marko 6.0.119 → 6.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/accessor.d.ts +2 -0
- package/dist/common/accessor.debug.d.ts +2 -0
- package/dist/common/types.d.ts +7 -3
- package/dist/debug/dom.js +605 -575
- package/dist/debug/dom.mjs +605 -575
- package/dist/dom/queue.d.ts +7 -0
- package/dist/dom/renderer.d.ts +1 -0
- package/dist/dom/signals.d.ts +1 -1
- package/dist/dom.js +332 -311
- package/dist/dom.mjs +332 -311
- package/dist/translator/index.js +135 -82
- package/dist/translator/util/optional.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +1 -0
- package/dist/translator/visitors/scriptlet.d.ts +1 -1
- package/package.json +2 -2
package/dist/translator/index.js
CHANGED
|
@@ -145,11 +145,13 @@ var AccessorProp = /* @__PURE__ */ ((AccessorProp4) => {
|
|
|
145
145
|
AccessorProp4["ClosestBranchId"] = "#ClosestBranchId";
|
|
146
146
|
AccessorProp4["Creating"] = "#Creating";
|
|
147
147
|
AccessorProp4["Destroyed"] = "#Destroyed";
|
|
148
|
+
AccessorProp4["DetachedAwait"] = "#DetachedAwait";
|
|
148
149
|
AccessorProp4["EndNode"] = "#EndNode";
|
|
149
150
|
AccessorProp4["Id"] = "#Id";
|
|
150
151
|
AccessorProp4["LoopKey"] = "#LoopKey";
|
|
151
152
|
AccessorProp4["ParentBranch"] = "#ParentBranch";
|
|
152
153
|
AccessorProp4["PendingEffects"] = "#PendingEffects";
|
|
154
|
+
AccessorProp4["PendingRenders"] = "#PendingRenders";
|
|
153
155
|
AccessorProp4["PlaceholderBranch"] = "#PlaceholderBranch";
|
|
154
156
|
AccessorProp4["PlaceholderContent"] = "#PlaceholderContent";
|
|
155
157
|
AccessorProp4["Renderer"] = "#Renderer";
|
|
@@ -1128,6 +1130,9 @@ function find(data, cb) {
|
|
|
1128
1130
|
}
|
|
1129
1131
|
}
|
|
1130
1132
|
}
|
|
1133
|
+
function some(data, cb) {
|
|
1134
|
+
return data ? Array.isArray(data) ? data.some(cb) : !!cb(data, 0) : false;
|
|
1135
|
+
}
|
|
1131
1136
|
function toArray(data, cb) {
|
|
1132
1137
|
return data ? Array.isArray(data) ? data.map(cb) : [cb(data, 0)] : [];
|
|
1133
1138
|
}
|
|
@@ -1297,11 +1302,13 @@ var AccessorProp2 = /* @__PURE__ */ ((AccessorProp4) => {
|
|
|
1297
1302
|
AccessorProp4["ClosestBranchId"] = "G";
|
|
1298
1303
|
AccessorProp4["Creating"] = "H";
|
|
1299
1304
|
AccessorProp4["Destroyed"] = "I";
|
|
1305
|
+
AccessorProp4["DetachedAwait"] = "V";
|
|
1300
1306
|
AccessorProp4["EndNode"] = "K";
|
|
1301
1307
|
AccessorProp4["Id"] = "L";
|
|
1302
1308
|
AccessorProp4["LoopKey"] = "M";
|
|
1303
1309
|
AccessorProp4["ParentBranch"] = "N";
|
|
1304
1310
|
AccessorProp4["PendingEffects"] = "J";
|
|
1311
|
+
AccessorProp4["PendingRenders"] = "W";
|
|
1305
1312
|
AccessorProp4["PlaceholderBranch"] = "P";
|
|
1306
1313
|
AccessorProp4["PlaceholderContent"] = "Q";
|
|
1307
1314
|
AccessorProp4["Renderer"] = "R";
|
|
@@ -3336,6 +3343,7 @@ var [getClosureSignalBuilder, _setClosureSignalBuilder] = createSectionState("qu
|
|
|
3336
3343
|
function setClosureSignalBuilder(tag, builder) {
|
|
3337
3344
|
_setClosureSignalBuilder(getSectionForBody(tag.get("body")), builder);
|
|
3338
3345
|
}
|
|
3346
|
+
var [getTryHasPlaceholder, setTryHasPlaceholder] = createSectionState("tryWithPlaceholder");
|
|
3339
3347
|
var [getSerializedAccessors] = createSectionState("serializedScopeProperties", () => /* @__PURE__ */ new Map());
|
|
3340
3348
|
function setSectionSerializedValue(section, prop, expression) {
|
|
3341
3349
|
const reason = getSerializeReason(section, prop);
|
|
@@ -3429,23 +3437,37 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
|
|
|
3429
3437
|
};
|
|
3430
3438
|
} else if (referencedBindings.section !== section && bindingUtil.find(section.referencedClosures, referencedBindings)) {
|
|
3431
3439
|
signal.build = () => {
|
|
3432
|
-
const
|
|
3440
|
+
const closure = getCanonicalBinding(referencedBindings);
|
|
3433
3441
|
const render = getSignalFn(signal);
|
|
3434
3442
|
const closureSignalBuilder = getClosureSignalBuilder(section);
|
|
3435
|
-
|
|
3443
|
+
if (closureSignalBuilder && !isDynamicClosure(section, closure)) {
|
|
3444
|
+
return closureSignalBuilder(closure, render);
|
|
3445
|
+
}
|
|
3446
|
+
return callRuntime(
|
|
3436
3447
|
"_closure_get",
|
|
3437
|
-
getScopeAccessorLiteral(
|
|
3448
|
+
getScopeAccessorLiteral(closure, true),
|
|
3438
3449
|
render,
|
|
3439
|
-
isImmediateOwner(section,
|
|
3450
|
+
isImmediateOwner(section, closure) ? void 0 : import_compiler22.types.arrowFunctionExpression(
|
|
3440
3451
|
[scopeIdentifier],
|
|
3441
|
-
getScopeExpression(section,
|
|
3442
|
-
)
|
|
3443
|
-
|
|
3452
|
+
getScopeExpression(section, closure.section)
|
|
3453
|
+
),
|
|
3454
|
+
some(closure.closureSections, underTryPlaceholder) ? import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure)) : void 0
|
|
3455
|
+
);
|
|
3444
3456
|
};
|
|
3445
3457
|
}
|
|
3446
3458
|
}
|
|
3447
3459
|
return signal;
|
|
3448
3460
|
}
|
|
3461
|
+
function underTryPlaceholder(section) {
|
|
3462
|
+
let curSection = section.parent;
|
|
3463
|
+
while (curSection) {
|
|
3464
|
+
if (getTryHasPlaceholder(curSection)) {
|
|
3465
|
+
return true;
|
|
3466
|
+
}
|
|
3467
|
+
curSection = curSection.parent;
|
|
3468
|
+
}
|
|
3469
|
+
return false;
|
|
3470
|
+
}
|
|
3449
3471
|
function initValue(binding, isLet = false) {
|
|
3450
3472
|
const section = binding.section;
|
|
3451
3473
|
const signal = getSignal(section, binding);
|
|
@@ -4038,10 +4060,29 @@ function writeHTMLResumeStatements(path5) {
|
|
|
4038
4060
|
import_compiler22.types.numericLiteral(getDynamicClosureIndex(closure, section)),
|
|
4039
4061
|
getAccessorPrefix().ClosureSignalIndex
|
|
4040
4062
|
);
|
|
4041
|
-
|
|
4042
|
-
section
|
|
4043
|
-
(
|
|
4044
|
-
|
|
4063
|
+
if (underTryPlaceholder(section)) {
|
|
4064
|
+
const reason = getSerializeReason(section);
|
|
4065
|
+
if (reason) {
|
|
4066
|
+
getHTMLSectionStatements(section).push(
|
|
4067
|
+
import_compiler22.types.expressionStatement(
|
|
4068
|
+
getExprIfSerialized(
|
|
4069
|
+
section,
|
|
4070
|
+
reason,
|
|
4071
|
+
callRuntime(
|
|
4072
|
+
"_script",
|
|
4073
|
+
getScopeIdIdentifier(section),
|
|
4074
|
+
import_compiler22.types.stringLiteral(getResumeRegisterId(section, closure))
|
|
4075
|
+
)
|
|
4076
|
+
)
|
|
4077
|
+
)
|
|
4078
|
+
);
|
|
4079
|
+
}
|
|
4080
|
+
} else {
|
|
4081
|
+
addWriteScopeBuilder(
|
|
4082
|
+
section,
|
|
4083
|
+
(expr) => callRuntime("_subscribe", identifier, expr)
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4045
4086
|
}
|
|
4046
4087
|
}
|
|
4047
4088
|
});
|
|
@@ -4822,30 +4863,25 @@ function withPreviousLocation(newNode, originalNode) {
|
|
|
4822
4863
|
var TAG_NAME_IDENTIFIER_REG = /^[A-Z][a-zA-Z0-9_$]*$/;
|
|
4823
4864
|
var BINDING_CHANGE_HANDLER = /* @__PURE__ */ new WeakMap();
|
|
4824
4865
|
function preAnalyze2(program) {
|
|
4825
|
-
|
|
4826
|
-
normalizeBody(state, program.get("body"));
|
|
4827
|
-
if (state.crawl) {
|
|
4828
|
-
program.scope.crawl();
|
|
4829
|
-
}
|
|
4866
|
+
normalizeBody(program.get("body"));
|
|
4830
4867
|
}
|
|
4831
|
-
function normalizeBody(
|
|
4868
|
+
function normalizeBody(body) {
|
|
4832
4869
|
if (body?.length) {
|
|
4833
4870
|
for (const child of body) {
|
|
4834
4871
|
if (child.isMarkoTag()) {
|
|
4835
|
-
normalizeTag(
|
|
4872
|
+
normalizeTag(child);
|
|
4836
4873
|
}
|
|
4837
4874
|
}
|
|
4838
4875
|
}
|
|
4839
4876
|
}
|
|
4840
|
-
function normalizeTag(
|
|
4877
|
+
function normalizeTag(tag) {
|
|
4841
4878
|
const { node } = tag;
|
|
4842
4879
|
const { name: name2, attributes } = node;
|
|
4843
|
-
normalizeBody(
|
|
4844
|
-
normalizeBody(
|
|
4880
|
+
normalizeBody(tag.get("body").get("body"));
|
|
4881
|
+
normalizeBody(tag.get("attributeTags"));
|
|
4845
4882
|
if (node.var) {
|
|
4846
4883
|
const insertions = getAssignmentInsertions(node.var);
|
|
4847
4884
|
if (insertions) {
|
|
4848
|
-
state.crawl = true;
|
|
4849
4885
|
tag.insertAfter(insertions);
|
|
4850
4886
|
}
|
|
4851
4887
|
}
|
|
@@ -4855,14 +4891,12 @@ function normalizeTag(state, tag) {
|
|
|
4855
4891
|
insertions = getAssignmentInsertions(param, insertions);
|
|
4856
4892
|
}
|
|
4857
4893
|
if (insertions) {
|
|
4858
|
-
state.crawl = true;
|
|
4859
4894
|
node.body.body = [...insertions, ...node.body.body];
|
|
4860
4895
|
}
|
|
4861
4896
|
}
|
|
4862
4897
|
if (name2.type === "StringLiteral") {
|
|
4863
4898
|
const tagName = name2.value;
|
|
4864
4899
|
if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
|
|
4865
|
-
state.crawl = true;
|
|
4866
4900
|
node.name = withPreviousLocation(import_compiler26.types.identifier(tagName), name2);
|
|
4867
4901
|
} else {
|
|
4868
4902
|
switch (tagName) {
|
|
@@ -4875,7 +4909,6 @@ function normalizeTag(state, tag) {
|
|
|
4875
4909
|
for (let i = 0; i < attributes.length; i++) {
|
|
4876
4910
|
const attr = attributes[i];
|
|
4877
4911
|
if (import_compiler26.types.isMarkoAttribute(attr) && attr.bound) {
|
|
4878
|
-
state.crawl = true;
|
|
4879
4912
|
attr.bound = false;
|
|
4880
4913
|
attributes.splice(++i, 0, getChangeHandler(tag, attr));
|
|
4881
4914
|
}
|
|
@@ -4937,7 +4970,6 @@ function getChangeHandler(tag, attr) {
|
|
|
4937
4970
|
} else {
|
|
4938
4971
|
markoRoot.unshiftContainer("body", changeHandlerConst);
|
|
4939
4972
|
}
|
|
4940
|
-
markoRoot.scope.crawl();
|
|
4941
4973
|
return import_compiler26.types.markoAttribute(
|
|
4942
4974
|
changeAttrName,
|
|
4943
4975
|
withPreviousLocation(import_compiler26.types.identifier(changeHandlerId), attr.value)
|
|
@@ -11121,6 +11153,9 @@ var try_default = {
|
|
|
11121
11153
|
}
|
|
11122
11154
|
const tagBody = tag.get("body");
|
|
11123
11155
|
const bodySection = getSectionForBody(tagBody);
|
|
11156
|
+
if (tag.node.extra?.attributeTags?.["@placeholder"]) {
|
|
11157
|
+
setTryHasPlaceholder(bodySection, true);
|
|
11158
|
+
}
|
|
11124
11159
|
setSectionParentIsOwner(bodySection, true);
|
|
11125
11160
|
flushBefore(tag);
|
|
11126
11161
|
},
|
|
@@ -11160,6 +11195,9 @@ var try_default = {
|
|
|
11160
11195
|
enter(tag) {
|
|
11161
11196
|
const tagBody = tag.get("body");
|
|
11162
11197
|
const bodySection = getSectionForBody(tagBody);
|
|
11198
|
+
if (tag.node.extra?.attributeTags?.["@placeholder"]) {
|
|
11199
|
+
setTryHasPlaceholder(bodySection, true);
|
|
11200
|
+
}
|
|
11163
11201
|
setSectionParentIsOwner(bodySection, true);
|
|
11164
11202
|
visit(tag, 37 /* Replace */);
|
|
11165
11203
|
enterShallow(tag);
|
|
@@ -11606,6 +11644,7 @@ var referenced_identifier_default = {
|
|
|
11606
11644
|
};
|
|
11607
11645
|
|
|
11608
11646
|
// src/translator/visitors/scriptlet.ts
|
|
11647
|
+
var import_compiler59 = require("@marko/compiler");
|
|
11609
11648
|
var import_babel_utils47 = require("@marko/compiler/babel-utils");
|
|
11610
11649
|
var scriptlet_default = {
|
|
11611
11650
|
analyze(scriptlet) {
|
|
@@ -11628,7 +11667,21 @@ var scriptlet_default = {
|
|
|
11628
11667
|
const { node } = scriptlet;
|
|
11629
11668
|
const isHTML = isOutputHTML();
|
|
11630
11669
|
if (node.target && node.target !== (isHTML ? "server" : "client")) {
|
|
11631
|
-
scriptlet.
|
|
11670
|
+
const ids = Object.keys(scriptlet.getOuterBindingIdentifiers());
|
|
11671
|
+
const decl = ids.length && import_compiler59.types.variableDeclaration(
|
|
11672
|
+
"var",
|
|
11673
|
+
ids.map((key) => import_compiler59.types.variableDeclarator(import_compiler59.types.identifier(key)))
|
|
11674
|
+
);
|
|
11675
|
+
if (decl) {
|
|
11676
|
+
if (isHTML) {
|
|
11677
|
+
scriptlet.node.target = null;
|
|
11678
|
+
scriptlet.node.body = [decl];
|
|
11679
|
+
} else {
|
|
11680
|
+
scriptlet.replaceWith(decl);
|
|
11681
|
+
}
|
|
11682
|
+
} else {
|
|
11683
|
+
scriptlet.remove();
|
|
11684
|
+
}
|
|
11632
11685
|
return;
|
|
11633
11686
|
}
|
|
11634
11687
|
if (isHTML) {
|
|
@@ -11641,11 +11694,11 @@ var scriptlet_default = {
|
|
|
11641
11694
|
};
|
|
11642
11695
|
|
|
11643
11696
|
// src/translator/visitors/tag/index.ts
|
|
11644
|
-
var
|
|
11697
|
+
var import_compiler63 = require("@marko/compiler");
|
|
11645
11698
|
var import_babel_utils51 = require("@marko/compiler/babel-utils");
|
|
11646
11699
|
|
|
11647
11700
|
// src/translator/visitors/tag/attribute-tag.ts
|
|
11648
|
-
var
|
|
11701
|
+
var import_compiler60 = require("@marko/compiler");
|
|
11649
11702
|
var import_babel_utils48 = require("@marko/compiler/babel-utils");
|
|
11650
11703
|
var attribute_tag_default = {
|
|
11651
11704
|
analyze: {
|
|
@@ -11678,7 +11731,7 @@ var attribute_tag_default = {
|
|
|
11678
11731
|
};
|
|
11679
11732
|
|
|
11680
11733
|
// src/translator/visitors/tag/custom-tag.ts
|
|
11681
|
-
var
|
|
11734
|
+
var import_compiler61 = require("@marko/compiler");
|
|
11682
11735
|
var import_babel_utils49 = require("@marko/compiler/babel-utils");
|
|
11683
11736
|
var import_path4 = __toESM(require("path"));
|
|
11684
11737
|
var custom_tag_default = {
|
|
@@ -11732,9 +11785,9 @@ function translateHTML(tag) {
|
|
|
11732
11785
|
const childProgram = (0, import_babel_utils49.loadFileForTag)(tag).ast.program;
|
|
11733
11786
|
const childExtra = childProgram.extra;
|
|
11734
11787
|
let tagIdentifier;
|
|
11735
|
-
if (
|
|
11788
|
+
if (import_compiler61.types.isStringLiteral(node.name)) {
|
|
11736
11789
|
const relativePath = getTagRelativePath(tag);
|
|
11737
|
-
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ?
|
|
11790
|
+
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler61.types.identifier(getTemplateContentName()) : (0, import_babel_utils49.importDefault)(tag.hub.file, relativePath, getTagName(tag));
|
|
11738
11791
|
} else {
|
|
11739
11792
|
tagIdentifier = node.name;
|
|
11740
11793
|
}
|
|
@@ -11755,7 +11808,7 @@ function translateDOM(tag) {
|
|
|
11755
11808
|
const childExtra = childFile.ast.program.extra;
|
|
11756
11809
|
const childExports = childExtra.domExports;
|
|
11757
11810
|
const childSection = childExtra.section;
|
|
11758
|
-
const tagName =
|
|
11811
|
+
const tagName = import_compiler61.types.isIdentifier(node.name) ? node.name.name : import_compiler61.types.isStringLiteral(node.name) ? node.name.value : "tag";
|
|
11759
11812
|
if (programSection === childSection) {
|
|
11760
11813
|
knownTagTranslateDOM(
|
|
11761
11814
|
tag,
|
|
@@ -11766,16 +11819,16 @@ function translateDOM(tag) {
|
|
|
11766
11819
|
"render",
|
|
11767
11820
|
section,
|
|
11768
11821
|
void 0,
|
|
11769
|
-
|
|
11770
|
-
|
|
11822
|
+
import_compiler61.types.expressionStatement(
|
|
11823
|
+
import_compiler61.types.callExpression(import_compiler61.types.identifier(childExports.setup), [
|
|
11771
11824
|
createScopeReadExpression(childBinding, section)
|
|
11772
11825
|
])
|
|
11773
11826
|
)
|
|
11774
11827
|
);
|
|
11775
11828
|
}
|
|
11776
11829
|
);
|
|
11777
|
-
write`${
|
|
11778
|
-
injectWalks(tag, tagName,
|
|
11830
|
+
write`${import_compiler61.types.identifier(childExports.template)}`;
|
|
11831
|
+
injectWalks(tag, tagName, import_compiler61.types.identifier(childExports.walks));
|
|
11779
11832
|
} else {
|
|
11780
11833
|
knownTagTranslateDOM(
|
|
11781
11834
|
tag,
|
|
@@ -11791,8 +11844,8 @@ function translateDOM(tag) {
|
|
|
11791
11844
|
"render",
|
|
11792
11845
|
section,
|
|
11793
11846
|
void 0,
|
|
11794
|
-
|
|
11795
|
-
|
|
11847
|
+
import_compiler61.types.expressionStatement(
|
|
11848
|
+
import_compiler61.types.callExpression(
|
|
11796
11849
|
importOrSelfReferenceName(
|
|
11797
11850
|
file,
|
|
11798
11851
|
relativePath,
|
|
@@ -11820,7 +11873,7 @@ function getTagRelativePath(tag) {
|
|
|
11820
11873
|
hub: { file }
|
|
11821
11874
|
} = tag;
|
|
11822
11875
|
let relativePath;
|
|
11823
|
-
if (
|
|
11876
|
+
if (import_compiler61.types.isStringLiteral(node.name)) {
|
|
11824
11877
|
const template = (0, import_babel_utils49.getTagTemplate)(tag);
|
|
11825
11878
|
relativePath = template && (0, import_babel_utils49.resolveRelativePath)(file, template);
|
|
11826
11879
|
} else if (node.extra?.tagNameImported) {
|
|
@@ -11841,7 +11894,7 @@ function getTagRelativePath(tag) {
|
|
|
11841
11894
|
}
|
|
11842
11895
|
function importOrSelfReferenceName(file, request, name2, nameHint) {
|
|
11843
11896
|
if (isCircularRequest(file, request)) {
|
|
11844
|
-
return
|
|
11897
|
+
return import_compiler61.types.identifier(name2);
|
|
11845
11898
|
}
|
|
11846
11899
|
return (0, import_babel_utils49.importNamed)(file, request, name2, nameHint);
|
|
11847
11900
|
}
|
|
@@ -11851,7 +11904,7 @@ function isCircularRequest(file, request) {
|
|
|
11851
11904
|
}
|
|
11852
11905
|
|
|
11853
11906
|
// src/translator/visitors/tag/dynamic-tag.ts
|
|
11854
|
-
var
|
|
11907
|
+
var import_compiler62 = require("@marko/compiler");
|
|
11855
11908
|
var import_babel_utils50 = require("@marko/compiler/babel-utils");
|
|
11856
11909
|
var kDOMBinding3 = Symbol("dynamic tag dom binding");
|
|
11857
11910
|
var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
|
|
@@ -11884,7 +11937,7 @@ var dynamic_tag_default = {
|
|
|
11884
11937
|
tagSection
|
|
11885
11938
|
);
|
|
11886
11939
|
if (hasVar || tag.node.attributes.some(
|
|
11887
|
-
(attr) =>
|
|
11940
|
+
(attr) => import_compiler62.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
|
|
11888
11941
|
)) {
|
|
11889
11942
|
(0, import_babel_utils50.getProgram)().node.extra.isInteractive = true;
|
|
11890
11943
|
}
|
|
@@ -11924,7 +11977,7 @@ var dynamic_tag_default = {
|
|
|
11924
11977
|
if (isOutputHTML()) {
|
|
11925
11978
|
knownTagTranslateHTML(
|
|
11926
11979
|
tag,
|
|
11927
|
-
|
|
11980
|
+
import_compiler62.types.memberExpression(tag.node.name, import_compiler62.types.identifier("content")),
|
|
11928
11981
|
definedBodySection,
|
|
11929
11982
|
propTree
|
|
11930
11983
|
);
|
|
@@ -11941,9 +11994,9 @@ var dynamic_tag_default = {
|
|
|
11941
11994
|
"render",
|
|
11942
11995
|
section,
|
|
11943
11996
|
void 0,
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11997
|
+
import_compiler62.types.expressionStatement(
|
|
11998
|
+
import_compiler62.types.callExpression(
|
|
11999
|
+
import_compiler62.types.memberExpression(signal.identifier, import_compiler62.types.identifier("_")),
|
|
11947
12000
|
[
|
|
11948
12001
|
createScopeReadExpression(childBinding, section),
|
|
11949
12002
|
getScopeExpression(section, definedBodySection.parent)
|
|
@@ -11968,7 +12021,7 @@ var dynamic_tag_default = {
|
|
|
11968
12021
|
const nodeBinding = tagExtra[kDOMBinding3];
|
|
11969
12022
|
const isClassAPI = tagExtra.featureType === "class";
|
|
11970
12023
|
let tagExpression = node.name;
|
|
11971
|
-
if (
|
|
12024
|
+
if (import_compiler62.types.isStringLiteral(tagExpression)) {
|
|
11972
12025
|
tagExpression = (0, import_babel_utils50.importDefault)(
|
|
11973
12026
|
tag.hub.file,
|
|
11974
12027
|
getTagRelativePath(tag),
|
|
@@ -11978,14 +12031,14 @@ var dynamic_tag_default = {
|
|
|
11978
12031
|
if (isClassAPI) {
|
|
11979
12032
|
if (isOutputHTML()) {
|
|
11980
12033
|
(0, import_babel_utils50.getProgram)().node.body.push(
|
|
11981
|
-
|
|
12034
|
+
import_compiler62.types.markoScriptlet(
|
|
11982
12035
|
[
|
|
11983
|
-
|
|
11984
|
-
|
|
12036
|
+
import_compiler62.types.expressionStatement(
|
|
12037
|
+
import_compiler62.types.callExpression(
|
|
11985
12038
|
(0, import_babel_utils50.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
|
|
11986
12039
|
[
|
|
11987
|
-
|
|
11988
|
-
|
|
12040
|
+
import_compiler62.types.identifier(tagExpression.name),
|
|
12041
|
+
import_compiler62.types.stringLiteral((0, import_babel_utils50.loadFileForTag)(tag).metadata.marko.id)
|
|
11989
12042
|
]
|
|
11990
12043
|
)
|
|
11991
12044
|
)
|
|
@@ -11995,11 +12048,11 @@ var dynamic_tag_default = {
|
|
|
11995
12048
|
);
|
|
11996
12049
|
} else {
|
|
11997
12050
|
(0, import_babel_utils50.getProgram)().node.body.push(
|
|
11998
|
-
|
|
12051
|
+
import_compiler62.types.expressionStatement(
|
|
11999
12052
|
callRuntime(
|
|
12000
12053
|
"_resume",
|
|
12001
|
-
|
|
12002
|
-
|
|
12054
|
+
import_compiler62.types.stringLiteral((0, import_babel_utils50.loadFileForTag)(tag).metadata.marko.id),
|
|
12055
|
+
import_compiler62.types.identifier(tagExpression.name)
|
|
12003
12056
|
)
|
|
12004
12057
|
)
|
|
12005
12058
|
);
|
|
@@ -12042,9 +12095,9 @@ var dynamic_tag_default = {
|
|
|
12042
12095
|
getScopeIdIdentifier(tagSection),
|
|
12043
12096
|
getScopeAccessorLiteral(nodeBinding),
|
|
12044
12097
|
tagExpression,
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12098
|
+
import_compiler62.types.arrayExpression(args),
|
|
12099
|
+
import_compiler62.types.numericLiteral(0),
|
|
12100
|
+
import_compiler62.types.numericLiteral(1),
|
|
12048
12101
|
serializeArg
|
|
12049
12102
|
) : callRuntime(
|
|
12050
12103
|
"_dynamic_tag",
|
|
@@ -12052,8 +12105,8 @@ var dynamic_tag_default = {
|
|
|
12052
12105
|
getScopeAccessorLiteral(nodeBinding),
|
|
12053
12106
|
tagExpression,
|
|
12054
12107
|
args[0],
|
|
12055
|
-
args[1] || (serializeArg ?
|
|
12056
|
-
serializeArg ?
|
|
12108
|
+
args[1] || (serializeArg ? import_compiler62.types.numericLiteral(0) : void 0),
|
|
12109
|
+
serializeArg ? import_compiler62.types.numericLiteral(0) : void 0,
|
|
12057
12110
|
serializeArg
|
|
12058
12111
|
);
|
|
12059
12112
|
if (node.var) {
|
|
@@ -12061,18 +12114,18 @@ var dynamic_tag_default = {
|
|
|
12061
12114
|
tag.get("name").toString() + "_scope"
|
|
12062
12115
|
);
|
|
12063
12116
|
statements.push(
|
|
12064
|
-
|
|
12065
|
-
|
|
12117
|
+
import_compiler62.types.variableDeclaration("const", [
|
|
12118
|
+
import_compiler62.types.variableDeclarator(
|
|
12066
12119
|
dynamicScopeIdentifier,
|
|
12067
12120
|
callRuntime("_peek_scope_id")
|
|
12068
12121
|
)
|
|
12069
12122
|
])
|
|
12070
12123
|
);
|
|
12071
12124
|
statements.push(
|
|
12072
|
-
|
|
12073
|
-
|
|
12125
|
+
import_compiler62.types.variableDeclaration("let", [
|
|
12126
|
+
import_compiler62.types.variableDeclarator(node.var, dynamicTagExpr)
|
|
12074
12127
|
]),
|
|
12075
|
-
|
|
12128
|
+
import_compiler62.types.expressionStatement(
|
|
12076
12129
|
callRuntime(
|
|
12077
12130
|
"_var",
|
|
12078
12131
|
getScopeIdIdentifier(tagSection),
|
|
@@ -12080,7 +12133,7 @@ var dynamic_tag_default = {
|
|
|
12080
12133
|
tag.node.extra[kChildOffsetScopeBinding2]
|
|
12081
12134
|
),
|
|
12082
12135
|
dynamicScopeIdentifier,
|
|
12083
|
-
|
|
12136
|
+
import_compiler62.types.stringLiteral(
|
|
12084
12137
|
getResumeRegisterId(
|
|
12085
12138
|
tagSection,
|
|
12086
12139
|
node.var.extra?.binding,
|
|
@@ -12092,7 +12145,7 @@ var dynamic_tag_default = {
|
|
|
12092
12145
|
)
|
|
12093
12146
|
);
|
|
12094
12147
|
} else {
|
|
12095
|
-
statements.push(
|
|
12148
|
+
statements.push(import_compiler62.types.expressionStatement(dynamicTagExpr));
|
|
12096
12149
|
}
|
|
12097
12150
|
for (const replacement of tag.replaceWithMultiple(statements)) {
|
|
12098
12151
|
replacement.skip();
|
|
@@ -12111,9 +12164,9 @@ var dynamic_tag_default = {
|
|
|
12111
12164
|
tagVarSignal.register = true;
|
|
12112
12165
|
tagVarSignal.buildAssignment = (valueSection, value) => {
|
|
12113
12166
|
const changeArgs = [
|
|
12114
|
-
|
|
12167
|
+
import_compiler62.types.memberExpression(
|
|
12115
12168
|
getScopeExpression(tagVarSignal.section, valueSection),
|
|
12116
|
-
|
|
12169
|
+
import_compiler62.types.stringLiteral(
|
|
12117
12170
|
getAccessorPrefix().BranchScopes + getScopeAccessor(nodeBinding)
|
|
12118
12171
|
),
|
|
12119
12172
|
true
|
|
@@ -12121,28 +12174,28 @@ var dynamic_tag_default = {
|
|
|
12121
12174
|
value
|
|
12122
12175
|
];
|
|
12123
12176
|
if (!isOptimize()) {
|
|
12124
|
-
changeArgs.push(
|
|
12177
|
+
changeArgs.push(import_compiler62.types.stringLiteral(varBinding.name));
|
|
12125
12178
|
}
|
|
12126
|
-
return
|
|
12179
|
+
return import_compiler62.types.callExpression(importRuntime("_var_change"), changeArgs);
|
|
12127
12180
|
};
|
|
12128
12181
|
}
|
|
12129
12182
|
signal.build = () => {
|
|
12130
12183
|
return callRuntime(
|
|
12131
12184
|
"_dynamic_tag",
|
|
12132
12185
|
getScopeAccessorLiteral(nodeBinding, true),
|
|
12133
|
-
bodySection &&
|
|
12134
|
-
tagVarSignal ?
|
|
12135
|
-
hasTagArgs &&
|
|
12186
|
+
bodySection && import_compiler62.types.identifier(bodySection.name),
|
|
12187
|
+
tagVarSignal ? import_compiler62.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
|
|
12188
|
+
hasTagArgs && import_compiler62.types.numericLiteral(1)
|
|
12136
12189
|
);
|
|
12137
12190
|
};
|
|
12138
12191
|
if (args.length) {
|
|
12139
|
-
const argsOrInput = hasTagArgs ?
|
|
12140
|
-
if (!
|
|
12192
|
+
const argsOrInput = hasTagArgs ? import_compiler62.types.arrayExpression(args) : args[0];
|
|
12193
|
+
if (!import_compiler62.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) {
|
|
12141
12194
|
signal.extraArgs = [
|
|
12142
|
-
|
|
12195
|
+
import_compiler62.types.arrowFunctionExpression(
|
|
12143
12196
|
[],
|
|
12144
|
-
statements.length ?
|
|
12145
|
-
statements.concat(
|
|
12197
|
+
statements.length ? import_compiler62.types.blockStatement(
|
|
12198
|
+
statements.concat(import_compiler62.types.returnStatement(argsOrInput))
|
|
12146
12199
|
) : argsOrInput
|
|
12147
12200
|
)
|
|
12148
12201
|
];
|
|
@@ -12162,7 +12215,7 @@ function enableDynamicTagResume(tag) {
|
|
|
12162
12215
|
if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
|
|
12163
12216
|
importedDynamicTagResume.add(program);
|
|
12164
12217
|
program.body.push(
|
|
12165
|
-
|
|
12218
|
+
import_compiler62.types.expressionStatement(callRuntime("_resume_dynamic_tag"))
|
|
12166
12219
|
);
|
|
12167
12220
|
return;
|
|
12168
12221
|
}
|
|
@@ -12273,7 +12326,7 @@ var tag_default = {
|
|
|
12273
12326
|
};
|
|
12274
12327
|
|
|
12275
12328
|
// src/translator/visitors/text.ts
|
|
12276
|
-
var
|
|
12329
|
+
var import_compiler64 = require("@marko/compiler");
|
|
12277
12330
|
var text_default = {
|
|
12278
12331
|
translate: {
|
|
12279
12332
|
exit(text) {
|
|
@@ -21,6 +21,7 @@ export declare function forEach<T>(data: Opt<T>, cb: (item: T, index: number) =>
|
|
|
21
21
|
export declare function fromIter<T>(data: Iterable<T>): T | Many<T> | undefined;
|
|
22
22
|
export declare function toIter<T>(data: Opt<T>): Iterable<T>;
|
|
23
23
|
export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): Opt<T>;
|
|
24
|
+
export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
|
|
24
25
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
|
25
26
|
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
|
26
27
|
export declare function filterMap<T, R>(data: Opt<T>, cb: (item: T) => undefined | R): Opt<R>;
|
|
@@ -26,6 +26,7 @@ export type Signal = {
|
|
|
26
26
|
};
|
|
27
27
|
type closureSignalBuilder = (closure: Binding, render: t.Expression) => t.Expression;
|
|
28
28
|
export declare function setClosureSignalBuilder(tag: t.NodePath<t.MarkoTag>, builder: closureSignalBuilder): void;
|
|
29
|
+
export declare const getTryHasPlaceholder: (section: Section) => true | undefined, setTryHasPlaceholder: (section: Section, value: true | undefined) => void;
|
|
29
30
|
export declare function setSectionSerializedValue(section: Section, prop: AccessorProp, expression: t.Expression): void;
|
|
30
31
|
export declare function setBindingSerializedValue(section: Section, binding: Binding, expression: t.Expression, prefix?: AccessorPrefix): void;
|
|
31
32
|
export declare function setSerializedValue(section: Section, key: string, expression: t.Expression): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.121",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"build": "node -r ~ts ./scripts/bundle.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@marko/compiler": "^5.39.
|
|
51
|
+
"@marko/compiler": "^5.39.44",
|
|
52
52
|
"csstype": "^3.1.3",
|
|
53
53
|
"magic-string": "^0.30.17"
|
|
54
54
|
},
|