marko 6.4.2 → 6.4.4
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/cheatsheet.md +2 -2
- package/dist/common/constants/accessor-prop.d.ts +1 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +1 -0
- package/dist/common/constants/renderer-prop.d.ts +2 -0
- package/dist/common/constants/renderer-prop.debug.d.ts +2 -0
- package/dist/common/types.d.ts +1 -0
- package/dist/debug/dom/catch.feat.js +1 -1
- package/dist/debug/dom/catch.feat.mjs +1 -1
- package/dist/debug/dom/controllable-input.feat.js +1 -1
- package/dist/debug/dom/controllable-input.feat.mjs +1 -1
- package/dist/debug/dom/controllable-open.feat.js +1 -1
- package/dist/debug/dom/controllable-open.feat.mjs +1 -1
- package/dist/debug/dom/controllable-select.feat.js +1 -1
- package/dist/debug/dom/controllable-select.feat.mjs +1 -1
- package/dist/debug/dom/controllable-textarea.feat.js +1 -1
- package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/debug/dom/controllable.feat.js +1 -1
- package/dist/debug/dom/controllable.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
- package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/debug/dom/dynamic-tag-var.feat.js +10 -2
- package/dist/debug/dom/dynamic-tag-var.feat.mjs +10 -2
- package/dist/debug/dom/lazy.feat.js +1 -1
- package/dist/debug/dom/lazy.feat.mjs +1 -1
- package/dist/debug/dom/placeholder.feat.js +1 -1
- package/dist/debug/dom/placeholder.feat.mjs +1 -1
- package/dist/debug/{dom-Cii0IA92.mjs → dom-BeY1nGUb.mjs} +74 -36
- package/dist/debug/{dom-BLbR0hEx.js → dom-CUxvM4i9.js} +109 -35
- package/dist/debug/dom.js +3 -1
- package/dist/debug/dom.mjs +3 -2
- package/dist/debug/html.js +37 -23
- package/dist/debug/html.mjs +37 -23
- package/dist/dom/catch.feat.js +3 -3
- package/dist/dom/catch.feat.mjs +1 -1
- package/dist/dom/control-flow.d.ts +3 -3
- package/dist/dom/controllable-input.feat.js +1 -1
- package/dist/dom/controllable-input.feat.mjs +1 -1
- package/dist/dom/controllable-open.feat.js +1 -1
- package/dist/dom/controllable-open.feat.mjs +1 -1
- package/dist/dom/controllable-select.feat.js +1 -1
- package/dist/dom/controllable-select.feat.mjs +1 -1
- package/dist/dom/controllable-textarea.feat.js +1 -1
- package/dist/dom/controllable-textarea.feat.mjs +1 -1
- package/dist/dom/controllable.feat.js +1 -1
- package/dist/dom/controllable.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-script.feat.js +2 -2
- package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
- package/dist/dom/dynamic-tag-var.feat.js +4 -2
- package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
- package/dist/dom/lazy.feat.js +1 -1
- package/dist/dom/lazy.feat.mjs +1 -1
- package/dist/dom/placeholder.feat.js +3 -3
- package/dist/dom/placeholder.feat.mjs +1 -1
- package/dist/dom/queue.d.ts +4 -1
- package/dist/dom/renderer.d.ts +9 -2
- package/dist/{dom-BPjLe6YU.mjs → dom-DefWmvQB.mjs} +59 -32
- package/dist/{dom-B8UEYzOz.js → dom-Diu8MpmL.js} +132 -90
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +30 -30
- package/dist/dom.mjs +2 -2
- package/dist/html/assets.d.ts +1 -1
- package/dist/html/content.d.ts +1 -0
- package/dist/html/dynamic-tag.d.ts +1 -1
- package/dist/html/template.d.ts +1 -0
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +25 -15
- package/dist/html.mjs +25 -15
- package/dist/translator/index.js +141 -83
- package/dist/translator/util/module-registrations.d.ts +1 -1
- package/dist/translator/util/solve-reasons.d.ts +1 -0
- package/dist/translator/visitors/function.d.ts +15 -10
- package/dist/translator/visitors/import-declaration.d.ts +3 -4
- package/package.json +3 -3
- package/tags-html.d.ts +9 -7
package/dist/translator/index.js
CHANGED
|
@@ -156,6 +156,7 @@ var accessor_prop_debug_exports = /* @__PURE__ */ __exportAll({
|
|
|
156
156
|
AbortScopes: () => AbortScopes$1,
|
|
157
157
|
AwaitCounter: () => AwaitCounter$1,
|
|
158
158
|
BranchAccessor: () => BranchAccessor$1,
|
|
159
|
+
BranchRenders: () => BranchRenders$1,
|
|
159
160
|
BranchScopes: () => BranchScopes$2,
|
|
160
161
|
CatchContent: () => CatchContent$1,
|
|
161
162
|
ClosestBranch: () => ClosestBranch$1,
|
|
@@ -189,6 +190,7 @@ const AbortControllers$1 = "#AbortControllers";
|
|
|
189
190
|
const AbortScopes$1 = "#AbortScopes";
|
|
190
191
|
const AwaitCounter$1 = "#AwaitCounter";
|
|
191
192
|
const BranchAccessor$1 = "#BranchAccessor";
|
|
193
|
+
const BranchRenders$1 = "#BranchRenders";
|
|
192
194
|
const BranchScopes$2 = "#BranchScopes";
|
|
193
195
|
const CatchContent$1 = "#CatchContent";
|
|
194
196
|
const ClosestBranch$1 = "#ClosestBranch";
|
|
@@ -953,7 +955,7 @@ function createSectionState(key, init) {
|
|
|
953
955
|
//#region src/translator/visitors/function.ts
|
|
954
956
|
const kRegisteredExports = Symbol("registered exports");
|
|
955
957
|
const [getReferencesByFn] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
956
|
-
const [
|
|
958
|
+
const [getReferencesByImport] = createProgramState(() => /* @__PURE__ */ new Map());
|
|
957
959
|
var function_default = { analyze(fn) {
|
|
958
960
|
const awaitNode = isMarkoAttribute(fn.parentPath) && _marko_compiler.types.isFunctionExpression(fn.node) && !fn.node.async && traverseFindAwait(fn.node.body);
|
|
959
961
|
if (awaitNode) {
|
|
@@ -987,24 +989,45 @@ function resolveFunctionReason() {
|
|
|
987
989
|
}
|
|
988
990
|
function finalizeFunctionRegistry() {
|
|
989
991
|
for (const fnExtra of getReferencesByFn().keys()) if (fnExtra.reason) registerFunction(fnExtra);
|
|
990
|
-
for (const [
|
|
992
|
+
for (const [{ node, local, registered, fnRoots }, exprExtras] of getReferencesByImport()) {
|
|
993
|
+
const reason = fnRoots ? resolveTemplateReason(exprExtras) : resolveReason(exprExtras);
|
|
994
|
+
if (reason) {
|
|
995
|
+
if (!fnRoots || !isTemplateShipped(fnRoots, exprExtras)) {
|
|
996
|
+
const extra = node.extra ??= {};
|
|
997
|
+
extra.registeredImports ??= /* @__PURE__ */ new Map();
|
|
998
|
+
extra.registeredImports.set(local, registered);
|
|
999
|
+
}
|
|
1000
|
+
markRegistrationInteractive(reason);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
991
1003
|
}
|
|
992
1004
|
/**
|
|
993
|
-
* Tracks a
|
|
994
|
-
*
|
|
1005
|
+
* Tracks a template imported as a default export. The server writes a template
|
|
1006
|
+
* only as a binding's value, so the importing template registers it when one may.
|
|
1007
|
+
*/
|
|
1008
|
+
function trackImportedTemplate(importDecl, local, templateFile) {
|
|
1009
|
+
trackImport(importDecl, local, {
|
|
1010
|
+
registerId: templateFile.metadata.marko.id,
|
|
1011
|
+
exportName: "default",
|
|
1012
|
+
filename: templateFile.opts.filename
|
|
1013
|
+
}, /* @__PURE__ */ new Set());
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Tracks an export imported from another template that registers under an id,
|
|
1017
|
+
* if it does. The importing template registers it (under that id) when client
|
|
995
1018
|
* code reads its own references.
|
|
996
1019
|
*/
|
|
997
|
-
function
|
|
998
|
-
const binding = importDecl.scope.getBinding(local);
|
|
1020
|
+
function trackImport(importDecl, local, registered, fnRoots) {
|
|
1021
|
+
const binding = registered && importDecl.scope.getBinding(local);
|
|
999
1022
|
if (!binding) return;
|
|
1000
|
-
const importedFn = {
|
|
1001
|
-
...resolved,
|
|
1002
|
-
node: importDecl.node,
|
|
1003
|
-
local
|
|
1004
|
-
};
|
|
1005
1023
|
const refs = /* @__PURE__ */ new Set();
|
|
1006
|
-
addBindingRefs(binding, refs, /* @__PURE__ */ new Set());
|
|
1007
|
-
if (refs.size)
|
|
1024
|
+
addBindingRefs(binding, refs, /* @__PURE__ */ new Set(), fnRoots);
|
|
1025
|
+
if (refs.size) getReferencesByImport().set({
|
|
1026
|
+
node: importDecl.node,
|
|
1027
|
+
local,
|
|
1028
|
+
registered,
|
|
1029
|
+
fnRoots
|
|
1030
|
+
}, refs);
|
|
1008
1031
|
}
|
|
1009
1032
|
/**
|
|
1010
1033
|
* Finds the id reserved for an export, following `export ... from` hops. Each
|
|
@@ -1013,15 +1036,11 @@ function trackImportedFn(importDecl, local, resolved) {
|
|
|
1013
1036
|
* hand out an incomplete map if the ids were pushed ahead of time.
|
|
1014
1037
|
*/
|
|
1015
1038
|
function resolveRegisteredExport(file, exportName, seen = /* @__PURE__ */ new Set()) {
|
|
1016
|
-
const
|
|
1017
|
-
const key = `${filename}\0${exportName}`;
|
|
1039
|
+
const key = `${file.opts.filename}\0${exportName}`;
|
|
1018
1040
|
if (seen.has(key)) return;
|
|
1019
1041
|
seen.add(key);
|
|
1020
|
-
const
|
|
1021
|
-
if (
|
|
1022
|
-
...reserved,
|
|
1023
|
-
filename
|
|
1024
|
-
};
|
|
1042
|
+
const registered = file.ast.program.extra?.[kRegisteredExports]?.get(exportName);
|
|
1043
|
+
if (registered) return registered;
|
|
1025
1044
|
for (const child of file.ast.program.body) {
|
|
1026
1045
|
if (child.type !== "ExportNamedDeclaration" && child.type !== "ExportAllDeclaration" || !child.source || (child.exportKind || "value") !== "value") continue;
|
|
1027
1046
|
const sourceFile = (0, _marko_compiler_babel_utils.loadFileForImport)(file, child.source.value);
|
|
@@ -1046,11 +1065,21 @@ function resolveReason(exprExtras) {
|
|
|
1046
1065
|
}
|
|
1047
1066
|
return reason;
|
|
1048
1067
|
}
|
|
1049
|
-
function
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1068
|
+
function resolveTemplateReason(exprExtras) {
|
|
1069
|
+
let reason;
|
|
1070
|
+
for (const exprExtra of exprExtras) {
|
|
1071
|
+
const extra = getCanonicalExtra(exprExtra);
|
|
1072
|
+
if (!extra.isEffect) reason = mergeReasons(reason, getReasonForExpr(extra));
|
|
1073
|
+
}
|
|
1074
|
+
return reason;
|
|
1075
|
+
}
|
|
1076
|
+
function isTemplateShipped(fnRoots, exprExtras) {
|
|
1077
|
+
for (const fnRoot of fnRoots) if (isRegisteredFnExtra(fnRoot)) return true;
|
|
1078
|
+
for (const exprExtra of exprExtras) if (getCanonicalExtra(exprExtra).isEffect) return true;
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
function markRegistrationInteractive(reason) {
|
|
1082
|
+
(0, _marko_compiler_babel_utils.getProgram)().node.extra.isInteractive ||= isUnconditionalReason(reason);
|
|
1054
1083
|
}
|
|
1055
1084
|
function reserveExportRegisterId(fnExtra, fn, markoRoot) {
|
|
1056
1085
|
if (!isStatic(markoRoot)) return;
|
|
@@ -1060,12 +1089,14 @@ function reserveExportRegisterId(fnExtra, fn, markoRoot) {
|
|
|
1060
1089
|
const { markoOpts, opts: { filename } } = (0, _marko_compiler_babel_utils.getFile)();
|
|
1061
1090
|
const programExtra = (0, _marko_compiler_babel_utils.getProgram)().node.extra;
|
|
1062
1091
|
const registerId = (0, _marko_compiler_babel_utils.getTemplateId)(markoOpts, filename, `${fnExtra.section.id}/export/${exportName}`);
|
|
1092
|
+
const registered = {
|
|
1093
|
+
registerId,
|
|
1094
|
+
exportName,
|
|
1095
|
+
filename
|
|
1096
|
+
};
|
|
1063
1097
|
fnExtra.exportRegisterId = registerId;
|
|
1064
1098
|
programExtra[kRegisteredExports] ??= /* @__PURE__ */ new Map();
|
|
1065
|
-
for (const name of exportNames) programExtra[kRegisteredExports].set(name,
|
|
1066
|
-
registerId,
|
|
1067
|
-
exportName
|
|
1068
|
-
});
|
|
1099
|
+
for (const name of exportNames) programExtra[kRegisteredExports].set(name, registered);
|
|
1069
1100
|
}
|
|
1070
1101
|
function getExportNames(fn, markoRoot) {
|
|
1071
1102
|
const localName = getExportableName(fn);
|
|
@@ -1093,31 +1124,35 @@ function getExportedName(specifier) {
|
|
|
1093
1124
|
function canIgnoreRegister(markoRoot, exprRoot) {
|
|
1094
1125
|
return markoRoot.isMarkoPlaceholder() || markoRoot.isMarkoScriptlet() && (!markoRoot.node.static || markoRoot.node.target === "server") || markoRoot.isMarkoTag() && markoRoot.node.name == exprRoot.node;
|
|
1095
1126
|
}
|
|
1096
|
-
function getStaticDeclRefs(path, refs = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set()) {
|
|
1127
|
+
function getStaticDeclRefs(path, refs = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set(), fnRoots) {
|
|
1097
1128
|
const decl = getDeclarationRoot(path);
|
|
1098
1129
|
if (decl && !seen.has(decl.node)) {
|
|
1099
1130
|
seen.add(decl.node);
|
|
1100
1131
|
const ids = decl.getOuterBindingIdentifiers();
|
|
1101
1132
|
if (ids) for (const name in ids) {
|
|
1102
1133
|
const binding = decl.scope.getBinding(name);
|
|
1103
|
-
if (binding) addBindingRefs(binding, refs, seen);
|
|
1134
|
+
if (binding) addBindingRefs(binding, refs, seen, fnRoots);
|
|
1104
1135
|
}
|
|
1105
1136
|
}
|
|
1106
1137
|
return refs;
|
|
1107
1138
|
}
|
|
1108
|
-
function addBindingRefs(binding, refs, seen) {
|
|
1139
|
+
function addBindingRefs(binding, refs, seen, fnRoots) {
|
|
1109
1140
|
for (const ref of binding.referencePaths) {
|
|
1110
1141
|
if (isInvokedFunction(ref) || ref.parentPath.type === "Program") continue;
|
|
1111
1142
|
const exprRoot = getExprRoot(ref);
|
|
1112
1143
|
const markoRoot = getMarkoRoot(exprRoot);
|
|
1113
1144
|
if (!markoRoot || canIgnoreRegister(markoRoot, exprRoot)) continue;
|
|
1114
|
-
if (
|
|
1145
|
+
if (fnRoots) {
|
|
1146
|
+
const fnRoot = getFnRoot(ref);
|
|
1147
|
+
if (fnRoot) fnRoots.add(fnRoot.node.extra ??= {});
|
|
1148
|
+
}
|
|
1149
|
+
if (isStatic(markoRoot)) getStaticDeclRefs(ref, refs, seen, fnRoots);
|
|
1115
1150
|
else refs.add(exprRoot.node.extra ??= {});
|
|
1116
1151
|
}
|
|
1117
1152
|
}
|
|
1118
1153
|
function registerFunction(fnExtra) {
|
|
1119
|
-
const { markoOpts,
|
|
1120
|
-
|
|
1154
|
+
const { markoOpts, opts: { filename } } = (0, _marko_compiler_babel_utils.getFile)();
|
|
1155
|
+
markRegistrationInteractive(fnExtra.reason);
|
|
1121
1156
|
fnExtra.name = generateUid(fnExtra.name);
|
|
1122
1157
|
fnExtra.registerId = fnExtra.exportRegisterId ?? (0, _marko_compiler_babel_utils.getTemplateId)(markoOpts, filename, `${fnExtra.section.id}/${fnExtra.name.slice(1)}`);
|
|
1123
1158
|
}
|
|
@@ -1591,7 +1626,7 @@ function _escape(val) {
|
|
|
1591
1626
|
return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
|
|
1592
1627
|
}
|
|
1593
1628
|
const unsafeScriptReg = /<(\/?script|!--)/gi;
|
|
1594
|
-
const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\
|
|
1629
|
+
const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str;
|
|
1595
1630
|
function _escape_script(val) {
|
|
1596
1631
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
1597
1632
|
}
|
|
@@ -1660,6 +1695,7 @@ const pureDOMFunctions = /* @__PURE__ */ new Set([
|
|
|
1660
1695
|
"_dynamic_tag_content",
|
|
1661
1696
|
"_content_closures",
|
|
1662
1697
|
"_template",
|
|
1698
|
+
"_return_setup",
|
|
1663
1699
|
"_closure",
|
|
1664
1700
|
"_closure_get",
|
|
1665
1701
|
"_or",
|
|
@@ -1887,19 +1923,20 @@ function escapeRegExp(str) {
|
|
|
1887
1923
|
/**
|
|
1888
1924
|
* Writes the registrations for module scoped functions: the ones this template
|
|
1889
1925
|
* exports and registers itself, and the ones it imports from a template that
|
|
1890
|
-
* reserved a register id without registering it.
|
|
1926
|
+
* reserved a register id without registering it; and for templates it imports.
|
|
1891
1927
|
*/
|
|
1892
1928
|
function writeModuleRegistrations(program) {
|
|
1893
1929
|
const file = (0, _marko_compiler_babel_utils.getFile)();
|
|
1894
1930
|
const statements = [];
|
|
1895
1931
|
const seen = /* @__PURE__ */ new Set();
|
|
1896
1932
|
for (const child of program.node.body) {
|
|
1897
|
-
const
|
|
1898
|
-
if (
|
|
1899
|
-
if (seen.has(
|
|
1900
|
-
seen.add(
|
|
1901
|
-
if (isOutputHTML())
|
|
1902
|
-
|
|
1933
|
+
const registeredImports = _marko_compiler.types.isImportDeclaration(child) && child.extra?.registeredImports;
|
|
1934
|
+
if (registeredImports) for (const [local, registered] of registeredImports) {
|
|
1935
|
+
if (seen.has(registered.registerId)) continue;
|
|
1936
|
+
seen.add(registered.registerId);
|
|
1937
|
+
if (isOutputHTML()) {
|
|
1938
|
+
if (registered.exportName !== "default") statements.push(buildRegistration(local, registered.registerId));
|
|
1939
|
+
} else (0, _marko_compiler_babel_utils.importDefault)(file, resolveRegisterModule(file, registered));
|
|
1903
1940
|
}
|
|
1904
1941
|
else if (child.type === "ExportNamedDeclaration") addExportRegistrations(child, seen, statements);
|
|
1905
1942
|
}
|
|
@@ -1930,7 +1967,7 @@ function resolveRegisterModule(file, { filename, exportName, registerId }) {
|
|
|
1930
1967
|
const importer = file.opts.filename;
|
|
1931
1968
|
return getMarkoOpts().resolveVirtualDependency(importer, {
|
|
1932
1969
|
virtualPath: `${relativePath(importer, filename)}.register-${exportName}.js`,
|
|
1933
|
-
code: `import { ${exportName} } from "./${path.default.basename(filename)}";\nimport { _resumed } from "${getRuntimePath("dom")}";\n_resumed${isValidPropertyIdentifier(registerId) ? `.${registerId}` : `[${JSON.stringify(registerId)}]`} =
|
|
1970
|
+
code: `import { ${exportName} as value } from "./${path.default.basename(filename)}";\nimport { _resumed } from "${getRuntimePath("dom")}";\n_resumed${isValidPropertyIdentifier(registerId) ? `.${registerId}` : `[${JSON.stringify(registerId)}]`} = value;\n`
|
|
1934
1971
|
});
|
|
1935
1972
|
}
|
|
1936
1973
|
function relativePath(from, to) {
|
|
@@ -1965,6 +2002,7 @@ var accessor_prop_exports = /* @__PURE__ */ __exportAll({
|
|
|
1965
2002
|
AbortScopes: () => "B",
|
|
1966
2003
|
AwaitCounter: () => "O",
|
|
1967
2004
|
BranchAccessor: () => "C",
|
|
2005
|
+
BranchRenders: () => "BR",
|
|
1968
2006
|
BranchScopes: () => "D",
|
|
1969
2007
|
CatchContent: () => "E",
|
|
1970
2008
|
ClosestBranch: () => "F",
|
|
@@ -2153,7 +2191,7 @@ var import_declaration_default = {
|
|
|
2153
2191
|
if (tagImport) {
|
|
2154
2192
|
const tags = (0, _marko_compiler_babel_utils.getFile)().metadata.marko.tags;
|
|
2155
2193
|
if (!tags.includes(tagImport)) tags.push(tagImport);
|
|
2156
|
-
|
|
2194
|
+
trackRegisteredImports(importDecl);
|
|
2157
2195
|
}
|
|
2158
2196
|
const loadAttrPath = getLoadAttr(importDecl);
|
|
2159
2197
|
if (loadAttrPath) {
|
|
@@ -2194,7 +2232,9 @@ var import_declaration_default = {
|
|
|
2194
2232
|
} else if (binding.referencePaths.every((ref) => _marko_compiler.types.isMarkoTag(ref.parent) && ref.parent.extra?.tagNameLoad)) importDecl.remove();
|
|
2195
2233
|
else {
|
|
2196
2234
|
importRuntimeFeature("catch");
|
|
2197
|
-
|
|
2235
|
+
const load = _marko_compiler.types.arrowFunctionExpression([], dynamicImport((0, _marko_compiler_babel_utils.resolveRelativePath)(file, loadFile.opts.filename), _marko_compiler.types.arrowFunctionExpression([_marko_compiler.types.identifier("mod")], toMemberExpression(_marko_compiler.types.identifier("mod"), "default"))));
|
|
2236
|
+
const args = [_marko_compiler.types.stringLiteral(loadFile.metadata.marko.id), load];
|
|
2237
|
+
importDecl.replaceWith(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(local, extra.registeredImports?.has(local.name) ? _marko_compiler.types.callExpression(importRuntime("_load_template"), args) : callRuntime("_load_template", ...args))]));
|
|
2198
2238
|
}
|
|
2199
2239
|
return;
|
|
2200
2240
|
}
|
|
@@ -2226,17 +2266,19 @@ function getOrCreateHtmlLoadWrapped(readyId, originalIdentifier, filename, trigg
|
|
|
2226
2266
|
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.markoScriptlet([_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(_marko_compiler.types.identifier(wrappedName), callRuntime("withLoadAssets", originalIdentifier, (0, _marko_compiler_babel_utils.importNamed)((0, _marko_compiler_babel_utils.getFile)(), markoOpts.linkAssets.runtime, "flush"), _marko_compiler.types.stringLiteral(readyId), triggers ? _marko_compiler.types.valueToNode(triggers) : void 0))])], true));
|
|
2227
2267
|
return wrappedName;
|
|
2228
2268
|
}
|
|
2229
|
-
function
|
|
2269
|
+
function trackRegisteredImports(importDecl) {
|
|
2230
2270
|
const { node } = importDecl;
|
|
2231
2271
|
const childFile = (0, _marko_compiler_babel_utils.loadFileForImport)((0, _marko_compiler_babel_utils.getFile)(), node.source.value);
|
|
2232
2272
|
if (!childFile) return;
|
|
2233
2273
|
for (const specifier of importDecl.get("specifiers")) {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2274
|
+
let importedName = "default";
|
|
2275
|
+
if (specifier.isImportSpecifier()) {
|
|
2276
|
+
const { imported } = specifier.node;
|
|
2277
|
+
importedName = imported.type === "Identifier" ? imported.name : imported.value;
|
|
2278
|
+
} else if (!specifier.isImportDefaultSpecifier()) continue;
|
|
2279
|
+
const local = specifier.node.local.name;
|
|
2280
|
+
if (importedName === "default") trackImportedTemplate(importDecl, local, childFile);
|
|
2281
|
+
else trackImport(importDecl, local, resolveRegisteredExport(childFile, importedName));
|
|
2240
2282
|
}
|
|
2241
2283
|
}
|
|
2242
2284
|
function getLoadAttr(importDecl) {
|
|
@@ -4295,8 +4337,7 @@ var dom_default = { translate: {
|
|
|
4295
4337
|
let renderer = callRuntime("_content", _marko_compiler.types.stringLiteral(registerId), ...replaceNullishAndEmptyFunctionsWith0([
|
|
4296
4338
|
writes,
|
|
4297
4339
|
walks,
|
|
4298
|
-
setupIdentifier,
|
|
4299
|
-
tagParamsIdentifier,
|
|
4340
|
+
...markReturn(childSection, setupIdentifier, tagParamsIdentifier),
|
|
4300
4341
|
childSection.hoisted || childSection.isHoistThrough ? getSectionInstancesAccessorLiteral(childSection) : void 0
|
|
4301
4342
|
]));
|
|
4302
4343
|
if (!registerReason || registerWrapper) renderer = _marko_compiler.types.addComment(renderer, "leading", "@__PURE__");
|
|
@@ -4319,8 +4360,7 @@ var dom_default = { translate: {
|
|
|
4319
4360
|
program.node.body.push(_marko_compiler.types.exportDefaultDeclaration(callRuntime("_template", _marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.getFile)().metadata.marko.id), ...replaceNullishAndEmptyFunctionsWith0([
|
|
4320
4361
|
templateIdentifier,
|
|
4321
4362
|
walksIdentifier,
|
|
4322
|
-
section.hasSetupWork ? setupIdentifier : void 0,
|
|
4323
|
-
programInputSignal?.identifier
|
|
4363
|
+
...markReturn(section, section.hasSetupWork ? setupIdentifier : void 0, programInputSignal?.identifier)
|
|
4324
4364
|
]))));
|
|
4325
4365
|
}
|
|
4326
4366
|
} };
|
|
@@ -4328,6 +4368,9 @@ function assertSetupWorkFound(program, section, written) {
|
|
|
4328
4368
|
const setup = getSetup(section);
|
|
4329
4369
|
if (!section.hasSetupWork && setup && written.has(setup)) throw program.buildCodeFrameError("Marko internal error: analysis found no setup work for a section whose translation produced setup statements. Please open an issue with a reproduction.");
|
|
4330
4370
|
}
|
|
4371
|
+
function markReturn(section, setup, params) {
|
|
4372
|
+
return section.returnValueExpr && !isOptimize() ? setup ? [callRuntime("_return_setup", setup), params] : [setup, callRuntime("_return_setup", params)] : [setup, params];
|
|
4373
|
+
}
|
|
4331
4374
|
//#endregion
|
|
4332
4375
|
//#region src/translator/visitors/program/html.ts
|
|
4333
4376
|
function getTemplateContentName() {
|
|
@@ -4335,11 +4378,11 @@ function getTemplateContentName() {
|
|
|
4335
4378
|
}
|
|
4336
4379
|
var html_default = { translate: {
|
|
4337
4380
|
enter() {
|
|
4381
|
+
const sectionDynamicSubscribers = /* @__PURE__ */ new Set();
|
|
4338
4382
|
forEachSection((section) => {
|
|
4339
4383
|
forEach(section.bindings, (binding) => {
|
|
4340
4384
|
for (const [hoistSection, hasReference] of binding.getters) if (hasReference) getHTMLSectionStatements(hoistSection || section).push(_marko_compiler.types.variableDeclaration("const", [hoistSection ? _marko_compiler.types.variableDeclarator(getBindingGetterIdentifier(binding, hoistSection), callRuntime("_hoist", getScopeIdIdentifier(hoistSection), _marko_compiler.types.stringLiteral(getResumeRegisterId(hoistSection, binding, "hoist")))) : _marko_compiler.types.variableDeclarator(_marko_compiler.types.identifier(binding.originalName), callRuntime("_el", getScopeIdIdentifier(section), _marko_compiler.types.stringLiteral(getResumeRegisterId(section, binding))))]));
|
|
4341
4385
|
});
|
|
4342
|
-
const sectionDynamicSubscribers = /* @__PURE__ */ new Set();
|
|
4343
4386
|
forEach(section.hoisted, (binding) => {
|
|
4344
4387
|
let highestHoistSection;
|
|
4345
4388
|
forEach(binding.hoists, (hoistSection) => {
|
|
@@ -4815,7 +4858,10 @@ var custom_tag_default = {
|
|
|
4815
4858
|
const childSection = childExtra.section;
|
|
4816
4859
|
if (childSection === programSection && getOrCreateSection(tag) === programSection) throw tag.get("name").buildCodeFrameError(`A template that renders itself outside a branch never terminates. Render \`<${getStaticTagName(tag.node)}>\` inside a branch that eventually stops, such as \`<if>\`.`);
|
|
4817
4860
|
if (childExtra.page) programExtra.page ??= true;
|
|
4818
|
-
if (tagExtra.tagNameLoad)
|
|
4861
|
+
if (tagExtra.tagNameLoad) {
|
|
4862
|
+
if (tag.node.var) throw tag.get("var").buildCodeFrameError(`The \`${getStaticTagName(tag.node)}\` tag is lazily loaded, so it does not support a [tag variable](https://markojs.com/docs/reference/language#tag-variables). Remove the variable, or import the tag without \`load\`.`);
|
|
4863
|
+
tagExtra[kLoadTagBinding] = createBinding("#text", 0, getOrCreateSection(tag));
|
|
4864
|
+
}
|
|
4819
4865
|
knownTagAnalyze(tag, childSection, childExtra.paramsTree);
|
|
4820
4866
|
const tagName = getStaticTagName(tag.node);
|
|
4821
4867
|
if (tagExtra.tagNameLoad) {
|
|
@@ -5865,6 +5911,7 @@ function knownTagAnalyze(tag, contentSection, childParamsTree) {
|
|
|
5865
5911
|
else exprs = analyzeKnownTagParams(tag, getParamsTree(contentSection));
|
|
5866
5912
|
} else exprs = analyzeKnownTagParams(tag, childParamsTree);
|
|
5867
5913
|
if (varBinding) {
|
|
5914
|
+
if (!recursive) assertReturns(tag, contentSection);
|
|
5868
5915
|
addSetupExpr(section);
|
|
5869
5916
|
const mutatesTagVar = !!(tag.node.var.type === "Identifier" && tag.scope.getBinding(tag.node.var.name)?.constantViolations.length);
|
|
5870
5917
|
const varExpr = recursive || (tagExtra.defineBodySection ? contentSection.returnValueExpr : mapParamReasonToExpr(exprs, getReturnParams(contentSection)));
|
|
@@ -5877,7 +5924,11 @@ function knownTagAnalyze(tag, contentSection, childParamsTree) {
|
|
|
5877
5924
|
}
|
|
5878
5925
|
}
|
|
5879
5926
|
function analyzeRecursiveTags() {
|
|
5880
|
-
for (const tag of getRecursiveTags())
|
|
5927
|
+
for (const tag of getRecursiveTags()) {
|
|
5928
|
+
const contentSection = tag.node.extra[kContentSection];
|
|
5929
|
+
if (tag.node.var) assertReturns(tag, contentSection);
|
|
5930
|
+
analyzeKnownTagParams(tag, getParamsTree(contentSection));
|
|
5931
|
+
}
|
|
5881
5932
|
}
|
|
5882
5933
|
function getParamsTree(contentSection) {
|
|
5883
5934
|
return contentSection.params && getBindingPropTree(contentSection.params, true);
|
|
@@ -5892,9 +5943,12 @@ function analyzeKnownTagParams(tag, propTree) {
|
|
|
5892
5943
|
return exprs;
|
|
5893
5944
|
}
|
|
5894
5945
|
function getReturnParams(section) {
|
|
5895
|
-
const sources =
|
|
5946
|
+
const sources = getSourcesForExpr(section.returnValueExpr);
|
|
5896
5947
|
return sources && (sources.always || !!sources.state || sources.param);
|
|
5897
5948
|
}
|
|
5949
|
+
function assertReturns(tag, contentSection) {
|
|
5950
|
+
if (!contentSection.returnValueExpr) throw tag.get("var").buildCodeFrameError(`The \`${getStaticTagName(tag.node)}\` tag does not [\`<return>\`](https://markojs.com/docs/reference/core-tag#return) a value, so it does not support a [tag variable](https://markojs.com/docs/reference/language#tag-variables). Remove the variable, or add a \`<return>\` to the tag.`);
|
|
5951
|
+
}
|
|
5898
5952
|
function isChildScopeResumed(tagExtra) {
|
|
5899
5953
|
return !!findSlot(tagExtra.nodeBinding)?.reason;
|
|
5900
5954
|
}
|
|
@@ -6689,16 +6743,20 @@ function getWalkedBinding(op) {
|
|
|
6689
6743
|
return typeof op === "object" && (op.kind === "node" || op.kind === "child") ? op.binding : void 0;
|
|
6690
6744
|
}
|
|
6691
6745
|
function getLastOwnSourceReturn(intersection, section) {
|
|
6692
|
-
let
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6746
|
+
let last;
|
|
6747
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6748
|
+
const track = (binding) => {
|
|
6749
|
+
if (binding.section === section && !seen.has(binding)) {
|
|
6750
|
+
seen.add(binding);
|
|
6751
|
+
const { returnedBy } = getAliasRoot(binding) || binding;
|
|
6752
|
+
if (returnedBy && (!last || last.id < returnedBy.id)) last = returnedBy;
|
|
6753
|
+
if (binding.derivedFrom) forEach(getValueReferences(binding.derivedFrom), track);
|
|
6754
|
+
forEach(binding.sources?.state, track);
|
|
6755
|
+
forEach(binding.sources?.param, track);
|
|
6756
|
+
}
|
|
6757
|
+
};
|
|
6758
|
+
forEach(intersection, track);
|
|
6759
|
+
return last;
|
|
6702
6760
|
}
|
|
6703
6761
|
function getIntersectionSource(intersection, section, resolved) {
|
|
6704
6762
|
if (!resolved.has(intersection)) {
|
|
@@ -6742,11 +6800,6 @@ function resolveBindingSources(binding) {
|
|
|
6742
6800
|
binding.sources = globalSources;
|
|
6743
6801
|
return;
|
|
6744
6802
|
}
|
|
6745
|
-
if (binding.localOf) {
|
|
6746
|
-
resolveBindingSources(binding.localOf);
|
|
6747
|
-
binding.sources = binding.localOf.sources;
|
|
6748
|
-
return;
|
|
6749
|
-
}
|
|
6750
6803
|
const aliasRoot = getAliasRoot(binding);
|
|
6751
6804
|
if (aliasRoot) {
|
|
6752
6805
|
if (!resolvedSources.has(aliasRoot)) {
|
|
@@ -7058,6 +7111,9 @@ function getValueReason(extra) {
|
|
|
7058
7111
|
}
|
|
7059
7112
|
return reason;
|
|
7060
7113
|
}
|
|
7114
|
+
function getReasonForExpr(extra) {
|
|
7115
|
+
return readersOfExtra(extra).reason;
|
|
7116
|
+
}
|
|
7061
7117
|
function readersOfExtra(extra) {
|
|
7062
7118
|
if (extra.isEffect) return ALWAYS_READ;
|
|
7063
7119
|
const readers = extraReaders(extra);
|
|
@@ -7520,7 +7576,7 @@ function getOrCreateLocalClosure(local, section) {
|
|
|
7520
7576
|
while (section.parent !== local.section) section = section.parent;
|
|
7521
7577
|
let closure = local.localClosures?.get(section);
|
|
7522
7578
|
if (!closure) {
|
|
7523
|
-
closure = createBinding(local.name,
|
|
7579
|
+
closure = createBinding(local.name, 2, section, void 0, void 0, void 0, local.loc);
|
|
7524
7580
|
closure.localOf = local;
|
|
7525
7581
|
(local.localClosures ??= /* @__PURE__ */ new Map()).set(section, closure);
|
|
7526
7582
|
}
|
|
@@ -11038,6 +11094,7 @@ var dynamic_tag_default = {
|
|
|
11038
11094
|
if (tag.node.extra?.tagNameUnresolved) throw tagNotFoundError(tag);
|
|
11039
11095
|
(0, _marko_compiler_babel_utils.assertAttributesOrArgs)(tag);
|
|
11040
11096
|
const { node } = tag;
|
|
11097
|
+
if (node.var && node.extra.featureType === "class") throw tag.get("var").buildCodeFrameError(`The Marko 5 (class API) tag \`${getStaticTagName(node)}\` cannot [\`<return>\`](https://markojs.com/docs/reference/core-tag#return) a value, so it does not support a [tag variable](https://markojs.com/docs/reference/language#tag-variables). Remove the variable, or migrate the tag to the tags API.`);
|
|
11041
11098
|
const definedBodySection = node.extra?.defineBodySection;
|
|
11042
11099
|
if (definedBodySection) {
|
|
11043
11100
|
knownTagAnalyze(tag, definedBodySection);
|
|
@@ -11159,7 +11216,8 @@ var dynamic_tag_default = {
|
|
|
11159
11216
|
flushInto(tag);
|
|
11160
11217
|
writeHTMLResumeStatements(tag.get("body"));
|
|
11161
11218
|
const markerGuard = getWriteGuard(tagSection, markerReason, true);
|
|
11162
|
-
const
|
|
11219
|
+
const debugTagVar = !isOptimize() && node.var && _marko_compiler.types.numericLiteral(1);
|
|
11220
|
+
const dynamicTagExpr = hasTagArgs ? callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, _marko_compiler.types.arrayExpression(args), contentProp ? contentProp.value : _marko_compiler.types.numericLiteral(0), _marko_compiler.types.numericLiteral(1), markerGuard, debugTagVar) : callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, args[0], args[1] || (markerGuard ? _marko_compiler.types.numericLiteral(0) : void 0), markerGuard ? _marko_compiler.types.numericLiteral(0) : void 0, markerGuard, debugTagVar);
|
|
11163
11221
|
if (node.var && isTagVarResumed(tag)) {
|
|
11164
11222
|
const dynamicScopeIdentifier = generateUidIdentifier(tag.get("name").toString() + "_scope");
|
|
11165
11223
|
const mutatesTagVar = isTagVarAssigned(tag);
|
|
@@ -11174,10 +11232,10 @@ var dynamic_tag_default = {
|
|
|
11174
11232
|
const bodySection = getSectionForBody(tag.get("body"));
|
|
11175
11233
|
const signal = getSignal(section, nodeBinding, "dynamicTag");
|
|
11176
11234
|
let tagVarSignal;
|
|
11177
|
-
if (tag.node.var) {
|
|
11235
|
+
if (tag.node.var && isTagVarResumed(tag)) {
|
|
11178
11236
|
const varBinding = tag.node.var.extra.binding;
|
|
11179
11237
|
tagVarSignal = initValue(varBinding);
|
|
11180
|
-
tagVarSignal.register =
|
|
11238
|
+
tagVarSignal.register = true;
|
|
11181
11239
|
tagVarSignal.referenced = true;
|
|
11182
11240
|
tagVarSignal.buildAssignment = (valueSection, value) => {
|
|
11183
11241
|
const changeArgs = [_marko_compiler.types.memberExpression(getScopeExpression(tagVarSignal.section, valueSection), _marko_compiler.types.stringLiteral(getAccessorPrefix().BranchScopes + getScopeAccessor(nodeBinding)), true), value];
|
|
@@ -11195,9 +11253,9 @@ var dynamic_tag_default = {
|
|
|
11195
11253
|
const argsOrInput = hasTagArgs ? _marko_compiler.types.arrayExpression(args) : args[0];
|
|
11196
11254
|
if (!_marko_compiler.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) signal.extraArgs = [_marko_compiler.types.arrowFunctionExpression([], statements.length ? _marko_compiler.types.blockStatement(statements.concat(_marko_compiler.types.returnStatement(argsOrInput))) : argsOrInput)];
|
|
11197
11255
|
}
|
|
11256
|
+
enableDynamicTagVar(tag);
|
|
11198
11257
|
if (!isClassAPI) {
|
|
11199
11258
|
enableDynamicTagResume(tag);
|
|
11200
|
-
enableDynamicTagVar(tag);
|
|
11201
11259
|
enableDynamicTagControllables(tag);
|
|
11202
11260
|
}
|
|
11203
11261
|
addValue(section, getReferencedBindings(tagExtra), signal, tagExpression);
|
|
@@ -11216,9 +11274,9 @@ function enableDynamicTagControllables(tag) {
|
|
|
11216
11274
|
}
|
|
11217
11275
|
}
|
|
11218
11276
|
function enableDynamicTagVar(tag) {
|
|
11219
|
-
if (!tag.node.var || !isTagVarResumed(tag)
|
|
11277
|
+
if (!tag.node.var || !isTagVarResumed(tag)) return;
|
|
11220
11278
|
importRuntimeFeature("dynamic-tag-var");
|
|
11221
|
-
if (!tag.node.var.extra.binding.pruned) {
|
|
11279
|
+
if (analyzeTagNameType(tag, true) !== 1 && !tag.node.var.extra.binding.pruned) {
|
|
11222
11280
|
const accessor = getScopeAccessorLiteral(tag.node.extra.nodeBinding, true);
|
|
11223
11281
|
if (addRuntimeOnce(`_dynamic_tag_var_resume ${accessor.value}`)) (0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.expressionStatement(callRuntime("_dynamic_tag_var_resume", accessor)));
|
|
11224
11282
|
}
|
|
@@ -2,6 +2,6 @@ import { types as t } from "@marko/compiler";
|
|
|
2
2
|
/**
|
|
3
3
|
* Writes the registrations for module scoped functions: the ones this template
|
|
4
4
|
* exports and registers itself, and the ones it imports from a template that
|
|
5
|
-
* reserved a register id without registering it.
|
|
5
|
+
* reserved a register id without registering it; and for templates it imports.
|
|
6
6
|
*/
|
|
7
7
|
export declare function writeModuleRegistrations(program: t.NodePath<t.Program>): void;
|
|
@@ -6,5 +6,6 @@ import { type Section } from "./sections";
|
|
|
6
6
|
export declare function solveReasons(intersectionsBySection: Map<Section, Intersection[]>): void;
|
|
7
7
|
export declare function getReasonForBinding(binding: Binding, properties?: Opt<string> | true): undefined | Reason;
|
|
8
8
|
export declare function getValueReason(extra: t.NodeExtra): undefined | Reason;
|
|
9
|
+
export declare function getReasonForExpr(extra: t.NodeExtra): undefined | Reason;
|
|
9
10
|
export declare function readsValuesOnResume(expr: t.NodeExtra): boolean;
|
|
10
11
|
export declare function addAlwaysRead(binding: Binding): void;
|
|
@@ -2,16 +2,16 @@ import { types as t } from "@marko/compiler";
|
|
|
2
2
|
declare const kRegisteredExports: unique symbol;
|
|
3
3
|
declare module "@marko/compiler/dist/types" {
|
|
4
4
|
interface ProgramExtra {
|
|
5
|
-
[kRegisteredExports]?: Map<string,
|
|
5
|
+
[kRegisteredExports]?: Map<string, RegisteredExport>;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
export
|
|
8
|
+
/**
|
|
9
|
+
* An export registered under an id: the template that declares it, and the
|
|
10
|
+
* canonical name it is exported under.
|
|
11
|
+
*/
|
|
12
|
+
export interface RegisteredExport {
|
|
10
13
|
registerId: string;
|
|
11
14
|
exportName: string;
|
|
12
|
-
}
|
|
13
|
-
/** A reserved export, plus the template that declares it. */
|
|
14
|
-
export interface ResolvedExport extends ReservedExport {
|
|
15
15
|
filename: string;
|
|
16
16
|
}
|
|
17
17
|
declare const _default: {
|
|
@@ -21,15 +21,20 @@ export default _default;
|
|
|
21
21
|
export declare function resolveFunctionReason(): void;
|
|
22
22
|
export declare function finalizeFunctionRegistry(): void;
|
|
23
23
|
/**
|
|
24
|
-
* Tracks a
|
|
25
|
-
*
|
|
24
|
+
* Tracks a template imported as a default export. The server writes a template
|
|
25
|
+
* only as a binding's value, so the importing template registers it when one may.
|
|
26
|
+
*/
|
|
27
|
+
export declare function trackImportedTemplate(importDecl: t.NodePath<t.ImportDeclaration>, local: string, templateFile: t.BabelFile): void;
|
|
28
|
+
/**
|
|
29
|
+
* Tracks an export imported from another template that registers under an id,
|
|
30
|
+
* if it does. The importing template registers it (under that id) when client
|
|
26
31
|
* code reads its own references.
|
|
27
32
|
*/
|
|
28
|
-
export declare function
|
|
33
|
+
export declare function trackImport(importDecl: t.NodePath<t.ImportDeclaration>, local: string, registered: RegisteredExport | undefined, fnRoots?: Set<t.NodeExtra>): void;
|
|
29
34
|
/**
|
|
30
35
|
* Finds the id reserved for an export, following `export ... from` hops. Each
|
|
31
36
|
* template only records the exports it declares, so this resolves on demand:
|
|
32
37
|
* a template in an import cycle is read while it is still analyzing, and would
|
|
33
38
|
* hand out an incomplete map if the ids were pushed ahead of time.
|
|
34
39
|
*/
|
|
35
|
-
export declare function resolveRegisteredExport(file: t.BabelFile, exportName: string, seen?: Set<string>):
|
|
40
|
+
export declare function resolveRegisteredExport(file: t.BabelFile, exportName: string, seen?: Set<string>): RegisteredExport | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
2
|
import type { LoadTrigger } from "../../html/assets";
|
|
3
|
-
import { type
|
|
3
|
+
import { type RegisteredExport } from "./function";
|
|
4
4
|
declare module "@marko/compiler/dist/types" {
|
|
5
5
|
interface ProgramExtra {
|
|
6
6
|
/** Absolute filenames of templates this one imports with `load`. */
|
|
@@ -9,9 +9,8 @@ declare module "@marko/compiler/dist/types" {
|
|
|
9
9
|
interface ImportDeclarationExtra {
|
|
10
10
|
tagImport?: string;
|
|
11
11
|
loadImport?: LoadImportConfig;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})[];
|
|
12
|
+
/** Each local binding the template registers -> the export it imports. */
|
|
13
|
+
registeredImports?: Map<string, RegisteredExport>;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
export type LoadImportConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.4",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@marko/compiler": "^5.42.
|
|
54
|
+
"@marko/compiler": "^5.42.11",
|
|
55
55
|
"csstype": "^3.2.3",
|
|
56
56
|
"fastest-levenshtein": "^1.0.16",
|
|
57
57
|
"magic-string": "^0.30.21"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@marko/runtime-tags": "npm:marko@6.4.
|
|
60
|
+
"@marko/runtime-tags": "npm:marko@6.4.4",
|
|
61
61
|
"marko": "5.39.45"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
package/tags-html.d.ts
CHANGED
|
@@ -2225,11 +2225,6 @@ declare global {
|
|
|
2225
2225
|
*/
|
|
2226
2226
|
autocomplete?: AttrAutoComplete;
|
|
2227
2227
|
|
|
2228
|
-
/**
|
|
2229
|
-
* (Safari only). Controls the autocorrect behavior of the <textarea> element.
|
|
2230
|
-
*/
|
|
2231
|
-
autocorrect?: AttrOnOff;
|
|
2232
|
-
|
|
2233
2228
|
/**
|
|
2234
2229
|
* Specifies the visible width of the <textarea> element in terms of character width.
|
|
2235
2230
|
* @see https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-cols
|
|
@@ -4208,6 +4203,12 @@ declare global {
|
|
|
4208
4203
|
| "sentences"
|
|
4209
4204
|
| "words";
|
|
4210
4205
|
|
|
4206
|
+
/**
|
|
4207
|
+
* Controls whether user agents may autocorrect spelling while the user types.
|
|
4208
|
+
* @see https://html.spec.whatwg.org/multipage/interaction.html#attr-autocorrect
|
|
4209
|
+
*/
|
|
4210
|
+
autocorrect?: AttrOnOff;
|
|
4211
|
+
|
|
4211
4212
|
/**
|
|
4212
4213
|
* Indicates whether the element should automatically get focus when the page loads.
|
|
4213
4214
|
* @see https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute
|
|
@@ -5938,10 +5939,11 @@ interface CommonAttributes<T extends Element> {
|
|
|
5938
5939
|
type AttrMissing = undefined | null | false;
|
|
5939
5940
|
type AttrClass =
|
|
5940
5941
|
| AttrMissing
|
|
5942
|
+
| 0
|
|
5941
5943
|
| string
|
|
5942
5944
|
| AttrClass[]
|
|
5943
|
-
| Record<string, AttrMissing | boolean>;
|
|
5944
|
-
type AttrStyle = AttrMissing | string | Marko.CSS.Properties | AttrStyle[];
|
|
5945
|
+
| Record<string, AttrMissing | boolean | number>;
|
|
5946
|
+
type AttrStyle = AttrMissing | 0 | string | Marko.CSS.Properties | AttrStyle[];
|
|
5945
5947
|
type AttrCrossOrigin = AttrBoolean | "anonymous" | "use-credentials";
|
|
5946
5948
|
type AttrEventHandler<Event, Target> =
|
|
5947
5949
|
| AttrMissing
|