@vesk/vesk-cli 0.2.36 → 0.2.37
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/cli.js +821 -201
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -2488,6 +2488,9 @@ function adoptElementRaw(marker, tag) {
|
|
|
2488
2488
|
}
|
|
2489
2489
|
function createHydrateWalker(container, markerList) {
|
|
2490
2490
|
const markers = markerList || (container ? collectVskMarkers(container) : []);
|
|
2491
|
+
if (!markerList && container && markers.length === 0 && container.children.length > 0) {
|
|
2492
|
+
return new StructuralWalker(container);
|
|
2493
|
+
}
|
|
2491
2494
|
return new WalkerEngine(container, markers);
|
|
2492
2495
|
}
|
|
2493
2496
|
function bumpNavEpoch() {
|
|
@@ -2685,7 +2688,7 @@ function hydrateOnInteraction(container, componentFn, props, options = {}) {
|
|
|
2685
2688
|
}
|
|
2686
2689
|
};
|
|
2687
2690
|
}
|
|
2688
|
-
var __hydrateDevMode, CLAIMED_ATTR, __hydrateStrict, __mismatchHandler, _SHOW_COMMENT, _FILTER_ACCEPT, _FILTER_SKIP, WalkerEngine;
|
|
2691
|
+
var __hydrateDevMode, CLAIMED_ATTR, __hydrateStrict, __mismatchHandler, _SHOW_COMMENT, _FILTER_ACCEPT, _FILTER_SKIP, WalkerEngine, StructuralWalker;
|
|
2689
2692
|
var init_hydrate = __esm({
|
|
2690
2693
|
"../runtime/src/hydrate.ts"() {
|
|
2691
2694
|
"use strict";
|
|
@@ -2990,7 +2993,7 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
|
|
|
2990
2993
|
}
|
|
2991
2994
|
return null;
|
|
2992
2995
|
}
|
|
2993
|
-
insertBeforeNextClaim(node) {
|
|
2996
|
+
insertBeforeNextClaim(node, _offset = 0) {
|
|
2994
2997
|
let i = this.idx;
|
|
2995
2998
|
while (i < this.markers.length && this.markers[i].state === "claimed") i++;
|
|
2996
2999
|
const next = i < this.markers.length ? this.markers[i] : null;
|
|
@@ -3003,6 +3006,184 @@ ${String(this.root.outerHTML).slice(0, 800)}` : ""),
|
|
|
3003
3006
|
return false;
|
|
3004
3007
|
}
|
|
3005
3008
|
}
|
|
3009
|
+
injectSkipK(_n) {
|
|
3010
|
+
}
|
|
3011
|
+
takeSkipK() {
|
|
3012
|
+
return 0;
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
StructuralWalker = class _StructuralWalker {
|
|
3016
|
+
root;
|
|
3017
|
+
// Snapshot taken at construction, so fresh nodes mounted during the render
|
|
3018
|
+
// are never re-claimed and claims stay aligned to the SSR source list.
|
|
3019
|
+
els;
|
|
3020
|
+
idx = 0;
|
|
3021
|
+
adopted = /* @__PURE__ */ new WeakSet();
|
|
3022
|
+
constructor(root3, els) {
|
|
3023
|
+
this.root = root3;
|
|
3024
|
+
this.els = els || (root3 ? Array.prototype.slice.call(root3.children) : []);
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Non-claimable framework preamble elements that the SSR renderer may emit
|
|
3028
|
+
* as real DOM nodes ahead of a component's first claimable element (scoped
|
|
3029
|
+
* `<style>` blocks, the loader title). The marker stream tracked them
|
|
3030
|
+
* implicitly; the structural walker must step PAST them without consuming a
|
|
3031
|
+
* claim slot, otherwise every subsequent positional claim shifts by one and
|
|
3032
|
+
* the whole subtree falls back to fresh-node building.
|
|
3033
|
+
*/
|
|
3034
|
+
static skipTags = /* @__PURE__ */ new Set(["style", "script", "template", "title", "meta", "link", "base"]);
|
|
3035
|
+
static isSkippable(el) {
|
|
3036
|
+
return _StructuralWalker.skipTags.has(el.tagName.toLowerCase());
|
|
3037
|
+
}
|
|
3038
|
+
advancePastSkippable(index) {
|
|
3039
|
+
while (index < this.els.length && _StructuralWalker.isSkippable(this.els[index])) index++;
|
|
3040
|
+
return index;
|
|
3041
|
+
}
|
|
3042
|
+
done() {
|
|
3043
|
+
return this.idx >= this.els.length;
|
|
3044
|
+
}
|
|
3045
|
+
remainingCount() {
|
|
3046
|
+
return this.els.length - this.idx;
|
|
3047
|
+
}
|
|
3048
|
+
/**
|
|
3049
|
+
* Insert `node` immediately before the `offset`-th unconsumed SSR element
|
|
3050
|
+
* after the `skipK` cursor slot. Falls back to appending at the end of the
|
|
3051
|
+
* root. Used by root-level dynamic regions whose branch had no SSR content:
|
|
3052
|
+
* the fence anchors at the region's source position instead of the root's
|
|
3053
|
+
* end. `offset` carries the region's first-claim budget (SSR slots past the
|
|
3054
|
+
* cursor): a region that follows static residue must anchor after those
|
|
3055
|
+
* residue slots, at exactly where its own first claim will land — otherwise
|
|
3056
|
+
* fences wrap the WRONG slot and `__place` relocates the claimed content
|
|
3057
|
+
* (e.g. a try/catch whose preceding h2/p/style residue pushes its slot to
|
|
3058
|
+
* `idx + 3`).
|
|
3059
|
+
*/
|
|
3060
|
+
insertBeforeCursor(node, offset2 = 0) {
|
|
3061
|
+
const host = this.root;
|
|
3062
|
+
if (host === null || host === void 0) return false;
|
|
3063
|
+
try {
|
|
3064
|
+
let n = this.advancePastSkippable(this.idx + (offset2 || 0));
|
|
3065
|
+
while (n < this.els.length && this.els[n].parentNode !== host) n++;
|
|
3066
|
+
if (n < this.els.length) host.insertBefore(node, this.els[n]);
|
|
3067
|
+
else host.appendChild(node);
|
|
3068
|
+
return true;
|
|
3069
|
+
} catch {
|
|
3070
|
+
return false;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
// Markerless value-thread offset (Phase 3.c): a transient residue deposit for
|
|
3074
|
+
// a compiled component's first top-level claim. `injectSkipK` is emitted by
|
|
3075
|
+
// the CALLER before invoking a self-claiming child (which cannot see the
|
|
3076
|
+
// caller's compile-time skipK); `takeSkipK` is read exactly once at the
|
|
3077
|
+
// callee's first claim and resets the deposit so later claims stay
|
|
3078
|
+
// positional against the advancing cursor. Consumed synchronously on the
|
|
3079
|
+
// same walker reference the call was made through.
|
|
3080
|
+
inheritOffset = 0;
|
|
3081
|
+
injectSkipK(n) {
|
|
3082
|
+
this.inheritOffset = n;
|
|
3083
|
+
}
|
|
3084
|
+
takeSkipK() {
|
|
3085
|
+
const n = this.inheritOffset;
|
|
3086
|
+
this.inheritOffset = 0;
|
|
3087
|
+
return n;
|
|
3088
|
+
}
|
|
3089
|
+
claimAt(tag, skipK, raw2) {
|
|
3090
|
+
if (globalThis.__vesk_hydrate_debug) {
|
|
3091
|
+
console.error("[hyd-dbg] claimAt", tag, "skip=", skipK, "idx=", this.idx, "els=", this.els.length);
|
|
3092
|
+
}
|
|
3093
|
+
let target = this.advancePastSkippable(this.idx + (skipK || 0));
|
|
3094
|
+
if (target > this.els.length) target = this.idx;
|
|
3095
|
+
while (target < this.els.length) {
|
|
3096
|
+
const el = this.els[target];
|
|
3097
|
+
if (tag && el.tagName.toLowerCase() !== tag) {
|
|
3098
|
+
this.idx = this.advancePastSkippable(target + 1);
|
|
3099
|
+
reportMiss(
|
|
3100
|
+
"tag-mismatch",
|
|
3101
|
+
`descriptor wanted <${tag}> but the SSR slot holds <${el.tagName.toLowerCase()}>; consuming one slot and rendering fresh.`,
|
|
3102
|
+
false
|
|
3103
|
+
);
|
|
3104
|
+
return document.createElement(tag || "div");
|
|
3105
|
+
}
|
|
3106
|
+
if (this.adopted.has(el)) {
|
|
3107
|
+
target = this.advancePastSkippable(target + 1);
|
|
3108
|
+
continue;
|
|
3109
|
+
}
|
|
3110
|
+
this.idx = this.advancePastSkippable(target + 1);
|
|
3111
|
+
this.adopted.add(el);
|
|
3112
|
+
if (!raw2) stripDirectTextNodes(el);
|
|
3113
|
+
captureSsrElementChildren(el);
|
|
3114
|
+
stampClaimed(el);
|
|
3115
|
+
return el;
|
|
3116
|
+
}
|
|
3117
|
+
this.idx = this.els.length;
|
|
3118
|
+
reportMiss(
|
|
3119
|
+
"exhausted",
|
|
3120
|
+
`hydration claim missed <${tag || "element"}>; the client rendered more or different content than SSR.`,
|
|
3121
|
+
// Not loud: an exhausted walker is the normal post-hydration
|
|
3122
|
+
// re-render shape (every further claim legitimately builds fresh
|
|
3123
|
+
// nodes) — telemetry-only, mirroring the marker engine.
|
|
3124
|
+
false
|
|
3125
|
+
);
|
|
3126
|
+
return document.createElement(tag || "div");
|
|
3127
|
+
}
|
|
3128
|
+
nextElement(tag, skipK = 0) {
|
|
3129
|
+
return this.claimAt(tag, skipK, false);
|
|
3130
|
+
}
|
|
3131
|
+
claimOnly(tag, skipK = 0) {
|
|
3132
|
+
return this.claimAt(tag, skipK, true);
|
|
3133
|
+
}
|
|
3134
|
+
subWalker(rootEl) {
|
|
3135
|
+
if (globalThis.__vesk_hydrate_debug) {
|
|
3136
|
+
console.error("[hyd-dbg] subWalker over <" + (rootEl && rootEl.tagName) + "> kids=" + (rootEl ? rootEl.children.length : -1));
|
|
3137
|
+
}
|
|
3138
|
+
return new _StructuralWalker(rootEl);
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* Markerless region scope (Phase 3.e): keyed lists claim their items from a
|
|
3142
|
+
* walker over their OWN container, not the top-level walker — the top
|
|
3143
|
+
* walker's positional cursor would otherwise adopt the region container's
|
|
3144
|
+
* siblings. The scoped walker snapshots the region's children and SHARES
|
|
3145
|
+
* the adoption ledger, so sibling regions in the same container never
|
|
3146
|
+
* double-claim (skip `adopted`) and top-level claims never re-adopt a node
|
|
3147
|
+
* the region already claimed.
|
|
3148
|
+
*/
|
|
3149
|
+
scopeToRegion(rootEl) {
|
|
3150
|
+
const w = new _StructuralWalker(rootEl);
|
|
3151
|
+
w.adopted = this.adopted;
|
|
3152
|
+
return w;
|
|
3153
|
+
}
|
|
3154
|
+
retireDetached() {
|
|
3155
|
+
}
|
|
3156
|
+
takeMarkers(_comments) {
|
|
3157
|
+
}
|
|
3158
|
+
claimByKey(_key, _options) {
|
|
3159
|
+
const k = _options && _options.skipK || 0;
|
|
3160
|
+
if (globalThis.__vesk_hydrate_debug) {
|
|
3161
|
+
console.error("[hyd-dbg] claimByKey key=", _key, "idx=", this.idx, "els=", this.els.length, "root=<", this.root ? this.root.tagName : "-", ">");
|
|
3162
|
+
}
|
|
3163
|
+
let target = this.advancePastSkippable(this.idx + k);
|
|
3164
|
+
if (target > this.els.length) target = this.idx;
|
|
3165
|
+
while (target < this.els.length) {
|
|
3166
|
+
const el = this.els[target];
|
|
3167
|
+
if (this.adopted.has(el)) {
|
|
3168
|
+
target = this.advancePastSkippable(target + 1);
|
|
3169
|
+
continue;
|
|
3170
|
+
}
|
|
3171
|
+
this.idx = this.advancePastSkippable(target + 1);
|
|
3172
|
+
this.adopted.add(el);
|
|
3173
|
+
stripDirectTextNodes(el);
|
|
3174
|
+
captureSsrElementChildren(el);
|
|
3175
|
+
stampClaimed(el);
|
|
3176
|
+
return { el };
|
|
3177
|
+
}
|
|
3178
|
+
this.idx = this.els.length;
|
|
3179
|
+
return null;
|
|
3180
|
+
}
|
|
3181
|
+
peekKey(_key) {
|
|
3182
|
+
return null;
|
|
3183
|
+
}
|
|
3184
|
+
insertBeforeNextClaim(node, offset2 = 0) {
|
|
3185
|
+
return this.insertBeforeCursor(node, offset2);
|
|
3186
|
+
}
|
|
3006
3187
|
};
|
|
3007
3188
|
}
|
|
3008
3189
|
});
|
|
@@ -3543,36 +3724,58 @@ function handleScroll(pathname, isReplace, scrollBehavior) {
|
|
|
3543
3724
|
requestAnimationFrame(() => window.scrollTo({ top: 0, behavior }));
|
|
3544
3725
|
}
|
|
3545
3726
|
}
|
|
3727
|
+
function applyHeadAttrs(el, raw2) {
|
|
3728
|
+
for (const attrMatch of raw2.matchAll(/([a-zA-Z0-9\-:]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) {
|
|
3729
|
+
const name = attrMatch[1];
|
|
3730
|
+
const value = attrMatch[3] ?? attrMatch[4] ?? "";
|
|
3731
|
+
if (name.toLowerCase() === "charset") continue;
|
|
3732
|
+
el.setAttribute(name, value);
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3546
3735
|
function applyHead(headHtml) {
|
|
3547
|
-
if (typeof document === "undefined"
|
|
3736
|
+
if (typeof document === "undefined") return;
|
|
3548
3737
|
const head = document.head;
|
|
3549
3738
|
if (!head) return;
|
|
3550
3739
|
for (const el of Array.from(head.querySelectorAll("[" + HEAD_MARKER + "]"))) {
|
|
3551
3740
|
el.remove();
|
|
3552
3741
|
}
|
|
3742
|
+
if (!headHtml) return;
|
|
3553
3743
|
const titleMatch = headHtml.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
3554
3744
|
if (titleMatch) {
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
t.textContent = titleMatch[1];
|
|
3560
|
-
head.appendChild(t);
|
|
3561
|
-
}
|
|
3745
|
+
const t = document.createElement("title");
|
|
3746
|
+
t.textContent = titleMatch[1];
|
|
3747
|
+
t.setAttribute(HEAD_MARKER, "");
|
|
3748
|
+
head.appendChild(t);
|
|
3562
3749
|
}
|
|
3563
3750
|
for (const m of headHtml.matchAll(/<meta\b([^>]*)>/gi)) {
|
|
3564
3751
|
const meta = document.createElement("meta");
|
|
3565
|
-
|
|
3566
|
-
for (const attrMatch of raw2.matchAll(/([a-zA-Z0-9\-:]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) {
|
|
3567
|
-
const name = attrMatch[1];
|
|
3568
|
-
const value = attrMatch[3] ?? attrMatch[4] ?? "";
|
|
3569
|
-
if (name.toLowerCase() === "charset") continue;
|
|
3570
|
-
meta.setAttribute(name, value);
|
|
3571
|
-
}
|
|
3752
|
+
applyHeadAttrs(meta, m[1] || "");
|
|
3572
3753
|
if (!meta.hasAttributes()) continue;
|
|
3573
3754
|
meta.setAttribute(HEAD_MARKER, "");
|
|
3574
3755
|
head.appendChild(meta);
|
|
3575
3756
|
}
|
|
3757
|
+
for (const m of headHtml.matchAll(/<link\b([^>]*)>/gi)) {
|
|
3758
|
+
const link = document.createElement("link");
|
|
3759
|
+
applyHeadAttrs(link, m[1] || "");
|
|
3760
|
+
if (!link.hasAttributes()) continue;
|
|
3761
|
+
link.setAttribute(HEAD_MARKER, "");
|
|
3762
|
+
head.appendChild(link);
|
|
3763
|
+
}
|
|
3764
|
+
const baseMatch = headHtml.match(/<base\b([^>]*)>/i);
|
|
3765
|
+
if (baseMatch) {
|
|
3766
|
+
const base = document.createElement("base");
|
|
3767
|
+
applyHeadAttrs(base, baseMatch[1] || "");
|
|
3768
|
+
if (base.hasAttributes()) {
|
|
3769
|
+
base.setAttribute(HEAD_MARKER, "");
|
|
3770
|
+
head.appendChild(base);
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
for (const m of headHtml.matchAll(/<style\b([^>]*)>([\s\S]*?)<\/style>/gi)) {
|
|
3774
|
+
const style = document.createElement("style");
|
|
3775
|
+
style.textContent = m[2];
|
|
3776
|
+
style.setAttribute(HEAD_MARKER, "");
|
|
3777
|
+
head.appendChild(style);
|
|
3778
|
+
}
|
|
3576
3779
|
}
|
|
3577
3780
|
function Outlet(props) {
|
|
3578
3781
|
const router = RouterCtx.get();
|
|
@@ -3637,6 +3840,10 @@ function Link(props, registry, hydrate) {
|
|
|
3637
3840
|
childStr = typeof props.children === "string" ? props.children : typeof props.children === "number" ? String(props.children) : "";
|
|
3638
3841
|
}
|
|
3639
3842
|
if (typeof document === "undefined") {
|
|
3843
|
+
const markerlessSsr = globalThis.__vsk_ssr_markerless === true;
|
|
3844
|
+
if (markerlessSsr) {
|
|
3845
|
+
return `<a ${attrs}>${childStr}</a>`;
|
|
3846
|
+
}
|
|
3640
3847
|
return `<!--vsk:c:Link--><a ${attrs}>${childStr}</a>`;
|
|
3641
3848
|
}
|
|
3642
3849
|
const a = document.createElement("a");
|
|
@@ -4298,9 +4505,9 @@ async function applyRouteData(router, match, data2, container, render3 = renderM
|
|
|
4298
4505
|
pageNode._dataPath = pathname;
|
|
4299
4506
|
pageNode._dataFetchedAt = Date.now();
|
|
4300
4507
|
}
|
|
4301
|
-
if (data2
|
|
4302
|
-
applyHead(data2.head);
|
|
4303
|
-
if (pageNode) pageNode._head = data2.head;
|
|
4508
|
+
if (data2 && "head" in data2) {
|
|
4509
|
+
applyHead(data2.head || "");
|
|
4510
|
+
if (pageNode) pageNode._head = data2.head || "";
|
|
4304
4511
|
}
|
|
4305
4512
|
const hasRealProps = data2.props ? Object.keys(data2.props).some((k) => k !== "params") : false;
|
|
4306
4513
|
if (!hasRealProps) {
|
|
@@ -4757,6 +4964,15 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
4757
4964
|
return;
|
|
4758
4965
|
}
|
|
4759
4966
|
const layoutNodes = chain.filter((n) => n.layout);
|
|
4967
|
+
if (globalThis.__vesk_hydrate_debug) {
|
|
4968
|
+
console.error("[hyd-dbg] hydrateInitial", {
|
|
4969
|
+
pageName: pageNode._pageName,
|
|
4970
|
+
pageType: typeof pageNode.page,
|
|
4971
|
+
layoutNames: layoutNodes.map((n) => n._layoutName),
|
|
4972
|
+
hydratorKeys: router.__hydrators ? Object.keys(router.__hydrators) : null,
|
|
4973
|
+
containerKids: container.children.length
|
|
4974
|
+
});
|
|
4975
|
+
}
|
|
4760
4976
|
const hydrators = router.__hydrators;
|
|
4761
4977
|
if (!pageNode.page && !(hydrators && pageNode._pageName && hydrators[pageNode._pageName])) {
|
|
4762
4978
|
if (await looksOffline()) {
|
|
@@ -4803,6 +5019,9 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
4803
5019
|
const childHydrator = renderLayoutChain2(index + 1);
|
|
4804
5020
|
return (walker2) => {
|
|
4805
5021
|
const layoutProps = { children: childHydrator, params: paramValues };
|
|
5022
|
+
if (globalThis.__vesk_hydrate_debug && index === 0) {
|
|
5023
|
+
console.error("[hyd-dbg] invoking outer layout", node._layoutName, typeof hydLayout, "pageChild=", typeof childHydrator);
|
|
5024
|
+
}
|
|
4806
5025
|
const result = hydLayout(layoutProps, /* @__PURE__ */ new Map(), walker2);
|
|
4807
5026
|
storeLayoutInstance(router, node, layoutProps, result);
|
|
4808
5027
|
return result;
|
|
@@ -4846,6 +5065,12 @@ async function hydrateInitial(router, match, container, strategy) {
|
|
|
4846
5065
|
setIsHydrating(false);
|
|
4847
5066
|
} catch (error) {
|
|
4848
5067
|
setIsHydrating(false);
|
|
5068
|
+
if (globalThis.__vesk_hydrate_debug) {
|
|
5069
|
+
console.error("[hyd-dbg] hydrateInitial FAILED:", error);
|
|
5070
|
+
if (error instanceof Error && error.stack) {
|
|
5071
|
+
console.error("[hyd-dbg] hydrateInitial stack:", error.stack.split("\n").slice(0, 12).join("\n"));
|
|
5072
|
+
}
|
|
5073
|
+
}
|
|
4849
5074
|
if (error instanceof NotFoundError) {
|
|
4850
5075
|
if (typeof console !== "undefined") console.error("[vesk-debug] NotFoundError during hydration:", error);
|
|
4851
5076
|
await renderNotFound(router, match, container);
|
|
@@ -17364,6 +17589,46 @@ function skipComment(text, i) {
|
|
|
17364
17589
|
}
|
|
17365
17590
|
return i;
|
|
17366
17591
|
}
|
|
17592
|
+
function blankLeadingLineComments(text) {
|
|
17593
|
+
const chars = text.split("");
|
|
17594
|
+
const n = text.length;
|
|
17595
|
+
let lineStart = true;
|
|
17596
|
+
let i = 0;
|
|
17597
|
+
while (i < n) {
|
|
17598
|
+
const ch = text[i];
|
|
17599
|
+
if (ch === "\n") {
|
|
17600
|
+
lineStart = true;
|
|
17601
|
+
i++;
|
|
17602
|
+
continue;
|
|
17603
|
+
}
|
|
17604
|
+
if (isWhitespaceChar(ch)) {
|
|
17605
|
+
i++;
|
|
17606
|
+
continue;
|
|
17607
|
+
}
|
|
17608
|
+
if (ch === '"' || ch === "'" || ch === "`") {
|
|
17609
|
+
const end = skipString(text, i);
|
|
17610
|
+
for (let k = i; k < end; k++) {
|
|
17611
|
+
const c = text[k];
|
|
17612
|
+
if (c === "\n") lineStart = true;
|
|
17613
|
+
else if (!isWhitespaceChar(c)) lineStart = false;
|
|
17614
|
+
}
|
|
17615
|
+
i = end;
|
|
17616
|
+
continue;
|
|
17617
|
+
}
|
|
17618
|
+
if (ch === "/" && text[i + 1] === "/" && lineStart) {
|
|
17619
|
+
let j = i;
|
|
17620
|
+
while (j < n && text[j] !== "\n") {
|
|
17621
|
+
chars[j] = " ";
|
|
17622
|
+
j++;
|
|
17623
|
+
}
|
|
17624
|
+
i = j;
|
|
17625
|
+
continue;
|
|
17626
|
+
}
|
|
17627
|
+
lineStart = false;
|
|
17628
|
+
i++;
|
|
17629
|
+
}
|
|
17630
|
+
return chars.join("");
|
|
17631
|
+
}
|
|
17367
17632
|
function findBalancedEnd(text, openIndex) {
|
|
17368
17633
|
const open = text[openIndex];
|
|
17369
17634
|
const close = open === "(" ? ")" : open === "[" ? "]" : open === "{" ? "}" : null;
|
|
@@ -17762,7 +18027,7 @@ function createBaseParser() {
|
|
|
17762
18027
|
}
|
|
17763
18028
|
function parse4(source, options = {}) {
|
|
17764
18029
|
const ParserClass = createBaseParser();
|
|
17765
|
-
const { code, annotations } = preprocessForClauses(source);
|
|
18030
|
+
const { code, annotations } = preprocessForClauses(blankLeadingLineComments(source));
|
|
17766
18031
|
try {
|
|
17767
18032
|
const ast = ParserClass.parse(code, {
|
|
17768
18033
|
ecmaVersion: "latest",
|
|
@@ -19435,6 +19700,10 @@ function componentUsesFetch(nodes) {
|
|
|
19435
19700
|
function extractKeyExpr(nodes) {
|
|
19436
19701
|
for (const n of nodes) {
|
|
19437
19702
|
if (n instanceof StaticNode && n.keyExpr) return n.keyExpr;
|
|
19703
|
+
if (n instanceof ComponentCall) {
|
|
19704
|
+
const k = n.props.find((p) => p.name === "key");
|
|
19705
|
+
if (k) return k.value;
|
|
19706
|
+
}
|
|
19438
19707
|
}
|
|
19439
19708
|
return null;
|
|
19440
19709
|
}
|
|
@@ -20514,6 +20783,7 @@ __export(server_utils_exports, {
|
|
|
20514
20783
|
__vskHydrate: () => __vskHydrate,
|
|
20515
20784
|
__vskId: () => __vskId,
|
|
20516
20785
|
__vskImportedNames: () => __vskImportedNames,
|
|
20786
|
+
__vskMarkerless: () => __vskMarkerless,
|
|
20517
20787
|
applyTrustProxy: () => applyTrustProxy,
|
|
20518
20788
|
assertSameOrigin: () => assertSameOrigin,
|
|
20519
20789
|
buildParamInit: () => buildParamInit,
|
|
@@ -20554,6 +20824,7 @@ __export(server_utils_exports, {
|
|
|
20554
20824
|
setVskForceClaim: () => setVskForceClaim,
|
|
20555
20825
|
setVskHydrate: () => setVskHydrate,
|
|
20556
20826
|
setVskImportedNames: () => setVskImportedNames,
|
|
20827
|
+
setVskMarkerless: () => setVskMarkerless,
|
|
20557
20828
|
signCookie: () => signCookie,
|
|
20558
20829
|
takeVskForceClaim: () => takeVskForceClaim,
|
|
20559
20830
|
tryEvalExpr: () => tryEvalExpr,
|
|
@@ -20561,14 +20832,19 @@ __export(server_utils_exports, {
|
|
|
20561
20832
|
urlAuthority: () => urlAuthority,
|
|
20562
20833
|
verifyCsrfToken: () => verifyCsrfToken
|
|
20563
20834
|
});
|
|
20564
|
-
function resetVskState(hydrate = false) {
|
|
20835
|
+
function resetVskState(hydrate = false, markerless = true) {
|
|
20565
20836
|
__vskHydrate = hydrate;
|
|
20837
|
+
__vskMarkerless = markerless;
|
|
20566
20838
|
__vskId = 0;
|
|
20567
20839
|
__vskForceClaim = false;
|
|
20840
|
+
globalThis.__vsk_ssr_markerless = markerless === true;
|
|
20568
20841
|
}
|
|
20569
20842
|
function setVskHydrate(v) {
|
|
20570
20843
|
__vskHydrate = v;
|
|
20571
20844
|
}
|
|
20845
|
+
function setVskMarkerless(v) {
|
|
20846
|
+
__vskMarkerless = v;
|
|
20847
|
+
}
|
|
20572
20848
|
function setVskImportedNames(names) {
|
|
20573
20849
|
__vskImportedNames = names;
|
|
20574
20850
|
}
|
|
@@ -21465,7 +21741,7 @@ return load(__ctx);
|
|
|
21465
21741
|
const resolved = result && typeof result.then === "function" ? await result : result;
|
|
21466
21742
|
return resolved;
|
|
21467
21743
|
}
|
|
21468
|
-
var VOID_ELEMENTS2, RAW_TEXT_ELEMENTS, __vskHydrate, __vskId, __vskForceClaim, __vskImportedNames, DEFAULT_MAX_BODY_BYTES, TOKEN_PREFIXES, LOWER, SECRET_KEY_NAMES, _origConsoleError, _origConsoleLog, _redactEnabled, SHA_K, __csrfSecrets, UNSAFE_METHODS, __cookieSecrets, CorsResponse, __cachedRuntimeModule;
|
|
21744
|
+
var VOID_ELEMENTS2, RAW_TEXT_ELEMENTS, __vskHydrate, __vskMarkerless, __vskId, __vskForceClaim, __vskImportedNames, DEFAULT_MAX_BODY_BYTES, TOKEN_PREFIXES, LOWER, SECRET_KEY_NAMES, _origConsoleError, _origConsoleLog, _redactEnabled, SHA_K, __csrfSecrets, UNSAFE_METHODS, __cookieSecrets, CorsResponse, __cachedRuntimeModule;
|
|
21469
21745
|
var init_server_utils = __esm({
|
|
21470
21746
|
"../compiler/src/server-utils.ts"() {
|
|
21471
21747
|
"use strict";
|
|
@@ -21493,6 +21769,7 @@ var init_server_utils = __esm({
|
|
|
21493
21769
|
]);
|
|
21494
21770
|
RAW_TEXT_ELEMENTS = /* @__PURE__ */ new Set(["style", "script", "title"]);
|
|
21495
21771
|
__vskHydrate = false;
|
|
21772
|
+
__vskMarkerless = true;
|
|
21496
21773
|
__vskId = 0;
|
|
21497
21774
|
__vskForceClaim = false;
|
|
21498
21775
|
__vskImportedNames = null;
|
|
@@ -27710,7 +27987,12 @@ function headElementKey(node, props, locals2) {
|
|
|
27710
27987
|
if (tag === "style") return null;
|
|
27711
27988
|
return null;
|
|
27712
27989
|
}
|
|
27713
|
-
function
|
|
27990
|
+
function headIsReconcilable(tag, attrMap) {
|
|
27991
|
+
if (!HEAD_RECONCILE_TAGS.has(tag)) return false;
|
|
27992
|
+
if (tag === "meta" && attrMap.has("charset")) return false;
|
|
27993
|
+
return true;
|
|
27994
|
+
}
|
|
27995
|
+
function irNodeToHeadHtml(node, props, locals2 = {}, reconcileable = false) {
|
|
27714
27996
|
if (node instanceof StaticNode) {
|
|
27715
27997
|
const attrMap = new Map(node.attributes.map((a) => [a.name, a.value]));
|
|
27716
27998
|
for (const child of node.children) {
|
|
@@ -27722,10 +28004,11 @@ function irNodeToHeadHtml(node, props, locals2 = {}) {
|
|
|
27722
28004
|
}
|
|
27723
28005
|
}
|
|
27724
28006
|
}
|
|
28007
|
+
const marker = reconcileable && headIsReconcilable(node.tag, attrMap) ? ` ${HEAD_RECONCILE_MARKER}` : "";
|
|
27725
28008
|
const attrs = [...attrMap.entries()].map(([k, v]) => ` ${k}="${escapeHtml(v)}"`).join("");
|
|
27726
|
-
if (node.selfClosing) return `<${node.tag}${attrs} />`;
|
|
27727
|
-
const inner = node.children.filter((c) => !(c instanceof DynamicBinding && c.kind === "attribute" && c.target !== "ref")).map((c) => irNodeToHeadHtml(c, props, locals2)).join("");
|
|
27728
|
-
return `<${node.tag}${attrs}>${inner}</${node.tag}>`;
|
|
28009
|
+
if (node.selfClosing) return `<${node.tag}${attrs}${marker} />`;
|
|
28010
|
+
const inner = node.children.filter((c) => !(c instanceof DynamicBinding && c.kind === "attribute" && c.target !== "ref")).map((c) => irNodeToHeadHtml(c, props, locals2, false)).join("");
|
|
28011
|
+
return `<${node.tag}${attrs}${marker}>${inner}</${node.tag}>`;
|
|
27729
28012
|
}
|
|
27730
28013
|
if (node instanceof TextNode) return node.value;
|
|
27731
28014
|
if (node instanceof DynamicBinding) {
|
|
@@ -27748,7 +28031,7 @@ function renderHeadHtml(comp, props = {}) {
|
|
|
27748
28031
|
const key = headElementKey(child, props, locals2);
|
|
27749
28032
|
if (key !== null && seen.has(key)) continue;
|
|
27750
28033
|
if (key !== null) seen.add(key);
|
|
27751
|
-
parts.push(irNodeToHeadHtml(child, props, locals2));
|
|
28034
|
+
parts.push(irNodeToHeadHtml(child, props, locals2, true));
|
|
27752
28035
|
}
|
|
27753
28036
|
}
|
|
27754
28037
|
}
|
|
@@ -27893,12 +28176,15 @@ function mergeHeadHtml(pageHead, layoutHead) {
|
|
|
27893
28176
|
conflicts
|
|
27894
28177
|
};
|
|
27895
28178
|
}
|
|
28179
|
+
var HEAD_RECONCILE_MARKER, HEAD_RECONCILE_TAGS;
|
|
27896
28180
|
var init_server_head = __esm({
|
|
27897
28181
|
"../compiler/src/server-head.ts"() {
|
|
27898
28182
|
"use strict";
|
|
27899
28183
|
init_ir();
|
|
27900
28184
|
init_server_utils();
|
|
27901
28185
|
init_scan();
|
|
28186
|
+
HEAD_RECONCILE_MARKER = "data-vesk-head";
|
|
28187
|
+
HEAD_RECONCILE_TAGS = /* @__PURE__ */ new Set(["title", "meta", "link", "base", "style"]);
|
|
27902
28188
|
}
|
|
27903
28189
|
});
|
|
27904
28190
|
|
|
@@ -28269,6 +28555,8 @@ function transformTracked(irNode, tracked2) {
|
|
|
28269
28555
|
return context.next();
|
|
28270
28556
|
if (parent.type === "UpdateExpression" && parent.argument === node)
|
|
28271
28557
|
return context.next();
|
|
28558
|
+
if (parent.type === "MemberExpression" && !parent.computed && parent.property === node)
|
|
28559
|
+
return context.next();
|
|
28272
28560
|
if (parent.type === "Property" && parent.value === node && parent.key && parent.key.type === "Identifier" && parent.key.name === "into")
|
|
28273
28561
|
return context.next();
|
|
28274
28562
|
if (parent.type === "MemberExpression" && !parent.computed && parent.object === node && parent.property && parent.property.type === "Identifier" && parent.property.name === "set")
|
|
@@ -28321,8 +28609,8 @@ function nameAllocFor(sourcePath2, start = 0) {
|
|
|
28321
28609
|
}
|
|
28322
28610
|
return { c: h * 1e6 + start };
|
|
28323
28611
|
}
|
|
28324
|
-
function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components") {
|
|
28325
|
-
if (node instanceof StaticNode) return emitStatic(ctx2, node, tracked2, effectsVar);
|
|
28612
|
+
function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components", skipK = 0, regionBudget) {
|
|
28613
|
+
if (node instanceof StaticNode) return emitStatic(ctx2, node, tracked2, effectsVar, skipK, regionBudget);
|
|
28326
28614
|
if (node instanceof TextNode) {
|
|
28327
28615
|
if (!node.value) return null;
|
|
28328
28616
|
const v = ctx2.n();
|
|
@@ -28337,9 +28625,9 @@ function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__c
|
|
|
28337
28625
|
return null;
|
|
28338
28626
|
}
|
|
28339
28627
|
if (node instanceof ComponentRef) return null;
|
|
28340
|
-
if (node instanceof ComponentCall) return emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPrefix);
|
|
28341
|
-
if (node instanceof OpaqueDynamicRegion) return emitOpaque(ctx2, node, tracked2, effectsVar, parentVar);
|
|
28342
|
-
if (node instanceof MapRegion) return emitMap(ctx2, node, tracked2, effectsVar, parentVar);
|
|
28628
|
+
if (node instanceof ComponentCall) return emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPrefix, skipK, regionBudget);
|
|
28629
|
+
if (node instanceof OpaqueDynamicRegion) return emitOpaque(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
28630
|
+
if (node instanceof MapRegion) return emitMap(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
28343
28631
|
if (node instanceof ServerBlock) return null;
|
|
28344
28632
|
if (node instanceof ClientBlock) {
|
|
28345
28633
|
const savedHydrate = ctx2.hydrate;
|
|
@@ -28376,10 +28664,10 @@ function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__c
|
|
|
28376
28664
|
}
|
|
28377
28665
|
return null;
|
|
28378
28666
|
}
|
|
28379
|
-
if (node instanceof TryCatch) return emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar);
|
|
28380
|
-
if (node instanceof WhileLoop) return emitWhileLoop(ctx2, node, tracked2, parentVar);
|
|
28381
|
-
if (node instanceof ForLoop) return emitForLoop(ctx2, node, tracked2, parentVar);
|
|
28382
|
-
if (node instanceof SwitchBlock) return emitSwitchBlock(ctx2, node, tracked2, parentVar);
|
|
28667
|
+
if (node instanceof TryCatch) return emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
28668
|
+
if (node instanceof WhileLoop) return emitWhileLoop(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
28669
|
+
if (node instanceof ForLoop) return emitForLoop(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
28670
|
+
if (node instanceof SwitchBlock) return emitSwitchBlock(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
28383
28671
|
if (node instanceof PropSlot) return null;
|
|
28384
28672
|
if (node instanceof PropSlotRender) {
|
|
28385
28673
|
const slotProp = `props.${node.propName}`;
|
|
@@ -28405,7 +28693,7 @@ function emitNode(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__c
|
|
|
28405
28693
|
}
|
|
28406
28694
|
return null;
|
|
28407
28695
|
}
|
|
28408
|
-
function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
28696
|
+
function emitStatic(ctx2, node, tracked2, effectsVar, skipK = 0, regionBudget) {
|
|
28409
28697
|
const el = ctx2.n();
|
|
28410
28698
|
if (ctx2.hydrate) {
|
|
28411
28699
|
const claim = ctx2.claimStatic;
|
|
@@ -28413,8 +28701,11 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
|
28413
28701
|
if (!claim && isStaticIR(node.children)) return null;
|
|
28414
28702
|
const rootClaim = ctx2.rootClaim;
|
|
28415
28703
|
ctx2.rootClaim = false;
|
|
28416
|
-
const
|
|
28704
|
+
const skipExpr = regionBudget && ctx2.markerless ? markerlessSkipExpr(regionBudget, skipK) : skipK;
|
|
28705
|
+
const skipArg = ctx2.markerless ? `, ${skipExpr}` : "";
|
|
28706
|
+
const claimedExpr = rootClaim ? `__root || document.createElement(${JSON.stringify(node.tag)})` : `${ctx2.walker}.nextElement(${JSON.stringify(node.tag)}${skipArg})`;
|
|
28417
28707
|
ctx2.push(`const ${el} = ${claimedExpr};`);
|
|
28708
|
+
if (regionBudget && ctx2.markerless) ctx2.push(`${regionBudget} = 0;`);
|
|
28418
28709
|
} else {
|
|
28419
28710
|
ctx2.push(`const ${el} = document.createElement(${JSON.stringify(node.tag)});`);
|
|
28420
28711
|
}
|
|
@@ -28443,7 +28734,31 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
|
28443
28734
|
const textKids = children.filter((c) => c instanceof TextNode || c instanceof DynamicBinding && c.kind === "text");
|
|
28444
28735
|
singleReactiveText = textKids.length === 1 && textKids[0] instanceof DynamicBinding && isReactiveExpression(textKids[0].expression, tracked2);
|
|
28445
28736
|
}
|
|
28737
|
+
const savedWalker = ctx2.walker;
|
|
28738
|
+
let needsSubWalker = false;
|
|
28739
|
+
if (ctx2.hydrate && ctx2.markerless) {
|
|
28740
|
+
for (const child of children) {
|
|
28741
|
+
if (child instanceof TextNode) continue;
|
|
28742
|
+
if (child instanceof DynamicBinding && child.kind === "text") continue;
|
|
28743
|
+
if (child instanceof StaticNode && isStaticIR(child.children)) continue;
|
|
28744
|
+
if (child instanceof TrackDecl) continue;
|
|
28745
|
+
if (child instanceof ComponentRef) continue;
|
|
28746
|
+
if (child instanceof ServerBlock) continue;
|
|
28747
|
+
if (child instanceof ClientBlock) continue;
|
|
28748
|
+
if (child instanceof HeadBlock) continue;
|
|
28749
|
+
if (child instanceof RuntimeStatement) continue;
|
|
28750
|
+
if (child instanceof PropSlot) continue;
|
|
28751
|
+
needsSubWalker = true;
|
|
28752
|
+
break;
|
|
28753
|
+
}
|
|
28754
|
+
}
|
|
28755
|
+
if (needsSubWalker) {
|
|
28756
|
+
const sub = ctx2.n();
|
|
28757
|
+
ctx2.push(`const ${sub} = ${ctx2.walker}.subWalker(${el});`);
|
|
28758
|
+
ctx2.walker = sub;
|
|
28759
|
+
}
|
|
28446
28760
|
let residueBefore = 0;
|
|
28761
|
+
let pendingSkip = 0;
|
|
28447
28762
|
for (const child of children) {
|
|
28448
28763
|
let childVar;
|
|
28449
28764
|
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR(child.children);
|
|
@@ -28497,10 +28812,12 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
|
28497
28812
|
}
|
|
28498
28813
|
}
|
|
28499
28814
|
childVar = ssrEl;
|
|
28815
|
+
pendingSkip += ssrResidueEstimate(child);
|
|
28500
28816
|
} else if (singleReactiveText && child instanceof DynamicBinding && child.kind === "text") {
|
|
28501
28817
|
childVar = emitDynamicBinding(ctx2, child, tracked2, effectsVar, `${el}.__vsk_ssrText`);
|
|
28502
28818
|
} else {
|
|
28503
|
-
childVar = emitNode(ctx2, child, tracked2, effectsVar, el);
|
|
28819
|
+
childVar = emitNode(ctx2, child, tracked2, effectsVar, el, "__components", pendingSkip);
|
|
28820
|
+
if (claimsWalkerNode(ctx2, child)) pendingSkip = 0;
|
|
28504
28821
|
}
|
|
28505
28822
|
if (childVar) {
|
|
28506
28823
|
if (ctx2.hydrate) {
|
|
@@ -28552,6 +28869,7 @@ function emitStatic(ctx2, node, tracked2, effectsVar) {
|
|
|
28552
28869
|
}
|
|
28553
28870
|
}
|
|
28554
28871
|
}
|
|
28872
|
+
if (ctx2.walker !== savedWalker) ctx2.walker = savedWalker;
|
|
28555
28873
|
return el;
|
|
28556
28874
|
}
|
|
28557
28875
|
function emitClientHead(ctx2, node, tracked2) {
|
|
@@ -28682,16 +29000,19 @@ function emitFragment(ctx2, nodes, tracked2, effectsVar) {
|
|
|
28682
29000
|
const savedEffects = ctx2.effects;
|
|
28683
29001
|
ctx2.effects = [];
|
|
28684
29002
|
ctx2.push(`const ${frag} = (() => { const $f = document.createDocumentFragment();`);
|
|
29003
|
+
let fragPendingSkip = 0;
|
|
28685
29004
|
for (const child of nodes) {
|
|
28686
|
-
const childVar = emitNode(ctx2, child, tracked2, effectsVar, "$f");
|
|
29005
|
+
const childVar = emitNode(ctx2, child, tracked2, effectsVar, "$f", "__components", fragPendingSkip);
|
|
28687
29006
|
if (childVar) ctx2.push(`$f.appendChild(${childVar});`);
|
|
29007
|
+
if (claimsWalkerNode(ctx2, child)) fragPendingSkip = 0;
|
|
29008
|
+
else fragPendingSkip += ssrResidueEstimate(child);
|
|
28688
29009
|
}
|
|
28689
29010
|
for (const eff of ctx2.effects) ctx2.push(effectsVar ? `${effectsVar}.push(${effectBlockToHandlerExpr(eff)});` : eff);
|
|
28690
29011
|
ctx2.effects = savedEffects;
|
|
28691
29012
|
ctx2.push(`return $f; })();`);
|
|
28692
29013
|
return frag;
|
|
28693
29014
|
}
|
|
28694
|
-
function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components") {
|
|
29015
|
+
function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components", skipK = 0, regionBudget) {
|
|
28695
29016
|
const propsEntries = node.props.map((p) => {
|
|
28696
29017
|
if (typeof p.value === "string") return `${JSON.stringify(p.name)}: ${JSON.stringify(p.value)}`;
|
|
28697
29018
|
const expr = transformTracked(p.value, tracked2);
|
|
@@ -28713,11 +29034,17 @@ function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPref
|
|
|
28713
29034
|
const callArgs = () => `{ ${propsEntries.join(", ")} }`;
|
|
28714
29035
|
if (ctx2.hydrate) {
|
|
28715
29036
|
const access = calleeExpr ?? (ctx2.importedNames.has(node.componentName) ? node.componentName : `__components[${JSON.stringify(node.componentName)}]`);
|
|
29037
|
+
if (!calleeExpr && !ctx2.importedNames.has(node.componentName)) {
|
|
29038
|
+
ctx2.push(`if (${access} == null) throw new Error(${JSON.stringify(`Component "${node.componentName}" was not found while rendering. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
29039
|
+
}
|
|
28716
29040
|
const plainTarget = !!(calleeExpr || ctx2.importedNames.has(node.componentName)) && !ctx2.selfClaimNames.has(node.componentName);
|
|
28717
29041
|
const walkerArg = ctx2.walker;
|
|
29042
|
+
const promptExpr = ctx2.markerless && (regionBudget || skipK > 0) ? markerlessSkipExpr(regionBudget, skipK) : null;
|
|
28718
29043
|
const maybeReplace = (v2) => {
|
|
28719
29044
|
if (!plainTarget) return;
|
|
28720
|
-
|
|
29045
|
+
const claim = promptExpr ? `${walkerArg}.claimOnly(undefined, ${promptExpr})` : `${walkerArg}.claimOnly()`;
|
|
29046
|
+
ctx2.push(`if (${v2} && ${v2}.parentNode == null && ${v2}.nodeType !== 11) { const __sr = ${claim}; if (__sr && __sr.parentNode) __sr.parentNode.replaceChild(${v2}, __sr); }`);
|
|
29047
|
+
if (regionBudget && ctx2.markerless) ctx2.push(`${regionBudget} = 0;`);
|
|
28721
29048
|
};
|
|
28722
29049
|
const maybeRetire = () => {
|
|
28723
29050
|
if (ctx2.selfClaimNames.has(node.componentName)) {
|
|
@@ -28746,9 +29073,13 @@ function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPref
|
|
|
28746
29073
|
ctx2.push(`return $f; })();`);
|
|
28747
29074
|
propsEntries.push(`children: ${frag}`);
|
|
28748
29075
|
}
|
|
29076
|
+
if (ctx2.markerless && promptExpr && !plainTarget) {
|
|
29077
|
+
ctx2.push(`${walkerArg}.injectSkipK(${promptExpr});`);
|
|
29078
|
+
}
|
|
28749
29079
|
ctx2.push(`let ${v} = undefined;`);
|
|
28750
29080
|
ctx2.push(`if (__hydrate) __hydrate.childFrame = (__hydrate.childFrame || 0) + 1;`);
|
|
28751
29081
|
ctx2.push(`try { ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg}); } finally { if (__hydrate) __hydrate.childFrame--; }`);
|
|
29082
|
+
if (ctx2.markerless && promptExpr && !plainTarget && regionBudget) ctx2.push(`${regionBudget} = 0;`);
|
|
28752
29083
|
maybeReplace(v);
|
|
28753
29084
|
maybeRetire();
|
|
28754
29085
|
return v;
|
|
@@ -28776,30 +29107,50 @@ function emitComponentCall(ctx2, node, tracked2, effectsVar, parentVar, compPref
|
|
|
28776
29107
|
} else if (ctx2.importedNames.has(node.componentName)) {
|
|
28777
29108
|
ctx2.push(`const ${v} = ${awaitKw}${node.componentName}(${callArgs()});`);
|
|
28778
29109
|
} else {
|
|
29110
|
+
ctx2.push(`if (${compPrefix}[${JSON.stringify(node.componentName)}] == null) throw new Error(${JSON.stringify(`Component "${node.componentName}" was not found while rendering. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
28779
29111
|
ctx2.push(`const ${v} = ${awaitKw}${compPrefix}[${JSON.stringify(node.componentName)}](${callArgs()});`);
|
|
28780
29112
|
}
|
|
28781
29113
|
}
|
|
28782
29114
|
return v;
|
|
28783
29115
|
}
|
|
28784
|
-
function emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, rootLevel) {
|
|
29116
|
+
function emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, rootLevel, offsetExpr) {
|
|
28785
29117
|
if (!ctx2.hydrate || !rootLevel) return;
|
|
28786
29118
|
ctx2.push(`// Anchor region fences to the SSR slot so no-content regions do not fall back to $root's end.`);
|
|
28787
|
-
ctx2.push(`if (
|
|
28788
|
-
ctx2.push(indent2(
|
|
28789
|
-
ctx2.push(indent2(
|
|
29119
|
+
ctx2.push(`if (${ctx2.walker} && ${ctx2.walker}.insertBeforeNextClaim) {`);
|
|
29120
|
+
ctx2.push(indent2(`${ctx2.walker}.insertBeforeNextClaim(${anchor}${offsetExpr ? `, ${offsetExpr}` : ""});`));
|
|
29121
|
+
ctx2.push(indent2(`${ctx2.walker}.insertBeforeNextClaim(${endAnchor}${offsetExpr ? `, ${offsetExpr}` : ""});`));
|
|
28790
29122
|
ctx2.push(`}`);
|
|
28791
29123
|
}
|
|
28792
|
-
function
|
|
29124
|
+
function regionBudgetVar(ctx2, skipK, regionBudget, inheritedInit) {
|
|
29125
|
+
if (!ctx2.markerless || !ctx2.hydrate) return null;
|
|
29126
|
+
if (skipK > 0) {
|
|
29127
|
+
const pk = ctx2.n();
|
|
29128
|
+
ctx2.push(`let ${pk} = ${skipK}; // first-claim budget: region SSR sits ${skipK} slot(s) past the walker cursor`);
|
|
29129
|
+
return pk;
|
|
29130
|
+
}
|
|
29131
|
+
if (inheritedInit) {
|
|
29132
|
+
const pk = ctx2.n();
|
|
29133
|
+
ctx2.push(`let ${pk} = ${inheritedInit}; // first-claim budget: inherited from the caller's walker residue`);
|
|
29134
|
+
return pk;
|
|
29135
|
+
}
|
|
29136
|
+
return regionBudget || null;
|
|
29137
|
+
}
|
|
29138
|
+
function markerlessSkipExpr(regionBudget, skipK) {
|
|
29139
|
+
if (regionBudget) return skipK > 0 ? `${regionBudget} + ${skipK}` : regionBudget;
|
|
29140
|
+
return String(skipK);
|
|
29141
|
+
}
|
|
29142
|
+
function emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar, skipK = 0, regionBudget) {
|
|
28793
29143
|
const anchor = ctx2.n();
|
|
28794
29144
|
const endAnchor = ctx2.n();
|
|
28795
29145
|
const effArr = ctx2.n();
|
|
28796
29146
|
const catchParam = node.catchParamName || "__e";
|
|
28797
29147
|
const parent = parentVar || "$root";
|
|
29148
|
+
const budget = ctx2.hydrate ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
28798
29149
|
ctx2.push(`const ${anchor} = document.createComment('try');`);
|
|
28799
29150
|
if (!ctx2.hydrate) ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
28800
29151
|
ctx2.push(`let ${effArr} = [];`);
|
|
28801
29152
|
ctx2.push(`const ${endAnchor} = document.createComment('try-end');`);
|
|
28802
|
-
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
|
|
29153
|
+
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
28803
29154
|
const asyncKw = ctx2.isAsyncScope ? "await " : "";
|
|
28804
29155
|
function emitRenderFunc(name, isCatch, hydMode, compPrefix = "__components") {
|
|
28805
29156
|
const savedHydrate = ctx2.hydrate;
|
|
@@ -28817,7 +29168,7 @@ function emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar) {
|
|
|
28817
29168
|
ctx2.push(indent2(`const __cl = [];`));
|
|
28818
29169
|
}
|
|
28819
29170
|
for (const child of body) {
|
|
28820
|
-
const childVar = emitNode(ctx2, child, tracked2, isCatch ? null : effArr, hydMode ? void 0 : "__p", compPrefix);
|
|
29171
|
+
const childVar = emitNode(ctx2, child, tracked2, isCatch ? null : effArr, hydMode ? void 0 : "__p", compPrefix, 0, budget || void 0);
|
|
28821
29172
|
if (childVar) {
|
|
28822
29173
|
if (hydMode) ctx2.push(indent2(`__cl.push(${childVar});`));
|
|
28823
29174
|
else ctx2.push(indent2(`__p.insertBefore(${childVar}, ${endAnchor});`));
|
|
@@ -28863,9 +29214,10 @@ function emitTryCatch(ctx2, node, tracked2, effectsVar, parentVar) {
|
|
|
28863
29214
|
}`);
|
|
28864
29215
|
return null;
|
|
28865
29216
|
}
|
|
28866
|
-
function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
29217
|
+
function emitOpaque(ctx2, node, tracked2, effTarget, parentVar, skipK = 0, regionBudget) {
|
|
28867
29218
|
const hyd = ctx2.hydrate;
|
|
28868
29219
|
const parent = parentVar || "$root";
|
|
29220
|
+
const budget = hyd ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
28869
29221
|
const isOpaque = (n) => !!n && typeof n.condition !== "undefined";
|
|
28870
29222
|
if (hyd && node.alternateNodes.length === 1 && isOpaque(node.alternateNodes[0])) {
|
|
28871
29223
|
const chain = [];
|
|
@@ -28886,7 +29238,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
28886
29238
|
ctx2.push(`const ${anchor2} = document.createComment('if');`);
|
|
28887
29239
|
ctx2.push(`let ${effectsVar2} = [];`);
|
|
28888
29240
|
ctx2.push(`const ${endAnchor2} = document.createComment('if-end');`);
|
|
28889
|
-
emitHydrateFenceAnchoring(ctx2, anchor2, endAnchor2, parent === "$root");
|
|
29241
|
+
emitHydrateFenceAnchoring(ctx2, anchor2, endAnchor2, parent === "$root", budget || void 0);
|
|
28890
29242
|
const asyncKw2 = ctx2.isAsyncScope ? "await " : "";
|
|
28891
29243
|
const fnOpen2 = ctx2.isAsyncScope ? "async () => {" : "() => {";
|
|
28892
29244
|
const renderNames = [];
|
|
@@ -28899,7 +29251,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
28899
29251
|
for (const n of chain[i].nodes) {
|
|
28900
29252
|
const savedClaim = ctx2.claimStatic;
|
|
28901
29253
|
if (hyd) ctx2.claimStatic = true;
|
|
28902
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar2, parentVar);
|
|
29254
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar2, parentVar, "__components", 0, budget || void 0);
|
|
28903
29255
|
ctx2.claimStatic = savedClaim;
|
|
28904
29256
|
if (v) ctx2.push(indent2(`${cl}.push(${v});`));
|
|
28905
29257
|
}
|
|
@@ -28915,7 +29267,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
28915
29267
|
for (const n of finalElse) {
|
|
28916
29268
|
const savedClaim = ctx2.claimStatic;
|
|
28917
29269
|
if (hyd) ctx2.claimStatic = true;
|
|
28918
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar2, parentVar);
|
|
29270
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar2, parentVar, "__components", 0, budget || void 0);
|
|
28919
29271
|
ctx2.claimStatic = savedClaim;
|
|
28920
29272
|
if (v) ctx2.push(indent2(`${cl2}.push(${v});`));
|
|
28921
29273
|
}
|
|
@@ -28969,7 +29321,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
28969
29321
|
if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
28970
29322
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
28971
29323
|
ctx2.push(`const ${endAnchor} = document.createComment('if-end');`);
|
|
28972
|
-
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
|
|
29324
|
+
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
28973
29325
|
const asyncKw = ctx2.isAsyncScope ? "await " : "";
|
|
28974
29326
|
const fnOpen = ctx2.isAsyncScope ? "async () => {" : "() => {";
|
|
28975
29327
|
const conRenderName = ctx2.n();
|
|
@@ -28981,7 +29333,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
28981
29333
|
for (const n of node.consequentNodes) {
|
|
28982
29334
|
const savedClaim = ctx2.claimStatic;
|
|
28983
29335
|
if (hyd) ctx2.claimStatic = true;
|
|
28984
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : conFrag);
|
|
29336
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : conFrag, "__components", 0, budget || void 0);
|
|
28985
29337
|
ctx2.claimStatic = savedClaim;
|
|
28986
29338
|
if (v) {
|
|
28987
29339
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
@@ -29002,7 +29354,7 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29002
29354
|
for (const n of node.alternateNodes) {
|
|
29003
29355
|
const savedAltClaim = ctx2.claimStatic;
|
|
29004
29356
|
if (hyd) ctx2.claimStatic = true;
|
|
29005
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : altFrag);
|
|
29357
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : altFrag, "__components", 0, budget || void 0);
|
|
29006
29358
|
ctx2.claimStatic = savedAltClaim;
|
|
29007
29359
|
if (v) {
|
|
29008
29360
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
@@ -29043,18 +29395,19 @@ function emitOpaque(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29043
29395
|
}
|
|
29044
29396
|
return null;
|
|
29045
29397
|
}
|
|
29046
|
-
function emitWhileLoop(ctx2, node, tracked2, parentVar) {
|
|
29398
|
+
function emitWhileLoop(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
29047
29399
|
const condExpr = transformTracked(node.condition, tracked2);
|
|
29048
29400
|
const anchor = ctx2.n();
|
|
29049
29401
|
const endAnchor = ctx2.n();
|
|
29050
29402
|
const effectsVar = ctx2.n();
|
|
29051
29403
|
const hyd = ctx2.hydrate;
|
|
29052
29404
|
const parent = parentVar || "$root";
|
|
29405
|
+
const budget = hyd ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
29053
29406
|
ctx2.push(`const ${anchor} = document.createComment('while');`);
|
|
29054
29407
|
if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
29055
29408
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
29056
29409
|
ctx2.push(`const ${endAnchor} = document.createComment('while-end');`);
|
|
29057
|
-
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
|
|
29410
|
+
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
29058
29411
|
const renderLoop = ctx2.n();
|
|
29059
29412
|
ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
29060
29413
|
if (!hyd) ctx2.push(indent2(`const __p = ${anchor}.parentNode;`));
|
|
@@ -29063,7 +29416,7 @@ function emitWhileLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29063
29416
|
if (node.isDoWhile) {
|
|
29064
29417
|
ctx2.push(indent2(`do {`));
|
|
29065
29418
|
for (const n of node.bodyTemplate) {
|
|
29066
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
29419
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
29067
29420
|
if (v) {
|
|
29068
29421
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
29069
29422
|
else ctx2.push(indent2(`__b.appendChild(${v});`));
|
|
@@ -29073,7 +29426,7 @@ function emitWhileLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29073
29426
|
} else {
|
|
29074
29427
|
ctx2.push(indent2(`while (${condExpr}) {`));
|
|
29075
29428
|
for (const n of node.bodyTemplate) {
|
|
29076
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
29429
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
29077
29430
|
if (v) {
|
|
29078
29431
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
29079
29432
|
else ctx2.push(indent2(`__b.appendChild(${v});`));
|
|
@@ -29107,17 +29460,18 @@ function emitWhileLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29107
29460
|
}`);
|
|
29108
29461
|
return null;
|
|
29109
29462
|
}
|
|
29110
|
-
function emitForLoop(ctx2, node, tracked2, parentVar) {
|
|
29463
|
+
function emitForLoop(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
29111
29464
|
const anchor = ctx2.n();
|
|
29112
29465
|
const endAnchor = ctx2.n();
|
|
29113
29466
|
const effectsVar = ctx2.n();
|
|
29114
29467
|
const hyd = ctx2.hydrate;
|
|
29115
29468
|
const parent = parentVar || "$root";
|
|
29469
|
+
const budget = hyd ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
29116
29470
|
ctx2.push(`const ${anchor} = document.createComment('for');`);
|
|
29117
29471
|
if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
29118
29472
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
29119
29473
|
ctx2.push(`const ${endAnchor} = document.createComment('for-end');`);
|
|
29120
|
-
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
|
|
29474
|
+
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
29121
29475
|
const renderLoop = ctx2.n();
|
|
29122
29476
|
ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
29123
29477
|
if (!hyd) ctx2.push(indent2(`const __p = ${anchor}.parentNode;`));
|
|
@@ -29127,7 +29481,7 @@ function emitForLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29127
29481
|
const srcExpr = transformTracked(node.condition, tracked2);
|
|
29128
29482
|
ctx2.push(indent2(`for (${node.init} of (Array.isArray(${srcExpr}) ? ${srcExpr} : (${srcExpr} == null ? [] : Object.keys(${srcExpr})))) {`));
|
|
29129
29483
|
for (const n of node.bodyTemplate) {
|
|
29130
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
29484
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
29131
29485
|
if (v) {
|
|
29132
29486
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
29133
29487
|
else ctx2.push(indent2(`__b.appendChild(${v});`));
|
|
@@ -29143,7 +29497,7 @@ function emitForLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29143
29497
|
const head = initPart ? `${initPart}; ${condExpr}` : `; ${condExpr}`;
|
|
29144
29498
|
ctx2.push(indent2(`for (${head}; ${updatePart}) {`));
|
|
29145
29499
|
for (const n of node.bodyTemplate) {
|
|
29146
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
29500
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
29147
29501
|
if (v) {
|
|
29148
29502
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
29149
29503
|
else ctx2.push(indent2(`__b.appendChild(${v});`));
|
|
@@ -29247,18 +29601,19 @@ function emitForLoop(ctx2, node, tracked2, parentVar) {
|
|
|
29247
29601
|
}
|
|
29248
29602
|
return null;
|
|
29249
29603
|
}
|
|
29250
|
-
function emitSwitchBlock(ctx2, node, tracked2, parentVar) {
|
|
29604
|
+
function emitSwitchBlock(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
29251
29605
|
const discExpr = transformTracked(node.discriminant, tracked2);
|
|
29252
29606
|
const anchor = ctx2.n();
|
|
29253
29607
|
const endAnchor = ctx2.n();
|
|
29254
29608
|
const effectsVar = ctx2.n();
|
|
29255
29609
|
const hyd = ctx2.hydrate;
|
|
29256
29610
|
const parent = parentVar || "$root";
|
|
29611
|
+
const budget = hyd ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
29257
29612
|
ctx2.push(`const ${anchor} = document.createComment('switch');`);
|
|
29258
29613
|
if (!hyd) ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
29259
29614
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
29260
29615
|
ctx2.push(`const ${endAnchor} = document.createComment('switch-end');`);
|
|
29261
|
-
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root");
|
|
29616
|
+
emitHydrateFenceAnchoring(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
29262
29617
|
const renderSwitch = ctx2.n();
|
|
29263
29618
|
ctx2.push(`const ${renderSwitch} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
29264
29619
|
if (hyd) {
|
|
@@ -29275,7 +29630,7 @@ function emitSwitchBlock(ctx2, node, tracked2, parentVar) {
|
|
|
29275
29630
|
ctx2.push(indent2(`default:`));
|
|
29276
29631
|
}
|
|
29277
29632
|
for (const n of c.body) {
|
|
29278
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__c");
|
|
29633
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__c", "__components", 0, budget || void 0);
|
|
29279
29634
|
if (v) {
|
|
29280
29635
|
if (hyd) ctx2.push(indent2(`__cl.push(${v});`));
|
|
29281
29636
|
else ctx2.push(indent2(`__c.appendChild(${v});`));
|
|
@@ -29310,7 +29665,7 @@ function emitSwitchBlock(ctx2, node, tracked2, parentVar) {
|
|
|
29310
29665
|
}`);
|
|
29311
29666
|
return null;
|
|
29312
29667
|
}
|
|
29313
|
-
function emitMap(ctx2, node, tracked2, effTarget, parentVar) {
|
|
29668
|
+
function emitMap(ctx2, node, tracked2, effTarget, parentVar, skipK = 0, regionBudget) {
|
|
29314
29669
|
const arrExpr = transformTracked(node.expression, tracked2);
|
|
29315
29670
|
const itemVar = node.itemVariable;
|
|
29316
29671
|
const anchor = ctx2.n();
|
|
@@ -29322,6 +29677,7 @@ function emitMap(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29322
29677
|
const hyd = ctx2.hydrate && !keyed;
|
|
29323
29678
|
const hydKeyed = ctx2.hydrate && keyed;
|
|
29324
29679
|
const parent = parentVar || "$root";
|
|
29680
|
+
const budget = hyd ? regionBudgetVar(ctx2, skipK, regionBudget) : null;
|
|
29325
29681
|
const reactiveSource = isReactiveExpression(node.expression, tracked2);
|
|
29326
29682
|
const pushEffect = (lets, effCall) => {
|
|
29327
29683
|
if (effTarget) {
|
|
@@ -29353,7 +29709,7 @@ function emitMap(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29353
29709
|
}
|
|
29354
29710
|
if (hydKeyed) ctx2.rootClaim = true;
|
|
29355
29711
|
for (const n of node.bodyTemplate) {
|
|
29356
|
-
const v = emitNode(ctx2, n, tracked2, "__e", hyd ? void 0 : "__it");
|
|
29712
|
+
const v = emitNode(ctx2, n, tracked2, "__e", hyd ? void 0 : "__it", "__components", 0, budget || void 0);
|
|
29357
29713
|
if (v) {
|
|
29358
29714
|
if (hyd) {
|
|
29359
29715
|
ctx2.push(indent2(`if (__cl) __cl.push(${v}); else __p.insertBefore(${v}, __r);`));
|
|
@@ -29380,7 +29736,7 @@ function emitMap(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29380
29736
|
if (hydKeyed) ctx2.hydrate = false;
|
|
29381
29737
|
for (const n of node.alternateNodes) {
|
|
29382
29738
|
ctx2.claimStatic = true;
|
|
29383
|
-
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? void 0 : frag);
|
|
29739
|
+
const v = emitNode(ctx2, n, tracked2, effectsVar, hyd ? void 0 : frag, "__components", 0, budget || void 0);
|
|
29384
29740
|
if (v) {
|
|
29385
29741
|
if (hyd) ctx2.push(indent2(`if (__cl) __cl.push(${v}); else __p.insertBefore(${v}, ${endAnchor});`));
|
|
29386
29742
|
else ctx2.push(indent2(`${frag}.appendChild(${v});`));
|
|
@@ -29401,7 +29757,7 @@ function emitMap(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
29401
29757
|
const initList = ctx2.n();
|
|
29402
29758
|
ctx2.push(`let ${reconciler} = () => {};`);
|
|
29403
29759
|
if (hydKeyed) {
|
|
29404
|
-
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcileHydrated(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e, __root) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"}, null, __root), __hydrate, ${parent}); };`);
|
|
29760
|
+
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcileHydrated(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e, __root) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"}, null, __root), __hydrate, ${parent}, ${skipK}); };`);
|
|
29405
29761
|
} else {
|
|
29406
29762
|
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcile(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"})); };`);
|
|
29407
29763
|
}
|
|
@@ -29499,13 +29855,14 @@ ${renderAllItems(" ", null)}
|
|
|
29499
29855
|
function computeAsyncComponents(comps) {
|
|
29500
29856
|
return new Set(comps.filter((c) => c.isAsync).map((c) => c.name));
|
|
29501
29857
|
}
|
|
29502
|
-
function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydrate = false, asyncComps = /* @__PURE__ */ new Set(), linkNames = /* @__PURE__ */ new Set(), selfClaimNames = /* @__PURE__ */ new Set(), alloc) {
|
|
29858
|
+
function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydrate = false, asyncComps = /* @__PURE__ */ new Set(), linkNames = /* @__PURE__ */ new Set(), selfClaimNames = /* @__PURE__ */ new Set(), alloc, markerless = true) {
|
|
29503
29859
|
const tracked2 = collectTrackedNames(comp.body);
|
|
29504
29860
|
const ctx2 = new Ctx(alloc);
|
|
29505
29861
|
ctx2.importedNames = importedNames;
|
|
29506
29862
|
ctx2.linkNames = linkNames;
|
|
29507
29863
|
ctx2.selfClaimNames = selfClaimNames;
|
|
29508
29864
|
ctx2.hydrate = hydrate;
|
|
29865
|
+
ctx2.markerless = markerless;
|
|
29509
29866
|
ctx2.asyncComps = asyncComps;
|
|
29510
29867
|
ctx2.isAsyncScope = comp.isAsync || asyncComps.has(comp.name);
|
|
29511
29868
|
ctx2.push(hydrate ? ctx2.isAsyncScope ? "async (props, __registry, __hydrate) => {" : "(props, __registry, __hydrate) => {" : ctx2.isAsyncScope ? "async (props) => {" : "(props) => {");
|
|
@@ -29533,9 +29890,19 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
29533
29890
|
emitNode(ctx2, node, tracked2, null);
|
|
29534
29891
|
}
|
|
29535
29892
|
}
|
|
29893
|
+
let topPendingSkip = 0;
|
|
29894
|
+
let topBudget = null;
|
|
29895
|
+
if (ctx2.markerless && ctx2.hydrate) {
|
|
29896
|
+
topBudget = regionBudgetVar(
|
|
29897
|
+
ctx2,
|
|
29898
|
+
0,
|
|
29899
|
+
void 0,
|
|
29900
|
+
`(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`
|
|
29901
|
+
);
|
|
29902
|
+
}
|
|
29536
29903
|
for (const node of comp.body) {
|
|
29537
29904
|
if (node instanceof TrackDecl) continue;
|
|
29538
|
-
const v = emitNode(ctx2, node, tracked2, null);
|
|
29905
|
+
const v = emitNode(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
|
|
29539
29906
|
if (v) {
|
|
29540
29907
|
if (ctx2.hydrate) {
|
|
29541
29908
|
ctx2.push(indent2(`if ($mount === null) $mount = ${v};`));
|
|
@@ -29544,6 +29911,10 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
|
|
|
29544
29911
|
ctx2.push(indent2(`$root.appendChild(${v});`));
|
|
29545
29912
|
}
|
|
29546
29913
|
}
|
|
29914
|
+
if (claimsWalkerNode(ctx2, node)) {
|
|
29915
|
+
topBudget = null;
|
|
29916
|
+
topPendingSkip = 0;
|
|
29917
|
+
} else topPendingSkip += ssrResidueEstimate(node);
|
|
29547
29918
|
}
|
|
29548
29919
|
const effCode = ctx2.flushEffects();
|
|
29549
29920
|
if (effCode) ctx2.push(indent2(effCode.trim()));
|
|
@@ -29566,7 +29937,7 @@ function buildParamInit2(paramNames) {
|
|
|
29566
29937
|
if (paramNames.length === 0) return "";
|
|
29567
29938
|
return `const { ${paramNames.join(", ")} } = props;`;
|
|
29568
29939
|
}
|
|
29569
|
-
function buildComponentMap(irRoot, hydrate = false, alloc) {
|
|
29940
|
+
function buildComponentMap(irRoot, hydrate = false, alloc, markerless = true) {
|
|
29570
29941
|
const mapLines = [];
|
|
29571
29942
|
mapLines.push(`const __components = {};`);
|
|
29572
29943
|
const asyncComps = computeAsyncComponents(irRoot.components);
|
|
@@ -29587,11 +29958,12 @@ function buildComponentMap(irRoot, hydrate = false, alloc) {
|
|
|
29587
29958
|
const directNames = /* @__PURE__ */ new Set([...extractRuntimeNames(irRoot.imports), ...localValueImportNames(irRoot.imports), ...topValueNames]);
|
|
29588
29959
|
for (const comp of irRoot.components) {
|
|
29589
29960
|
if (hydrate && isStaticComponent(comp)) {
|
|
29590
|
-
const
|
|
29961
|
+
const claimExpr = markerless ? `__hydrate.claimOnly(undefined, (typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0))` : `__hydrate.claimOnly()`;
|
|
29962
|
+
const stub = `(props, __registry, __hydrate) => { return ${claimExpr}; }`;
|
|
29591
29963
|
mapLines.push(`__components[${JSON.stringify(comp.name)}] = ${stub};`);
|
|
29592
29964
|
continue;
|
|
29593
29965
|
}
|
|
29594
|
-
const code = generateComponent(comp, directNames, hydrate, asyncComps, linkNames, selfClaimNames, alloc);
|
|
29966
|
+
const code = generateComponent(comp, directNames, hydrate, asyncComps, linkNames, selfClaimNames, alloc, markerless);
|
|
29595
29967
|
mapLines.push(`__components[${JSON.stringify(comp.name)}] = ${code};`);
|
|
29596
29968
|
}
|
|
29597
29969
|
mapLines.push(`function __cleanup(start, end) {`);
|
|
@@ -29612,6 +29984,12 @@ function buildComponentMap(irRoot, hydrate = false, alloc) {
|
|
|
29612
29984
|
mapLines.push(` const p = nodes[0].parentNode;`);
|
|
29613
29985
|
mapLines.push(` p.insertBefore(start, nodes[0]);`);
|
|
29614
29986
|
mapLines.push(` p.insertBefore(end, nodes[nodes.length - 1].nextSibling);`);
|
|
29987
|
+
mapLines.push(` // Client-surplus nodes (SSR rendered fewer items than the client data)`);
|
|
29988
|
+
mapLines.push(` // are freshly claimed and still detached \u2014 move them into the region in`);
|
|
29989
|
+
mapLines.push(` // client order before \`end\`, instead of stranding them off-parent.`);
|
|
29990
|
+
mapLines.push(` for (let i = 0; i < nodes.length; i++) {`);
|
|
29991
|
+
mapLines.push(` if (nodes[i].parentNode === null) p.insertBefore(nodes[i], end);`);
|
|
29992
|
+
mapLines.push(` }`);
|
|
29615
29993
|
mapLines.push(` return;`);
|
|
29616
29994
|
mapLines.push(` }`);
|
|
29617
29995
|
mapLines.push(` fallback.appendChild(start);`);
|
|
@@ -29662,6 +30040,17 @@ function isStaticIR(body) {
|
|
|
29662
30040
|
}
|
|
29663
30041
|
return true;
|
|
29664
30042
|
}
|
|
30043
|
+
function claimsWalkerNode(ctx2, node) {
|
|
30044
|
+
if (node instanceof StaticNode) return ctx2.claimStatic || !isStaticIR(node.children);
|
|
30045
|
+
if (node instanceof ComponentCall) return true;
|
|
30046
|
+
if (node instanceof OpaqueDynamicRegion) return true;
|
|
30047
|
+
if (node instanceof MapRegion) return true;
|
|
30048
|
+
if (node instanceof ForLoop) return true;
|
|
30049
|
+
if (node instanceof WhileLoop) return true;
|
|
30050
|
+
if (node instanceof SwitchBlock) return true;
|
|
30051
|
+
if (node instanceof TryCatch) return true;
|
|
30052
|
+
return false;
|
|
30053
|
+
}
|
|
29665
30054
|
function isStaticComponent(comp) {
|
|
29666
30055
|
if (comp.style) return false;
|
|
29667
30056
|
return isStaticIR(comp.body);
|
|
@@ -29790,7 +30179,7 @@ function emitClientFromIR(ir, options) {
|
|
|
29790
30179
|
if (!options.forceClient && !needsClient) {
|
|
29791
30180
|
return "";
|
|
29792
30181
|
}
|
|
29793
|
-
const componentMapCode = buildComponentMap(ir, options.hydrate, options.nameAllocator);
|
|
30182
|
+
const componentMapCode = buildComponentMap(ir, options.hydrate, options.nameAllocator, options.markerless !== false);
|
|
29794
30183
|
const importLines = ir.imports.length > 0 ? ir.imports.join("\n") + "\n" : "";
|
|
29795
30184
|
const topCode = (options.includeTopLevel === false ? [] : transformTopLevelForActions(ir.topLevelCode, "client")).join("\n") + "\n";
|
|
29796
30185
|
const exportLines = [];
|
|
@@ -29868,7 +30257,7 @@ function compileClientBoth(source, _componentName, sourcePath2, opts) {
|
|
|
29868
30257
|
if (opts?.skipHyd) return { comp, hyd: "", name };
|
|
29869
30258
|
return {
|
|
29870
30259
|
comp,
|
|
29871
|
-
hyd: emitClientFromIR(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc }),
|
|
30260
|
+
hyd: emitClientFromIR(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc, markerless: opts?.markerless !== false }),
|
|
29872
30261
|
name
|
|
29873
30262
|
};
|
|
29874
30263
|
}
|
|
@@ -29933,6 +30322,12 @@ var init_client_codegen = __esm({
|
|
|
29933
30322
|
delegatedEvents = /* @__PURE__ */ new Set();
|
|
29934
30323
|
directEvents = /* @__PURE__ */ new Set();
|
|
29935
30324
|
hydrate = false;
|
|
30325
|
+
// Markerless structural hydration: claims run `nextElement(tag, skipK)` with
|
|
30326
|
+
// positional residue offsets and interior claims rebind the walker to the
|
|
30327
|
+
// claimed element (subWalker). Only meaningful when `hydrate` is also true.
|
|
30328
|
+
// Markerless is the DEFAULT; pass `markerless: false` to restore legacy
|
|
30329
|
+
// marker-mode claim emission.
|
|
30330
|
+
markerless = true;
|
|
29936
30331
|
inTryBody = false;
|
|
29937
30332
|
claimStatic = false;
|
|
29938
30333
|
// While set, the next StaticNode claimed in hydrate mode uses `__root` (the
|
|
@@ -30041,6 +30436,7 @@ function irNodeToJS(node, importedNames, isAsync = false, tracked2) {
|
|
|
30041
30436
|
}
|
|
30042
30437
|
if (node instanceof RuntimeStatement) return semicolonizeStatement(transformTracked(node, tracked2 || /* @__PURE__ */ new Map()));
|
|
30043
30438
|
if (node instanceof SlotNode) {
|
|
30439
|
+
if (__vskMarkerless) return `__out.push(props.children || '');`;
|
|
30044
30440
|
const sid = `s${nextVskId()}`;
|
|
30045
30441
|
return `__out.push('<!--vsk-slot:${sid}-->');__out.push(props.children || '');__out.push('<!--vsk-slot-end:${sid}-->');`;
|
|
30046
30442
|
}
|
|
@@ -30070,7 +30466,7 @@ function staticNodeToJS(node, isAsync = false, tracked2) {
|
|
|
30070
30466
|
let openTag = `<${node.tag}`;
|
|
30071
30467
|
const forceClaim = takeVskForceClaim();
|
|
30072
30468
|
const subtreeNeedsJS = __vskHydrate && (forceClaim || !isStaticIR(node.children));
|
|
30073
|
-
if (subtreeNeedsJS) {
|
|
30469
|
+
if (subtreeNeedsJS && !__vskMarkerless) {
|
|
30074
30470
|
lines.push("__out.push(" + JSON.stringify(`<!--vsk:t:${sanitizeMarkerName(node.tag)}-->`) + ");");
|
|
30075
30471
|
}
|
|
30076
30472
|
for (const attr of node.attributes) {
|
|
@@ -30163,7 +30559,7 @@ function mapRegionToJS(node, isAsync = false, tracked2) {
|
|
|
30163
30559
|
const lines = [];
|
|
30164
30560
|
const arr = exprJSX(node.expression, tracked2);
|
|
30165
30561
|
const item = node.itemVariable;
|
|
30166
|
-
const bodyForItem = __vskHydrate && node.keyExpr ? keyedItemTemplate(node) : node.bodyTemplate;
|
|
30562
|
+
const bodyForItem = __vskHydrate && !__vskMarkerless && node.keyExpr ? keyedItemTemplate(node) : node.bodyTemplate;
|
|
30167
30563
|
const hasAlternate = node.alternateNodes.length > 0;
|
|
30168
30564
|
const arrVar = hasAlternate ? `__a${nextVskId()}` : null;
|
|
30169
30565
|
if (hasAlternate) {
|
|
@@ -30344,8 +30740,11 @@ function componentCallToJS(node, importedNames, isAsync = false, tracked2) {
|
|
|
30344
30740
|
const awaitKw = isAsync ? "await " : "";
|
|
30345
30741
|
const calleeVar = `__cc${nextVskId()}`;
|
|
30346
30742
|
lines.push(`const ${calleeVar} = ${callee};`);
|
|
30743
|
+
if (!node.calleeExpr) {
|
|
30744
|
+
lines.push(`if (${calleeVar} == null) throw new Error(${JSON.stringify(`Component "${compName}" was not found while rendering SSR HTML. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
30745
|
+
}
|
|
30347
30746
|
const callExpr3 = `${awaitKw}${calleeVar}(${propsObj}, __registry, (${calleeVar}.__veskScope || __vesk))`;
|
|
30348
|
-
if (__vskHydrate) {
|
|
30747
|
+
if (__vskHydrate && !__vskMarkerless) {
|
|
30349
30748
|
lines.push(`__out.push(${JSON.stringify(componentMarker(compName))} + (${callExpr3} || ''));`);
|
|
30350
30749
|
} else {
|
|
30351
30750
|
lines.push(`__out.push(${callExpr3} || '');`);
|
|
@@ -30551,7 +30950,7 @@ function compileFileInternal(source, sourcePath2, seenImportFiles) {
|
|
|
30551
30950
|
return { ir, componentMap, __vesk };
|
|
30552
30951
|
}
|
|
30553
30952
|
function render2(source, componentName, props = {}, registry = /* @__PURE__ */ new Map(), options = {}) {
|
|
30554
|
-
resetVskState(!!options.hydrate);
|
|
30953
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
30555
30954
|
const compiled = compileFile(source, { sourcePath: options.sourcePath || void 0 });
|
|
30556
30955
|
const componentMap = compiled.componentMap;
|
|
30557
30956
|
const renderFn = componentMap.get(componentName);
|
|
@@ -30586,7 +30985,7 @@ function render2(source, componentName, props = {}, registry = /* @__PURE__ */ n
|
|
|
30586
30985
|
return bodyHtml;
|
|
30587
30986
|
}
|
|
30588
30987
|
function renderPage(source, componentName, props = {}, registry = /* @__PURE__ */ new Map(), options = {}) {
|
|
30589
|
-
resetVskState(!!options.hydrate);
|
|
30988
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
30590
30989
|
let __vesk, componentMap, ir;
|
|
30591
30990
|
if (options.cached) {
|
|
30592
30991
|
const cached = options.cached;
|
|
@@ -30735,10 +31134,10 @@ async function ssg(source, componentName, customProps, options = {}) {
|
|
|
30735
31134
|
if (c.style) return true;
|
|
30736
31135
|
return !isStatic(c.body);
|
|
30737
31136
|
});
|
|
30738
|
-
const rendered = await renderPage(source, componentName, props, options.registry || /* @__PURE__ */ new Map(), { hydrate: needsClient });
|
|
31137
|
+
const rendered = await renderPage(source, componentName, props, options.registry || /* @__PURE__ */ new Map(), { hydrate: needsClient, markerless: options.markerless !== false });
|
|
30739
31138
|
const bodyHtml = rendered.body;
|
|
30740
31139
|
const headHtml = rendered.head;
|
|
30741
|
-
const clientCode = needsClient ? compileClient(source, null, { hydrate: true }) : "";
|
|
31140
|
+
const clientCode = needsClient ? compileClient(source, null, { hydrate: true, markerless: options.markerless !== false }) : "";
|
|
30742
31141
|
const serializedProps = safeJsonForScript(JSON.stringify(props));
|
|
30743
31142
|
const hasClient = clientCode.length > 0;
|
|
30744
31143
|
const scriptBlock = hasClient ? `
|
|
@@ -30914,7 +31313,7 @@ function renderPageStream(source, componentName, props = {}, registry = /* @__PU
|
|
|
30914
31313
|
const fullRegistry = new Map([...registry, ...componentMap]);
|
|
30915
31314
|
const renderFn = componentMap.get(componentName);
|
|
30916
31315
|
if (!renderFn) throw new Error(`Component "${componentName}" not found in source`);
|
|
30917
|
-
resetVskState(!!options.hydrate);
|
|
31316
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
30918
31317
|
const targetComp = ir.components.find((c) => c.name === componentName);
|
|
30919
31318
|
const cssUrls = options.cssUrls || (options.cssUrl ? [options.cssUrl] : []);
|
|
30920
31319
|
const cssLink = cssUrls.map((u) => ` <link rel="stylesheet" href="${u}" />
|
|
@@ -31076,7 +31475,7 @@ import {
|
|
|
31076
31475
|
readFileSync as readFileSync16,
|
|
31077
31476
|
writeFileSync as writeFileSync7,
|
|
31078
31477
|
existsSync as existsSync16,
|
|
31079
|
-
mkdirSync as
|
|
31478
|
+
mkdirSync as mkdirSync6,
|
|
31080
31479
|
statSync as statSync7
|
|
31081
31480
|
} from "node:fs";
|
|
31082
31481
|
import { resolve as resolve14, dirname as dirname11, join as join10, extname as extname4, basename } from "node:path";
|
|
@@ -31114,7 +31513,7 @@ function readPluginState(veskDir) {
|
|
|
31114
31513
|
function writePluginState(veskDir, state) {
|
|
31115
31514
|
const file = stateFilePath(veskDir);
|
|
31116
31515
|
const dir = dirname11(file);
|
|
31117
|
-
if (!existsSync16(dir))
|
|
31516
|
+
if (!existsSync16(dir)) mkdirSync6(dir, { recursive: true });
|
|
31118
31517
|
writeFileSync7(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
31119
31518
|
}
|
|
31120
31519
|
function resolvePackage(appDir, pkg) {
|
|
@@ -31993,15 +32392,15 @@ __export(static_exports, {
|
|
|
31993
32392
|
generateSitemap: () => generateSitemap,
|
|
31994
32393
|
generateSsgRoutes: () => generateSsgRoutes
|
|
31995
32394
|
});
|
|
31996
|
-
import { mkdirSync as
|
|
32395
|
+
import { mkdirSync as mkdirSync7, copyFileSync as copyFileSync2, readdirSync as readdirSync3, statSync as statSync8, existsSync as existsSync17, writeFileSync as writeFileSync8, readFileSync as readFileSync17 } from "node:fs";
|
|
31997
32396
|
import { resolve as resolve15, join as join11 } from "node:path";
|
|
31998
32397
|
function copyStaticAssets2(publicDir, outDir) {
|
|
31999
32398
|
const targetDir = resolve15(outDir, "static", "public");
|
|
32000
|
-
|
|
32399
|
+
mkdirSync7(targetDir, { recursive: true });
|
|
32001
32400
|
if (!existsSync17(publicDir))
|
|
32002
32401
|
return;
|
|
32003
32402
|
function copyDir(src2, dest) {
|
|
32004
|
-
|
|
32403
|
+
mkdirSync7(dest, { recursive: true });
|
|
32005
32404
|
const entries = readdirSync3(src2);
|
|
32006
32405
|
for (const entry of entries) {
|
|
32007
32406
|
const srcPath = join11(src2, entry);
|
|
@@ -32019,7 +32418,7 @@ function copyStaticAssets2(publicDir, outDir) {
|
|
|
32019
32418
|
async function generateSsgRoutes(routeTree, appDir, outDir, plugins, headExtra, cssUrls) {
|
|
32020
32419
|
const { ssg: ssg2 } = await Promise.resolve().then(() => (init_server_render(), server_render_exports));
|
|
32021
32420
|
const prerenderDir = resolve15(outDir, "prerendered");
|
|
32022
|
-
|
|
32421
|
+
mkdirSync7(prerenderDir, { recursive: true });
|
|
32023
32422
|
const ssgOptions = { plugins, headExtra, cssUrls };
|
|
32024
32423
|
const results = [];
|
|
32025
32424
|
async function evaluateExport(src2, exportName) {
|
|
@@ -32056,7 +32455,7 @@ async function generateSsgRoutes(routeTree, appDir, outDir, plugins, headExtra,
|
|
|
32056
32455
|
console.error(`vesk: SSG path escaped output dir \u2014 skipping ${pagePath} (path: ${urlPath})`);
|
|
32057
32456
|
continue;
|
|
32058
32457
|
}
|
|
32059
|
-
|
|
32458
|
+
mkdirSync7(resolve15(htmlPath, ".."), { recursive: true });
|
|
32060
32459
|
writeFileSync8(htmlPath, result.html);
|
|
32061
32460
|
results.push({ path: urlPath, html: htmlPath, static: result.static, params });
|
|
32062
32461
|
} catch (e) {
|
|
@@ -32069,7 +32468,7 @@ async function generateSsgRoutes(routeTree, appDir, outDir, plugins, headExtra,
|
|
|
32069
32468
|
try {
|
|
32070
32469
|
const result = await ssg2(src2, null, void 0, ssgOptions);
|
|
32071
32470
|
const htmlPath = resolve15(prerenderDir, node.fullPath === "/" ? "index.html" : `${node.fullPath.slice(1)}.html`);
|
|
32072
|
-
|
|
32471
|
+
mkdirSync7(resolve15(htmlPath, ".."), { recursive: true });
|
|
32073
32472
|
writeFileSync8(htmlPath, result.html);
|
|
32074
32473
|
results.push({ path: node.fullPath, html: htmlPath, static: result.static });
|
|
32075
32474
|
} catch (e) {
|
|
@@ -32139,7 +32538,7 @@ var image_pipeline_exports = {};
|
|
|
32139
32538
|
__export(image_pipeline_exports, {
|
|
32140
32539
|
optimizeImages: () => optimizeImages
|
|
32141
32540
|
});
|
|
32142
|
-
import { mkdirSync as
|
|
32541
|
+
import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync9, readFileSync as readFileSync18, existsSync as existsSync18, readdirSync as readdirSync4, statSync as statSync9 } from "node:fs";
|
|
32143
32542
|
import { resolve as resolve16, extname as extname5, dirname as dirname12 } from "node:path";
|
|
32144
32543
|
async function processImage(srcPath, outDir, baseName) {
|
|
32145
32544
|
const image = sharpFn ? sharpFn(srcPath) : null;
|
|
@@ -32147,7 +32546,7 @@ async function processImage(srcPath, outDir, baseName) {
|
|
|
32147
32546
|
const original = readFileSync18(srcPath);
|
|
32148
32547
|
for (const w of OUTPUT_WIDTHS) {
|
|
32149
32548
|
const outputPath = resolve16(outDir, `${baseName}-${w}w`);
|
|
32150
|
-
|
|
32549
|
+
mkdirSync8(dirname12(outputPath), { recursive: true });
|
|
32151
32550
|
writeFileSync9(outputPath, original);
|
|
32152
32551
|
}
|
|
32153
32552
|
return [];
|
|
@@ -32161,7 +32560,7 @@ async function processImage(srcPath, outDir, baseName) {
|
|
|
32161
32560
|
const resized = image.clone().resize({ width: w, withoutEnlargement: true });
|
|
32162
32561
|
const base = `${baseName}-${w}w`;
|
|
32163
32562
|
const jpgPath = resolve16(outDir, `${base}${extname5(srcPath)}`);
|
|
32164
|
-
|
|
32563
|
+
mkdirSync8(dirname12(jpgPath), { recursive: true });
|
|
32165
32564
|
await resized.toFile(jpgPath);
|
|
32166
32565
|
generated.push(jpgPath);
|
|
32167
32566
|
for (const fmt of FORMATS) {
|
|
@@ -32203,7 +32602,7 @@ function collectImageRefs(appDir) {
|
|
|
32203
32602
|
}
|
|
32204
32603
|
async function optimizeImages(appDir, outDir) {
|
|
32205
32604
|
const imageOutDir = resolve16(outDir, "static", "images");
|
|
32206
|
-
|
|
32605
|
+
mkdirSync8(imageOutDir, { recursive: true });
|
|
32207
32606
|
const refs = collectImageRefs(appDir);
|
|
32208
32607
|
if (refs.length === 0) {
|
|
32209
32608
|
console.error("vesk images: no <Image> refs found");
|
|
@@ -32544,6 +32943,30 @@ ${prerenderedList}
|
|
|
32544
32943
|
${isrCache}
|
|
32545
32944
|
const __routes = [${routeEntries.join(",\n")}];
|
|
32546
32945
|
|
|
32946
|
+
async function __invokeRoute(route, request) {
|
|
32947
|
+
try {
|
|
32948
|
+
return await route.handler(request);
|
|
32949
|
+
} catch (e) {
|
|
32950
|
+
if (e && typeof e === 'object' && e.name === 'Redirect') {
|
|
32951
|
+
return new Response(null, {
|
|
32952
|
+
status: Number(e.status) || 302,
|
|
32953
|
+
headers: { Location: String(e.url || '/') },
|
|
32954
|
+
});
|
|
32955
|
+
}
|
|
32956
|
+
if (e && typeof e === 'object' && e.name === 'NotFoundError') {
|
|
32957
|
+
return new Response('<!DOCTYPE html><html><body><h1>404</h1><p>Not Found</p></body></html>', {
|
|
32958
|
+
status: 404,
|
|
32959
|
+
headers: { 'Content-Type': 'text/html' },
|
|
32960
|
+
});
|
|
32961
|
+
}
|
|
32962
|
+
throw e;
|
|
32963
|
+
}
|
|
32964
|
+
}
|
|
32965
|
+
|
|
32966
|
+
function __escapeScript(json) {
|
|
32967
|
+
return json.split('<').join('\\u003c').split('\\u2028').join('\\u2028').split('\\u2029').join('\\u2029');
|
|
32968
|
+
}
|
|
32969
|
+
|
|
32547
32970
|
function __matchPath(pattern, pathname) {
|
|
32548
32971
|
const patternParts = pattern.split('/').filter(Boolean);
|
|
32549
32972
|
const pathParts = pathname.split('/').filter(Boolean);
|
|
@@ -32574,6 +32997,24 @@ ${serverStoreLine}
|
|
|
32574
32997
|
return new Response(null, { status: 308, headers: { Location: '/_vesk/static/public' + (pathname.endsWith('/') ? pathname + 'index.html' : pathname + '.html') } });
|
|
32575
32998
|
}
|
|
32576
32999
|
|
|
33000
|
+
// Serve the SSR-data handoff the page references (script tag /ssr-data.js?t=...).
|
|
33001
|
+
// The render stashed the payload in the shared global store \u2014 mirror the node
|
|
33002
|
+
// prod/dev servers so edge/serverless hydration never re-fetches resources that
|
|
33003
|
+
// SSR already resolved. Entry is consumed on read (bound store).
|
|
33004
|
+
if (pathname === '/ssr-data.js') {
|
|
33005
|
+
const dataToken = url.searchParams.get('t') || '';
|
|
33006
|
+
const dataStore = (globalThis.__vsk_ssr_data_store || {});
|
|
33007
|
+
const payload = dataStore[dataToken];
|
|
33008
|
+
if (payload) delete dataStore[dataToken];
|
|
33009
|
+
const dataLines = [];
|
|
33010
|
+
if (payload && payload.props) dataLines.push('globalThis.__vesk_props = ' + __escapeScript(JSON.stringify(payload.props)) + ';');
|
|
33011
|
+
if (payload && payload.ssrData) dataLines.push('globalThis.__vsk_ssr_data = ' + __escapeScript(JSON.stringify(payload.ssrData)) + ';');
|
|
33012
|
+
return new Response(dataLines.join('\\n') || '// no ssr data', {
|
|
33013
|
+
status: 200,
|
|
33014
|
+
headers: { 'Content-Type': 'application/javascript', 'Cache-Control': 'no-store' },
|
|
33015
|
+
});
|
|
33016
|
+
}
|
|
33017
|
+
|
|
32577
33018
|
${eventsStartLine}
|
|
32578
33019
|
let mwCtx = { params: {}, url, locals: ${localsSeed}, cookies: {}, request, resolveUrl(u) { return new URL(u, request.url).href; }, set() {}, get() { return undefined; } };
|
|
32579
33020
|
if (${hasMwLiteral}) {
|
|
@@ -32603,7 +33044,7 @@ ${eventsRequestLine}
|
|
|
32603
33044
|
if (!params) continue;
|
|
32604
33045
|
|
|
32605
33046
|
if (route.type === 'api') {
|
|
32606
|
-
return await route
|
|
33047
|
+
return await __invokeRoute(route, request);
|
|
32607
33048
|
}
|
|
32608
33049
|
|
|
32609
33050
|
if (route.revalidate && route.revalidate > 0 && !isDataRequest) {
|
|
@@ -32616,7 +33057,7 @@ ${eventsRequestLine}
|
|
|
32616
33057
|
}
|
|
32617
33058
|
}
|
|
32618
33059
|
|
|
32619
|
-
const response = await route
|
|
33060
|
+
const response = await __invokeRoute(route, request);
|
|
32620
33061
|
|
|
32621
33062
|
if (route.revalidate && route.revalidate > 0 && !isDataRequest) {
|
|
32622
33063
|
const html = await response.clone().text();
|
|
@@ -32727,7 +33168,7 @@ var init_platform_handler = __esm({
|
|
|
32727
33168
|
|
|
32728
33169
|
// ../adapter/src/platform-output.ts
|
|
32729
33170
|
import {
|
|
32730
|
-
mkdirSync as
|
|
33171
|
+
mkdirSync as mkdirSync9,
|
|
32731
33172
|
copyFileSync as copyFileSync3,
|
|
32732
33173
|
readdirSync as readdirSync6,
|
|
32733
33174
|
statSync as statSync11,
|
|
@@ -32739,28 +33180,28 @@ import {
|
|
|
32739
33180
|
import { resolve as resolve19, join as join13, extname as extname6, dirname as dirname14 } from "node:path";
|
|
32740
33181
|
function ensureCleanDir(dir) {
|
|
32741
33182
|
rmSync2(dir, { recursive: true, force: true });
|
|
32742
|
-
|
|
33183
|
+
mkdirSync9(dir, { recursive: true });
|
|
32743
33184
|
}
|
|
32744
33185
|
function copyDirContents(srcDir, destDir) {
|
|
32745
33186
|
if (!existsSync21(srcDir)) return;
|
|
32746
|
-
|
|
33187
|
+
mkdirSync9(destDir, { recursive: true });
|
|
32747
33188
|
for (const entry of readdirSync6(srcDir)) {
|
|
32748
33189
|
const srcPath = join13(srcDir, entry);
|
|
32749
33190
|
const destPath = join13(destDir, entry);
|
|
32750
33191
|
if (statSync11(srcPath).isDirectory()) {
|
|
32751
33192
|
copyDirContents(srcPath, destPath);
|
|
32752
33193
|
} else {
|
|
32753
|
-
|
|
33194
|
+
mkdirSync9(dirname14(destPath), { recursive: true });
|
|
32754
33195
|
copyFileSync3(srcPath, destPath);
|
|
32755
33196
|
}
|
|
32756
33197
|
}
|
|
32757
33198
|
}
|
|
32758
33199
|
function writeFile(path, content) {
|
|
32759
|
-
|
|
33200
|
+
mkdirSync9(dirname14(path), { recursive: true });
|
|
32760
33201
|
writeFileSync10(path, content, "utf-8");
|
|
32761
33202
|
}
|
|
32762
33203
|
function writePlatformStatic(buildStaticDir, platformStaticDir) {
|
|
32763
|
-
|
|
33204
|
+
mkdirSync9(platformStaticDir, { recursive: true });
|
|
32764
33205
|
const publicDir = resolve19(buildStaticDir, "public");
|
|
32765
33206
|
if (existsSync21(publicDir)) {
|
|
32766
33207
|
copyDirContents(publicDir, platformStaticDir);
|
|
@@ -32770,7 +33211,7 @@ function writePlatformStatic(buildStaticDir, platformStaticDir) {
|
|
|
32770
33211
|
const runtimeAlias = resolve19(platformStaticDir, "_vesk", "runtime.js");
|
|
32771
33212
|
const clientPath = resolve19(buildStaticDir, "client.js");
|
|
32772
33213
|
if (existsSync21(clientPath)) {
|
|
32773
|
-
|
|
33214
|
+
mkdirSync9(dirname14(runtimeAlias), { recursive: true });
|
|
32774
33215
|
copyFileSync3(clientPath, runtimeAlias);
|
|
32775
33216
|
}
|
|
32776
33217
|
}
|
|
@@ -32844,7 +33285,7 @@ var platform_deploy_exports = {};
|
|
|
32844
33285
|
__export(platform_deploy_exports, {
|
|
32845
33286
|
emitPlatformOutput: () => emitPlatformOutput
|
|
32846
33287
|
});
|
|
32847
|
-
import { writeFileSync as writeFileSync11, mkdirSync as
|
|
33288
|
+
import { writeFileSync as writeFileSync11, mkdirSync as mkdirSync10, rmSync as rmSync3, cpSync } from "node:fs";
|
|
32848
33289
|
import { resolve as resolve20 } from "node:path";
|
|
32849
33290
|
async function emitPlatformOutput(platform, ctx2) {
|
|
32850
33291
|
if (platform === "node") return null;
|
|
@@ -32883,7 +33324,7 @@ ${shell.bootstrap}
|
|
|
32883
33324
|
let handlerRel;
|
|
32884
33325
|
if (shell.functionFile) {
|
|
32885
33326
|
const funcDir = resolve20(outRoot, shell.functionFile.dir);
|
|
32886
|
-
|
|
33327
|
+
mkdirSync10(funcDir, { recursive: true });
|
|
32887
33328
|
if (shell.functionConfig) {
|
|
32888
33329
|
writeFileSync11(resolve20(funcDir, ".vc-config.json"), JSON.stringify(shell.functionConfig, null, 2), "utf-8");
|
|
32889
33330
|
writeFileSync11(resolve20(funcDir, "package.json"), JSON.stringify({ type: "module" }, null, 2) + "\n", "utf-8");
|
|
@@ -38164,7 +38605,7 @@ declare module '@vesk/runtime' {
|
|
|
38164
38605
|
});
|
|
38165
38606
|
|
|
38166
38607
|
// src/index.ts
|
|
38167
|
-
import { readFileSync as readFileSync40, writeFileSync as writeFileSync21, mkdirSync as
|
|
38608
|
+
import { readFileSync as readFileSync40, writeFileSync as writeFileSync21, mkdirSync as mkdirSync20, existsSync as existsSync43 } from "fs";
|
|
38168
38609
|
import { resolve as resolve40, join as join26 } from "path";
|
|
38169
38610
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
38170
38611
|
|
|
@@ -38734,7 +39175,7 @@ function setRuntimeModule2(mod) {
|
|
|
38734
39175
|
}
|
|
38735
39176
|
|
|
38736
39177
|
// ../adapter/dist/index.js
|
|
38737
|
-
import { mkdirSync as
|
|
39178
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, existsSync as existsSync22, readFileSync as readFileSync21 } from "node:fs";
|
|
38738
39179
|
import { resolve as resolve21, dirname as dirname16, relative as relative4, basename as basename2 } from "node:path";
|
|
38739
39180
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
38740
39181
|
|
|
@@ -39970,9 +40411,10 @@ init_esbuild_fallback();
|
|
|
39970
40411
|
init_strip_ts();
|
|
39971
40412
|
init_parser();
|
|
39972
40413
|
init_client_codegen();
|
|
39973
|
-
import { readFileSync as readFileSync11, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync3, rmSync, mkdtempSync } from "node:fs";
|
|
40414
|
+
import { readFileSync as readFileSync11, existsSync as existsSync11, writeFileSync as writeFileSync4, unlinkSync as unlinkSync3, statSync as statSync3, rmSync, mkdtempSync, mkdirSync as mkdirSync3 } from "node:fs";
|
|
39974
40415
|
import { resolve as resolve10, join as join7, dirname as dirname8, relative as relative2, sep } from "node:path";
|
|
39975
40416
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
40417
|
+
import { tmpdir } from "node:os";
|
|
39976
40418
|
init_vsk_imports();
|
|
39977
40419
|
init_md_inline();
|
|
39978
40420
|
init_module_imports();
|
|
@@ -40722,7 +41164,19 @@ function runtimeExportNames(runtimeDir) {
|
|
|
40722
41164
|
return names;
|
|
40723
41165
|
}
|
|
40724
41166
|
var RUNTIME_ENTRY = ".runtime-tree-entry.mjs";
|
|
40725
|
-
|
|
41167
|
+
function esbuildPath(p) {
|
|
41168
|
+
return sep === "/" ? p : p.split(sep).join("/");
|
|
41169
|
+
}
|
|
41170
|
+
function runtimeTreeShakeEntry() {
|
|
41171
|
+
return join7(tmpdir(), "vesk-runtime-tree-shake", RUNTIME_ENTRY);
|
|
41172
|
+
}
|
|
41173
|
+
var treeShakeQueue = Promise.resolve();
|
|
41174
|
+
function buildTreeShakenRuntime(runtimeDir, usedNames) {
|
|
41175
|
+
const run = treeShakeQueue.then(() => buildTreeShakenRuntimeNow(runtimeDir, usedNames));
|
|
41176
|
+
treeShakeQueue = run.catch(() => void 0);
|
|
41177
|
+
return run;
|
|
41178
|
+
}
|
|
41179
|
+
async function buildTreeShakenRuntimeNow(runtimeDir, usedNames) {
|
|
40726
41180
|
const unique = [...new Set(usedNames)];
|
|
40727
41181
|
const available = runtimeExportNames(runtimeDir);
|
|
40728
41182
|
const missing = unique.filter((n) => !available.has(n));
|
|
@@ -40730,16 +41184,21 @@ async function buildTreeShakenRuntime(runtimeDir, usedNames) {
|
|
|
40730
41184
|
console.error(`vesk: runtime names not exported \u2014 ${missing.join(", ")}; falling back to full runtime`);
|
|
40731
41185
|
return buildRuntimeCode(runtimeDir);
|
|
40732
41186
|
}
|
|
40733
|
-
const entry =
|
|
41187
|
+
const entry = runtimeTreeShakeEntry();
|
|
41188
|
+
const indexClient = esbuildPath(join7(runtimeDir, "index-client.js"));
|
|
40734
41189
|
try {
|
|
41190
|
+
try {
|
|
41191
|
+
mkdirSync3(dirname8(entry), { recursive: true });
|
|
41192
|
+
} catch {
|
|
41193
|
+
}
|
|
40735
41194
|
try {
|
|
40736
41195
|
rmSync(entry);
|
|
40737
41196
|
} catch {
|
|
40738
41197
|
}
|
|
40739
|
-
writeFileSync4(entry, `export { ${unique.join(", ")} } from
|
|
41198
|
+
writeFileSync4(entry, `export { ${unique.join(", ")} } from ${JSON.stringify(indexClient)};
|
|
40740
41199
|
`);
|
|
40741
41200
|
const result = await build({
|
|
40742
|
-
entryPoints: [entry],
|
|
41201
|
+
entryPoints: [esbuildPath(entry)],
|
|
40743
41202
|
bundle: true,
|
|
40744
41203
|
format: "iife",
|
|
40745
41204
|
globalName: "__veskRuntime",
|
|
@@ -40796,7 +41255,7 @@ async function buildMainBundle(routeTree, runtimeDir, codeSplit, mono, hmr, impo
|
|
|
40796
41255
|
|
|
40797
41256
|
` : runtimeCode + "\n";
|
|
40798
41257
|
const cleanupFn = "function __cleanup(start, end) {\n let n = start.nextSibling;\n while (n && n !== end) {\n const next = n.nextSibling;\n n.remove();\n n = next;\n }\n}\n";
|
|
40799
|
-
const placeFn = "function __place(start, end, nodes, fallback) {\n if (start.parentNode !== null) {\n const p = start.parentNode;\n for (let i = 0; i < nodes.length; i++) p.insertBefore(nodes[i], end);\n return;\n }\n if (nodes.length > 0 && nodes[0].parentNode) {\n const p = nodes[0].parentNode;\n p.insertBefore(start, nodes[0]);\n p.insertBefore(end, nodes[nodes.length - 1].nextSibling);\n return;\n }\n fallback.appendChild(start);\n fallback.appendChild(end);\n for (let i = 0; i < nodes.length; i++) fallback.insertBefore(nodes[i], end);\n}\n";
|
|
41258
|
+
const placeFn = "function __place(start, end, nodes, fallback) {\n if (start.parentNode !== null) {\n const p = start.parentNode;\n for (let i = 0; i < nodes.length; i++) p.insertBefore(nodes[i], end);\n return;\n }\n if (nodes.length > 0 && nodes[0].parentNode) {\n const p = nodes[0].parentNode;\n p.insertBefore(start, nodes[0]);\n p.insertBefore(end, nodes[nodes.length - 1].nextSibling);\n // Client-surplus nodes (SSR rendered fewer items than the client data)\n // are freshly claimed and still detached \u2014 move them into the region in\n // client order before `end`, instead of stranding them off-parent.\n for (let i = 0; i < nodes.length; i++) {\n if (nodes[i].parentNode === null) p.insertBefore(nodes[i], end);\n }\n return;\n }\n fallback.appendChild(start);\n fallback.appendChild(end);\n for (let i = 0; i < nodes.length; i++) fallback.insertBefore(nodes[i], end);\n}\n";
|
|
40800
41259
|
const updateComponentsFn = "function __updateComponents(nodes) {\n for (const n of nodes) {\n if (n._pageName && __components[n._pageName]) n.page = __components[n._pageName];\n if (n._layoutName && __components[n._layoutName]) n.layout = __components[n._layoutName];\n if (n._errorName && __components[n._errorName]) n.error = __components[n._errorName];\n if (n._notFoundName && __components[n._notFoundName]) n.notFound = __components[n._notFoundName];\n if (n._offlineName && __components[n._offlineName]) n.offline = __components[n._offlineName];\n if (n._networkName && __components[n._networkName]) n.network = __components[n._networkName];\n if (n.children) __updateComponents(n.children);\n }\n}\n";
|
|
40801
41260
|
const routeTreeJson = JSON.stringify(routeTree);
|
|
40802
41261
|
if (codeSplit) {
|
|
@@ -40915,14 +41374,14 @@ function generateManifest(routes, ssrRoutes, apiRoutes, staticRoutes, middleware
|
|
|
40915
41374
|
|
|
40916
41375
|
// ../adapter/src/static.ts
|
|
40917
41376
|
init_paths();
|
|
40918
|
-
import { mkdirSync as
|
|
41377
|
+
import { mkdirSync as mkdirSync4, copyFileSync, readdirSync as readdirSync2, statSync as statSync5, existsSync as existsSync13, writeFileSync as writeFileSync5, readFileSync as readFileSync13 } from "node:fs";
|
|
40919
41378
|
import { resolve as resolve12, join as join8 } from "node:path";
|
|
40920
41379
|
function copyStaticAssets(publicDir, outDir) {
|
|
40921
41380
|
const targetDir = resolve12(outDir, "static", "public");
|
|
40922
|
-
|
|
41381
|
+
mkdirSync4(targetDir, { recursive: true });
|
|
40923
41382
|
if (!existsSync13(publicDir)) return;
|
|
40924
41383
|
function copyDir(src2, dest) {
|
|
40925
|
-
|
|
41384
|
+
mkdirSync4(dest, { recursive: true });
|
|
40926
41385
|
const entries = readdirSync2(src2);
|
|
40927
41386
|
for (const entry of entries) {
|
|
40928
41387
|
const srcPath = join8(src2, entry);
|
|
@@ -40947,7 +41406,7 @@ init_server_utils();
|
|
|
40947
41406
|
init_paths();
|
|
40948
41407
|
|
|
40949
41408
|
// ../adapter/src/load-config.ts
|
|
40950
|
-
import { existsSync as existsSync14, readFileSync as readFileSync14, writeFileSync as writeFileSync6, mkdirSync as
|
|
41409
|
+
import { existsSync as existsSync14, readFileSync as readFileSync14, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5 } from "node:fs";
|
|
40951
41410
|
import { join as join9, dirname as dirname9 } from "node:path";
|
|
40952
41411
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
40953
41412
|
import { createRequire as createRequire3 } from "node:module";
|
|
@@ -40992,7 +41451,7 @@ async function loadVeskConfig2(projectDir) {
|
|
|
40992
41451
|
js = `const {${injectKeys.join(",")}} = globalThis.__vesk_inject;
|
|
40993
41452
|
` + js;
|
|
40994
41453
|
const tmpFile = join9(projectDir, ".vesk", "config.loader.tmp.mjs");
|
|
40995
|
-
|
|
41454
|
+
mkdirSync5(dirname9(tmpFile), { recursive: true });
|
|
40996
41455
|
writeFileSync6(tmpFile, js, "utf-8");
|
|
40997
41456
|
globalThis.__vesk_inject = inject;
|
|
40998
41457
|
try {
|
|
@@ -41445,6 +41904,12 @@ async function startProdServer(outDir, options) {
|
|
|
41445
41904
|
return;
|
|
41446
41905
|
} catch (e) {
|
|
41447
41906
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
41907
|
+
if (err.name === "Redirect") {
|
|
41908
|
+
const redirect2 = err;
|
|
41909
|
+
res.writeHead(Number(redirect2.status) || 302, { Location: typeof redirect2.url === "string" ? redirect2.url : "/" });
|
|
41910
|
+
res.end();
|
|
41911
|
+
return;
|
|
41912
|
+
}
|
|
41448
41913
|
if (err.name === "NotFoundError") {
|
|
41449
41914
|
res.writeHead(404, { "Content-Type": "text/html" });
|
|
41450
41915
|
res.end(notFoundHtml || "<!DOCTYPE html><html><body><h1>404</h1><p>Not Found</p></body></html>");
|
|
@@ -41609,7 +42074,7 @@ async function build2(appDir, options) {
|
|
|
41609
42074
|
resolve21(outDir, "prerendered")
|
|
41610
42075
|
];
|
|
41611
42076
|
for (const d of dirs)
|
|
41612
|
-
|
|
42077
|
+
mkdirSync11(d, { recursive: true });
|
|
41613
42078
|
const cssSourcePath = resolveUserCssPath(appDir);
|
|
41614
42079
|
if (cssSourcePath !== null) {
|
|
41615
42080
|
const cssContent = readFileSync21(cssSourcePath, "utf-8");
|
|
@@ -42226,6 +42691,8 @@ function transformTracked2(irNode, tracked2) {
|
|
|
42226
42691
|
return context.next();
|
|
42227
42692
|
if (parent.type === "UpdateExpression" && parent.argument === node)
|
|
42228
42693
|
return context.next();
|
|
42694
|
+
if (parent.type === "MemberExpression" && !parent.computed && parent.property === node)
|
|
42695
|
+
return context.next();
|
|
42229
42696
|
if (parent.type === "Property" && parent.value === node && parent.key && parent.key.type === "Identifier" && parent.key.name === "into")
|
|
42230
42697
|
return context.next();
|
|
42231
42698
|
if (parent.type === "MemberExpression" && !parent.computed && parent.object === node && parent.property && parent.property.type === "Identifier" && parent.property.name === "set")
|
|
@@ -42329,6 +42796,12 @@ var Ctx2 = class {
|
|
|
42329
42796
|
delegatedEvents = /* @__PURE__ */ new Set();
|
|
42330
42797
|
directEvents = /* @__PURE__ */ new Set();
|
|
42331
42798
|
hydrate = false;
|
|
42799
|
+
// Markerless structural hydration: claims run `nextElement(tag, skipK)` with
|
|
42800
|
+
// positional residue offsets and interior claims rebind the walker to the
|
|
42801
|
+
// claimed element (subWalker). Only meaningful when `hydrate` is also true.
|
|
42802
|
+
// Markerless is the DEFAULT; pass `markerless: false` to restore legacy
|
|
42803
|
+
// marker-mode claim emission.
|
|
42804
|
+
markerless = true;
|
|
42332
42805
|
inTryBody = false;
|
|
42333
42806
|
claimStatic = false;
|
|
42334
42807
|
// While set, the next StaticNode claimed in hydrate mode uses `__root` (the
|
|
@@ -42378,9 +42851,9 @@ var Ctx2 = class {
|
|
|
42378
42851
|
return "\n" + lines.join("\n");
|
|
42379
42852
|
}
|
|
42380
42853
|
};
|
|
42381
|
-
function emitNode2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components") {
|
|
42854
|
+
function emitNode2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components", skipK = 0, regionBudget) {
|
|
42382
42855
|
if (node instanceof StaticNode)
|
|
42383
|
-
return emitStatic2(ctx2, node, tracked2, effectsVar);
|
|
42856
|
+
return emitStatic2(ctx2, node, tracked2, effectsVar, skipK, regionBudget);
|
|
42384
42857
|
if (node instanceof TextNode) {
|
|
42385
42858
|
if (!node.value)
|
|
42386
42859
|
return null;
|
|
@@ -42399,11 +42872,11 @@ function emitNode2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__
|
|
|
42399
42872
|
if (node instanceof ComponentRef)
|
|
42400
42873
|
return null;
|
|
42401
42874
|
if (node instanceof ComponentCall)
|
|
42402
|
-
return emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix);
|
|
42875
|
+
return emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix, skipK, regionBudget);
|
|
42403
42876
|
if (node instanceof OpaqueDynamicRegion)
|
|
42404
|
-
return emitOpaque2(ctx2, node, tracked2, effectsVar, parentVar);
|
|
42877
|
+
return emitOpaque2(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
42405
42878
|
if (node instanceof MapRegion)
|
|
42406
|
-
return emitMap2(ctx2, node, tracked2, effectsVar, parentVar);
|
|
42879
|
+
return emitMap2(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
42407
42880
|
if (node instanceof ServerBlock)
|
|
42408
42881
|
return null;
|
|
42409
42882
|
if (node instanceof ClientBlock) {
|
|
@@ -42443,13 +42916,13 @@ function emitNode2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__
|
|
|
42443
42916
|
return null;
|
|
42444
42917
|
}
|
|
42445
42918
|
if (node instanceof TryCatch)
|
|
42446
|
-
return emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar);
|
|
42919
|
+
return emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar, skipK, regionBudget);
|
|
42447
42920
|
if (node instanceof WhileLoop)
|
|
42448
|
-
return emitWhileLoop2(ctx2, node, tracked2, parentVar);
|
|
42921
|
+
return emitWhileLoop2(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
42449
42922
|
if (node instanceof ForLoop)
|
|
42450
|
-
return emitForLoop2(ctx2, node, tracked2, parentVar);
|
|
42923
|
+
return emitForLoop2(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
42451
42924
|
if (node instanceof SwitchBlock)
|
|
42452
|
-
return emitSwitchBlock2(ctx2, node, tracked2, parentVar);
|
|
42925
|
+
return emitSwitchBlock2(ctx2, node, tracked2, parentVar, skipK, regionBudget);
|
|
42453
42926
|
if (node instanceof PropSlot)
|
|
42454
42927
|
return null;
|
|
42455
42928
|
if (node instanceof PropSlotRender) {
|
|
@@ -42484,7 +42957,7 @@ var PROPERTY_ATTRS2 = {
|
|
|
42484
42957
|
option: /* @__PURE__ */ new Set(["selected"]),
|
|
42485
42958
|
progress: /* @__PURE__ */ new Set(["value"])
|
|
42486
42959
|
};
|
|
42487
|
-
function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
42960
|
+
function emitStatic2(ctx2, node, tracked2, effectsVar, skipK = 0, regionBudget) {
|
|
42488
42961
|
const el = ctx2.n();
|
|
42489
42962
|
if (ctx2.hydrate) {
|
|
42490
42963
|
const claim = ctx2.claimStatic;
|
|
@@ -42493,8 +42966,12 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
|
42493
42966
|
return null;
|
|
42494
42967
|
const rootClaim = ctx2.rootClaim;
|
|
42495
42968
|
ctx2.rootClaim = false;
|
|
42496
|
-
const
|
|
42969
|
+
const skipExpr = regionBudget && ctx2.markerless ? markerlessSkipExpr2(regionBudget, skipK) : skipK;
|
|
42970
|
+
const skipArg = ctx2.markerless ? `, ${skipExpr}` : "";
|
|
42971
|
+
const claimedExpr = rootClaim ? `__root || document.createElement(${JSON.stringify(node.tag)})` : `${ctx2.walker}.nextElement(${JSON.stringify(node.tag)}${skipArg})`;
|
|
42497
42972
|
ctx2.push(`const ${el} = ${claimedExpr};`);
|
|
42973
|
+
if (regionBudget && ctx2.markerless)
|
|
42974
|
+
ctx2.push(`${regionBudget} = 0;`);
|
|
42498
42975
|
} else {
|
|
42499
42976
|
ctx2.push(`const ${el} = document.createElement(${JSON.stringify(node.tag)});`);
|
|
42500
42977
|
}
|
|
@@ -42527,7 +43004,41 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
|
42527
43004
|
const textKids = children.filter((c) => c instanceof TextNode || c instanceof DynamicBinding && c.kind === "text");
|
|
42528
43005
|
singleReactiveText = textKids.length === 1 && textKids[0] instanceof DynamicBinding && isReactiveExpression2(textKids[0].expression, tracked2);
|
|
42529
43006
|
}
|
|
43007
|
+
const savedWalker = ctx2.walker;
|
|
43008
|
+
let needsSubWalker = false;
|
|
43009
|
+
if (ctx2.hydrate && ctx2.markerless) {
|
|
43010
|
+
for (const child of children) {
|
|
43011
|
+
if (child instanceof TextNode)
|
|
43012
|
+
continue;
|
|
43013
|
+
if (child instanceof DynamicBinding && child.kind === "text")
|
|
43014
|
+
continue;
|
|
43015
|
+
if (child instanceof StaticNode && isStaticIR2(child.children))
|
|
43016
|
+
continue;
|
|
43017
|
+
if (child instanceof TrackDecl)
|
|
43018
|
+
continue;
|
|
43019
|
+
if (child instanceof ComponentRef)
|
|
43020
|
+
continue;
|
|
43021
|
+
if (child instanceof ServerBlock)
|
|
43022
|
+
continue;
|
|
43023
|
+
if (child instanceof ClientBlock)
|
|
43024
|
+
continue;
|
|
43025
|
+
if (child instanceof HeadBlock)
|
|
43026
|
+
continue;
|
|
43027
|
+
if (child instanceof RuntimeStatement)
|
|
43028
|
+
continue;
|
|
43029
|
+
if (child instanceof PropSlot)
|
|
43030
|
+
continue;
|
|
43031
|
+
needsSubWalker = true;
|
|
43032
|
+
break;
|
|
43033
|
+
}
|
|
43034
|
+
}
|
|
43035
|
+
if (needsSubWalker) {
|
|
43036
|
+
const sub = ctx2.n();
|
|
43037
|
+
ctx2.push(`const ${sub} = ${ctx2.walker}.subWalker(${el});`);
|
|
43038
|
+
ctx2.walker = sub;
|
|
43039
|
+
}
|
|
42530
43040
|
let residueBefore = 0;
|
|
43041
|
+
let pendingSkip = 0;
|
|
42531
43042
|
for (const child of children) {
|
|
42532
43043
|
let childVar;
|
|
42533
43044
|
const isPureStaticChild = ctx2.hydrate && child instanceof StaticNode && isStaticIR2(child.children);
|
|
@@ -42581,10 +43092,13 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
|
42581
43092
|
}
|
|
42582
43093
|
}
|
|
42583
43094
|
childVar = ssrEl;
|
|
43095
|
+
pendingSkip += ssrResidueEstimate2(child);
|
|
42584
43096
|
} else if (singleReactiveText && child instanceof DynamicBinding && child.kind === "text") {
|
|
42585
43097
|
childVar = emitDynamicBinding2(ctx2, child, tracked2, effectsVar, `${el}.__vsk_ssrText`);
|
|
42586
43098
|
} else {
|
|
42587
|
-
childVar = emitNode2(ctx2, child, tracked2, effectsVar, el);
|
|
43099
|
+
childVar = emitNode2(ctx2, child, tracked2, effectsVar, el, "__components", pendingSkip);
|
|
43100
|
+
if (claimsWalkerNode2(ctx2, child))
|
|
43101
|
+
pendingSkip = 0;
|
|
42588
43102
|
}
|
|
42589
43103
|
if (childVar) {
|
|
42590
43104
|
if (ctx2.hydrate) {
|
|
@@ -42636,6 +43150,8 @@ function emitStatic2(ctx2, node, tracked2, effectsVar) {
|
|
|
42636
43150
|
}
|
|
42637
43151
|
}
|
|
42638
43152
|
}
|
|
43153
|
+
if (ctx2.walker !== savedWalker)
|
|
43154
|
+
ctx2.walker = savedWalker;
|
|
42639
43155
|
return el;
|
|
42640
43156
|
}
|
|
42641
43157
|
function emitClientHead2(ctx2, node, tracked2) {
|
|
@@ -42785,10 +43301,15 @@ function emitFragment2(ctx2, nodes, tracked2, effectsVar) {
|
|
|
42785
43301
|
const savedEffects = ctx2.effects;
|
|
42786
43302
|
ctx2.effects = [];
|
|
42787
43303
|
ctx2.push(`const ${frag} = (() => { const $f = document.createDocumentFragment();`);
|
|
43304
|
+
let fragPendingSkip = 0;
|
|
42788
43305
|
for (const child of nodes) {
|
|
42789
|
-
const childVar = emitNode2(ctx2, child, tracked2, effectsVar, "$f");
|
|
43306
|
+
const childVar = emitNode2(ctx2, child, tracked2, effectsVar, "$f", "__components", fragPendingSkip);
|
|
42790
43307
|
if (childVar)
|
|
42791
43308
|
ctx2.push(`$f.appendChild(${childVar});`);
|
|
43309
|
+
if (claimsWalkerNode2(ctx2, child))
|
|
43310
|
+
fragPendingSkip = 0;
|
|
43311
|
+
else
|
|
43312
|
+
fragPendingSkip += ssrResidueEstimate2(child);
|
|
42792
43313
|
}
|
|
42793
43314
|
for (const eff of ctx2.effects)
|
|
42794
43315
|
ctx2.push(effectsVar ? `${effectsVar}.push(${effectBlockToHandlerExpr2(eff)});` : eff);
|
|
@@ -42796,7 +43317,7 @@ function emitFragment2(ctx2, nodes, tracked2, effectsVar) {
|
|
|
42796
43317
|
ctx2.push(`return $f; })();`);
|
|
42797
43318
|
return frag;
|
|
42798
43319
|
}
|
|
42799
|
-
function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components") {
|
|
43320
|
+
function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPrefix = "__components", skipK = 0, regionBudget) {
|
|
42800
43321
|
const propsEntries = node.props.map((p) => {
|
|
42801
43322
|
if (typeof p.value === "string")
|
|
42802
43323
|
return `${JSON.stringify(p.name)}: ${JSON.stringify(p.value)}`;
|
|
@@ -42819,12 +43340,19 @@ function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPre
|
|
|
42819
43340
|
const callArgs = () => `{ ${propsEntries.join(", ")} }`;
|
|
42820
43341
|
if (ctx2.hydrate) {
|
|
42821
43342
|
const access = calleeExpr ?? (ctx2.importedNames.has(node.componentName) ? node.componentName : `__components[${JSON.stringify(node.componentName)}]`);
|
|
43343
|
+
if (!calleeExpr && !ctx2.importedNames.has(node.componentName)) {
|
|
43344
|
+
ctx2.push(`if (${access} == null) throw new Error(${JSON.stringify(`Component "${node.componentName}" was not found while rendering. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
43345
|
+
}
|
|
42822
43346
|
const plainTarget = !!(calleeExpr || ctx2.importedNames.has(node.componentName)) && !ctx2.selfClaimNames.has(node.componentName);
|
|
42823
43347
|
const walkerArg = ctx2.walker;
|
|
43348
|
+
const promptExpr = ctx2.markerless && (regionBudget || skipK > 0) ? markerlessSkipExpr2(regionBudget, skipK) : null;
|
|
42824
43349
|
const maybeReplace = (v2) => {
|
|
42825
43350
|
if (!plainTarget)
|
|
42826
43351
|
return;
|
|
42827
|
-
|
|
43352
|
+
const claim = promptExpr ? `${walkerArg}.claimOnly(undefined, ${promptExpr})` : `${walkerArg}.claimOnly()`;
|
|
43353
|
+
ctx2.push(`if (${v2} && ${v2}.parentNode == null && ${v2}.nodeType !== 11) { const __sr = ${claim}; if (__sr && __sr.parentNode) __sr.parentNode.replaceChild(${v2}, __sr); }`);
|
|
43354
|
+
if (regionBudget && ctx2.markerless)
|
|
43355
|
+
ctx2.push(`${regionBudget} = 0;`);
|
|
42828
43356
|
};
|
|
42829
43357
|
const maybeRetire = () => {
|
|
42830
43358
|
if (ctx2.selfClaimNames.has(node.componentName)) {
|
|
@@ -42856,9 +43384,14 @@ function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPre
|
|
|
42856
43384
|
ctx2.push(`return $f; })();`);
|
|
42857
43385
|
propsEntries.push(`children: ${frag}`);
|
|
42858
43386
|
}
|
|
43387
|
+
if (ctx2.markerless && promptExpr && !plainTarget) {
|
|
43388
|
+
ctx2.push(`${walkerArg}.injectSkipK(${promptExpr});`);
|
|
43389
|
+
}
|
|
42859
43390
|
ctx2.push(`let ${v} = undefined;`);
|
|
42860
43391
|
ctx2.push(`if (__hydrate) __hydrate.childFrame = (__hydrate.childFrame || 0) + 1;`);
|
|
42861
43392
|
ctx2.push(`try { ${v} = ${awaitKw}${access}(${callArgs()}, __registry, ${walkerArg}); } finally { if (__hydrate) __hydrate.childFrame--; }`);
|
|
43393
|
+
if (ctx2.markerless && promptExpr && !plainTarget && regionBudget)
|
|
43394
|
+
ctx2.push(`${regionBudget} = 0;`);
|
|
42862
43395
|
maybeReplace(v);
|
|
42863
43396
|
maybeRetire();
|
|
42864
43397
|
return v;
|
|
@@ -42888,32 +43421,54 @@ function emitComponentCall2(ctx2, node, tracked2, effectsVar, parentVar, compPre
|
|
|
42888
43421
|
} else if (ctx2.importedNames.has(node.componentName)) {
|
|
42889
43422
|
ctx2.push(`const ${v} = ${awaitKw}${node.componentName}(${callArgs()});`);
|
|
42890
43423
|
} else {
|
|
43424
|
+
ctx2.push(`if (${compPrefix}[${JSON.stringify(node.componentName)}] == null) throw new Error(${JSON.stringify(`Component "${node.componentName}" was not found while rendering. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
42891
43425
|
ctx2.push(`const ${v} = ${awaitKw}${compPrefix}[${JSON.stringify(node.componentName)}](${callArgs()});`);
|
|
42892
43426
|
}
|
|
42893
43427
|
}
|
|
42894
43428
|
return v;
|
|
42895
43429
|
}
|
|
42896
|
-
function emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, rootLevel) {
|
|
43430
|
+
function emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, rootLevel, offsetExpr) {
|
|
42897
43431
|
if (!ctx2.hydrate || !rootLevel)
|
|
42898
43432
|
return;
|
|
42899
43433
|
ctx2.push(`// Anchor region fences to the SSR slot so no-content regions do not fall back to $root's end.`);
|
|
42900
|
-
ctx2.push(`if (
|
|
42901
|
-
ctx2.push(indent3(
|
|
42902
|
-
ctx2.push(indent3(
|
|
43434
|
+
ctx2.push(`if (${ctx2.walker} && ${ctx2.walker}.insertBeforeNextClaim) {`);
|
|
43435
|
+
ctx2.push(indent3(`${ctx2.walker}.insertBeforeNextClaim(${anchor}${offsetExpr ? `, ${offsetExpr}` : ""});`));
|
|
43436
|
+
ctx2.push(indent3(`${ctx2.walker}.insertBeforeNextClaim(${endAnchor}${offsetExpr ? `, ${offsetExpr}` : ""});`));
|
|
42903
43437
|
ctx2.push(`}`);
|
|
42904
43438
|
}
|
|
42905
|
-
function
|
|
43439
|
+
function regionBudgetVar2(ctx2, skipK, regionBudget, inheritedInit) {
|
|
43440
|
+
if (!ctx2.markerless || !ctx2.hydrate)
|
|
43441
|
+
return null;
|
|
43442
|
+
if (skipK > 0) {
|
|
43443
|
+
const pk = ctx2.n();
|
|
43444
|
+
ctx2.push(`let ${pk} = ${skipK}; // first-claim budget: region SSR sits ${skipK} slot(s) past the walker cursor`);
|
|
43445
|
+
return pk;
|
|
43446
|
+
}
|
|
43447
|
+
if (inheritedInit) {
|
|
43448
|
+
const pk = ctx2.n();
|
|
43449
|
+
ctx2.push(`let ${pk} = ${inheritedInit}; // first-claim budget: inherited from the caller's walker residue`);
|
|
43450
|
+
return pk;
|
|
43451
|
+
}
|
|
43452
|
+
return regionBudget || null;
|
|
43453
|
+
}
|
|
43454
|
+
function markerlessSkipExpr2(regionBudget, skipK) {
|
|
43455
|
+
if (regionBudget)
|
|
43456
|
+
return skipK > 0 ? `${regionBudget} + ${skipK}` : regionBudget;
|
|
43457
|
+
return String(skipK);
|
|
43458
|
+
}
|
|
43459
|
+
function emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar, skipK = 0, regionBudget) {
|
|
42906
43460
|
const anchor = ctx2.n();
|
|
42907
43461
|
const endAnchor = ctx2.n();
|
|
42908
43462
|
const effArr = ctx2.n();
|
|
42909
43463
|
const catchParam = node.catchParamName || "__e";
|
|
42910
43464
|
const parent = parentVar || "$root";
|
|
43465
|
+
const budget = ctx2.hydrate ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
42911
43466
|
ctx2.push(`const ${anchor} = document.createComment('try');`);
|
|
42912
43467
|
if (!ctx2.hydrate)
|
|
42913
43468
|
ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
42914
43469
|
ctx2.push(`let ${effArr} = [];`);
|
|
42915
43470
|
ctx2.push(`const ${endAnchor} = document.createComment('try-end');`);
|
|
42916
|
-
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
|
|
43471
|
+
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
42917
43472
|
const asyncKw = ctx2.isAsyncScope ? "await " : "";
|
|
42918
43473
|
function emitRenderFunc(name, isCatch, hydMode, compPrefix = "__components") {
|
|
42919
43474
|
const savedHydrate = ctx2.hydrate;
|
|
@@ -42931,7 +43486,7 @@ function emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar) {
|
|
|
42931
43486
|
ctx2.push(indent3(`const __cl = [];`));
|
|
42932
43487
|
}
|
|
42933
43488
|
for (const child of body) {
|
|
42934
|
-
const childVar = emitNode2(ctx2, child, tracked2, isCatch ? null : effArr, hydMode ? void 0 : "__p", compPrefix);
|
|
43489
|
+
const childVar = emitNode2(ctx2, child, tracked2, isCatch ? null : effArr, hydMode ? void 0 : "__p", compPrefix, 0, budget || void 0);
|
|
42935
43490
|
if (childVar) {
|
|
42936
43491
|
if (hydMode)
|
|
42937
43492
|
ctx2.push(indent3(`__cl.push(${childVar});`));
|
|
@@ -42981,9 +43536,10 @@ function emitTryCatch2(ctx2, node, tracked2, effectsVar, parentVar) {
|
|
|
42981
43536
|
}`);
|
|
42982
43537
|
return null;
|
|
42983
43538
|
}
|
|
42984
|
-
function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
43539
|
+
function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar, skipK = 0, regionBudget) {
|
|
42985
43540
|
const hyd = ctx2.hydrate;
|
|
42986
43541
|
const parent = parentVar || "$root";
|
|
43542
|
+
const budget = hyd ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
42987
43543
|
const isOpaque = (n) => !!n && typeof n.condition !== "undefined";
|
|
42988
43544
|
if (hyd && node.alternateNodes.length === 1 && isOpaque(node.alternateNodes[0])) {
|
|
42989
43545
|
const chain = [];
|
|
@@ -43004,7 +43560,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43004
43560
|
ctx2.push(`const ${anchor2} = document.createComment('if');`);
|
|
43005
43561
|
ctx2.push(`let ${effectsVar2} = [];`);
|
|
43006
43562
|
ctx2.push(`const ${endAnchor2} = document.createComment('if-end');`);
|
|
43007
|
-
emitHydrateFenceAnchoring2(ctx2, anchor2, endAnchor2, parent === "$root");
|
|
43563
|
+
emitHydrateFenceAnchoring2(ctx2, anchor2, endAnchor2, parent === "$root", budget || void 0);
|
|
43008
43564
|
const asyncKw2 = ctx2.isAsyncScope ? "await " : "";
|
|
43009
43565
|
const fnOpen2 = ctx2.isAsyncScope ? "async () => {" : "() => {";
|
|
43010
43566
|
const renderNames = [];
|
|
@@ -43018,7 +43574,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43018
43574
|
const savedClaim = ctx2.claimStatic;
|
|
43019
43575
|
if (hyd)
|
|
43020
43576
|
ctx2.claimStatic = true;
|
|
43021
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar2, parentVar);
|
|
43577
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar2, parentVar, "__components", 0, budget || void 0);
|
|
43022
43578
|
ctx2.claimStatic = savedClaim;
|
|
43023
43579
|
if (v)
|
|
43024
43580
|
ctx2.push(indent3(`${cl}.push(${v});`));
|
|
@@ -43036,7 +43592,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43036
43592
|
const savedClaim = ctx2.claimStatic;
|
|
43037
43593
|
if (hyd)
|
|
43038
43594
|
ctx2.claimStatic = true;
|
|
43039
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar2, parentVar);
|
|
43595
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar2, parentVar, "__components", 0, budget || void 0);
|
|
43040
43596
|
ctx2.claimStatic = savedClaim;
|
|
43041
43597
|
if (v)
|
|
43042
43598
|
ctx2.push(indent3(`${cl2}.push(${v});`));
|
|
@@ -43096,7 +43652,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43096
43652
|
ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
43097
43653
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
43098
43654
|
ctx2.push(`const ${endAnchor} = document.createComment('if-end');`);
|
|
43099
|
-
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
|
|
43655
|
+
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
43100
43656
|
const asyncKw = ctx2.isAsyncScope ? "await " : "";
|
|
43101
43657
|
const fnOpen = ctx2.isAsyncScope ? "async () => {" : "() => {";
|
|
43102
43658
|
const conRenderName = ctx2.n();
|
|
@@ -43112,7 +43668,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43112
43668
|
const savedClaim = ctx2.claimStatic;
|
|
43113
43669
|
if (hyd)
|
|
43114
43670
|
ctx2.claimStatic = true;
|
|
43115
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : conFrag);
|
|
43671
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : conFrag, "__components", 0, budget || void 0);
|
|
43116
43672
|
ctx2.claimStatic = savedClaim;
|
|
43117
43673
|
if (v) {
|
|
43118
43674
|
if (hyd)
|
|
@@ -43141,7 +43697,7 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43141
43697
|
const savedAltClaim = ctx2.claimStatic;
|
|
43142
43698
|
if (hyd)
|
|
43143
43699
|
ctx2.claimStatic = true;
|
|
43144
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : altFrag);
|
|
43700
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : altFrag, "__components", 0, budget || void 0);
|
|
43145
43701
|
ctx2.claimStatic = savedAltClaim;
|
|
43146
43702
|
if (v) {
|
|
43147
43703
|
if (hyd)
|
|
@@ -43188,19 +43744,20 @@ function emitOpaque2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43188
43744
|
}
|
|
43189
43745
|
return null;
|
|
43190
43746
|
}
|
|
43191
|
-
function emitWhileLoop2(ctx2, node, tracked2, parentVar) {
|
|
43747
|
+
function emitWhileLoop2(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
43192
43748
|
const condExpr = transformTracked2(node.condition, tracked2);
|
|
43193
43749
|
const anchor = ctx2.n();
|
|
43194
43750
|
const endAnchor = ctx2.n();
|
|
43195
43751
|
const effectsVar = ctx2.n();
|
|
43196
43752
|
const hyd = ctx2.hydrate;
|
|
43197
43753
|
const parent = parentVar || "$root";
|
|
43754
|
+
const budget = hyd ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
43198
43755
|
ctx2.push(`const ${anchor} = document.createComment('while');`);
|
|
43199
43756
|
if (!hyd)
|
|
43200
43757
|
ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
43201
43758
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
43202
43759
|
ctx2.push(`const ${endAnchor} = document.createComment('while-end');`);
|
|
43203
|
-
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
|
|
43760
|
+
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
43204
43761
|
const renderLoop = ctx2.n();
|
|
43205
43762
|
ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
43206
43763
|
if (!hyd)
|
|
@@ -43212,7 +43769,7 @@ function emitWhileLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43212
43769
|
if (node.isDoWhile) {
|
|
43213
43770
|
ctx2.push(indent3(`do {`));
|
|
43214
43771
|
for (const n of node.bodyTemplate) {
|
|
43215
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
43772
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
43216
43773
|
if (v) {
|
|
43217
43774
|
if (hyd)
|
|
43218
43775
|
ctx2.push(indent3(`__cl.push(${v});`));
|
|
@@ -43224,7 +43781,7 @@ function emitWhileLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43224
43781
|
} else {
|
|
43225
43782
|
ctx2.push(indent3(`while (${condExpr}) {`));
|
|
43226
43783
|
for (const n of node.bodyTemplate) {
|
|
43227
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
43784
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
43228
43785
|
if (v) {
|
|
43229
43786
|
if (hyd)
|
|
43230
43787
|
ctx2.push(indent3(`__cl.push(${v});`));
|
|
@@ -43263,18 +43820,19 @@ function emitWhileLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43263
43820
|
}`);
|
|
43264
43821
|
return null;
|
|
43265
43822
|
}
|
|
43266
|
-
function emitForLoop2(ctx2, node, tracked2, parentVar) {
|
|
43823
|
+
function emitForLoop2(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
43267
43824
|
const anchor = ctx2.n();
|
|
43268
43825
|
const endAnchor = ctx2.n();
|
|
43269
43826
|
const effectsVar = ctx2.n();
|
|
43270
43827
|
const hyd = ctx2.hydrate;
|
|
43271
43828
|
const parent = parentVar || "$root";
|
|
43829
|
+
const budget = hyd ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
43272
43830
|
ctx2.push(`const ${anchor} = document.createComment('for');`);
|
|
43273
43831
|
if (!hyd)
|
|
43274
43832
|
ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
43275
43833
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
43276
43834
|
ctx2.push(`const ${endAnchor} = document.createComment('for-end');`);
|
|
43277
|
-
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
|
|
43835
|
+
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
43278
43836
|
const renderLoop = ctx2.n();
|
|
43279
43837
|
ctx2.push(`const ${renderLoop} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
43280
43838
|
if (!hyd)
|
|
@@ -43287,7 +43845,7 @@ function emitForLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43287
43845
|
const srcExpr = transformTracked2(node.condition, tracked2);
|
|
43288
43846
|
ctx2.push(indent3(`for (${node.init} of (Array.isArray(${srcExpr}) ? ${srcExpr} : (${srcExpr} == null ? [] : Object.keys(${srcExpr})))) {`));
|
|
43289
43847
|
for (const n of node.bodyTemplate) {
|
|
43290
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
43848
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
43291
43849
|
if (v) {
|
|
43292
43850
|
if (hyd)
|
|
43293
43851
|
ctx2.push(indent3(`__cl.push(${v});`));
|
|
@@ -43307,7 +43865,7 @@ function emitForLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43307
43865
|
const head = initPart ? `${initPart}; ${condExpr}` : `; ${condExpr}`;
|
|
43308
43866
|
ctx2.push(indent3(`for (${head}; ${updatePart}) {`));
|
|
43309
43867
|
for (const n of node.bodyTemplate) {
|
|
43310
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b");
|
|
43868
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__b", "__components", 0, budget || void 0);
|
|
43311
43869
|
if (v) {
|
|
43312
43870
|
if (hyd)
|
|
43313
43871
|
ctx2.push(indent3(`__cl.push(${v});`));
|
|
@@ -43418,19 +43976,20 @@ function emitForLoop2(ctx2, node, tracked2, parentVar) {
|
|
|
43418
43976
|
}
|
|
43419
43977
|
return null;
|
|
43420
43978
|
}
|
|
43421
|
-
function emitSwitchBlock2(ctx2, node, tracked2, parentVar) {
|
|
43979
|
+
function emitSwitchBlock2(ctx2, node, tracked2, parentVar, skipK = 0, regionBudget) {
|
|
43422
43980
|
const discExpr = transformTracked2(node.discriminant, tracked2);
|
|
43423
43981
|
const anchor = ctx2.n();
|
|
43424
43982
|
const endAnchor = ctx2.n();
|
|
43425
43983
|
const effectsVar = ctx2.n();
|
|
43426
43984
|
const hyd = ctx2.hydrate;
|
|
43427
43985
|
const parent = parentVar || "$root";
|
|
43986
|
+
const budget = hyd ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
43428
43987
|
ctx2.push(`const ${anchor} = document.createComment('switch');`);
|
|
43429
43988
|
if (!hyd)
|
|
43430
43989
|
ctx2.push(`${parent}.appendChild(${anchor});`);
|
|
43431
43990
|
ctx2.push(`let ${effectsVar} = [];`);
|
|
43432
43991
|
ctx2.push(`const ${endAnchor} = document.createComment('switch-end');`);
|
|
43433
|
-
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root");
|
|
43992
|
+
emitHydrateFenceAnchoring2(ctx2, anchor, endAnchor, parent === "$root", budget || void 0);
|
|
43434
43993
|
const renderSwitch = ctx2.n();
|
|
43435
43994
|
ctx2.push(`const ${renderSwitch} = ${ctx2.isAsyncScope ? "async () => {" : "() => {"}`);
|
|
43436
43995
|
if (hyd) {
|
|
@@ -43447,7 +44006,7 @@ function emitSwitchBlock2(ctx2, node, tracked2, parentVar) {
|
|
|
43447
44006
|
ctx2.push(indent3(`default:`));
|
|
43448
44007
|
}
|
|
43449
44008
|
for (const n of c.body) {
|
|
43450
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__c");
|
|
44009
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? parentVar : "__c", "__components", 0, budget || void 0);
|
|
43451
44010
|
if (v) {
|
|
43452
44011
|
if (hyd)
|
|
43453
44012
|
ctx2.push(indent3(`__cl.push(${v});`));
|
|
@@ -43487,7 +44046,7 @@ function emitSwitchBlock2(ctx2, node, tracked2, parentVar) {
|
|
|
43487
44046
|
}`);
|
|
43488
44047
|
return null;
|
|
43489
44048
|
}
|
|
43490
|
-
function emitMap2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
44049
|
+
function emitMap2(ctx2, node, tracked2, effTarget, parentVar, skipK = 0, regionBudget) {
|
|
43491
44050
|
const arrExpr = transformTracked2(node.expression, tracked2);
|
|
43492
44051
|
const itemVar = node.itemVariable;
|
|
43493
44052
|
const anchor = ctx2.n();
|
|
@@ -43499,6 +44058,7 @@ function emitMap2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43499
44058
|
const hyd = ctx2.hydrate && !keyed;
|
|
43500
44059
|
const hydKeyed = ctx2.hydrate && keyed;
|
|
43501
44060
|
const parent = parentVar || "$root";
|
|
44061
|
+
const budget = hyd ? regionBudgetVar2(ctx2, skipK, regionBudget) : null;
|
|
43502
44062
|
const reactiveSource = isReactiveExpression2(node.expression, tracked2);
|
|
43503
44063
|
const pushEffect = (lets, effCall) => {
|
|
43504
44064
|
if (effTarget) {
|
|
@@ -43533,7 +44093,7 @@ function emitMap2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43533
44093
|
if (hydKeyed)
|
|
43534
44094
|
ctx2.rootClaim = true;
|
|
43535
44095
|
for (const n of node.bodyTemplate) {
|
|
43536
|
-
const v = emitNode2(ctx2, n, tracked2, "__e", hyd ? void 0 : "__it");
|
|
44096
|
+
const v = emitNode2(ctx2, n, tracked2, "__e", hyd ? void 0 : "__it", "__components", 0, budget || void 0);
|
|
43537
44097
|
if (v) {
|
|
43538
44098
|
if (hyd) {
|
|
43539
44099
|
ctx2.push(indent3(`if (__cl) __cl.push(${v}); else __p.insertBefore(${v}, __r);`));
|
|
@@ -43564,7 +44124,7 @@ function emitMap2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43564
44124
|
ctx2.hydrate = false;
|
|
43565
44125
|
for (const n of node.alternateNodes) {
|
|
43566
44126
|
ctx2.claimStatic = true;
|
|
43567
|
-
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? void 0 : frag);
|
|
44127
|
+
const v = emitNode2(ctx2, n, tracked2, effectsVar, hyd ? void 0 : frag, "__components", 0, budget || void 0);
|
|
43568
44128
|
if (v) {
|
|
43569
44129
|
if (hyd)
|
|
43570
44130
|
ctx2.push(indent3(`if (__cl) __cl.push(${v}); else __p.insertBefore(${v}, ${endAnchor});`));
|
|
@@ -43589,7 +44149,7 @@ function emitMap2(ctx2, node, tracked2, effTarget, parentVar) {
|
|
|
43589
44149
|
const initList = ctx2.n();
|
|
43590
44150
|
ctx2.push(`let ${reconciler} = () => {};`);
|
|
43591
44151
|
if (hydKeyed) {
|
|
43592
|
-
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcileHydrated(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e, __root) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"}, null, __root), __hydrate, ${parent}); };`);
|
|
44152
|
+
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcileHydrated(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e, __root) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"}, null, __root), __hydrate, ${parent}, ${skipK}); };`);
|
|
43593
44153
|
} else {
|
|
43594
44154
|
ctx2.push(`const ${initList} = () => { ${reconciler} = reconcile(${anchor}, ${endAnchor}, ${arrExpr}, ${keyFnSrc}, (${itemVar}, __i, __e) => ${renderItem}(${itemVar}${indexParam ? ", __i, __e" : ", __e"})); };`);
|
|
43595
44155
|
}
|
|
@@ -43695,13 +44255,14 @@ ${renderAllItems(" ", null)}
|
|
|
43695
44255
|
function computeAsyncComponents2(comps) {
|
|
43696
44256
|
return new Set(comps.filter((c) => c.isAsync).map((c) => c.name));
|
|
43697
44257
|
}
|
|
43698
|
-
function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hydrate = false, asyncComps = /* @__PURE__ */ new Set(), linkNames = /* @__PURE__ */ new Set(), selfClaimNames = /* @__PURE__ */ new Set(), alloc) {
|
|
44258
|
+
function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hydrate = false, asyncComps = /* @__PURE__ */ new Set(), linkNames = /* @__PURE__ */ new Set(), selfClaimNames = /* @__PURE__ */ new Set(), alloc, markerless = true) {
|
|
43699
44259
|
const tracked2 = collectTrackedNames2(comp.body);
|
|
43700
44260
|
const ctx2 = new Ctx2(alloc);
|
|
43701
44261
|
ctx2.importedNames = importedNames;
|
|
43702
44262
|
ctx2.linkNames = linkNames;
|
|
43703
44263
|
ctx2.selfClaimNames = selfClaimNames;
|
|
43704
44264
|
ctx2.hydrate = hydrate;
|
|
44265
|
+
ctx2.markerless = markerless;
|
|
43705
44266
|
ctx2.asyncComps = asyncComps;
|
|
43706
44267
|
ctx2.isAsyncScope = comp.isAsync || asyncComps.has(comp.name);
|
|
43707
44268
|
ctx2.push(hydrate ? ctx2.isAsyncScope ? "async (props, __registry, __hydrate) => {" : "(props, __registry, __hydrate) => {" : ctx2.isAsyncScope ? "async (props) => {" : "(props) => {");
|
|
@@ -43730,10 +44291,15 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
43730
44291
|
emitNode2(ctx2, node, tracked2, null);
|
|
43731
44292
|
}
|
|
43732
44293
|
}
|
|
44294
|
+
let topPendingSkip = 0;
|
|
44295
|
+
let topBudget = null;
|
|
44296
|
+
if (ctx2.markerless && ctx2.hydrate) {
|
|
44297
|
+
topBudget = regionBudgetVar2(ctx2, 0, void 0, `(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`);
|
|
44298
|
+
}
|
|
43733
44299
|
for (const node of comp.body) {
|
|
43734
44300
|
if (node instanceof TrackDecl)
|
|
43735
44301
|
continue;
|
|
43736
|
-
const v = emitNode2(ctx2, node, tracked2, null);
|
|
44302
|
+
const v = emitNode2(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
|
|
43737
44303
|
if (v) {
|
|
43738
44304
|
if (ctx2.hydrate) {
|
|
43739
44305
|
ctx2.push(indent3(`if ($mount === null) $mount = ${v};`));
|
|
@@ -43742,6 +44308,11 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
|
|
|
43742
44308
|
ctx2.push(indent3(`$root.appendChild(${v});`));
|
|
43743
44309
|
}
|
|
43744
44310
|
}
|
|
44311
|
+
if (claimsWalkerNode2(ctx2, node)) {
|
|
44312
|
+
topBudget = null;
|
|
44313
|
+
topPendingSkip = 0;
|
|
44314
|
+
} else
|
|
44315
|
+
topPendingSkip += ssrResidueEstimate2(node);
|
|
43745
44316
|
}
|
|
43746
44317
|
const effCode = ctx2.flushEffects();
|
|
43747
44318
|
if (effCode)
|
|
@@ -43768,7 +44339,7 @@ function buildParamInit3(paramNames) {
|
|
|
43768
44339
|
return "";
|
|
43769
44340
|
return `const { ${paramNames.join(", ")} } = props;`;
|
|
43770
44341
|
}
|
|
43771
|
-
function buildComponentMap3(irRoot, hydrate = false, alloc) {
|
|
44342
|
+
function buildComponentMap3(irRoot, hydrate = false, alloc, markerless = true) {
|
|
43772
44343
|
const mapLines = [];
|
|
43773
44344
|
mapLines.push(`const __components = {};`);
|
|
43774
44345
|
const asyncComps = computeAsyncComponents2(irRoot.components);
|
|
@@ -43792,11 +44363,12 @@ function buildComponentMap3(irRoot, hydrate = false, alloc) {
|
|
|
43792
44363
|
const directNames = /* @__PURE__ */ new Set([...extractRuntimeNames(irRoot.imports), ...localValueImportNames(irRoot.imports), ...topValueNames]);
|
|
43793
44364
|
for (const comp of irRoot.components) {
|
|
43794
44365
|
if (hydrate && isStaticComponent2(comp)) {
|
|
43795
|
-
const
|
|
44366
|
+
const claimExpr = markerless ? `__hydrate.claimOnly(undefined, (typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0))` : `__hydrate.claimOnly()`;
|
|
44367
|
+
const stub = `(props, __registry, __hydrate) => { return ${claimExpr}; }`;
|
|
43796
44368
|
mapLines.push(`__components[${JSON.stringify(comp.name)}] = ${stub};`);
|
|
43797
44369
|
continue;
|
|
43798
44370
|
}
|
|
43799
|
-
const code = generateComponent2(comp, directNames, hydrate, asyncComps, linkNames, selfClaimNames, alloc);
|
|
44371
|
+
const code = generateComponent2(comp, directNames, hydrate, asyncComps, linkNames, selfClaimNames, alloc, markerless);
|
|
43800
44372
|
mapLines.push(`__components[${JSON.stringify(comp.name)}] = ${code};`);
|
|
43801
44373
|
}
|
|
43802
44374
|
mapLines.push(`function __cleanup(start, end) {`);
|
|
@@ -43817,6 +44389,12 @@ function buildComponentMap3(irRoot, hydrate = false, alloc) {
|
|
|
43817
44389
|
mapLines.push(` const p = nodes[0].parentNode;`);
|
|
43818
44390
|
mapLines.push(` p.insertBefore(start, nodes[0]);`);
|
|
43819
44391
|
mapLines.push(` p.insertBefore(end, nodes[nodes.length - 1].nextSibling);`);
|
|
44392
|
+
mapLines.push(` // Client-surplus nodes (SSR rendered fewer items than the client data)`);
|
|
44393
|
+
mapLines.push(` // are freshly claimed and still detached \u2014 move them into the region in`);
|
|
44394
|
+
mapLines.push(` // client order before \`end\`, instead of stranding them off-parent.`);
|
|
44395
|
+
mapLines.push(` for (let i = 0; i < nodes.length; i++) {`);
|
|
44396
|
+
mapLines.push(` if (nodes[i].parentNode === null) p.insertBefore(nodes[i], end);`);
|
|
44397
|
+
mapLines.push(` }`);
|
|
43820
44398
|
mapLines.push(` return;`);
|
|
43821
44399
|
mapLines.push(` }`);
|
|
43822
44400
|
mapLines.push(` fallback.appendChild(start);`);
|
|
@@ -43875,6 +44453,25 @@ function isStaticIR2(body) {
|
|
|
43875
44453
|
}
|
|
43876
44454
|
return true;
|
|
43877
44455
|
}
|
|
44456
|
+
function claimsWalkerNode2(ctx2, node) {
|
|
44457
|
+
if (node instanceof StaticNode)
|
|
44458
|
+
return ctx2.claimStatic || !isStaticIR2(node.children);
|
|
44459
|
+
if (node instanceof ComponentCall)
|
|
44460
|
+
return true;
|
|
44461
|
+
if (node instanceof OpaqueDynamicRegion)
|
|
44462
|
+
return true;
|
|
44463
|
+
if (node instanceof MapRegion)
|
|
44464
|
+
return true;
|
|
44465
|
+
if (node instanceof ForLoop)
|
|
44466
|
+
return true;
|
|
44467
|
+
if (node instanceof WhileLoop)
|
|
44468
|
+
return true;
|
|
44469
|
+
if (node instanceof SwitchBlock)
|
|
44470
|
+
return true;
|
|
44471
|
+
if (node instanceof TryCatch)
|
|
44472
|
+
return true;
|
|
44473
|
+
return false;
|
|
44474
|
+
}
|
|
43878
44475
|
function isStaticComponent2(comp) {
|
|
43879
44476
|
if (comp.style)
|
|
43880
44477
|
return false;
|
|
@@ -44049,7 +44646,7 @@ function emitClientFromIR2(ir, options) {
|
|
|
44049
44646
|
if (!options.forceClient && !needsClient) {
|
|
44050
44647
|
return "";
|
|
44051
44648
|
}
|
|
44052
|
-
const componentMapCode = buildComponentMap3(ir, options.hydrate, options.nameAllocator);
|
|
44649
|
+
const componentMapCode = buildComponentMap3(ir, options.hydrate, options.nameAllocator, options.markerless !== false);
|
|
44053
44650
|
const importLines = ir.imports.length > 0 ? ir.imports.join("\n") + "\n" : "";
|
|
44054
44651
|
const topCode = (options.includeTopLevel === false ? [] : transformTopLevelForActions(ir.topLevelCode, "client")).join("\n") + "\n";
|
|
44055
44652
|
const exportLines = [];
|
|
@@ -44135,7 +44732,7 @@ function compileClientBoth2(source, _componentName, sourcePath2, opts) {
|
|
|
44135
44732
|
return { comp, hyd: "", name };
|
|
44136
44733
|
return {
|
|
44137
44734
|
comp,
|
|
44138
|
-
hyd: emitClientFromIR2(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc }),
|
|
44735
|
+
hyd: emitClientFromIR2(irHyd, { forceClient: true, hydrate: true, includeTopLevel: false, nameAllocator: alloc, markerless: opts?.markerless !== false }),
|
|
44139
44736
|
name
|
|
44140
44737
|
};
|
|
44141
44738
|
}
|
|
@@ -45276,9 +45873,10 @@ function guessProjectRoots2(dir) {
|
|
|
45276
45873
|
}
|
|
45277
45874
|
|
|
45278
45875
|
// ../adapter/dist/client-bundle.js
|
|
45279
|
-
import { readFileSync as readFileSync24, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2 } from "node:fs";
|
|
45876
|
+
import { readFileSync as readFileSync24, existsSync as existsSync28, writeFileSync as writeFileSync13, unlinkSync as unlinkSync4, statSync as statSync14, rmSync as rmSync4, mkdtempSync as mkdtempSync2, mkdirSync as mkdirSync12 } from "node:fs";
|
|
45280
45877
|
import { resolve as resolve24, join as join18, dirname as dirname18, relative as relative6, sep as sep3 } from "node:path";
|
|
45281
45878
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
45879
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
45282
45880
|
|
|
45283
45881
|
// ../adapter/dist/esbuild-fallback.js
|
|
45284
45882
|
var _nativeBuild2 = null;
|
|
@@ -46145,7 +46743,19 @@ function runtimeExportNames2(runtimeDir) {
|
|
|
46145
46743
|
return names;
|
|
46146
46744
|
}
|
|
46147
46745
|
var RUNTIME_ENTRY2 = ".runtime-tree-entry.mjs";
|
|
46148
|
-
|
|
46746
|
+
function esbuildPath2(p) {
|
|
46747
|
+
return sep3 === "/" ? p : p.split(sep3).join("/");
|
|
46748
|
+
}
|
|
46749
|
+
function runtimeTreeShakeEntry2() {
|
|
46750
|
+
return join18(tmpdir2(), "vesk-runtime-tree-shake", RUNTIME_ENTRY2);
|
|
46751
|
+
}
|
|
46752
|
+
var treeShakeQueue2 = Promise.resolve();
|
|
46753
|
+
function buildTreeShakenRuntime2(runtimeDir, usedNames) {
|
|
46754
|
+
const run = treeShakeQueue2.then(() => buildTreeShakenRuntimeNow2(runtimeDir, usedNames));
|
|
46755
|
+
treeShakeQueue2 = run.catch(() => void 0);
|
|
46756
|
+
return run;
|
|
46757
|
+
}
|
|
46758
|
+
async function buildTreeShakenRuntimeNow2(runtimeDir, usedNames) {
|
|
46149
46759
|
const unique = [...new Set(usedNames)];
|
|
46150
46760
|
const available = runtimeExportNames2(runtimeDir);
|
|
46151
46761
|
const missing = unique.filter((n) => !available.has(n));
|
|
@@ -46153,16 +46763,21 @@ async function buildTreeShakenRuntime2(runtimeDir, usedNames) {
|
|
|
46153
46763
|
console.error(`vesk: runtime names not exported \u2014 ${missing.join(", ")}; falling back to full runtime`);
|
|
46154
46764
|
return buildRuntimeCode2(runtimeDir);
|
|
46155
46765
|
}
|
|
46156
|
-
const entry =
|
|
46766
|
+
const entry = runtimeTreeShakeEntry2();
|
|
46767
|
+
const indexClient = esbuildPath2(join18(runtimeDir, "index-client.js"));
|
|
46157
46768
|
try {
|
|
46769
|
+
try {
|
|
46770
|
+
mkdirSync12(dirname18(entry), { recursive: true });
|
|
46771
|
+
} catch {
|
|
46772
|
+
}
|
|
46158
46773
|
try {
|
|
46159
46774
|
rmSync4(entry);
|
|
46160
46775
|
} catch {
|
|
46161
46776
|
}
|
|
46162
|
-
writeFileSync13(entry, `export { ${unique.join(", ")} } from
|
|
46777
|
+
writeFileSync13(entry, `export { ${unique.join(", ")} } from ${JSON.stringify(indexClient)};
|
|
46163
46778
|
`);
|
|
46164
46779
|
const result = await build3({
|
|
46165
|
-
entryPoints: [entry],
|
|
46780
|
+
entryPoints: [esbuildPath2(entry)],
|
|
46166
46781
|
bundle: true,
|
|
46167
46782
|
format: "iife",
|
|
46168
46783
|
globalName: "__veskRuntime",
|
|
@@ -46219,7 +46834,7 @@ async function buildMainBundle2(routeTree, runtimeDir, codeSplit, mono, hmr, imp
|
|
|
46219
46834
|
|
|
46220
46835
|
` : runtimeCode + "\n";
|
|
46221
46836
|
const cleanupFn = "function __cleanup(start, end) {\n let n = start.nextSibling;\n while (n && n !== end) {\n const next = n.nextSibling;\n n.remove();\n n = next;\n }\n}\n";
|
|
46222
|
-
const placeFn = "function __place(start, end, nodes, fallback) {\n if (start.parentNode !== null) {\n const p = start.parentNode;\n for (let i = 0; i < nodes.length; i++) p.insertBefore(nodes[i], end);\n return;\n }\n if (nodes.length > 0 && nodes[0].parentNode) {\n const p = nodes[0].parentNode;\n p.insertBefore(start, nodes[0]);\n p.insertBefore(end, nodes[nodes.length - 1].nextSibling);\n return;\n }\n fallback.appendChild(start);\n fallback.appendChild(end);\n for (let i = 0; i < nodes.length; i++) fallback.insertBefore(nodes[i], end);\n}\n";
|
|
46837
|
+
const placeFn = "function __place(start, end, nodes, fallback) {\n if (start.parentNode !== null) {\n const p = start.parentNode;\n for (let i = 0; i < nodes.length; i++) p.insertBefore(nodes[i], end);\n return;\n }\n if (nodes.length > 0 && nodes[0].parentNode) {\n const p = nodes[0].parentNode;\n p.insertBefore(start, nodes[0]);\n p.insertBefore(end, nodes[nodes.length - 1].nextSibling);\n // Client-surplus nodes (SSR rendered fewer items than the client data)\n // are freshly claimed and still detached \u2014 move them into the region in\n // client order before `end`, instead of stranding them off-parent.\n for (let i = 0; i < nodes.length; i++) {\n if (nodes[i].parentNode === null) p.insertBefore(nodes[i], end);\n }\n return;\n }\n fallback.appendChild(start);\n fallback.appendChild(end);\n for (let i = 0; i < nodes.length; i++) fallback.insertBefore(nodes[i], end);\n}\n";
|
|
46223
46838
|
const updateComponentsFn = "function __updateComponents(nodes) {\n for (const n of nodes) {\n if (n._pageName && __components[n._pageName]) n.page = __components[n._pageName];\n if (n._layoutName && __components[n._layoutName]) n.layout = __components[n._layoutName];\n if (n._errorName && __components[n._errorName]) n.error = __components[n._errorName];\n if (n._notFoundName && __components[n._notFoundName]) n.notFound = __components[n._notFoundName];\n if (n._offlineName && __components[n._offlineName]) n.offline = __components[n._offlineName];\n if (n._networkName && __components[n._networkName]) n.network = __components[n._networkName];\n if (n.children) __updateComponents(n.children);\n }\n}\n";
|
|
46224
46839
|
const routeTreeJson = JSON.stringify(routeTree);
|
|
46225
46840
|
if (codeSplit) {
|
|
@@ -46387,7 +47002,7 @@ import { resolve as resolve28 } from "node:path";
|
|
|
46387
47002
|
|
|
46388
47003
|
// ../adapter/dist/plugins.js
|
|
46389
47004
|
init_paths();
|
|
46390
|
-
import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as
|
|
47005
|
+
import { readFileSync as readFileSync26, writeFileSync as writeFileSync14, existsSync as existsSync30, mkdirSync as mkdirSync13, statSync as statSync16 } from "node:fs";
|
|
46391
47006
|
import { resolve as resolve26, dirname as dirname19, join as join19, extname as extname7, basename as basename5 } from "node:path";
|
|
46392
47007
|
import { createRequire as createRequire5 } from "node:module";
|
|
46393
47008
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -46431,7 +47046,7 @@ function writePluginState2(veskDir, state) {
|
|
|
46431
47046
|
const file = stateFilePath2(veskDir);
|
|
46432
47047
|
const dir = dirname19(file);
|
|
46433
47048
|
if (!existsSync30(dir))
|
|
46434
|
-
|
|
47049
|
+
mkdirSync13(dir, { recursive: true });
|
|
46435
47050
|
writeFileSync14(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
46436
47051
|
}
|
|
46437
47052
|
function resolvePackage2(appDir, pkg) {
|
|
@@ -47363,8 +47978,8 @@ var __internals2 = {
|
|
|
47363
47978
|
};
|
|
47364
47979
|
|
|
47365
47980
|
// ../adapter/dist/dev-config.js
|
|
47366
|
-
import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as
|
|
47367
|
-
import { tmpdir } from "node:os";
|
|
47981
|
+
import { existsSync as existsSync31, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync3, rmSync as rmSync5 } from "node:fs";
|
|
47982
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
47368
47983
|
import { resolve as resolve27, dirname as dirname20, join as join20 } from "node:path";
|
|
47369
47984
|
init_parser();
|
|
47370
47985
|
function findConfigFile2(projectDir) {
|
|
@@ -47393,8 +48008,8 @@ async function parseConfigSource(source, isTs, projectDir) {
|
|
|
47393
48008
|
js = `const { defineConfig, definePlugin, preset } = globalThis.__vesk_inject;
|
|
47394
48009
|
` + js;
|
|
47395
48010
|
}
|
|
47396
|
-
const base = projectDir ? (
|
|
47397
|
-
const dir = base ? mkdtempSync3(join20(base, "cfg-")) : mkdtempSync3(join20(
|
|
48011
|
+
const base = projectDir ? (mkdirSync14(join20(projectDir, ".vesk"), { recursive: true }), join20(projectDir, ".vesk")) : void 0;
|
|
48012
|
+
const dir = base ? mkdtempSync3(join20(base, "cfg-")) : mkdtempSync3(join20(tmpdir3(), "vesk-cfg-"));
|
|
47398
48013
|
const tmpFile = join20(dir, "config.mjs");
|
|
47399
48014
|
try {
|
|
47400
48015
|
writeFileSync15(tmpFile, js, "utf-8");
|
|
@@ -47430,7 +48045,7 @@ async function writeConfigSource2(projectDir, source) {
|
|
|
47430
48045
|
const { path, isTs } = findConfigFile2(projectDir);
|
|
47431
48046
|
const target = path || resolve27(projectDir, "vesk.config.ts");
|
|
47432
48047
|
await parseConfigSource(source, isTs, projectDir);
|
|
47433
|
-
|
|
48048
|
+
mkdirSync14(dirname20(target), { recursive: true });
|
|
47434
48049
|
writeFileSync15(target, source, "utf-8");
|
|
47435
48050
|
const config = await parseConfigSource(source, isTs, projectDir);
|
|
47436
48051
|
return { path: target, exists: true, source, config };
|
|
@@ -48704,7 +49319,7 @@ function produceDiagnostics(input) {
|
|
|
48704
49319
|
}
|
|
48705
49320
|
|
|
48706
49321
|
// ../agentic/dist/checkpoints.js
|
|
48707
|
-
import { existsSync as existsSync33, mkdirSync as
|
|
49322
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync15, readFileSync as readFileSync29, writeFileSync as writeFileSync16, statSync as statSync18, unlinkSync as unlinkSync5, rmSync as rmSync6, renameSync } from "node:fs";
|
|
48708
49323
|
import { join as join21, resolve as resolve29, dirname as dirname21, sep as sep5 } from "node:path";
|
|
48709
49324
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
48710
49325
|
function generateId() {
|
|
@@ -48850,7 +49465,7 @@ function getCheckpointPath(projectDir, id) {
|
|
|
48850
49465
|
return join21(getCheckpointDir(projectDir, id), "checkpoint.json");
|
|
48851
49466
|
}
|
|
48852
49467
|
function ensureDir(dir) {
|
|
48853
|
-
|
|
49468
|
+
mkdirSync15(dir, { recursive: true });
|
|
48854
49469
|
}
|
|
48855
49470
|
function readJson(filePath, fallback) {
|
|
48856
49471
|
try {
|
|
@@ -48976,7 +49591,7 @@ function rollback(projectDir, id) {
|
|
|
48976
49591
|
}
|
|
48977
49592
|
|
|
48978
49593
|
// ../agentic/dist/config.js
|
|
48979
|
-
import { readFileSync as readFileSync30, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as
|
|
49594
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync17, existsSync as existsSync34, mkdirSync as mkdirSync16, chmodSync } from "node:fs";
|
|
48980
49595
|
import { resolve as resolve30, dirname as dirname22 } from "node:path";
|
|
48981
49596
|
var DEFAULT_CONFIG = {
|
|
48982
49597
|
provider: "openai",
|
|
@@ -49106,7 +49721,7 @@ function saveAgenticConfig(projectDir, patch) {
|
|
|
49106
49721
|
if (next.baseUrl)
|
|
49107
49722
|
toWrite.baseUrl = next.baseUrl;
|
|
49108
49723
|
try {
|
|
49109
|
-
|
|
49724
|
+
mkdirSync16(dirname22(p), { recursive: true });
|
|
49110
49725
|
writeFileSync17(p, JSON.stringify(toWrite, null, 2), "utf-8");
|
|
49111
49726
|
} catch {
|
|
49112
49727
|
}
|
|
@@ -50431,7 +51046,7 @@ var Agent = class {
|
|
|
50431
51046
|
};
|
|
50432
51047
|
|
|
50433
51048
|
// ../agentic/dist/tools/vesk.js
|
|
50434
|
-
import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as
|
|
51049
|
+
import { existsSync as existsSync36, readFileSync as readFileSync32, writeFileSync as writeFileSync18, mkdirSync as mkdirSync17, readdirSync as readdirSync10, statSync as statSync19 } from "node:fs";
|
|
50435
51050
|
import { resolve as resolve32, join as join22, dirname as dirname23, sep as sep6 } from "node:path";
|
|
50436
51051
|
function resolveWithin3(baseDir, relPath) {
|
|
50437
51052
|
const base = resolve32(baseDir);
|
|
@@ -50465,7 +51080,7 @@ function readPluginState3(veskDir) {
|
|
|
50465
51080
|
}
|
|
50466
51081
|
function writePluginState3(veskDir, state) {
|
|
50467
51082
|
const file = stateFilePath3(veskDir);
|
|
50468
|
-
|
|
51083
|
+
mkdirSync17(dirname23(file), { recursive: true });
|
|
50469
51084
|
writeFileSync18(file, JSON.stringify(state, null, 2) + "\n", "utf-8");
|
|
50470
51085
|
}
|
|
50471
51086
|
function eqIgnoreCase3(a, b) {
|
|
@@ -50825,7 +51440,7 @@ function createVeskTools(deps) {
|
|
|
50825
51440
|
if (!contained)
|
|
50826
51441
|
return jsonError("path escapes project root");
|
|
50827
51442
|
}
|
|
50828
|
-
|
|
51443
|
+
mkdirSync17(dirname23(target), { recursive: true });
|
|
50829
51444
|
writeFileSync18(target, source, "utf-8");
|
|
50830
51445
|
return jsonOk({ ok: true, path: target, source });
|
|
50831
51446
|
}
|
|
@@ -51107,7 +51722,7 @@ function createVeskTools(deps) {
|
|
|
51107
51722
|
} catch {
|
|
51108
51723
|
}
|
|
51109
51724
|
const dir = checkpointDir(veskDir);
|
|
51110
|
-
|
|
51725
|
+
mkdirSync17(dir, { recursive: true });
|
|
51111
51726
|
const id = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
51112
51727
|
const file = join22(dir, `${id}.json`);
|
|
51113
51728
|
const check = resolveWithin3(dir, `${id}.json`);
|
|
@@ -51879,7 +52494,7 @@ function renderDevErrorPage(payload, opts) {
|
|
|
51879
52494
|
|
|
51880
52495
|
// src/build-packages.ts
|
|
51881
52496
|
import { spawnSync } from "node:child_process";
|
|
51882
|
-
import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as
|
|
52497
|
+
import { cpSync as cpSync2, existsSync as existsSync40, mkdirSync as mkdirSync18, readFileSync as readFileSync36, readdirSync as readdirSync11, statSync as statSync20, writeFileSync as writeFileSync20 } from "node:fs";
|
|
51883
52498
|
import { createRequire as createRequire6 } from "node:module";
|
|
51884
52499
|
import { dirname as dirname25, join as join23, resolve as resolve36 } from "node:path";
|
|
51885
52500
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
@@ -51962,7 +52577,7 @@ function buildPackages(force = false) {
|
|
|
51962
52577
|
const distDir = join23(pkgDir, "dist");
|
|
51963
52578
|
for (const c of cfg.copy || []) {
|
|
51964
52579
|
const to = join23(distDir, c.to);
|
|
51965
|
-
|
|
52580
|
+
mkdirSync18(dirname25(to), { recursive: true });
|
|
51966
52581
|
cpSync2(join23(pkgDir, c.from), to, { recursive: true });
|
|
51967
52582
|
}
|
|
51968
52583
|
const srcPkg = JSON.parse(readFileSync36(join23(pkgDir, "package.json"), "utf-8"));
|
|
@@ -52611,7 +53226,11 @@ var HMR_CONFIG_NAMES = /* @__PURE__ */ new Set([
|
|
|
52611
53226
|
"tsconfig.json",
|
|
52612
53227
|
"package.json"
|
|
52613
53228
|
]);
|
|
52614
|
-
function
|
|
53229
|
+
function normalizeWatchPath(relPath) {
|
|
53230
|
+
return relPath.includes("\\") ? relPath.split("\\").join("/") : relPath;
|
|
53231
|
+
}
|
|
53232
|
+
function classifyHmrWatchPath(relPathRaw) {
|
|
53233
|
+
const relPath = normalizeWatchPath(relPathRaw);
|
|
52615
53234
|
const first = relPath.split("/")[0];
|
|
52616
53235
|
if (HMR_SKIP_DIRS.has(first) || HMR_SKIP_MARKERS.some((m) => relPath.includes(m))) return "ignored";
|
|
52617
53236
|
const name = relPath.slice(relPath.lastIndexOf("/") + 1);
|
|
@@ -52622,8 +53241,9 @@ function classifyHmrWatchPath(relPath) {
|
|
|
52622
53241
|
if (HMR_SCRIPT_EXTS.some((ext) => relPath.endsWith(ext))) return "script";
|
|
52623
53242
|
return "ignored";
|
|
52624
53243
|
}
|
|
52625
|
-
function shouldRescanRoutes(
|
|
53244
|
+
function shouldRescanRoutes(relPathRaw, eventType) {
|
|
52626
53245
|
if (eventType === "rename") return true;
|
|
53246
|
+
const relPath = normalizeWatchPath(relPathRaw);
|
|
52627
53247
|
const name = relPath.slice(relPath.lastIndexOf("/") + 1);
|
|
52628
53248
|
return relPath.endsWith(".vsk") && ROUTE_STRUCTURAL_VSK.has(name);
|
|
52629
53249
|
}
|
|
@@ -54432,7 +55052,7 @@ if (cmd === "init") {
|
|
|
54432
55052
|
console.error(`vesk init: ${target} already exists \u2014 skipping`);
|
|
54433
55053
|
process.exit(0);
|
|
54434
55054
|
}
|
|
54435
|
-
|
|
55055
|
+
mkdirSync20(appDirPath, { recursive: true });
|
|
54436
55056
|
writeFileSync21(target, [
|
|
54437
55057
|
`@import 'tailwindcss';`,
|
|
54438
55058
|
``,
|