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

@marko/babel-utils

Package Overview
Dependencies
Maintainers
6
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marko/babel-utils - npm Package Compare versions

Comparing version 6.3.1 to 6.3.2

16

dist/assert.js

@@ -8,4 +8,4 @@ "use strict";exports.__esModule = true;exports.assertAllowedAttributes = assertAllowedAttributes;exports.assertNoArgs = assertNoArgs;exports.assertNoAttributeTags = assertNoAttributeTags;exports.assertNoAttributes = assertNoAttributes;exports.assertNoParams = assertNoParams;exports.assertNoVar = assertNoVar;function assertAllowedAttributes(path, allowed) {

buildCodeFrameError(
`Invalid "${node.name.value}" tag attribute: "${attr.name}".`);
`Invalid "${node.name.value}" tag attribute: "${attr.name}".`
);
}

@@ -25,5 +25,5 @@ });

throw path.hub.buildError(
{ loc: { start, end } },
"Tag does not support parameters.");
{ loc: { start, end } },
"Tag does not support parameters."
);
}

@@ -48,5 +48,5 @@ }

throw hub.buildError(
{ loc: { start, end } },
"Tag does not support arguments.");
{ loc: { start, end } },
"Tag does not support arguments."
);
}

@@ -53,0 +53,0 @@ }

