@marko/runtime-tags 6.0.173 → 6.1.0
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/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/translator/index.js +25 -21
- package/dist/translator/util/runtime.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
|
@@ -2218,7 +2218,7 @@ function getFilteredGlobals($global) {
|
|
|
2218
2218
|
return filtered;
|
|
2219
2219
|
}
|
|
2220
2220
|
function _subscribe(subscribers, scope) {
|
|
2221
|
-
$chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2221
|
+
if (subscribers) $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2222
2222
|
return referenceScope(scope);
|
|
2223
2223
|
}
|
|
2224
2224
|
//#endregion
|
package/dist/debug/html.mjs
CHANGED
|
@@ -2216,7 +2216,7 @@ function getFilteredGlobals($global) {
|
|
|
2216
2216
|
return filtered;
|
|
2217
2217
|
}
|
|
2218
2218
|
function _subscribe(subscribers, scope) {
|
|
2219
|
-
$chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2219
|
+
if (subscribers) $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
|
|
2220
2220
|
return referenceScope(scope);
|
|
2221
2221
|
}
|
|
2222
2222
|
//#endregion
|
package/dist/html/writer.d.ts
CHANGED
|
@@ -145,4 +145,4 @@ export declare function _trailers(html: string): void;
|
|
|
145
145
|
type QueueCallback = (ticked: true) => void;
|
|
146
146
|
export declare function queueTick(cb: QueueCallback): void;
|
|
147
147
|
export declare function offTick(cb: QueueCallback): void;
|
|
148
|
-
export declare function _subscribe(subscribers: Set<ScopeInternals
|
|
148
|
+
export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;
|
package/dist/html.js
CHANGED
|
@@ -1464,7 +1464,7 @@ function getFilteredGlobals($global) {
|
|
|
1464
1464
|
return filtered;
|
|
1465
1465
|
}
|
|
1466
1466
|
function _subscribe(subscribers, scope) {
|
|
1467
|
-
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1467
|
+
return subscribers && $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1468
1468
|
}
|
|
1469
1469
|
//#endregion
|
|
1470
1470
|
//#region src/html/attrs.ts
|
package/dist/html.mjs
CHANGED
|
@@ -1463,7 +1463,7 @@ function getFilteredGlobals($global) {
|
|
|
1463
1463
|
return filtered;
|
|
1464
1464
|
}
|
|
1465
1465
|
function _subscribe(subscribers, scope) {
|
|
1466
|
-
return $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1466
|
+
return subscribers && $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add"), referenceScope(scope);
|
|
1467
1467
|
}
|
|
1468
1468
|
//#endregion
|
|
1469
1469
|
//#region src/html/attrs.ts
|
package/dist/translator/index.js
CHANGED
|
@@ -2134,24 +2134,6 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2134
2134
|
};
|
|
2135
2135
|
})(_dynamic_tag);
|
|
2136
2136
|
//#endregion
|
|
2137
|
-
//#region src/translator/util/to-property-name.ts
|
|
2138
|
-
function isValidPropertyIdentifier(name) {
|
|
2139
|
-
return /^[a-z_$][a-z0-9_$]*$/i.test(name);
|
|
2140
|
-
}
|
|
2141
|
-
function toPropertyName(name) {
|
|
2142
|
-
if (isValidPropertyIdentifier(name)) return _marko_compiler.types.identifier(name);
|
|
2143
|
-
else if (/^(?:0|[1-9][0-9]*)$/.test(name)) return _marko_compiler.types.numericLiteral(parseInt(name, 10));
|
|
2144
|
-
return _marko_compiler.types.stringLiteral(name);
|
|
2145
|
-
}
|
|
2146
|
-
function toObjectProperty(name, value) {
|
|
2147
|
-
return _marko_compiler.types.objectProperty(toPropertyName(name), value);
|
|
2148
|
-
}
|
|
2149
|
-
function toMemberExpression(object, key, optional) {
|
|
2150
|
-
const prop = toPropertyName(key);
|
|
2151
|
-
const computed = prop.type !== "Identifier";
|
|
2152
|
-
return optional ? _marko_compiler.types.optionalMemberExpression(object, prop, computed, true) : _marko_compiler.types.memberExpression(object, prop, computed);
|
|
2153
|
-
}
|
|
2154
|
-
//#endregion
|
|
2155
2137
|
//#region src/translator/util/runtime.ts
|
|
2156
2138
|
const pureDOMFunctions = new Set([
|
|
2157
2139
|
"_await_promise",
|
|
@@ -2177,7 +2159,7 @@ const pureDOMFunctions = new Set([
|
|
|
2177
2159
|
]);
|
|
2178
2160
|
function importRuntime(name) {
|
|
2179
2161
|
const { output } = getMarkoOpts();
|
|
2180
|
-
return
|
|
2162
|
+
return (0, _marko_compiler_babel_utils.importNamed)((0, _marko_compiler_babel_utils.getFile)(), getRuntimePath(output), name);
|
|
2181
2163
|
}
|
|
2182
2164
|
function callRuntime(name, ...args) {
|
|
2183
2165
|
const callExpression = _marko_compiler.types.callExpression(importRuntime(name), filterArguments(args));
|
|
@@ -2771,6 +2753,24 @@ function forEachIdentifierPath(nodePath, cb) {
|
|
|
2771
2753
|
}
|
|
2772
2754
|
}
|
|
2773
2755
|
//#endregion
|
|
2756
|
+
//#region src/translator/util/to-property-name.ts
|
|
2757
|
+
function isValidPropertyIdentifier(name) {
|
|
2758
|
+
return /^[a-z_$][a-z0-9_$]*$/i.test(name);
|
|
2759
|
+
}
|
|
2760
|
+
function toPropertyName(name) {
|
|
2761
|
+
if (isValidPropertyIdentifier(name)) return _marko_compiler.types.identifier(name);
|
|
2762
|
+
else if (/^(?:0|[1-9][0-9]*)$/.test(name)) return _marko_compiler.types.numericLiteral(parseInt(name, 10));
|
|
2763
|
+
return _marko_compiler.types.stringLiteral(name);
|
|
2764
|
+
}
|
|
2765
|
+
function toObjectProperty(name, value) {
|
|
2766
|
+
return _marko_compiler.types.objectProperty(toPropertyName(name), value);
|
|
2767
|
+
}
|
|
2768
|
+
function toMemberExpression(object, key, optional) {
|
|
2769
|
+
const prop = toPropertyName(key);
|
|
2770
|
+
const computed = prop.type !== "Identifier";
|
|
2771
|
+
return optional ? _marko_compiler.types.optionalMemberExpression(object, prop, computed, true) : _marko_compiler.types.memberExpression(object, prop, computed);
|
|
2772
|
+
}
|
|
2773
|
+
//#endregion
|
|
2774
2774
|
//#region src/translator/util/get-declared-binding-expression.ts
|
|
2775
2775
|
function getDeclaredBindingExpression(binding) {
|
|
2776
2776
|
const canonicalBinding = getCanonicalBinding(binding);
|
|
@@ -3204,6 +3204,7 @@ function writeHTMLResumeStatements(path) {
|
|
|
3204
3204
|
const body = path.node.body;
|
|
3205
3205
|
const allSignals = Array.from(getSignals(section).values());
|
|
3206
3206
|
const scopeIdIdentifier = getScopeIdIdentifier(section);
|
|
3207
|
+
const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
|
|
3207
3208
|
forEach(section.referencedClosures, (closure) => {
|
|
3208
3209
|
if (closure.sources) {
|
|
3209
3210
|
if (isDynamicClosure(section, closure)) {
|
|
@@ -3219,7 +3220,11 @@ function writeHTMLResumeStatements(path) {
|
|
|
3219
3220
|
if (underTryPlaceholder(section)) {
|
|
3220
3221
|
const reason = getSerializeReason(section);
|
|
3221
3222
|
if (reason) getHTMLSectionStatements(section).push(_marko_compiler.types.expressionStatement(getExprIfSerialized(section, reason, callRuntime("_script", getScopeIdIdentifier(section), _marko_compiler.types.stringLiteral(getResumeRegisterId(section, closure, "pending"))))));
|
|
3222
|
-
} else
|
|
3223
|
+
} else {
|
|
3224
|
+
const closureScopesReason = getSerializeReason(closure.section, closure, getAccessorPrefix().ClosureScopes);
|
|
3225
|
+
const subscribeArg = isReasonDynamic(closureScopesReason) && !isSameReason(closureScopesReason, sectionSerializeReason) ? getExprIfSerialized(closure.section, closureScopesReason, identifier) : identifier;
|
|
3226
|
+
addWriteScopeBuilder(section, (expr) => callRuntime("_subscribe", subscribeArg, expr));
|
|
3227
|
+
}
|
|
3223
3228
|
}
|
|
3224
3229
|
}
|
|
3225
3230
|
});
|
|
@@ -3231,7 +3236,6 @@ function writeHTMLResumeStatements(path) {
|
|
|
3231
3236
|
const writeScopeBuilder = getSectionWriteScopeBuilder(section);
|
|
3232
3237
|
const serializedLookup = getSerializedAccessors(section);
|
|
3233
3238
|
const serializedProperties = [];
|
|
3234
|
-
const sectionSerializeReason = nonAnalyzedForceSerializedSection.has(section) ? true : section.serializeReason;
|
|
3235
3239
|
const ifSerialized = (reason, expr) => {
|
|
3236
3240
|
if (isSameReason(sectionSerializeReason, reason)) return expr;
|
|
3237
3241
|
return getExprIfSerialized(section, reason, expr);
|
|
@@ -3,7 +3,7 @@ import type { Falsy } from "../../common/types";
|
|
|
3
3
|
import { _attr, _attr_class, _attr_style, _escape, _escape_comment, _escape_script, _escape_style, _unescaped } from "../../html";
|
|
4
4
|
export type DOMRuntimeHelpers = keyof typeof import("../../dom");
|
|
5
5
|
export type HTMLRuntimeHelpers = keyof typeof import("../../html");
|
|
6
|
-
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.
|
|
6
|
+
export declare function importRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers): t.Identifier;
|
|
7
7
|
export declare function callRuntime(name: DOMRuntimeHelpers | HTMLRuntimeHelpers, ...args: Array<Parameters<typeof t.callExpression>[1][number] | Falsy>): t.CallExpression;
|
|
8
8
|
export declare function getHTMLRuntime(): {
|
|
9
9
|
_escape: typeof _escape;
|