marko 6.0.52 → 6.0.54
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 +34 -38
- package/dist/debug/html.mjs +34 -38
- package/dist/html/compat.d.ts +4 -3
- package/dist/html/writer.d.ts +1 -0
- package/dist/html.js +25 -28
- package/dist/html.mjs +25 -28
- package/dist/translator/index.js +73 -53
- package/dist/translator/util/entry-builder.d.ts +1 -1
- package/dist/translator/util/walks.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/html.js
CHANGED
@@ -1997,7 +1997,9 @@ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
|
1997
1997
|
}
|
1998
1998
|
}
|
1999
1999
|
var writeScope = (scopeId, partialScope) => {
|
2000
|
-
|
2000
|
+
return writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
2001
|
+
};
|
2002
|
+
function writeScopeToState(state, scopeId, partialScope) {
|
2001
2003
|
const { scopes } = state;
|
2002
2004
|
let scope = scopes.get(scopeId);
|
2003
2005
|
state.needsMainRuntime = true;
|
@@ -2014,7 +2016,7 @@ var writeScope = (scopeId, partialScope) => {
|
|
2014
2016
|
state.writeScopes = { [scopeId]: scope };
|
2015
2017
|
}
|
2016
2018
|
return scope;
|
2017
|
-
}
|
2019
|
+
}
|
2018
2020
|
if (true) {
|
2019
2021
|
writeScope = /* @__PURE__ */ ((writeScope2) => (scopeId, partialScope, file, loc, vars) => {
|
2020
2022
|
const scope = writeScope2(scopeId, partialScope);
|
@@ -3262,6 +3264,15 @@ var compat = {
|
|
3262
3264
|
nextScopeId,
|
3263
3265
|
peekNextScopeId,
|
3264
3266
|
isInResumedBranch,
|
3267
|
+
ensureState($global2) {
|
3268
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3269
|
+
if (!state) {
|
3270
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3271
|
+
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3272
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3273
|
+
}
|
3274
|
+
return state;
|
3275
|
+
},
|
3265
3276
|
isTagsAPI(fn) {
|
3266
3277
|
return !!fn.___id;
|
3267
3278
|
},
|
@@ -3277,32 +3288,27 @@ var compat = {
|
|
3277
3288
|
writeScope(branchId, { m5c });
|
3278
3289
|
writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
3279
3290
|
},
|
3280
|
-
toJSON() {
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3291
|
+
toJSON(state) {
|
3292
|
+
return function toJSON() {
|
3293
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
3294
|
+
if (!compatRegistered) {
|
3295
|
+
const registered = getRegistered(this);
|
3296
|
+
if (registered) {
|
3297
|
+
const scopeId = getScopeId(registered.scope);
|
3298
|
+
if (scopeId !== void 0) {
|
3299
|
+
writeScopeToState(state, scopeId, {});
|
3300
|
+
}
|
3301
|
+
COMPAT_REGISTRY.set(
|
3302
|
+
this,
|
3303
|
+
compatRegistered = [registered.id, scopeId]
|
3304
|
+
);
|
3288
3305
|
}
|
3289
|
-
COMPAT_REGISTRY.set(
|
3290
|
-
this,
|
3291
|
-
compatRegistered = [registered.id, scopeId]
|
3292
|
-
);
|
3293
3306
|
}
|
3294
|
-
|
3295
|
-
|
3307
|
+
return compatRegistered;
|
3308
|
+
};
|
3296
3309
|
},
|
3297
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
3298
|
-
const
|
3299
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3300
|
-
if (!state) {
|
3301
|
-
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3302
|
-
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3303
|
-
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3304
|
-
}
|
3305
|
-
const boundary = new Boundary(state);
|
3310
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
3311
|
+
const boundary = new Boundary(this.ensureState(classAPIOut.global));
|
3306
3312
|
let head = new Chunk(
|
3307
3313
|
boundary,
|
3308
3314
|
null,
|
@@ -3332,21 +3338,11 @@ var compat = {
|
|
3332
3338
|
asyncOut.error(boundary.signal.reason);
|
3333
3339
|
boundary.onNext = NOOP3;
|
3334
3340
|
} else if (!boundary.count) {
|
3335
|
-
|
3336
|
-
if (boundary.done) {
|
3337
|
-
const { html, scripts } = head.flushScript();
|
3338
|
-
writer.script(scripts);
|
3339
|
-
writer.write(html);
|
3340
|
-
} else {
|
3341
|
-
asyncOut.error(
|
3342
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
3343
|
-
);
|
3344
|
-
}
|
3345
|
-
});
|
3346
|
-
head = head.consume();
|
3341
|
+
completeChunks.push(head = head.consume());
|
3347
3342
|
asyncOut.write(head.html);
|
3343
|
+
asyncOut.script(head.scripts);
|
3348
3344
|
asyncOut.end();
|
3349
|
-
head.html = "";
|
3345
|
+
head.html = head.scripts = "";
|
3350
3346
|
}
|
3351
3347
|
})();
|
3352
3348
|
});
|
package/dist/debug/html.mjs
CHANGED
@@ -1913,7 +1913,9 @@ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
|
1913
1913
|
}
|
1914
1914
|
}
|
1915
1915
|
var writeScope = (scopeId, partialScope) => {
|
1916
|
-
|
1916
|
+
return writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
1917
|
+
};
|
1918
|
+
function writeScopeToState(state, scopeId, partialScope) {
|
1917
1919
|
const { scopes } = state;
|
1918
1920
|
let scope = scopes.get(scopeId);
|
1919
1921
|
state.needsMainRuntime = true;
|
@@ -1930,7 +1932,7 @@ var writeScope = (scopeId, partialScope) => {
|
|
1930
1932
|
state.writeScopes = { [scopeId]: scope };
|
1931
1933
|
}
|
1932
1934
|
return scope;
|
1933
|
-
}
|
1935
|
+
}
|
1934
1936
|
if (true) {
|
1935
1937
|
writeScope = /* @__PURE__ */ ((writeScope2) => (scopeId, partialScope, file, loc, vars) => {
|
1936
1938
|
const scope = writeScope2(scopeId, partialScope);
|
@@ -3178,6 +3180,15 @@ var compat = {
|
|
3178
3180
|
nextScopeId,
|
3179
3181
|
peekNextScopeId,
|
3180
3182
|
isInResumedBranch,
|
3183
|
+
ensureState($global2) {
|
3184
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3185
|
+
if (!state) {
|
3186
|
+
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3187
|
+
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3188
|
+
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3189
|
+
}
|
3190
|
+
return state;
|
3191
|
+
},
|
3181
3192
|
isTagsAPI(fn) {
|
3182
3193
|
return !!fn.___id;
|
3183
3194
|
},
|
@@ -3193,32 +3204,27 @@ var compat = {
|
|
3193
3204
|
writeScope(branchId, { m5c });
|
3194
3205
|
writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
3195
3206
|
},
|
3196
|
-
toJSON() {
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3207
|
+
toJSON(state) {
|
3208
|
+
return function toJSON() {
|
3209
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
3210
|
+
if (!compatRegistered) {
|
3211
|
+
const registered = getRegistered(this);
|
3212
|
+
if (registered) {
|
3213
|
+
const scopeId = getScopeId(registered.scope);
|
3214
|
+
if (scopeId !== void 0) {
|
3215
|
+
writeScopeToState(state, scopeId, {});
|
3216
|
+
}
|
3217
|
+
COMPAT_REGISTRY.set(
|
3218
|
+
this,
|
3219
|
+
compatRegistered = [registered.id, scopeId]
|
3220
|
+
);
|
3204
3221
|
}
|
3205
|
-
COMPAT_REGISTRY.set(
|
3206
|
-
this,
|
3207
|
-
compatRegistered = [registered.id, scopeId]
|
3208
|
-
);
|
3209
3222
|
}
|
3210
|
-
|
3211
|
-
|
3223
|
+
return compatRegistered;
|
3224
|
+
};
|
3212
3225
|
},
|
3213
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
3214
|
-
const
|
3215
|
-
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
3216
|
-
if (!state) {
|
3217
|
-
$global2.runtimeId ||= DEFAULT_RUNTIME_ID;
|
3218
|
-
$global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || DEFAULT_RENDER_ID;
|
3219
|
-
$global2[K_TAGS_API_STATE] = state = new State2($global2);
|
3220
|
-
}
|
3221
|
-
const boundary = new Boundary(state);
|
3226
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
3227
|
+
const boundary = new Boundary(this.ensureState(classAPIOut.global));
|
3222
3228
|
let head = new Chunk(
|
3223
3229
|
boundary,
|
3224
3230
|
null,
|
@@ -3248,21 +3254,11 @@ var compat = {
|
|
3248
3254
|
asyncOut.error(boundary.signal.reason);
|
3249
3255
|
boundary.onNext = NOOP3;
|
3250
3256
|
} else if (!boundary.count) {
|
3251
|
-
|
3252
|
-
if (boundary.done) {
|
3253
|
-
const { html, scripts } = head.flushScript();
|
3254
|
-
writer.script(scripts);
|
3255
|
-
writer.write(html);
|
3256
|
-
} else {
|
3257
|
-
asyncOut.error(
|
3258
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
3259
|
-
);
|
3260
|
-
}
|
3261
|
-
});
|
3262
|
-
head = head.consume();
|
3257
|
+
completeChunks.push(head = head.consume());
|
3263
3258
|
asyncOut.write(head.html);
|
3259
|
+
asyncOut.script(head.scripts);
|
3264
3260
|
asyncOut.end();
|
3265
|
-
head.html = "";
|
3261
|
+
head.html = head.scripts = "";
|
3266
3262
|
}
|
3267
3263
|
})();
|
3268
3264
|
});
|
package/dist/html/compat.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { patchDynamicTag } from "./dynamic-tag";
|
2
2
|
import { type ServerRenderer } from "./template";
|
3
|
-
import { $global, Chunk, fork, isInResumedBranch, nextScopeId, peekNextScopeId, write, writeScript } from "./writer";
|
3
|
+
import { $global, Chunk, fork, isInResumedBranch, nextScopeId, peekNextScopeId, State, write, writeScript } from "./writer";
|
4
4
|
export declare const compat: {
|
5
5
|
$global: typeof $global;
|
6
6
|
fork: typeof fork;
|
@@ -9,12 +9,13 @@ export declare const compat: {
|
|
9
9
|
nextScopeId: typeof nextScopeId;
|
10
10
|
peekNextScopeId: typeof peekNextScopeId;
|
11
11
|
isInResumedBranch: typeof isInResumedBranch;
|
12
|
+
ensureState($global: any): State;
|
12
13
|
isTagsAPI(fn: any): boolean;
|
13
14
|
onFlush(fn: (chunk: Chunk) => void): void;
|
14
15
|
patchDynamicTag: typeof patchDynamicTag;
|
15
16
|
writeSetScopeForComponent(branchId: number, m5c: string): void;
|
16
|
-
toJSON(this: WeakKey)
|
17
|
-
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any,
|
17
|
+
toJSON(state: State): (this: WeakKey) => [registryId: string, scopeId: unknown] | undefined;
|
18
|
+
render(renderer: ServerRenderer, willRerender: boolean, classAPIOut: any, component: any, input: any, completeChunks: Chunk[]): void;
|
18
19
|
registerRenderer(renderer: any, id: string): any;
|
19
20
|
registerRenderBody(fn: any): void;
|
20
21
|
};
|
package/dist/html/writer.d.ts
CHANGED
@@ -44,6 +44,7 @@ export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: un
|
|
44
44
|
export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
45
45
|
export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
|
46
46
|
declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
|
47
|
+
export declare function writeScopeToState(state: State, scopeId: number, partialScope: PartialScope): ScopeInternals;
|
47
48
|
export { writeScope };
|
48
49
|
export declare function writeExistingScope(scopeId: number): ScopeInternals;
|
49
50
|
export declare function ensureScopeWithId(scopeId: number): PartialScope;
|
package/dist/html.js
CHANGED
@@ -1291,10 +1291,11 @@ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
|
1291
1291
|
let endTag = parentEndTag || "";
|
1292
1292
|
resumeMarker ? mark ? $chunk.writeHTML(mark + endTag) : $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor)) : $chunk.writeHTML(endTag);
|
1293
1293
|
}
|
1294
|
-
var writeScope = (scopeId, partialScope) =>
|
1295
|
-
|
1294
|
+
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
1295
|
+
function writeScopeToState(state, scopeId, partialScope) {
|
1296
|
+
let { scopes } = state, scope = scopes.get(scopeId);
|
1296
1297
|
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|
1297
|
-
}
|
1298
|
+
}
|
1298
1299
|
function writeExistingScope(scopeId) {
|
1299
1300
|
return writeScope(scopeId, ensureScopeWithId(scopeId));
|
1300
1301
|
}
|
@@ -2097,6 +2098,10 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2097
2098
|
nextScopeId,
|
2098
2099
|
peekNextScopeId,
|
2099
2100
|
isInResumedBranch,
|
2101
|
+
ensureState($global2) {
|
2102
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
2103
|
+
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
2104
|
+
},
|
2100
2105
|
isTagsAPI(fn) {
|
2101
2106
|
return !!fn.h;
|
2102
2107
|
},
|
@@ -2110,24 +2115,24 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2110
2115
|
writeSetScopeForComponent(branchId, m5c) {
|
2111
2116
|
writeScope(branchId, { m5c }), writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
2112
2117
|
},
|
2113
|
-
toJSON() {
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2118
|
+
toJSON(state) {
|
2119
|
+
return function() {
|
2120
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
2121
|
+
if (!compatRegistered) {
|
2122
|
+
let registered = getRegistered(this);
|
2123
|
+
if (registered) {
|
2124
|
+
let scopeId = getScopeId(registered.scope);
|
2125
|
+
scopeId !== void 0 && writeScopeToState(state, scopeId, {}), COMPAT_REGISTRY.set(
|
2126
|
+
this,
|
2127
|
+
compatRegistered = [registered.id, scopeId]
|
2128
|
+
);
|
2129
|
+
}
|
2123
2130
|
}
|
2124
|
-
|
2125
|
-
|
2131
|
+
return compatRegistered;
|
2132
|
+
};
|
2126
2133
|
},
|
2127
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
2128
|
-
let
|
2129
|
-
state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
2130
|
-
let boundary = new Boundary(state), head = new Chunk(
|
2134
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
2135
|
+
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
2131
2136
|
boundary,
|
2132
2137
|
null,
|
2133
2138
|
null
|
@@ -2145,15 +2150,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2145
2150
|
isTemplate(renderer) && willRerender ? renderer(normalizedInput, 1) : renderer(normalizedInput);
|
2146
2151
|
let asyncOut = classAPIOut.beginAsync();
|
2147
2152
|
(boundary.onNext = () => {
|
2148
|
-
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (asyncOut.
|
2149
|
-
if (boundary.done) {
|
2150
|
-
let { html, scripts } = head.flushScript();
|
2151
|
-
writer.script(scripts), writer.write(html);
|
2152
|
-
} else
|
2153
|
-
asyncOut.error(
|
2154
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
2155
|
-
);
|
2156
|
-
}), head = head.consume(), asyncOut.write(head.html), asyncOut.end(), head.html = "");
|
2153
|
+
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (completeChunks.push(head = head.consume()), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "");
|
2157
2154
|
})();
|
2158
2155
|
});
|
2159
2156
|
},
|
package/dist/html.mjs
CHANGED
@@ -1210,10 +1210,11 @@ function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
|
|
1210
1210
|
let endTag = parentEndTag || "";
|
1211
1211
|
resumeMarker ? mark ? $chunk.writeHTML(mark + endTag) : $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor)) : $chunk.writeHTML(endTag);
|
1212
1212
|
}
|
1213
|
-
var writeScope = (scopeId, partialScope) =>
|
1214
|
-
|
1213
|
+
var writeScope = (scopeId, partialScope) => writeScopeToState($chunk.boundary.state, scopeId, partialScope);
|
1214
|
+
function writeScopeToState(state, scopeId, partialScope) {
|
1215
|
+
let { scopes } = state, scope = scopes.get(scopeId);
|
1215
1216
|
return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
|
1216
|
-
}
|
1217
|
+
}
|
1217
1218
|
function writeExistingScope(scopeId) {
|
1218
1219
|
return writeScope(scopeId, ensureScopeWithId(scopeId));
|
1219
1220
|
}
|
@@ -2016,6 +2017,10 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2016
2017
|
nextScopeId,
|
2017
2018
|
peekNextScopeId,
|
2018
2019
|
isInResumedBranch,
|
2020
|
+
ensureState($global2) {
|
2021
|
+
let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
|
2022
|
+
return state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2)), state;
|
2023
|
+
},
|
2019
2024
|
isTagsAPI(fn) {
|
2020
2025
|
return !!fn.h;
|
2021
2026
|
},
|
@@ -2029,24 +2034,24 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2029
2034
|
writeSetScopeForComponent(branchId, m5c) {
|
2030
2035
|
writeScope(branchId, { m5c }), writeEffect(branchId, SET_SCOPE_REGISTER_ID);
|
2031
2036
|
},
|
2032
|
-
toJSON() {
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2037
|
+
toJSON(state) {
|
2038
|
+
return function() {
|
2039
|
+
let compatRegistered = COMPAT_REGISTRY.get(this);
|
2040
|
+
if (!compatRegistered) {
|
2041
|
+
let registered = getRegistered(this);
|
2042
|
+
if (registered) {
|
2043
|
+
let scopeId = getScopeId(registered.scope);
|
2044
|
+
scopeId !== void 0 && writeScopeToState(state, scopeId, {}), COMPAT_REGISTRY.set(
|
2045
|
+
this,
|
2046
|
+
compatRegistered = [registered.id, scopeId]
|
2047
|
+
);
|
2048
|
+
}
|
2042
2049
|
}
|
2043
|
-
|
2044
|
-
|
2050
|
+
return compatRegistered;
|
2051
|
+
};
|
2045
2052
|
},
|
2046
|
-
render(renderer, willRerender, classAPIOut, component, input,
|
2047
|
-
let
|
2048
|
-
state || ($global2.runtimeId ||= "M", $global2.renderId ||= $global2.componentIdPrefix || $global2.widgetIdPrefix || "_", $global2[K_TAGS_API_STATE] = state = new State2($global2));
|
2049
|
-
let boundary = new Boundary(state), head = new Chunk(
|
2053
|
+
render(renderer, willRerender, classAPIOut, component, input, completeChunks) {
|
2054
|
+
let boundary = new Boundary(this.ensureState(classAPIOut.global)), head = new Chunk(
|
2050
2055
|
boundary,
|
2051
2056
|
null,
|
2052
2057
|
null
|
@@ -2064,15 +2069,7 @@ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap()
|
|
2064
2069
|
isTemplate(renderer) && willRerender ? renderer(normalizedInput, 1) : renderer(normalizedInput);
|
2065
2070
|
let asyncOut = classAPIOut.beginAsync();
|
2066
2071
|
(boundary.onNext = () => {
|
2067
|
-
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (asyncOut.
|
2068
|
-
if (boundary.done) {
|
2069
|
-
let { html, scripts } = head.flushScript();
|
2070
|
-
writer.script(scripts), writer.write(html);
|
2071
|
-
} else
|
2072
|
-
asyncOut.error(
|
2073
|
-
new Error("Cannot serialize promises with class/tags interop.")
|
2074
|
-
);
|
2075
|
-
}), head = head.consume(), asyncOut.write(head.html), asyncOut.end(), head.html = "");
|
2072
|
+
boundary.signal.aborted ? (asyncOut.error(boundary.signal.reason), boundary.onNext = NOOP3) : boundary.count || (completeChunks.push(head = head.consume()), asyncOut.write(head.html), asyncOut.script(head.scripts), asyncOut.end(), head.html = head.scripts = "");
|
2076
2073
|
})();
|
2077
2074
|
});
|
2078
2075
|
},
|
package/dist/translator/index.js
CHANGED
@@ -1194,7 +1194,7 @@ var import_compiler5 = require("@marko/compiler");
|
|
1194
1194
|
var import_babel_utils6 = require("@marko/compiler/babel-utils");
|
1195
1195
|
var kState = Symbol();
|
1196
1196
|
var entry_builder_default = {
|
1197
|
-
build(entryFile) {
|
1197
|
+
build(entryFile, exportInit) {
|
1198
1198
|
const state = entryFile[kState];
|
1199
1199
|
if (!state) {
|
1200
1200
|
throw entryFile.path.buildCodeFrameError(
|
@@ -1214,12 +1214,19 @@ var entry_builder_default = {
|
|
1214
1214
|
)
|
1215
1215
|
);
|
1216
1216
|
const { runtimeId } = entryFile.markoOpts;
|
1217
|
+
const initExpression = import_compiler5.types.callExpression(
|
1218
|
+
import_compiler5.types.identifier("init"),
|
1219
|
+
runtimeId ? [import_compiler5.types.stringLiteral(runtimeId)] : []
|
1220
|
+
);
|
1217
1221
|
body.push(
|
1218
|
-
import_compiler5.types.
|
1219
|
-
import_compiler5.types.
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1222
|
+
exportInit ? import_compiler5.types.exportDefaultDeclaration(
|
1223
|
+
import_compiler5.types.arrowFunctionExpression([], initExpression)
|
1224
|
+
) : import_compiler5.types.expressionStatement(initExpression)
|
1225
|
+
);
|
1226
|
+
} else if (exportInit) {
|
1227
|
+
body.push(
|
1228
|
+
import_compiler5.types.exportDefaultDeclaration(
|
1229
|
+
import_compiler5.types.arrowFunctionExpression([], import_compiler5.types.blockStatement([]))
|
1223
1230
|
)
|
1224
1231
|
);
|
1225
1232
|
}
|
@@ -2673,7 +2680,12 @@ var [getWalkComment] = createSectionState(
|
|
2673
2680
|
"walkComment",
|
2674
2681
|
() => []
|
2675
2682
|
);
|
2676
|
-
var [getSteps] = createSectionState("steps", () =>
|
2683
|
+
var [getSteps] = createSectionState("steps", (section) => {
|
2684
|
+
if (section.content?.startType === 1 /* Dynamic */) {
|
2685
|
+
return [0 /* Enter */, 1 /* Exit */];
|
2686
|
+
}
|
2687
|
+
return [];
|
2688
|
+
});
|
2677
2689
|
var walkCodeToName = {
|
2678
2690
|
[32 /* Get */]: "get",
|
2679
2691
|
[36 /* Inside */]: "inside",
|
@@ -2692,17 +2704,23 @@ var walkCodeToName = {
|
|
2692
2704
|
[126 /* MultiplierEnd */]: "multiplierEnd"
|
2693
2705
|
};
|
2694
2706
|
function enter2(path5) {
|
2695
|
-
getSteps(getSection(path5))
|
2707
|
+
const steps = getSteps(getSection(path5));
|
2708
|
+
steps.push(0 /* Enter */);
|
2696
2709
|
}
|
2697
2710
|
function exit2(path5) {
|
2698
|
-
getSteps(getSection(path5))
|
2711
|
+
const steps = getSteps(getSection(path5));
|
2712
|
+
steps.push(1 /* Exit */);
|
2699
2713
|
}
|
2700
2714
|
function enterShallow(path5) {
|
2701
|
-
|
2715
|
+
const section = getSection(path5);
|
2716
|
+
const steps = getSteps(section);
|
2717
|
+
steps.push(0 /* Enter */, 1 /* Exit */);
|
2702
2718
|
}
|
2703
2719
|
function injectWalks(tag, expr) {
|
2704
|
-
const
|
2705
|
-
const
|
2720
|
+
const section = getSection(tag);
|
2721
|
+
const walks = getWalks(section);
|
2722
|
+
const walkComment = getWalkComment(section);
|
2723
|
+
visitInternal(section);
|
2706
2724
|
walkComment.push(
|
2707
2725
|
`${walkCodeToName[tag.node.var ? 48 /* BeginChildWithVar */ : 47 /* BeginChild */]}`,
|
2708
2726
|
expr.name,
|
@@ -2721,52 +2739,54 @@ function visit(path5, code) {
|
|
2721
2739
|
return;
|
2722
2740
|
}
|
2723
2741
|
const section = getSection(path5);
|
2742
|
+
const walks = getWalks(section);
|
2743
|
+
const walkComment = getWalkComment(section);
|
2744
|
+
visitInternal(section);
|
2745
|
+
if (code !== 32 /* Get */) {
|
2746
|
+
writeTo(path5)`<!>`;
|
2747
|
+
}
|
2748
|
+
walkComment.push(`${walkCodeToName[code]}`);
|
2749
|
+
appendLiteral(walks, String.fromCharCode(code));
|
2750
|
+
}
|
2751
|
+
function visitInternal(section) {
|
2724
2752
|
const steps = getSteps(section);
|
2753
|
+
if (!steps.length) return;
|
2725
2754
|
const walks = getWalks(section);
|
2726
2755
|
const walkComment = getWalkComment(section);
|
2756
|
+
const walkCodes = [];
|
2727
2757
|
let walkString = "";
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
walkCodes.length = walkCodes.lastIndexOf(67 /* Next */);
|
2739
|
-
walkCodes.push(97 /* Over */);
|
2740
|
-
} else {
|
2741
|
-
walkCodes.length = walkCodes.lastIndexOf(107 /* Out */) + 1;
|
2742
|
-
walkCodes.push(107 /* Out */);
|
2743
|
-
depth = 0;
|
2744
|
-
}
|
2745
|
-
}
|
2746
|
-
}
|
2747
|
-
let current = walkCodes[0];
|
2748
|
-
let count = 0;
|
2749
|
-
for (const walk of walkCodes) {
|
2750
|
-
if (walk !== current) {
|
2751
|
-
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2752
|
-
walkString += nCodeString(current, count);
|
2753
|
-
current = walk;
|
2754
|
-
count = 1;
|
2758
|
+
let depth = 0;
|
2759
|
+
for (const step of steps) {
|
2760
|
+
if (step === 0 /* Enter */) {
|
2761
|
+
depth++;
|
2762
|
+
walkCodes.push(67 /* Next */);
|
2763
|
+
} else {
|
2764
|
+
depth--;
|
2765
|
+
if (depth >= 0) {
|
2766
|
+
walkCodes.length = walkCodes.lastIndexOf(67 /* Next */);
|
2767
|
+
walkCodes.push(97 /* Over */);
|
2755
2768
|
} else {
|
2756
|
-
|
2769
|
+
walkCodes.length = walkCodes.lastIndexOf(107 /* Out */) + 1;
|
2770
|
+
walkCodes.push(107 /* Out */);
|
2771
|
+
depth = 0;
|
2757
2772
|
}
|
2758
2773
|
}
|
2759
|
-
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2760
|
-
walkString += nCodeString(current, count);
|
2761
|
-
steps.length = 0;
|
2762
2774
|
}
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2775
|
+
let current = walkCodes[0];
|
2776
|
+
let count = 0;
|
2777
|
+
for (const walk of walkCodes) {
|
2778
|
+
if (walk !== current) {
|
2779
|
+
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2780
|
+
walkString += nCodeString(current, count);
|
2781
|
+
current = walk;
|
2782
|
+
count = 1;
|
2783
|
+
} else {
|
2784
|
+
count++;
|
2766
2785
|
}
|
2767
|
-
walkComment.push(`${walkCodeToName[code]}`);
|
2768
|
-
walkString += String.fromCharCode(code);
|
2769
2786
|
}
|
2787
|
+
walkComment.push(`${walkCodeToName[current]}(${count})`);
|
2788
|
+
walkString += nCodeString(current, count);
|
2789
|
+
steps.length = 0;
|
2770
2790
|
appendLiteral(walks, walkString);
|
2771
2791
|
}
|
2772
2792
|
function nCodeString(code, number) {
|
@@ -2796,10 +2816,12 @@ function toCharString(number, startCode, rangeSize) {
|
|
2796
2816
|
return result;
|
2797
2817
|
}
|
2798
2818
|
function getWalkString(section) {
|
2799
|
-
|
2800
|
-
|
2819
|
+
if (section.content?.endType === 1 /* Dynamic */) {
|
2820
|
+
getSteps(section).push(0 /* Enter */, 1 /* Exit */);
|
2821
|
+
}
|
2822
|
+
visitInternal(section);
|
2801
2823
|
const walks = getWalks(section);
|
2802
|
-
const walkLiteral = normalizeStringExpression(
|
2824
|
+
const walkLiteral = normalizeStringExpression(walks);
|
2803
2825
|
if (walkLiteral && walkLiteral.value !== "") {
|
2804
2826
|
withLeadingComment(walkLiteral, getWalkComment(section).join(", "));
|
2805
2827
|
}
|
@@ -4142,7 +4164,6 @@ function getRegisteredFnExpression2(node) {
|
|
4142
4164
|
var dom_default = {
|
4143
4165
|
translate: {
|
4144
4166
|
exit(program) {
|
4145
|
-
visit(program);
|
4146
4167
|
const section = getSectionForBody(program);
|
4147
4168
|
const { walks, writes, setup } = getSectionMeta(section);
|
4148
4169
|
const domExports = program.node.extra.domExports;
|
@@ -10499,7 +10520,6 @@ var custom_tag_default = {
|
|
10499
10520
|
},
|
10500
10521
|
translate: {
|
10501
10522
|
enter(tag) {
|
10502
|
-
visit(tag);
|
10503
10523
|
if (isOutputHTML()) {
|
10504
10524
|
flushBefore(tag);
|
10505
10525
|
}
|
@@ -14,7 +14,7 @@ type EntryFile = t.BabelFile & {
|
|
14
14
|
};
|
15
15
|
declare const kState: unique symbol;
|
16
16
|
declare const _default: {
|
17
|
-
build(entryFile: EntryFile): t.Statement[];
|
17
|
+
build(entryFile: EntryFile, exportInit?: boolean): t.Statement[];
|
18
18
|
visit(file: t.BabelFile, entryFile: EntryFile, visitChild: (id: string) => void): void;
|
19
19
|
};
|
20
20
|
export default _default;
|
@@ -10,6 +10,6 @@ export declare function enter(path: t.NodePath<any>): void;
|
|
10
10
|
export declare function exit(path: t.NodePath<any>): void;
|
11
11
|
export declare function enterShallow(path: t.NodePath<any>): void;
|
12
12
|
export declare function injectWalks(tag: t.NodePath<t.MarkoTag>, expr: t.Expression): void;
|
13
|
-
export declare function visit(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder | t.Program>, code
|
13
|
+
export declare function visit(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder | t.Program>, code: VisitCodes): void;
|
14
14
|
export declare function getWalkString(section: Section): t.Expression | undefined;
|
15
15
|
export {};
|