marko 6.0.153 → 6.0.154
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 +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +3 -5
- package/dist/debug/html.mjs +3 -5
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/html.js +5 -5
- package/dist/html.mjs +5 -5
- package/dist/translator/index.js +32 -30
- package/dist/translator/util/known-tag.d.ts +0 -1
- package/package.json +3 -2
package/dist/debug/dom.js
CHANGED
|
@@ -720,8 +720,8 @@ function walk(startNode, walkCodes, branch) {
|
|
|
720
720
|
}
|
|
721
721
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
722
722
|
let value;
|
|
723
|
+
let currentMultiplier;
|
|
723
724
|
let storedMultiplier = 0;
|
|
724
|
-
let currentMultiplier = 0;
|
|
725
725
|
let currentScopeIndex = 0;
|
|
726
726
|
for (; currentWalkIndex < walkCodes.length; ) {
|
|
727
727
|
value = walkCodes.charCodeAt(currentWalkIndex++);
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -606,8 +606,8 @@ function walk(startNode, walkCodes, branch) {
|
|
|
606
606
|
}
|
|
607
607
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
608
608
|
let value;
|
|
609
|
+
let currentMultiplier;
|
|
609
610
|
let storedMultiplier = 0;
|
|
610
|
-
let currentMultiplier = 0;
|
|
611
611
|
let currentScopeIndex = 0;
|
|
612
612
|
for (; currentWalkIndex < walkCodes.length; ) {
|
|
613
613
|
value = walkCodes.charCodeAt(currentWalkIndex++);
|
package/dist/debug/html.js
CHANGED
|
@@ -782,7 +782,7 @@ function getRegistered(val) {
|
|
|
782
782
|
function writeRoot(state, root) {
|
|
783
783
|
const { buf } = state;
|
|
784
784
|
const hadBuf = buf.length !== 0;
|
|
785
|
-
let result
|
|
785
|
+
let result;
|
|
786
786
|
if (hadBuf) {
|
|
787
787
|
buf.push(",");
|
|
788
788
|
}
|
|
@@ -1238,7 +1238,7 @@ function writeSet(state, val, ref) {
|
|
|
1238
1238
|
return true;
|
|
1239
1239
|
}
|
|
1240
1240
|
function writeArrayBuffer(state, val) {
|
|
1241
|
-
let result
|
|
1241
|
+
let result;
|
|
1242
1242
|
if (val.byteLength) {
|
|
1243
1243
|
const view = new Int8Array(val);
|
|
1244
1244
|
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
@@ -1380,7 +1380,6 @@ function writeRequest(state, val, ref) {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
if (val.referrerPolicy) {
|
|
1382
1382
|
options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0);
|
|
1383
|
-
sep = ",";
|
|
1384
1383
|
}
|
|
1385
1384
|
state.buf.push(
|
|
1386
1385
|
hasBody ? options + "})" : options ? ",{" + options + "})" : ")"
|
|
@@ -1402,7 +1401,6 @@ function writeResponse(state, val, ref) {
|
|
|
1402
1401
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
|
|
1403
1402
|
if (headers) {
|
|
1404
1403
|
options += sep + "headers:{" + headers + "}";
|
|
1405
|
-
sep = ",";
|
|
1406
1404
|
}
|
|
1407
1405
|
if (!val.body || val.bodyUsed) {
|
|
1408
1406
|
state.buf.push(
|
|
@@ -3192,7 +3190,7 @@ var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
3192
3190
|
}
|
|
3193
3191
|
const state = getState();
|
|
3194
3192
|
const branchId = _peek_scope_id();
|
|
3195
|
-
let rendered
|
|
3193
|
+
let rendered;
|
|
3196
3194
|
let result;
|
|
3197
3195
|
if (typeof renderer === "string") {
|
|
3198
3196
|
if (true) {
|
package/dist/debug/html.mjs
CHANGED
|
@@ -689,7 +689,7 @@ function getRegistered(val) {
|
|
|
689
689
|
function writeRoot(state, root) {
|
|
690
690
|
const { buf } = state;
|
|
691
691
|
const hadBuf = buf.length !== 0;
|
|
692
|
-
let result
|
|
692
|
+
let result;
|
|
693
693
|
if (hadBuf) {
|
|
694
694
|
buf.push(",");
|
|
695
695
|
}
|
|
@@ -1145,7 +1145,7 @@ function writeSet(state, val, ref) {
|
|
|
1145
1145
|
return true;
|
|
1146
1146
|
}
|
|
1147
1147
|
function writeArrayBuffer(state, val) {
|
|
1148
|
-
let result
|
|
1148
|
+
let result;
|
|
1149
1149
|
if (val.byteLength) {
|
|
1150
1150
|
const view = new Int8Array(val);
|
|
1151
1151
|
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
@@ -1287,7 +1287,6 @@ function writeRequest(state, val, ref) {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
if (val.referrerPolicy) {
|
|
1289
1289
|
options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0);
|
|
1290
|
-
sep = ",";
|
|
1291
1290
|
}
|
|
1292
1291
|
state.buf.push(
|
|
1293
1292
|
hasBody ? options + "})" : options ? ",{" + options + "})" : ")"
|
|
@@ -1309,7 +1308,6 @@ function writeResponse(state, val, ref) {
|
|
|
1309
1308
|
state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
|
|
1310
1309
|
if (headers) {
|
|
1311
1310
|
options += sep + "headers:{" + headers + "}";
|
|
1312
|
-
sep = ",";
|
|
1313
1311
|
}
|
|
1314
1312
|
if (!val.body || val.bodyUsed) {
|
|
1315
1313
|
state.buf.push(
|
|
@@ -3099,7 +3097,7 @@ var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
3099
3097
|
}
|
|
3100
3098
|
const state = getState();
|
|
3101
3099
|
const branchId = _peek_scope_id();
|
|
3102
|
-
let rendered
|
|
3100
|
+
let rendered;
|
|
3103
3101
|
let result;
|
|
3104
3102
|
if (typeof renderer === "string") {
|
|
3105
3103
|
if (true) {
|
package/dist/dom.js
CHANGED
|
@@ -447,7 +447,7 @@ function walk(startNode, walkCodes, branch) {
|
|
|
447
447
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
|
448
448
|
}
|
|
449
449
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
450
|
-
let value,
|
|
450
|
+
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
451
451
|
for (; currentWalkIndex < walkCodes.length; )
|
|
452
452
|
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
|
453
453
|
let node = walker.currentNode;
|
package/dist/dom.mjs
CHANGED
|
@@ -336,7 +336,7 @@ function walk(startNode, walkCodes, branch) {
|
|
|
336
336
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
|
337
337
|
}
|
|
338
338
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
339
|
-
let value,
|
|
339
|
+
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
340
340
|
for (; currentWalkIndex < walkCodes.length; )
|
|
341
341
|
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
|
342
342
|
let node = walker.currentNode;
|
package/dist/html.js
CHANGED
|
@@ -542,7 +542,7 @@ function getRegistered(val) {
|
|
|
542
542
|
return { id: registered.id, scope: registered.scope };
|
|
543
543
|
}
|
|
544
544
|
function writeRoot(state, root) {
|
|
545
|
-
let { buf } = state, hadBuf = buf.length !== 0, result
|
|
545
|
+
let { buf } = state, hadBuf = buf.length !== 0, result;
|
|
546
546
|
if (hadBuf && buf.push(","), writeProp(state, root, null, "")) {
|
|
547
547
|
let rootRef = state.refs.get(root);
|
|
548
548
|
if (rootRef) {
|
|
@@ -836,7 +836,7 @@ function writeSet(state, val, ref) {
|
|
|
836
836
|
), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
|
|
837
837
|
}
|
|
838
838
|
function writeArrayBuffer(state, val) {
|
|
839
|
-
let result
|
|
839
|
+
let result;
|
|
840
840
|
if (val.byteLength) {
|
|
841
841
|
let view = new Int8Array(val);
|
|
842
842
|
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
@@ -887,7 +887,7 @@ function writeRequest(state, val, ref) {
|
|
|
887
887
|
let options = "";
|
|
888
888
|
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
889
889
|
let headers = stringEntriesToProps(val.headers);
|
|
890
|
-
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}", sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)
|
|
890
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}", sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(
|
|
891
891
|
hasBody ? options + "})" : options ? ",{" + options + "})" : ")"
|
|
892
892
|
), !0;
|
|
893
893
|
}
|
|
@@ -895,7 +895,7 @@ function writeResponse(state, val, ref) {
|
|
|
895
895
|
let sep = "", options = "";
|
|
896
896
|
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
897
897
|
let headers = stringEntriesToProps(val.headers);
|
|
898
|
-
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}"
|
|
898
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}"), !val.body || val.bodyUsed ? state.buf.push(
|
|
899
899
|
"new Response" + (options ? "(null,{" + options + "})" : "")
|
|
900
900
|
) : (state.buf.push("new Response("), state.buf.push(
|
|
901
901
|
(writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")")
|
|
@@ -2008,7 +2008,7 @@ var RENDERER_REGISTER_ID = "$C_r", SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_I
|
|
|
2008
2008
|
|
|
2009
2009
|
// src/html/dynamic-tag.ts
|
|
2010
2010
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
2011
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered
|
|
2011
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
2012
2012
|
if (typeof renderer == "string") {
|
|
2013
2013
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
2014
2014
|
if (rendered = !0, _scope_id(), _html(
|
package/dist/html.mjs
CHANGED
|
@@ -452,7 +452,7 @@ function getRegistered(val) {
|
|
|
452
452
|
return { id: registered.id, scope: registered.scope };
|
|
453
453
|
}
|
|
454
454
|
function writeRoot(state, root) {
|
|
455
|
-
let { buf } = state, hadBuf = buf.length !== 0, result
|
|
455
|
+
let { buf } = state, hadBuf = buf.length !== 0, result;
|
|
456
456
|
if (hadBuf && buf.push(","), writeProp(state, root, null, "")) {
|
|
457
457
|
let rootRef = state.refs.get(root);
|
|
458
458
|
if (rootRef) {
|
|
@@ -746,7 +746,7 @@ function writeSet(state, val, ref) {
|
|
|
746
746
|
), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
|
|
747
747
|
}
|
|
748
748
|
function writeArrayBuffer(state, val) {
|
|
749
|
-
let result
|
|
749
|
+
let result;
|
|
750
750
|
if (val.byteLength) {
|
|
751
751
|
let view = new Int8Array(val);
|
|
752
752
|
result = hasOnlyZeros(view) ? "new ArrayBuffer(" + val.byteLength + ")" : "new Int8Array(" + typedArrayToInitString(view) + ").buffer";
|
|
@@ -797,7 +797,7 @@ function writeRequest(state, val, ref) {
|
|
|
797
797
|
let options = "";
|
|
798
798
|
val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
|
|
799
799
|
let headers = stringEntriesToProps(val.headers);
|
|
800
|
-
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}", sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)
|
|
800
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}", sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(
|
|
801
801
|
hasBody ? options + "})" : options ? ",{" + options + "})" : ")"
|
|
802
802
|
), !0;
|
|
803
803
|
}
|
|
@@ -805,7 +805,7 @@ function writeResponse(state, val, ref) {
|
|
|
805
805
|
let sep = "", options = "";
|
|
806
806
|
val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
|
|
807
807
|
let headers = stringEntriesToProps(val.headers);
|
|
808
|
-
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}"
|
|
808
|
+
return state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null)), headers && (options += sep + "headers:{" + headers + "}"), !val.body || val.bodyUsed ? state.buf.push(
|
|
809
809
|
"new Response" + (options ? "(null,{" + options + "})" : "")
|
|
810
810
|
) : (state.buf.push("new Response("), state.buf.push(
|
|
811
811
|
(writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")")
|
|
@@ -1918,7 +1918,7 @@ var RENDERER_REGISTER_ID = "$C_r", SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_I
|
|
|
1918
1918
|
|
|
1919
1919
|
// src/html/dynamic-tag.ts
|
|
1920
1920
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
1921
|
-
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered
|
|
1921
|
+
let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
|
|
1922
1922
|
if (typeof renderer == "string") {
|
|
1923
1923
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
1924
1924
|
if (rendered = !0, _scope_id(), _html(
|
package/dist/translator/index.js
CHANGED
|
@@ -9388,7 +9388,7 @@ function createSources(state, param) {
|
|
|
9388
9388
|
return { state, param };
|
|
9389
9389
|
}
|
|
9390
9390
|
function compareSources(a, b) {
|
|
9391
|
-
let delta
|
|
9391
|
+
let delta;
|
|
9392
9392
|
if (a.param) {
|
|
9393
9393
|
if (!b.param) return 1;
|
|
9394
9394
|
if (delta = compareReferences(a.param, b.param)) return delta;
|
|
@@ -9775,21 +9775,21 @@ function findClosestReference(from, refs) {
|
|
|
9775
9775
|
return from;
|
|
9776
9776
|
}
|
|
9777
9777
|
for (const ref of refs) {
|
|
9778
|
-
const
|
|
9779
|
-
if (
|
|
9778
|
+
const closest2 = findClosestUpstream(from, ref);
|
|
9779
|
+
if (closest2) return closest2;
|
|
9780
9780
|
}
|
|
9781
9781
|
} else {
|
|
9782
|
-
const
|
|
9783
|
-
if (
|
|
9782
|
+
const closest2 = findClosestUpstream(from, refs);
|
|
9783
|
+
if (closest2) return closest2;
|
|
9784
9784
|
}
|
|
9785
9785
|
}
|
|
9786
9786
|
function findClosestUpstream(from, to) {
|
|
9787
|
-
let
|
|
9787
|
+
let closest2 = from;
|
|
9788
9788
|
do {
|
|
9789
|
-
if (
|
|
9790
|
-
return
|
|
9789
|
+
if (closest2 === to) {
|
|
9790
|
+
return closest2;
|
|
9791
9791
|
}
|
|
9792
|
-
} while (
|
|
9792
|
+
} while (closest2 = closest2.upstreamAlias);
|
|
9793
9793
|
}
|
|
9794
9794
|
function getRootBindings(reads) {
|
|
9795
9795
|
let rootRefs;
|
|
@@ -12396,22 +12396,13 @@ var attribute_tag_default = {
|
|
|
12396
12396
|
// src/translator/visitors/tag/custom-tag.ts
|
|
12397
12397
|
var import_compiler61 = require("@marko/compiler");
|
|
12398
12398
|
var import_babel_utils49 = require("@marko/compiler/babel-utils");
|
|
12399
|
+
var import_fastest_levenshtein = require("fastest-levenshtein");
|
|
12399
12400
|
var import_path4 = __toESM(require("path"));
|
|
12400
12401
|
var custom_tag_default = {
|
|
12401
12402
|
analyze: {
|
|
12402
12403
|
enter(tag) {
|
|
12403
12404
|
const templateFile = (0, import_babel_utils49.getTagTemplate)(tag);
|
|
12404
|
-
if (!templateFile)
|
|
12405
|
-
const tagName = getTagName(tag);
|
|
12406
|
-
if (tagName && tag.scope.hasBinding(tagName)) {
|
|
12407
|
-
throw tag.get("name").buildCodeFrameError(
|
|
12408
|
-
`Local variables must be in a [dynamic tag](https://markojs.com/docs/reference/language#dynamic-tags) unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
|
|
12409
|
-
);
|
|
12410
|
-
}
|
|
12411
|
-
throw tag.get("name").buildCodeFrameError(
|
|
12412
|
-
`Unable to find entry point for [custom tag](https://markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.`
|
|
12413
|
-
);
|
|
12414
|
-
}
|
|
12405
|
+
if (!templateFile) throw tagNotFoundError(tag);
|
|
12415
12406
|
(0, import_babel_utils49.assertAttributesOrSingleArg)(tag);
|
|
12416
12407
|
const childFile = (0, import_babel_utils49.loadFileForTag)(tag);
|
|
12417
12408
|
if (!childFile) {
|
|
@@ -12542,18 +12533,29 @@ function getTagRelativePath(tag) {
|
|
|
12542
12533
|
} else if (node.extra?.tagNameImported) {
|
|
12543
12534
|
relativePath = node.extra.tagNameImported;
|
|
12544
12535
|
}
|
|
12545
|
-
if (!relativePath)
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
`Unable to find entry point for [custom tag](https://markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.`
|
|
12536
|
+
if (!relativePath) throw tagNotFoundError(tag);
|
|
12537
|
+
return relativePath;
|
|
12538
|
+
}
|
|
12539
|
+
function tagNotFoundError(tag) {
|
|
12540
|
+
const tagName = getTagName(tag);
|
|
12541
|
+
if (tagName && tag.scope.hasBinding(tagName)) {
|
|
12542
|
+
return tag.get("name").buildCodeFrameError(
|
|
12543
|
+
`Local variables must be in a [dynamic tag](https://markojs.com/docs/reference/language#dynamic-tags) unless they are PascalCase. Use \`<\${${tagName}}/>\` or rename to \`${tagName.charAt(0).toUpperCase() + tagName.slice(1)}\`.`
|
|
12554
12544
|
);
|
|
12555
12545
|
}
|
|
12556
|
-
|
|
12546
|
+
let didYouMean = "";
|
|
12547
|
+
if (tagName) {
|
|
12548
|
+
const closestTag = (0, import_fastest_levenshtein.closest)(
|
|
12549
|
+
tagName,
|
|
12550
|
+
Object.keys(tag.state.file.___taglibLookup.merged.tags)
|
|
12551
|
+
);
|
|
12552
|
+
if ((0, import_fastest_levenshtein.distance)(tagName, closestTag) < 4) {
|
|
12553
|
+
didYouMean = ` Did you mean \`<${closestTag}>\`?`;
|
|
12554
|
+
}
|
|
12555
|
+
}
|
|
12556
|
+
return tag.get("name").buildCodeFrameError(
|
|
12557
|
+
`Unable to find entry point for [custom tag](https://markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.${didYouMean}`
|
|
12558
|
+
);
|
|
12557
12559
|
}
|
|
12558
12560
|
function importOrSelfReferenceName(file, request, name2, nameHint) {
|
|
12559
12561
|
if (isCircularRequest(file, request)) {
|
|
@@ -21,6 +21,5 @@ declare module "@marko/compiler/dist/types" {
|
|
|
21
21
|
export declare function knownTagAnalyze(tag: t.NodePath<t.MarkoTag>, contentSection: Section, propTree: BindingPropTree | undefined): void;
|
|
22
22
|
export declare function knownTagTranslateHTML(tag: t.NodePath<t.MarkoTag>, tagIdentifier: t.Expression, contentSection: Section, propTree: BindingPropTree | undefined): void;
|
|
23
23
|
export declare function knownTagTranslateDOM(tag: t.NodePath<t.MarkoTag>, propTree: BindingPropTree | undefined, getBindingIdentifier: (binding: Binding, preferedName?: string) => t.Identifier, callSetup: (section: Section, childBinding: Binding) => void): void;
|
|
24
|
-
export declare function getTagRelativePath(tag: t.NodePath<t.MarkoTag>): string;
|
|
25
24
|
export declare function finalizeKnownTags(section: Section): void;
|
|
26
25
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.154",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"build": "node -r ~ts ./scripts/bundle.ts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@marko/compiler": "^5.39.
|
|
51
|
+
"@marko/compiler": "^5.39.59",
|
|
52
52
|
"csstype": "^3.2.3",
|
|
53
|
+
"fastest-levenshtein": "^1.0.16",
|
|
53
54
|
"magic-string": "^0.30.21"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|