marko 6.0.46 → 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 +52 -38
- 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
@@ -1213,8 +1213,14 @@ var entry_builder_default = {
|
|
1213
1213
|
)
|
1214
1214
|
)
|
1215
1215
|
);
|
1216
|
+
const { runtimeId } = entryFile.markoOpts;
|
1216
1217
|
body.push(
|
1217
|
-
import_compiler5.types.expressionStatement(
|
1218
|
+
import_compiler5.types.expressionStatement(
|
1219
|
+
import_compiler5.types.callExpression(
|
1220
|
+
import_compiler5.types.identifier("init"),
|
1221
|
+
runtimeId ? [import_compiler5.types.stringLiteral(runtimeId)] : []
|
1222
|
+
)
|
1223
|
+
)
|
1218
1224
|
);
|
1219
1225
|
}
|
1220
1226
|
return body;
|
@@ -1561,7 +1567,7 @@ function filterArguments(args) {
|
|
1561
1567
|
}
|
1562
1568
|
function getCompatRuntimeFile() {
|
1563
1569
|
const markoOpts = getMarkoOpts();
|
1564
|
-
return `marko
|
1570
|
+
return `marko/${markoOpts.optimize ? "dist" : "src"}/runtime/helpers/tags-compat/${isOutputHTML() ? "html" : "dom"}${markoOpts.optimize ? "" : "-debug"}.${markoOpts.modules === "esm" ? "mjs" : "js"}`;
|
1565
1571
|
}
|
1566
1572
|
|
1567
1573
|
// src/translator/util/sections.ts
|
@@ -9994,6 +10000,7 @@ var function_default = {
|
|
9994
10000
|
filename,
|
9995
10001
|
`${section.id}/${name2.slice(1)}`
|
9996
10002
|
);
|
10003
|
+
(0, import_babel_utils44.getProgram)().node.extra.isInteractive = true;
|
9997
10004
|
}
|
9998
10005
|
};
|
9999
10006
|
function isMarkoAttribute(path5) {
|
@@ -10317,6 +10324,7 @@ var referenced_identifier_default = {
|
|
10317
10324
|
};
|
10318
10325
|
|
10319
10326
|
// src/translator/visitors/scriptlet.ts
|
10327
|
+
var import_babel_utils46 = require("@marko/compiler/babel-utils");
|
10320
10328
|
var scriptlet_default = {
|
10321
10329
|
analyze(scriptlet) {
|
10322
10330
|
if (!scriptlet.node.static) {
|
@@ -10329,6 +10337,9 @@ var scriptlet_default = {
|
|
10329
10337
|
scriptlet.node,
|
10330
10338
|
scriptlet.node.body
|
10331
10339
|
);
|
10340
|
+
if (scriptlet.node.target === "client") {
|
10341
|
+
(0, import_babel_utils46.getProgram)().node.extra.isInteractive = true;
|
10342
|
+
}
|
10332
10343
|
},
|
10333
10344
|
translate: {
|
10334
10345
|
exit(scriptlet) {
|
@@ -10349,20 +10360,20 @@ var scriptlet_default = {
|
|
10349
10360
|
|
10350
10361
|
// src/translator/visitors/tag/index.ts
|
10351
10362
|
var import_compiler58 = require("@marko/compiler");
|
10352
|
-
var
|
10363
|
+
var import_babel_utils50 = require("@marko/compiler/babel-utils");
|
10353
10364
|
|
10354
10365
|
// src/translator/visitors/tag/attribute-tag.ts
|
10355
10366
|
var import_compiler55 = require("@marko/compiler");
|
10356
|
-
var
|
10367
|
+
var import_babel_utils47 = require("@marko/compiler/babel-utils");
|
10357
10368
|
var attribute_tag_default = {
|
10358
10369
|
analyze: {
|
10359
10370
|
enter(tag) {
|
10360
|
-
(0,
|
10361
|
-
(0,
|
10371
|
+
(0, import_babel_utils47.assertNoVar)(tag);
|
10372
|
+
(0, import_babel_utils47.assertNoArgs)(tag);
|
10362
10373
|
const body = tag.get("body");
|
10363
10374
|
startSection(body);
|
10364
10375
|
trackParamsReferences(body, 3 /* param */);
|
10365
|
-
if (!(0,
|
10376
|
+
if (!(0, import_babel_utils47.findParentTag)(tag)) {
|
10366
10377
|
throw tag.get("name").buildCodeFrameError("@tags must be nested within another tag.");
|
10367
10378
|
}
|
10368
10379
|
}
|
@@ -10384,7 +10395,7 @@ var attribute_tag_default = {
|
|
10384
10395
|
|
10385
10396
|
// src/translator/visitors/tag/custom-tag.ts
|
10386
10397
|
var import_compiler56 = require("@marko/compiler");
|
10387
|
-
var
|
10398
|
+
var import_babel_utils48 = require("@marko/compiler/babel-utils");
|
10388
10399
|
var import_path4 = __toESM(require("path"));
|
10389
10400
|
var kChildScopeBinding = Symbol("custom tag child scope");
|
10390
10401
|
var kChildOffsetScopeBinding = Symbol("custom tag scope offset");
|
@@ -10394,9 +10405,9 @@ var kChildInputSerializePropIds = Symbol(
|
|
10394
10405
|
var custom_tag_default = {
|
10395
10406
|
analyze: {
|
10396
10407
|
enter(tag) {
|
10397
|
-
(0,
|
10408
|
+
(0, import_babel_utils48.assertAttributesOrSingleArg)(tag);
|
10398
10409
|
analyzeAttributeTags(tag);
|
10399
|
-
const templateFile = (0,
|
10410
|
+
const templateFile = (0, import_babel_utils48.getTagTemplate)(tag);
|
10400
10411
|
if (!templateFile) {
|
10401
10412
|
const tagName = getTagName(tag);
|
10402
10413
|
if (tagName && tag.scope.hasBinding(tagName)) {
|
@@ -10417,7 +10428,7 @@ var custom_tag_default = {
|
|
10417
10428
|
const attrExprs = /* @__PURE__ */ new Set([tagExtra]);
|
10418
10429
|
startSection(tagBody);
|
10419
10430
|
trackParamsReferences(tagBody, 3 /* param */);
|
10420
|
-
const childFile = (0,
|
10431
|
+
const childFile = (0, import_babel_utils48.loadFileForTag)(tag);
|
10421
10432
|
if (!childFile) {
|
10422
10433
|
throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
|
10423
10434
|
}
|
@@ -10428,7 +10439,7 @@ var custom_tag_default = {
|
|
10428
10439
|
if (childFile.opts.filename === tag.hub.file.opts.filename) {
|
10429
10440
|
mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
|
10430
10441
|
if (varBinding) {
|
10431
|
-
const varSerializeReason = (0,
|
10442
|
+
const varSerializeReason = (0, import_babel_utils48.getProgram)().node.extra.returnValueExpr;
|
10432
10443
|
setBindingValueExpr(varBinding, varSerializeReason);
|
10433
10444
|
addBindingSerializeReasonExpr(
|
10434
10445
|
section,
|
@@ -10475,7 +10486,7 @@ var custom_tag_default = {
|
|
10475
10486
|
);
|
10476
10487
|
}
|
10477
10488
|
}
|
10478
|
-
(0,
|
10489
|
+
(0, import_babel_utils48.getProgram)().node.extra.hasInteractiveChild = childExtra?.isInteractive || childExtra?.hasInteractiveChild || false;
|
10479
10490
|
}
|
10480
10491
|
addBindingSerializeReasonExpr(
|
10481
10492
|
section,
|
@@ -10509,13 +10520,13 @@ function translateHTML(tag) {
|
|
10509
10520
|
writeHTMLResumeStatements(tagBody);
|
10510
10521
|
if (import_compiler56.types.isStringLiteral(node.name)) {
|
10511
10522
|
const relativePath = getTagRelativePath(tag);
|
10512
|
-
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));
|
10513
10524
|
} else {
|
10514
10525
|
tagIdentifier = node.name;
|
10515
10526
|
}
|
10516
10527
|
const tagVar = node.var;
|
10517
10528
|
const section = getSection(tag);
|
10518
|
-
const childProgram = (0,
|
10529
|
+
const childProgram = (0, import_babel_utils48.loadFileForTag)(tag).ast.program;
|
10519
10530
|
const childExtra = childProgram.extra;
|
10520
10531
|
const inputExport = childExtra.domExports?.input;
|
10521
10532
|
const { properties, statements } = inputExport ? translateAttrs(tag, inputExport.props) : {
|
@@ -10666,7 +10677,7 @@ function translateDOM(tag) {
|
|
10666
10677
|
const { file } = tag.hub;
|
10667
10678
|
const tagName = import_compiler56.types.isIdentifier(node.name) ? node.name.name : import_compiler56.types.isStringLiteral(node.name) ? node.name.value : "tag";
|
10668
10679
|
const relativePath = getTagRelativePath(tag);
|
10669
|
-
const childFile = (0,
|
10680
|
+
const childFile = (0, import_babel_utils48.loadFileForTag)(tag);
|
10670
10681
|
const childExports = childFile.ast.program.extra.domExports;
|
10671
10682
|
const tagIdentifier = importOrSelfReferenceName(
|
10672
10683
|
file,
|
@@ -10720,10 +10731,10 @@ function translateDOM(tag) {
|
|
10720
10731
|
attrTagCallsByTag: void 0
|
10721
10732
|
});
|
10722
10733
|
}
|
10723
|
-
write2`${(0,
|
10734
|
+
write2`${(0, import_babel_utils48.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
|
10724
10735
|
injectWalks(
|
10725
10736
|
tag,
|
10726
|
-
(0,
|
10737
|
+
(0, import_babel_utils48.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
|
10727
10738
|
);
|
10728
10739
|
tag.remove();
|
10729
10740
|
}
|
@@ -10734,8 +10745,8 @@ function getTagRelativePath(tag) {
|
|
10734
10745
|
} = tag;
|
10735
10746
|
let relativePath;
|
10736
10747
|
if (import_compiler56.types.isStringLiteral(node.name)) {
|
10737
|
-
const template = (0,
|
10738
|
-
relativePath = template && (0,
|
10748
|
+
const template = (0, import_babel_utils48.getTagTemplate)(tag);
|
10749
|
+
relativePath = template && (0, import_babel_utils48.resolveRelativePath)(file, template);
|
10739
10750
|
} else if (node.extra?.tagNameImported) {
|
10740
10751
|
relativePath = node.extra.tagNameImported;
|
10741
10752
|
}
|
@@ -10786,7 +10797,7 @@ function analyzeAttrs(rootTagExtra, section, tag, templateExport, rootAttrExprs,
|
|
10786
10797
|
const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
|
10787
10798
|
for (const child of attrTags2) {
|
10788
10799
|
if (child.isMarkoTag()) {
|
10789
|
-
if ((0,
|
10800
|
+
if ((0, import_babel_utils48.isAttributeTag)(child)) {
|
10790
10801
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
10791
10802
|
const childAttrExports = templateExport.props[attrTagMeta.name];
|
10792
10803
|
if (childAttrExports) {
|
@@ -10912,7 +10923,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
10912
10923
|
);
|
10913
10924
|
}
|
10914
10925
|
let translatedProps = propsToExpression(translatedAttrs.properties);
|
10915
|
-
if ((0,
|
10926
|
+
if ((0, import_babel_utils48.isAttributeTag)(tag)) {
|
10916
10927
|
const attrTagName = getTagName(tag);
|
10917
10928
|
const parentTag = tag.parentPath;
|
10918
10929
|
const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
|
@@ -10988,7 +10999,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
10988
10999
|
for (let i = 0; i < attrTags2.length; i++) {
|
10989
11000
|
const child = attrTags2[i];
|
10990
11001
|
if (child.isMarkoTag()) {
|
10991
|
-
if ((0,
|
11002
|
+
if ((0, import_babel_utils48.isAttributeTag)(child)) {
|
10992
11003
|
const attrTagMeta = attrTagLookup[getTagName(child)];
|
10993
11004
|
const childAttrExport = templateExport.props[attrTagMeta.name];
|
10994
11005
|
if (childAttrExport) {
|
@@ -11052,7 +11063,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
|
|
11052
11063
|
if (bodySection && !seen.has("content")) {
|
11053
11064
|
seen.add("content");
|
11054
11065
|
if (templateExport.props.content) {
|
11055
|
-
const contentExportIdentifier = (0,
|
11066
|
+
const contentExportIdentifier = (0, import_babel_utils48.importNamed)(
|
11056
11067
|
tag.hub.file,
|
11057
11068
|
info.relativePath,
|
11058
11069
|
templateExport.props.content.id,
|
@@ -11153,7 +11164,7 @@ function importOrSelfReferenceName(file, request, name2, nameHint) {
|
|
11153
11164
|
if (isCircularRequest(file, request)) {
|
11154
11165
|
return import_compiler56.types.identifier(name2);
|
11155
11166
|
}
|
11156
|
-
return (0,
|
11167
|
+
return (0, import_babel_utils48.importNamed)(file, request, name2, nameHint);
|
11157
11168
|
}
|
11158
11169
|
function mapChildReasonToLocalReason(childReason, childInputBinding, inputExpr) {
|
11159
11170
|
if (childReason) {
|
@@ -11201,13 +11212,13 @@ function buildUndefined2() {
|
|
11201
11212
|
|
11202
11213
|
// src/translator/visitors/tag/dynamic-tag.ts
|
11203
11214
|
var import_compiler57 = require("@marko/compiler");
|
11204
|
-
var
|
11215
|
+
var import_babel_utils49 = require("@marko/compiler/babel-utils");
|
11205
11216
|
var kDOMBinding3 = Symbol("dynamic tag dom binding");
|
11206
11217
|
var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
|
11207
11218
|
var dynamic_tag_default = {
|
11208
11219
|
analyze: {
|
11209
11220
|
enter(tag) {
|
11210
|
-
(0,
|
11221
|
+
(0, import_babel_utils49.assertAttributesOrArgs)(tag);
|
11211
11222
|
analyzeAttributeTags(tag);
|
11212
11223
|
const tagSection = getOrCreateSection(tag);
|
11213
11224
|
const tagExtra = mergeReferences(tagSection, tag.node, [
|
@@ -11222,6 +11233,9 @@ var dynamic_tag_default = {
|
|
11222
11233
|
0 /* dom */,
|
11223
11234
|
tagSection
|
11224
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
|
+
);
|
11225
11239
|
if (hasVar) {
|
11226
11240
|
trackVarReferences(tag, 5 /* derived */);
|
11227
11241
|
tag.node.var.extra.binding.scopeOffset = tagExtra[kChildOffsetScopeBinding2] = createBinding("#scopeOffset", 0 /* dom */, tagSection);
|
@@ -11254,7 +11268,7 @@ var dynamic_tag_default = {
|
|
11254
11268
|
const isClassAPI = tagExtra.featureType === "class";
|
11255
11269
|
let tagExpression = node.name;
|
11256
11270
|
if (import_compiler57.types.isStringLiteral(tagExpression)) {
|
11257
|
-
tagExpression = (0,
|
11271
|
+
tagExpression = (0, import_babel_utils49.importDefault)(
|
11258
11272
|
tag.hub.file,
|
11259
11273
|
getTagRelativePath(tag),
|
11260
11274
|
tagExpression.value
|
@@ -11262,15 +11276,15 @@ var dynamic_tag_default = {
|
|
11262
11276
|
}
|
11263
11277
|
if (isClassAPI) {
|
11264
11278
|
if (isOutputHTML()) {
|
11265
|
-
(0,
|
11279
|
+
(0, import_babel_utils49.getProgram)().node.body.push(
|
11266
11280
|
import_compiler57.types.markoScriptlet(
|
11267
11281
|
[
|
11268
11282
|
import_compiler57.types.expressionStatement(
|
11269
11283
|
import_compiler57.types.callExpression(
|
11270
|
-
(0,
|
11284
|
+
(0, import_babel_utils49.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
|
11271
11285
|
[
|
11272
11286
|
import_compiler57.types.identifier(tagExpression.name),
|
11273
|
-
import_compiler57.types.stringLiteral((0,
|
11287
|
+
import_compiler57.types.stringLiteral((0, import_babel_utils49.loadFileForTag)(tag).metadata.marko.id)
|
11274
11288
|
]
|
11275
11289
|
)
|
11276
11290
|
)
|
@@ -11279,11 +11293,11 @@ var dynamic_tag_default = {
|
|
11279
11293
|
)
|
11280
11294
|
);
|
11281
11295
|
} else {
|
11282
|
-
(0,
|
11296
|
+
(0, import_babel_utils49.getProgram)().node.body.push(
|
11283
11297
|
import_compiler57.types.expressionStatement(
|
11284
11298
|
callRuntime(
|
11285
11299
|
"register",
|
11286
|
-
import_compiler57.types.stringLiteral((0,
|
11300
|
+
import_compiler57.types.stringLiteral((0, import_babel_utils49.loadFileForTag)(tag).metadata.marko.id),
|
11287
11301
|
import_compiler57.types.identifier(tagExpression.name)
|
11288
11302
|
)
|
11289
11303
|
)
|
@@ -11464,7 +11478,7 @@ var tag_default = {
|
|
11464
11478
|
},
|
11465
11479
|
analyze: {
|
11466
11480
|
enter(tag) {
|
11467
|
-
const tagDef = (0,
|
11481
|
+
const tagDef = (0, import_babel_utils50.getTagDef)(tag);
|
11468
11482
|
const type = analyzeTagNameType(tag);
|
11469
11483
|
const hook = tagDef?.analyzer?.hook;
|
11470
11484
|
if (hook) {
|
@@ -11488,7 +11502,7 @@ var tag_default = {
|
|
11488
11502
|
}
|
11489
11503
|
},
|
11490
11504
|
exit(tag) {
|
11491
|
-
const hook = (0,
|
11505
|
+
const hook = (0, import_babel_utils50.getTagDef)(tag)?.analyzer?.hook;
|
11492
11506
|
if (hook) {
|
11493
11507
|
exit(hook, tag);
|
11494
11508
|
return;
|
@@ -11497,7 +11511,7 @@ var tag_default = {
|
|
11497
11511
|
},
|
11498
11512
|
translate: {
|
11499
11513
|
enter(tag) {
|
11500
|
-
const tagDef = (0,
|
11514
|
+
const tagDef = (0, import_babel_utils50.getTagDef)(tag);
|
11501
11515
|
const extra = tag.node.extra;
|
11502
11516
|
if (tagDef?.translator) {
|
11503
11517
|
if (tagDef.translator.path) {
|
@@ -11514,7 +11528,7 @@ var tag_default = {
|
|
11514
11528
|
);
|
11515
11529
|
}
|
11516
11530
|
if (attr2.node.modifier) {
|
11517
|
-
if ((0,
|
11531
|
+
if ((0, import_babel_utils50.isNativeTag)(attr2.parentPath)) {
|
11518
11532
|
attr2.node.name += `:${attr2.node.modifier}`;
|
11519
11533
|
} else {
|
11520
11534
|
throw attr2.buildCodeFrameError(
|
@@ -11550,7 +11564,7 @@ var tag_default = {
|
|
11550
11564
|
}
|
11551
11565
|
},
|
11552
11566
|
exit(tag) {
|
11553
|
-
const translator = (0,
|
11567
|
+
const translator = (0, import_babel_utils50.getTagDef)(tag)?.translator;
|
11554
11568
|
if (translator) {
|
11555
11569
|
exit(translator.hook, tag);
|
11556
11570
|
return;
|