@marko/compiler 5.37.23 → 5.37.25
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/config.js +1 -1
- package/dist/babel-plugin/parser.js +29 -13
- package/dist/babel-types/types/definitions.js +4 -0
- package/dist/index.js +3 -3
- package/dist/traverse.d.ts +13 -13
- package/dist/types.d.ts +1 -0
- package/index.d.ts +2 -0
- package/package.json +3 -3
package/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require("./dist/config");
|
|
1
|
+
module.exports = require("./dist/config").default;
|
|
@@ -542,34 +542,50 @@ function parseMarko(file) {
|
|
|
542
542
|
|
|
543
543
|
if (node.body.body.length) {
|
|
544
544
|
const body = [];
|
|
545
|
+
// When we have a control flow with mixed body and attribute tag content
|
|
546
|
+
// we move any scriptlets, comments or empty nested control flow.
|
|
547
|
+
// This is because they initially ambiguous as to whether
|
|
548
|
+
// they are part of the body or the attributeTags.
|
|
549
|
+
// Otherwise we only move scriptlets.
|
|
545
550
|
for (const child of node.body.body) {
|
|
546
551
|
if (
|
|
547
552
|
t.isMarkoScriptlet(child) ||
|
|
548
|
-
isControlFlow && (
|
|
549
|
-
t.isMarkoComment(child) ||
|
|
550
|
-
child.tagDef?.controlFlow && !child.body.body.length))
|
|
553
|
+
isControlFlow && t.isMarkoComment(child))
|
|
551
554
|
{
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
555
|
+
attributeTags.push(child);
|
|
556
|
+
} else if (
|
|
557
|
+
isControlFlow &&
|
|
558
|
+
child.tagDef?.controlFlow &&
|
|
559
|
+
!child.body.body.length)
|
|
560
|
+
{
|
|
561
|
+
child.body.attributeTags = true;
|
|
556
562
|
attributeTags.push(child);
|
|
557
563
|
} else {
|
|
558
564
|
body.push(child);
|
|
559
565
|
}
|
|
560
566
|
}
|
|
561
567
|
|
|
562
|
-
if (isControlFlow
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
+
if (isControlFlow) {
|
|
569
|
+
if (body.length) {
|
|
570
|
+
onNext();
|
|
571
|
+
throw file.buildCodeFrameError(
|
|
572
|
+
body[0],
|
|
573
|
+
"Cannot have attribute tags and body content under a control flow tag."
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
node.attributeTags = body;
|
|
578
|
+
node.body.body = attributeTags;
|
|
579
|
+
node.body.attributeTags = true;
|
|
568
580
|
} else {
|
|
569
581
|
node.body.body = body;
|
|
570
582
|
}
|
|
571
583
|
|
|
572
584
|
attributeTags.sort(sortByStart);
|
|
585
|
+
} else if (isControlFlow) {
|
|
586
|
+
node.attributeTags = [];
|
|
587
|
+
node.body.body = attributeTags;
|
|
588
|
+
node.body.attributeTags = true;
|
|
573
589
|
}
|
|
574
590
|
|
|
575
591
|
if (isControlFlow) {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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;
|
|
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 = exports.globalConfig = void 0;var _types = _interopRequireWildcard(require("./babel-types"));exports.types = _types;
|
|
2
2
|
var babel = _interopRequireWildcard(require("@babel/core"));
|
|
3
3
|
var _pluginSyntaxTypescript = _interopRequireDefault(require("@babel/plugin-syntax-typescript"));
|
|
4
4
|
var _pluginTransformModulesCommonjs = _interopRequireDefault(require("@babel/plugin-transform-modules-commonjs"));
|
|
@@ -17,9 +17,9 @@ var _tryLoadTranslator = _interopRequireDefault(require("./util/try-load-transla
|
|
|
17
17
|
|
|
18
18
|
const CWD = process.cwd();
|
|
19
19
|
|
|
20
|
-
let globalConfig = { ..._config.default };
|
|
20
|
+
let globalConfig = exports.globalConfig = { ..._config.default };
|
|
21
21
|
function configure(newConfig) {
|
|
22
|
-
globalConfig = { ..._config.default, ...newConfig };
|
|
22
|
+
exports.globalConfig = globalConfig = { ..._config.default, ...newConfig };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async function compile(src, filename, config) {
|
package/dist/traverse.d.ts
CHANGED
|
@@ -1126,19 +1126,19 @@ export class NodePath<T = Node> {
|
|
|
1126
1126
|
// #endregion
|
|
1127
1127
|
|
|
1128
1128
|
// #region ------------------------- assertXXX -------------------------
|
|
1129
|
-
assertMarkoParseError(opts?: object | null):
|
|
1130
|
-
assertMarkoDocumentType(opts?: object | null):
|
|
1131
|
-
assertMarkoDeclaration(opts?: object | null):
|
|
1132
|
-
assertMarkoCDATA(opts?: object | null):
|
|
1133
|
-
assertMarkoComment(opts?: object | null):
|
|
1134
|
-
assertMarkoText(opts?: object | null):
|
|
1135
|
-
assertMarkoPlaceholder(opts?: object | null):
|
|
1136
|
-
assertMarkoScriptlet(opts?: object | null):
|
|
1137
|
-
assertMarkoClass(opts?: object | null):
|
|
1138
|
-
assertMarkoAttribute(opts?: object | null):
|
|
1139
|
-
assertMarkoSpreadAttribute(opts?: object | null):
|
|
1140
|
-
assertMarkoTagBody(opts?: object | null):
|
|
1141
|
-
assertMarkoTag(opts?: object | null):
|
|
1129
|
+
assertMarkoParseError(opts?: object | null): asserts this is NodePath<t.MarkoParseError>;
|
|
1130
|
+
assertMarkoDocumentType(opts?: object | null): asserts this is NodePath<t.MarkoDocumentType>;
|
|
1131
|
+
assertMarkoDeclaration(opts?: object | null): asserts this is NodePath<t.MarkoDeclaration>;
|
|
1132
|
+
assertMarkoCDATA(opts?: object | null): asserts this is NodePath<t.MarkoCDATA>;
|
|
1133
|
+
assertMarkoComment(opts?: object | null): asserts this is NodePath<t.MarkoComment>;
|
|
1134
|
+
assertMarkoText(opts?: object | null): asserts this is NodePath<t.MarkoText>;
|
|
1135
|
+
assertMarkoPlaceholder(opts?: object | null): asserts this is NodePath<t.MarkoPlaceholder>;
|
|
1136
|
+
assertMarkoScriptlet(opts?: object | null): asserts this is NodePath<t.MarkoScriptlet>;
|
|
1137
|
+
assertMarkoClass(opts?: object | null): asserts this is NodePath<t.MarkoClass>;
|
|
1138
|
+
assertMarkoAttribute(opts?: object | null): asserts this is NodePath<t.MarkoAttribute>;
|
|
1139
|
+
assertMarkoSpreadAttribute(opts?: object | null): asserts this is NodePath<t.MarkoSpreadAttribute>;
|
|
1140
|
+
assertMarkoTagBody(opts?: object | null): asserts this is NodePath<t.MarkoTagBody>;
|
|
1141
|
+
assertMarkoTag(opts?: object | null): asserts this is NodePath<t.MarkoTag>;
|
|
1142
1142
|
assertAccessor(opts?: object): asserts this is NodePath<t.Accessor>;
|
|
1143
1143
|
assertAnyTypeAnnotation(opts?: object): asserts this is NodePath<t.AnyTypeAnnotation>;
|
|
1144
1144
|
assertArgumentPlaceholder(opts?: object): asserts this is NodePath<t.ArgumentPlaceholder>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1741,6 +1741,7 @@ export interface MarkoTagBody extends BaseNode {
|
|
|
1741
1741
|
type: "MarkoTagBody";
|
|
1742
1742
|
body: Array<MarkoTag | MarkoCDATA | MarkoText | MarkoPlaceholder | MarkoScriptlet | MarkoComment>;
|
|
1743
1743
|
params: Array<Identifier | Pattern | RestElement>;
|
|
1744
|
+
attributeTags: boolean;
|
|
1744
1745
|
typeParameters: TSTypeParameterDeclaration | null;
|
|
1745
1746
|
}
|
|
1746
1747
|
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
|
-
"version": "5.37.
|
|
3
|
+
"version": "5.37.25",
|
|
4
4
|
"description": "Marko template to JS compiler.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"babel",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@babel/traverse": "^7.25.9",
|
|
67
67
|
"@babel/types": "^7.26.0",
|
|
68
68
|
"@luxass/strip-json-comments": "^1.3.2",
|
|
69
|
-
"@marko/babel-utils": "^6.5.
|
|
69
|
+
"@marko/babel-utils": "^6.5.13",
|
|
70
70
|
"complain": "^1.6.1",
|
|
71
71
|
"he": "^1.2.0",
|
|
72
72
|
"htmljs-parser": "^5.5.2",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"source-map-support": "^0.5.21"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@marko/translator-default": "^6.0.
|
|
83
|
+
"@marko/translator-default": "^6.0.25"
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|