marko 6.0.47 → 6.0.49
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 +14 -9
- package/dist/debug/dom.mjs +14 -9
- package/dist/debug/html.js +21 -10
- package/dist/debug/html.mjs +21 -10
- package/dist/dom.js +3 -3
- package/dist/dom.mjs +3 -3
- package/dist/html/compat.d.ts +3 -2
- package/dist/html.js +6 -9
- package/dist/html.mjs +6 -9
- package/dist/translator/index.js +46 -38
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/tags-html.d.ts +1451 -1488
package/dist/translator/index.js
CHANGED
@@ -1567,7 +1567,7 @@ function filterArguments(args) {
|
|
1567
1567
|
}
|
1568
1568
|
function getCompatRuntimeFile() {
|
1569
1569
|
const markoOpts = getMarkoOpts();
|
1570
|
-
return `marko
|
1570
|
+
return `marko/${markoOpts.optimize ? "dist" : "src"}/runtime/helpers/tags-compat/${isOutputHTML() ? "html" : "dom"}${markoOpts.optimize ? "" : "-debug"}.${markoOpts.modules === "esm" ? "mjs" : "js"}`;
|
1571
1571
|
}
|
1572
1572
|
|
1573
1573
|
// src/translator/util/sections.ts
|
@@ -6804,7 +6804,7 @@ function getUsedAttrs(tagName, tag) {
|
|
6804
6804
|
seen[attr2.name] = attr2;
|
6805
6805
|
if (spreadProps) {
|
6806
6806
|
spreadProps.push(toObjectProperty(attr2.name, attr2.value));
|
6807
|
-
} else if (attr2.name === "content") {
|
6807
|
+
} else if (attr2.name === "content" && tagName !== "meta") {
|
6808
6808
|
staticContentAttr = attr2;
|
6809
6809
|
} else {
|
6810
6810
|
maybeStaticAttrs.add(attr2);
|
@@ -10000,6 +10000,7 @@ var function_default = {
|
|
10000
10000
|
filename,
|
10001
10001
|
`${section.id}/${name2.slice(1)}`
|
10002
10002
|
);
|
10003
|
+
(0, import_babel_utils44.getProgram)().node.extra.isInteractive = true;
|
10003
10004
|
}
|
10004
10005
|
};
|
10005
10006
|
function isMarkoAttribute(path5) {
|
@@ -10323,6 +10324,7 @@ var referenced_identifier_default = {
|
|
10323
10324
|
};
|
10324
10325
|
|
10325
10326
|
// src/translator/visitors/scriptlet.ts
|
10327
|
+
var import_babel_utils46 = require("@marko/compiler/babel-utils");
|
10326
10328
|
var scriptlet_default = {
|
10327
10329
|
analyze(scriptlet) {
|
10328
10330
|
if (!scriptlet.node.static) {
|
@@ -10335,6 +10337,9 @@ var scriptlet_default = {
|
|
10335
10337
|
scriptlet.node,
|
10336
10338
|
scriptlet.node.body
|
10337
10339
|
);
|
10340
|
+
if (scriptlet.node.target === "client") {
|
10341
|
+
(0, import_babel_utils46.getProgram)().node.extra.isInteractive = true;
|
10342
|
+
}
|
10338
10343
|
},
|
10339
10344
|
translate: {
|
10340
10345
|
exit(scriptlet) {
|
@@ -10355,20 +10360,20 @@ var scriptlet_default = {
|
|
10355
10360
|
|
10356
10361
|
// src/translator/visitors/tag/index.ts
|
10357
10362
|
var import_compiler58 = require("@marko/compiler");
|
10358
|
-
var
|
10363
|
+
var import_babel_utils50 = require("@marko/compiler/babel-utils");
|
10359
10364
|
|
10360
10365
|
// src/translator/visitors/tag/attribute-tag.ts
|
10361
10366
|
var import_compiler55 = require("@marko/compiler");
|
10362
|
-
var
|
10367
|
+
var import_babel_utils47 = require("@marko/compiler/babel-utils");
|
10363
10368
|
var attribute_tag_default = {
|
10364
10369
|
analyze: {
|
10365
10370
|
enter(tag) {
|
10366
|
-
(0,
|
10367
|
-
(0,
|
10371
|
+
(0, import_babel_utils47.assertNoVar)(tag);
|
10372
|
+
(0, import_babel_utils47.assertNoArgs)(tag);
|
10368
10373
|
const body = tag.get("body");
|
10369
10374
|
startSection(body);
|
10370
10375
|
trackParamsReferences(body, 3 /* param */);
|
10371
|
-
if (!(0,
|
10376
|
+
if (!(0, import_babel_utils47.findParentTag)(tag)) {
|
10372
10377
|
throw tag.get("name").buildCodeFrameError("@tags must be nested within another tag.");
|
10373
10378
|
}
|
10374
10379
|
}
|
@@ -10390,7 +10395,7 @@ var attribute_tag_default = {
|
|
10390
10395
|
|
10391
10396
|
// src/translator/visitors/tag/custom-tag.ts
|
10392
10397
|
var import_compiler56 = require("@marko/compiler");
|
10393
|
-
var
|
10398
|
+
var import_babel_utils48 = require("@marko/compiler/babel-utils");
|
10394
10399
|
var import_path4 = __toESM(require("path"));
|
10395
10400
|
var kChildScopeBinding = Symbol("custom tag child scope");
|
10396
10401
|
var kChildOffsetScopeBinding = Symbol("custom tag scope offset");
|
@@ -10400,9 +10405,9 @@ var kChildInputSerializePropIds = Symbol(
|
|
10400
10405
|
var custom_tag_default = {
|
10401
10406
|
analyze: {
|
10402
10407
|
enter(tag) {
|
10403
|
-
(0,
|
10408
|
+
(0, import_babel_utils48.assertAttributesOrSingleArg)(tag);
|
10404
10409
|
analyzeAttributeTags(tag);
|
10405
|
-
const templateFile = (0,
|
10410
|
+
const templateFile = (0, import_babel_utils48.getTagTemplate)(tag);
|
10406
10411
|
if (!templateFile) {
|
10407
10412
|
const tagName = getTagName(tag);
|
10408
10413
|
if (tagName && tag.scope.hasBinding(tagName)) {
|
@@ -10423,7 +10428,7 @@ var custom_tag_default = {
|
|
10423
10428
|
const attrExprs = /* @__PURE__ */ new Set([tagExtra]);
|
10424
10429
|
startSection(tagBody);
|
10425
10430
|
trackParamsReferences(tagBody, 3 /* param */);
|
10426
|
-
const childFile = (0,
|
10431
|
+
const childFile = (0, import_babel_utils48.loadFileForTag)(tag);
|
10427
10432
|
if (!childFile) {
|
10428
10433
|
throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
|
10429
10434
|
}
|
@@ -10434,7 +10439,7 @@ var custom_tag_default = {
|
|
10434
10439
|
if (childFile.opts.filename === tag.hub.file.opts.filename) {
|
10435
10440
|
mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
|
10436
10441
|
if (varBinding) {
|
10437
|
-
const varSerializeReason = (0,
|
10442
|
+
const varSerializeReason = (0, import_babel_utils48.getProgram)().node.extra.returnValueExpr;
|
10438
10443
|
setBindingValueExpr(varBinding, varSerializeReason);
|
10439
10444
|
addBindingSerializeReasonExpr(
|
10440
10445
|
section,
|
@@ -10481,7 +10486,7 @@ var custom_tag_default = {
|
|
10481
10486
|
);
|
10482
10487
|
}
|
10483
10488
|
}
|
10484
|
-
(0,
|
10489
|
+
(0, import_babel_utils48.getProgram)().node.extra.hasInteractiveChild = childExtra?.isInteractive || childExtra?.hasInteractiveChild || false;
|
10485
10490
|
}
|
10486
10491
|
addBindingSerializeReasonExpr(
|
10487
10492
|
section,
|
@@ -10515,13 +10520,13 @@ function translateHTML(tag) {
|
|
10515
10520
|
writeHTMLResumeStatements(tagBody);
|
10516
10521
|
if (import_compiler56.types.isStringLiteral(node.name)) {
|
10517
10522
|
const relativePath = getTagRelativePath(tag);
|
10518
|
-
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler56.types.identifier(getTemplateContentName()) : (0,
|
10523
|
+
tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler56.types.identifier(getTemplateContentName()) : (0, import_babel_utils48.importDefault)(tag.hub.file, relativePath, getTagName(tag));
|
10519
10524
|
} else {
|
10520
10525
|
tagIdentifier = node.name;
|
10521
10526
|
}
|
10522
10527
|
const tagVar = node.var;
|
10523
10528
|
const section = getSection(tag);
|
10524
|
-
const childProgram = (0,
|
10529
|
+
const childProgram = (0, import_babel_utils48.loadFileForTag)(tag).ast.program;
|
10525
10530
|
const childExtra = childProgram.extra;
|
10526
10531
|
const inputExport = childExtra.domExports?.input;
|
10527
10532
|
const { properties, statements } = inputExport ? translateAttrs(tag, inputExport.props) : {
|
@@ -10672,7 +10677,7 @@ function translateDOM(tag) {
|
|
10672
10677
|
const { file } = tag.hub;
|
10673
10678
|
const tagName = import_compiler56.types.isIdentifier(node.name) ? node.name.name : import_compiler56.types.isStringLiteral(node.name) ? node.name.value : "tag";
|
10674
10679
|
const relativePath = getTagRelativePath(tag);
|
10675
|
-
const childFile = (0,
|
10680
|
+
const childFile = (0, import_babel_utils48.loadFileForTag)(tag);
|
10676
10681
|
const childExports = childFile.ast.program.extra.domExports;
|
10677
10682
|
const tagIdentifier = importOrSelfReferenceName(
|
10678
10683
|
file,
|
@@ -10726,10 +10731,10 @@ function translateDOM(tag) {
|
|
10726
10731
|
attrTagCallsByTag: void 0
|
10727
10732
|
});
|
10728
10733
|
}
|
10729
|
-
write2`${(0,
|
10734
|
+
write2`${(0, import_babel_utils48.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
|
10730
10735
|
injectWalks(
|
10731
10736
|
tag,
|
10732
|
-
(0,
|
10737
|
+
(0, import_babel_utils48.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
|
10733
10738
|
);
|
10734
10739
|
tag.remove();
|
10735
10740
|
}
|
@@ -10740,8 +10745,8 @@ function getTagRelativePath(tag) {
|
|
10740
10745
|
} = tag;
|
10741
10746
|
let relativePath;
|
10742
10747
|
if (import_compiler56.types.isStringLiteral(node.name)) {
|
10743
|
-
const template = (0,
|
10744
|
-
relativePath = template && (0,
|
10748
|
+
const template = (0, import_babel_utils48.getTagTemplate)(tag);
|
10749
|
+
relativePath = template && (0, import_babel_utils48.resolveRelativePath)(file, template);
|
10745
10750
|
} else if (node.extra?.tagNameImported) {
|
10746
10751
|
relativePath = node.extra.tagNameImported;
|
10747
10752
|
}
|
@@ -10792,7 +10797,7 @@ function analyzeAttrs(rootTagExtra, section, tag, templateExport, rootAttrExprs,
|
|
10792
10797
|
const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
|
10793
10798
|
for (const child of attrTags2) {
|
10794
10799
|
if (child.isMarkoTag()) {
|
10795
|
-
if ((0,
|
10800
|
+
if ((0, import_babel_utils48.isAttributeTag)(child)) {
|
10796
10801
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
10797
10802
|
const childAttrExports = templateExport.props[attrTagMeta.name];
|
10798
10803
|
if (childAttrExports) {
|
@@ -10918,7 +10923,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
10918
10923
|
);
|
10919
10924
|
}
|
10920
10925
|
let translatedProps = propsToExpression(translatedAttrs.properties);
|
10921
|
-
if ((0,
|
10926
|
+
if ((0, import_babel_utils48.isAttributeTag)(tag)) {
|
10922
10927
|
const attrTagName = getTagName(tag);
|
10923
10928
|
const parentTag = tag.parentPath;
|
10924
10929
|
const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
|
@@ -10994,7 +10999,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
10994
10999
|
for (let i = 0; i < attrTags2.length; i++) {
|
10995
11000
|
const child = attrTags2[i];
|
10996
11001
|
if (child.isMarkoTag()) {
|
10997
|
-
if ((0,
|
11002
|
+
if ((0, import_babel_utils48.isAttributeTag)(child)) {
|
10998
11003
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
10999
11004
|
const childAttrExport = templateExport.props[attrTagMeta.name];
|
11000
11005
|
if (childAttrExport) {
|
@@ -11058,7 +11063,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
11058
11063
|
if (bodySection && !seen.has("content")) {
|
11059
11064
|
seen.add("content");
|
11060
11065
|
if (templateExport.props.content) {
|
11061
|
-
const contentExportIdentifier = (0,
|
11066
|
+
const contentExportIdentifier = (0, import_babel_utils48.importNamed)(
|
11062
11067
|
tag.hub.file,
|
11063
11068
|
info.relativePath,
|
11064
11069
|
templateExport.props.content.id,
|
@@ -11159,7 +11164,7 @@ function importOrSelfReferenceName(file, request, name2, nameHint) {
|
|
11159
11164
|
if (isCircularRequest(file, request)) {
|
11160
11165
|
return import_compiler56.types.identifier(name2);
|
11161
11166
|
}
|
11162
|
-
return (0,
|
11167
|
+
return (0, import_babel_utils48.importNamed)(file, request, name2, nameHint);
|
11163
11168
|
}
|
11164
11169
|
function mapChildReasonToLocalReason(childReason, childInputBinding, inputExpr) {
|
11165
11170
|
if (childReason) {
|
@@ -11207,13 +11212,13 @@ function buildUndefined2() {
|
|
11207
11212
|
|
11208
11213
|
// src/translator/visitors/tag/dynamic-tag.ts
|
11209
11214
|
var import_compiler57 = require("@marko/compiler");
|
11210
|
-
var
|
11215
|
+
var import_babel_utils49 = require("@marko/compiler/babel-utils");
|
11211
11216
|
var kDOMBinding3 = Symbol("dynamic tag dom binding");
|
11212
11217
|
var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
|
11213
11218
|
var dynamic_tag_default = {
|
11214
11219
|
analyze: {
|
11215
11220
|
enter(tag) {
|
11216
|
-
(0,
|
11221
|
+
(0, import_babel_utils49.assertAttributesOrArgs)(tag);
|
11217
11222
|
analyzeAttributeTags(tag);
|
11218
11223
|
const tagSection = getOrCreateSection(tag);
|
11219
11224
|
const tagExtra = mergeReferences(tagSection, tag.node, [
|
@@ -11228,6 +11233,9 @@ var dynamic_tag_default = {
|
|
11228
11233
|
0 /* dom */,
|
11229
11234
|
tagSection
|
11230
11235
|
);
|
11236
|
+
(0, import_babel_utils49.getProgram)().node.extra.isInteractive ||= hasVar || tag.node.attributes.some(
|
11237
|
+
(attr2) => import_compiler57.types.isMarkoSpreadAttribute(attr2) || isEventHandler(attr2.name)
|
11238
|
+
);
|
11231
11239
|
if (hasVar) {
|
11232
11240
|
trackVarReferences(tag, 5 /* derived */);
|
11233
11241
|
tag.node.var.extra.binding.scopeOffset = tagExtra[kChildOffsetScopeBinding2] = createBinding("#scopeOffset", 0 /* dom */, tagSection);
|
@@ -11260,7 +11268,7 @@ var dynamic_tag_default = {
|
|
11260
11268
|
const isClassAPI = tagExtra.featureType === "class";
|
11261
11269
|
let tagExpression = node.name;
|
11262
11270
|
if (import_compiler57.types.isStringLiteral(tagExpression)) {
|
11263
|
-
tagExpression = (0,
|
11271
|
+
tagExpression = (0, import_babel_utils49.importDefault)(
|
11264
11272
|
tag.hub.file,
|
11265
11273
|
getTagRelativePath(tag),
|
11266
11274
|
tagExpression.value
|
@@ -11268,15 +11276,15 @@ var dynamic_tag_default = {
|
|
11268
11276
|
}
|
11269
11277
|
if (isClassAPI) {
|
11270
11278
|
if (isOutputHTML()) {
|
11271
|
-
(0,
|
11279
|
+
(0, import_babel_utils49.getProgram)().node.body.push(
|
11272
11280
|
import_compiler57.types.markoScriptlet(
|
11273
11281
|
[
|
11274
11282
|
import_compiler57.types.expressionStatement(
|
11275
11283
|
import_compiler57.types.callExpression(
|
11276
|
-
(0,
|
11284
|
+
(0, import_babel_utils49.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
|
11277
11285
|
[
|
11278
11286
|
import_compiler57.types.identifier(tagExpression.name),
|
11279
|
-
import_compiler57.types.stringLiteral((0,
|
11287
|
+
import_compiler57.types.stringLiteral((0, import_babel_utils49.loadFileForTag)(tag).metadata.marko.id)
|
11280
11288
|
]
|
11281
11289
|
)
|
11282
11290
|
)
|
@@ -11285,11 +11293,11 @@ var dynamic_tag_default = {
|
|
11285
11293
|
)
|
11286
11294
|
);
|
11287
11295
|
} else {
|
11288
|
-
(0,
|
11296
|
+
(0, import_babel_utils49.getProgram)().node.body.push(
|
11289
11297
|
import_compiler57.types.expressionStatement(
|
11290
11298
|
callRuntime(
|
11291
11299
|
"register",
|
11292
|
-
import_compiler57.types.stringLiteral((0,
|
11300
|
+
import_compiler57.types.stringLiteral((0, import_babel_utils49.loadFileForTag)(tag).metadata.marko.id),
|
11293
11301
|
import_compiler57.types.identifier(tagExpression.name)
|
11294
11302
|
)
|
11295
11303
|
)
|
@@ -11470,7 +11478,7 @@ var tag_default = {
|
|
11470
11478
|
},
|
11471
11479
|
analyze: {
|
11472
11480
|
enter(tag) {
|
11473
|
-
const tagDef = (0,
|
11481
|
+
const tagDef = (0, import_babel_utils50.getTagDef)(tag);
|
11474
11482
|
const type = analyzeTagNameType(tag);
|
11475
11483
|
const hook = tagDef?.analyzer?.hook;
|
11476
11484
|
if (hook) {
|
@@ -11494,7 +11502,7 @@ var tag_default = {
|
|
11494
11502
|
}
|
11495
11503
|
},
|
11496
11504
|
exit(tag) {
|
11497
|
-
const hook = (0,
|
11505
|
+
const hook = (0, import_babel_utils50.getTagDef)(tag)?.analyzer?.hook;
|
11498
11506
|
if (hook) {
|
11499
11507
|
exit(hook, tag);
|
11500
11508
|
return;
|
@@ -11503,7 +11511,7 @@ var tag_default = {
|
|
11503
11511
|
},
|
11504
11512
|
translate: {
|
11505
11513
|
enter(tag) {
|
11506
|
-
const tagDef = (0,
|
11514
|
+
const tagDef = (0, import_babel_utils50.getTagDef)(tag);
|
11507
11515
|
const extra = tag.node.extra;
|
11508
11516
|
if (tagDef?.translator) {
|
11509
11517
|
if (tagDef.translator.path) {
|
@@ -11520,7 +11528,7 @@ var tag_default = {
|
|
11520
11528
|
);
|
11521
11529
|
}
|
11522
11530
|
if (attr2.node.modifier) {
|
11523
|
-
if ((0,
|
11531
|
+
if ((0, import_babel_utils50.isNativeTag)(attr2.parentPath)) {
|
11524
11532
|
attr2.node.name += `:${attr2.node.modifier}`;
|
11525
11533
|
} else {
|
11526
11534
|
throw attr2.buildCodeFrameError(
|
@@ -11556,7 +11564,7 @@ var tag_default = {
|
|
11556
11564
|
}
|
11557
11565
|
},
|
11558
11566
|
exit(tag) {
|
11559
|
-
const translator = (0,
|
11567
|
+
const translator = (0, import_babel_utils50.getTagDef)(tag)?.translator;
|
11560
11568
|
if (translator) {
|
11561
11569
|
exit(translator.hook, tag);
|
11562
11570
|
return;
|
package/index.d.ts
CHANGED