marko 6.4.9 → 6.4.10
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/cheatsheet.md +1 -1
- package/dist/debug/dom/catch.feat.js +2 -3
- package/dist/debug/dom/catch.feat.mjs +2 -3
- package/dist/debug/dom/controllable-input.feat.js +2 -3
- package/dist/debug/dom/controllable-input.feat.mjs +2 -3
- package/dist/debug/dom/controllable-open.feat.js +2 -3
- package/dist/debug/dom/controllable-open.feat.mjs +2 -3
- package/dist/debug/dom/controllable-select.feat.js +2 -3
- package/dist/debug/dom/controllable-select.feat.mjs +2 -3
- package/dist/debug/dom/controllable-textarea.feat.js +2 -3
- package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/debug/dom/controllable.feat.js +2 -3
- package/dist/debug/dom/controllable.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
- package/dist/debug/dom/lazy.feat.js +2 -3
- package/dist/debug/dom/lazy.feat.mjs +2 -3
- package/dist/debug/dom/placeholder.feat.js +2 -3
- package/dist/debug/dom/placeholder.feat.mjs +2 -3
- package/dist/debug/{dom-VKjkbuuo.mjs → dom-C1V5vpFs.mjs} +24 -48
- package/dist/debug/{dom-QkYva5Qx.js → dom-DNB5yq3U.js} +24 -48
- package/dist/debug/dom.js +6 -11
- package/dist/debug/dom.mjs +6 -11
- package/dist/debug/html.js +19 -38
- package/dist/debug/html.mjs +19 -38
- package/dist/dom/catch.feat.js +2 -3
- package/dist/dom/catch.feat.mjs +2 -3
- package/dist/dom/controllable-input.feat.js +1 -2
- package/dist/dom/controllable-input.feat.mjs +1 -2
- package/dist/dom/controllable-open.feat.js +2 -3
- package/dist/dom/controllable-open.feat.mjs +2 -3
- package/dist/dom/controllable-select.feat.js +2 -3
- package/dist/dom/controllable-select.feat.mjs +2 -3
- package/dist/dom/controllable-textarea.feat.js +2 -3
- package/dist/dom/controllable-textarea.feat.mjs +2 -3
- package/dist/dom/controllable.feat.js +1 -2
- package/dist/dom/controllable.feat.mjs +1 -2
- package/dist/dom/dynamic-tag-script.feat.js +2 -3
- package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
- package/dist/dom/dynamic-tag-var.feat.js +1 -2
- package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
- package/dist/dom/lazy.feat.js +2 -3
- package/dist/dom/lazy.feat.mjs +2 -3
- package/dist/dom/placeholder.feat.js +2 -3
- package/dist/dom/placeholder.feat.mjs +2 -3
- package/dist/{dom-IujlfJ6b.js → dom-C2-Flitp.js} +40 -60
- package/dist/{dom-DtKQb840.mjs → dom-DsHYWMCR.mjs} +40 -61
- package/dist/dom.js +6 -10
- package/dist/dom.mjs +6 -11
- package/dist/html.js +39 -59
- package/dist/html.mjs +39 -60
- package/dist/translator/index.js +222 -355
- package/dist/translator/util/assert.d.ts +9 -2
- package/dist/translator/util/known-tag.d.ts +3 -0
- package/dist/translator/util/sources.d.ts +1 -1
- package/dist/translator/util/tag-name-type.d.ts +3 -0
- package/package.json +6 -6
- package/tags/lifecycle.d.marko +2 -0
package/dist/translator/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -30,7 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
value: mod,
|
|
31
31
|
enumerable: true
|
|
32
32
|
}) : target, mod));
|
|
33
|
-
//#endregion
|
|
34
33
|
let package_json = require("../../package.json");
|
|
35
34
|
package_json = __toESM(package_json, 1);
|
|
36
35
|
let _marko_compiler = require("@marko/compiler");
|
|
@@ -39,17 +38,15 @@ let path = require("path");
|
|
|
39
38
|
path = __toESM(path, 1);
|
|
40
39
|
let fastest_levenshtein = require("fastest-levenshtein");
|
|
41
40
|
let magic_string = require("magic-string");
|
|
42
|
-
magic_string = __toESM(magic_string, 1);
|
|
43
41
|
let _marko_compiler_internal_babel = require("@marko/compiler/internal/babel");
|
|
44
42
|
let _marko_compiler_modules = require("@marko/compiler/modules");
|
|
45
43
|
_marko_compiler_modules = __toESM(_marko_compiler_modules, 1);
|
|
46
|
-
|
|
44
|
+
// src/translator/util/runtime-info.ts
|
|
47
45
|
var runtime_info_default = {
|
|
48
46
|
name: package_json.default.name,
|
|
49
47
|
taglibId: "marko-core"
|
|
50
48
|
};
|
|
51
|
-
|
|
52
|
-
//#region src/common/constants/accessor-prefix.debug.ts
|
|
49
|
+
// src/common/constants/accessor-prefix.debug.ts
|
|
53
50
|
var accessor_prefix_debug_exports = /* @__PURE__ */ __exportAll({
|
|
54
51
|
BranchScopes: () => BranchScopes$3,
|
|
55
52
|
ClosureScopes: () => ClosureScopes$1,
|
|
@@ -86,8 +83,7 @@ const Lifecycle$1 = "Lifecycle:";
|
|
|
86
83
|
const Promise$2 = "Promise:";
|
|
87
84
|
const TagVariableChange$3 = "TagVariableChange:";
|
|
88
85
|
const TryBranch$3 = "TryBranch:";
|
|
89
|
-
|
|
90
|
-
//#region src/common/constants/accessor-prop.debug.ts
|
|
86
|
+
// src/common/constants/accessor-prop.debug.ts
|
|
91
87
|
var accessor_prop_debug_exports = /* @__PURE__ */ __exportAll({
|
|
92
88
|
AbortControllers: () => AbortControllers$1,
|
|
93
89
|
AbortScopes: () => AbortScopes$1,
|
|
@@ -152,8 +148,7 @@ const Subscriptions$1 = "#Subscriptions";
|
|
|
152
148
|
const TagVariable$1 = "#TagVariable";
|
|
153
149
|
const TagVariableChange$2 = "#TagVariableChange";
|
|
154
150
|
const TryBranch$2 = "#TryBranch";
|
|
155
|
-
|
|
156
|
-
//#region src/html/serializer.ts
|
|
151
|
+
// src/html/serializer.ts
|
|
157
152
|
const kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator");
|
|
158
153
|
const { hasOwnProperty } = {};
|
|
159
154
|
Array.prototype;
|
|
@@ -174,8 +169,7 @@ function patchIteratorNext(proto) {
|
|
|
174
169
|
};
|
|
175
170
|
proto.next[kTouchedIterator] = true;
|
|
176
171
|
}
|
|
177
|
-
|
|
178
|
-
//#region src/translator/util/optional.ts
|
|
172
|
+
// src/translator/util/optional.ts
|
|
179
173
|
var Sorted = class {
|
|
180
174
|
compare;
|
|
181
175
|
constructor(compare) {
|
|
@@ -609,8 +603,7 @@ function last(data) {
|
|
|
609
603
|
function rest(data) {
|
|
610
604
|
return Array.isArray(data) ? data.length === 2 ? data[1] : data.slice(1) : void 0;
|
|
611
605
|
}
|
|
612
|
-
|
|
613
|
-
//#region src/translator/util/get-tag-name.ts
|
|
606
|
+
// src/translator/util/get-tag-name.ts
|
|
614
607
|
function getTagName(tag) {
|
|
615
608
|
switch (tag.node.name.type) {
|
|
616
609
|
case "StringLiteral": return tag.node.name.value;
|
|
@@ -620,12 +613,10 @@ function getTagName(tag) {
|
|
|
620
613
|
function getTagNameHint(node) {
|
|
621
614
|
return _marko_compiler.types.isIdentifier(node.name) ? node.name.name : _marko_compiler.types.isStringLiteral(node.name) ? node.name.value : "tag";
|
|
622
615
|
}
|
|
623
|
-
|
|
624
|
-
//#region src/translator/util/constants/compile-stage.ts
|
|
616
|
+
// src/translator/util/constants/compile-stage.ts
|
|
625
617
|
const analyze$1 = "analyze";
|
|
626
618
|
const translate$1 = "translate";
|
|
627
|
-
|
|
628
|
-
//#region src/translator/util/get-compile-stage.ts
|
|
619
|
+
// src/translator/util/get-compile-stage.ts
|
|
629
620
|
function isTranslate() {
|
|
630
621
|
return getCompileStage() === translate$1;
|
|
631
622
|
}
|
|
@@ -635,8 +626,7 @@ function isAnalyzing(file) {
|
|
|
635
626
|
function getCompileStage(file = (0, _marko_compiler_babel_utils.getFile)()) {
|
|
636
627
|
return file.___compileStage;
|
|
637
628
|
}
|
|
638
|
-
|
|
639
|
-
//#region src/translator/util/replace-with-statements.ts
|
|
629
|
+
// src/translator/util/replace-with-statements.ts
|
|
640
630
|
const replacements = /* @__PURE__ */ new WeakMap();
|
|
641
631
|
function replaceWithStatements(path, statements) {
|
|
642
632
|
path.skip();
|
|
@@ -659,8 +649,7 @@ function writeBodyStatements(body) {
|
|
|
659
649
|
}
|
|
660
650
|
body.body = statements;
|
|
661
651
|
}
|
|
662
|
-
|
|
663
|
-
//#region src/translator/util/state.ts
|
|
652
|
+
// src/translator/util/state.ts
|
|
664
653
|
function createOutputState(init) {
|
|
665
654
|
return createKeyedState(_marko_compiler_babel_utils.getProgram, init);
|
|
666
655
|
}
|
|
@@ -698,8 +687,7 @@ function createSectionState(createState, init) {
|
|
|
698
687
|
getBySection().set(section, value);
|
|
699
688
|
}];
|
|
700
689
|
}
|
|
701
|
-
|
|
702
|
-
//#region src/translator/util/traverse.ts
|
|
690
|
+
// src/translator/util/traverse.ts
|
|
703
691
|
const skip = Symbol("skip");
|
|
704
692
|
function traverseReplace(container, key, exit, state) {
|
|
705
693
|
const node = container[key];
|
|
@@ -754,8 +742,7 @@ function traverse(visit, node, parent, grandParent) {
|
|
|
754
742
|
else if (visit(node, parent, grandParent) !== skip) for (const key of _marko_compiler.types.VISITOR_KEYS[node.type]) traverse(visit, node[key], node, parent);
|
|
755
743
|
}
|
|
756
744
|
}
|
|
757
|
-
|
|
758
|
-
//#region src/translator/util/generate-uid.ts
|
|
745
|
+
// src/translator/util/generate-uid.ts
|
|
759
746
|
const kUidCounts = Symbol("uid counts");
|
|
760
747
|
const countsForFile = /* @__PURE__ */ new WeakMap();
|
|
761
748
|
function generateUid(name = "") {
|
|
@@ -815,8 +802,7 @@ function getInitialCounts(file) {
|
|
|
815
802
|
}, program.node);
|
|
816
803
|
return counts;
|
|
817
804
|
}
|
|
818
|
-
|
|
819
|
-
//#region src/translator/util/get-parent-tag.ts
|
|
805
|
+
// src/translator/util/get-parent-tag.ts
|
|
820
806
|
function getParentTag(tag) {
|
|
821
807
|
const parent = tag.parent.type === "MarkoTagBody" ? tag.parentPath.parentPath : tag.parentPath;
|
|
822
808
|
if (parent.type === "MarkoTag") return parent;
|
|
@@ -826,8 +812,7 @@ function getAttributeTagParent(tag) {
|
|
|
826
812
|
while ((0, _marko_compiler_babel_utils.isAttributeTag)(cur) || (0, _marko_compiler_babel_utils.isTransparentTag)(cur)) cur = getParentTag(cur);
|
|
827
813
|
return cur;
|
|
828
814
|
}
|
|
829
|
-
|
|
830
|
-
//#region src/translator/util/is-core-tag.ts
|
|
815
|
+
// src/translator/util/is-core-tag.ts
|
|
831
816
|
const { taglibId } = runtime_info_default;
|
|
832
817
|
const htmlTaglibId = "marko-html";
|
|
833
818
|
function isCoreTag(tag) {
|
|
@@ -854,8 +839,7 @@ function isConditionTag(tag) {
|
|
|
854
839
|
}
|
|
855
840
|
return false;
|
|
856
841
|
}
|
|
857
|
-
|
|
858
|
-
//#region src/translator/util/nested-attribute-tags.ts
|
|
842
|
+
// src/translator/util/nested-attribute-tags.ts
|
|
859
843
|
const [getAttrTagIdentifiers] = createOutputState(() => /* @__PURE__ */ new WeakMap());
|
|
860
844
|
function getAttrTagIdentifier(meta) {
|
|
861
845
|
const identifiers = getAttrTagIdentifiers();
|
|
@@ -958,16 +942,14 @@ function getConditionRoot(tag) {
|
|
|
958
942
|
prev = prev.getPrevSibling();
|
|
959
943
|
}
|
|
960
944
|
}
|
|
961
|
-
|
|
962
|
-
//#region src/translator/util/constants/structure-kind.ts
|
|
945
|
+
// src/translator/util/constants/structure-kind.ts
|
|
963
946
|
const Node = "node";
|
|
964
947
|
const Text = "text";
|
|
965
948
|
const Child = "child";
|
|
966
949
|
const ModuleRead = "moduleRead";
|
|
967
950
|
const SectionRef = "sectionRef";
|
|
968
951
|
const ExportRef = "exportRef";
|
|
969
|
-
|
|
970
|
-
//#region src/translator/util/cyclic-memo.ts
|
|
952
|
+
// src/translator/util/cyclic-memo.ts
|
|
971
953
|
let computations = 0;
|
|
972
954
|
let provisionalAt = Infinity;
|
|
973
955
|
function createCyclicMemo(compute, cycleAnswer) {
|
|
@@ -1023,8 +1005,7 @@ function ensurePropKeys(pathKeys, property) {
|
|
|
1023
1005
|
if (!next) (pathKeys.properties ??= /* @__PURE__ */ new Map()).set(property, next = {});
|
|
1024
1006
|
return next;
|
|
1025
1007
|
}
|
|
1026
|
-
|
|
1027
|
-
//#region src/translator/util/slots.ts
|
|
1008
|
+
// src/translator/util/slots.ts
|
|
1028
1009
|
function ensureSlot(binding, kind = 0, section, group) {
|
|
1029
1010
|
const owner = getCanonicalBinding(binding);
|
|
1030
1011
|
return ensureIn(section || owner.section, owner, kind, group);
|
|
@@ -1076,8 +1057,7 @@ function compareSlotTo(slot, order, kind, group) {
|
|
|
1076
1057
|
function getOwnerOrder(owner) {
|
|
1077
1058
|
return "uid" in owner ? owner.uid : -1 - owner.id;
|
|
1078
1059
|
}
|
|
1079
|
-
|
|
1080
|
-
//#region src/translator/util/get-root.ts
|
|
1060
|
+
// src/translator/util/get-root.ts
|
|
1081
1061
|
function getMarkoRoot(path) {
|
|
1082
1062
|
let curPath = path;
|
|
1083
1063
|
do
|
|
@@ -1137,8 +1117,7 @@ function isFunctionOrVariableDeclaration(path) {
|
|
|
1137
1117
|
default: return false;
|
|
1138
1118
|
}
|
|
1139
1119
|
}
|
|
1140
|
-
|
|
1141
|
-
//#region src/translator/util/is-invoked-function.ts
|
|
1120
|
+
// src/translator/util/is-invoked-function.ts
|
|
1142
1121
|
function isInvokedFunction(expr) {
|
|
1143
1122
|
let curPath = expr;
|
|
1144
1123
|
while (curPath) {
|
|
@@ -1154,13 +1133,11 @@ function isInvokedFunction(expr) {
|
|
|
1154
1133
|
}
|
|
1155
1134
|
return false;
|
|
1156
1135
|
}
|
|
1157
|
-
|
|
1158
|
-
//#region src/translator/util/is-static.ts
|
|
1136
|
+
// src/translator/util/is-static.ts
|
|
1159
1137
|
function isStatic(path) {
|
|
1160
1138
|
return path.isImportDeclaration() || path.isExportDeclaration() || path.isMarkoScriptlet({ static: true });
|
|
1161
1139
|
}
|
|
1162
|
-
|
|
1163
|
-
//#region src/translator/util/marko-config.ts
|
|
1140
|
+
// src/translator/util/marko-config.ts
|
|
1164
1141
|
function isOutputHTML() {
|
|
1165
1142
|
return getMarkoOpts().output === "html";
|
|
1166
1143
|
}
|
|
@@ -1178,8 +1155,7 @@ function getReadyId(file = (0, _marko_compiler_babel_utils.getFile)()) {
|
|
|
1178
1155
|
if (!markoOpts.linkAssets) return void 0;
|
|
1179
1156
|
return (markoOpts.optimize ? "_" : "ready:") + (0, _marko_compiler_babel_utils.getTemplateId)(markoOpts, file.opts.filename);
|
|
1180
1157
|
}
|
|
1181
|
-
|
|
1182
|
-
//#region src/translator/util/for-each-identifier.ts
|
|
1158
|
+
// src/translator/util/for-each-identifier.ts
|
|
1183
1159
|
function forEachIdentifier(node, cb) {
|
|
1184
1160
|
switch (node.type) {
|
|
1185
1161
|
case "ObjectPattern":
|
|
@@ -1221,13 +1197,11 @@ function forEachIdentifierPath(nodePath, cb) {
|
|
|
1221
1197
|
}
|
|
1222
1198
|
}
|
|
1223
1199
|
}
|
|
1224
|
-
|
|
1225
|
-
//#region src/translator/util/is-event-or-change-handler.ts
|
|
1200
|
+
// src/translator/util/is-event-or-change-handler.ts
|
|
1226
1201
|
function isEventOrChangeHandler(prop) {
|
|
1227
1202
|
return /^on[-A-Z]|[a-zA-Z_$][a-zA-Z0-9_$]*Change$/.test(prop);
|
|
1228
1203
|
}
|
|
1229
|
-
|
|
1230
|
-
//#region src/translator/util/sources.ts
|
|
1204
|
+
// src/translator/util/sources.ts
|
|
1231
1205
|
const ALWAYS = {
|
|
1232
1206
|
state: void 0,
|
|
1233
1207
|
param: void 0,
|
|
@@ -1241,7 +1215,7 @@ const globalSources = {
|
|
|
1241
1215
|
always: void 0
|
|
1242
1216
|
};
|
|
1243
1217
|
function sharesSources(a, b) {
|
|
1244
|
-
return !!a.sources && !!b.sources && (bindingUtil.intersects(a.sources.state, b.sources.state) ||
|
|
1218
|
+
return !!a.sources && !!b.sources && (bindingUtil.intersects(a.sources.state, b.sources.state) || some(a.sources.param, (param) => isCoveredParam(param, b.sources.param)) || some(b.sources.param, (param) => isCoveredParam(param, a.sources.param)));
|
|
1245
1219
|
}
|
|
1246
1220
|
function createSources(state, param, global, always) {
|
|
1247
1221
|
/* v8 ignore next 6 -- every caller passes at least one source */
|
|
@@ -1288,7 +1262,7 @@ function unionParamSources(a, b) {
|
|
|
1288
1262
|
return bindingUtil.union(dropCovered(a, b), dropCovered(b, a));
|
|
1289
1263
|
}
|
|
1290
1264
|
function dropCovered(params, other) {
|
|
1291
|
-
return bindingUtil.filter(params, (binding) => !
|
|
1265
|
+
return bindingUtil.filter(params, (binding) => !isCoveredParam(binding.aliasOf, other));
|
|
1292
1266
|
}
|
|
1293
1267
|
function isInParams(binding, params) {
|
|
1294
1268
|
return bindingUtil.has(params, binding);
|
|
@@ -1296,10 +1270,12 @@ function isInParams(binding, params) {
|
|
|
1296
1270
|
function isSupersetSources(a, b) {
|
|
1297
1271
|
if (!b.sources) return true;
|
|
1298
1272
|
if (!a.sources) return false;
|
|
1299
|
-
return bindingUtil.isSuperset(a.sources.state, b.sources.state) &&
|
|
1273
|
+
return bindingUtil.isSuperset(a.sources.state, b.sources.state) && every(b.sources.param, (param) => isCoveredParam(param, a.sources.param));
|
|
1300
1274
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1275
|
+
function isCoveredParam(binding, params) {
|
|
1276
|
+
return someUpToAliasRoot(binding, isInParams, params);
|
|
1277
|
+
}
|
|
1278
|
+
// src/translator/util/to-property-name.ts
|
|
1303
1279
|
function getMemberExpressionPropString(expr) {
|
|
1304
1280
|
switch (expr.property.type) {
|
|
1305
1281
|
case "StringLiteral": return expr.property.value;
|
|
@@ -1331,8 +1307,7 @@ function toMemberExpression(object, key, optional) {
|
|
|
1331
1307
|
const computed = prop.type !== "Identifier";
|
|
1332
1308
|
return optional ? _marko_compiler.types.optionalMemberExpression(object, prop, computed, true) : _marko_compiler.types.memberExpression(object, prop, computed);
|
|
1333
1309
|
}
|
|
1334
|
-
|
|
1335
|
-
//#region src/translator/util/references.ts
|
|
1310
|
+
// src/translator/util/references.ts
|
|
1336
1311
|
const kReferencedBindings = Symbol("referenced bindings");
|
|
1337
1312
|
const kLazyBindings = Symbol("lazy bindings");
|
|
1338
1313
|
const kReferencedBindingsInFunction = Symbol("referenced bindings in function");
|
|
@@ -1897,8 +1872,7 @@ function addNumericPropertiesUntil(properties, len) {
|
|
|
1897
1872
|
for (let i = len; i--;) result = propertiesUtil.add(result, i + "");
|
|
1898
1873
|
return result;
|
|
1899
1874
|
}
|
|
1900
|
-
|
|
1901
|
-
//#region src/translator/util/runtime.ts
|
|
1875
|
+
// src/translator/util/runtime.ts
|
|
1902
1876
|
const pureDOMFunctions = /* @__PURE__ */ new Set([
|
|
1903
1877
|
"_await_promise",
|
|
1904
1878
|
"_await_content",
|
|
@@ -2015,8 +1989,7 @@ function getCompatRuntimeFile() {
|
|
|
2015
1989
|
const markoOpts = getMarkoOpts();
|
|
2016
1990
|
return `marko/${markoOpts.optimize ? "dist" : "src"}/runtime/helpers/tags-compat/${isOutputHTML() ? "html" : "dom"}${markoOpts.optimize ? "" : "-debug"}.${markoOpts.modules === "esm" ? "mjs" : "js"}`;
|
|
2017
1991
|
}
|
|
2018
|
-
|
|
2019
|
-
//#region src/translator/util/module-registrations.ts
|
|
1992
|
+
// src/translator/util/module-registrations.ts
|
|
2020
1993
|
const kRegisteredExports = Symbol("registered exports");
|
|
2021
1994
|
const [getReferencesByFn] = createAnalysisState(() => /* @__PURE__ */ new Map());
|
|
2022
1995
|
const [getReferencesByImport] = createAnalysisState(() => /* @__PURE__ */ new Map());
|
|
@@ -2189,8 +2162,8 @@ function getExportableName(fn) {
|
|
|
2189
2162
|
if (node.type === "FunctionDeclaration") return node.id?.name;
|
|
2190
2163
|
if (_marko_compiler.types.isVariableDeclarator(parent) && parent.init === node && _marko_compiler.types.isIdentifier(parent.id) && _marko_compiler.types.isVariableDeclaration(fn.parentPath.parent, { kind: "const" })) return parent.id.name;
|
|
2191
2164
|
}
|
|
2192
|
-
function getStaticDeclExprs(path
|
|
2193
|
-
const decl = getDeclarationRoot(path
|
|
2165
|
+
function getStaticDeclExprs(path, exprs = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set(), fnRoots) {
|
|
2166
|
+
const decl = getDeclarationRoot(path);
|
|
2194
2167
|
if (decl && !seen.has(decl.node)) {
|
|
2195
2168
|
seen.add(decl.node);
|
|
2196
2169
|
const ids = decl.getOuterBindingIdentifiers();
|
|
@@ -2252,8 +2225,7 @@ function relativePath(from, to) {
|
|
|
2252
2225
|
const relative = path.default.relative(path.default.dirname(from), to).split(path.default.sep).join("/");
|
|
2253
2226
|
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
2254
2227
|
}
|
|
2255
|
-
|
|
2256
|
-
//#region src/translator/util/solve-reasons.ts
|
|
2228
|
+
// src/translator/util/solve-reasons.ts
|
|
2257
2229
|
function solveReasons(intersectionsBySection) {
|
|
2258
2230
|
let reasonsVersion;
|
|
2259
2231
|
do {
|
|
@@ -2288,14 +2260,14 @@ function hasReadIntermediate(member, partner, seen) {
|
|
|
2288
2260
|
return some(getBindingsDerivedFrom(member), (from) => {
|
|
2289
2261
|
if (seen.has(from) || !sharesSources(from, partner)) return false;
|
|
2290
2262
|
seen.add(from);
|
|
2291
|
-
if (bindingUtil.has(partner.sources.state, from) ||
|
|
2263
|
+
if (bindingUtil.has(partner.sources.state, from) || some(partner.sources.param, (param) => isCoveredParam(param, from))) return false;
|
|
2292
2264
|
return !!findSlot(from)?.reason || hasReadIntermediate(from, partner, seen);
|
|
2293
2265
|
});
|
|
2294
2266
|
}
|
|
2295
2267
|
function withoutOwnSources(closure, sources) {
|
|
2296
2268
|
const own = closure.sources;
|
|
2297
2269
|
if (!sources || !own || hasReadIntermediate(closure, closure, /* @__PURE__ */ new Set())) return sources;
|
|
2298
|
-
return withSources(sources, bindingUtil.difference(sources.state, own.state), bindingUtil.filter(sources.param, (binding) => !
|
|
2270
|
+
return withSources(sources, bindingUtil.difference(sources.state, own.state), bindingUtil.filter(sources.param, (binding) => !isCoveredParam(binding, own.param)));
|
|
2299
2271
|
}
|
|
2300
2272
|
function getBranchExprReason(section) {
|
|
2301
2273
|
const { derives, branchExpr } = section;
|
|
@@ -2499,8 +2471,7 @@ function renderingReaders(expr, binding) {
|
|
|
2499
2471
|
};
|
|
2500
2472
|
return expr.derives ? UNREAD : UNSEEN_READ;
|
|
2501
2473
|
}
|
|
2502
|
-
|
|
2503
|
-
//#region src/common/helpers.ts
|
|
2474
|
+
// src/common/helpers.ts
|
|
2504
2475
|
const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
|
|
2505
2476
|
const invalidAttrNameReg = /^[^a-z_$]|[^a-z0-9._:-]/i;
|
|
2506
2477
|
const knownWrongAttrs = {
|
|
@@ -2592,8 +2563,7 @@ function isNullishOrFalse(value) {
|
|
|
2592
2563
|
return value == null || value === false;
|
|
2593
2564
|
}
|
|
2594
2565
|
const decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36);
|
|
2595
|
-
|
|
2596
|
-
//#region src/common/errors.ts
|
|
2566
|
+
// src/common/errors.ts
|
|
2597
2567
|
const lowercaseOnAttrReg = /^on[a-z]/;
|
|
2598
2568
|
function assertExclusiveAttrs(attrs, onError = throwErr, isSet = isTruthy) {
|
|
2599
2569
|
if (attrs) {
|
|
@@ -2627,8 +2597,7 @@ function joinWithAnd(a) {
|
|
|
2627
2597
|
default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
|
|
2628
2598
|
}
|
|
2629
2599
|
}
|
|
2630
|
-
|
|
2631
|
-
//#region src/html/attrs.ts
|
|
2600
|
+
// src/html/attrs.ts
|
|
2632
2601
|
function _attr_class(value) {
|
|
2633
2602
|
return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
|
|
2634
2603
|
}
|
|
@@ -2667,15 +2636,13 @@ function escapeDoubleQuotedAttrValue(value) {
|
|
|
2667
2636
|
function replaceUnsafeDoubleQuoteAttrChar(match) {
|
|
2668
2637
|
return match === "\"" ? """ : match === "\r" ? " " : "&";
|
|
2669
2638
|
}
|
|
2670
|
-
|
|
2671
|
-
//#region src/html/writer.ts
|
|
2639
|
+
// src/html/writer.ts
|
|
2672
2640
|
let $chunk;
|
|
2673
2641
|
function getState() {
|
|
2674
2642
|
return $chunk.boundary.state;
|
|
2675
2643
|
}
|
|
2676
2644
|
globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask;
|
|
2677
|
-
|
|
2678
|
-
//#region src/html/content.ts
|
|
2645
|
+
// src/html/content.ts
|
|
2679
2646
|
var content_exports = /* @__PURE__ */ __exportAll({
|
|
2680
2647
|
_escape: () => _escape,
|
|
2681
2648
|
_escape_comment: () => _escape_comment,
|
|
@@ -2722,8 +2689,7 @@ function escapeCommentStr(str) {
|
|
|
2722
2689
|
function _escape_comment(val) {
|
|
2723
2690
|
return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
|
|
2724
2691
|
}
|
|
2725
|
-
|
|
2726
|
-
//#region src/translator/util/evaluate.ts
|
|
2692
|
+
// src/translator/util/evaluate.ts
|
|
2727
2693
|
const kEvaluated = Symbol("evaluated");
|
|
2728
2694
|
function evaluate(value) {
|
|
2729
2695
|
return (value.extra ??= {})[kEvaluated] ??= computeEvaluated(value);
|
|
@@ -2811,8 +2777,7 @@ function isNullableExpr(expr) {
|
|
|
2811
2777
|
default: return true;
|
|
2812
2778
|
}
|
|
2813
2779
|
}
|
|
2814
|
-
|
|
2815
|
-
//#region src/translator/util/static-text.ts
|
|
2780
|
+
// src/translator/util/static-text.ts
|
|
2816
2781
|
function isStaticText(node) {
|
|
2817
2782
|
switch (node?.type) {
|
|
2818
2783
|
case "MarkoText": return true;
|
|
@@ -2832,8 +2797,7 @@ function getStaticPlaceholderText(placeholder) {
|
|
|
2832
2797
|
const { confident, computed } = evaluate(placeholder.value);
|
|
2833
2798
|
if (confident) return placeholder.escape ? _escape(computed) : _unescaped(computed);
|
|
2834
2799
|
}
|
|
2835
|
-
|
|
2836
|
-
//#region src/translator/util/tag-import.ts
|
|
2800
|
+
// src/translator/util/tag-import.ts
|
|
2837
2801
|
const triggerRegExp = /\s*([\w-]+)\s*([^?|]+?)?\s*(?:\?([^|]*?))?\s*(?:\||$)/g;
|
|
2838
2802
|
const derivedImports = /* @__PURE__ */ new WeakSet();
|
|
2839
2803
|
function trackTagImport(tagImport) {
|
|
@@ -2914,8 +2878,7 @@ function parseTriggerType(type) {
|
|
|
2914
2878
|
default: return isEventHandler(type) ? `on-${getEventType(type)}` : void 0;
|
|
2915
2879
|
}
|
|
2916
2880
|
}
|
|
2917
|
-
|
|
2918
|
-
//#region src/translator/util/tag-name-type.ts
|
|
2881
|
+
// src/translator/util/tag-name-type.ts
|
|
2919
2882
|
const kTagNameDynamic = Symbol("tag name dynamic");
|
|
2920
2883
|
const MARKO_FILE_REG = /^<.*>$|\.marko$/;
|
|
2921
2884
|
const TAG_NAME_IDENTIFIER_REG$1 = /^[A-Z][a-zA-Z0-9_$]*$/;
|
|
@@ -2924,12 +2887,12 @@ function analyzeTagNameType(tag) {
|
|
|
2924
2887
|
if (extra.tagNameType === void 0) {
|
|
2925
2888
|
const name = tag.get("name");
|
|
2926
2889
|
let load;
|
|
2927
|
-
if (
|
|
2928
|
-
extra.tagNameType = name.node.value[0] === "@" ? 3 : (0, _marko_compiler_babel_utils.isNativeTag)(tag) ? 0 : 1;
|
|
2929
|
-
extra.tagNameNullable = extra[kTagNameDynamic] = false;
|
|
2930
|
-
} else if (name.isTemplateLiteral() && name.node.quasis.length === 1) {
|
|
2890
|
+
if (isStaticNativeTag(tag)) {
|
|
2931
2891
|
extra.tagNameType = 0;
|
|
2932
2892
|
extra.tagNameNullable = extra[kTagNameDynamic] = false;
|
|
2893
|
+
} else if (name.isStringLiteral()) {
|
|
2894
|
+
extra.tagNameType = name.node.value[0] === "@" ? 3 : 1;
|
|
2895
|
+
extra.tagNameNullable = extra[kTagNameDynamic] = false;
|
|
2933
2896
|
} else if (name.isIdentifier()) {
|
|
2934
2897
|
load = analyzeExpressionTagName(name, extra);
|
|
2935
2898
|
extra[kTagNameDynamic] = !extra.tagNameImported;
|
|
@@ -2958,6 +2921,12 @@ function analyzeTagNameType(tag) {
|
|
|
2958
2921
|
}
|
|
2959
2922
|
return extra[kTagNameDynamic] ? 2 : extra.tagNameType;
|
|
2960
2923
|
}
|
|
2924
|
+
/** A native element by its name alone: the tag lookup's verdict on a string, or
|
|
2925
|
+
* a template literal without expressions. Loads no template, so pre-analyze may ask. */
|
|
2926
|
+
function isStaticNativeTag(tag) {
|
|
2927
|
+
const { name } = tag.node;
|
|
2928
|
+
return _marko_compiler.types.isStringLiteral(name) ? (0, _marko_compiler_babel_utils.isNativeTag)(tag) : _marko_compiler.types.isTemplateLiteral(name) && name.quasis.length === 1;
|
|
2929
|
+
}
|
|
2961
2930
|
function analyzeExpressionTagName(name, extra) {
|
|
2962
2931
|
const pending = [name];
|
|
2963
2932
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3123,8 +3092,7 @@ function getSimilarTagHint(tagName) {
|
|
|
3123
3092
|
}
|
|
3124
3093
|
return closestTag ? ` Did you mean \`<${closestTag}>\`?` : "";
|
|
3125
3094
|
}
|
|
3126
|
-
|
|
3127
|
-
//#region src/translator/util/tag-facts.ts
|
|
3095
|
+
// src/translator/util/tag-facts.ts
|
|
3128
3096
|
const noContentFacts = { content: null };
|
|
3129
3097
|
const coreTagFacts = {
|
|
3130
3098
|
attrs: noContentFacts,
|
|
@@ -3291,8 +3259,7 @@ function getStyleContentType(tag) {
|
|
|
3291
3259
|
function isMarkoPlaceholder(node) {
|
|
3292
3260
|
return _marko_compiler.types.isMarkoPlaceholder(node);
|
|
3293
3261
|
}
|
|
3294
|
-
|
|
3295
|
-
//#region src/translator/util/with-comment.ts
|
|
3262
|
+
// src/translator/util/with-comment.ts
|
|
3296
3263
|
function withLeadingComment(node, value) {
|
|
3297
3264
|
if (value) {
|
|
3298
3265
|
const comment = {
|
|
@@ -3303,8 +3270,7 @@ function withLeadingComment(node, value) {
|
|
|
3303
3270
|
}
|
|
3304
3271
|
return node;
|
|
3305
3272
|
}
|
|
3306
|
-
|
|
3307
|
-
//#region src/translator/util/write-guard.ts
|
|
3273
|
+
// src/translator/util/write-guard.ts
|
|
3308
3274
|
function isSameReason(a, b) {
|
|
3309
3275
|
return a === b || (a && b ? a.always && b.always || compareSources(a, b) === 0 : false);
|
|
3310
3276
|
}
|
|
@@ -3478,8 +3444,7 @@ function isConditionalSlot(slot) {
|
|
|
3478
3444
|
function scopeReasonIdentifier(section) {
|
|
3479
3445
|
return _marko_compiler.types.identifier(ensureSharedUid(`scope${section.id}_reason`, section));
|
|
3480
3446
|
}
|
|
3481
|
-
|
|
3482
|
-
//#region src/translator/util/sections.ts
|
|
3447
|
+
// src/translator/util/sections.ts
|
|
3483
3448
|
const sectionUtil = new Sorted(function compareSections(a, b) {
|
|
3484
3449
|
return a.id - b.id;
|
|
3485
3450
|
});
|
|
@@ -3773,8 +3738,7 @@ function setReadsOwner(from, to) {
|
|
|
3773
3738
|
function markReadsOwner(section) {
|
|
3774
3739
|
section.readsOwner = true;
|
|
3775
3740
|
}
|
|
3776
|
-
|
|
3777
|
-
//#region src/translator/util/content-derives.ts
|
|
3741
|
+
// src/translator/util/content-derives.ts
|
|
3778
3742
|
const [getTagContentDerives] = createAnalysisSectionState(() => /* @__PURE__ */ new Map());
|
|
3779
3743
|
function setTagContentDerives(tag, binding, exprs) {
|
|
3780
3744
|
if (binding) getTagContentDerives(getSection(tag)).set(tag, {
|
|
@@ -3805,8 +3769,7 @@ function setContentDerives(tag, tagExtra, binding, exprs, properties, skip) {
|
|
|
3805
3769
|
} else setContentDerives(child, tagExtra, binding, exprs, properties, true);
|
|
3806
3770
|
}
|
|
3807
3771
|
}
|
|
3808
|
-
|
|
3809
|
-
//#region src/translator/util/params-tree.ts
|
|
3772
|
+
// src/translator/util/params-tree.ts
|
|
3810
3773
|
function exposeParamsTree(binding, bodyAnalyzed) {
|
|
3811
3774
|
binding.exposed = true;
|
|
3812
3775
|
const tree = {
|
|
@@ -3881,8 +3844,7 @@ function getAllKnownPropertyNames(paramsTree) {
|
|
|
3881
3844
|
function hasAllKnownProperties(paramsTree) {
|
|
3882
3845
|
return paramsTree.properties && (!paramsTree.rest || !!paramsTree.rest.properties);
|
|
3883
3846
|
}
|
|
3884
|
-
|
|
3885
|
-
//#region src/common/constants/accessor-prefix.ts
|
|
3847
|
+
// src/common/constants/accessor-prefix.ts
|
|
3886
3848
|
var accessor_prefix_exports = /* @__PURE__ */ __exportAll({
|
|
3887
3849
|
BranchScopes: () => "A",
|
|
3888
3850
|
ClosureScopes: () => "B",
|
|
@@ -3902,8 +3864,7 @@ var accessor_prefix_exports = /* @__PURE__ */ __exportAll({
|
|
|
3902
3864
|
TagVariableChange: () => "M",
|
|
3903
3865
|
TryBranch: () => "Q"
|
|
3904
3866
|
});
|
|
3905
|
-
|
|
3906
|
-
//#region src/common/constants/accessor-prop.ts
|
|
3867
|
+
// src/common/constants/accessor-prop.ts
|
|
3907
3868
|
var accessor_prop_exports = /* @__PURE__ */ __exportAll({
|
|
3908
3869
|
AbortControllers: () => "A",
|
|
3909
3870
|
AbortScopes: () => "B",
|
|
@@ -3938,16 +3899,14 @@ var accessor_prop_exports = /* @__PURE__ */ __exportAll({
|
|
|
3938
3899
|
TagVariableChange: () => "U",
|
|
3939
3900
|
TryBranch: () => "PT"
|
|
3940
3901
|
});
|
|
3941
|
-
|
|
3942
|
-
//#region src/translator/util/get-accessor-enums.ts
|
|
3902
|
+
// src/translator/util/get-accessor-enums.ts
|
|
3943
3903
|
function getAccessorPrefix() {
|
|
3944
3904
|
return isOptimize() ? accessor_prefix_exports : accessor_prefix_debug_exports;
|
|
3945
3905
|
}
|
|
3946
3906
|
function getAccessorProp() {
|
|
3947
3907
|
return isOptimize() ? accessor_prop_exports : accessor_prop_debug_exports;
|
|
3948
3908
|
}
|
|
3949
|
-
|
|
3950
|
-
//#region src/translator/util/scope-accessor.ts
|
|
3909
|
+
// src/translator/util/scope-accessor.ts
|
|
3951
3910
|
function getSlotAccessor(slot) {
|
|
3952
3911
|
switch (slot.kind) {
|
|
3953
3912
|
case 0: return getScopeAccessor(slot.owner);
|
|
@@ -4013,8 +3972,7 @@ function getSectionInstancesAccessor(section) {
|
|
|
4013
3972
|
function getSectionScopesAccessorLiteral(section) {
|
|
4014
3973
|
return _marko_compiler.types.stringLiteral(getSectionInstancesAccessor(section));
|
|
4015
3974
|
}
|
|
4016
|
-
|
|
4017
|
-
//#region src/translator/util/scope-read.ts
|
|
3975
|
+
// src/translator/util/scope-read.ts
|
|
4018
3976
|
let scopeIdentifier;
|
|
4019
3977
|
let localsIdentifier;
|
|
4020
3978
|
function createScopeIdentifiers() {
|
|
@@ -4037,8 +3995,7 @@ function createScopeReadExpression(reference, section = reference.section) {
|
|
|
4037
3995
|
}
|
|
4038
3996
|
return expr;
|
|
4039
3997
|
}
|
|
4040
|
-
|
|
4041
|
-
//#region src/translator/util/section-renderer.ts
|
|
3998
|
+
// src/translator/util/section-renderer.ts
|
|
4042
3999
|
function getSectionRendererIdentifier(section) {
|
|
4043
4000
|
return isSectionRendererElided(section) ? void 0 : _marko_compiler.types.identifier(section.name);
|
|
4044
4001
|
}
|
|
@@ -4055,8 +4012,7 @@ function isPropertyPathRead(binding, properties) {
|
|
|
4055
4012
|
for (const alias of binding.aliases) if (isPropertyPathRead(alias, properties)) return true;
|
|
4056
4013
|
return false;
|
|
4057
4014
|
}
|
|
4058
|
-
|
|
4059
|
-
//#region src/translator/util/setup-work.ts
|
|
4015
|
+
// src/translator/util/setup-work.ts
|
|
4060
4016
|
const [getSetupInfo] = createAnalysisSectionState(() => ({
|
|
4061
4017
|
always: false,
|
|
4062
4018
|
exprs: /* @__PURE__ */ new Set()
|
|
@@ -4093,8 +4049,7 @@ function hasOwnSetupWork(section) {
|
|
|
4093
4049
|
}
|
|
4094
4050
|
return false;
|
|
4095
4051
|
}
|
|
4096
|
-
|
|
4097
|
-
//#region src/translator/util/for-selector.ts
|
|
4052
|
+
// src/translator/util/for-selector.ts
|
|
4098
4053
|
function isForSelectorClosure(bodySection, closure) {
|
|
4099
4054
|
return !!bodySection.selector?.has(getCanonicalBinding(closure));
|
|
4100
4055
|
}
|
|
@@ -4150,8 +4105,7 @@ function readsKey(read, keyBinding) {
|
|
|
4150
4105
|
const binding = getPropertyAlias(read.binding, read.properties);
|
|
4151
4106
|
return !!binding && getCanonicalBinding(binding) === getCanonicalBinding(keyBinding);
|
|
4152
4107
|
}
|
|
4153
|
-
|
|
4154
|
-
//#region src/translator/util/get-declared-binding-expression.ts
|
|
4108
|
+
// src/translator/util/get-declared-binding-expression.ts
|
|
4155
4109
|
function getDeclaredBindingExpression(binding, inPlace = false) {
|
|
4156
4110
|
const canonicalBinding = getCanonicalBinding(binding);
|
|
4157
4111
|
if (canonicalBinding.localOf) return getDeclaredBindingExpression(canonicalBinding.localOf, inPlace);
|
|
@@ -4167,16 +4121,14 @@ function getDeclaredBindingExpression(binding, inPlace = false) {
|
|
|
4167
4121
|
}
|
|
4168
4122
|
return getDeclaredBindingExpression(aliased, inPlace);
|
|
4169
4123
|
}
|
|
4170
|
-
|
|
4171
|
-
//#region src/translator/util/with-previous-location.ts
|
|
4124
|
+
// src/translator/util/with-previous-location.ts
|
|
4172
4125
|
function withPreviousLocation(newNode, originalNode) {
|
|
4173
4126
|
newNode.start = originalNode.start;
|
|
4174
4127
|
newNode.loc = originalNode.loc;
|
|
4175
4128
|
newNode.end = originalNode.end;
|
|
4176
4129
|
return newNode;
|
|
4177
4130
|
}
|
|
4178
|
-
|
|
4179
|
-
//#region src/translator/util/read-replacement.ts
|
|
4131
|
+
// src/translator/util/read-replacement.ts
|
|
4180
4132
|
function getReadReplacement(node, signal) {
|
|
4181
4133
|
if (isOutputDOM() && !isOptimize() && node.type === "MemberExpression" && !node.computed && node.property.type === "Identifier" && node.object.extra?.binding?.type === 6 && getReferencedBindings(node.object.extra.exprRoot)) return callRuntime("_global_read", node.object, _marko_compiler.types.stringLiteral(node.property.name));
|
|
4182
4134
|
const { extra } = node;
|
|
@@ -4207,10 +4159,8 @@ function getReadReplacement(node, signal) {
|
|
|
4207
4159
|
function getDOMReadBase(read, section, signal) {
|
|
4208
4160
|
const { binding, properties, getter } = read;
|
|
4209
4161
|
if (read.localFn) return isRegisteredFnExtra(read.localFn) ? toMemberExpression(localsIdentifier, getLocalsScopeAccessor(binding)) : _marko_compiler.types.identifier(binding.name);
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
if (inlined) return _marko_compiler.types.cloneNode(inlined, true);
|
|
4213
|
-
}
|
|
4162
|
+
const inlined = getSignals(section).get(binding)?.inline?.value;
|
|
4163
|
+
if (inlined) return _marko_compiler.types.cloneNode(inlined, true);
|
|
4214
4164
|
if (signal?.referencedBindings === binding && !signal.storesValue) return getSignalValueIdentifier(signal);
|
|
4215
4165
|
if (getter?.hoisted) return binding.aliasOf ? callRuntime("_hoist_read_error") : _marko_compiler.types.callExpression(getBindingGetterIdentifier(binding, getter.hoisted), [getScopeExpression(section, getter.hoisted)]);
|
|
4216
4166
|
if (properties === void 0 && binding.type === 0) return getter && _marko_compiler.types.callExpression(getBindingGetterIdentifier(binding, binding.section), [getScopeExpression(section, binding.section)]);
|
|
@@ -4247,8 +4197,7 @@ function getChainReplacement(node, expr, depth) {
|
|
|
4247
4197
|
function addMember(expr, prop) {
|
|
4248
4198
|
return toMemberExpression(expr, prop);
|
|
4249
4199
|
}
|
|
4250
|
-
|
|
4251
|
-
//#region src/translator/util/simplify-fn.ts
|
|
4200
|
+
// src/translator/util/simplify-fn.ts
|
|
4252
4201
|
function replaceMethodNode(node, replacement) {
|
|
4253
4202
|
switch (node.type) {
|
|
4254
4203
|
case "ClassMethod": return _marko_compiler.types.classProperty(node.key, replacement, void 0, void 0, node.computed, node.static);
|
|
@@ -4267,8 +4216,7 @@ function simplifyFunction(fn) {
|
|
|
4267
4216
|
default: return _marko_compiler.types.functionExpression(null, fn.params, fn.body, fn.generator, fn.async);
|
|
4268
4217
|
}
|
|
4269
4218
|
}
|
|
4270
|
-
|
|
4271
|
-
//#region src/translator/util/to-only-or-block.ts
|
|
4219
|
+
// src/translator/util/to-only-or-block.ts
|
|
4272
4220
|
function toOnlyExpressionOrBlock(stmts) {
|
|
4273
4221
|
if (stmts.length === 1 && _marko_compiler.types.isExpressionStatement(stmts[0])) return stmts[0].expression;
|
|
4274
4222
|
return _marko_compiler.types.blockStatement(stmts);
|
|
@@ -4277,8 +4225,7 @@ function toOnlyStatementOrBlock(body) {
|
|
|
4277
4225
|
if (body.length === 1) return body[0];
|
|
4278
4226
|
return _marko_compiler.types.blockStatement(body);
|
|
4279
4227
|
}
|
|
4280
|
-
|
|
4281
|
-
//#region src/translator/util/translate-var.ts
|
|
4228
|
+
// src/translator/util/translate-var.ts
|
|
4282
4229
|
function translateVar(tag, initialValue, kind = "const", statements) {
|
|
4283
4230
|
const { node: { var: tagVar } } = tag;
|
|
4284
4231
|
if (!tagVar) return;
|
|
@@ -4377,7 +4324,7 @@ function withRestFallback(rest, from, value) {
|
|
|
4377
4324
|
function getSectionTarget(tag, section) {
|
|
4378
4325
|
let target = tag;
|
|
4379
4326
|
let cur = tag.parentPath;
|
|
4380
|
-
while (cur.node.extra?.section !== section) {
|
|
4327
|
+
while (cur.node.extra?.section !== section || cur.listKey === "attributeTags") {
|
|
4381
4328
|
target = cur;
|
|
4382
4329
|
cur = cur.parentPath;
|
|
4383
4330
|
}
|
|
@@ -4398,8 +4345,7 @@ function getDestructurePattern(id) {
|
|
|
4398
4345
|
cur = cur.parentPath;
|
|
4399
4346
|
}
|
|
4400
4347
|
}
|
|
4401
|
-
|
|
4402
|
-
//#region src/translator/util/build-string-expression.ts
|
|
4348
|
+
// src/translator/util/build-string-expression.ts
|
|
4403
4349
|
function buildStringExpression(parts, useIife) {
|
|
4404
4350
|
const strs = [""];
|
|
4405
4351
|
const exprs = [];
|
|
@@ -4450,8 +4396,7 @@ function joinPart(strs, exprs, part) {
|
|
|
4450
4396
|
strs.push("");
|
|
4451
4397
|
}
|
|
4452
4398
|
}
|
|
4453
|
-
|
|
4454
|
-
//#region src/translator/util/writer.ts
|
|
4399
|
+
// src/translator/util/writer.ts
|
|
4455
4400
|
const [getWrites] = createOutputSectionState(() => [""]);
|
|
4456
4401
|
const [getTrailerWrites] = createOutputSectionState(() => [""]);
|
|
4457
4402
|
function writeTo$1(path, trailer) {
|
|
@@ -4500,8 +4445,7 @@ function markNode(path, nodeBinding, reason, deferred) {
|
|
|
4500
4445
|
function unwrapWrite(write) {
|
|
4501
4446
|
return typeof write === "function" ? write() || "" : write;
|
|
4502
4447
|
}
|
|
4503
|
-
|
|
4504
|
-
//#region src/translator/util/signals.ts
|
|
4448
|
+
// src/translator/util/signals.ts
|
|
4505
4449
|
const [getSignals] = createOutputSectionState(() => /* @__PURE__ */ new Map());
|
|
4506
4450
|
const [getClosureSignalBuilder, _setClosureSignalBuilder] = createOutputSectionState();
|
|
4507
4451
|
function setClosureSignalBuilder(tag, build) {
|
|
@@ -4612,7 +4556,7 @@ function getSignal(section, referencedBindings, name) {
|
|
|
4612
4556
|
const sourceSignal = getSignal(section, meta.source);
|
|
4613
4557
|
forEach(referencedBindings, (member) => {
|
|
4614
4558
|
const memberSignal = getSignal(section, member);
|
|
4615
|
-
const inline =
|
|
4559
|
+
const inline = !member.propertyAliases.size && member.reads.size === 1 && !findSlot(member)?.reason && sourceSignal.values.find((v) => v.signal === memberSignal);
|
|
4616
4560
|
if (inline) memberSignal.inline = inline;
|
|
4617
4561
|
else memberSignal.storesValue = memberSignal.forceStore = true;
|
|
4618
4562
|
});
|
|
@@ -5200,15 +5144,13 @@ function isLetBinding(binding) {
|
|
|
5200
5144
|
function getDebugLoc({ start }) {
|
|
5201
5145
|
return `${start.line}:${start.column + 1}`;
|
|
5202
5146
|
}
|
|
5203
|
-
|
|
5204
|
-
//#region src/translator/util/get-known-attr-values.ts
|
|
5147
|
+
// src/translator/util/get-known-attr-values.ts
|
|
5205
5148
|
function getKnownAttrValues(tag) {
|
|
5206
5149
|
const attrs = {};
|
|
5207
5150
|
for (const attr of tag.attributes) if (attr.type === "MarkoAttribute") attrs[attr.name] = attr.value;
|
|
5208
5151
|
return attrs;
|
|
5209
5152
|
}
|
|
5210
|
-
|
|
5211
|
-
//#region src/translator/util/translate-attrs.ts
|
|
5153
|
+
// src/translator/util/translate-attrs.ts
|
|
5212
5154
|
const contentProps = /* @__PURE__ */ new WeakSet();
|
|
5213
5155
|
function translateAttrs(tag, paramsTree = true, skip, statements = [], contentKey = "content") {
|
|
5214
5156
|
const contentProperties = [];
|
|
@@ -5393,12 +5335,12 @@ function getSingleKnownSpread(paramsTree, attributes) {
|
|
|
5393
5335
|
}
|
|
5394
5336
|
return binding;
|
|
5395
5337
|
}
|
|
5396
|
-
|
|
5397
|
-
//#region src/translator/util/known-tag.ts
|
|
5338
|
+
// src/translator/util/known-tag.ts
|
|
5398
5339
|
const [getTagVarBindings] = createOutputSectionState(() => []);
|
|
5399
5340
|
const [getCallSiteSourcesByParam] = createAnalysisState(() => /* @__PURE__ */ new Map());
|
|
5400
5341
|
const kParamsTree = Symbol("known tag params tree");
|
|
5401
5342
|
const kKnownExprs = Symbol("known tag exprs");
|
|
5343
|
+
const kPassesInput = Symbol("known tag passes input");
|
|
5402
5344
|
const [getRecursiveTags] = createAnalysisState(() => []);
|
|
5403
5345
|
function knownTagAnalyze(tag, childSection, childParamsTree) {
|
|
5404
5346
|
analyzeAttributeTags(tag);
|
|
@@ -5463,11 +5405,13 @@ function exposeChildParamsTree(childSection) {
|
|
|
5463
5405
|
return childSection.params && exposeParamsTree(childSection.params, true);
|
|
5464
5406
|
}
|
|
5465
5407
|
function analyzeKnownTagParams(tag, paramsTree) {
|
|
5466
|
-
const
|
|
5408
|
+
const { node } = tag;
|
|
5409
|
+
const tagExtra = node.extra;
|
|
5467
5410
|
const attrExprs = /* @__PURE__ */ new Set([tagExtra]);
|
|
5468
5411
|
tagExtra[kParamsTree] = paramsTree;
|
|
5412
|
+
tagExtra[kPassesInput] = !node.arguments?.length || !!node.body.body.length || !!node.attributeTags.length;
|
|
5469
5413
|
const exprs = tagExtra[kKnownExprs] = analyzeParams(tagExtra, getSection(tag), tag, paramsTree, attrExprs);
|
|
5470
|
-
setTagContentDerives(tag, paramsTree?.properties?.[
|
|
5414
|
+
setTagContentDerives(tag, paramsTree?.properties?.[node.arguments?.length ?? 0]?.binding, exprs);
|
|
5471
5415
|
addReasonExprs(ensureSlot(tagExtra.childScopeBinding), fromIter(attrExprs));
|
|
5472
5416
|
return exprs;
|
|
5473
5417
|
}
|
|
@@ -5483,8 +5427,9 @@ function isChildScopeResumed(section, tagExtra) {
|
|
|
5483
5427
|
}
|
|
5484
5428
|
function getRenderArgs(tag, properties) {
|
|
5485
5429
|
const args = tag.node.arguments;
|
|
5486
|
-
const
|
|
5487
|
-
|
|
5430
|
+
const withInput = tag.node.extra[kPassesInput];
|
|
5431
|
+
const renderArgs = args?.length && (withInput || !args.every(isDroppedNode)) ? args.map(toRenderArg) : [];
|
|
5432
|
+
if (withInput) renderArgs.push(propsToExpression(properties));
|
|
5488
5433
|
return renderArgs;
|
|
5489
5434
|
}
|
|
5490
5435
|
function isDroppedNode(node) {
|
|
@@ -5617,13 +5562,17 @@ function analyzeParams(rootTagExtra, section, tag, paramsTree, rootAttrExprs) {
|
|
|
5617
5562
|
i++;
|
|
5618
5563
|
}
|
|
5619
5564
|
const attrsTree = paramsTree.properties[i];
|
|
5620
|
-
if (attrsTree) known[i] = analyzeAttrs(rootTagExtra, section, tag, attrsTree, rootAttrExprs, paramsExpr);
|
|
5565
|
+
if (attrsTree && rootTagExtra[kPassesInput]) known[i] = analyzeAttrs(rootTagExtra, section, tag, attrsTree, rootAttrExprs, paramsExpr);
|
|
5621
5566
|
else {
|
|
5622
5567
|
const args = tag.node.arguments;
|
|
5623
5568
|
tag.node.arguments = null;
|
|
5624
5569
|
dropAllTagNodes(tag.node);
|
|
5625
5570
|
tag.node.arguments = args;
|
|
5626
5571
|
}
|
|
5572
|
+
for (const key in paramsTree.properties) if (!known[key]) {
|
|
5573
|
+
addSetupWork(section);
|
|
5574
|
+
break;
|
|
5575
|
+
}
|
|
5627
5576
|
return paramsExpr;
|
|
5628
5577
|
}
|
|
5629
5578
|
function analyzeAttrs(rootTagExtra, section, tag, paramsTree, rootAttrExprs, rootExprs) {
|
|
@@ -5820,7 +5769,9 @@ function writeParamsToSignals(tag, paramsTree, hint, info) {
|
|
|
5820
5769
|
i++;
|
|
5821
5770
|
}
|
|
5822
5771
|
const attrsTree = paramsTree.properties[i];
|
|
5823
|
-
if (attrsTree) writeAttrsToSignals(tag, attrsTree, `${hint}_input`, info);
|
|
5772
|
+
if (attrsTree && tag.node.extra[kPassesInput]) writeAttrsToSignals(tag, attrsTree, `${hint}_input`, info);
|
|
5773
|
+
const { known } = tag.node.extra[kKnownExprs];
|
|
5774
|
+
for (const key in paramsTree.properties) if (!known[key]) writeToSignal(info, info.getBindingIdentifier(paramsTree.properties[key].binding, `${hint}_param_${key}`), void 0, void 0, true);
|
|
5824
5775
|
}
|
|
5825
5776
|
function applyAttrObject(tag, paramsTree, tagInputIdentifier, info) {
|
|
5826
5777
|
const tagExtra = tag.node.extra;
|
|
@@ -6004,8 +5955,7 @@ function getGroupParamsTrees(group, attrTagLookup, paramsTree) {
|
|
|
6004
5955
|
}
|
|
6005
5956
|
return trees;
|
|
6006
5957
|
}
|
|
6007
|
-
|
|
6008
|
-
//#region src/translator/util/reasons.ts
|
|
5958
|
+
// src/translator/util/reasons.ts
|
|
6009
5959
|
function addReason(slot, reason) {
|
|
6010
5960
|
if (reason) {
|
|
6011
5961
|
const newReason = mergeSources(slot.reason, reason);
|
|
@@ -6134,8 +6084,7 @@ function setParamReasonGroups(section, groups) {
|
|
|
6134
6084
|
reasonsVersion++;
|
|
6135
6085
|
section.paramReasonGroups = groups;
|
|
6136
6086
|
}
|
|
6137
|
-
|
|
6138
|
-
//#region src/translator/util/bindings.ts
|
|
6087
|
+
// src/translator/util/bindings.ts
|
|
6139
6088
|
const [getBindings] = createAnalysisState(() => /* @__PURE__ */ new Set());
|
|
6140
6089
|
const [getNextBindingId, setNextBindingId] = createAnalysisState(() => 0);
|
|
6141
6090
|
function createBinding(name, type, refSection, aliased, property, excludeProperties, loc = null, refDeclared = false, restOffset) {
|
|
@@ -6339,8 +6288,7 @@ function getPropertyPath(binding, ancestor) {
|
|
|
6339
6288
|
function isIndexProperty(property) {
|
|
6340
6289
|
return /^\d+$/.test(property);
|
|
6341
6290
|
}
|
|
6342
|
-
|
|
6343
|
-
//#region src/translator/util/is-only-child-in-parent.ts
|
|
6291
|
+
// src/translator/util/is-only-child-in-parent.ts
|
|
6344
6292
|
const kOnlyChildInParent = Symbol("only child in parent");
|
|
6345
6293
|
function getOnlyChildParentTagName(tag) {
|
|
6346
6294
|
const extra = tag.node.extra;
|
|
@@ -6352,8 +6300,7 @@ function isOnlyChild(tag) {
|
|
|
6352
6300
|
for (const sibling of tag.parentPath.get("body")) if (sibling.node !== tag.node && getNodeContentType(sibling, "startType") !== null) return false;
|
|
6353
6301
|
return true;
|
|
6354
6302
|
}
|
|
6355
|
-
|
|
6356
|
-
//#region src/translator/util/branch-tag.ts
|
|
6303
|
+
// src/translator/util/branch-tag.ts
|
|
6357
6304
|
function initBranchSection(bodySection, branchExpr, branch) {
|
|
6358
6305
|
bodySection.branchExpr = branchExpr;
|
|
6359
6306
|
bodySection.branch = branch;
|
|
@@ -6449,8 +6396,7 @@ function getBaseArgsInForTag(type, attrs) {
|
|
|
6449
6396
|
];
|
|
6450
6397
|
}
|
|
6451
6398
|
}
|
|
6452
|
-
|
|
6453
|
-
//#region src/translator/util/assert.ts
|
|
6399
|
+
// src/translator/util/assert.ts
|
|
6454
6400
|
const docsAnchors = {
|
|
6455
6401
|
if: "if--else",
|
|
6456
6402
|
"else-if": "if--else",
|
|
@@ -6466,12 +6412,19 @@ function assertNoSpreadAttrs(tag) {
|
|
|
6466
6412
|
}
|
|
6467
6413
|
function assertOnlyValueAttr(tag, required, change, hint) {
|
|
6468
6414
|
let valueAttr;
|
|
6469
|
-
let
|
|
6470
|
-
for (const attr of tag.node.attributes) if (
|
|
6471
|
-
|
|
6472
|
-
|
|
6415
|
+
let valueChangeAttr;
|
|
6416
|
+
for (const attr of tag.node.attributes) if (isValueAttr(attr)) {
|
|
6417
|
+
if (valueAttr) throw buildDuplicateAttrError(tag, attr);
|
|
6418
|
+
valueAttr = attr;
|
|
6419
|
+
} else if (change && isValueChangeAttr(attr)) {
|
|
6420
|
+
if (valueChangeAttr) throw buildDuplicateAttrError(tag, attr);
|
|
6421
|
+
valueChangeAttr = attr;
|
|
6422
|
+
} else throw buildUnsupportedAttrsError(tag, change, hint);
|
|
6473
6423
|
if (required && !valueAttr) throw tag.get("name").buildCodeFrameError(`The ${coreTagLink(tag)} requires a ${valueAttrLink}.`);
|
|
6474
|
-
return
|
|
6424
|
+
return {
|
|
6425
|
+
valueAttr,
|
|
6426
|
+
valueChangeAttr
|
|
6427
|
+
};
|
|
6475
6428
|
}
|
|
6476
6429
|
function assertHasVar(tag, hint) {
|
|
6477
6430
|
if (!tag.node.var) throw tag.get("name").buildCodeFrameError(withHint(`The ${coreTagLink(tag)} requires a [tag variable](${languageDocsURL}#tag-variables).`, typeof hint === "function" ? hint(tag) : hint));
|
|
@@ -6505,6 +6458,9 @@ function buildAttrNameError(tag, attr, msg) {
|
|
|
6505
6458
|
column: start.column + attr.name.length
|
|
6506
6459
|
}, msg);
|
|
6507
6460
|
}
|
|
6461
|
+
function buildDuplicateAttrError(tag, attr) {
|
|
6462
|
+
return buildAttrsError(tag, [attr], `The ${coreTagLink(tag)} takes a single ${isValueAttr(attr) ? valueAttrLink : "`valueChange=` attribute"}.`);
|
|
6463
|
+
}
|
|
6508
6464
|
function buildUnsupportedAttrsError(tag, change, hint) {
|
|
6509
6465
|
const { attributes } = tag.node;
|
|
6510
6466
|
const valueAttr = attributes.find(isValueAttr);
|
|
@@ -6552,8 +6508,7 @@ function isValueAttr(attr) {
|
|
|
6552
6508
|
function isValueChangeAttr(attr) {
|
|
6553
6509
|
return attr.type === "MarkoAttribute" && attr.name === "valueChange";
|
|
6554
6510
|
}
|
|
6555
|
-
|
|
6556
|
-
//#region src/translator/util/body-to-text.ts
|
|
6511
|
+
// src/translator/util/body-to-text.ts
|
|
6557
6512
|
function bodyToText(body, decodeEntities = false) {
|
|
6558
6513
|
return buildText(body, toText, decodeEntities);
|
|
6559
6514
|
}
|
|
@@ -6598,8 +6553,7 @@ function buildText(body, coerce, decodeEntities = false) {
|
|
|
6598
6553
|
}
|
|
6599
6554
|
return _marko_compiler.types.stringLiteral(currentQuasi);
|
|
6600
6555
|
}
|
|
6601
|
-
|
|
6602
|
-
//#region src/translator/util/module-read.ts
|
|
6556
|
+
// src/translator/util/module-read.ts
|
|
6603
6557
|
const styleImportReg = /\.(?:css(?:\.[cm]?[jt]s)?|less|s[ac]ss|styl(?:us)?|pcss|postcss)(?:\?|$)/i;
|
|
6604
6558
|
const kModuleRead = Symbol("module read");
|
|
6605
6559
|
/** The module read an expression is, resolved on first use: translate replaces
|
|
@@ -6644,8 +6598,7 @@ function resolveModuleRead(path, expr) {
|
|
|
6644
6598
|
}
|
|
6645
6599
|
return null;
|
|
6646
6600
|
}
|
|
6647
|
-
|
|
6648
|
-
//#region src/translator/util/structure.ts
|
|
6601
|
+
// src/translator/util/structure.ts
|
|
6649
6602
|
const walkCodeToName = {
|
|
6650
6603
|
[32]: "get",
|
|
6651
6604
|
[37]: "replace",
|
|
@@ -6935,8 +6888,7 @@ function trimTrailingExits(walks) {
|
|
|
6935
6888
|
function getComment(node) {
|
|
6936
6889
|
return node.leadingComments?.[0]?.value.trim() || "";
|
|
6937
6890
|
}
|
|
6938
|
-
|
|
6939
|
-
//#region src/translator/util/visitors.ts
|
|
6891
|
+
// src/translator/util/visitors.ts
|
|
6940
6892
|
function extractVisitors(visitors) {
|
|
6941
6893
|
const result = {
|
|
6942
6894
|
migrate: {},
|
|
@@ -6986,8 +6938,7 @@ function isModulePlugin(plugin) {
|
|
|
6986
6938
|
function isFunctionPlugin(plugin) {
|
|
6987
6939
|
return typeof plugin === "function";
|
|
6988
6940
|
}
|
|
6989
|
-
|
|
6990
|
-
//#region src/translator/core/if.ts
|
|
6941
|
+
// src/translator/core/if.ts
|
|
6991
6942
|
const BRANCHES_LOOKUP = /* @__PURE__ */ new WeakMap();
|
|
6992
6943
|
const IfTag = {
|
|
6993
6944
|
analyze(tag) {
|
|
@@ -7118,7 +7069,7 @@ function flattenTextOnlyConditional(rootTag) {
|
|
|
7118
7069
|
const tagBody = rootTag.parentPath;
|
|
7119
7070
|
if (!tagBody.isMarkoTagBody()) return;
|
|
7120
7071
|
const parentTag = tagBody.parentPath;
|
|
7121
|
-
if (!parentTag.isMarkoTag() ||
|
|
7072
|
+
if (!parentTag.isMarkoTag() || !isStaticNativeTag(parentTag)) return;
|
|
7122
7073
|
const branches = [];
|
|
7123
7074
|
let tag = rootTag;
|
|
7124
7075
|
do {
|
|
@@ -7200,8 +7151,7 @@ function isLastBranch(tag) {
|
|
|
7200
7151
|
function isIfAttr(attr) {
|
|
7201
7152
|
return attr.type === "MarkoAttribute" && attr.name === "if";
|
|
7202
7153
|
}
|
|
7203
|
-
|
|
7204
|
-
//#region src/translator/core/textarea.ts
|
|
7154
|
+
// src/translator/core/textarea.ts
|
|
7205
7155
|
function preAnalyze$1(tag) {
|
|
7206
7156
|
if (tag.node.body.body.length) {
|
|
7207
7157
|
const [firstChild] = tag.node.body.body;
|
|
@@ -7219,8 +7169,7 @@ function preAnalyze$1(tag) {
|
|
|
7219
7169
|
tag.node.body.body = [];
|
|
7220
7170
|
}
|
|
7221
7171
|
}
|
|
7222
|
-
|
|
7223
|
-
//#region src/translator/visitors/program/pre-analyze.ts
|
|
7172
|
+
// src/translator/visitors/program/pre-analyze.ts
|
|
7224
7173
|
const TAG_NAME_IDENTIFIER_REG = /^[A-Z][a-zA-Z0-9_$]*$/;
|
|
7225
7174
|
const BINDING_CHANGE_HANDLER = /* @__PURE__ */ new WeakMap();
|
|
7226
7175
|
function preAnalyze(program) {
|
|
@@ -7438,8 +7387,7 @@ function toFallbackExpr(id, fallback) {
|
|
|
7438
7387
|
function toConstTag(id, expr) {
|
|
7439
7388
|
return _marko_compiler.types.markoTag(_marko_compiler.types.stringLiteral("const"), [_marko_compiler.types.markoAttribute("value", expr, null, null, true)], _marko_compiler.types.markoTagBody(), null, id);
|
|
7440
7389
|
}
|
|
7441
|
-
|
|
7442
|
-
//#region src/translator/core/attrs.ts
|
|
7390
|
+
// src/translator/core/attrs.ts
|
|
7443
7391
|
var attrs_default = {
|
|
7444
7392
|
migrate: (tag) => {
|
|
7445
7393
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
@@ -7463,8 +7411,7 @@ var attrs_default = {
|
|
|
7463
7411
|
snippet: "attrs/{ $1 }$2"
|
|
7464
7412
|
}]
|
|
7465
7413
|
};
|
|
7466
|
-
|
|
7467
|
-
//#region src/translator/core/await.ts
|
|
7414
|
+
// src/translator/core/await.ts
|
|
7468
7415
|
var await_default = {
|
|
7469
7416
|
analyze(tag) {
|
|
7470
7417
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
@@ -7474,7 +7421,7 @@ var await_default = {
|
|
|
7474
7421
|
const { node } = tag;
|
|
7475
7422
|
const tagBody = tag.get("body");
|
|
7476
7423
|
const section = ensureSection(tag);
|
|
7477
|
-
const valueAttr = assertOnlyValueAttr(tag, true);
|
|
7424
|
+
const { valueAttr } = assertOnlyValueAttr(tag, true);
|
|
7478
7425
|
assertHasBody(tag);
|
|
7479
7426
|
const tagExtra = tag.node.extra ??= {};
|
|
7480
7427
|
const nodeBinding = tagExtra.nodeBinding = createBinding("#text", 0, section);
|
|
@@ -7538,8 +7485,7 @@ var await_default = {
|
|
|
7538
7485
|
}],
|
|
7539
7486
|
types: runtime_info_default.name + "/tags/await.d.marko"
|
|
7540
7487
|
};
|
|
7541
|
-
|
|
7542
|
-
//#region src/translator/core/class.ts
|
|
7488
|
+
// src/translator/core/class.ts
|
|
7543
7489
|
var class_default = {
|
|
7544
7490
|
parse(tag) {
|
|
7545
7491
|
throw tag.hub.buildError(tag.node.name, "class {} component blocks are no longer supported. Use <let> and <const> tags for state.");
|
|
@@ -7549,8 +7495,7 @@ var class_default = {
|
|
|
7549
7495
|
rawOpenTag: true
|
|
7550
7496
|
}
|
|
7551
7497
|
};
|
|
7552
|
-
|
|
7553
|
-
//#region src/translator/util/statement-tag.ts
|
|
7498
|
+
// src/translator/util/statement-tag.ts
|
|
7554
7499
|
function parseSingleStatement(tag, msg) {
|
|
7555
7500
|
const { node } = tag;
|
|
7556
7501
|
const statements = (0, _marko_compiler_babel_utils.parseStatements)((0, _marko_compiler_babel_utils.getFile)(), node.rawValue, node.start, node.end);
|
|
@@ -7584,18 +7529,16 @@ function createStatementTag(keyword) {
|
|
|
7584
7529
|
}]
|
|
7585
7530
|
};
|
|
7586
7531
|
}
|
|
7587
|
-
|
|
7588
|
-
//#region src/translator/core/client.ts
|
|
7532
|
+
// src/translator/core/client.ts
|
|
7589
7533
|
var client_default = createStatementTag("client");
|
|
7590
|
-
|
|
7591
|
-
//#region src/translator/core/const.ts
|
|
7534
|
+
// src/translator/core/const.ts
|
|
7592
7535
|
var const_default = {
|
|
7593
7536
|
analyze(tag) {
|
|
7594
7537
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
7595
7538
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
7596
7539
|
assertNoBodyContent(tag);
|
|
7597
7540
|
assertHasVar(tag, getVarHint);
|
|
7598
|
-
const valueAttr = assertOnlyValueAttr(tag, true);
|
|
7541
|
+
const { valueAttr } = assertOnlyValueAttr(tag, true);
|
|
7599
7542
|
const valueExtra = valueAttr.value.extra ??= {};
|
|
7600
7543
|
valueExtra.pure = evaluate(valueAttr.value).pure;
|
|
7601
7544
|
const valueBinding = _marko_compiler.types.isIdentifier(valueAttr.value) ? tag.scope.getBinding(valueAttr.value.name) : void 0;
|
|
@@ -7640,15 +7583,14 @@ function getVarHint(tag) {
|
|
|
7640
7583
|
const [attr] = attributes;
|
|
7641
7584
|
return attributes.length === 1 && attr.type === "MarkoAttribute" && attr.name !== "value" && /^[A-Za-z_$][\w$]*$/.test(attr.name) ? `The variable goes after a slash: \`<const/${attr.name}=...>\`. For a one time module level value, prefix a plain JavaScript statement with \`static\`.` : "For example: `<const/doubled=count * 2>`.";
|
|
7642
7585
|
}
|
|
7643
|
-
|
|
7644
|
-
//#region src/translator/core/debug.ts
|
|
7586
|
+
// src/translator/core/debug.ts
|
|
7645
7587
|
var debug_default = {
|
|
7646
7588
|
analyze(tag) {
|
|
7647
7589
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
7648
7590
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
7649
7591
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
7650
7592
|
assertNoBodyContent(tag);
|
|
7651
|
-
const valueAttr = assertOnlyValueAttr(tag);
|
|
7593
|
+
const { valueAttr } = assertOnlyValueAttr(tag);
|
|
7652
7594
|
const section = ensureSection(tag);
|
|
7653
7595
|
if (valueAttr) addSetupExpr(section, valueAttr.value);
|
|
7654
7596
|
else addSetupWork(section);
|
|
@@ -7664,8 +7606,7 @@ var debug_default = {
|
|
|
7664
7606
|
}],
|
|
7665
7607
|
types: runtime_info_default.name + "/tags/debug.d.marko"
|
|
7666
7608
|
};
|
|
7667
|
-
|
|
7668
|
-
//#region src/translator/core/define.ts
|
|
7609
|
+
// src/translator/core/define.ts
|
|
7669
7610
|
var define_default = {
|
|
7670
7611
|
analyze(tag) {
|
|
7671
7612
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
@@ -7762,8 +7703,7 @@ var define_default = {
|
|
|
7762
7703
|
}],
|
|
7763
7704
|
types: runtime_info_default.name + "/tags/define.d.marko"
|
|
7764
7705
|
};
|
|
7765
|
-
|
|
7766
|
-
//#region src/translator/core/effect.ts
|
|
7706
|
+
// src/translator/core/effect.ts
|
|
7767
7707
|
var effect_default = {
|
|
7768
7708
|
migrate: (tag) => {
|
|
7769
7709
|
if (tag.node.body.body.length) throw tag.get("name").buildCodeFrameError("The `<effect>` tag has been replaced by [`<script>`](https://markojs.com/docs/reference/core-tag#script), which runs its body as code. Rename it to `<script>`.");
|
|
@@ -7783,8 +7723,7 @@ var effect_default = {
|
|
|
7783
7723
|
attributes: {},
|
|
7784
7724
|
types: runtime_info_default.name + "/tags/effect.d.marko"
|
|
7785
7725
|
};
|
|
7786
|
-
|
|
7787
|
-
//#region src/translator/core/export.ts
|
|
7726
|
+
// src/translator/core/export.ts
|
|
7788
7727
|
var export_default = {
|
|
7789
7728
|
parse(tag) {
|
|
7790
7729
|
const statement = parseSingleStatement(tag, "The `<export>` tag takes a single export statement.");
|
|
@@ -7806,8 +7745,7 @@ function getDefaultExport(statement) {
|
|
|
7806
7745
|
if (exported && getLiteralName(exported) === "default") return specifier;
|
|
7807
7746
|
}
|
|
7808
7747
|
}
|
|
7809
|
-
|
|
7810
|
-
//#region src/translator/core/for.ts
|
|
7748
|
+
// src/translator/core/for.ts
|
|
7811
7749
|
var for_default = {
|
|
7812
7750
|
analyze(tag) {
|
|
7813
7751
|
const tagSection = ensureSection(tag);
|
|
@@ -8008,8 +7946,7 @@ function isKeyedByIndex(type, attrs) {
|
|
|
8008
7946
|
function isNumberOrOmitted(node, value) {
|
|
8009
7947
|
return !node || node.type === "NumericLiteral" && node.value === value;
|
|
8010
7948
|
}
|
|
8011
|
-
|
|
8012
|
-
//#region src/translator/core/html-comment.ts
|
|
7949
|
+
// src/translator/core/html-comment.ts
|
|
8013
7950
|
const escapeCommentText = (text) => text.replace(/>/g, ">");
|
|
8014
7951
|
var html_comment_default = {
|
|
8015
7952
|
analyze(tag) {
|
|
@@ -8085,8 +8022,7 @@ function buildCommentValue(body) {
|
|
|
8085
8022
|
}
|
|
8086
8023
|
return value;
|
|
8087
8024
|
}
|
|
8088
|
-
|
|
8089
|
-
//#region src/translator/core/html-script.ts
|
|
8025
|
+
// src/translator/core/html-script.ts
|
|
8090
8026
|
var html_script_default = {
|
|
8091
8027
|
types: runtime_info_default.name + "/tags/html-script.d.marko",
|
|
8092
8028
|
html: true,
|
|
@@ -8099,8 +8035,7 @@ var html_script_default = {
|
|
|
8099
8035
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-script--html-style"
|
|
8100
8036
|
}]
|
|
8101
8037
|
};
|
|
8102
|
-
|
|
8103
|
-
//#region src/translator/core/html-style.ts
|
|
8038
|
+
// src/translator/core/html-style.ts
|
|
8104
8039
|
var html_style_default = {
|
|
8105
8040
|
types: runtime_info_default.name + "/tags/html-style.d.marko",
|
|
8106
8041
|
html: true,
|
|
@@ -8113,8 +8048,7 @@ var html_style_default = {
|
|
|
8113
8048
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-script--html-style"
|
|
8114
8049
|
}]
|
|
8115
8050
|
};
|
|
8116
|
-
|
|
8117
|
-
//#region src/translator/core/id.ts
|
|
8051
|
+
// src/translator/core/id.ts
|
|
8118
8052
|
var id_default = {
|
|
8119
8053
|
analyze(tag) {
|
|
8120
8054
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
@@ -8123,7 +8057,7 @@ var id_default = {
|
|
|
8123
8057
|
(0, _marko_compiler_babel_utils.assertNoAttributeTags)(tag);
|
|
8124
8058
|
assertHasVar(tag);
|
|
8125
8059
|
assertIdentifierVar(tag);
|
|
8126
|
-
const valueAttr = assertOnlyValueAttr(tag);
|
|
8060
|
+
const { valueAttr } = assertOnlyValueAttr(tag);
|
|
8127
8061
|
const valueNode = valueAttr ? valueAttr.value : tag.node;
|
|
8128
8062
|
const valueExtra = valueAttr ? valueAttr.value.extra ??= {} : tag.node.extra ??= {};
|
|
8129
8063
|
valueExtra.pure = !valueAttr || evaluate(valueAttr.value).pure;
|
|
@@ -8163,8 +8097,7 @@ var id_default = {
|
|
|
8163
8097
|
}],
|
|
8164
8098
|
types: runtime_info_default.name + "/tags/id.d.marko"
|
|
8165
8099
|
};
|
|
8166
|
-
|
|
8167
|
-
//#region src/translator/core/import.ts
|
|
8100
|
+
// src/translator/core/import.ts
|
|
8168
8101
|
var import_default = {
|
|
8169
8102
|
parse(tag) {
|
|
8170
8103
|
tag.replaceWith(parseSingleStatement(tag, "The [`<import>` tag](https://markojs.com/docs/reference/language#import) takes a single import statement."));
|
|
@@ -8180,8 +8113,7 @@ var import_default = {
|
|
|
8180
8113
|
descriptionMoreURL: "https://markojs.com/docs/reference/language#import"
|
|
8181
8114
|
}]
|
|
8182
8115
|
};
|
|
8183
|
-
|
|
8184
|
-
//#region src/translator/util/finalize-references.ts
|
|
8116
|
+
// src/translator/util/finalize-references.ts
|
|
8185
8117
|
function finalizeReferences() {
|
|
8186
8118
|
const intersectionsBySection = /* @__PURE__ */ new Map();
|
|
8187
8119
|
settleAssignments();
|
|
@@ -8647,25 +8579,13 @@ function resolveExpressionReference(expr, { binding, inOwnBody }) {
|
|
|
8647
8579
|
const ancestor = getNearestReadBy(binding.aliasOf, expr);
|
|
8648
8580
|
return ancestor ? createResolvedRead(ancestor, getPropertyPath(binding, ancestor)) : createResolvedRead(binding, void 0, inOwnBody);
|
|
8649
8581
|
}
|
|
8650
|
-
|
|
8651
|
-
//#region src/translator/core/let.ts
|
|
8582
|
+
// src/translator/core/let.ts
|
|
8652
8583
|
var let_default = {
|
|
8653
8584
|
analyze(tag) {
|
|
8654
8585
|
const { node } = tag;
|
|
8655
8586
|
const tagVar = node.var;
|
|
8656
|
-
let valueAttr;
|
|
8657
|
-
let valueChangeAttr;
|
|
8658
|
-
for (const attr of node.attributes) if (_marko_compiler.types.isMarkoAttribute(attr)) {
|
|
8659
|
-
if (attr.name === "value") {
|
|
8660
|
-
if (valueAttr) throw tag.hub.buildError(attr, "Invalid duplicate value attribute.");
|
|
8661
|
-
valueAttr = attr;
|
|
8662
|
-
} else if (attr.name === "valueChange") {
|
|
8663
|
-
if (valueChangeAttr) throw tag.hub.buildError(attr, "Invalid duplicate valueChange attribute.");
|
|
8664
|
-
valueChangeAttr = attr;
|
|
8665
|
-
}
|
|
8666
|
-
}
|
|
8667
8587
|
assertNoSpreadAttrs(tag);
|
|
8668
|
-
assertOnlyValueAttr(tag, false, true, tagVar ? void 0 : getDeclarationHint);
|
|
8588
|
+
const { valueAttr, valueChangeAttr } = assertOnlyValueAttr(tag, false, true, tagVar ? void 0 : getDeclarationHint);
|
|
8669
8589
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
8670
8590
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
8671
8591
|
assertNoBodyContent(tag);
|
|
@@ -8739,8 +8659,7 @@ var let_default = {
|
|
|
8739
8659
|
function getDeclarationHint(attr) {
|
|
8740
8660
|
if (/^[A-Za-z_$][\w$]*$/.test(attr.name)) return `To declare reactive state, the variable goes after a slash: \`<let/${attr.name}=...>\`. For a one time module level value, prefix a plain JavaScript statement with \`static\`.`;
|
|
8741
8661
|
}
|
|
8742
|
-
|
|
8743
|
-
//#region src/translator/core/lifecycle.ts
|
|
8662
|
+
// src/translator/core/lifecycle.ts
|
|
8744
8663
|
const [getIndex, setIndex] = createOutputSectionState(() => 0);
|
|
8745
8664
|
var lifecycle_default = {
|
|
8746
8665
|
analyze(tag) {
|
|
@@ -8779,15 +8698,14 @@ var lifecycle_default = {
|
|
|
8779
8698
|
}],
|
|
8780
8699
|
types: runtime_info_default.name + "/tags/lifecycle.d.marko"
|
|
8781
8700
|
};
|
|
8782
|
-
|
|
8783
|
-
//#region src/translator/core/log.ts
|
|
8701
|
+
// src/translator/core/log.ts
|
|
8784
8702
|
var log_default = {
|
|
8785
8703
|
analyze(tag) {
|
|
8786
8704
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
8787
8705
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
8788
8706
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
8789
8707
|
assertNoBodyContent(tag);
|
|
8790
|
-
const valueAttr = assertOnlyValueAttr(tag, true);
|
|
8708
|
+
const { valueAttr } = assertOnlyValueAttr(tag, true);
|
|
8791
8709
|
addSetupExpr(ensureSection(tag), valueAttr.value);
|
|
8792
8710
|
},
|
|
8793
8711
|
translate: { exit(tag) {
|
|
@@ -8801,8 +8719,7 @@ var log_default = {
|
|
|
8801
8719
|
}],
|
|
8802
8720
|
types: runtime_info_default.name + "/tags/log.d.marko"
|
|
8803
8721
|
};
|
|
8804
|
-
|
|
8805
|
-
//#region src/translator/core/return.ts
|
|
8722
|
+
// src/translator/core/return.ts
|
|
8806
8723
|
var return_default = {
|
|
8807
8724
|
analyze(tag) {
|
|
8808
8725
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag);
|
|
@@ -8810,18 +8727,7 @@ var return_default = {
|
|
|
8810
8727
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
8811
8728
|
assertNoBodyContent(tag);
|
|
8812
8729
|
assertNoSpreadAttrs(tag);
|
|
8813
|
-
|
|
8814
|
-
let valueChangeAttr;
|
|
8815
|
-
for (const attr of tag.node.attributes) if (_marko_compiler.types.isMarkoAttribute(attr)) {
|
|
8816
|
-
if (attr.name === "value") {
|
|
8817
|
-
if (valueAttr) throw tag.hub.buildError(attr, "Invalid duplicate value attribute.");
|
|
8818
|
-
valueAttr = attr;
|
|
8819
|
-
} else if (attr.name === "valueChange") {
|
|
8820
|
-
if (valueChangeAttr) throw tag.hub.buildError(attr, "Invalid duplicate valueChange attribute.");
|
|
8821
|
-
valueChangeAttr = attr;
|
|
8822
|
-
}
|
|
8823
|
-
}
|
|
8824
|
-
assertOnlyValueAttr(tag, true, true);
|
|
8730
|
+
const { valueAttr, valueChangeAttr } = assertOnlyValueAttr(tag, true, true);
|
|
8825
8731
|
const parentTag = getParentTag(tag);
|
|
8826
8732
|
if (parentTag) {
|
|
8827
8733
|
if ((0, _marko_compiler_babel_utils.isNativeTag)(parentTag)) throw tag.get("name").buildCodeFrameError("The [`<return>` tag](https://markojs.com/docs/reference/core-tag#return) can not be used in a [native tag](https://markojs.com/docs/reference/native-tag).");
|
|
@@ -8829,14 +8735,13 @@ var return_default = {
|
|
|
8829
8735
|
}
|
|
8830
8736
|
const section = ensureSection(tag);
|
|
8831
8737
|
if (section.returnValueExpr) throw tag.get("name").buildCodeFrameError(`Cannot have multiple [\`<return>\` tags](https://markojs.com/docs/reference/core-tag#return) ${tag.parent.type === "Program" ? "for the template" : "within a tag's body content"}.`);
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
(
|
|
8835
|
-
addSetupExpr(section, attrs.valueChange);
|
|
8738
|
+
if (valueChangeAttr) {
|
|
8739
|
+
(valueChangeAttr.value.extra ??= {}).isEffect = true;
|
|
8740
|
+
addSetupExpr(section, valueChangeAttr.value);
|
|
8836
8741
|
addReason(ensureSectionSlot(section, 8), ALWAYS);
|
|
8837
8742
|
}
|
|
8838
|
-
addSetupExpr(section,
|
|
8839
|
-
section.returnValueExpr =
|
|
8743
|
+
addSetupExpr(section, valueAttr.value);
|
|
8744
|
+
section.returnValueExpr = valueAttr.value.extra ??= {};
|
|
8840
8745
|
},
|
|
8841
8746
|
translate: translateByTarget({
|
|
8842
8747
|
html: { exit(tag) {
|
|
@@ -8866,9 +8771,8 @@ var return_default = {
|
|
|
8866
8771
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#return"
|
|
8867
8772
|
}]
|
|
8868
8773
|
};
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
const htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
|
|
8774
|
+
// src/translator/core/script.ts
|
|
8775
|
+
const htmlScriptTagAlternateMsg = " For a native html `<script>` tag use the [`html-script` core tag](https://markojs.com/docs/reference/core-tag#html-script--html-style) instead.";
|
|
8872
8776
|
var script_default = {
|
|
8873
8777
|
parse(tag) {
|
|
8874
8778
|
const { node } = tag;
|
|
@@ -8882,6 +8786,8 @@ var script_default = {
|
|
|
8882
8786
|
const start = body[0]?.start;
|
|
8883
8787
|
const end = body[body.length - 1]?.end;
|
|
8884
8788
|
const block = (0, _marko_compiler_babel_utils.parseBlock)((0, _marko_compiler_babel_utils.getFile)(), code, start, end);
|
|
8789
|
+
const [parseError] = block.body;
|
|
8790
|
+
if (parseError?.type === "MarkoParseError") parseError.label += htmlScriptTagAlternateMsg;
|
|
8885
8791
|
if (block.body.length || block.innerComments) {
|
|
8886
8792
|
const valueFn = _marko_compiler.types.arrowFunctionExpression([], block, !!traverseFindAwait(block));
|
|
8887
8793
|
node.attributes.push(_marko_compiler.types.markoAttribute("value", valueFn));
|
|
@@ -8898,7 +8804,7 @@ var script_default = {
|
|
|
8898
8804
|
if (node.var) throw tag.hub.buildError(node.var, "The [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) does not support a tag variable reference." + htmlScriptTagAlternateMsg);
|
|
8899
8805
|
let seenValueAttr = false;
|
|
8900
8806
|
for (const attr of node.attributes) if (attr.type === "MarkoAttribute" && attr.name === "value") {
|
|
8901
|
-
if (seenValueAttr) throw tag
|
|
8807
|
+
if (seenValueAttr) throw buildDuplicateAttrError(tag, attr);
|
|
8902
8808
|
seenValueAttr = true;
|
|
8903
8809
|
if (!isEmptyFunction(attr.value)) {
|
|
8904
8810
|
const valueExtra = attr.value.extra ??= {};
|
|
@@ -8944,7 +8850,7 @@ var script_default = {
|
|
|
8944
8850
|
preserveWhitespace: true
|
|
8945
8851
|
},
|
|
8946
8852
|
autocomplete: [{
|
|
8947
|
-
description: "Use to create side effects.",
|
|
8853
|
+
description: "Use to create side effects. For a native `<script>` element, use `<html-script>`.",
|
|
8948
8854
|
descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#script"
|
|
8949
8855
|
}],
|
|
8950
8856
|
types: runtime_info_default.name + "/tags/script.d.marko"
|
|
@@ -8976,11 +8882,9 @@ function isReturnStatement(node) {
|
|
|
8976
8882
|
default: return false;
|
|
8977
8883
|
}
|
|
8978
8884
|
}
|
|
8979
|
-
|
|
8980
|
-
//#region src/translator/core/server.ts
|
|
8885
|
+
// src/translator/core/server.ts
|
|
8981
8886
|
var server_default = createStatementTag("server");
|
|
8982
|
-
|
|
8983
|
-
//#region src/translator/core/show.ts
|
|
8887
|
+
// src/translator/core/show.ts
|
|
8984
8888
|
const kStartBinding = Symbol("<show> range start binding");
|
|
8985
8889
|
const kStaticDisplay = Symbol("<show> static display");
|
|
8986
8890
|
const kBodyContent = Symbol("<show> body content");
|
|
@@ -9101,11 +9005,9 @@ function assertLegalHiddenContext(tag) {
|
|
|
9101
9005
|
throw tag.get("name").buildCodeFrameError(`A [\`<${getTagName(tag)}>\` tag](https://markojs.com/docs/reference/core-tag#show) cannot be a direct child of \`<${parentName}>\`: hidden content is wrapped in an element that \`<${parentName}>\` discards, which would render the content instead of hiding it. Move the \`<${getTagName(tag)}>\` inside the row or option, or use [\`<if>\`](https://markojs.com/docs/reference/core-tag#if).`);
|
|
9102
9006
|
}
|
|
9103
9007
|
}
|
|
9104
|
-
|
|
9105
|
-
//#region src/translator/core/static.ts
|
|
9008
|
+
// src/translator/core/static.ts
|
|
9106
9009
|
var static_default = createStatementTag("static");
|
|
9107
|
-
|
|
9108
|
-
//#region src/translator/util/asset-imports.ts
|
|
9010
|
+
// src/translator/util/asset-imports.ts
|
|
9109
9011
|
function addAssetImport(request) {
|
|
9110
9012
|
((0, _marko_compiler_babel_utils.getFile)().metadata.marko.assetImports ??= /* @__PURE__ */ new Set()).add(request);
|
|
9111
9013
|
}
|
|
@@ -9113,8 +9015,7 @@ function isClientAssetImport(file, request) {
|
|
|
9113
9015
|
const { hydrateIncludeImports } = file.markoOpts;
|
|
9114
9016
|
return typeof hydrateIncludeImports === "function" ? hydrateIncludeImports(request) : !!hydrateIncludeImports?.test(request);
|
|
9115
9017
|
}
|
|
9116
|
-
|
|
9117
|
-
//#region src/translator/util/style-interpolation.ts
|
|
9018
|
+
// src/translator/util/style-interpolation.ts
|
|
9118
9019
|
const htmlStyleTagAlternateMsg = " For a native html [`<style>` tag](https://markojs.com/docs/reference/core-tag#style) use the `html-style` core tag instead.";
|
|
9119
9020
|
function checkStyleInterpolations(tag) {
|
|
9120
9021
|
const { body } = tag.node.body;
|
|
@@ -9202,8 +9103,7 @@ const cssGluedValue = /^(?:[%.\d]|(?:p[xtc]|in|[cm]m|q|r?em|ex|ch|r?lh|v[whib]|v
|
|
|
9202
9103
|
const cssGluedBefore = /[\w%]$/;
|
|
9203
9104
|
const cssUrlBefore = /(?:^|[^\w-])url\($/i;
|
|
9204
9105
|
const cssQuotedArg = /^\s*["']/;
|
|
9205
|
-
|
|
9206
|
-
//#region src/translator/core/style.ts
|
|
9106
|
+
// src/translator/core/style.ts
|
|
9207
9107
|
const kStyleImportPath = Symbol("style import path");
|
|
9208
9108
|
const kCustomPropertyNames = Symbol("custom property names");
|
|
9209
9109
|
const STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
|
|
@@ -9350,7 +9250,7 @@ function createStyleDependency(file, node, names) {
|
|
|
9350
9250
|
const counts = getStyleCounts();
|
|
9351
9251
|
const index = counts[ext] || 0;
|
|
9352
9252
|
counts[ext] = index + 1;
|
|
9353
|
-
const magicString = sourceMaps ? new magic_string.
|
|
9253
|
+
const magicString = sourceMaps ? new magic_string.MagicString(file.code, { filename }) : void 0;
|
|
9354
9254
|
let code = "";
|
|
9355
9255
|
let last = 0;
|
|
9356
9256
|
let map;
|
|
@@ -9387,8 +9287,7 @@ function createStyleDependency(file, node, names) {
|
|
|
9387
9287
|
map
|
|
9388
9288
|
});
|
|
9389
9289
|
}
|
|
9390
|
-
|
|
9391
|
-
//#region src/translator/core/try.ts
|
|
9290
|
+
// src/translator/core/try.ts
|
|
9392
9291
|
var try_default = {
|
|
9393
9292
|
analyze(tag) {
|
|
9394
9293
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
@@ -9494,8 +9393,7 @@ function getAttrTag(tag, name) {
|
|
|
9494
9393
|
function buildContent(body) {
|
|
9495
9394
|
return _marko_compiler.types.arrowFunctionExpression(body.node.params, _marko_compiler.types.blockStatement([getScopeReasonStatement(getSectionForBody(body)), ...body.node.body]));
|
|
9496
9395
|
}
|
|
9497
|
-
|
|
9498
|
-
//#region src/translator/core/index.ts
|
|
9396
|
+
// src/translator/core/index.ts
|
|
9499
9397
|
var core_default = {
|
|
9500
9398
|
taglibId: runtime_info_default.taglibId,
|
|
9501
9399
|
"<attrs>": attrs_default,
|
|
@@ -9527,23 +9425,19 @@ var core_default = {
|
|
|
9527
9425
|
"<style>": style_default,
|
|
9528
9426
|
"<try>": try_default
|
|
9529
9427
|
};
|
|
9530
|
-
|
|
9531
|
-
//#region src/translator/visitors/cdata.ts
|
|
9428
|
+
// src/translator/visitors/cdata.ts
|
|
9532
9429
|
var cdata_default = { translate: { enter(cdata) {
|
|
9533
9430
|
throw cdata.buildCodeFrameError("CDATA sections are not supported in Marko.");
|
|
9534
9431
|
} } };
|
|
9535
|
-
|
|
9536
|
-
//#region src/translator/visitors/comment.ts
|
|
9432
|
+
// src/translator/visitors/comment.ts
|
|
9537
9433
|
var comment_default = { translate: { exit(comment) {
|
|
9538
9434
|
replaceWithStatements(comment);
|
|
9539
9435
|
} } };
|
|
9540
|
-
|
|
9541
|
-
//#region src/translator/visitors/declaration.ts
|
|
9436
|
+
// src/translator/visitors/declaration.ts
|
|
9542
9437
|
var declaration_default = { translate: { enter(decl) {
|
|
9543
9438
|
throw decl.buildCodeFrameError("XML declarations sections are not supported in Marko.");
|
|
9544
9439
|
} } };
|
|
9545
|
-
|
|
9546
|
-
//#region src/translator/visitors/document-type.ts
|
|
9440
|
+
// src/translator/visitors/document-type.ts
|
|
9547
9441
|
var document_type_default = { translate: { exit(documentType) {
|
|
9548
9442
|
if (isOutputHTML()) {
|
|
9549
9443
|
writeTo$1(documentType)`<!${documentType.node.value}>`;
|
|
@@ -9562,8 +9456,7 @@ function isBeforeHtmlOrHead(documentType) {
|
|
|
9562
9456
|
}
|
|
9563
9457
|
return false;
|
|
9564
9458
|
}
|
|
9565
|
-
|
|
9566
|
-
//#region src/translator/visitors/export-declaration.ts
|
|
9459
|
+
// src/translator/visitors/export-declaration.ts
|
|
9567
9460
|
var export_declaration_default = {
|
|
9568
9461
|
analyze(exportDecl) {
|
|
9569
9462
|
const { node } = exportDecl;
|
|
@@ -9582,8 +9475,7 @@ var export_declaration_default = {
|
|
|
9582
9475
|
if (tagImport) node.source.value = tagImport;
|
|
9583
9476
|
} }
|
|
9584
9477
|
};
|
|
9585
|
-
|
|
9586
|
-
//#region src/translator/visitors/function.ts
|
|
9478
|
+
// src/translator/visitors/function.ts
|
|
9587
9479
|
var function_default = { analyze(fn) {
|
|
9588
9480
|
const awaitNode = isMarkoAttribute(fn.parentPath) && _marko_compiler.types.isFunctionExpression(fn.node) && !fn.node.async && traverseFindAwait(fn.node.body);
|
|
9589
9481
|
if (awaitNode) {
|
|
@@ -9608,8 +9500,7 @@ var function_default = { analyze(fn) {
|
|
|
9608
9500
|
function isMarkoAttribute(path) {
|
|
9609
9501
|
return path ? path.isMarkoAttribute() : false;
|
|
9610
9502
|
}
|
|
9611
|
-
|
|
9612
|
-
//#region src/translator/visitors/import-declaration.ts
|
|
9503
|
+
// src/translator/visitors/import-declaration.ts
|
|
9613
9504
|
const [getHtmlLoadWrapped] = createOutputState(() => /* @__PURE__ */ new Map());
|
|
9614
9505
|
var import_declaration_default = {
|
|
9615
9506
|
analyze(importDecl) {
|
|
@@ -9697,8 +9588,7 @@ function trackRegisteredImports(importDecl) {
|
|
|
9697
9588
|
else trackImport(importDecl, local, resolveRegisteredExport(childFile, importedName));
|
|
9698
9589
|
}
|
|
9699
9590
|
}
|
|
9700
|
-
|
|
9701
|
-
//#region src/translator/visitors/placeholder.ts
|
|
9591
|
+
// src/translator/visitors/placeholder.ts
|
|
9702
9592
|
const kTextAfter = Symbol("text may merge after the placeholder");
|
|
9703
9593
|
var placeholder_default = {
|
|
9704
9594
|
analyze: {
|
|
@@ -9786,8 +9676,7 @@ function analyzeSiblingText(placeholder) {
|
|
|
9786
9676
|
extra.textBefore = mayMergeWithText(placeholder, true);
|
|
9787
9677
|
extra[kTextAfter] = mayMergeWithText(placeholder, false);
|
|
9788
9678
|
}
|
|
9789
|
-
|
|
9790
|
-
//#region src/translator/util/analyze-errors.ts
|
|
9679
|
+
// src/translator/util/analyze-errors.ts
|
|
9791
9680
|
const [hasAnalyzeErrors, setHasAnalyzeErrors] = createAnalysisState(() => false);
|
|
9792
9681
|
function reportAnalyzeError(path, error) {
|
|
9793
9682
|
const { filename } = error;
|
|
@@ -9799,8 +9688,7 @@ function reportAnalyzeError(path, error) {
|
|
|
9799
9688
|
loc: loc ?? path.node.loc ?? void 0
|
|
9800
9689
|
});
|
|
9801
9690
|
}
|
|
9802
|
-
|
|
9803
|
-
//#region src/translator/util/entry-builder.ts
|
|
9691
|
+
// src/translator/util/entry-builder.ts
|
|
9804
9692
|
const kState = Symbol();
|
|
9805
9693
|
const builder = {
|
|
9806
9694
|
build(entryFile, exportInit) {
|
|
@@ -9890,8 +9778,7 @@ function markReached(visited, resolved, reach) {
|
|
|
9890
9778
|
visited.set(resolved, reach);
|
|
9891
9779
|
return true;
|
|
9892
9780
|
}
|
|
9893
|
-
|
|
9894
|
-
//#region src/translator/util/get-style-file.ts
|
|
9781
|
+
// src/translator/util/get-style-file.ts
|
|
9895
9782
|
function getStyleFile(file) {
|
|
9896
9783
|
const { filename } = file.opts;
|
|
9897
9784
|
const fs = file.markoOpts.fileSystem;
|
|
@@ -9931,8 +9818,7 @@ const regexpCharsReg = /[\\^$.*+?()[\]{}|]/g;
|
|
|
9931
9818
|
function escapeRegExp(str) {
|
|
9932
9819
|
return str.replace(regexpCharsReg, "\\$&");
|
|
9933
9820
|
}
|
|
9934
|
-
|
|
9935
|
-
//#region src/translator/visitors/tag/dynamic-tag.ts
|
|
9821
|
+
// src/translator/visitors/tag/dynamic-tag.ts
|
|
9936
9822
|
const [getAddedStatementKeys] = createOutputState(() => /* @__PURE__ */ new Set());
|
|
9937
9823
|
const [needsCompat, setNeedsCompat] = createOutputState(() => false);
|
|
9938
9824
|
const [getCompatBoundaryCalls] = createOutputState(() => /* @__PURE__ */ new Map());
|
|
@@ -10140,8 +10026,7 @@ function getDynamicTagInputBindings(tagExtra) {
|
|
|
10140
10026
|
function isTagVarResumed(tag) {
|
|
10141
10027
|
return !tag.node.var.extra.binding.pruned || isTagVarAssigned(tag);
|
|
10142
10028
|
}
|
|
10143
|
-
|
|
10144
|
-
//#region src/translator/visitors/program/dom.ts
|
|
10029
|
+
// src/translator/visitors/program/dom.ts
|
|
10145
10030
|
var dom_default = { translate: {
|
|
10146
10031
|
enter(program) {
|
|
10147
10032
|
const section = getSectionForBody(program);
|
|
@@ -10238,8 +10123,7 @@ function assertSetupWorkFound(program, section, written) {
|
|
|
10238
10123
|
function markReturn(section, setup, params) {
|
|
10239
10124
|
return section.returnValueExpr && !isOptimize() ? setup ? [callRuntime("_return_setup", setup), params] : [setup, callRuntime("_return_setup", params)] : [setup, params];
|
|
10240
10125
|
}
|
|
10241
|
-
|
|
10242
|
-
//#region src/translator/visitors/program/html.ts
|
|
10126
|
+
// src/translator/visitors/program/html.ts
|
|
10243
10127
|
var html_default = { translate: {
|
|
10244
10128
|
enter() {
|
|
10245
10129
|
const sectionDynamicSubscribers = /* @__PURE__ */ new Set();
|
|
@@ -10333,8 +10217,7 @@ function buildResumeCall(node) {
|
|
|
10333
10217
|
return callRuntime("_resume", simplifyFunction(node), _marko_compiler.types.stringLiteral(extra.registryId), extra.referencesScope && getScopeIdIdentifier(extra.section));
|
|
10334
10218
|
}
|
|
10335
10219
|
}
|
|
10336
|
-
|
|
10337
|
-
//#region src/translator/visitors/program/index.ts
|
|
10220
|
+
// src/translator/visitors/program/index.ts
|
|
10338
10221
|
var program_default = {
|
|
10339
10222
|
migrate: {
|
|
10340
10223
|
enter(program) {
|
|
@@ -10451,8 +10334,7 @@ var program_default = {
|
|
|
10451
10334
|
}
|
|
10452
10335
|
}
|
|
10453
10336
|
};
|
|
10454
|
-
|
|
10455
|
-
//#region src/translator/visitors/referenced-identifier.ts
|
|
10337
|
+
// src/translator/visitors/referenced-identifier.ts
|
|
10456
10338
|
const kAbortId = Symbol("abort id");
|
|
10457
10339
|
const [getAbortResetEmitted] = createOutputSectionState(() => /* @__PURE__ */ new Set());
|
|
10458
10340
|
var referenced_identifier_default = {
|
|
@@ -10505,8 +10387,7 @@ function replaceWithExtra(path, replacement) {
|
|
|
10505
10387
|
replacement.extra = path.node.extra;
|
|
10506
10388
|
path.replaceWith(replacement);
|
|
10507
10389
|
}
|
|
10508
|
-
|
|
10509
|
-
//#region src/translator/visitors/scriptlet.ts
|
|
10390
|
+
// src/translator/visitors/scriptlet.ts
|
|
10510
10391
|
var scriptlet_default = {
|
|
10511
10392
|
analyze(scriptlet) {
|
|
10512
10393
|
if (!scriptlet.node.static) {
|
|
@@ -10527,8 +10408,7 @@ var scriptlet_default = {
|
|
|
10527
10408
|
if (!isHTML) replaceWithStatements(scriptlet, node.body);
|
|
10528
10409
|
} }
|
|
10529
10410
|
};
|
|
10530
|
-
|
|
10531
|
-
//#region src/translator/visitors/tag/attribute-tag.ts
|
|
10411
|
+
// src/translator/visitors/tag/attribute-tag.ts
|
|
10532
10412
|
var attribute_tag_default = {
|
|
10533
10413
|
analyze: { enter(tag) {
|
|
10534
10414
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
@@ -10554,8 +10434,7 @@ var attribute_tag_default = {
|
|
|
10554
10434
|
}
|
|
10555
10435
|
}
|
|
10556
10436
|
};
|
|
10557
|
-
|
|
10558
|
-
//#region src/translator/visitors/tag/custom-tag.ts
|
|
10437
|
+
// src/translator/visitors/tag/custom-tag.ts
|
|
10559
10438
|
const [getLoadIdentifiers] = createOutputState(() => ({
|
|
10560
10439
|
triggers: /* @__PURE__ */ new Map(),
|
|
10561
10440
|
signals: /* @__PURE__ */ new Map(),
|
|
@@ -10708,8 +10587,7 @@ function isTemplateImport(tag) {
|
|
|
10708
10587
|
const { name } = tag.node;
|
|
10709
10588
|
return _marko_compiler.types.isIdentifier(name) && tag.scope.getBinding(name.name)?.kind === "module";
|
|
10710
10589
|
}
|
|
10711
|
-
|
|
10712
|
-
//#region src/translator/visitors/tag/native-tag.ts
|
|
10590
|
+
// src/translator/visitors/tag/native-tag.ts
|
|
10713
10591
|
const kNodeOp = Symbol("native tag structure node");
|
|
10714
10592
|
const kNativeAttrs = Symbol("native tag attrs");
|
|
10715
10593
|
const htmlContentAttrTags = /* @__PURE__ */ new WeakSet();
|
|
@@ -11091,14 +10969,11 @@ var native_tag_default = {
|
|
|
11091
10969
|
}
|
|
11092
10970
|
if (spreadExpression) {
|
|
11093
10971
|
const spreadContent = spreadRendersContent(tag, contentAttr, getTagFacts(tag).textBody);
|
|
11094
|
-
const
|
|
11095
|
-
const staticName = name.isStringLiteral() ? name.node.value : void 0;
|
|
11096
|
-
const element = staticName === void 0 ? void 0 : controllableElements.get(staticName);
|
|
10972
|
+
const element = controllableElements.get(tagName);
|
|
11097
10973
|
const spreadHelper = !controllable && element?.spreadHelper;
|
|
11098
10974
|
if (skipExpression) addStatement("render", tagSection, tagExtra, callRuntime(spreadContent ? "_attrs_partial_content" : "_attrs_partial", scopeIdentifier, nodeAccessor, spreadExpression, skipExpression, spreadHelper && importRuntime(spreadHelper)));
|
|
11099
10975
|
else addStatement("render", tagSection, tagExtra, callRuntime(spreadContent ? "_attrs_content" : "_attrs", scopeIdentifier, nodeAccessor, spreadExpression, spreadHelper && importRuntime(spreadHelper)));
|
|
11100
|
-
if (
|
|
11101
|
-
else if (element) importRuntimeFeature(element.feature);
|
|
10976
|
+
if (element) importRuntimeFeature(element.feature);
|
|
11102
10977
|
addStatement("effect", tagSection, tagExtra, callRuntime("_attrs_script", scopeIdentifier, nodeAccessor));
|
|
11103
10978
|
}
|
|
11104
10979
|
if (contentAttr) addStatement("render", tagSection, contentAttr.value.extra, callRuntime("_attr_content", scopeIdentifier, nodeAccessor, contentAttr.value), true);
|
|
@@ -11383,27 +11258,27 @@ function buildClassMarkup({ staticParts, toggles = [] }) {
|
|
|
11383
11258
|
combos.push(parts);
|
|
11384
11259
|
}
|
|
11385
11260
|
if (combos.every((parts) => parts.every(isLiteralPart))) return buildPrecomputedClass(combos.map((parts) => _attr_class(parts.join(" "))), toggles);
|
|
11386
|
-
const table = ensureModuleClassMarkup(combos)
|
|
11261
|
+
const table = ensureModuleClassMarkup(JSON.stringify(combos), () => {
|
|
11262
|
+
const markups = combos.map((parts) => parts.length ? callRuntime("_attr_class", buildClassString(parts, [])) : _marko_compiler.types.stringLiteral(""));
|
|
11263
|
+
return markups.length === 1 ? markups[0] : _marko_compiler.types.arrayExpression(markups);
|
|
11264
|
+
});
|
|
11387
11265
|
return toggles.length ? _marko_compiler.types.memberExpression(table, buildToggleIndex(toggles), true) : table;
|
|
11388
11266
|
}
|
|
11389
11267
|
function buildPrecomputedClass(combos, toggles) {
|
|
11390
11268
|
if (!toggles.length) return _marko_compiler.types.stringLiteral(combos[0]);
|
|
11391
11269
|
if (toggles.length === 1) return _marko_compiler.types.conditionalExpression(toggles[0].value, _marko_compiler.types.stringLiteral(combos[1]), _marko_compiler.types.stringLiteral(combos[0]));
|
|
11392
11270
|
const end = commonAttrPrefixEnd(combos);
|
|
11393
|
-
const
|
|
11394
|
-
|
|
11395
|
-
const lookup = _marko_compiler.types.memberExpression(_marko_compiler.types.cloneNode(table), buildToggleIndex(toggles), true);
|
|
11271
|
+
const values = combos.map((combo) => combo.slice(end));
|
|
11272
|
+
const lookup = _marko_compiler.types.memberExpression(ensureModuleClassMarkup(JSON.stringify(values), () => _marko_compiler.types.arrayExpression(values.map((value) => _marko_compiler.types.stringLiteral(value)))), buildToggleIndex(toggles), true);
|
|
11396
11273
|
return buildStringExpression([combos[0].slice(0, end), lookup]);
|
|
11397
11274
|
}
|
|
11398
11275
|
const [getModuleClassMarkups] = createOutputState(() => /* @__PURE__ */ new Map());
|
|
11399
|
-
function ensureModuleClassMarkup(
|
|
11400
|
-
const key = JSON.stringify(combos);
|
|
11276
|
+
function ensureModuleClassMarkup(key, build) {
|
|
11401
11277
|
const moduleClassMarkups = getModuleClassMarkups();
|
|
11402
11278
|
let id = moduleClassMarkups.get(key);
|
|
11403
11279
|
if (!id) {
|
|
11404
|
-
const markups = combos.map((parts) => parts.length ? callRuntime("_attr_class", buildClassString(parts, [])) : _marko_compiler.types.stringLiteral(""));
|
|
11405
11280
|
moduleClassMarkups.set(key, id = generateUidIdentifier("class"));
|
|
11406
|
-
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.markoScriptlet([_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(id,
|
|
11281
|
+
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.markoScriptlet([_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(id, build())])], true));
|
|
11407
11282
|
}
|
|
11408
11283
|
return _marko_compiler.types.cloneNode(id);
|
|
11409
11284
|
}
|
|
@@ -11542,8 +11417,7 @@ function addToggle(meta, key, value, alternate) {
|
|
|
11542
11417
|
alternate
|
|
11543
11418
|
});
|
|
11544
11419
|
}
|
|
11545
|
-
|
|
11546
|
-
//#region src/translator/visitors/tag/index.ts
|
|
11420
|
+
// src/translator/visitors/tag/index.ts
|
|
11547
11421
|
const kAnalyzeFailed = Symbol("analyze failed");
|
|
11548
11422
|
var tag_default = {
|
|
11549
11423
|
analyze: {
|
|
@@ -11637,8 +11511,7 @@ var tag_default = {
|
|
|
11637
11511
|
}
|
|
11638
11512
|
}
|
|
11639
11513
|
};
|
|
11640
|
-
|
|
11641
|
-
//#region src/translator/visitors/text.ts
|
|
11514
|
+
// src/translator/visitors/text.ts
|
|
11642
11515
|
var text_default = {
|
|
11643
11516
|
analyze: { exit(text) {
|
|
11644
11517
|
if (isInTextBody(text)) return;
|
|
@@ -11651,12 +11524,11 @@ var text_default = {
|
|
|
11651
11524
|
replaceWithStatements(text);
|
|
11652
11525
|
} }
|
|
11653
11526
|
};
|
|
11654
|
-
|
|
11655
|
-
//#region src/translator/interop/build-aggregate-error.ts
|
|
11527
|
+
// src/translator/interop/build-aggregate-error.ts
|
|
11656
11528
|
function buildAggregateError(file, rootMsg, ...paths) {
|
|
11657
11529
|
const err = /* @__PURE__ */ new SyntaxError();
|
|
11658
11530
|
const fileName = path.default.relative(_marko_compiler_modules.cwd, file.opts.filename);
|
|
11659
|
-
const finalMsg = `${rootMsg}:\n\n${paths.map(([msg, path
|
|
11531
|
+
const finalMsg = `${rootMsg}:\n\n${paths.map(([msg, path]) => `\x1b[90m${msg} at ${getFileNameWithLoc(fileName, path)}:\x1b[0m\n${getFrame(file, path)}`).join("\n\n")}`;
|
|
11660
11532
|
if (!("MARKO_DEBUG" in process.env)) err.stack = finalMsg;
|
|
11661
11533
|
Object.defineProperty(err, "message", {
|
|
11662
11534
|
get() {
|
|
@@ -11682,12 +11554,10 @@ function getFileNameWithLoc(fileName, { node: { loc } }) {
|
|
|
11682
11554
|
if (loc) return `${fileName}(${loc.start.line},${loc.start.column + 1})`;
|
|
11683
11555
|
return fileName;
|
|
11684
11556
|
}
|
|
11685
|
-
|
|
11686
|
-
//#region src/translator/interop/constants/feature-type.ts
|
|
11557
|
+
// src/translator/interop/constants/feature-type.ts
|
|
11687
11558
|
const Class = "class";
|
|
11688
11559
|
const Tags = "tags";
|
|
11689
|
-
|
|
11690
|
-
//#region src/translator/interop/feature-detection.ts
|
|
11560
|
+
// src/translator/interop/feature-detection.ts
|
|
11691
11561
|
function isTagsAPI(file = (0, _marko_compiler_babel_utils.getFile)()) {
|
|
11692
11562
|
const program = file.path;
|
|
11693
11563
|
const programExtra = program.node.extra ??= {};
|
|
@@ -11781,8 +11651,7 @@ function addFeature(state, type, name, path) {
|
|
|
11781
11651
|
type
|
|
11782
11652
|
};
|
|
11783
11653
|
}
|
|
11784
|
-
|
|
11785
|
-
//#region src/translator/interop/index.ts
|
|
11654
|
+
// src/translator/interop/index.ts
|
|
11786
11655
|
function createInteropTranslator(translate5) {
|
|
11787
11656
|
return {
|
|
11788
11657
|
version: translate5.version ?? "0.0.0",
|
|
@@ -11881,8 +11750,8 @@ function mergeVisit(visit5, visit6) {
|
|
|
11881
11750
|
} : { exit } : enter;
|
|
11882
11751
|
}
|
|
11883
11752
|
function mergeHook(hook5, hook6) {
|
|
11884
|
-
return (hook5 || hook6) && function(path
|
|
11885
|
-
return (isTagsAPI() ? hook6 : hook5)?.call(this, path
|
|
11753
|
+
return (hook5 || hook6) && function(path, state) {
|
|
11754
|
+
return (isTagsAPI() ? hook6 : hook5)?.call(this, path, state);
|
|
11886
11755
|
};
|
|
11887
11756
|
}
|
|
11888
11757
|
function mergeTaglibs(libs5, libs6) {
|
|
@@ -11960,8 +11829,7 @@ function getVisitorEnter(visit) {
|
|
|
11960
11829
|
function getVisitorExit(visit) {
|
|
11961
11830
|
return typeof visit === "object" ? visit?.exit : void 0;
|
|
11962
11831
|
}
|
|
11963
|
-
|
|
11964
|
-
//#region src/translator/index.ts
|
|
11832
|
+
// src/translator/index.ts
|
|
11965
11833
|
const version = package_json.default.version;
|
|
11966
11834
|
const cheatsheet = "../../cheatsheet.md";
|
|
11967
11835
|
const visitors = extractVisitors({
|
|
@@ -11992,7 +11860,6 @@ function getRuntimeEntryFiles(output, optimize) {
|
|
|
11992
11860
|
if (output === "html") return [`${runtime}/html`];
|
|
11993
11861
|
return [`${runtime}/dom`, ...domRuntimeFeatures.map((feature) => `${runtime}/dom/${feature}.feat`)];
|
|
11994
11862
|
}
|
|
11995
|
-
//#endregion
|
|
11996
11863
|
exports.analyze = analyze;
|
|
11997
11864
|
exports.cheatsheet = cheatsheet;
|
|
11998
11865
|
exports.createInteropTranslator = createInteropTranslator;
|