sibujs 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +309 -129
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +184 -72
- package/dist/build.js +15 -16
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/chunk-3ISI6ACU.js +44 -0
- package/dist/{chunk-ONOHFDLG.js → chunk-47M47FOM.js} +3 -3
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-KKLW7YWL.js → chunk-5MT6SJ3P.js} +275 -144
- package/dist/{chunk-UGRX3S57.js → chunk-5Q4R7HCL.js} +12 -3
- package/dist/{chunk-S373NSMK.js → chunk-7GQCWFOE.js} +150 -59
- package/dist/{chunk-FTIR4QW2.js → chunk-7NCARGJW.js} +6 -8
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/{chunk-VZKNK2V7.js → chunk-AIF3Z2T7.js} +296 -38
- package/dist/{chunk-4PMLNECI.js → chunk-BAAG6ZTI.js} +98 -29
- package/dist/{chunk-XZZOBQAY.js → chunk-D33YTSX5.js} +2 -2
- package/dist/{chunk-TBYTO6BS.js → chunk-DKGBBKOF.js} +136 -80
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/{chunk-GW3SCCZG.js → chunk-HYXDKS4N.js} +153 -110
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-PCT43HW3.js → chunk-JSXPZCET.js} +1 -1
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RJE2BNI4.js → chunk-ORMZXBKQ.js} +108 -45
- package/dist/{chunk-OMJJM3KM.js → chunk-OXUY2A6L.js} +287 -130
- package/dist/{chunk-3JZ4L5TJ.js → chunk-PK6FK2G2.js} +181 -66
- package/dist/{chunk-RBTPLM32.js → chunk-QE4TTDU3.js} +2 -2
- package/dist/{chunk-2DCGACUU.js → chunk-SXXVZMKZ.js} +251 -66
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-7LN645I6.js → chunk-UZQ6ALFS.js} +3 -3
- package/dist/{chunk-KEISJXBU.js → chunk-VVWPJ543.js} +6 -8
- package/dist/{chunk-RIXRAYIU.js → chunk-XC4MEKGA.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-XRRZKZYX.js} +55 -31
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-DRIuclVT.d.cts} +10 -2
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-DRIuclVT.d.ts} +10 -2
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +213 -117
- package/dist/data.d.cts +47 -9
- package/dist/data.d.ts +47 -9
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +81 -57
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +309 -104
- package/dist/ecosystem.d.cts +19 -3
- package/dist/ecosystem.d.ts +19 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2133 -863
- package/dist/extras.d.cts +10 -9
- package/dist/extras.d.ts +10 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +184 -72
- package/dist/index.d.cts +22 -5
- package/dist/index.d.ts +22 -5
- package/dist/index.js +24 -27
- package/dist/motion.cjs +107 -41
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +317 -39
- package/dist/patterns.d.cts +27 -9
- package/dist/patterns.d.ts +27 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +308 -216
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +549 -202
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +35 -23
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +176 -72
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/{tagFactory-DVoDpHye.d.ts → tagFactory-DFstCLQV.d.cts} +2 -100
- package/dist/{tagFactory-DVoDpHye.d.cts → tagFactory-DkaNVUNV.d.ts} +2 -100
- package/dist/testing.cjs +2484 -2185
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/ui.cjs +707 -317
- package/dist/ui.d.cts +40 -7
- package/dist/ui.d.ts +40 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +246 -278
- package/dist/widgets.js +9 -10
- package/package.json +1 -1
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
package/dist/ssr.cjs
CHANGED
|
@@ -186,6 +186,23 @@ function reportDrainRunaway(label2, executed, remaining) {
|
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
var activeBindingCount = 0;
|
|
189
|
+
function resolveCapture(capture) {
|
|
190
|
+
let frame = capture;
|
|
191
|
+
while (frame?.closed) frame = frame.forwardTo;
|
|
192
|
+
return frame ?? null;
|
|
193
|
+
}
|
|
194
|
+
var registrationCaptures = [];
|
|
195
|
+
function currentDisposerCapture() {
|
|
196
|
+
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
197
|
+
}
|
|
198
|
+
function beginDisposerCapture(capture) {
|
|
199
|
+
if (capture === null && registrationCaptures.length === 0) return false;
|
|
200
|
+
registrationCaptures.push(resolveCapture(capture));
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
function endDisposerCapture() {
|
|
204
|
+
registrationCaptures.pop();
|
|
205
|
+
}
|
|
189
206
|
function registerDisposer(node, teardown) {
|
|
190
207
|
let disposers = elementDisposers.get(node);
|
|
191
208
|
if (!disposers) {
|
|
@@ -194,6 +211,8 @@ function registerDisposer(node, teardown) {
|
|
|
194
211
|
}
|
|
195
212
|
disposers.push(teardown);
|
|
196
213
|
if (DEV) activeBindingCount++;
|
|
214
|
+
const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
215
|
+
if (capture) capture.entries.push([node, teardown]);
|
|
197
216
|
}
|
|
198
217
|
function dispose(node) {
|
|
199
218
|
const stack = [node];
|
|
@@ -207,33 +226,34 @@ function dispose(node) {
|
|
|
207
226
|
}
|
|
208
227
|
}
|
|
209
228
|
for (let i2 = order.length - 1; i2 >= 0; i2--) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
229
|
+
disposeNodeOwn(order[i2]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function disposeNodeOwn(node) {
|
|
233
|
+
if (!elementDisposers.has(node)) return;
|
|
234
|
+
let executed = 0;
|
|
235
|
+
let runaway = false;
|
|
236
|
+
while (!runaway) {
|
|
237
|
+
const pending = elementDisposers.get(node);
|
|
238
|
+
if (!pending || pending.length === 0) break;
|
|
239
|
+
const snapshot = pending.slice();
|
|
240
|
+
elementDisposers.delete(node);
|
|
241
|
+
if (DEV) activeBindingCount -= snapshot.length;
|
|
242
|
+
for (let i2 = 0; i2 < snapshot.length; i2++) {
|
|
243
|
+
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
244
|
+
const rest = snapshot.slice(i2);
|
|
245
|
+
const added = elementDisposers.get(node);
|
|
246
|
+
elementDisposers.set(node, added ? rest.concat(added) : rest);
|
|
247
|
+
if (DEV) activeBindingCount += rest.length;
|
|
248
|
+
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
249
|
+
runaway = true;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
executed++;
|
|
253
|
+
try {
|
|
254
|
+
snapshot[i2]();
|
|
255
|
+
} catch (err) {
|
|
256
|
+
reportError(err, { phase: "cleanup", name: "disposer" });
|
|
237
257
|
}
|
|
238
258
|
}
|
|
239
259
|
}
|
|
@@ -938,7 +958,7 @@ function renderToDocument(component, options = {}) {
|
|
|
938
958
|
<head>
|
|
939
959
|
<meta charset="UTF-8" />
|
|
940
960
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
941
|
-
${options.title ? `<title>${escapeHtml(options.title)}</title>` : ""}
|
|
961
|
+
${options.title != null ? `<title>${escapeHtml(options.title)}</title>` : ""}
|
|
942
962
|
${metaTags}
|
|
943
963
|
${linkTags}
|
|
944
964
|
${options.headExtra || ""}
|
|
@@ -1113,16 +1133,32 @@ function ssrSuspense(props) {
|
|
|
1113
1133
|
const timeoutPromise = new Promise((_, reject) => {
|
|
1114
1134
|
timer = setTimeout(() => reject(new Error(`[SibuJS SSR] ssrSuspense timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
1115
1135
|
});
|
|
1116
|
-
|
|
1136
|
+
let contentPromise;
|
|
1137
|
+
try {
|
|
1138
|
+
contentPromise = Promise.resolve(props.content());
|
|
1139
|
+
} catch (err) {
|
|
1140
|
+
contentPromise = Promise.reject(err);
|
|
1141
|
+
}
|
|
1142
|
+
const toFallback = (err) => {
|
|
1143
|
+
if (DEV) console.warn("[SibuJS SSR] ssrSuspense rejected:", err);
|
|
1144
|
+
return { id, html: fallbackHtml };
|
|
1145
|
+
};
|
|
1146
|
+
const clearTimer = () => {
|
|
1147
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
1148
|
+
};
|
|
1149
|
+
const raced = Promise.race([contentPromise, timeoutPromise]);
|
|
1117
1150
|
const promise = raced.then(
|
|
1118
1151
|
(resolvedEl) => {
|
|
1119
|
-
|
|
1120
|
-
|
|
1152
|
+
clearTimer();
|
|
1153
|
+
try {
|
|
1154
|
+
return { id, html: renderToString(resolvedEl) };
|
|
1155
|
+
} catch (err) {
|
|
1156
|
+
return toFallback(err);
|
|
1157
|
+
}
|
|
1121
1158
|
},
|
|
1122
1159
|
(err) => {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
return { id, html: fallbackHtml };
|
|
1160
|
+
clearTimer();
|
|
1161
|
+
return toFallback(err);
|
|
1126
1162
|
}
|
|
1127
1163
|
);
|
|
1128
1164
|
promise.catch(noop);
|
|
@@ -1343,6 +1379,7 @@ function retrack(effectFn, subscriber) {
|
|
|
1343
1379
|
}
|
|
1344
1380
|
currentSubscriber = subscriber;
|
|
1345
1381
|
const sub2 = subscriber;
|
|
1382
|
+
if (sub2._cap === void 0) sub2._cap = currentDisposerCapture();
|
|
1346
1383
|
const epoch = ++subscriberEpochCounter;
|
|
1347
1384
|
sub2._epoch = epoch;
|
|
1348
1385
|
sub2._structDirty = false;
|
|
@@ -1534,7 +1571,12 @@ function drainQueue() {
|
|
|
1534
1571
|
quarantined.add(sub2);
|
|
1535
1572
|
continue;
|
|
1536
1573
|
}
|
|
1537
|
-
|
|
1574
|
+
const pushed = beginDisposerCapture(sub2._cap ?? null);
|
|
1575
|
+
try {
|
|
1576
|
+
safeInvoke(sub2);
|
|
1577
|
+
} finally {
|
|
1578
|
+
if (pushed) endDisposerCapture();
|
|
1579
|
+
}
|
|
1538
1580
|
}
|
|
1539
1581
|
}
|
|
1540
1582
|
function drainNotificationQueue() {
|
|
@@ -1670,7 +1712,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1670
1712
|
}
|
|
1671
1713
|
|
|
1672
1714
|
// src/reactivity/track.ts
|
|
1673
|
-
var _runtimeVersion = true ? "4.
|
|
1715
|
+
var _runtimeVersion = true ? "4.6.0" : "dev";
|
|
1674
1716
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1675
1717
|
function resolveReactiveApi() {
|
|
1676
1718
|
const g2 = globalThis;
|
|
@@ -2036,7 +2078,7 @@ function Head(props) {
|
|
|
2036
2078
|
};
|
|
2037
2079
|
const apply = () => {
|
|
2038
2080
|
cleanup3();
|
|
2039
|
-
if (props.title) {
|
|
2081
|
+
if (props.title != null) {
|
|
2040
2082
|
if (typeof props.title === "function") {
|
|
2041
2083
|
const getter = props.title;
|
|
2042
2084
|
let lease = null;
|
|
@@ -2091,13 +2133,14 @@ function Head(props) {
|
|
|
2091
2133
|
return anchor;
|
|
2092
2134
|
}
|
|
2093
2135
|
function setStructuredData(data2) {
|
|
2094
|
-
const
|
|
2095
|
-
if (existing) existing.remove();
|
|
2136
|
+
const json = escapeScriptJsonLocal(JSON.stringify(data2));
|
|
2096
2137
|
const script2 = document.createElement("script");
|
|
2097
2138
|
script2.type = "application/ld+json";
|
|
2098
2139
|
script2.setAttribute("data-sibu", "true");
|
|
2099
|
-
script2.textContent =
|
|
2100
|
-
document.head.
|
|
2140
|
+
script2.textContent = json;
|
|
2141
|
+
const existing = document.head.querySelector('script[type="application/ld+json"][data-sibu]');
|
|
2142
|
+
if (existing) existing.replaceWith(script2);
|
|
2143
|
+
else document.head.appendChild(script2);
|
|
2101
2144
|
}
|
|
2102
2145
|
function setCanonical(url) {
|
|
2103
2146
|
let link2 = document.head.querySelector('link[rel="canonical"]');
|
|
@@ -2254,15 +2297,31 @@ function signal(initial, options) {
|
|
|
2254
2297
|
// src/platform/incrementalRegeneration.ts
|
|
2255
2298
|
function createISR(options) {
|
|
2256
2299
|
const { revalidateAfter, fetcher, initialData } = options;
|
|
2300
|
+
if (!Number.isFinite(revalidateAfter) || revalidateAfter <= 0) {
|
|
2301
|
+
throw new RangeError(`[SibuJS ISR] revalidateAfter must be a positive finite number, got ${revalidateAfter}`);
|
|
2302
|
+
}
|
|
2257
2303
|
const [data2, setData] = signal(initialData);
|
|
2258
|
-
const [
|
|
2304
|
+
const [stale, setStale] = signal(initialData === void 0);
|
|
2259
2305
|
const controller = new AbortController();
|
|
2260
2306
|
let inFlight = false;
|
|
2261
2307
|
let disposed = false;
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2308
|
+
let deadline;
|
|
2309
|
+
const clearDeadline = () => {
|
|
2310
|
+
if (deadline !== void 0) {
|
|
2311
|
+
clearTimeout(deadline);
|
|
2312
|
+
deadline = void 0;
|
|
2313
|
+
}
|
|
2314
|
+
};
|
|
2315
|
+
const armDeadline = () => {
|
|
2316
|
+
clearDeadline();
|
|
2317
|
+
deadline = setTimeout(() => {
|
|
2318
|
+
deadline = void 0;
|
|
2319
|
+
if (disposed) return;
|
|
2320
|
+
setStale(true);
|
|
2321
|
+
revalidate().catch((err) => {
|
|
2322
|
+
if (typeof console !== "undefined") console.warn("[SibuJS ISR] revalidate failed", err);
|
|
2323
|
+
});
|
|
2324
|
+
}, revalidateAfter);
|
|
2266
2325
|
};
|
|
2267
2326
|
const revalidate = async () => {
|
|
2268
2327
|
if (disposed || inFlight) return;
|
|
@@ -2271,8 +2330,14 @@ function createISR(options) {
|
|
|
2271
2330
|
try {
|
|
2272
2331
|
const result = await fetcher({ signal: controller.signal });
|
|
2273
2332
|
if (disposed || controller.signal.aborted) return;
|
|
2274
|
-
|
|
2275
|
-
|
|
2333
|
+
batch(() => {
|
|
2334
|
+
setData(result);
|
|
2335
|
+
setStale(false);
|
|
2336
|
+
});
|
|
2337
|
+
armDeadline();
|
|
2338
|
+
} catch (err) {
|
|
2339
|
+
if (!disposed && !controller.signal.aborted) armDeadline();
|
|
2340
|
+
throw err;
|
|
2276
2341
|
} finally {
|
|
2277
2342
|
inFlight = false;
|
|
2278
2343
|
}
|
|
@@ -2281,19 +2346,16 @@ function createISR(options) {
|
|
|
2281
2346
|
revalidate().catch((err) => {
|
|
2282
2347
|
if (typeof console !== "undefined") console.warn("[SibuJS ISR] initial fetch failed", err);
|
|
2283
2348
|
});
|
|
2349
|
+
} else {
|
|
2350
|
+
armDeadline();
|
|
2284
2351
|
}
|
|
2285
|
-
const intervalId = setInterval(() => {
|
|
2286
|
-
revalidate().catch((err) => {
|
|
2287
|
-
if (typeof console !== "undefined") console.warn("[SibuJS ISR] revalidate failed", err);
|
|
2288
|
-
});
|
|
2289
|
-
}, revalidateAfter);
|
|
2290
2352
|
const dispose2 = () => {
|
|
2291
2353
|
if (disposed) return;
|
|
2292
2354
|
disposed = true;
|
|
2293
|
-
|
|
2355
|
+
clearDeadline();
|
|
2294
2356
|
controller.abort();
|
|
2295
2357
|
};
|
|
2296
|
-
return { data: data2, isStale, revalidate, dispose: dispose2 };
|
|
2358
|
+
return { data: data2, isStale: stale, revalidate, dispose: dispose2 };
|
|
2297
2359
|
}
|
|
2298
2360
|
|
|
2299
2361
|
// src/platform/routeActions.ts
|
|
@@ -3203,13 +3265,13 @@ function createSharedScope(initialState) {
|
|
|
3203
3265
|
for (const key of Object.keys(initialState)) {
|
|
3204
3266
|
const [get2, set2] = signal(initialState[key]);
|
|
3205
3267
|
signals.set(key, { get: get2, set: set2 });
|
|
3206
|
-
subscribers.set(key, /* @__PURE__ */ new
|
|
3268
|
+
subscribers.set(key, /* @__PURE__ */ new Map());
|
|
3207
3269
|
}
|
|
3208
3270
|
function ensureSignal(key) {
|
|
3209
3271
|
if (!signals.has(key)) {
|
|
3210
3272
|
const [get2, set2] = signal(void 0);
|
|
3211
3273
|
signals.set(key, { get: get2, set: set2 });
|
|
3212
|
-
subscribers.set(key, /* @__PURE__ */ new
|
|
3274
|
+
subscribers.set(key, /* @__PURE__ */ new Map());
|
|
3213
3275
|
}
|
|
3214
3276
|
}
|
|
3215
3277
|
function get(key) {
|
|
@@ -3220,9 +3282,14 @@ function createSharedScope(initialState) {
|
|
|
3220
3282
|
ensureSignal(key);
|
|
3221
3283
|
signals.get(key)?.set(value);
|
|
3222
3284
|
const subs = subscribers.get(key);
|
|
3223
|
-
if (subs) {
|
|
3224
|
-
for (const
|
|
3225
|
-
|
|
3285
|
+
if (subs && subs.size > 0) {
|
|
3286
|
+
for (const subscription of Array.from(subs.values())) {
|
|
3287
|
+
if (!subscription.active) continue;
|
|
3288
|
+
try {
|
|
3289
|
+
subscription.callback(value);
|
|
3290
|
+
} catch (err) {
|
|
3291
|
+
reportError(err, { phase: "event", name: `sharedScope(${String(key)})` });
|
|
3292
|
+
}
|
|
3226
3293
|
}
|
|
3227
3294
|
}
|
|
3228
3295
|
}
|
|
@@ -3233,9 +3300,17 @@ function createSharedScope(initialState) {
|
|
|
3233
3300
|
return () => {
|
|
3234
3301
|
};
|
|
3235
3302
|
}
|
|
3236
|
-
|
|
3303
|
+
const cb = callback;
|
|
3304
|
+
let subscription = subs.get(cb);
|
|
3305
|
+
if (!subscription) {
|
|
3306
|
+
subscription = { callback: cb, active: true };
|
|
3307
|
+
subs.set(cb, subscription);
|
|
3308
|
+
}
|
|
3309
|
+
const own = subscription;
|
|
3237
3310
|
return () => {
|
|
3238
|
-
subs.
|
|
3311
|
+
if (subs.get(cb) !== own) return;
|
|
3312
|
+
own.active = false;
|
|
3313
|
+
subs.delete(cb);
|
|
3239
3314
|
};
|
|
3240
3315
|
}
|
|
3241
3316
|
return { get, set, subscribe };
|
|
@@ -3366,6 +3441,11 @@ function serviceWorker(scriptUrl, options) {
|
|
|
3366
3441
|
}
|
|
3367
3442
|
|
|
3368
3443
|
// src/platform/worker.ts
|
|
3444
|
+
function toError(err) {
|
|
3445
|
+
if (err instanceof Error) return err;
|
|
3446
|
+
if (err !== null && typeof err === "object" && "name" in err && "message" in err) return err;
|
|
3447
|
+
return new Error(String(err));
|
|
3448
|
+
}
|
|
3369
3449
|
function worker(workerFn2) {
|
|
3370
3450
|
const [result, setResult] = signal(null);
|
|
3371
3451
|
const [error, setError] = signal(null);
|
|
@@ -3388,8 +3468,11 @@ function worker(workerFn2) {
|
|
|
3388
3468
|
worker2 = new Worker(blobUrl);
|
|
3389
3469
|
worker2.addEventListener("message", (e) => {
|
|
3390
3470
|
revokeBlobUrl();
|
|
3391
|
-
|
|
3392
|
-
|
|
3471
|
+
batch(() => {
|
|
3472
|
+
setResult(e.data);
|
|
3473
|
+
setError(null);
|
|
3474
|
+
setLoading(false);
|
|
3475
|
+
});
|
|
3393
3476
|
});
|
|
3394
3477
|
worker2.addEventListener("error", (e) => {
|
|
3395
3478
|
revokeBlobUrl();
|
|
@@ -3406,10 +3489,17 @@ function worker(workerFn2) {
|
|
|
3406
3489
|
}
|
|
3407
3490
|
function post(data2) {
|
|
3408
3491
|
if (!worker2) return;
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3492
|
+
try {
|
|
3493
|
+
worker2.postMessage(data2);
|
|
3494
|
+
} catch (err) {
|
|
3495
|
+
setError(toError(err));
|
|
3496
|
+
return;
|
|
3497
|
+
}
|
|
3498
|
+
batch(() => {
|
|
3499
|
+
setLoading(true);
|
|
3500
|
+
setError(null);
|
|
3501
|
+
setResult(null);
|
|
3502
|
+
});
|
|
3413
3503
|
}
|
|
3414
3504
|
function terminate() {
|
|
3415
3505
|
if (!worker2) return;
|
|
@@ -3473,9 +3563,14 @@ function workerFn(fn) {
|
|
|
3473
3563
|
reject(new Error("Worker is not available"));
|
|
3474
3564
|
return;
|
|
3475
3565
|
}
|
|
3476
|
-
|
|
3566
|
+
try {
|
|
3567
|
+
worker2.postMessage(args);
|
|
3568
|
+
} catch (err) {
|
|
3569
|
+
reject(toError(err));
|
|
3570
|
+
return;
|
|
3571
|
+
}
|
|
3477
3572
|
queue.push({ resolve, reject });
|
|
3478
|
-
|
|
3573
|
+
setLoading(true);
|
|
3479
3574
|
});
|
|
3480
3575
|
}
|
|
3481
3576
|
function terminate() {
|
|
@@ -3505,7 +3600,11 @@ function createWorkerPool(workerFn2, poolSize) {
|
|
|
3505
3600
|
}
|
|
3506
3601
|
};
|
|
3507
3602
|
function dispatchNext(idx) {
|
|
3508
|
-
|
|
3603
|
+
while (alive && !inflight[idx] && queues[idx].length > 0) {
|
|
3604
|
+
dispatchOne(idx);
|
|
3605
|
+
}
|
|
3606
|
+
}
|
|
3607
|
+
function dispatchOne(idx) {
|
|
3509
3608
|
const w = workers[idx];
|
|
3510
3609
|
const slot2 = queues[idx].shift();
|
|
3511
3610
|
const onMsg = (e) => {
|
|
@@ -3530,10 +3629,15 @@ function createWorkerPool(workerFn2, poolSize) {
|
|
|
3530
3629
|
slot2.reject(new Error(e.message || "Worker error"));
|
|
3531
3630
|
dispatchNext(idx);
|
|
3532
3631
|
};
|
|
3632
|
+
try {
|
|
3633
|
+
w.postMessage(slot2.data);
|
|
3634
|
+
} catch (err) {
|
|
3635
|
+
slot2.reject(toError(err));
|
|
3636
|
+
return;
|
|
3637
|
+
}
|
|
3533
3638
|
inflight[idx] = { ...slot2, onMsg, onErr };
|
|
3534
3639
|
w.addEventListener("message", onMsg);
|
|
3535
3640
|
w.addEventListener("error", onErr);
|
|
3536
|
-
w.postMessage(slot2.data);
|
|
3537
3641
|
}
|
|
3538
3642
|
try {
|
|
3539
3643
|
if (typeof Worker === "undefined") {
|
package/dist/ssr.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-
|
|
1
|
+
export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-Bli9XRW5.cjs';
|
|
2
2
|
|
|
3
3
|
interface HeadProps {
|
|
4
4
|
title?: string | (() => string);
|
|
@@ -482,8 +482,14 @@ interface ISROptions<T> {
|
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
484
|
* Creates an Incremental Static Regeneration (ISR) resource.
|
|
485
|
-
* Data is fetched initially, then automatically revalidated
|
|
486
|
-
*
|
|
485
|
+
* Data is fetched initially, then automatically revalidated once it goes stale.
|
|
486
|
+
*
|
|
487
|
+
* `isStale()` is a reactive signal: it flips to `true` when `revalidateAfter`
|
|
488
|
+
* elapses since the last successful fetch (effects re-run at that moment), stays
|
|
489
|
+
* `true` while a revalidation is pending or after one fails, and returns to
|
|
490
|
+
* `false` when a revalidation succeeds.
|
|
491
|
+
*
|
|
492
|
+
* @throws RangeError when `revalidateAfter` is not a positive finite number.
|
|
487
493
|
*/
|
|
488
494
|
declare function createISR<T>(options: ISROptions<T>): {
|
|
489
495
|
data: () => T | undefined;
|
package/dist/ssr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-
|
|
1
|
+
export { H as HydrateOptions, a as HydrationMismatch, T as TrustedHTML, c as collectStream, d as deserializeState, e as escapeScriptJson, h as hydrate, b as hydrateIslands, f as hydrateProgressively, i as isDangerousMetaRefresh, g as island, r as renderToDocument, j as renderToReadableStream, k as renderToStream, l as renderToString, m as renderToSuspenseStream, n as resetSSRState, s as serializeState, o as ssrSuspense, p as suspenseSwapScript, t as trustHTML } from './ssr-Bli9XRW5.js';
|
|
2
2
|
|
|
3
3
|
interface HeadProps {
|
|
4
4
|
title?: string | (() => string);
|
|
@@ -482,8 +482,14 @@ interface ISROptions<T> {
|
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
484
|
* Creates an Incremental Static Regeneration (ISR) resource.
|
|
485
|
-
* Data is fetched initially, then automatically revalidated
|
|
486
|
-
*
|
|
485
|
+
* Data is fetched initially, then automatically revalidated once it goes stale.
|
|
486
|
+
*
|
|
487
|
+
* `isStale()` is a reactive signal: it flips to `true` when `revalidateAfter`
|
|
488
|
+
* elapses since the last successful fetch (effects re-run at that moment), stays
|
|
489
|
+
* `true` while a revalidation is pending or after one fails, and returns to
|
|
490
|
+
* `false` when a revalidation succeeds.
|
|
491
|
+
*
|
|
492
|
+
* @throws RangeError when `revalidateAfter` is not a positive finite number.
|
|
487
493
|
*/
|
|
488
494
|
declare function createISR<T>(options: ISROptions<T>): {
|
|
489
495
|
data: () => T | undefined;
|
package/dist/ssr.js
CHANGED
|
@@ -23,9 +23,9 @@ import {
|
|
|
23
23
|
wasm,
|
|
24
24
|
worker,
|
|
25
25
|
workerFn
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ORMZXBKQ.js";
|
|
27
27
|
import "./chunk-52XFPGSN.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-JSXPZCET.js";
|
|
29
29
|
import {
|
|
30
30
|
collectStream,
|
|
31
31
|
deserializeState,
|
|
@@ -45,17 +45,16 @@ import {
|
|
|
45
45
|
ssrSuspense,
|
|
46
46
|
suspenseSwapScript,
|
|
47
47
|
trustHTML
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-HURREPU2.js";
|
|
49
|
+
import "./chunk-VVWPJ543.js";
|
|
50
|
+
import "./chunk-47M47FOM.js";
|
|
51
|
+
import "./chunk-2INLLLMZ.js";
|
|
52
52
|
import "./chunk-7ZHH77QA.js";
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
57
|
-
import "./chunk-
|
|
58
|
-
import "./chunk-2WLZ6757.js";
|
|
53
|
+
import "./chunk-XC4MEKGA.js";
|
|
54
|
+
import "./chunk-7XHATCIH.js";
|
|
55
|
+
import "./chunk-D33YTSX5.js";
|
|
56
|
+
import "./chunk-5Q4R7HCL.js";
|
|
57
|
+
import "./chunk-NYNYSPK7.js";
|
|
59
58
|
export {
|
|
60
59
|
Head,
|
|
61
60
|
clearWasmCache,
|