@marko/babel-utils
Advanced tools
Comparing version 6.5.9 to 6.5.10
@@ -5,3 +5,2 @@ "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");function _getRequireWildcardCache(e) {if ("function" != typeof WeakMap) return null;var r = new WeakMap(),t = new WeakMap();return (_getRequireWildcardCache = function (e) {return e ? t : r;})(e);}function _interopRequireWildcard(e, r) {if (!r && e && e.__esModule) return e;if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };var t = _getRequireWildcardCache(r);if (t && t.has(e)) return t.get(e);var n = { __proto__: null },a = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];}return n.default = e, t && t.set(e, n), n;} | ||
const CODE_AS_WHITE_SPACE_KEY = Symbol(); | ||
@@ -116,3 +115,3 @@ function parseStatements( | ||
isExpression, | ||
str, | ||
code, | ||
sourceStart, | ||
@@ -123,12 +122,9 @@ sourceEnd, | ||
const { parserOpts } = file.opts; | ||
let code = str; | ||
if (typeof sourceStart === "number") { | ||
const whitespace = | ||
file.metadata.marko[CODE_AS_WHITE_SPACE_KEY] || ( | ||
file.metadata.marko[CODE_AS_WHITE_SPACE_KEY] = file.code.replace( | ||
/[^\s]/g, | ||
" " | ||
)); | ||
code = whitespace.slice(0, sourceStart - (sourceOffset || 0)) + str; | ||
const startIndex = sourceStart - (sourceOffset || 0); | ||
const startLoc = (0, _loc.getLoc)(file, startIndex); | ||
parserOpts.startIndex = startIndex; | ||
parserOpts.startColumn = startLoc.column; | ||
parserOpts.startLine = startLoc.line; | ||
@@ -153,2 +149,6 @@ try { | ||
} | ||
} finally { | ||
parserOpts.startIndex = 0; | ||
parserOpts.startColumn = 0; | ||
parserOpts.startLine = 1; | ||
} | ||
@@ -155,0 +155,0 @@ } else { |
@@ -271,7 +271,3 @@ "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.getTagTemplate = getTagTemplate;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 _compiler = require("@marko/compiler"); | ||
return file.___getMarkoFile( | ||
fs.readFileSync(filename).toString("utf-8"), | ||
createNewFileOpts(file.opts, filename), | ||
file.markoOpts | ||
); | ||
return resolveMarkoFile(file, filename); | ||
} | ||
@@ -297,10 +293,22 @@ } | ||
return file.___getMarkoFile( | ||
fs.readFileSync(filename).toString("utf-8"), | ||
createNewFileOpts(file.opts, filename), | ||
file.markoOpts | ||
); | ||
return resolveMarkoFile(file, filename); | ||
} | ||
} | ||
function resolveMarkoFile(file, filename) { | ||
if (filename === file.opts.filename) { | ||
if (file.___compileStage === "analyze") { | ||
return file; | ||
} | ||
return file.___getMarkoFile(file.code, file.opts, file.markoOpts); | ||
} | ||
return file.___getMarkoFile( | ||
file.markoOpts.fileSystem.readFileSync(filename).toString("utf-8"), | ||
createNewFileOpts(file.opts, filename), | ||
file.markoOpts | ||
); | ||
} | ||
const idCache = new WeakMap(); | ||
@@ -307,0 +315,0 @@ function getTemplateId(opts, request, child) { |
{ | ||
"name": "@marko/babel-utils", | ||
"version": "6.5.9", | ||
"version": "6.5.10", | ||
"description": "Utilities for use with Marko babel plugins.", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@marko/compiler": "^5.37.22" | ||
"@marko/compiler": "^5.37.23" | ||
}, | ||
@@ -39,0 +39,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51662
1493