Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-marko

Package Overview
Dependencies
Maintainers
6
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-marko - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

101

dist/index.js

@@ -397,15 +397,2 @@ "use strict";

var currentConfig;
function getCurrentCompiler() {
try {
return [
currentCompiler || (currentCompiler = rootRequire("@marko/compiler")),
currentConfig || (currentConfig = rootRequire("@marko/compiler/config").default)
];
} catch (cause) {
throw new Error(
"You must have @marko/compiler installed to use prettier-plugin-marko.",
{ cause }
);
}
}
var languages = [

@@ -467,34 +454,7 @@ {

async parse(text, opts) {
ensureCompiler();
const { filepath = defaultFilePath } = opts;
const [{ compile, types: t }, config] = getCurrentCompiler();
const translator = (() => {
try {
return rootRequire(config.translator);
} catch (err) {
throw new Error("Unable to find Marko translator.", { cause: err });
}
})();
const { compile, types: t } = currentCompiler;
const { ast } = await compile(`${text}
`, filepath, {
...config,
translator,
ast: true,
code: false,
optimize: false,
output: "source",
sourceMaps: false,
writeVersionComment: false,
babelConfig: {
caller: { name: "@marko/prettier" },
babelrc: false,
configFile: false,
parserOpts: {
allowUndeclaredExports: true,
allowAwaitOutsideFunction: true,
allowReturnOutsideFunction: true,
allowImportExportEverywhere: true,
plugins: ["exportDefaultFrom", "importAssertions"]
}
}
});
`, filepath, currentConfig);
opts.originalText = text;

@@ -915,5 +875,6 @@ opts.markoLinePositions = [0];

embed(path, opts) {
ensureCompiler();
const node = path.getNode();
const type = node == null ? void 0 : node.type;
const [{ types: t }] = getCurrentCompiler();
const { types: t } = currentCompiler;
switch (type) {

@@ -1225,4 +1186,4 @@ case "File":

getVisitorKeys(node) {
const [compiler] = getCurrentCompiler();
return compiler.types.VISITOR_KEYS[node.type] || emptyArr;
ensureCompiler();
return currentCompiler.types.VISITOR_KEYS[node.type] || emptyArr;
}

@@ -1233,3 +1194,3 @@ }

currentCompiler = compiler;
currentConfig = config;
setConfig(config);
}

@@ -1358,2 +1319,48 @@ function printSpecialDeclaration(path, prefix, opts, print) {

}
function ensureCompiler() {
if (!currentConfig) {
let config;
try {
currentCompiler = rootRequire("@marko/compiler");
config = rootRequire("@marko/compiler/config").default;
} catch (cause) {
throw new Error(
"You must have @marko/compiler installed to use prettier-plugin-marko.",
{ cause }
);
}
setConfig(config);
}
}
function setConfig(config) {
let { translator } = config;
if (typeof translator === "string") {
try {
translator = rootRequire(translator);
} catch {
}
}
currentConfig = {
...config,
translator,
ast: true,
code: false,
optimize: false,
output: "source",
sourceMaps: false,
writeVersionComment: false,
babelConfig: {
caller: { name: "@marko/prettier" },
babelrc: false,
configFile: false,
parserOpts: {
allowUndeclaredExports: true,
allowAwaitOutsideFunction: true,
allowReturnOutsideFunction: true,
allowImportExportEverywhere: true,
plugins: ["exportDefaultFrom", "importAssertions"]
}
}
};
}
// Annotate the CommonJS export names for ESM import in node:

@@ -1360,0 +1367,0 @@ 0 && (module.exports = {

{
"name": "prettier-plugin-marko",
"description": "A prettier plugin for parsing and printing Marko files",
"version": "3.1.1",
"version": "3.1.2",
"author": "Dylan Piercey <dpiercey@ebay.com>",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/marko-js/prettier/issues",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc