marko 6.0.47 → 6.0.48
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 +12 -5
- package/dist/debug/dom.mjs +12 -5
- package/dist/debug/html.js +19 -5
- package/dist/debug/html.mjs +19 -5
- package/dist/html/compat.d.ts +3 -2
- package/dist/html.js +4 -4
- package/dist/html.mjs +4 -4
- package/dist/translator/index.js +45 -37
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -256,11 +256,6 @@ function enableBranches() {
|
|
256
256
|
}
|
257
257
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
258
258
|
if (true) {
|
259
|
-
if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
260
|
-
throw new Error(
|
261
|
-
`Invalid runtimeId: "${runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
262
|
-
);
|
263
|
-
}
|
264
259
|
const descriptor = Object.getOwnPropertyDescriptor(self, runtimeId);
|
265
260
|
if (descriptor && (descriptor.set || descriptor.configurable === false)) {
|
266
261
|
throw new Error(
|
@@ -2318,6 +2313,18 @@ function mount(input = {}, reference, position) {
|
|
2318
2313
|
renderId: DEFAULT_RENDER_ID,
|
2319
2314
|
...$global
|
2320
2315
|
};
|
2316
|
+
if (true) {
|
2317
|
+
if (!String($global.runtimeId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2318
|
+
throw new Error(
|
2319
|
+
`Invalid runtimeId: "${$global.runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
2320
|
+
);
|
2321
|
+
}
|
2322
|
+
if (!String($global.renderId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2323
|
+
throw new Error(
|
2324
|
+
`Invalid renderId: "${$global.renderId}". The renderId must be a valid JavaScript identifier.`
|
2325
|
+
);
|
2326
|
+
}
|
2327
|
+
}
|
2321
2328
|
} else {
|
2322
2329
|
$global = {
|
2323
2330
|
___nextScopeId: 0,
|
package/dist/debug/dom.mjs
CHANGED
@@ -160,11 +160,6 @@ function enableBranches() {
|
|
160
160
|
}
|
161
161
|
function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
162
162
|
if (true) {
|
163
|
-
if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
164
|
-
throw new Error(
|
165
|
-
`Invalid runtimeId: "${runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
166
|
-
);
|
167
|
-
}
|
168
163
|
const descriptor = Object.getOwnPropertyDescriptor(self, runtimeId);
|
169
164
|
if (descriptor && (descriptor.set || descriptor.configurable === false)) {
|
170
165
|
throw new Error(
|
@@ -2222,6 +2217,18 @@ function mount(input = {}, reference, position) {
|
|
2222
2217
|
renderId: DEFAULT_RENDER_ID,
|
2223
2218
|
...$global
|
2224
2219
|
};
|
2220
|
+
if (true) {
|
2221
|
+
if (!String($global.runtimeId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2222
|
+
throw new Error(
|
2223
|
+
`Invalid runtimeId: "${$global.runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
2224
|
+
);
|
2225
|
+
}
|
2226
|
+
if (!String($global.renderId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2227
|
+
throw new Error(
|
2228
|
+
`Invalid renderId: "${$global.renderId}". The renderId must be a valid JavaScript identifier.`
|
2229
|
+
);
|
2230
|
+
}
|
2231
|
+
}
|
2225
2232
|
} else {
|
2226
2233
|
$global = {
|
2227
2234
|
___nextScopeId: 0,
|
package/dist/debug/html.js
CHANGED
@@ -2899,6 +2899,18 @@ function render(input = {}) {
|
|
2899
2899
|
renderId: DEFAULT_RENDER_ID,
|
2900
2900
|
...$global2
|
2901
2901
|
};
|
2902
|
+
if (true) {
|
2903
|
+
if (!String($global2.runtimeId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2904
|
+
throw new Error(
|
2905
|
+
`Invalid runtimeId: "${$global2.runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
2906
|
+
);
|
2907
|
+
}
|
2908
|
+
if (!String($global2.renderId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2909
|
+
throw new Error(
|
2910
|
+
`Invalid renderId: "${$global2.renderId}". The renderId must be a valid JavaScript identifier.`
|
2911
|
+
);
|
2912
|
+
}
|
2913
|
+
}
|
2902
2914
|
} else {
|
2903
2915
|
$global2 = { runtimeId: DEFAULT_RUNTIME_ID, renderId: DEFAULT_RENDER_ID };
|
2904
2916
|
}
|
@@ -3243,14 +3255,14 @@ var compat = {
|
|
3243
3255
|
write,
|
3244
3256
|
writeScript,
|
3245
3257
|
nextScopeId,
|
3258
|
+
peekNextScopeId,
|
3246
3259
|
isTagsAPI(fn) {
|
3247
3260
|
return !!fn.___id;
|
3248
3261
|
},
|
3249
3262
|
patchDynamicTag,
|
3250
|
-
writeSetScopeForComponent(m5c) {
|
3251
|
-
|
3252
|
-
|
3253
|
-
writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
|
3263
|
+
writeSetScopeForComponent(branchId, m5c) {
|
3264
|
+
writeScope(branchId, { m5c });
|
3265
|
+
writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
3254
3266
|
},
|
3255
3267
|
toJSON() {
|
3256
3268
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
@@ -3311,7 +3323,9 @@ var compat = {
|
|
3311
3323
|
const { scripts, html } = head.consume().flushScript();
|
3312
3324
|
asyncOut.script(scripts);
|
3313
3325
|
asyncOut.write(html);
|
3314
|
-
|
3326
|
+
if (boundary.done) {
|
3327
|
+
asyncOut.end();
|
3328
|
+
}
|
3315
3329
|
}
|
3316
3330
|
}
|
3317
3331
|
);
|
package/dist/debug/html.mjs
CHANGED
@@ -2815,6 +2815,18 @@ function render(input = {}) {
|
|
2815
2815
|
renderId: DEFAULT_RENDER_ID,
|
2816
2816
|
...$global2
|
2817
2817
|
};
|
2818
|
+
if (true) {
|
2819
|
+
if (!String($global2.runtimeId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2820
|
+
throw new Error(
|
2821
|
+
`Invalid runtimeId: "${$global2.runtimeId}". The runtimeId must be a valid JavaScript identifier.`
|
2822
|
+
);
|
2823
|
+
}
|
2824
|
+
if (!String($global2.renderId).match(/^[_$a-z][_$a-z0-9]*$/i)) {
|
2825
|
+
throw new Error(
|
2826
|
+
`Invalid renderId: "${$global2.renderId}". The renderId must be a valid JavaScript identifier.`
|
2827
|
+
);
|
2828
|
+
}
|
2829
|
+
}
|
2818
2830
|
} else {
|
2819
2831
|
$global2 = { runtimeId: DEFAULT_RUNTIME_ID, renderId: DEFAULT_RENDER_ID };
|
2820
2832
|
}
|
@@ -3159,14 +3171,14 @@ var compat = {
|
|
3159
3171
|
write,
|
3160
3172
|
writeScript,
|
3161
3173
|
nextScopeId,
|
3174
|
+
peekNextScopeId,
|
3162
3175
|
isTagsAPI(fn) {
|
3163
3176
|
return !!fn.___id;
|
3164
3177
|
},
|
3165
3178
|
patchDynamicTag,
|
3166
|
-
writeSetScopeForComponent(m5c) {
|
3167
|
-
|
3168
|
-
|
3169
|
-
writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
|
3179
|
+
writeSetScopeForComponent(branchId, m5c) {
|
3180
|
+
writeScope(branchId, { m5c });
|
3181
|
+
writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
3170
3182
|
},
|
3171
3183
|
toJSON() {
|
3172
3184
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
@@ -3227,7 +3239,9 @@ var compat = {
|
|
3227
3239
|
const { scripts, html } = head.consume().flushScript();
|
3228
3240
|
asyncOut.script(scripts);
|
3229
3241
|
asyncOut.write(html);
|
3230
|
-
|
3242
|
+
if (boundary.done) {
|
3243
|
+
asyncOut.end();
|
3244
|
+
}
|
3231
3245
|
}
|
3232
3246
|
}
|
3233
3247
|
);
|
package/dist/html/compat.d.ts
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
import { patchDynamicTag } from "./dynamic-tag";
|
2
2
|
import { type ServerRenderer } from "./template";
|
3
|
-
import { $global, fork, nextScopeId, write, writeScript } from "./writer";
|
3
|
+
import { $global, fork, nextScopeId, peekNextScopeId, write, writeScript } from "./writer";
|
4
4
|
export declare const compat: {
|
5
5
|
$global: typeof $global;
|
6
6
|
fork: typeof fork;
|
7
7
|
write: typeof write;
|
8
8
|
writeScript: typeof writeScript;
|
9
9
|
nextScopeId: typeof nextScopeId;
|
10
|
+
peekNextScopeId: typeof peekNextScopeId;
|
10
11
|
isTagsAPI(fn: any): boolean;
|
11
12
|
patchDynamicTag: typeof patchDynamicTag;
|
12
|
-
writeSetScopeForComponent(m5c: string): void;
|
13
|
+
writeSetScopeForComponent(branchId: number, m5c: string): void;
|
13
14
|
toJSON(this: WeakKey): [registryId: string, scopeId: unknown] | undefined;
|
14
15
|
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any): void;
|
15
16
|
registerRenderer(renderer: any, id: string): any;
|
package/dist/html.js
CHANGED
@@ -2088,13 +2088,13 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2088
2088
|
write,
|
2089
2089
|
writeScript,
|
2090
2090
|
nextScopeId,
|
2091
|
+
peekNextScopeId,
|
2091
2092
|
isTagsAPI(fn) {
|
2092
2093
|
return !!fn.h;
|
2093
2094
|
},
|
2094
2095
|
patchDynamicTag,
|
2095
|
-
writeSetScopeForComponent(m5c) {
|
2096
|
-
|
2097
|
-
writeScope(scopeId, { m5c }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
|
2096
|
+
writeSetScopeForComponent(branchId, m5c) {
|
2097
|
+
writeScope(branchId, { m5c }), writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
2098
2098
|
},
|
2099
2099
|
toJSON() {
|
2100
2100
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
@@ -2137,7 +2137,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2137
2137
|
asyncOut.error(boundary.signal.reason);
|
2138
2138
|
else if (boundary.done) {
|
2139
2139
|
let { scripts, html } = head.consume().flushScript();
|
2140
|
-
asyncOut.script(scripts), asyncOut.write(html), asyncOut.end();
|
2140
|
+
asyncOut.script(scripts), asyncOut.write(html), boundary.done && asyncOut.end();
|
2141
2141
|
}
|
2142
2142
|
}
|
2143
2143
|
);
|
package/dist/html.mjs
CHANGED
@@ -2007,13 +2007,13 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2007
2007
|
write,
|
2008
2008
|
writeScript,
|
2009
2009
|
nextScopeId,
|
2010
|
+
peekNextScopeId,
|
2010
2011
|
isTagsAPI(fn) {
|
2011
2012
|
return !!fn.h;
|
2012
2013
|
},
|
2013
2014
|
patchDynamicTag,
|
2014
|
-
writeSetScopeForComponent(m5c) {
|
2015
|
-
|
2016
|
-
writeScope(scopeId, { m5c }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
|
2015
|
+
writeSetScopeForComponent(branchId, m5c) {
|
2016
|
+
writeScope(branchId, { m5c }), writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
2017
2017
|
},
|
2018
2018
|
toJSON() {
|
2019
2019
|
let compatRegistered = COMPAT_REGISTRY.get(this);
|
@@ -2056,7 +2056,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2056
2056
|
asyncOut.error(boundary.signal.reason);
|
2057
2057
|
else if (boundary.done) {
|
2058
2058
|
let { scripts, html } = head.consume().flushScript();
|
2059
|
-
asyncOut.script(scripts), asyncOut.write(html), asyncOut.end();
|
2059
|
+
asyncOut.script(scripts), asyncOut.write(html), boundary.done && asyncOut.end();
|
2060
2060
|
}
|
2061
2061
|
}
|
2062
2062
|
);
|
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
|
@@ -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;
|