@marko/compiler 5.39.48 → 5.39.50
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.
|
@@ -64,17 +64,20 @@ let stripTypesVisitor;var _default =
|
|
|
64
64
|
return {
|
|
65
65
|
name: "marko",
|
|
66
66
|
manipulateOptions(opts) {
|
|
67
|
+
const { parserOpts } = opts;
|
|
67
68
|
// We need to allow these for now since we are not parsing the entire file
|
|
68
69
|
// These types of syntax errors will be picked up by the bundler / runtime anyways.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
parserOpts.allowAwaitOutsideFunction =
|
|
71
|
+
parserOpts.allowImportExportEverywhere =
|
|
72
|
+
parserOpts.allowReturnOutsideFunction =
|
|
73
|
+
parserOpts.allowSuperOutsideMethod =
|
|
74
|
+
parserOpts.allowUndeclaredExports =
|
|
75
|
+
parserOpts.allowNewTargetOutsideFunction =
|
|
76
|
+
parserOpts.createParenthesizedExpressions =
|
|
77
|
+
parserOpts.createImportExpressions =
|
|
75
78
|
true;
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
parserOpts.plugins.push("objectRestSpread", "classProperties", [
|
|
78
81
|
"typescript",
|
|
79
82
|
{
|
|
80
83
|
disallowAmbiguousJSXLike: false,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");require("
|
|
2
|
-
|
|
3
|
-
var _printer = _interopRequireDefault(require("@babel/generator/lib/printer"));
|
|
4
|
-
var t = _interopRequireWildcard(require("@babel/types"));
|
|
5
|
-
var _selfClosingTags = _interopRequireDefault(require("self-closing-tags"));function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}
|
|
6
|
-
|
|
7
|
-
Object.assign(_printer.default.prototype, {
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");var _selfClosingTags = _interopRequireDefault(require("self-closing-tags"));
|
|
2
|
+
Object.assign(require("@babel/generator/lib/generators/template-literals"), {
|
|
8
3
|
MarkoParseError(node) {
|
|
9
4
|
this.token(node.source);
|
|
10
5
|
},
|
|
@@ -29,26 +24,16 @@ Object.assign(_printer.default.prototype, {
|
|
|
29
24
|
this.token("-->");
|
|
30
25
|
},
|
|
31
26
|
MarkoPlaceholder(node, parent) {
|
|
32
|
-
|
|
33
|
-
const parentBody = getBody(parent);
|
|
34
|
-
const prev = parentBody[parentBody.indexOf(node) - 1];
|
|
27
|
+
const isRootLevel = parent.type === "Program";
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
29
|
+
if (isRootLevel) {
|
|
30
|
+
this.token("-- ");
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
this.token(node.escape ? "${" : "$!{");
|
|
42
|
-
this.print(node.value);
|
|
33
|
+
this.print(node.value, true, true);
|
|
43
34
|
this.token("}");
|
|
44
35
|
},
|
|
45
36
|
MarkoScriptlet(node, parent) {
|
|
46
|
-
this.removeTrailingNewline();
|
|
47
|
-
|
|
48
|
-
if (!(t.isProgram(parent) && getBody(parent)[0] === node)) {
|
|
49
|
-
this.token("\n");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
37
|
this.token(`${node.static ? node.target ?? "static" : "$"} `);
|
|
53
38
|
|
|
54
39
|
if (
|
|
@@ -56,20 +41,17 @@ Object.assign(_printer.default.prototype, {
|
|
|
56
41
|
!statementCouldHaveUnenclosedNewline(node.body[0]))
|
|
57
42
|
{
|
|
58
43
|
// TODO should determine if node has unenclosed newlines.
|
|
59
|
-
this.print(node.body[0]);
|
|
44
|
+
this.print(node.body[0], false, true);
|
|
60
45
|
} else {
|
|
61
46
|
this.token("{");
|
|
62
|
-
this.
|
|
63
|
-
this.indent();
|
|
64
|
-
this.printSequence(node.body);
|
|
65
|
-
this.dedent();
|
|
47
|
+
this.printSequence(node.body, true, true);
|
|
66
48
|
this.token("}");
|
|
67
49
|
}
|
|
68
50
|
},
|
|
69
51
|
MarkoClass(node) {
|
|
70
52
|
this.token("class");
|
|
71
53
|
this.token(" ");
|
|
72
|
-
this.print(node.body);
|
|
54
|
+
this.print(node.body, true, true);
|
|
73
55
|
},
|
|
74
56
|
MarkoAttribute(node) {
|
|
75
57
|
const value = node.value;
|
|
@@ -89,15 +71,18 @@ Object.assign(_printer.default.prototype, {
|
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
73
|
|
|
92
|
-
if (
|
|
74
|
+
if (
|
|
75
|
+
node.default ||
|
|
76
|
+
!(node.value.type === "BooleanLiteral" && node.value.value))
|
|
77
|
+
{
|
|
93
78
|
if (
|
|
94
|
-
|
|
79
|
+
value.type === "FunctionExpression" &&
|
|
95
80
|
!(value.id || value.async || value.generator))
|
|
96
81
|
{
|
|
97
82
|
this.token("(");
|
|
98
83
|
this.printList(value.params);
|
|
99
|
-
this.token(")
|
|
100
|
-
this.
|
|
84
|
+
this.token(")");
|
|
85
|
+
this.printBlock(value.body);
|
|
101
86
|
} else {
|
|
102
87
|
this.token(node.bound ? ":=" : "=");
|
|
103
88
|
printWithParansIfNeeded.call(this, value);
|
|
@@ -109,17 +94,10 @@ Object.assign(_printer.default.prototype, {
|
|
|
109
94
|
printWithParansIfNeeded.call(this, node.value);
|
|
110
95
|
},
|
|
111
96
|
MarkoText(node, parent) {
|
|
112
|
-
const
|
|
113
|
-
const prev = parentBody[parentBody.indexOf(node) - 1];
|
|
114
|
-
const concatToPrev = prev && t.isMarkoPlaceholder(prev);
|
|
115
|
-
let { value } = node;
|
|
116
|
-
|
|
117
|
-
if (concatToPrev) {
|
|
118
|
-
this.removeTrailingNewline();
|
|
119
|
-
}
|
|
97
|
+
const { value } = node;
|
|
120
98
|
|
|
121
99
|
const isMultiLine = /[\r\n]/g.test(value);
|
|
122
|
-
const isRootLevel =
|
|
100
|
+
const isRootLevel = parent.type === "Program";
|
|
123
101
|
|
|
124
102
|
if (isRootLevel) {
|
|
125
103
|
if (isMultiLine) {
|
|
@@ -136,10 +114,10 @@ Object.assign(_printer.default.prototype, {
|
|
|
136
114
|
}
|
|
137
115
|
},
|
|
138
116
|
MarkoTagBody(node) {
|
|
139
|
-
this.printSequence(node.body
|
|
117
|
+
this.printSequence(node.body);
|
|
140
118
|
},
|
|
141
119
|
MarkoTag(node) {
|
|
142
|
-
const isDynamicTag =
|
|
120
|
+
const isDynamicTag = node.name.type !== "StringLiteral";
|
|
143
121
|
const tagName = !isDynamicTag && node.name.value;
|
|
144
122
|
const rawValue = node.rawValue;
|
|
145
123
|
let bodyOverride;
|
|
@@ -159,7 +137,7 @@ Object.assign(_printer.default.prototype, {
|
|
|
159
137
|
} else {
|
|
160
138
|
if (isDynamicTag) {
|
|
161
139
|
this.token("${");
|
|
162
|
-
this.print(node.name);
|
|
140
|
+
this.print(node.name, true, true);
|
|
163
141
|
this.token("}");
|
|
164
142
|
} else {
|
|
165
143
|
this.token(tagName);
|
|
@@ -173,10 +151,10 @@ Object.assign(_printer.default.prototype, {
|
|
|
173
151
|
|
|
174
152
|
if (node.var) {
|
|
175
153
|
this.token("/");
|
|
176
|
-
this.print(node.var);
|
|
154
|
+
this.print(node.var, true, true);
|
|
177
155
|
|
|
178
156
|
if (node.var.typeAnnotation) {
|
|
179
|
-
this.print(node.var.typeAnnotation);
|
|
157
|
+
this.print(node.var.typeAnnotation, true, true);
|
|
180
158
|
}
|
|
181
159
|
}
|
|
182
160
|
|
|
@@ -239,8 +217,11 @@ Object.assign(_printer.default.prototype, {
|
|
|
239
217
|
this.token("/>");
|
|
240
218
|
} else {
|
|
241
219
|
this.token(">");
|
|
242
|
-
this.
|
|
243
|
-
|
|
220
|
+
this.printSequence(
|
|
221
|
+
bodyOverride || zipAttributeTagsAndBody(node),
|
|
222
|
+
true,
|
|
223
|
+
true
|
|
224
|
+
);
|
|
244
225
|
this.token("</");
|
|
245
226
|
if (!isDynamicTag) {
|
|
246
227
|
this.token(tagName);
|
|
@@ -261,7 +242,7 @@ function printWithParansIfNeeded(value) {
|
|
|
261
242
|
this.token("(");
|
|
262
243
|
}
|
|
263
244
|
|
|
264
|
-
this.print(value);
|
|
245
|
+
this.print(value, true, true);
|
|
265
246
|
|
|
266
247
|
if (needsParans) {
|
|
267
248
|
this.token(")");
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
require("../generator/patch");
|
|
3
|
+
|
|
2
4
|
var babelTypes = _interopRequireWildcard(require("@babel/types"));
|
|
3
5
|
var definitionUtils = _interopRequireWildcard(require("@babel/types/lib/definitions/utils"));
|
|
4
6
|
var generatedValidators = _interopRequireWildcard(require("@babel/types/lib/validators/generated"));
|
package/dist/babel-utils/tags.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"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");
|
|
2
2
|
var _modules = _interopRequireDefault(require("@marko/compiler/modules"));
|
|
3
|
-
var _lassoPackageRoot = require("lasso-package-root");
|
|
4
3
|
var _path = require("path");
|
|
5
4
|
|
|
6
5
|
var _quickHash = require("../util/quick-hash");
|
|
@@ -296,10 +295,11 @@ function resolveMarkoFile(file, filename) {
|
|
|
296
295
|
const idCache = new WeakMap();
|
|
297
296
|
const templateIdHashOpts = { outputLength: 5 };
|
|
298
297
|
function getTemplateId(opts, request, child) {
|
|
298
|
+
if (!child && opts.getTemplateId) return opts.getTemplateId(request);
|
|
299
|
+
|
|
299
300
|
const id = (0, _path.relative)(root, request).replace(/[^a-zA-Z0-9_$./-]/g, "/");
|
|
300
|
-
const optimize = typeof opts === "object" ? opts.optimize : opts;
|
|
301
301
|
|
|
302
|
-
if (optimize) {
|
|
302
|
+
if (opts.optimize) {
|
|
303
303
|
const optimizeKnownTemplates =
|
|
304
304
|
typeof opts === "object" && opts.optimizeKnownTemplates;
|
|
305
305
|
const knownTemplatesSize = optimizeKnownTemplates?.length || 0;
|
package/dist/taglib/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
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;exports.resolveOptionalTaglibs = resolveOptionalTaglibs;var _modules = _interopRequireDefault(require("@marko/compiler/modules"));
|
|
2
|
-
var _lassoPackageRoot = require("lasso-package-root");
|
|
3
2
|
var _path = _interopRequireDefault(require("path"));
|
|
4
3
|
|
|
5
4
|
var _tryLoadTranslator = _interopRequireDefault(require("../util/try-load-translator"));
|
package/dist/types.d.ts
CHANGED
|
@@ -447,8 +447,8 @@ export interface ClassDeclaration extends BaseNode {
|
|
|
447
447
|
export interface ExportAllDeclaration extends BaseNode {
|
|
448
448
|
type: "ExportAllDeclaration";
|
|
449
449
|
source: StringLiteral;
|
|
450
|
-
assertions: Array<ImportAttribute> | null;
|
|
451
450
|
attributes: Array<ImportAttribute> | null;
|
|
451
|
+
assertions: Array<ImportAttribute> | null;
|
|
452
452
|
exportKind: "type" | "value" | null;
|
|
453
453
|
}
|
|
454
454
|
|
|
@@ -463,8 +463,8 @@ export interface ExportNamedDeclaration extends BaseNode {
|
|
|
463
463
|
declaration: Declaration | null;
|
|
464
464
|
specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>;
|
|
465
465
|
source: StringLiteral | null;
|
|
466
|
-
assertions: Array<ImportAttribute> | null;
|
|
467
466
|
attributes: Array<ImportAttribute> | null;
|
|
467
|
+
assertions: Array<ImportAttribute> | null;
|
|
468
468
|
exportKind: "type" | "value" | null;
|
|
469
469
|
}
|
|
470
470
|
|
|
@@ -487,8 +487,8 @@ export interface ImportDeclaration extends BaseNode {
|
|
|
487
487
|
type: "ImportDeclaration";
|
|
488
488
|
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
489
489
|
source: StringLiteral;
|
|
490
|
-
assertions: Array<ImportAttribute> | null;
|
|
491
490
|
attributes: Array<ImportAttribute> | null;
|
|
491
|
+
assertions: Array<ImportAttribute> | null;
|
|
492
492
|
importKind: "type" | "typeof" | "value" | null;
|
|
493
493
|
module: boolean | null;
|
|
494
494
|
phase: "source" | "defer" | null;
|
|
@@ -1962,12 +1962,12 @@ export function arrowFunctionExpression(params: Array<FunctionParameter>, body:
|
|
|
1962
1962
|
export function classBody(body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock>): ClassBody;
|
|
1963
1963
|
export function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array<Decorator> | null): ClassExpression;
|
|
1964
1964
|
export function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Array<Decorator> | null): ClassDeclaration;
|
|
1965
|
-
export function exportAllDeclaration(source: StringLiteral): ExportAllDeclaration;
|
|
1965
|
+
export function exportAllDeclaration(source: StringLiteral, attributes?: Array<ImportAttribute> | null): ExportAllDeclaration;
|
|
1966
1966
|
export function exportDefaultDeclaration(declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration;
|
|
1967
|
-
export function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>, source?: StringLiteral | null): ExportNamedDeclaration;
|
|
1967
|
+
export function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>, source?: StringLiteral | null, attributes?: Array<ImportAttribute> | null): ExportNamedDeclaration;
|
|
1968
1968
|
export function exportSpecifier(local: Identifier, exported: Identifier | StringLiteral): ExportSpecifier;
|
|
1969
1969
|
export function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement;
|
|
1970
|
-
export function importDeclaration(specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>, source: StringLiteral): ImportDeclaration;
|
|
1970
|
+
export function importDeclaration(specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>, source: StringLiteral, attributes?: Array<ImportAttribute> | null): ImportDeclaration;
|
|
1971
1971
|
export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier;
|
|
1972
1972
|
export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier;
|
|
1973
1973
|
export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
|
-
"version": "5.39.
|
|
3
|
+
"version": "5.39.50",
|
|
4
4
|
"description": "Marko template to JS compiler.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"babel",
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"prepare": "node -r ~ts scripts/types"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@babel/code-frame": "^7.
|
|
66
|
-
"@babel/core": "^7.
|
|
67
|
-
"@babel/generator": "^7.
|
|
68
|
-
"@babel/parser": "^7.
|
|
69
|
-
"@babel/plugin-syntax-typescript": "^7.
|
|
70
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
71
|
-
"@babel/plugin-transform-typescript": "^7.28.
|
|
72
|
-
"@babel/runtime": "^7.28.
|
|
73
|
-
"@babel/traverse": "^7.
|
|
74
|
-
"@babel/types": "^7.
|
|
65
|
+
"@babel/code-frame": "^7.29.0",
|
|
66
|
+
"@babel/core": "^7.29.0",
|
|
67
|
+
"@babel/generator": "^7.29.1",
|
|
68
|
+
"@babel/parser": "^7.29.0",
|
|
69
|
+
"@babel/plugin-syntax-typescript": "^7.28.6",
|
|
70
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
71
|
+
"@babel/plugin-transform-typescript": "^7.28.6",
|
|
72
|
+
"@babel/runtime": "^7.28.6",
|
|
73
|
+
"@babel/traverse": "^7.29.0",
|
|
74
|
+
"@babel/types": "^7.29.0",
|
|
75
75
|
"@luxass/strip-json-comments": "^1.4.0",
|
|
76
76
|
"complain": "^1.6.1",
|
|
77
77
|
"he": "^1.2.0",
|
|
78
|
-
"htmljs-parser": "^5.7.
|
|
78
|
+
"htmljs-parser": "^5.7.4",
|
|
79
79
|
"jsesc": "^3.1.0",
|
|
80
80
|
"kleur": "^4.1.5",
|
|
81
81
|
"lasso-package-root": "^1.0.1",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"source-map-support": "^0.5.21"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"marko": "^5.38.
|
|
90
|
+
"marko": "^5.38.20"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
93
|
"node": "18 || 20 || >=22"
|