sibujs 4.13.1 → 4.14.1
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/README.md +1 -1
- package/dist/browser.cjs +15 -2
- package/dist/browser.js +9 -7
- package/dist/build.cjs +880 -281
- package/dist/build.d.cts +68 -3
- package/dist/build.d.ts +68 -3
- package/dist/build.js +88 -30
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +13 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-J6FW5TV6.js → chunk-3HEX6QJQ.js} +5 -3
- package/dist/chunk-3HZOSMPX.js +90 -0
- package/dist/{chunk-K4LNUT5L.js → chunk-3T7TWMSD.js} +8 -6
- package/dist/{chunk-ADZHPN2B.js → chunk-4XCWNGRY.js} +3 -3
- package/dist/{chunk-2NC56RGY.js → chunk-55TAOW5M.js} +2 -2
- package/dist/{chunk-G3Z2FEBR.js → chunk-B2NLNZ3E.js} +119 -26
- package/dist/{chunk-EXXSN3BW.js → chunk-B3HOT4TK.js} +1 -1
- package/dist/{chunk-QKFVMIAV.js → chunk-FCWOMATN.js} +11 -3
- package/dist/{chunk-QC3NP47A.js → chunk-FFXZ6ELZ.js} +10 -6
- package/dist/{chunk-TUCPL2HB.js → chunk-GIJ33UJZ.js} +1 -1
- package/dist/chunk-KTJC7QPA.js +195 -0
- package/dist/chunk-L2IPKGUJ.js +2596 -0
- package/dist/{chunk-4UTGDVSA.js → chunk-LAHX7XFG.js} +7 -14
- package/dist/{chunk-PBJYCE2Z.js → chunk-LJ2LR5P4.js} +5 -5
- package/dist/{chunk-AM6DZLBM.js → chunk-LJMX4SQ7.js} +2 -2
- package/dist/{chunk-5RIBLY2N.js → chunk-LUZXFMKH.js} +6 -6
- package/dist/{chunk-VFPLWUT7.js → chunk-LZKKMDQF.js} +151 -86
- package/dist/{chunk-J4X7ICH4.js → chunk-NIHGSXOX.js} +8 -6
- package/dist/chunk-NT3ZYB5S.js +167 -0
- package/dist/{chunk-2O6JJCUR.js → chunk-OLMZF4RU.js} +49 -8
- package/dist/{chunk-22OPSWMF.js → chunk-OPRQW4LI.js} +2 -2
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/{chunk-KC62VURU.js → chunk-RBRITLFL.js} +10 -8
- package/dist/{chunk-F2UWOZ6J.js → chunk-RVWJGWCL.js} +2 -2
- package/dist/{chunk-NYNYSPK7.js → chunk-S37PZD6I.js} +30 -45
- package/dist/chunk-TOV4PN3P.js +2015 -0
- package/dist/{chunk-C73VBPEF.js → chunk-TS6JDK7Y.js} +8 -8
- package/dist/{chunk-EU7T7EB3.js → chunk-TZNR6E6D.js} +4 -4
- package/dist/chunk-UYTYNCMZ.js +199 -0
- package/dist/{chunk-OIKD7YDY.js → chunk-VIAVYBNQ.js} +6 -5
- package/dist/{chunk-QZ47OZ25.js → chunk-WFMMSMA5.js} +8 -6
- package/dist/chunk-YIXMS546.js +1901 -0
- package/dist/{chunk-5XUGJM3J.js → chunk-YPLQQTWS.js} +1 -1
- package/dist/{chunk-CPQKWCJ2.js → chunk-ZKI4SDZ2.js} +16 -10
- package/dist/{chunk-YFTBCCVH.js → chunk-ZYK4NZZA.js} +5 -3
- package/dist/data.cjs +265 -35
- package/dist/data.d.cts +31 -1
- package/dist/data.d.ts +31 -1
- package/dist/data.js +16 -10
- package/dist/devtools.cjs +15 -2
- package/dist/devtools.js +9 -7
- package/dist/{dispose-GEIG2KOF.js → dispose-EIHHHDC7.js} +3 -1
- package/dist/ecosystem.cjs +62 -23
- package/dist/ecosystem.js +14 -12
- package/dist/extras.cjs +3562 -270
- package/dist/extras.d.cts +3 -3
- package/dist/extras.d.ts +3 -3
- package/dist/extras.js +39 -29
- package/dist/index.cjs +442 -253
- package/dist/index.d.cts +93 -283
- package/dist/index.d.ts +93 -283
- package/dist/index.js +26 -16
- package/dist/motion.cjs +12 -1
- package/dist/motion.js +6 -4
- package/dist/patterns.cjs +15 -2
- package/dist/patterns.js +10 -8
- package/dist/performance.cjs +36 -2
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +14 -10
- package/dist/plugins.cjs +5267 -1807
- package/dist/plugins.d.cts +8 -834
- package/dist/plugins.d.ts +8 -834
- package/dist/plugins.js +64 -2329
- package/dist/prerenderServer-MXJEVWA3.js +350 -0
- package/dist/renderRoute-DP20XwMS.d.cts +86 -0
- package/dist/renderRoute-fxgsm2Ir.d.ts +86 -0
- package/dist/routeHead-CE9SV-cH.d.cts +995 -0
- package/dist/routeHead-DzVxPviY.d.ts +995 -0
- package/dist/{routeMiddleware-B1sp4P7a.d.ts → routeMiddleware-BySbueoE.d.ts} +0 -25
- package/dist/{routeMiddleware-CedQTsLK.d.cts → routeMiddleware-CijZD5eW.d.cts} +0 -25
- package/dist/{ssr-VBM6J5SJ.js → ssr-HHU3DAD2.js} +15 -6
- package/dist/ssr-JpGpHnpC.d.cts +841 -0
- package/dist/ssr-JpGpHnpC.d.ts +841 -0
- package/dist/ssr-dom.cjs +1904 -0
- package/dist/ssr-dom.d.cts +343 -0
- package/dist/ssr-dom.d.ts +343 -0
- package/dist/ssr-dom.js +19 -0
- package/dist/ssr.cjs +7677 -2069
- package/dist/ssr.d.cts +63 -5
- package/dist/ssr.d.ts +63 -5
- package/dist/ssr.js +136 -14
- package/dist/testing.cjs +6585 -87
- package/dist/testing.d.cts +80 -1
- package/dist/testing.d.ts +80 -1
- package/dist/testing.js +117 -4
- package/dist/ui.cjs +36 -2
- package/dist/ui.js +17 -14
- package/dist/widgets.cjs +14 -1
- package/dist/widgets.js +11 -9
- package/package.json +9 -2
- package/dist/chunk-2F4PSJ5Z.js +0 -765
- package/dist/chunk-7XHATCIH.js +0 -121
- package/dist/chunk-B36ADEIR.js +0 -21
- package/dist/ssr-Db0Sgdu3.d.cts +0 -245
- package/dist/ssr-Db0Sgdu3.d.ts +0 -245
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// src/core/dev.ts
|
|
2
|
+
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
3
|
+
// safe default: off in browser, on in test/dev Node
|
|
4
|
+
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
5
|
+
);
|
|
6
|
+
function isDev() {
|
|
7
|
+
if (typeof globalThis.__SIBU_DEV__ !== "undefined") return !!globalThis.__SIBU_DEV__;
|
|
8
|
+
if (typeof __SIBU_DEV__ !== "undefined") return !!__SIBU_DEV__;
|
|
9
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
10
|
+
}
|
|
11
|
+
function devAssert(condition, message) {
|
|
12
|
+
if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
|
|
13
|
+
throw new Error(`[SibuJS] ${message}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function devWarnLazy(build) {
|
|
17
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
18
|
+
const message = build();
|
|
19
|
+
if (message) console.warn(`[SibuJS] ${message}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function devWarn(message) {
|
|
23
|
+
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
24
|
+
console.warn(`[SibuJS] ${message}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/core/rendering/adoptScope.ts
|
|
29
|
+
var current = null;
|
|
30
|
+
function inAdoptScope() {
|
|
31
|
+
return current?.s.on === true;
|
|
32
|
+
}
|
|
33
|
+
function currentSink() {
|
|
34
|
+
return current?.s.on ? current.s : null;
|
|
35
|
+
}
|
|
36
|
+
function createScopedElement(tag, ns) {
|
|
37
|
+
const c = current;
|
|
38
|
+
if (c?.s.on) {
|
|
39
|
+
const el = c.s.el(tag, ns, c.p + (c.n++).toString(36));
|
|
40
|
+
if (el) return el;
|
|
41
|
+
}
|
|
42
|
+
return ns ? document.createElementNS(ns, tag) : document.createElement(tag);
|
|
43
|
+
}
|
|
44
|
+
function captureScope() {
|
|
45
|
+
const c = current;
|
|
46
|
+
return c?.s.on ? { p: `${c.p}${(c.n++).toString(36)}.`, n: 0, s: c.s } : null;
|
|
47
|
+
}
|
|
48
|
+
function keyedScope(scope, key) {
|
|
49
|
+
if (!scope?.s.on) return null;
|
|
50
|
+
const type = typeof key;
|
|
51
|
+
if (type !== "string" && type !== "number") {
|
|
52
|
+
throw new TypeError(`[SibuJS] adopt: a key must be a string or a number, not ${type}`);
|
|
53
|
+
}
|
|
54
|
+
const text = String(key).replace(/[^\w-]/g, (c) => `~${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
55
|
+
return { p: `${scope.p}${type === "string" ? "_" : "-"}${text}.`, n: 0, s: scope.s };
|
|
56
|
+
}
|
|
57
|
+
function inScope(scope, fn) {
|
|
58
|
+
const prev = current;
|
|
59
|
+
if (!scope && !prev) return fn();
|
|
60
|
+
current = scope?.s.on ? { p: scope.p, n: 0, s: scope.s } : null;
|
|
61
|
+
try {
|
|
62
|
+
return fn();
|
|
63
|
+
} finally {
|
|
64
|
+
current = prev;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/core/rendering/hydrationHooks.ts
|
|
69
|
+
var _a;
|
|
70
|
+
var slot = globalThis[_a = /* @__PURE__ */ Symbol.for("sibujs.hydration.v2")] ?? (globalThis[_a] = { a: /* @__PURE__ */ new Set(), c: null });
|
|
71
|
+
function isHydrating() {
|
|
72
|
+
return slot.a.size > 0;
|
|
73
|
+
}
|
|
74
|
+
function ownSession() {
|
|
75
|
+
return currentSink()?.h ?? slot.c;
|
|
76
|
+
}
|
|
77
|
+
function hydrationOwners() {
|
|
78
|
+
const own = ownSession();
|
|
79
|
+
return own ? own.open ? [own] : [] : Array.from(slot.a);
|
|
80
|
+
}
|
|
81
|
+
function afterHydration(fn) {
|
|
82
|
+
const owners = hydrationOwners();
|
|
83
|
+
let left = owners.length;
|
|
84
|
+
const once = () => {
|
|
85
|
+
if (--left < 1) fn();
|
|
86
|
+
};
|
|
87
|
+
if (left) for (const s of owners) s.done.push(once);
|
|
88
|
+
else fn();
|
|
89
|
+
}
|
|
90
|
+
function notify(session) {
|
|
91
|
+
for (const wake of Array.from(session.wake)) wake();
|
|
92
|
+
}
|
|
93
|
+
function holdHydration(sessions, entry) {
|
|
94
|
+
for (const s of sessions) s.pending.add(entry);
|
|
95
|
+
return () => {
|
|
96
|
+
for (const s of sessions) if (s.pending.delete(entry)) notify(s);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function inHydration(session, fn) {
|
|
100
|
+
const prev = slot.c;
|
|
101
|
+
slot.c = session;
|
|
102
|
+
try {
|
|
103
|
+
return fn();
|
|
104
|
+
} finally {
|
|
105
|
+
slot.c = prev;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function beginHydration() {
|
|
109
|
+
const own = ownSession();
|
|
110
|
+
const session = {
|
|
111
|
+
done: [],
|
|
112
|
+
pending: /* @__PURE__ */ new Set(),
|
|
113
|
+
wake: /* @__PURE__ */ new Set(),
|
|
114
|
+
up: own?.open ? own : null,
|
|
115
|
+
open: true,
|
|
116
|
+
end() {
|
|
117
|
+
if (!session.open) return;
|
|
118
|
+
session.open = false;
|
|
119
|
+
slot.a.delete(session);
|
|
120
|
+
session.pending.clear();
|
|
121
|
+
notify(session);
|
|
122
|
+
const up = session.up;
|
|
123
|
+
session.up = null;
|
|
124
|
+
const callbacks = session.done.splice(0);
|
|
125
|
+
if (up?.open) {
|
|
126
|
+
up.done.push(...callbacks);
|
|
127
|
+
if (up.pending.delete(session)) notify(up);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
let failed = false;
|
|
131
|
+
let error;
|
|
132
|
+
inHydration(session, () => {
|
|
133
|
+
for (const fn of callbacks) {
|
|
134
|
+
try {
|
|
135
|
+
fn();
|
|
136
|
+
} catch (err) {
|
|
137
|
+
if (!failed) error = err;
|
|
138
|
+
failed = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
if (failed) throw error;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
if (session.up) session.up.pending.add(session);
|
|
146
|
+
slot.a.add(session);
|
|
147
|
+
return session;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
DEV,
|
|
152
|
+
isDev,
|
|
153
|
+
devAssert,
|
|
154
|
+
devWarnLazy,
|
|
155
|
+
devWarn,
|
|
156
|
+
inAdoptScope,
|
|
157
|
+
createScopedElement,
|
|
158
|
+
captureScope,
|
|
159
|
+
keyedScope,
|
|
160
|
+
inScope,
|
|
161
|
+
isHydrating,
|
|
162
|
+
hydrationOwners,
|
|
163
|
+
afterHydration,
|
|
164
|
+
holdHydration,
|
|
165
|
+
inHydration,
|
|
166
|
+
beginHydration
|
|
167
|
+
};
|
|
@@ -6,33 +6,39 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
div,
|
|
8
8
|
span
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YPLQQTWS.js";
|
|
10
10
|
import {
|
|
11
11
|
STATIC_VALUE_RESOLVER,
|
|
12
12
|
planHeadElementEntry,
|
|
13
|
-
planMetaEntry
|
|
14
|
-
|
|
13
|
+
planMetaEntry,
|
|
14
|
+
recordServerHead,
|
|
15
|
+
serializeHeadEntry,
|
|
16
|
+
serializePlannedHeadEntry
|
|
17
|
+
} from "./chunk-TOV4PN3P.js";
|
|
15
18
|
import {
|
|
16
19
|
globalSingleton
|
|
17
20
|
} from "./chunk-7ZHH77QA.js";
|
|
18
21
|
import {
|
|
19
22
|
effect
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FFXZ6ELZ.js";
|
|
21
24
|
import {
|
|
22
25
|
sanitizeUrl
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-B3HOT4TK.js";
|
|
27
|
+
import {
|
|
28
|
+
getRequestStore
|
|
29
|
+
} from "./chunk-UYTYNCMZ.js";
|
|
24
30
|
import {
|
|
25
31
|
batch,
|
|
26
32
|
signal
|
|
27
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-FCWOMATN.js";
|
|
28
34
|
import {
|
|
29
35
|
bindOwnerScope
|
|
30
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-LAHX7XFG.js";
|
|
31
37
|
import {
|
|
32
38
|
registerDisposer,
|
|
33
39
|
replaceChildrenSafely,
|
|
34
40
|
reportError
|
|
35
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-S37PZD6I.js";
|
|
36
42
|
|
|
37
43
|
// src/platform/head.ts
|
|
38
44
|
function escapeScriptJsonLocal(json) {
|
|
@@ -86,8 +92,43 @@ function applyMetaEntry(metaProps, managedElements) {
|
|
|
86
92
|
retract();
|
|
87
93
|
};
|
|
88
94
|
}
|
|
95
|
+
function headEntryKey(tag, attrs) {
|
|
96
|
+
const lower = (v) => (v ?? "").toLowerCase();
|
|
97
|
+
if (tag === "meta") {
|
|
98
|
+
if (attrs.name) return `meta:name:${lower(attrs.name)}`;
|
|
99
|
+
if (attrs.property) return `meta:property:${lower(attrs.property)}`;
|
|
100
|
+
if (attrs["http-equiv"]) return `meta:http-equiv:${lower(attrs["http-equiv"])}`;
|
|
101
|
+
return `meta:${JSON.stringify(attrs)}`;
|
|
102
|
+
}
|
|
103
|
+
const rel = lower(attrs.rel);
|
|
104
|
+
if (rel === "canonical") return "link:rel:canonical";
|
|
105
|
+
if (rel === "alternate" && attrs.hreflang) return `link:hreflang:${lower(attrs.hreflang)}`;
|
|
106
|
+
return `link:${rel}:${attrs.href ?? ""}`;
|
|
107
|
+
}
|
|
108
|
+
function resolveHeadForServer(props) {
|
|
109
|
+
const layer = { tags: [] };
|
|
110
|
+
if (props.title != null) layer.title = CLIENT_RESOLVER.resolveValue("title", props.title);
|
|
111
|
+
for (const entry of props.meta ?? []) {
|
|
112
|
+
const plan = planMetaEntry(entry, CLIENT_RESOLVER);
|
|
113
|
+
if (plan.kind === "drop") continue;
|
|
114
|
+
const attrs = Object.fromEntries(plan.attributes);
|
|
115
|
+
layer.tags.push({ key: headEntryKey("meta", attrs), html: serializePlannedHeadEntry("meta", plan.attributes) });
|
|
116
|
+
}
|
|
117
|
+
for (const attrs of props.link ?? []) {
|
|
118
|
+
const html = serializeHeadEntry("link", attrs);
|
|
119
|
+
if (html) layer.tags.push({ key: headEntryKey("link", attrs), html });
|
|
120
|
+
}
|
|
121
|
+
return layer;
|
|
122
|
+
}
|
|
123
|
+
function recordHeadForServer(props, anchor) {
|
|
124
|
+
const withdraw = recordServerHead(() => resolveHeadForServer(props));
|
|
125
|
+
if (!withdraw) return false;
|
|
126
|
+
registerDisposer(anchor, withdraw);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
89
129
|
function Head(props) {
|
|
90
130
|
const anchor = document.createComment("sibu-head");
|
|
131
|
+
if (getRequestStore()?.ssr && recordHeadForServer(props, anchor)) return anchor;
|
|
91
132
|
const managedElements = [];
|
|
92
133
|
const effectCleanups = [];
|
|
93
134
|
const cleanup = () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRequestStore,
|
|
3
3
|
isSSR
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UYTYNCMZ.js";
|
|
5
5
|
import {
|
|
6
6
|
reactiveBinding
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LAHX7XFG.js";
|
|
8
8
|
|
|
9
9
|
// src/core/rendering/createId.ts
|
|
10
10
|
var COUNTER_KEY = /* @__PURE__ */ Symbol.for("sibujs.createId.v1");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
__require,
|
|
15
|
+
__export
|
|
16
|
+
};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isBlockedElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RVWJGWCL.js";
|
|
4
4
|
import {
|
|
5
5
|
globalSingleton
|
|
6
6
|
} from "./chunk-7ZHH77QA.js";
|
|
7
7
|
import {
|
|
8
8
|
effect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FFXZ6ELZ.js";
|
|
10
10
|
import {
|
|
11
11
|
sanitizeUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B3HOT4TK.js";
|
|
13
13
|
import {
|
|
14
14
|
signal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FCWOMATN.js";
|
|
16
16
|
import {
|
|
17
17
|
bindOwnerScope
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LAHX7XFG.js";
|
|
19
19
|
import {
|
|
20
|
-
DEV,
|
|
21
|
-
devWarn,
|
|
22
20
|
dispose,
|
|
23
21
|
registerDisposer,
|
|
24
22
|
replaceChildrenSafely,
|
|
25
23
|
reportError
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-S37PZD6I.js";
|
|
25
|
+
import {
|
|
26
|
+
DEV,
|
|
27
|
+
devWarn
|
|
28
|
+
} from "./chunk-NT3ZYB5S.js";
|
|
27
29
|
|
|
28
30
|
// src/performance/scheduler.ts
|
|
29
31
|
var Priority = {
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
isUrlAttribute,
|
|
6
6
|
sanitizeUrl,
|
|
7
7
|
stripControlChars
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-B3HOT4TK.js";
|
|
9
9
|
import {
|
|
10
10
|
DEV
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NT3ZYB5S.js";
|
|
12
12
|
|
|
13
13
|
// src/utils/metaRefresh.ts
|
|
14
14
|
function isAsciiWhitespace(ch) {
|
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// src/core/dev.ts
|
|
14
|
-
var DEV = typeof __SIBU_DEV__ !== "undefined" ? !!__SIBU_DEV__ : typeof globalThis.__SIBU_DEV__ !== "undefined" ? !!globalThis.__SIBU_DEV__ : (
|
|
15
|
-
// safe default: off in browser, on in test/dev Node
|
|
16
|
-
typeof process !== "undefined" && process.env?.NODE_ENV !== "production"
|
|
17
|
-
);
|
|
18
|
-
function isDev() {
|
|
19
|
-
if (typeof globalThis.__SIBU_DEV__ !== "undefined") return !!globalThis.__SIBU_DEV__;
|
|
20
|
-
if (typeof __SIBU_DEV__ !== "undefined") return !!__SIBU_DEV__;
|
|
21
|
-
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production";
|
|
22
|
-
}
|
|
23
|
-
function devAssert(condition, message) {
|
|
24
|
-
if ((typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) && !condition) {
|
|
25
|
-
throw new Error(`[SibuJS] ${message}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function devWarnLazy(build) {
|
|
29
|
-
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
30
|
-
const message = build();
|
|
31
|
-
if (message) console.warn(`[SibuJS] ${message}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function devWarn(message) {
|
|
35
|
-
if (typeof __SIBU_DEV__ !== "undefined" ? __SIBU_DEV__ : DEV) {
|
|
36
|
-
console.warn(`[SibuJS] ${message}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
DEV,
|
|
3
|
+
devWarn,
|
|
4
|
+
isHydrating
|
|
5
|
+
} from "./chunk-NT3ZYB5S.js";
|
|
39
6
|
|
|
40
7
|
// src/core/errors.ts
|
|
41
8
|
var ERROR_STATE_KEY = /* @__PURE__ */ Symbol.for("sibujs.runtime-errors.v1");
|
|
@@ -110,10 +77,21 @@ function defaultReport(error, context) {
|
|
|
110
77
|
if (typeof console === "undefined") return;
|
|
111
78
|
console.error(`[SibuJS] Uncaught error during ${describe(context)}: ${error.message}`, error);
|
|
112
79
|
}
|
|
80
|
+
function requestErrorSink() {
|
|
81
|
+
const shared = globalThis[/* @__PURE__ */ Symbol.for("sibujs.ssr.v1")];
|
|
82
|
+
if (!shared) return void 0;
|
|
83
|
+
const store = shared.als ? shared.als.getStore() : shared.fallbackDepth > 0 ? shared.fallbackStore : void 0;
|
|
84
|
+
return store?.errors;
|
|
85
|
+
}
|
|
113
86
|
function reportError(error, context) {
|
|
114
87
|
const err = normalizeError(error);
|
|
115
88
|
untrackedRun(() => {
|
|
116
89
|
if (claimedByBoundary(err, context)) return;
|
|
90
|
+
const sink = requestErrorSink();
|
|
91
|
+
if (sink) {
|
|
92
|
+
sink.push({ error: err, context });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
117
95
|
const s = state();
|
|
118
96
|
const handler = s.handler;
|
|
119
97
|
if (handler && s.handlerDepth === 0) {
|
|
@@ -271,6 +249,20 @@ function disposeNodeOwn(node) {
|
|
|
271
249
|
}
|
|
272
250
|
}
|
|
273
251
|
function replaceChildrenSafely(parent, ...next) {
|
|
252
|
+
if (isHydrating() && next.length > 0 && next[0] === parent.firstChild) {
|
|
253
|
+
let ok = true;
|
|
254
|
+
for (let i = 1; i < next.length && ok; i++) ok = next[i - 1].nextSibling === next[i];
|
|
255
|
+
if (ok) {
|
|
256
|
+
let rest = next[next.length - 1].nextSibling;
|
|
257
|
+
while (rest) {
|
|
258
|
+
const following = rest.nextSibling;
|
|
259
|
+
dispose(rest);
|
|
260
|
+
parent.removeChild(rest);
|
|
261
|
+
rest = following;
|
|
262
|
+
}
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
274
266
|
for (let i = 0; i < next.length; i++) {
|
|
275
267
|
const node = next[i];
|
|
276
268
|
node.parentNode?.removeChild(node);
|
|
@@ -292,13 +284,6 @@ function checkLeaks(warnThreshold = 0) {
|
|
|
292
284
|
}
|
|
293
285
|
|
|
294
286
|
export {
|
|
295
|
-
__require,
|
|
296
|
-
__export,
|
|
297
|
-
DEV,
|
|
298
|
-
isDev,
|
|
299
|
-
devAssert,
|
|
300
|
-
devWarnLazy,
|
|
301
|
-
devWarn,
|
|
302
287
|
setRuntimeErrorHandler,
|
|
303
288
|
getRuntimeErrorHandler,
|
|
304
289
|
normalizeError,
|