@@ -23,4 +23,4 @@ "use strict";exports.__esModule = true;exports.computeNode = computeNode; /**

default:
return;}
return;
}
case "BigIntLiteral":

@@ -75,4 +75,4 @@ return { value: BigInt(node.value) };

default:
return;}
return;
}
}

@@ -96,4 +96,4 @@ case "UnaryExpression":{

default:
return;}
return;
}
}

@@ -113,4 +113,4 @@ case "LogicalExpression":{

default:
return;}
return;
}
}

@@ -155,4 +155,4 @@ case "ConditionalExpression":{

default:
return;}
return;
}
}

@@ -170,4 +170,4 @@

break;
}}
}
}
}

@@ -183,3 +183,3 @@

const arg = computeNode(elem.argument);
if (typeof (arg == null ? void 0 : (_arg$value = arg.value) == null ? void 0 : _arg$value[Symbol.iterator]) !== "function") return;
if (typeof (arg == null || (_arg$value = arg.value) == null ? void 0 : _arg$value[Symbol.iterator]) !== "function") return;
for (const item of arg.value) {

@@ -199,4 +199,4 @@ value.push(item);

return { value };
}}
}
}
}

@@ -33,4 +33,4 @@ "use strict";exports.__esModule = true;exports.DiagnosticType = void 0;exports.diagnosticDeprecate = diagnosticDeprecate;exports.diagnosticError = diagnosticError;exports.diagnosticSuggest = diagnosticSuggest;exports.diagnosticWarn = diagnosticWarn;const DiagnosticType = {

throw new Error(
"Diagnostic fixes can only be registered during the migrate stage.");
"Diagnostic fixes can only be registered during the migrate stage."
);
}

@@ -37,0 +37,0 @@

@@ -15,5 +15,5 @@ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.importDefault = importDefault;exports.importNamed = importNamed;exports.resolveRelativePath = resolveRelativePath;var _path = _interopRequireDefault(require("path"));

request = request.replace(
/(^|\/node-modules\/)marko\/src\//,
"$1marko/dist/");
/(^|\/node-modules\/)marko\/src\//,
"$1marko/dist/"
);
}

@@ -31,8 +31,8 @@

imports.set(
request,
importDeclaration = file.path.pushContainer(
"body",
_compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)))[
0]);
request,
importDeclaration = file.path.pushContainer(
"body",
_compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
)[0]
);
}

@@ -46,11 +46,11 @@

const specifier = specifiers.find((specifier) =>
specifier.isImportDefaultSpecifier());
specifier.isImportDefaultSpecifier()
);
if (!specifier) {
const identifier = file.scope.generateUidIdentifier(nameHint);
importDeclaration.pushContainer(
"specifiers",
_compiler.types.importDefaultSpecifier(identifier));
"specifiers",
_compiler.types.importDefaultSpecifier(identifier)
);
return identifier;

@@ -69,8 +69,8 @@ }

imports.set(
request,
importDeclaration = file.path.pushContainer(
"body",
_compiler.types.importDeclaration([], _compiler.types.stringLiteral(request)))[
0]);
request,
importDeclaration = file.path.pushContainer(
"body",
_compiler.types.importDeclaration([], _compiler.types.stringLiteral(request))
)[0]
);
}

@@ -80,12 +80,12 @@

const specifier = specifiers.find(
(specifier) =>
specifier.isImportSpecifier() && specifier.node.imported.name === name);
(specifier) =>
specifier.isImportSpecifier() && specifier.node.imported.name === name
);
if (!specifier) {
const identifier = file.scope.generateUidIdentifier(nameHint);
importDeclaration.pushContainer(
"specifiers",
_compiler.types.importSpecifier(identifier, _compiler.types.identifier(name)));
"specifiers",
_compiler.types.importSpecifier(identifier, _compiler.types.identifier(name))
);
return identifier;

@@ -92,0 +92,0 @@ }

@@ -1,2 +0,2 @@

"use strict";exports.__esModule = true;exports.parseArgs = parseArgs;exports.parseExpression = parseExpression;exports.parseParams = parseParams;exports.parseStatements = parseStatements;exports.parseTemplateLiteral = parseTemplateLiteral;exports.parseVar = parseVar;var babelParser = _interopRequireWildcard(require("@babel/parser"));
"use strict";exports.__esModule = true;exports.parseArgs = parseArgs;exports.parseExpression = parseExpression;exports.parseParams = parseParams;exports.parseStatements = parseStatements;exports.parseTemplateLiteral = parseTemplateLiteral;exports.parseTypeArgs = parseTypeArgs;exports.parseTypeParams = parseTypeParams;exports.parseVar = parseVar;var babelParser = _interopRequireWildcard(require("@babel/parser"));
var _loc = require("./loc");

@@ -29,9 +29,9 @@ var _compiler = require("@marko/compiler");function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function (nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}

const parsed = parseExpression(
file,
`(${str})=>{}`,
sourceStart,
sourceEnd,
1);
file,
`(${str})=>{}`,
sourceStart,
sourceEnd,
1
);
if (parsed.type === "ArrowFunctionExpression") {

@@ -56,9 +56,9 @@ return parsed.params;

const parsed = parseExpression(
file,
`(${str})=>{}`,
sourceStart,
sourceEnd,
1);
file,
`(${str})=>{}`,
sourceStart,
sourceEnd,
1
);
if (parsed.type === "ArrowFunctionExpression" && parsed.params.length === 1) {

@@ -73,9 +73,9 @@ return parsed.params[0];

const parsed = parseExpression(
file,
"`" + str + "`",
sourceStart,
sourceEnd,
1);
file,
"`" + str + "`",
sourceStart,
sourceEnd,
1
);
if (parsed.type === "TemplateLiteral") {

@@ -88,2 +88,29 @@ return parsed;

function parseTypeArgs(file, str, sourceStart, sourceEnd) {
const parsed = parseExpression(file, `_<${str}>`, sourceStart, sourceEnd, 2);
if (parsed.type === "TSInstantiationExpression") {
// typeArguments is Flow only (not TS), we need to use typeParameters
return parsed.typeParameters;
}
return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
}
function parseTypeParams(file, str, sourceStart, sourceEnd) {
const parsed = parseExpression(
file,
`<${str}>()=>{}`,
sourceStart,
sourceEnd,
1
);
if (parsed.type === "ArrowFunctionExpression") {
return parsed.typeParameters;
}
return [ensureParseError(file, parsed, sourceStart, sourceEnd)];
}
function tryParse(

@@ -104,10 +131,10 @@ file,

file.metadata.marko[CODE_AS_WHITE_SPACE_KEY] = file.code.replace(
/[^\s]/g,
" "));
/[^\s]/g,
" "
));
code =
whitespace.slice(
0,
sourceOffset ? sourceStart - sourceOffset : sourceStart) +
str;
0,
sourceOffset ? sourceStart - sourceOffset : sourceStart
) + str;

@@ -120,9 +147,9 @@ try {

const parseError = createParseError(
file,
sourceStart,
sourceEnd,
err.message,
err.loc);
file,
sourceStart,
sourceEnd,
err.message,
err.loc
);
if (isExpression) {

@@ -146,7 +173,7 @@ return parseError;

return createParseError(
file,
sourceStart,
sourceEnd,
`Unexpected node of type ${node.type} returned while parsing.`);
file,
sourceStart,
sourceEnd,
`Unexpected node of type ${node.type} returned while parsing.`
);
}

@@ -153,0 +180,0 @@

@@ -17,5 +17,5 @@ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.findAttributeTags = findAttributeTags;exports.findParentTag = findParentTag;exports.getArgOrSequence = getArgOrSequence;exports.getFullyResolvedTagName = getFullyResolvedTagName;exports.getMacroIdentifier = getMacroIdentifier;exports.getMacroIdentifierForName = getMacroIdentifierForName;exports.getTagDef = getTagDef;exports.getTemplateId = getTemplateId;exports.hasMacro = hasMacro;exports.isAttributeTag = isAttributeTag;exports.isDynamicTag = isDynamicTag;exports.isLoopTag = isLoopTag;exports.isMacroTag = isMacroTag;exports.isNativeTag = isNativeTag;exports.isTransparentTag = isTransparentTag;exports.loadFileForImport = loadFileForImport;exports.loadFileForTag = loadFileForTag;exports.registerMacro = registerMacro;exports.resolveTagImport = resolveTagImport;var _path = require("path");

"else-if",
"_no-update"]);
"_no-update"]
);
const CWD = process.cwd();

@@ -68,4 +68,4 @@ let ROOT = CWD;

throw path.buildCodeFrameError(
`A macro with the name "${name}" already exists.`);
`A macro with the name "${name}" already exists.`
);
}

@@ -93,4 +93,4 @@ macroNames[name] = true;

throw new Error(
"getMacroIdentifierForName can only be called during the translate phase of the compiler.");
"getMacroIdentifierForName can only be called during the translate phase of the compiler."
);
}

@@ -113,4 +113,4 @@

throw new Error(
"<macro> was added programmatically, but was not registered via the 'registerMacro' api in @marko/babel-utils.");
"<macro> was added programmatically, but was not registered via the 'registerMacro' api in @marko/babel-utils."
);
}

@@ -126,4 +126,4 @@

throw new Error(
"getMacroIdentifier can only be called during the translate phase of the compiler.");
"getMacroIdentifier can only be called during the translate phase of the compiler."
);
}

@@ -133,4 +133,4 @@

throw path.buildCodeFrameError(
"getMacroIdentifier called on non macro referencing tag.");
"getMacroIdentifier called on non macro referencing tag."
);
}

@@ -153,5 +153,5 @@

(0, _taglib.getTagDefForTagName)(
file,
isAttributeTag(path) ? getFullyResolvedTagName(path) : node.name.value) ||
null;
file,
isAttributeTag(path) ? getFullyResolvedTagName(path) : node.name.value
) || null;
}

@@ -247,6 +247,6 @@ }

return file.___getMarkoFile(
fs.readFileSync(filename).toString("utf-8"),
createNewFileOpts(file.opts, filename),
file.markoOpts);
fs.readFileSync(filename).toString("utf-8"),
createNewFileOpts(file.opts, filename),
file.markoOpts
);
}

@@ -265,6 +265,6 @@ }

return file.___getMarkoFile(
fs.readFileSync(filename).toString("utf-8"),
createNewFileOpts(file.opts, filename),
file.markoOpts);
fs.readFileSync(filename).toString("utf-8"),
createNewFileOpts(file.opts, filename),
file.markoOpts
);
}

@@ -295,4 +295,4 @@ }

throw path.buildCodeFrameError(
`Unable to find entry point for custom tag <${tagName}>.`);
`Unable to find entry point for custom tag <${tagName}>.`
);
}

@@ -299,0 +299,0 @@

@@ -14,6 +14,6 @@ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.normalizeTemplateString = normalizeTemplateString;var _jsesc = _interopRequireDefault(require("jsesc"));

quasis.splice(
i + 1,
0,
...v.quasis.slice(1, -1).map((q) => q.value.cooked));
i + 1,
0,
...v.quasis.slice(1, -1).map((q) => q.value.cooked)
);
expressions.splice(i, 1, ...v.expressions);

@@ -20,0 +20,0 @@ i += v.expressions.length;

{
"name": "@marko/babel-utils",
"version": "6.3.1",
"version": "6.3.2",
"description": "Utilities for use with Marko babel plugins.",

@@ -36,3 +36,3 @@ "keywords": [

"devDependencies": {
"@marko/compiler": "^5.32.0"
"@marko/compiler": "^5.33.5"
},

@@ -39,0 +39,0 @@ "publishConfig": {

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