@marko/compiler 5.16.0 → 5.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel-plugin/index.js +1 -1
- package/dist/babel-types/traverse/patch.js +16 -14
- package/dist/babel-types/traverse/patch.js.map +1 -1
- package/dist/babel-types/types/definitions.js +1 -1
- package/dist/babel-types/types/patch.js +3 -2
- package/dist/babel-types/types/patch.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/taglib/finder/index.js +4 -4
- package/dist/taglib/finder/index.js.map +1 -1
- package/dist/taglib/fs.js +1 -1
- package/dist/taglib/index.js +3 -2
- package/dist/taglib/index.js.map +1 -1
- package/dist/types.d.ts +23 -10
- package/package.json +13 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;exports.getMarkoFile = getMarkoFile;var _path = _interopRequireDefault(require("path"));
|
|
2
2
|
var _crypto = require("crypto");
|
|
3
3
|
var t = _interopRequireWildcard(require("../babel-types"));
|
|
4
4
|
var _babelUtils = require("@marko/babel-utils");
|
|
@@ -37,6 +37,7 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
37
37
|
const path = this.path;
|
|
38
38
|
const originalTraverse = path.traverse;
|
|
39
39
|
path.traverse = function (visitor, state) {
|
|
40
|
+
state.hoistableTagVarsByScope = new Map();
|
|
40
41
|
path.traverse = originalTraverse;
|
|
41
42
|
|
|
42
43
|
if (!patchedVisitors.has(visitor)) {
|
|
@@ -49,7 +50,7 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
49
50
|
body.scope.registerBinding("param", param);
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
|
-
MarkoTag(tag) {
|
|
53
|
+
MarkoTag(tag, state) {
|
|
53
54
|
const tagVar = tag.get("var");
|
|
54
55
|
if (tagVar.node) {
|
|
55
56
|
tag.scope.registerBinding("local", tagVar, tag);
|
|
@@ -58,17 +59,17 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
58
59
|
const binding = curScope.getBinding(name);
|
|
59
60
|
|
|
60
61
|
while (curScope = curScope.parent) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
curScope.hoistableTagVars[name] = true;
|
|
69
|
-
}
|
|
62
|
+
const hoistableTagVars =
|
|
63
|
+
state.hoistableTagVarsByScope.get(curScope);
|
|
64
|
+
|
|
65
|
+
if (hoistableTagVars) {
|
|
66
|
+
hoistableTagVars[name] = hoistableTagVars[name] ?
|
|
67
|
+
true :
|
|
68
|
+
binding;
|
|
70
69
|
} else {
|
|
71
|
-
curScope
|
|
70
|
+
state.hoistableTagVarsByScope.set(curScope, {
|
|
71
|
+
[name]: binding });
|
|
72
|
+
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -87,9 +88,10 @@ _traverse.Scope.prototype.crawl = function () {
|
|
|
87
88
|
let curScope = ref.scope;
|
|
88
89
|
if (curScope.hasBinding(name)) continue;
|
|
89
90
|
|
|
90
|
-
do {
|
|
91
|
-
const hoistableBinding =
|
|
92
|
-
curScope
|
|
91
|
+
do {var _state$hoistableTagVa;
|
|
92
|
+
const hoistableBinding = (_state$hoistableTagVa =
|
|
93
|
+
state.hoistableTagVarsByScope.get(curScope)) == null ? void 0 : _state$hoistableTagVa[name];
|
|
94
|
+
|
|
93
95
|
if (hoistableBinding) {
|
|
94
96
|
if (hoistableBinding === true) {
|
|
95
97
|
throw ref.buildCodeFrameError(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/babel-types/traverse/patch.js"],"names":["MARKO_TYPES","forEach","typeName","checkKey","assertKey","checkFn","t","assertFn","NodePath","prototype","opts","node","MARKO_ALIAS_TYPES","aliasName","originalProtoCheck","is","call","originalCrawl","Scope","crawl","patchedVisitors","WeakSet","path","originalTraverse","traverse","visitor","state","has","add","Object","assign","explode","MarkoTagBody","body","param","get","scope","registerBinding","MarkoTag","tag","tagVar","name","getBindingIdentifiers","curScope","binding","getBinding","parent","hoistableTagVars","
|
|
1
|
+
{"version":3,"sources":["../../../src/babel-types/traverse/patch.js"],"names":["MARKO_TYPES","forEach","typeName","checkKey","assertKey","checkFn","t","assertFn","NodePath","prototype","opts","node","MARKO_ALIAS_TYPES","aliasName","originalProtoCheck","is","call","originalCrawl","Scope","crawl","patchedVisitors","WeakSet","path","originalTraverse","traverse","visitor","state","hoistableTagVarsByScope","Map","has","add","Object","assign","explode","MarkoTagBody","body","param","get","scope","registerBinding","MarkoTag","tag","tagVar","name","getBindingIdentifiers","curScope","binding","getBinding","parent","hoistableTagVars","set","references","length","movedBindings","ref","hasBinding","hoistableBinding","buildCodeFrameError","movedBinding","getScopeDepth","moveBindingTo","identifier","depth","cur"],"mappings":"aAAA;;AAEA;AACA;AACA,mD;;AAEAA,yBAAYC,OAAZ,CAAoB,CAAAC,QAAQ,KAAI;AAC9B,QAAMC,QAAQ,GAAI,KAAID,QAAS,EAA/B;AACA,QAAME,SAAS,GAAI,SAAQF,QAAS,EAApC;AACA,QAAMG,OAAO,GAAGC,CAAC,CAACH,QAAD,CAAjB;AACA,QAAMI,QAAQ,GAAGD,CAAC,CAACF,SAAD,CAAlB;AACAI,qBAASC,SAAT,CAAmBN,QAAnB,IAA+B,UAAUO,IAAV,EAAgB;AAC7C,WAAOL,OAAO,CAAC,KAAKM,IAAN,EAAYD,IAAZ,CAAd;AACD,GAFD;AAGAF,qBAASC,SAAT,CAAmBL,SAAnB,IAAgC,UAAUM,IAAV,EAAgB;AAC9CH,IAAAA,QAAQ,CAAC,KAAKI,IAAN,EAAYD,IAAZ,CAAR;AACD,GAFD;AAGD,CAXD;;AAaAE,+BAAkBX,OAAlB,CAA0B,CAAAY,S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, Scope } from \"@babel/traverse\";\nimport { MARKO_TYPES, MARKO_ALIAS_TYPES } from \"../types/definitions\";\n\nMARKO_TYPES.forEach(typeName => {\n const checkKey = `is${typeName}`;\n const assertKey = `assert${typeName}`;\n const checkFn = t[checkKey];\n const assertFn = t[assertKey];\n NodePath.prototype[checkKey] = function (opts) {\n return checkFn(this.node, opts);\n };\n NodePath.prototype[assertKey] = function (opts) {\n assertFn(this.node, opts);\n };\n});\n\nMARKO_ALIAS_TYPES.forEach(aliasName => {\n const checkKey = `is${aliasName}`;\n const originalProtoCheck = NodePath.prototype[checkKey];\n NodePath.prototype[checkKey] = function (opts) {\n return (\n t.is(aliasName, this.node, opts) ||\n originalProtoCheck.call(this, this.node, opts)\n );\n };\n});\n\n// Adds a one time patch to the scope collector visitors to include\n// Marko bindings for params and tag vars.\nconst originalCrawl = Scope.prototype.crawl;\nconst patchedVisitors = new WeakSet();\n\nScope.prototype.crawl = function () {\n const path = this.path;\n const originalTraverse = path.traverse;\n path.traverse = function (visitor, state) {\n state.hoistableTagVarsByScope = new Map();\n path.traverse = originalTraverse;\n\n if (!patchedVisitors.has(visitor)) {\n patchedVisitors.add(visitor);\n Object.assign(\n traverse.explode(visitor),\n traverse.explode({\n MarkoTagBody(body) {\n for (const param of body.get(\"params\")) {\n body.scope.registerBinding(\"param\", param);\n }\n },\n MarkoTag(tag, state) {\n const tagVar = tag.get(\"var\");\n if (tagVar.node) {\n tag.scope.registerBinding(\"local\", tagVar, tag);\n for (const name in tagVar.getBindingIdentifiers()) {\n let curScope = tag.scope;\n const binding = curScope.getBinding(name);\n\n while ((curScope = curScope.parent)) {\n const hoistableTagVars =\n state.hoistableTagVarsByScope.get(curScope);\n\n if (hoistableTagVars) {\n hoistableTagVars[name] = hoistableTagVars[name]\n ? true\n : binding;\n } else {\n state.hoistableTagVarsByScope.set(curScope, {\n [name]: binding\n });\n }\n }\n }\n }\n }\n })\n );\n }\n\n this.traverse(visitor, state);\n\n if (state.references.length) {\n const movedBindings = new Map();\n for (const ref of state.references) {\n const { name } = ref.node;\n let curScope = ref.scope;\n if (curScope.hasBinding(name)) continue;\n\n do {\n const hoistableBinding =\n state.hoistableTagVarsByScope.get(curScope)?.[name];\n\n if (hoistableBinding) {\n if (hoistableBinding === true) {\n throw ref.buildCodeFrameError(\n \"Ambiguous reference, variable was defined in multiple places and was not shadowed.\"\n );\n }\n\n const movedBinding = movedBindings.get(hoistableBinding);\n if (\n !movedBinding ||\n getScopeDepth(movedBinding) < getScopeDepth(curScope)\n ) {\n movedBindings.set(hoistableBinding, curScope);\n }\n }\n } while ((curScope = curScope.parent));\n }\n\n for (const [binding, scope] of movedBindings) {\n binding.scope.moveBindingTo(binding.identifier.name, scope);\n }\n }\n };\n\n originalCrawl.call(this);\n path.traverse = originalTraverse;\n};\n\nfunction getScopeDepth(scope) {\n let depth = 0;\n let cur = scope;\n while ((cur = cur.parent)) depth++;\n return depth;\n}\n"],"file":"patch.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.
|
|
1
|
+
"use strict";exports.__esModule = true;exports.default = exports.MARKO_TYPES = exports.MARKO_ALIAS_TYPES = void 0;var _utils = require("@babel/types/lib/definitions/utils");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -36,8 +36,9 @@ _definitions.MARKO_TYPES.forEach((typeName) => {
|
|
|
36
36
|
const assertKey = `assert${typeName}`;
|
|
37
37
|
babelTypes[checkKey] = (node, opts) => is(typeName, node, opts);
|
|
38
38
|
babelTypes[assertKey] = (node, opts) => assert(typeName, node, opts);
|
|
39
|
-
babelTypes[typeName] = babelTypes[lowerName] = (
|
|
40
|
-
|
|
39
|
+
babelTypes[typeName] = babelTypes[lowerName] = function () {
|
|
40
|
+
return _builder.default.apply(typeName, arguments);
|
|
41
|
+
};
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
_definitions.MARKO_ALIAS_TYPES.forEach((aliasName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/babel-types/types/patch.js"],"names":["TYPES","VISITOR_KEYS","FLIPPED_ALIAS_KEYS","DEPRECATED_KEYS","is","getBindingIdentifiers","babelTypes","keys","MARKO_TYPES","forEach","typeName","definitions","type","Object","includes","push","lowerName","toLowerCase","slice","checkKey","assertKey","node","opts","assert","
|
|
1
|
+
{"version":3,"sources":["../../../src/babel-types/types/patch.js"],"names":["TYPES","VISITOR_KEYS","FLIPPED_ALIAS_KEYS","DEPRECATED_KEYS","is","getBindingIdentifiers","babelTypes","keys","MARKO_TYPES","forEach","typeName","definitions","type","Object","includes","push","lowerName","toLowerCase","slice","checkKey","assertKey","node","opts","assert","builder","apply","arguments","MARKO_ALIAS_TYPES","aliasName","originalCheck","generatedValidators","originalIsReferenced","referencedValidators","default","parent","grandparent","Error","JSON","stringify"],"mappings":";AACA;AACA;AACA;AACA;AACA;AACA,qE,yjCANA;;AAQA,MAAM;AACJA,EAAAA,KADI;AAEJC,EAAAA,YAFI;AAGJC,EAAAA,kBAHI;AAIJC,EAAAA,eAJI;AAKJC,EAAAA,EALI;AAMJC,EAAAA,qBANI;AAOFC,UAPJ;;AASAD,qBAAqB,CAACE,IAAtB,CAA2B,UAA3B,IAAyC,CAAC,KAAD,CAAzC;AACAF,qBAAqB,CAACE,IAAtB,CAA2B,cAA3B,IAA6C,CAAC,QAAD,CAA7C;;AAEAC,yBAAYC,OAAZ,CAAoB,CAAAC,QAAQ,KAAI;AAC9B,sBAAWA,QAAX,EAAqBC,qBAAYD,QAAZ,CAArB;AACD,CAFD;;AAIA,KAAK,MAAME,IAAX,IAAmB;AACjB,GAAGC,MAAM,CAACN,IAAP,CAAYN,YAAZ,CADc;AAEjB,GAAGY,MAAM,CAACN,IAAP,CAAYL,kBAAZ,CAFc;AAGjB,GAAGW,MAAM,CAACN,IAAP,CAAYJ,eAAZ,CAHc,CAAnB;AAIG;AACD,MAAI,CAACH,KAAK,CAACc,QAAN,CAAeF,IAAf,CAAL,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B;AAC5D,MAAID,MAAM,CAACtB,IAAP,KAAgB,UAAhB,IAA8BsB,MAAM,CAACtB,IAAP,KAAgB,cAAlD,EAAkE;AAChE,WAAO,KAAP;AACD;AACD,SAAOmB,oBAAoB,CAACV,IAAD,EAAOa,MAAP,EAAeC,WAAf,CAA3B;AACD,CALD;;AAOA,SAASZ,MAAT,CAAgBb,QAAhB,EAA0BW,IAA1B,EAAgCC,IAAhC,EAAsC;AACpC,MAAI,CAAClB,EAAE,CAACM,QAAD,EAAWW,IAAX,EAAiBC,IAAjB,CAAP,EAA+B;AAC7B,UAAM,IAAIc,KAAJ;AACH,sBAAiB1B,QAAS,iBAAgB2B,IAAI,CAACC,SAAL;AACzChB,IAAAA,IADyC;AAEzC,0BAAqBD,IAAI,CAACT,IAAK,IAH7B,CAAN;;AAKD;AACF","sourcesContent":["/* eslint-disable no-import-assign */\nimport * as babelTypes from \"@babel/types\";\nimport builder from \"@babel/types/lib/builders/builder\";\nimport defineType from \"@babel/types/lib/definitions/utils\";\nimport * as generatedValidators from \"@babel/types/lib/validators/generated\";\nimport * as referencedValidators from \"@babel/types/lib/validators/isReferenced\";\nimport definitions, { MARKO_TYPES, MARKO_ALIAS_TYPES } from \"./definitions\";\n\nconst {\n TYPES,\n VISITOR_KEYS,\n FLIPPED_ALIAS_KEYS,\n DEPRECATED_KEYS,\n is,\n getBindingIdentifiers\n} = babelTypes;\n\ngetBindingIdentifiers.keys[\"MarkoTag\"] = [\"var\"];\ngetBindingIdentifiers.keys[\"MarkoTagBody\"] = [\"params\"];\n\nMARKO_TYPES.forEach(typeName => {\n defineType(typeName, definitions[typeName]);\n});\n\nfor (const type of [\n ...Object.keys(VISITOR_KEYS),\n ...Object.keys(FLIPPED_ALIAS_KEYS),\n ...Object.keys(DEPRECATED_KEYS)\n]) {\n if (!TYPES.includes(type)) TYPES.push(type);\n}\n\nMARKO_TYPES.forEach(typeName => {\n const lowerName = typeName[0].toLowerCase() + typeName.slice(1);\n const checkKey = `is${typeName}`;\n const assertKey = `assert${typeName}`;\n babelTypes[checkKey] = (node, opts) => is(typeName, node, opts);\n babelTypes[assertKey] = (node, opts) => assert(typeName, node, opts);\n babelTypes[typeName] = babelTypes[lowerName] = function () {\n return builder.apply(typeName, arguments);\n };\n});\n\nMARKO_ALIAS_TYPES.forEach(aliasName => {\n const checkKey = `is${aliasName}`;\n const originalCheck = generatedValidators[checkKey];\n generatedValidators[checkKey] = (node, opts) =>\n is(aliasName, node, opts) || originalCheck(node, opts);\n});\n\nconst originalIsReferenced = referencedValidators.default;\nreferencedValidators.default = (node, parent, grandparent) => {\n if (parent.type === \"MarkoTag\" || parent.type === \"MarkoTagBody\") {\n return false;\n }\n return originalIsReferenced(node, parent, grandparent);\n};\n\nfunction assert(typeName, node, opts) {\n if (!is(typeName, node, opts)) {\n throw new Error(\n `Expected type \"${typeName}\" with option ${JSON.stringify(\n opts\n )}, but instead got \"${node.type}\".`\n );\n }\n}\n"],"file":"patch.js"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports._clearDefaults = _clearDefaults;exports.compile = compile;exports.compileFile = compileFile;exports.compileFileSync = compileFileSync;exports.compileSync = compileSync;exports.configure = configure;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.types = exports.taglib = void 0;var _types = _interopRequireWildcard(require("./babel-types"));exports.types = _types;
|
|
2
2
|
var _path = _interopRequireDefault(require("path"));
|
|
3
3
|
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
4
4
|
var _babelPlugin = _interopRequireDefault(require("./babel-plugin"));
|
|
@@ -65,15 +65,15 @@ function find(dirname, registeredTaglibs) {
|
|
|
65
65
|
var added = {};
|
|
66
66
|
|
|
67
67
|
var helper = {
|
|
68
|
-
alreadyAdded: function (
|
|
69
|
-
return hasOwnProperty.call(added,
|
|
68
|
+
alreadyAdded: function (taglibId) {
|
|
69
|
+
return hasOwnProperty.call(added, taglibId);
|
|
70
70
|
},
|
|
71
71
|
addTaglib: function (taglib) {
|
|
72
|
-
if (added[taglib.
|
|
72
|
+
if (added[taglib.id]) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
added[taglib.
|
|
76
|
+
added[taglib.id] = true;
|
|
77
77
|
found.push(taglib);
|
|
78
78
|
},
|
|
79
79
|
foundTaglibPackages: {} };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/taglib/finder/index.js"],"names":["nodePath","require","resolveFrom","silent","taglibFS","taglibLoader","lassoPackageRoot","scanTagsDir","DependencyChain","hasOwnProperty","Object","prototype","findCache","excludedDirs","excludedPackages","reset","clearCache","getModuleRootPackage","dirname","getRootPackage","e","undefined","getAllDependencyNames","pkg","map","dependencies","keys","forEach","name","peerDependencies","devDependencies","find","registeredTaglibs","found","added","helper","alreadyAdded","
|
|
1
|
+
{"version":3,"sources":["../../../src/taglib/finder/index.js"],"names":["nodePath","require","resolveFrom","silent","taglibFS","taglibLoader","lassoPackageRoot","scanTagsDir","DependencyChain","hasOwnProperty","Object","prototype","findCache","excludedDirs","excludedPackages","reset","clearCache","getModuleRootPackage","dirname","getRootPackage","e","undefined","getAllDependencyNames","pkg","map","dependencies","keys","forEach","name","peerDependencies","devDependencies","find","registeredTaglibs","found","added","helper","alreadyAdded","taglibId","call","addTaglib","taglib","id","push","foundTaglibPackages","rootDirname","process","cwd","rootPkg","__dirname","curDirname","taglibPath","join","existsSync","loadTaglibFromFile","tagsDir","componentsPath","createTaglib","parentDirname","concat","excludeDir","dir","excludePackage","file","curFS","statSync","_","exports"],"mappings":"AAAA;AACA,IAAIA,QAAQ,GAAGC,OAAO,CAAC,MAAD,CAAtB;AACA,IAAIC,WAAW,GAAGD,OAAO,CAAC,cAAD,CAAP,CAAwBE,MAA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,cAAzB","sourcesContent":["\"use strict\";\nvar nodePath = require(\"path\");\nvar resolveFrom = require(\"resolve-from\").silent;\nvar taglibFS = require(\"../fs\");\nvar taglibLoader = require(\"../loader\");\nvar lassoPackageRoot = require(\"lasso-package-root\");\nvar scanTagsDir = require(\"../loader/scanTagsDir\");\nvar DependencyChain = require(\"../loader/DependencyChain\");\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar findCache = {};\nvar excludedDirs = {};\nvar excludedPackages = {};\n\n/**\n * Reset all internal state to the default state. This\n * was added for testing purposes.\n */\nfunction reset() {\n clearCache();\n excludedDirs = {};\n excludedPackages = {};\n}\n\nfunction getModuleRootPackage(dirname) {\n try {\n return lassoPackageRoot.getRootPackage(dirname);\n } catch (e) {\n return undefined;\n }\n}\n\nfunction getAllDependencyNames(pkg) {\n var map = {};\n\n if (pkg.dependencies) {\n Object.keys(pkg.dependencies).forEach(name => {\n map[name] = true;\n });\n }\n\n if (pkg.peerDependencies) {\n Object.keys(pkg.peerDependencies).forEach(name => {\n map[name] = true;\n });\n }\n\n if (pkg.devDependencies) {\n Object.keys(pkg.devDependencies).forEach(name => {\n map[name] = true;\n });\n }\n\n return Object.keys(map);\n}\n\nfunction find(dirname, registeredTaglibs) {\n var found = findCache[dirname];\n if (found) {\n return found;\n }\n\n found = [];\n\n var added = {};\n\n var helper = {\n alreadyAdded: function (taglibId) {\n return hasOwnProperty.call(added, taglibId);\n },\n addTaglib: function (taglib) {\n if (added[taglib.id]) {\n return;\n }\n\n added[taglib.id] = true;\n found.push(taglib);\n },\n foundTaglibPackages: {}\n };\n\n var rootDirname = process.cwd(); // Don't search up past this directory\n var rootPkg = getModuleRootPackage(dirname);\n if (rootPkg) {\n rootDirname = rootPkg.__dirname; // Use the package's root directory as the top-level directory\n }\n\n // First walk up the directory tree looking for marko.json files or components/ directories\n let curDirname = dirname;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (!excludedDirs[curDirname]) {\n let taglibPath = nodePath.join(curDirname, \"marko.json\");\n let taglib;\n\n if (existsSync(taglibPath)) {\n taglib = taglibLoader.loadTaglibFromFile(taglibPath);\n helper.addTaglib(taglib);\n }\n\n if (!taglib || taglib.tagsDir === undefined) {\n let componentsPath = nodePath.join(curDirname, \"components\");\n\n if (\n existsSync(componentsPath) &&\n !excludedDirs[componentsPath] &&\n !helper.alreadyAdded(componentsPath)\n ) {\n let taglib = taglibLoader.createTaglib(componentsPath);\n scanTagsDir(\n componentsPath,\n nodePath.dirname(componentsPath),\n \"components\",\n taglib,\n new DependencyChain([componentsPath])\n );\n helper.addTaglib(taglib);\n }\n }\n }\n\n if (curDirname === rootDirname) {\n break;\n }\n\n let parentDirname = nodePath.dirname(curDirname);\n if (!parentDirname || parentDirname === curDirname) {\n break;\n }\n curDirname = parentDirname;\n }\n\n if (rootPkg) {\n // Now look for `marko.json` from installed packages\n getAllDependencyNames(rootPkg).forEach(name => {\n if (!excludedPackages[name]) {\n let taglibPath = resolveFrom(\n rootPkg.__dirname,\n nodePath.join(name, \"marko.json\")\n );\n if (taglibPath) {\n var taglib = taglibLoader.loadTaglibFromFile(taglibPath);\n helper.addTaglib(taglib);\n }\n }\n });\n }\n\n found = found.concat(registeredTaglibs);\n\n findCache[dirname] = found;\n\n return found;\n}\n\nfunction clearCache() {\n findCache = {};\n}\n\nfunction excludeDir(dir) {\n excludedDirs[dir] = true;\n}\n\nfunction excludePackage(name) {\n excludedPackages[name] = true;\n}\n\nfunction existsSync(file) {\n try {\n taglibFS.curFS.statSync(file);\n return true;\n } catch (_) {\n return false;\n }\n}\n\nexports.reset = reset;\nexports.find = find;\nexports.clearCache = clearCache;\nexports.excludeDir = excludeDir;\nexports.excludePackage = excludePackage;\n"],"file":"index.js"}
|
package/dist/taglib/fs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.
|
|
1
|
+
"use strict";exports.__esModule = true;exports.curFS = void 0;exports.setFS = setFS;let curFS;exports.curFS = curFS;
|
|
2
2
|
function setFS(fs) {
|
|
3
3
|
exports.curFS = curFS = fs;
|
|
4
4
|
}
|
package/dist/taglib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports._loader = exports._finder = void 0;exports.buildLookup = buildLookup;exports.clearCaches = clearCaches;exports.excludePackage = exports.excludeDir = void 0;exports.register = register;var _loader2 = _interopRequireDefault(require("./loader"));
|
|
2
2
|
var _finder2 = _interopRequireDefault(require("./finder"));
|
|
3
3
|
var _lookup = _interopRequireDefault(require("./lookup"));
|
|
4
4
|
var _tryLoadTranslator = _interopRequireDefault(require("../util/try-load-translator"));
|
|
@@ -39,7 +39,8 @@ function buildLookup(dirname, requestedTranslator) {
|
|
|
39
39
|
|
|
40
40
|
if (!lookup) {
|
|
41
41
|
lookup = lookupCache[cacheKey] = new _lookup.default();
|
|
42
|
-
for (
|
|
42
|
+
for (let i = taglibsForDir.length; i--;) {
|
|
43
|
+
const taglib = taglibsForDir[i];
|
|
43
44
|
lookup.addTaglib(taglib);
|
|
44
45
|
if (taglib.imports) {
|
|
45
46
|
for (const importedTaglib of taglib.imports) {
|
package/dist/taglib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/taglib/index.js"],"names":["excludeDir","finder","excludePackage","registeredTaglibs","loadedTranslatorsTaglibs","Map","lookupCache","Object","create","register","require","resolve","buildLookup","dirname","requestedTranslator","translator","Array","isArray","taglibs","Error","has","set","map","id","props","loadTaglib","taglibsForDir","find","concat","get","cacheKey","it","join","lookup","Lookup","taglib","addTaglib","imports","importedTaglib","hasTaglib","push","clearCaches","loader","clearCache","_loader","_finder","loadTaglibFromProps","createTaglib"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/taglib/index.js"],"names":["excludeDir","finder","excludePackage","registeredTaglibs","loadedTranslatorsTaglibs","Map","lookupCache","Object","create","register","require","resolve","buildLookup","dirname","requestedTranslator","translator","Array","isArray","taglibs","Error","has","set","map","id","props","loadTaglib","taglibsForDir","find","concat","get","cacheKey","it","join","lookup","Lookup","i","length","taglib","addTaglib","imports","importedTaglib","hasTaglib","push","clearCaches","loader","clearCache","_loader","_finder","loadTaglibFromProps","createTaglib"],"mappings":"4TAAA;AACA;AACA;AACA;;AAEO,MAAMA,UAAU,GAAGC,iBAAOD,UAA1B,C;AACA,MAAME,cAAc,GAAGD,iBAAOC,cAA9B,C;;AAEP,MAAMC,iBAAiB,GAAG,EAA1B;AACA,MAAMC,wBAAwB,GAAG,IAAIC,GAAJ,EAAjC;AACA,IAAIC,WAAW,GAAGC,MAAM,CAACC,MAAP,CAAc,IAAd,CAAlB;;AAEAC,QAAQ,CAACC,OAAO,CAACC,OAAR,CAAgB,mBAAhB,CAAD,EAAuCD,OAAO,CAAC,mBAAD,CAA9C,CAAR;AACAD,QAAQ,CAACC,OAAO,CAACC,OAAR,CAAgB,kBAAhB,CAAD,EAAsCD,OAAO,CAAC,kBAAD,CAA7C,CAAR;AACAD,QAAQ,CAACC,OAAO,CAACC,OAAR,CAAgB,mBAAhB,CAAD,EAAuCD,OAAO,CAAC,mBAAD,CAA9C,CAAR;;AAEO,SAASE,WAAT,CAAqBC,OAArB,EAA8BC,mBAA9B,EAAmD;AACxD,QAAMC,UAAU,GAAG,gCAAkBD,mBAAlB,CAAnB;AACA,MAAI,CAACC,UAAD,IAAe,CAACC,KAAK,CAACC,OAAN,CAAcF,UAAU,CAACG,OAAzB,CAApB,EAAuD;AACrD,UAAM,IAAIC,KAAJ;AACJ,kFADI,CAAN;;AAGD;;AAED,MAAI,CAACf,wBAAwB,CAACgB,GAAzB,CAA6BL,UAA7B,CAAL,EAA+C;AAC7CX,IAAAA,wBAAwB,CAACiB,GAAzB;AACEN,IAAAA,UADF;AAEEA,IAAAA,UAA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C,mBAAO4C,UAAP;AACAvC,EAAAA,WAAW,GAAGC,MAAM,CAACC,MAAP,CAAc,IAAd,CAAd;AACD;;AAED;AACO,MAAMsC,OAAO,GAAGF,gBAAhB,C;AACA,MAAMG,OAAO,GAAG9C,gBAAhB,C;;AAEP,SAASwB,UAAT,CAAoBF,EAApB,EAAwBC,KAAxB,EAA+B;AAC7B,SAAOoB,iBAAOI,mBAAP,CAA2BJ,iBAAOK,YAAP,CAAoB1B,EAApB,CAA3B,EAAoDC,KAApD,CAAP;AACD","sourcesContent":["import loader from \"./loader\";\nimport finder from \"./finder\";\nimport Lookup from \"./lookup\";\nimport tryLoadTranslator from \"../util/try-load-translator\";\n\nexport const excludeDir = finder.excludeDir;\nexport const excludePackage = finder.excludePackage;\n\nconst registeredTaglibs = [];\nconst loadedTranslatorsTaglibs = new Map();\nlet lookupCache = Object.create(null);\n\nregister(require.resolve(\"./marko-html.json\"), require(\"./marko-html.json\"));\nregister(require.resolve(\"./marko-svg.json\"), require(\"./marko-svg.json\"));\nregister(require.resolve(\"./marko-math.json\"), require(\"./marko-math.json\"));\n\nexport function buildLookup(dirname, requestedTranslator) {\n const translator = tryLoadTranslator(requestedTranslator);\n if (!translator || !Array.isArray(translator.taglibs)) {\n throw new Error(\n \"@marko/compiler: Invalid translator provided to buildLookup(dir, translator)\"\n );\n }\n\n if (!loadedTranslatorsTaglibs.has(translator)) {\n loadedTranslatorsTaglibs.set(\n translator,\n translator.taglibs.map(([id, props]) => loadTaglib(id, props))\n );\n }\n\n const taglibsForDir = finder.find(\n dirname,\n registeredTaglibs.concat(loadedTranslatorsTaglibs.get(translator))\n );\n\n const cacheKey = taglibsForDir.map(it => it.id).join();\n let lookup = lookupCache[cacheKey];\n\n if (!lookup) {\n lookup = lookupCache[cacheKey] = new Lookup();\n for (let i = taglibsForDir.length; i--; ) {\n const taglib = taglibsForDir[i];\n lookup.addTaglib(taglib);\n if (taglib.imports) {\n for (const importedTaglib of taglib.imports) {\n if (!lookup.hasTaglib(importedTaglib)) {\n lookup.addTaglib(importedTaglib);\n }\n }\n }\n }\n }\n\n return lookup;\n}\n\nexport function register(id, props) {\n registeredTaglibs.push(loadTaglib(id, props));\n}\n\nexport function clearCaches() {\n loader.clearCache();\n finder.clearCache();\n lookupCache = Object.create(null);\n}\n\n// Used by legacy compiler api.\nexport const _loader = loader;\nexport const _finder = finder;\n\nfunction loadTaglib(id, props) {\n return loader.loadTaglibFromProps(loader.createTaglib(id), props);\n}\n"],"file":"index.js"}
|
package/dist/types.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ interface BaseNode {
|
|
|
42
42
|
extra?: Record<string, unknown>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
|
|
45
|
+
export type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | Binary | BinaryExpression | BindExpression | Block | BlockParent | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | Class | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | CompletionStatement | Conditional | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | Declaration | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBody | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | Expression | ExpressionStatement | ExpressionWrapper | File | Flow | FlowBaseAnnotation | FlowDeclaration | FlowPredicate | FlowType | For | ForInStatement | ForOfStatement | ForStatement | ForXStatement | Function | FunctionDeclaration | FunctionExpression | FunctionParent | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Immutable | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSX | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LVal | LabeledStatement | Literal | LogicalExpression | Loop | Marko | MarkoAttribute | MarkoCDATA | MarkoClass | MarkoComment | MarkoDeclaration | MarkoDocumentType | MarkoPlaceholder | MarkoScriptlet | MarkoSpreadAttribute | MarkoTag | MarkoTagBody | MarkoText | MemberExpression | MetaProperty | Method | Miscellaneous | MixedTypeAnnotation | ModuleDeclaration | ModuleExpression | ModuleSpecifier | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMember | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | Pattern | PatternLike | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | Private | PrivateName | Program | Property | Pureish | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral | RestElement | RestProperty | ReturnStatement | Scopable | Scope | SequenceExpression | SpreadElement | SpreadProperty | Standardized | Statement | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBaseType | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEntityName | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeElement | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | Terminatorless | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeScript | TypeofTypeAnnotation | UnaryExpression | UnaryLike | UnionTypeAnnotation | UpdateExpression | UserWhitespacable | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | While | WhileStatement | WithStatement | YieldExpression;
|
|
46
46
|
|
|
47
47
|
export interface ArrayExpression extends BaseNode {
|
|
48
48
|
type: "ArrayExpression";
|
|
@@ -462,6 +462,7 @@ export interface ExportSpecifier extends BaseNode {
|
|
|
462
462
|
type: "ExportSpecifier";
|
|
463
463
|
local: Identifier;
|
|
464
464
|
exported: Identifier | StringLiteral;
|
|
465
|
+
exportKind: "type" | "value" | null;
|
|
465
466
|
}
|
|
466
467
|
|
|
467
468
|
export interface ForOfStatement extends BaseNode {
|
|
@@ -494,7 +495,7 @@ export interface ImportSpecifier extends BaseNode {
|
|
|
494
495
|
type: "ImportSpecifier";
|
|
495
496
|
local: Identifier;
|
|
496
497
|
imported: Identifier | StringLiteral;
|
|
497
|
-
importKind: "type" | "typeof" | null;
|
|
498
|
+
importKind: "type" | "typeof" | "value" | null;
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
export interface MetaProperty extends BaseNode {
|
|
@@ -655,6 +656,11 @@ export interface PrivateName extends BaseNode {
|
|
|
655
656
|
id: Identifier;
|
|
656
657
|
}
|
|
657
658
|
|
|
659
|
+
export interface StaticBlock extends BaseNode {
|
|
660
|
+
type: "StaticBlock";
|
|
661
|
+
body: Array<Statement>;
|
|
662
|
+
}
|
|
663
|
+
|
|
658
664
|
export interface AnyTypeAnnotation extends BaseNode {
|
|
659
665
|
type: "AnyTypeAnnotation";
|
|
660
666
|
}
|
|
@@ -1195,11 +1201,6 @@ export interface DecimalLiteral extends BaseNode {
|
|
|
1195
1201
|
value: string;
|
|
1196
1202
|
}
|
|
1197
1203
|
|
|
1198
|
-
export interface StaticBlock extends BaseNode {
|
|
1199
|
-
type: "StaticBlock";
|
|
1200
|
-
body: Array<Statement>;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
1204
|
export interface ModuleExpression extends BaseNode {
|
|
1204
1205
|
type: "ModuleExpression";
|
|
1205
1206
|
body: Program;
|
|
@@ -1705,6 +1706,7 @@ export type RestProperty = RestElement;
|
|
|
1705
1706
|
*/
|
|
1706
1707
|
export type SpreadProperty = SpreadElement;
|
|
1707
1708
|
|
|
1709
|
+
export type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | ConditionalExpression | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | File | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | LabeledStatement | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | Program | ObjectExpression | ObjectMethod | ObjectProperty | RestElement | ReturnStatement | SequenceExpression | ParenthesizedExpression | SwitchCase | SwitchStatement | ThisExpression | ThrowStatement | TryStatement | UnaryExpression | UpdateExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | AssignmentPattern | ArrayPattern | ArrowFunctionExpression | ClassBody | ClassExpression | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ForOfStatement | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | MetaProperty | ClassMethod | ObjectPattern | SpreadElement | Super | TaggedTemplateExpression | TemplateElement | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | ExportNamespaceSpecifier | OptionalMemberExpression | OptionalCallExpression | ClassProperty | ClassPrivateProperty | ClassPrivateMethod | PrivateName | StaticBlock;
|
|
1708
1710
|
export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ParenthesizedExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | AwaitExpression | Import | BigIntLiteral | OptionalMemberExpression | OptionalCallExpression | TypeCastExpression | JSXElement | JSXFragment | BindExpression | DoExpression | RecordExpression | TupleExpression | DecimalLiteral | ModuleExpression | TopicReference | PipelineTopicExpression | PipelineBareFunction | PipelinePrimaryTopicReference | TSAsExpression | TSTypeAssertion | TSNonNullExpression;
|
|
1709
1711
|
export type Binary = BinaryExpression | LogicalExpression;
|
|
1710
1712
|
export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassExpression | ClassDeclaration | ForOfStatement | ClassMethod | ClassPrivateMethod | StaticBlock | TSModuleBlock;
|
|
@@ -1720,7 +1722,7 @@ export type ExpressionWrapper = ExpressionStatement | ParenthesizedExpression |
|
|
|
1720
1722
|
export type For = ForInStatement | ForStatement | ForOfStatement;
|
|
1721
1723
|
export type ForXStatement = ForInStatement | ForOfStatement;
|
|
1722
1724
|
export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod;
|
|
1723
|
-
export type FunctionParent = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod;
|
|
1725
|
+
export type FunctionParent = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod | ClassPrivateMethod | StaticBlock;
|
|
1724
1726
|
export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ArrowFunctionExpression | BigIntLiteral | DecimalLiteral;
|
|
1725
1727
|
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias | EnumDeclaration | TSDeclareFunction | TSInterfaceDeclaration | TSTypeAliasDeclaration | TSEnumDeclaration | TSModuleDeclaration;
|
|
1726
1728
|
export type PatternLike = Identifier | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern;
|
|
@@ -1739,7 +1741,7 @@ export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration
|
|
|
1739
1741
|
export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration;
|
|
1740
1742
|
export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportNamespaceSpecifier | ExportDefaultSpecifier;
|
|
1741
1743
|
export type Private = ClassPrivateProperty | ClassPrivateMethod | PrivateName;
|
|
1742
|
-
export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ClassImplements | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | DeclaredPredicate | ExistsTypeAnnotation | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | InferredPredicate | InterfaceExtends | InterfaceDeclaration | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | QualifiedTypeIdentifier | StringLiteralTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | UnionTypeAnnotation | Variance | VoidTypeAnnotation | IndexedAccessType | OptionalIndexedAccessType;
|
|
1744
|
+
export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ClassImplements | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | DeclaredPredicate | ExistsTypeAnnotation | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | InferredPredicate | InterfaceExtends | InterfaceDeclaration | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | ObjectTypeInternalSlot | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | QualifiedTypeIdentifier | StringLiteralTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | UnionTypeAnnotation | Variance | VoidTypeAnnotation | EnumDeclaration | EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody | EnumBooleanMember | EnumNumberMember | EnumStringMember | EnumDefaultedMember | IndexedAccessType | OptionalIndexedAccessType;
|
|
1743
1745
|
export type FlowType = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullLiteralTypeAnnotation | ExistsTypeAnnotation | FunctionTypeAnnotation | GenericTypeAnnotation | InterfaceTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NullableTypeAnnotation | NumberLiteralTypeAnnotation | NumberTypeAnnotation | ObjectTypeAnnotation | StringLiteralTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | UnionTypeAnnotation | VoidTypeAnnotation | IndexedAccessType | OptionalIndexedAccessType;
|
|
1744
1746
|
export type FlowBaseAnnotation = AnyTypeAnnotation | BooleanTypeAnnotation | NullLiteralTypeAnnotation | MixedTypeAnnotation | EmptyTypeAnnotation | NumberTypeAnnotation | StringTypeAnnotation | SymbolTypeAnnotation | ThisTypeAnnotation | VoidTypeAnnotation;
|
|
1745
1747
|
export type FlowDeclaration = DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareTypeAlias | DeclareOpaqueType | DeclareVariable | DeclareExportDeclaration | DeclareExportAllDeclaration | InterfaceDeclaration | OpaqueType | TypeAlias;
|
|
@@ -1747,6 +1749,8 @@ export type FlowPredicate = DeclaredPredicate | InferredPredicate;
|
|
|
1747
1749
|
export type EnumBody = EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody;
|
|
1748
1750
|
export type EnumMember = EnumBooleanMember | EnumNumberMember | EnumStringMember | EnumDefaultedMember;
|
|
1749
1751
|
export type JSX = JSXAttribute | JSXClosingElement | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXSpreadChild | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXSpreadAttribute | JSXText | JSXFragment | JSXOpeningFragment | JSXClosingFragment;
|
|
1752
|
+
export type Miscellaneous = Noop | Placeholder | V8IntrinsicIdentifier;
|
|
1753
|
+
export type TypeScript = TSParameterProperty | TSDeclareFunction | TSDeclareMethod | TSQualifiedName | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature | TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSNamedTupleMember | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSInterfaceDeclaration | TSInterfaceBody | TSTypeAliasDeclaration | TSAsExpression | TSTypeAssertion | TSEnumDeclaration | TSEnumMember | TSModuleDeclaration | TSModuleBlock | TSImportType | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | TSExportAssignment | TSNamespaceExportDeclaration | TSTypeAnnotation | TSTypeParameterInstantiation | TSTypeParameterDeclaration | TSTypeParameter;
|
|
1750
1754
|
export type TSTypeElement = TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSPropertySignature | TSMethodSignature | TSIndexSignature;
|
|
1751
1755
|
export type TSType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSFunctionType | TSConstructorType | TSTypeReference | TSTypePredicate | TSTypeQuery | TSTypeLiteral | TSArrayType | TSTupleType | TSOptionalType | TSRestType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSParenthesizedType | TSTypeOperator | TSIndexedAccessType | TSMappedType | TSLiteralType | TSExpressionWithTypeArguments | TSImportType;
|
|
1752
1756
|
export type TSBaseType = TSAnyKeyword | TSBooleanKeyword | TSBigIntKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSLiteralType;
|
|
@@ -1754,6 +1758,7 @@ export type Marko = MarkoDocumentType | MarkoDeclaration | MarkoCDATA | MarkoCom
|
|
|
1754
1758
|
export type Scope = MarkoTagBody;
|
|
1755
1759
|
|
|
1756
1760
|
export interface Aliases {
|
|
1761
|
+
Standardized: Standardized;
|
|
1757
1762
|
Expression: Expression;
|
|
1758
1763
|
Binary: Binary;
|
|
1759
1764
|
Scopable: Scopable;
|
|
@@ -1796,6 +1801,8 @@ export interface Aliases {
|
|
|
1796
1801
|
EnumBody: EnumBody;
|
|
1797
1802
|
EnumMember: EnumMember;
|
|
1798
1803
|
JSX: JSX;
|
|
1804
|
+
Miscellaneous: Miscellaneous;
|
|
1805
|
+
TypeScript: TypeScript;
|
|
1799
1806
|
TSTypeElement: TSTypeElement;
|
|
1800
1807
|
TSType: TSType;
|
|
1801
1808
|
TSBaseType: TSBaseType;
|
|
@@ -1890,6 +1897,7 @@ export function classProperty(key: Identifier | StringLiteral | NumericLiteral |
|
|
|
1890
1897
|
export function classPrivateProperty(key: PrivateName, value: Expression | null | undefined, decorators: Array<Decorator> | null | undefined, _static: any): ClassPrivateProperty;
|
|
1891
1898
|
export function classPrivateMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
|
|
1892
1899
|
export function privateName(id: Identifier): PrivateName;
|
|
1900
|
+
export function staticBlock(body: Array<Statement>): StaticBlock;
|
|
1893
1901
|
export function anyTypeAnnotation(): AnyTypeAnnotation;
|
|
1894
1902
|
export function arrayTypeAnnotation(elementType: FlowType): ArrayTypeAnnotation;
|
|
1895
1903
|
export function booleanTypeAnnotation(): BooleanTypeAnnotation;
|
|
@@ -1982,7 +1990,6 @@ export function exportDefaultSpecifier(exported: Identifier): ExportDefaultSpeci
|
|
|
1982
1990
|
export function recordExpression(properties: Array<ObjectProperty | SpreadElement>): RecordExpression;
|
|
1983
1991
|
export function tupleExpression(elements?: Array<Expression | SpreadElement>): TupleExpression;
|
|
1984
1992
|
export function decimalLiteral(value: string): DecimalLiteral;
|
|
1985
|
-
export function staticBlock(body: Array<Statement>): StaticBlock;
|
|
1986
1993
|
export function moduleExpression(body: Program): ModuleExpression;
|
|
1987
1994
|
export function topicReference(): TopicReference;
|
|
1988
1995
|
export function pipelineTopicExpression(expression: Expression): PipelineTopicExpression;
|
|
@@ -2361,6 +2368,8 @@ export function isMetaProperty(node: object | null | undefined, opts?: object |
|
|
|
2361
2368
|
export function assertMetaProperty(node: object | null | undefined, opts?: object | null): void;
|
|
2362
2369
|
export function isMethod(node: object | null | undefined, opts?: object | null): node is Method;
|
|
2363
2370
|
export function assertMethod(node: object | null | undefined, opts?: object | null): void;
|
|
2371
|
+
export function isMiscellaneous(node: object | null | undefined, opts?: object | null): node is Miscellaneous;
|
|
2372
|
+
export function assertMiscellaneous(node: object | null | undefined, opts?: object | null): void;
|
|
2364
2373
|
export function isMixedTypeAnnotation(node: object | null | undefined, opts?: object | null): node is MixedTypeAnnotation;
|
|
2365
2374
|
export function assertMixedTypeAnnotation(node: object | null | undefined, opts?: object | null): void;
|
|
2366
2375
|
export function isModuleDeclaration(node: object | null | undefined, opts?: object | null): node is ModuleDeclaration;
|
|
@@ -2473,6 +2482,8 @@ export function assertSpreadElement(node: object | null | undefined, opts?: obje
|
|
|
2473
2482
|
export function isSpreadProperty(node: object | null | undefined, opts?: object | null): node is SpreadElement;
|
|
2474
2483
|
/** @deprecated Use `assertSpreadElement` */
|
|
2475
2484
|
export function assertSpreadProperty(node: object | null | undefined, opts?: object | null): void;
|
|
2485
|
+
export function isStandardized(node: object | null | undefined, opts?: object | null): node is Standardized;
|
|
2486
|
+
export function assertStandardized(node: object | null | undefined, opts?: object | null): void;
|
|
2476
2487
|
export function isStatement(node: object | null | undefined, opts?: object | null): node is Statement;
|
|
2477
2488
|
export function assertStatement(node: object | null | undefined, opts?: object | null): void;
|
|
2478
2489
|
export function isStaticBlock(node: object | null | undefined, opts?: object | null): node is StaticBlock;
|
|
@@ -2659,6 +2670,8 @@ export function isTypeParameterDeclaration(node: object | null | undefined, opts
|
|
|
2659
2670
|
export function assertTypeParameterDeclaration(node: object | null | undefined, opts?: object | null): void;
|
|
2660
2671
|
export function isTypeParameterInstantiation(node: object | null | undefined, opts?: object | null): node is TypeParameterInstantiation;
|
|
2661
2672
|
export function assertTypeParameterInstantiation(node: object | null | undefined, opts?: object | null): void;
|
|
2673
|
+
export function isTypeScript(node: object | null | undefined, opts?: object | null): node is TypeScript;
|
|
2674
|
+
export function assertTypeScript(node: object | null | undefined, opts?: object | null): void;
|
|
2662
2675
|
export function isTypeofTypeAnnotation(node: object | null | undefined, opts?: object | null): node is TypeofTypeAnnotation;
|
|
2663
2676
|
export function assertTypeofTypeAnnotation(node: object | null | undefined, opts?: object | null): void;
|
|
2664
2677
|
export function isUnaryExpression(node: object | null | undefined, opts?: object | null): node is UnaryExpression;
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
3
|
"description": "Marko template to JS compiler.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.17.6",
|
|
5
5
|
"author": "Dylan Piercey <dpiercey@ebay.com>",
|
|
6
6
|
"bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@babel/code-frame": "^7.
|
|
9
|
-
"@babel/core": "^7.
|
|
10
|
-
"@babel/generator": "^7.
|
|
11
|
-
"@babel/parser": "^7.
|
|
12
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
13
|
-
"@babel/runtime": "^7.
|
|
14
|
-
"@babel/traverse": "^7.
|
|
15
|
-
"@babel/types": "^7.
|
|
16
|
-
"@marko/babel-utils": "^5.
|
|
8
|
+
"@babel/code-frame": "^7.16.0",
|
|
9
|
+
"@babel/core": "^7.16.0",
|
|
10
|
+
"@babel/generator": "^7.16.0",
|
|
11
|
+
"@babel/parser": "^7.16.0",
|
|
12
|
+
"@babel/plugin-transform-modules-commonjs": "^7.16.0",
|
|
13
|
+
"@babel/runtime": "^7.16.0",
|
|
14
|
+
"@babel/traverse": "^7.16.0",
|
|
15
|
+
"@babel/types": "^7.16.0",
|
|
16
|
+
"@marko/babel-utils": "^5.17.4",
|
|
17
17
|
"complain": "^1.6.0",
|
|
18
18
|
"enhanced-resolve": "5.7.0",
|
|
19
19
|
"he": "^1.2.0",
|
|
20
|
-
"htmljs-parser": "^2.11.
|
|
20
|
+
"htmljs-parser": "^2.11.1",
|
|
21
21
|
"jsesc": "^3.0.2",
|
|
22
22
|
"lasso-package-root": "^1.0.1",
|
|
23
23
|
"property-handlers": "^1.1.1",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"strip-json-comments": "^3.1.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@marko/translator-default": "^5.
|
|
32
|
+
"@marko/translator-default": "^5.17.6"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"url": "https://github.com/marko-js/marko/tree/master/packages/compiler"
|
|
61
61
|
},
|
|
62
62
|
"types": "index.d.ts",
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ec2a1cdaea4b22f7b1ab4fa42f56c61ce54c5e64"
|
|
64
64
|
}
|