marko 6.3.25 → 6.3.27
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/debug/dom.js +305 -297
- package/dist/debug/dom.mjs +305 -297
- package/dist/debug/html.js +14 -13
- package/dist/debug/html.mjs +14 -13
- package/dist/dom.js +211 -212
- package/dist/dom.mjs +211 -212
- package/dist/html.js +9 -11
- package/dist/html.mjs +9 -11
- package/dist/translator/index.js +100 -40
- package/dist/translator/util/translate-attrs.d.ts +2 -0
- package/dist/translator/visitors/tag/native-tag.d.ts +3 -2
- package/package.json +4 -4
package/dist/translator/index.js
CHANGED
|
@@ -1906,7 +1906,8 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, seriali
|
|
|
1906
1906
|
return _textarea_value(value);
|
|
1907
1907
|
}
|
|
1908
1908
|
function _textarea_value(value) {
|
|
1909
|
-
|
|
1909
|
+
const escaped = _escape(normalizeStrAttrValue(value));
|
|
1910
|
+
return escaped[0] === "\n" || escaped[0] === "\r" ? "\n" + escaped : escaped;
|
|
1910
1911
|
}
|
|
1911
1912
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1912
1913
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
@@ -3484,7 +3485,14 @@ function replaceAssignedNode(node) {
|
|
|
3484
3485
|
switch (node.left.type) {
|
|
3485
3486
|
case "Identifier": {
|
|
3486
3487
|
const { extra } = node.left;
|
|
3487
|
-
|
|
3488
|
+
if (isAssignedBindingExtra(extra)) {
|
|
3489
|
+
const { operator } = node;
|
|
3490
|
+
const shortCircuits = operator === "||=" || operator === "&&=" || operator === "??=";
|
|
3491
|
+
const readAssigned = () => createScopeReadExpression(extra.assignment, extra.section);
|
|
3492
|
+
const builtAssignment = getBuildAssignment(extra)?.(extra.section, operator === "=" || shortCircuits ? node.right : _marko_compiler.types.binaryExpression(operator.slice(0, -1), readAssigned(), node.right));
|
|
3493
|
+
if (builtAssignment) return shortCircuits ? _marko_compiler.types.logicalExpression(operator.slice(0, -1), readAssigned(), builtAssignment) : builtAssignment;
|
|
3494
|
+
}
|
|
3495
|
+
return extra?.assignment && withLeadingComment(node.right, getDebugName(extra.assignment));
|
|
3488
3496
|
}
|
|
3489
3497
|
case "ArrayPattern":
|
|
3490
3498
|
case "ObjectPattern": {
|
|
@@ -4175,13 +4183,11 @@ function getBaseArgsInForTag(type, attrs) {
|
|
|
4175
4183
|
}
|
|
4176
4184
|
//#endregion
|
|
4177
4185
|
//#region src/translator/util/nested-attribute-tags.ts
|
|
4178
|
-
const
|
|
4186
|
+
const [getAttrTagIdentifiers] = createProgramState(() => /* @__PURE__ */ new WeakMap());
|
|
4179
4187
|
function getAttrTagIdentifier(meta) {
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
attrTagToIdentifierLookup.set(meta, name);
|
|
4184
|
-
}
|
|
4188
|
+
const identifiers = getAttrTagIdentifiers();
|
|
4189
|
+
let name = identifiers.get(meta);
|
|
4190
|
+
if (!name) identifiers.set(meta, name = generateUid(meta.name));
|
|
4185
4191
|
return _marko_compiler.types.identifier(name);
|
|
4186
4192
|
}
|
|
4187
4193
|
function getAttrTagPaths(tag) {
|
|
@@ -4298,8 +4304,8 @@ function translateAttrs(tag, propTree = true, skip, statements = [], contentKey
|
|
|
4298
4304
|
else {
|
|
4299
4305
|
const translatedAttrTag = translateAttrs(child, getKnownFromPropTree(propTree, attrTagMeta.name), void 0, statements, contentKey);
|
|
4300
4306
|
const prevProp = attrTagMeta.repeated ? findObjectProperty(attrTagMeta.name, contentProperties) : void 0;
|
|
4301
|
-
if (prevProp) prevProp.value = callRuntime("attrTags", prevProp.value,
|
|
4302
|
-
else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag",
|
|
4307
|
+
if (prevProp) prevProp.value = callRuntime("attrTags", prevProp.value, _marko_compiler.types.objectExpression(translatedAttrTag.properties));
|
|
4308
|
+
else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", _marko_compiler.types.objectExpression(translatedAttrTag.properties))));
|
|
4303
4309
|
}
|
|
4304
4310
|
} else i = addDynamicAttrTagStatements(attrTags, i, attrTagLookup, statements, propTree, contentKey);
|
|
4305
4311
|
}
|
|
@@ -4339,8 +4345,8 @@ function addDynamicAttrTagStatements(attrTags, index, attrTagLookup, statements,
|
|
|
4339
4345
|
const attrTagExport = getKnownFromPropTree(propTree, attrTagMeta.name);
|
|
4340
4346
|
if (attrTagExport && attrTagMeta.dynamic) {
|
|
4341
4347
|
const translatedAttrTag = translateAttrs(tag, attrTagExport, void 0, statements, contentKey);
|
|
4342
|
-
if (attrTagMeta.repeated) statements.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("=", getAttrTagIdentifier(attrTagMeta), callRuntime("attrTags", getAttrTagIdentifier(attrTagMeta),
|
|
4343
|
-
else statements.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("=", getAttrTagIdentifier(attrTagMeta), callRuntime("attrTag",
|
|
4348
|
+
if (attrTagMeta.repeated) statements.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("=", getAttrTagIdentifier(attrTagMeta), callRuntime("attrTags", getAttrTagIdentifier(attrTagMeta), _marko_compiler.types.objectExpression(translatedAttrTag.properties)))));
|
|
4349
|
+
else statements.push(_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("=", getAttrTagIdentifier(attrTagMeta), callRuntime("attrTag", _marko_compiler.types.objectExpression(translatedAttrTag.properties)))));
|
|
4344
4350
|
}
|
|
4345
4351
|
} else switch (getTagName(tag)) {
|
|
4346
4352
|
case "if": return translateIfAttrTag(attrTags, index, attrTagLookup, statements, propTree, contentKey);
|
|
@@ -4348,6 +4354,8 @@ function addDynamicAttrTagStatements(attrTags, index, attrTagLookup, statements,
|
|
|
4348
4354
|
}
|
|
4349
4355
|
return index;
|
|
4350
4356
|
}
|
|
4357
|
+
/** Unwraps a lone spread to the spread argument itself, so the result may alias
|
|
4358
|
+
* a caller binding; anything the runtime writes to needs its own object. */
|
|
4351
4359
|
function propsToExpression(props) {
|
|
4352
4360
|
return props.length === 1 && _marko_compiler.types.isSpreadElement(props[0]) ? props[0].argument : _marko_compiler.types.objectExpression(props);
|
|
4353
4361
|
}
|
|
@@ -4501,6 +4509,10 @@ var native_tag_default = {
|
|
|
4501
4509
|
assertExclusiveAttrs(seen, (msg) => {
|
|
4502
4510
|
throw tag.get("name").buildCodeFrameError(msg);
|
|
4503
4511
|
});
|
|
4512
|
+
if (seen.content) {
|
|
4513
|
+
if ((0, _marko_compiler_babel_utils.getTagDef)(tag)?.parseOptions?.openTagOnly) throw tag.hub.buildError(seen.content, `The \`<${tagName}>\` tag cannot have content, so it does not support the \`content\` attribute.`);
|
|
4514
|
+
if (isTextOnly) throw tag.hub.buildError(seen.content, `The \`<${tagName}>\` tag takes its content from its body as text, so it does not support the \`content\` attribute.`);
|
|
4515
|
+
}
|
|
4504
4516
|
let textPlaceholders;
|
|
4505
4517
|
if (isTextOnly) {
|
|
4506
4518
|
for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoPlaceholder(child)) (textPlaceholders ||= []).push(child.value);
|
|
@@ -4562,10 +4574,11 @@ var native_tag_default = {
|
|
|
4562
4574
|
const write = writeTo(tag);
|
|
4563
4575
|
const tagSection = getSection(tag);
|
|
4564
4576
|
const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
|
|
4565
|
-
write`<${tagName}`;
|
|
4566
4577
|
const usedAttrs = getUsedAttrs(tagName, tag.node);
|
|
4567
4578
|
const { staticAttrs, staticControllable, staticContentAttr, skipExpression, injectNonce } = usedAttrs;
|
|
4568
4579
|
let { spreadExpression } = usedAttrs;
|
|
4580
|
+
if (tagName === "select" && (staticControllable || spreadExpression)) flushBefore(tag);
|
|
4581
|
+
write`<${tagName}`;
|
|
4569
4582
|
if (injectNonce) write`${callRuntime("_attr_nonce")}`;
|
|
4570
4583
|
if (staticControllable) {
|
|
4571
4584
|
const hasChangeHandler = !!staticControllable.attrs[1];
|
|
@@ -4761,7 +4774,7 @@ var native_tag_default = {
|
|
|
4761
4774
|
const canHaveAttrContent = !(isTextOnly || isOpenOnly || hasChildren || staticContentAttr);
|
|
4762
4775
|
const name = tag.get("name");
|
|
4763
4776
|
const staticName = name.isStringLiteral() ? name.node.value : void 0;
|
|
4764
|
-
const controllable = controllableClaimFor(staticName);
|
|
4777
|
+
const controllable = !staticControllable && controllableClaimFor(staticName);
|
|
4765
4778
|
if (skipExpression) addStatement("render", tagSection, tagExtra.referencedBindings, _marko_compiler.types.expressionStatement(callRuntime(canHaveAttrContent ? "_attrs_partial_content" : "_attrs_partial", scopeIdentifier, visitAccessor, spreadExpression, skipExpression, controllable && importRuntime(controllable))));
|
|
4766
4779
|
else addStatement("render", tagSection, tagExtra.referencedBindings, _marko_compiler.types.expressionStatement(callRuntime(canHaveAttrContent ? "_attrs_content" : "_attrs", scopeIdentifier, visitAccessor, spreadExpression, controllable && importRuntime(controllable))));
|
|
4767
4780
|
enableControllable(controllableScriptLatchFor(staticName));
|
|
@@ -5174,8 +5187,9 @@ function isDynamicControllable(controllable) {
|
|
|
5174
5187
|
function buildUndefined$1() {
|
|
5175
5188
|
return _marko_compiler.types.unaryExpression("void", _marko_compiler.types.numericLiteral(0));
|
|
5176
5189
|
}
|
|
5177
|
-
/** How a
|
|
5178
|
-
* nothing
|
|
5190
|
+
/** How a spread claims its controlled attrs during render; nothing for the many
|
|
5191
|
+
* tags that control nothing, and nothing when a static attr owns the
|
|
5192
|
+
* controllable, since then the spread must leave the slots it wrote alone. */
|
|
5179
5193
|
function controllableClaimFor(tagName) {
|
|
5180
5194
|
switch (tagName) {
|
|
5181
5195
|
case "input": return "_controllable_input";
|
|
@@ -6298,6 +6312,7 @@ function applyAttrObject(tag, propTree, tagInputIdentifier, info) {
|
|
|
6298
6312
|
let translatedProps = propsToExpression(translatedAttrs.properties);
|
|
6299
6313
|
if (translatedAttrs.statements.length) addStatement("render", info.tagSection, referencedBindings, translatedAttrs.statements);
|
|
6300
6314
|
if ((0, _marko_compiler_babel_utils.isAttributeTag)(tag)) {
|
|
6315
|
+
translatedProps = _marko_compiler.types.objectExpression(translatedAttrs.properties);
|
|
6301
6316
|
const attrTagName = getTagName(tag);
|
|
6302
6317
|
const parentTag = tag.parentPath;
|
|
6303
6318
|
if (analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated) {
|
|
@@ -6313,7 +6328,8 @@ function applyAttrObject(tag, propTree, tagInputIdentifier, info) {
|
|
|
6313
6328
|
addStatement("render", info.tagSection, referencedBindings, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(tagInputIdentifier, [createScopeReadExpression(info.childScopeBinding, info.tagSection), translatedProps])), void 0, true);
|
|
6314
6329
|
}
|
|
6315
6330
|
function translateAttrTag(tag, attrTagMeta, info, statements) {
|
|
6316
|
-
|
|
6331
|
+
const translatedAttrs = translateAttrs(tag, true, void 0, statements);
|
|
6332
|
+
let translatedProps = _marko_compiler.types.objectExpression(translatedAttrs.properties);
|
|
6317
6333
|
const attrTagName = getTagName(tag);
|
|
6318
6334
|
const parentTag = tag.parentPath;
|
|
6319
6335
|
if (attrTagMeta.repeated) {
|
|
@@ -8022,17 +8038,17 @@ var define_default = {
|
|
|
8022
8038
|
let allDirectReferences = true;
|
|
8023
8039
|
for (const ref of babelBinding.referencePaths) if (ref.parent.type === "MarkoTag" && ref.parent.name === ref.node) hasDirectReferences = true;
|
|
8024
8040
|
else allDirectReferences = false;
|
|
8025
|
-
if (
|
|
8041
|
+
if (allDirectReferences) {
|
|
8026
8042
|
const bodySection = getSectionForBody(tag.get("body"));
|
|
8027
8043
|
if (bodySection) {
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
tag.remove();
|
|
8034
|
-
return;
|
|
8044
|
+
if (hasDirectReferences) {
|
|
8045
|
+
const signal = getSignal(bodySection, void 0);
|
|
8046
|
+
signal.build = () => {
|
|
8047
|
+
if (signalHasStatements(signal)) return callRuntime("_child_setup", getSignalFn(signal));
|
|
8048
|
+
};
|
|
8035
8049
|
}
|
|
8050
|
+
tag.remove();
|
|
8051
|
+
return;
|
|
8036
8052
|
}
|
|
8037
8053
|
}
|
|
8038
8054
|
}
|
|
@@ -8077,7 +8093,9 @@ var effect_default = {
|
|
|
8077
8093
|
var export_default = {
|
|
8078
8094
|
parse(tag) {
|
|
8079
8095
|
const { node } = tag;
|
|
8080
|
-
|
|
8096
|
+
const statements = (0, _marko_compiler_babel_utils.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end);
|
|
8097
|
+
if (statements.length > 1) throw tag.hub.buildError(statements[1], "The `<export>` tag takes a single export statement.");
|
|
8098
|
+
tag.replaceWith(statements[0]);
|
|
8081
8099
|
},
|
|
8082
8100
|
parseOptions: {
|
|
8083
8101
|
statement: true,
|
|
@@ -8242,7 +8260,9 @@ var id_default = {
|
|
|
8242
8260
|
var import_default = {
|
|
8243
8261
|
parse(tag) {
|
|
8244
8262
|
const { node } = tag;
|
|
8245
|
-
|
|
8263
|
+
const statements = (0, _marko_compiler_babel_utils.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end);
|
|
8264
|
+
if (statements.length > 1) throw tag.hub.buildError(statements[1], "The [`<import>` tag](https://markojs.com/docs/syntax/#importing-external-files) takes a single import statement.");
|
|
8265
|
+
tag.replaceWith(statements[0]);
|
|
8246
8266
|
},
|
|
8247
8267
|
parseOptions: {
|
|
8248
8268
|
statement: true,
|
|
@@ -9572,7 +9592,6 @@ function translateDOM(tag) {
|
|
|
9572
9592
|
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.variableDeclaration("let", [_marko_compiler.types.variableDeclarator(setupIdent, callRuntime("_load_setup", getScopeAccessorLiteral(node.extra[kLoadTagBinding], true), getScopeAccessorLiteral(childBinding, true), triggerIdent ? _marko_compiler.types.addComment(_marko_compiler.types.callExpression(triggerIdent, [setupLoadExpr]), "leading", "@__PURE__") : setupLoadExpr))]));
|
|
9573
9593
|
addStatement("render", section, void 0, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(setupIdent, [scopeIdentifier])));
|
|
9574
9594
|
});
|
|
9575
|
-
write`<!>`;
|
|
9576
9595
|
visit(tag, 37);
|
|
9577
9596
|
injectWalks(tag, tagName);
|
|
9578
9597
|
enterShallow(tag);
|
|
@@ -9685,12 +9704,13 @@ const kDOMBinding = Symbol("dynamic tag dom binding");
|
|
|
9685
9704
|
const kChildOffsetScopeBinding = Symbol("custom tag scope offset");
|
|
9686
9705
|
const importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
|
|
9687
9706
|
const [getCompatRegistrations] = createProgramState(() => /* @__PURE__ */ new Set());
|
|
9707
|
+
const [getCompatBoundaryCalls] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
9688
9708
|
function pushCompatRegistration(key, statement) {
|
|
9689
9709
|
const keys = getCompatRegistrations();
|
|
9690
|
-
if (
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9710
|
+
if (keys.has(key)) return false;
|
|
9711
|
+
keys.add(key);
|
|
9712
|
+
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(statement);
|
|
9713
|
+
return true;
|
|
9694
9714
|
}
|
|
9695
9715
|
var dynamic_tag_default = {
|
|
9696
9716
|
analyze: { enter(tag) {
|
|
@@ -9772,11 +9792,19 @@ var dynamic_tag_default = {
|
|
|
9772
9792
|
if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
9773
9793
|
if (classTagTemplate) {
|
|
9774
9794
|
const preserveBoundary = !tagsSerializeReason && (classHydration === "descendant" || classHydration === "self" && !!classFile?.metadata.marko.hasComponentBrowser);
|
|
9775
|
-
|
|
9776
|
-
|
|
9795
|
+
const classId = classFile.metadata.marko.id;
|
|
9796
|
+
const registration = isOutputHTML() ? _marko_compiler.types.callExpression((0, _marko_compiler_babel_utils.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"), [
|
|
9797
|
+
_marko_compiler.types.stringLiteral(classId),
|
|
9777
9798
|
_marko_compiler.types.identifier(tagExpression.name),
|
|
9778
9799
|
...preserveBoundary ? [_marko_compiler.types.stringLiteral("preserve")] : []
|
|
9779
|
-
])
|
|
9800
|
+
]) : void 0;
|
|
9801
|
+
if (isOutputHTML() ? serializeReason || classHydration : serializeReason) {
|
|
9802
|
+
if (pushCompatRegistration(classId, registration ? _marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(registration)], true) : _marko_compiler.types.expressionStatement(callRuntime("_resume", _marko_compiler.types.stringLiteral(classId), _marko_compiler.types.identifier(tagExpression.name)))) && registration) getCompatBoundaryCalls().set(classId, registration);
|
|
9803
|
+
}
|
|
9804
|
+
if (!preserveBoundary) {
|
|
9805
|
+
const emitted = getCompatBoundaryCalls().get(classId);
|
|
9806
|
+
if (emitted) emitted.arguments.length = 2;
|
|
9807
|
+
}
|
|
9780
9808
|
} else {
|
|
9781
9809
|
const rendererName = tagExpression.name;
|
|
9782
9810
|
pushCompatRegistration(rendererName, _marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("??=", _marko_compiler.types.memberExpression(_marko_compiler.types.identifier(rendererName), _marko_compiler.types.identifier("_")), _marko_compiler.types.identifier(rendererName)))], true));
|
|
@@ -9977,7 +10005,7 @@ var text_default = {
|
|
|
9977
10005
|
function buildAggregateError(file, rootMsg, ...paths) {
|
|
9978
10006
|
const err = /* @__PURE__ */ new SyntaxError();
|
|
9979
10007
|
const fileName = path.default.relative(_marko_compiler_modules.cwd, file.opts.filename);
|
|
9980
|
-
const finalMsg = `${rootMsg}:\n\n${paths.map(([msg, path$
|
|
10008
|
+
const finalMsg = `${rootMsg}:\n\n${paths.map(([msg, path$12]) => `\x1b[90m${msg} at ${getFileNameWithLoc(fileName, path$12)}:\x1b[0m\n${getFrame(file, path$12)}`).join("\n\n")}`;
|
|
9981
10009
|
if (!("MARKO_DEBUG" in process.env)) err.stack = finalMsg;
|
|
9982
10010
|
Object.defineProperty(err, "message", {
|
|
9983
10011
|
get() {
|
|
@@ -10094,9 +10122,11 @@ function getFeatureTypeFromCoreTagName(tagName) {
|
|
|
10094
10122
|
case "macro":
|
|
10095
10123
|
case "module-code":
|
|
10096
10124
|
case "while": return Class;
|
|
10125
|
+
case "attrs":
|
|
10097
10126
|
case "const":
|
|
10098
10127
|
case "debug":
|
|
10099
10128
|
case "define":
|
|
10129
|
+
case "effect":
|
|
10100
10130
|
case "id":
|
|
10101
10131
|
case "let":
|
|
10102
10132
|
case "lifecycle":
|
|
@@ -10249,11 +10279,15 @@ function mergeTagDef(def5, def6) {
|
|
|
10249
10279
|
}
|
|
10250
10280
|
function mergeObjects(a, b, cb) {
|
|
10251
10281
|
const merged = {};
|
|
10282
|
+
const assign = (key, aValue, bValue) => {
|
|
10283
|
+
const value = cb(key, aValue, bValue);
|
|
10284
|
+
if (value !== void 0) merged[key] = value;
|
|
10285
|
+
};
|
|
10252
10286
|
if (a) if (b) {
|
|
10253
|
-
for (const key in a)
|
|
10254
|
-
for (const key in b) if (!(key in a))
|
|
10255
|
-
} else for (const key in a)
|
|
10256
|
-
else if (b) for (const key in b)
|
|
10287
|
+
for (const key in a) assign(key, a[key], b[key]);
|
|
10288
|
+
for (const key in b) if (!(key in a)) assign(key, void 0, b[key]);
|
|
10289
|
+
} else for (const key in a) assign(key, a[key], void 0);
|
|
10290
|
+
else if (b) for (const key in b) assign(key, void 0, b[key]);
|
|
10257
10291
|
return merged;
|
|
10258
10292
|
}
|
|
10259
10293
|
function normalizeTagDef(tagDef) {
|
|
@@ -10279,8 +10313,34 @@ function normalizeVisitor(visitor) {
|
|
|
10279
10313
|
return visitor?.default ?? visitor;
|
|
10280
10314
|
}
|
|
10281
10315
|
function normalizeVisit(visitor) {
|
|
10316
|
+
if (Array.isArray(visitor)) {
|
|
10317
|
+
let merged;
|
|
10318
|
+
for (const entry of visitor) merged = sequenceVisit(merged, normalizeVisit(entry));
|
|
10319
|
+
return merged;
|
|
10320
|
+
}
|
|
10282
10321
|
return typeof visitor === "function" ? visitor : normalizeVisitor(visitor);
|
|
10283
10322
|
}
|
|
10323
|
+
function sequenceVisit(first, second) {
|
|
10324
|
+
if (!first || !second) return first || second;
|
|
10325
|
+
const enterFirst = getVisitorEnter(first);
|
|
10326
|
+
const enterSecond = getVisitorEnter(second);
|
|
10327
|
+
const enter = (enterFirst || enterSecond) && function enter(path$10, state) {
|
|
10328
|
+
const { node } = path$10;
|
|
10329
|
+
enterFirst?.call(this, path$10, state);
|
|
10330
|
+
if (path$10.node === node) enterSecond?.call(this, path$10, state);
|
|
10331
|
+
};
|
|
10332
|
+
const exitFirst = getVisitorExit(first);
|
|
10333
|
+
const exitSecond = getVisitorExit(second);
|
|
10334
|
+
const exit = (exitFirst || exitSecond) && function exit(path$11, state) {
|
|
10335
|
+
const { node } = path$11;
|
|
10336
|
+
exitFirst?.call(this, path$11, state);
|
|
10337
|
+
if (path$11.node === node) exitSecond?.call(this, path$11, state);
|
|
10338
|
+
};
|
|
10339
|
+
return exit ? enter ? {
|
|
10340
|
+
enter,
|
|
10341
|
+
exit
|
|
10342
|
+
} : { exit } : enter;
|
|
10343
|
+
}
|
|
10284
10344
|
function getVisitorEnter(visit) {
|
|
10285
10345
|
return typeof visit === "function" ? visit : visit?.enter;
|
|
10286
10346
|
}
|
|
@@ -10,5 +10,7 @@ export declare function getTranslatedBodyContentProperty(props: t.ObjectExpressi
|
|
|
10
10
|
value: t.Expression;
|
|
11
11
|
}) | undefined;
|
|
12
12
|
export declare function addDynamicAttrTagStatements(attrTags: t.NodePath<t.MarkoTag["attributeTags"][number]>[], index: number, attrTagLookup: AttrTagLookup, statements: t.Statement[], propTree: BindingPropTree | true, contentKey?: ContentKey): number;
|
|
13
|
+
/** Unwraps a lone spread to the spread argument itself, so the result may alias
|
|
14
|
+
* a caller binding; anything the runtime writes to needs its own object. */
|
|
13
15
|
export declare function propsToExpression(props: t.ObjectExpression["properties"]): t.Expression;
|
|
14
16
|
export {};
|
|
@@ -21,8 +21,9 @@ declare const _default: {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export default _default;
|
|
24
|
-
/** How a
|
|
25
|
-
* nothing
|
|
24
|
+
/** How a spread claims its controlled attrs during render; nothing for the many
|
|
25
|
+
* tags that control nothing, and nothing when a static attr owns the
|
|
26
|
+
* controllable, since then the spread must leave the slots it wrote alone. */
|
|
26
27
|
export declare function controllableClaimFor(tagName: string | undefined): "_controllable_input" | "_controllable_open" | "_controllable_select" | "_controllable_textarea" | undefined;
|
|
27
28
|
/** The resume-pass latch for a tag: `_attrs_script` resolves the control kind
|
|
28
29
|
* at run time, and a run-time tag name can be any of them. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.27",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@marko/compiler": "^5.41.
|
|
51
|
+
"@marko/compiler": "^5.41.11",
|
|
52
52
|
"csstype": "^3.2.3",
|
|
53
53
|
"fastest-levenshtein": "^1.0.16",
|
|
54
54
|
"magic-string": "^0.30.21"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"marko": "
|
|
58
|
-
"
|
|
57
|
+
"@marko/runtime-tags": "npm:marko@6.3.27",
|
|
58
|
+
"marko": "5.39.30"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|