@ogygia/core 0.12.2 → 0.13.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/LateIsland.svelte +3 -2
- package/dist/LateIslandAwait.svelte +6 -2
- package/dist/Region.svelte +22 -33
- package/dist/boundary.d.ts +0 -2
- package/dist/boundary.js +8 -6
- package/dist/compiler/debarrel/barrel.d.ts +15 -8
- package/dist/compiler/debarrel/barrel.js +92 -45
- package/dist/compiler/debarrel/plugin.js +41 -17
- package/dist/compiler/dev/dev-hmr.d.ts +3 -0
- package/dist/compiler/dev/dev-hmr.js +3 -0
- package/dist/compiler/driver.js +11 -4
- package/dist/compiler/flags.js +21 -7
- package/dist/compiler/fouc-css.js +5 -1
- package/dist/compiler/kit.js +5 -1
- package/dist/compiler/link/build-output.js +12 -3
- package/dist/compiler/macros/bake.js +18 -4
- package/dist/compiler/macros/dollar.js +6 -1
- package/dist/compiler/macros/source.js +6 -1
- package/dist/compiler/macros/store.js +10 -2
- package/dist/compiler/macros/wire.js +6 -1
- package/dist/compiler/parse/scan.js +10 -3
- package/dist/compiler/region/transform.js +188 -74
- package/dist/context-bridge.js +13 -5
- package/dist/context.d.ts +9 -0
- package/dist/context.js +30 -1
- package/dist/document.d.ts +1 -1
- package/dist/document.js +7 -1
- package/dist/early-holes-head.d.ts +5 -0
- package/dist/early-holes-head.js +20 -0
- package/dist/early-holes.d.ts +34 -0
- package/dist/early-holes.js +51 -0
- package/dist/entry-hydrate.js +9 -12
- package/dist/events/bus.js +7 -2
- package/dist/events/schema.d.ts +2 -2
- package/dist/fn-transport.js +4 -3
- package/dist/hooks.js +94 -163
- package/dist/insights/page-assets.js +11 -3
- package/dist/insights/page-insights.d.ts +0 -2
- package/dist/insights/page-insights.js +14 -10
- package/dist/insights/session-insights.js +2 -2
- package/dist/internal-instruments.d.ts +3 -1
- package/dist/internal-instruments.js +3 -1
- package/dist/internal-server.d.ts +3 -2
- package/dist/internal-server.js +3 -2
- package/dist/internal.d.ts +1 -2
- package/dist/internal.js +1 -2
- package/dist/keep-fallback.d.ts +0 -2
- package/dist/keep-fallback.js +4 -5
- package/dist/live-transport.js +3 -2
- package/dist/messages/build.d.ts +585 -0
- package/dist/messages/build.js +800 -0
- package/dist/messages/core.d.ts +464 -0
- package/dist/messages/core.js +843 -0
- package/dist/messages/define.d.ts +62 -0
- package/dist/messages/define.js +49 -0
- package/dist/messages/index.d.ts +6 -0
- package/dist/messages/index.js +6 -0
- package/dist/messages/island.d.ts +4 -0
- package/dist/messages/island.js +34 -0
- package/dist/messages/lazy.d.ts +3 -0
- package/dist/messages/lazy.js +22 -0
- package/dist/messages/prose.d.ts +15 -0
- package/dist/messages/prose.js +43 -0
- package/dist/messages/server.d.ts +142 -0
- package/dist/messages/server.js +246 -0
- package/dist/nested.d.ts +3 -0
- package/dist/nested.js +8 -1
- package/dist/plugin/css.js +14 -13
- package/dist/plugin/facts.d.ts +2 -0
- package/dist/plugin/facts.js +10 -6
- package/dist/plugin/hooks.d.ts +7 -17
- package/dist/plugin/hooks.js +32 -4
- package/dist/plugin/index.d.ts +9 -2
- package/dist/plugin/request-scope.d.ts +20 -0
- package/dist/plugin/request-scope.js +149 -0
- package/dist/plugin/server.d.ts +20 -2
- package/dist/plugin/server.js +98 -28
- package/dist/plugin/testing.d.ts +6 -0
- package/dist/plugin/testing.js +14 -2
- package/dist/policies.d.ts +21 -0
- package/dist/policies.js +66 -0
- package/dist/preference.js +6 -1
- package/dist/preload.js +6 -9
- package/dist/ref-watch.d.ts +0 -10
- package/dist/ref-watch.js +14 -1
- package/dist/ref.js +17 -5
- package/dist/region-snippet.js +9 -3
- package/dist/region.js +2 -1
- package/dist/report-thrown.d.ts +9 -0
- package/dist/report-thrown.js +15 -0
- package/dist/rules.d.ts +17 -0
- package/dist/rules.js +57 -0
- package/dist/runtime/beacon.d.ts +0 -4
- package/dist/runtime/beacon.js +58 -43
- package/dist/runtime/boot-link.js +19 -2
- package/dist/runtime/client-hooks.js +2 -1
- package/dist/runtime/concurrency.d.ts +16 -5
- package/dist/runtime/concurrency.js +123 -7
- package/dist/runtime/core.d.ts +3 -1
- package/dist/runtime/core.js +718 -384
- package/dist/runtime/devalue-lane.d.ts +13 -0
- package/dist/runtime/devalue-lane.js +49 -0
- package/dist/runtime/disclose-version.d.ts +1 -0
- package/dist/runtime/disclose-version.js +14 -0
- package/dist/runtime/early-holes.d.ts +4 -0
- package/dist/runtime/early-holes.js +40 -0
- package/dist/runtime/entry-locations.js +40 -49
- package/dist/runtime/foreign-props.d.ts +0 -7
- package/dist/runtime/foreign-props.js +2 -1
- package/dist/runtime/form-continuity.d.ts +2 -2
- package/dist/runtime/form-continuity.js +30 -8
- package/dist/runtime/frame-nav.d.ts +7 -1
- package/dist/runtime/frame-nav.js +84 -18
- package/dist/runtime/frame-store.d.ts +25 -16
- package/dist/runtime/frame-store.js +124 -98
- package/dist/runtime/frames.js +8 -4
- package/dist/runtime/hole-facts.js +6 -7
- package/dist/runtime/hole-fetch.d.ts +17 -0
- package/dist/runtime/hole-fetch.js +47 -0
- package/dist/runtime/hydrate-core.d.ts +4 -4
- package/dist/runtime/hydrate-core.js +80 -64
- package/dist/runtime/import-again.d.ts +33 -0
- package/dist/runtime/import-again.js +217 -0
- package/dist/runtime/interaction-replay.d.ts +5 -3
- package/dist/runtime/interaction-replay.js +6 -6
- package/dist/runtime/interaction.d.ts +14 -3
- package/dist/runtime/interaction.js +46 -23
- package/dist/runtime/kit-page-thread.svelte.d.ts +2 -1
- package/dist/runtime/kit-page-thread.svelte.js +44 -20
- package/dist/runtime/lakes.d.ts +1 -1
- package/dist/runtime/lakes.js +18 -5
- package/dist/runtime/live.d.ts +1 -2
- package/dist/runtime/live.js +6 -8
- package/dist/runtime/load-scheduler.d.ts +29 -18
- package/dist/runtime/load-scheduler.js +236 -136
- package/dist/runtime/nav-handle.js +25 -6
- package/dist/runtime/navigation.d.ts +24 -0
- package/dist/runtime/navigation.js +24 -0
- package/dist/runtime/ownership.d.ts +1 -1
- package/dist/runtime/page-defer.js +3 -3
- package/dist/runtime/parse-html.d.ts +15 -4
- package/dist/runtime/parse-html.js +24 -5
- package/dist/runtime/pushable-props.svelte.d.ts +21 -0
- package/dist/runtime/pushable-props.svelte.js +37 -0
- package/dist/runtime/region-endpoint-url.js +4 -6
- package/dist/runtime/region-machines.d.ts +111 -0
- package/dist/runtime/region-machines.js +97 -0
- package/dist/runtime/region-sheets.d.ts +31 -0
- package/dist/runtime/region-sheets.js +49 -0
- package/dist/runtime/restore-report.d.ts +1 -0
- package/dist/runtime/restore-report.js +36 -0
- package/dist/runtime/restore.d.ts +5 -2
- package/dist/runtime/restore.js +33 -14
- package/dist/runtime/router-nav.d.ts +32 -12
- package/dist/runtime/router-nav.js +320 -228
- package/dist/runtime/router.d.ts +83 -19
- package/dist/runtime/router.js +297 -129
- package/dist/runtime/rules.d.ts +35 -0
- package/dist/runtime/rules.js +137 -0
- package/dist/runtime/schedule.d.ts +6 -3
- package/dist/runtime/schedule.js +172 -57
- package/dist/runtime/seeds.d.ts +5 -1
- package/dist/runtime/seeds.js +11 -5
- package/dist/runtime/session.d.ts +46 -7
- package/dist/runtime/session.js +78 -10
- package/dist/runtime/slots.d.ts +53 -20
- package/dist/runtime/slots.js +2 -3
- package/dist/runtime/soft-refresh.d.ts +16 -0
- package/dist/runtime/soft-refresh.js +14 -0
- package/dist/runtime/svelte-warnings.d.ts +4 -10
- package/dist/runtime/svelte-warnings.js +7 -4
- package/dist/runtime/wire-classes.js +21 -8
- package/dist/runtime/wire-format.js +6 -3
- package/dist/script.js +8 -7
- package/dist/seed-ref-reviver.d.ts +0 -9
- package/dist/seed-ref-reviver.js +2 -1
- package/dist/seed-refs.d.ts +46 -36
- package/dist/seed-refs.js +131 -92
- package/dist/server/document-tail.d.ts +6 -0
- package/dist/server/document-tail.js +7 -1
- package/dist/server/early-holes-csp.d.ts +14 -0
- package/dist/server/early-holes-csp.js +73 -0
- package/dist/server/page-facts.d.ts +4 -1
- package/dist/server/page-facts.js +4 -1
- package/dist/server/page-seed.d.ts +2 -2
- package/dist/server/page-seed.js +104 -11
- package/dist/server/page-stream.d.ts +14 -1
- package/dist/server/page-stream.js +119 -2
- package/dist/server/personal-response.d.ts +0 -5
- package/dist/server/personal-response.js +6 -2
- package/dist/server/props-wire.js +5 -1
- package/dist/server/region-endpoint.js +10 -2
- package/dist/server/render-cache.d.ts +24 -20
- package/dist/server/render-cache.js +99 -40
- package/dist/server/render-page.js +46 -15
- package/dist/server/request-stats.d.ts +10 -8
- package/dist/server/request-stats.js +20 -12
- package/dist/server/rules.d.ts +11 -0
- package/dist/server/rules.js +64 -0
- package/dist/server/signing-key.js +31 -18
- package/dist/server/stream-regions.d.ts +14 -1
- package/dist/server/stream-regions.js +38 -2
- package/dist/shared-state.js +5 -1
- package/dist/shims/app-navigation.js +3 -2
- package/dist/shims/page-store.svelte.js +16 -2
- package/dist/source.js +7 -2
- package/dist/store-transport.js +12 -5
- package/dist/transport.js +3 -2
- package/dist/vite/index.js +83 -74
- package/dist/vite/kit-dirs.js +7 -1
- package/dist/vite/options.d.ts +2 -1
- package/dist/vite/options.js +11 -20
- package/dist/vite/package-files.js +13 -3
- package/dist/vite/paths.d.ts +2 -0
- package/dist/vite/paths.js +4 -4
- package/dist/vite/plugin-api.d.ts +6 -5
- package/dist/vite/plugin-api.js +42 -14
- package/dist/vite/style-preprocess.js +10 -3
- package/package.json +8 -1
- package/dist/KeepHost.svelte +0 -19
- package/dist/KeepHost.svelte.d.ts +0 -10
- package/dist/LiveHost.svelte +0 -19
- package/dist/LiveHost.svelte.d.ts +0 -10
- package/dist/NestedProvider.svelte +0 -13
- package/dist/NestedProvider.svelte.d.ts +0 -8
- package/dist/runtime/page-cache.d.ts +0 -23
- package/dist/runtime/page-cache.js +0 -74
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE MESSAGE SYSTEM ogygia and its first-party plugins share. Each package keeps its messages in two
|
|
3
|
+
* tables — its errors and its warnings: a code, its wording from its arguments, what to do about it —
|
|
4
|
+
* and makes its error class and its `warn()` from them:
|
|
5
|
+
*
|
|
6
|
+
* export const ERRORS = { some_error: { text: (a: { entry: string }): string => …, details } }
|
|
7
|
+
* satisfies MessageTableShape;
|
|
8
|
+
* export const WARNINGS = { … } satisfies MessageTableShape;
|
|
9
|
+
* const own: MessagesOf<typeof ERRORS, typeof WARNINGS> = define_messages(
|
|
10
|
+
* import.meta.env.DEV ? ERRORS : null,
|
|
11
|
+
* import.meta.env.DEV ? WARNINGS : null
|
|
12
|
+
* );
|
|
13
|
+
*
|
|
14
|
+
* throw new OgygiaError('goto_not_http');
|
|
15
|
+
* console.error(new OgygiaError('island_load_failed', { entry }), err); // a caught failure
|
|
16
|
+
* warn('island_healed', { entry, drift }); // console.warn
|
|
17
|
+
*
|
|
18
|
+
* Every message ends with its code's page, `https://ogygiajs.dev/e/<code>?<args>` (the docs fill the
|
|
19
|
+
* wording in from the arguments). In dev it starts with the wording; in a production build it is the
|
|
20
|
+
* link alone: the tables are only passed under `import.meta.env.DEV`, so the bundler drops them and
|
|
21
|
+
* no wording reaches the bundle (the way Svelte ships `https://svelte.dev/e/<code>`). An error
|
|
22
|
+
* carries its code (`err.code`). Codes are one namespace across every package (the docs' `/e` pages
|
|
23
|
+
* list them all and check it).
|
|
24
|
+
*/
|
|
25
|
+
/** One message: its wording from its arguments, and its page (plain sentences, `code` in backticks,
|
|
26
|
+
* one paragraph a line). `details` is a function so a table makes no call as it loads — the bundler
|
|
27
|
+
* can then drop it whole from a production build. */
|
|
28
|
+
export type MessageEntry<A> = {
|
|
29
|
+
text: (a: A) => string;
|
|
30
|
+
details: () => string;
|
|
31
|
+
};
|
|
32
|
+
/** What a table satisfies. Each `text` declares its own arguments (`(a: { entry: string }): string`),
|
|
33
|
+
* the one place they are written; {@link MessagesOf} reads them back. */
|
|
34
|
+
export type MessageTableShape = Record<string, MessageEntry<never>>;
|
|
35
|
+
/** Each code's arguments, read off its `text` (`void`: none). */
|
|
36
|
+
type ArgsOf<T> = { [C in keyof T]: T[C] extends {
|
|
37
|
+
text: () => string;
|
|
38
|
+
} ? void : T[C] extends {
|
|
39
|
+
text: (a: infer A) => string;
|
|
40
|
+
} ? A : never; };
|
|
41
|
+
type Args<M, C extends keyof M> = M[C] extends void ? [] : [M[C]];
|
|
42
|
+
/** A package's `OgygiaError` (its error codes) and `warn()` (its warning codes). */
|
|
43
|
+
export type MessagesOf<E, W> = {
|
|
44
|
+
OgygiaError: new <C extends keyof E & string>(code: C, ...args: Args<ArgsOf<E>, C>) => Error & {
|
|
45
|
+
code: C;
|
|
46
|
+
};
|
|
47
|
+
warn: <C extends keyof W & string>(code: C, ...rest: [...Args<ArgsOf<W>, C>, ...unknown[]]) => void;
|
|
48
|
+
/** A code's line as a string, for a logger that takes one (Rollup's `this.warn`, an injected
|
|
49
|
+
* `warn`): what `OgygiaError` and `warn` print. */
|
|
50
|
+
line: <C extends (keyof E | keyof W) & string>(code: C, ...args: Args<ArgsOf<E & W>, C & keyof (E & W)>) => string;
|
|
51
|
+
};
|
|
52
|
+
/** The line for a code: the wording and its link with the table, the link alone without it. */
|
|
53
|
+
/** Dev, or a prerender (the server's handle publishes Kit's `building`, hooks.ts): the moments a
|
|
54
|
+
* server-side message prints its wording. Asked when it prints, never as a module loads. */
|
|
55
|
+
export declare function dev_or_prerender(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* A package's `OgygiaError`, `warn` and `line` from its tables. A table left out (`null`) prints the
|
|
58
|
+
* link alone; `worded`, asked as each message prints, says whether a table it was given is used —
|
|
59
|
+
* a server bundle keeps its tables for a prerender and words a message only then (and in dev).
|
|
60
|
+
*/
|
|
61
|
+
export declare function define_messages<E extends MessageTableShape, W extends MessageTableShape>(errors_table: E | null, warnings_table: W | null, worded?: () => boolean): MessagesOf<E, W>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/messages/define.ts
|
|
2
|
+
/** The line for a code: the wording and its link with the table, the link alone without it. */
|
|
3
|
+
/** Dev, or a prerender (the server's handle publishes Kit's `building`, hooks.ts): the moments a
|
|
4
|
+
* server-side message prints its wording. Asked when it prints, never as a module loads. */
|
|
5
|
+
function dev_or_prerender() {
|
|
6
|
+
return !!import.meta.env?.DEV || globalThis[Symbol.for("ogygia.prerendering")] === true;
|
|
7
|
+
}
|
|
8
|
+
function line(table, code, a) {
|
|
9
|
+
let link = "https://ogygiajs.dev/e/" + code;
|
|
10
|
+
if (a && typeof a === "object") {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
for (const name in a) {
|
|
13
|
+
const value = a[name];
|
|
14
|
+
if (value != null && value !== "") params.set(name, String(value).slice(0, 300));
|
|
15
|
+
}
|
|
16
|
+
const query = params.toString();
|
|
17
|
+
if (query) link += "?" + query;
|
|
18
|
+
}
|
|
19
|
+
const entry = table && table[code];
|
|
20
|
+
return entry ? "[ogygia] " + entry.text(a) + "\n" + link : "[ogygia] " + link;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A package's `OgygiaError`, `warn` and `line` from its tables. A table left out (`null`) prints the
|
|
24
|
+
* link alone; `worded`, asked as each message prints, says whether a table it was given is used —
|
|
25
|
+
* a server bundle keeps its tables for a prerender and words a message only then (and in dev).
|
|
26
|
+
*/
|
|
27
|
+
function define_messages(errors_table, warnings_table, worded = () => true) {
|
|
28
|
+
const errors = () => errors_table && worded() ? errors_table : null;
|
|
29
|
+
const warnings = () => warnings_table && worded() ? warnings_table : null;
|
|
30
|
+
class OgygiaError extends Error {
|
|
31
|
+
code;
|
|
32
|
+
constructor(code, a) {
|
|
33
|
+
super(line(errors(), code, a));
|
|
34
|
+
this.name = "OgygiaError";
|
|
35
|
+
this.code = code;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
OgygiaError,
|
|
40
|
+
warn: ((code, ...rest) => {
|
|
41
|
+
const first = rest[0];
|
|
42
|
+
const proto = first !== null && typeof first === "object" ? Object.getPrototypeOf(first) : 0;
|
|
43
|
+
const has_args = proto === Object.prototype || proto === null;
|
|
44
|
+
console.warn(line(warnings(), code, has_args ? first : void 0), ...has_args ? rest.slice(1) : rest);
|
|
45
|
+
}),
|
|
46
|
+
line: ((code, a) => line(errors_table && code in errors_table ? errors() : warnings(), code, a))
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export { define_messages, dev_or_prerender };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MessageEntry, MessageTableShape, MessagesOf, define_messages, dev_or_prerender } from "./define.js";
|
|
2
|
+
import { prose } from "./prose.js";
|
|
3
|
+
import { ERRORS, WARNINGS } from "./core.js";
|
|
4
|
+
import { SERVER_ERRORS, SERVER_WARNINGS } from "./server.js";
|
|
5
|
+
import { BUILD_ERRORS, BUILD_WARNINGS } from "./build.js";
|
|
6
|
+
export { BUILD_ERRORS, BUILD_WARNINGS, ERRORS, type MessageEntry, type MessageTableShape, type MessagesOf, SERVER_ERRORS, SERVER_WARNINGS, WARNINGS, define_messages, dev_or_prerender, prose };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { define_messages, dev_or_prerender } from "./define.js";
|
|
2
|
+
import { prose } from "./prose.js";
|
|
3
|
+
import { ERRORS, WARNINGS } from "./core.js";
|
|
4
|
+
import { SERVER_ERRORS, SERVER_WARNINGS } from "./server.js";
|
|
5
|
+
import { BUILD_ERRORS, BUILD_WARNINGS } from "./build.js";
|
|
6
|
+
export { BUILD_ERRORS, BUILD_WARNINGS, ERRORS, SERVER_ERRORS, SERVER_WARNINGS, WARNINGS, define_messages, dev_or_prerender, prose };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/messages/island.ts
|
|
2
|
+
const runtime = () => globalThis[Symbol.for("ogygia.messages")];
|
|
3
|
+
/** The code's link with its arguments — what a production build prints (./define.ts `line`). */
|
|
4
|
+
function link(code, a) {
|
|
5
|
+
let url = "[ogygia] https://ogygiajs.dev/e/" + code;
|
|
6
|
+
if (a && typeof a === "object") {
|
|
7
|
+
const params = new URLSearchParams();
|
|
8
|
+
for (const name in a) {
|
|
9
|
+
const value = a[name];
|
|
10
|
+
if (value != null && value !== "") params.set(name, String(value).slice(0, 300));
|
|
11
|
+
}
|
|
12
|
+
const query = params.toString();
|
|
13
|
+
if (query) url += "?" + query;
|
|
14
|
+
}
|
|
15
|
+
return url;
|
|
16
|
+
}
|
|
17
|
+
const OgygiaError = function(code, a) {
|
|
18
|
+
const own = runtime();
|
|
19
|
+
return own ? new own.OgygiaError(code, a) : Object.assign(new Error(link(code, a)), { code });
|
|
20
|
+
};
|
|
21
|
+
const warn = ((code, ...rest) => {
|
|
22
|
+
const own = runtime();
|
|
23
|
+
if (own) own.warn(code, ...rest);
|
|
24
|
+
else {
|
|
25
|
+
const first = rest[0];
|
|
26
|
+
const proto = first !== null && typeof first === "object" ? Object.getPrototypeOf(first) : 0;
|
|
27
|
+
console.warn(link(code, proto === Object.prototype || proto === null ? first : void 0));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const line = ((code, a) => {
|
|
31
|
+
const own = runtime();
|
|
32
|
+
return own ? own.line(code, a) : link(code, a);
|
|
33
|
+
});
|
|
34
|
+
export { OgygiaError, line, warn };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { slots } from "../runtime/slots.js";
|
|
2
|
+
// src/messages/lazy.ts
|
|
3
|
+
/**
|
|
4
|
+
* `OgygiaError` and `warn` for the runtime's lazy chunks (the hydrate core, the router's navigation)
|
|
5
|
+
* and what only they import. A lazy chunk never imports a boot module — one both import is split
|
|
6
|
+
* into a chunk of its own — so these are the boot's own (./core.ts), reached through the boot link;
|
|
7
|
+
* where no boot linked them (the server's render of the same module, a test), the copy the server's
|
|
8
|
+
* handle publishes (./island.ts), else the code's link alone. Same calls:
|
|
9
|
+
* `throw new OgygiaError(code, args)`, `warn(code, args, ...rest)`.
|
|
10
|
+
*/
|
|
11
|
+
const own = () => slots.boot ?? globalThis[Symbol.for("ogygia.messages")];
|
|
12
|
+
const link = (code) => "[ogygia] https://ogygiajs.dev/e/" + code;
|
|
13
|
+
const OgygiaError = function(code, a) {
|
|
14
|
+
const m = own();
|
|
15
|
+
return m ? new m.OgygiaError(code, a) : Object.assign(new Error(link(code)), { code });
|
|
16
|
+
};
|
|
17
|
+
const warn = ((code, ...rest) => {
|
|
18
|
+
const m = own();
|
|
19
|
+
if (m) m.warn(code, ...rest);
|
|
20
|
+
else console.warn(link(code));
|
|
21
|
+
});
|
|
22
|
+
export { OgygiaError, warn };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write a message as it reads: an indented paragraph in the source, one line in the console.
|
|
3
|
+
*
|
|
4
|
+
* prose`
|
|
5
|
+
* island "${a.entry}" was edited while it slept, so its server HTML
|
|
6
|
+
* was put back and hydrated.
|
|
7
|
+
*
|
|
8
|
+
* ${a.drift && `What drifted: ${a.drift}`}
|
|
9
|
+
* `
|
|
10
|
+
*
|
|
11
|
+
* The indentation goes, the lines of a paragraph join with a space, a blank line starts a new one
|
|
12
|
+
* (`\n`), and a paragraph left empty (a value that is `''`, `false`, `null`) is dropped. Values go in
|
|
13
|
+
* as they are. Dev only: it runs inside a message table, which a production build drops.
|
|
14
|
+
*/
|
|
15
|
+
export declare function prose(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/messages/prose.ts
|
|
2
|
+
/**
|
|
3
|
+
* Write a message as it reads: an indented paragraph in the source, one line in the console.
|
|
4
|
+
*
|
|
5
|
+
* prose`
|
|
6
|
+
* island "${a.entry}" was edited while it slept, so its server HTML
|
|
7
|
+
* was put back and hydrated.
|
|
8
|
+
*
|
|
9
|
+
* ${a.drift && `What drifted: ${a.drift}`}
|
|
10
|
+
* `
|
|
11
|
+
*
|
|
12
|
+
* The indentation goes, the lines of a paragraph join with a space, a blank line starts a new one
|
|
13
|
+
* (`\n`), and a paragraph left empty (a value that is `''`, `false`, `null`) is dropped. Values go in
|
|
14
|
+
* as they are. Dev only: it runs inside a message table, which a production build drops.
|
|
15
|
+
*/
|
|
16
|
+
function prose(strings, ...values) {
|
|
17
|
+
const paragraphs = [];
|
|
18
|
+
let current = "";
|
|
19
|
+
const end_paragraph = () => {
|
|
20
|
+
const text = current.trim();
|
|
21
|
+
if (text) paragraphs.push(text);
|
|
22
|
+
current = "";
|
|
23
|
+
};
|
|
24
|
+
strings.forEach((part, i) => {
|
|
25
|
+
const lines = part.split("\n");
|
|
26
|
+
const last = lines.length - 1;
|
|
27
|
+
lines.forEach((line, j) => {
|
|
28
|
+
if (j > 0) {
|
|
29
|
+
if (line.trim() === "" && j < last) end_paragraph();
|
|
30
|
+
else current += " ";
|
|
31
|
+
}
|
|
32
|
+
const text = j === 0 ? line : line.trimStart();
|
|
33
|
+
current += j === last ? text : text.trimEnd();
|
|
34
|
+
});
|
|
35
|
+
if (i < values.length) {
|
|
36
|
+
const value = values[i];
|
|
37
|
+
if (value !== null && value !== void 0 && value !== false) current += String(value);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
end_paragraph();
|
|
41
|
+
return paragraphs.join("\n");
|
|
42
|
+
}
|
|
43
|
+
export { prose };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { MessagesOf } from "./define.js";
|
|
2
|
+
/** The errors: `throw new OgygiaError(code, args)`, or `console.error(new OgygiaError(…))`. */
|
|
3
|
+
export declare const SERVER_ERRORS: {
|
|
4
|
+
handle_secret_too_short: {
|
|
5
|
+
text: (a: {
|
|
6
|
+
min: number;
|
|
7
|
+
}) => string;
|
|
8
|
+
details: () => string;
|
|
9
|
+
};
|
|
10
|
+
secret_conflict: {
|
|
11
|
+
text: (a: {
|
|
12
|
+
key: string;
|
|
13
|
+
decided: string;
|
|
14
|
+
from: string;
|
|
15
|
+
}) => string;
|
|
16
|
+
details: () => string;
|
|
17
|
+
};
|
|
18
|
+
secret_missing_at_runtime: {
|
|
19
|
+
text: () => string;
|
|
20
|
+
details: () => string;
|
|
21
|
+
};
|
|
22
|
+
hole_props_too_large: {
|
|
23
|
+
text: (a: {
|
|
24
|
+
entry: string;
|
|
25
|
+
length: number;
|
|
26
|
+
max: number;
|
|
27
|
+
}) => string;
|
|
28
|
+
details: () => string;
|
|
29
|
+
};
|
|
30
|
+
prop_not_serializable: {
|
|
31
|
+
text: (a: {
|
|
32
|
+
entry: string;
|
|
33
|
+
detail: string;
|
|
34
|
+
}) => string;
|
|
35
|
+
details: () => string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** The warnings: `warn(code, args, ...rest)`. */
|
|
39
|
+
export declare const SERVER_WARNINGS: {
|
|
40
|
+
region_render_failed: {
|
|
41
|
+
text: () => string;
|
|
42
|
+
details: () => string;
|
|
43
|
+
};
|
|
44
|
+
region_render_abandoned: {
|
|
45
|
+
text: (a: {
|
|
46
|
+
ms: number;
|
|
47
|
+
}) => string;
|
|
48
|
+
details: () => string;
|
|
49
|
+
};
|
|
50
|
+
endpoint_props_decode_failed: {
|
|
51
|
+
text: () => string;
|
|
52
|
+
details: () => string;
|
|
53
|
+
};
|
|
54
|
+
endpoint_foreign_key: {
|
|
55
|
+
text: (a: {
|
|
56
|
+
id: string;
|
|
57
|
+
key: string;
|
|
58
|
+
own: string;
|
|
59
|
+
}) => string;
|
|
60
|
+
details: () => string;
|
|
61
|
+
};
|
|
62
|
+
endpoint_bad_signature: {
|
|
63
|
+
text: (a: {
|
|
64
|
+
id: string;
|
|
65
|
+
}) => string;
|
|
66
|
+
details: () => string;
|
|
67
|
+
};
|
|
68
|
+
endpoint_unknown_id: {
|
|
69
|
+
text: (a: {
|
|
70
|
+
id: string;
|
|
71
|
+
component?: string;
|
|
72
|
+
known: number;
|
|
73
|
+
}) => string;
|
|
74
|
+
details: () => string;
|
|
75
|
+
};
|
|
76
|
+
live_props_not_serializable: {
|
|
77
|
+
text: (a: {
|
|
78
|
+
entry: string;
|
|
79
|
+
max: number;
|
|
80
|
+
}) => string;
|
|
81
|
+
details: () => string;
|
|
82
|
+
};
|
|
83
|
+
build_key_prerender: {
|
|
84
|
+
text: () => string;
|
|
85
|
+
details: () => string;
|
|
86
|
+
};
|
|
87
|
+
secret_missing: {
|
|
88
|
+
text: () => string;
|
|
89
|
+
details: () => string;
|
|
90
|
+
};
|
|
91
|
+
outside_page_data_unavailable: {
|
|
92
|
+
text: (a: {
|
|
93
|
+
path: string;
|
|
94
|
+
miss: string;
|
|
95
|
+
}) => string;
|
|
96
|
+
details: () => string;
|
|
97
|
+
};
|
|
98
|
+
outside_page_data_key: {
|
|
99
|
+
text: (a: {
|
|
100
|
+
path: string;
|
|
101
|
+
key: string;
|
|
102
|
+
}) => string;
|
|
103
|
+
details: () => string;
|
|
104
|
+
};
|
|
105
|
+
router_css_inactive: {
|
|
106
|
+
text: () => string;
|
|
107
|
+
details: () => string;
|
|
108
|
+
};
|
|
109
|
+
plugin_hook_failed: {
|
|
110
|
+
text: (a: {
|
|
111
|
+
name: string;
|
|
112
|
+
}) => string;
|
|
113
|
+
details: () => string;
|
|
114
|
+
};
|
|
115
|
+
personal_response_unmarked: {
|
|
116
|
+
text: (a: {
|
|
117
|
+
status: number;
|
|
118
|
+
}) => string;
|
|
119
|
+
details: () => string;
|
|
120
|
+
};
|
|
121
|
+
request_cleanup_failed: {
|
|
122
|
+
text: () => string;
|
|
123
|
+
details: () => string;
|
|
124
|
+
};
|
|
125
|
+
rule_request_scope_open: {
|
|
126
|
+
text: (a: {
|
|
127
|
+
detail: string;
|
|
128
|
+
}) => string;
|
|
129
|
+
details: () => string;
|
|
130
|
+
};
|
|
131
|
+
rule_flight_kept_failure: {
|
|
132
|
+
text: (a: {
|
|
133
|
+
detail: string;
|
|
134
|
+
}) => string;
|
|
135
|
+
details: () => string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
type Server = MessagesOf<typeof SERVER_ERRORS, typeof SERVER_WARNINGS>;
|
|
139
|
+
export declare const OgygiaError: Server["OgygiaError"];
|
|
140
|
+
export declare const warn: Server["warn"];
|
|
141
|
+
export declare const line: Server["line"];
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { define_messages, dev_or_prerender } from "./define.js";
|
|
2
|
+
import { prose } from "./prose.js";
|
|
3
|
+
// src/messages/server.ts
|
|
4
|
+
/**
|
|
5
|
+
* EVERY MESSAGE OGYGIA'S SERVER PRINTS — the handle, the islands endpoint, region capabilities, the
|
|
6
|
+
* page a render outside Kit reads: their code, their wording, what to do about them. Same calls as
|
|
7
|
+
* the runtime's (./core.ts): the wording and the code's page in dev and while prerendering; a
|
|
8
|
+
* production server prints the page's link alone.
|
|
9
|
+
*
|
|
10
|
+
* throw new OgygiaError('handle_secret_too_short', { min });
|
|
11
|
+
* warn('endpoint_bad_signature', { id });
|
|
12
|
+
*/
|
|
13
|
+
const SECRET_FIX = "Set a stable `OGYGIA_SECRET` in the server environment, or pass one to `handle({ secret })`.";
|
|
14
|
+
/** The errors: `throw new OgygiaError(code, args)`, or `console.error(new OgygiaError(…))`. */
|
|
15
|
+
const SERVER_ERRORS = {
|
|
16
|
+
handle_secret_too_short: {
|
|
17
|
+
text: (a) => `handle({ secret }) is too short for production (need ≥${a.min} UTF-8 bytes).`,
|
|
18
|
+
details: () => prose`
|
|
19
|
+
A production build signs region capabilities with the secret passed to
|
|
20
|
+
\`handle({ secret })\`, and a short one can be guessed. Use a random secret at least as long
|
|
21
|
+
as the message says, from the server's environment.
|
|
22
|
+
`
|
|
23
|
+
},
|
|
24
|
+
secret_conflict: {
|
|
25
|
+
text: (a) => prose`
|
|
26
|
+
handle({ secret }) names key ${a.key}, but this server already signs with key ${a.decided}
|
|
27
|
+
(from ${a.from}). The first key stays: pass one secret, before anything renders.
|
|
28
|
+
`,
|
|
29
|
+
details: () => prose`
|
|
30
|
+
The server decides its signing key once, the first time it mints or verifies a region
|
|
31
|
+
capability. A second, different secret arrived after that, and is ignored: every
|
|
32
|
+
capability keeps verifying with the first key.
|
|
33
|
+
|
|
34
|
+
Pass one secret, to the one \`handle()\`, before anything renders.
|
|
35
|
+
`
|
|
36
|
+
},
|
|
37
|
+
secret_missing_at_runtime: {
|
|
38
|
+
text: () => prose`
|
|
39
|
+
OGYGIA_SECRET was set when this app was built but is not set where it runs: region
|
|
40
|
+
capabilities are signed with this build's random key, so every hole minted by another
|
|
41
|
+
deployment (another backend behind the same CDN, the previous deploy) is refused (403,
|
|
42
|
+
x-ogygia-deny: foreign-key). Set OGYGIA_SECRET in the server's runtime environment, or pass
|
|
43
|
+
it to handle({ secret }) (e.g. from $env/static/private).
|
|
44
|
+
`,
|
|
45
|
+
details: () => prose`
|
|
46
|
+
The build saw \`OGYGIA_SECRET\` but the running server does not, so it signs with a random
|
|
47
|
+
key of its own. A page from another deployment carries capabilities signed with another
|
|
48
|
+
key, and the islands endpoint refuses them (\`x-ogygia-deny: foreign-key\`).
|
|
49
|
+
|
|
50
|
+
${SECRET_FIX}
|
|
51
|
+
`
|
|
52
|
+
},
|
|
53
|
+
hole_props_too_large: {
|
|
54
|
+
text: (a) => prose`
|
|
55
|
+
server island "${a.entry}": props payload is ${a.length} b64 chars (max ${a.max}). Shrink
|
|
56
|
+
what you pass into the deferred region — the handle would reject this capability anyway.
|
|
57
|
+
`,
|
|
58
|
+
details: () => prose`
|
|
59
|
+
A deferred region's props travel inside its signed address, so they have a size limit.
|
|
60
|
+
Pass less: an id the region looks up on the server instead of the record itself.
|
|
61
|
+
`
|
|
62
|
+
},
|
|
63
|
+
prop_not_serializable: {
|
|
64
|
+
text: (a) => prose`
|
|
65
|
+
island "${a.entry}": a captured prop is not serializable — ${a.detail}. Captured host values
|
|
66
|
+
cross the boundary via devalue; functions/Promises cannot, and a class instance only can
|
|
67
|
+
when the class declares a static [ogygia.wire] codec. Pass a serializable value, add a
|
|
68
|
+
codec, or move that logic inside the island component.
|
|
69
|
+
`,
|
|
70
|
+
details: () => prose`
|
|
71
|
+
An island's props are serialized into the page so the browser can hydrate it. Functions
|
|
72
|
+
and promises cannot be serialized, and a class instance can only when its class declares
|
|
73
|
+
a wire codec.
|
|
74
|
+
|
|
75
|
+
Pass plain data, give the class a codec, or move the logic inside the island.
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/** The warnings: `warn(code, args, ...rest)`. */
|
|
80
|
+
const SERVER_WARNINGS = {
|
|
81
|
+
region_render_failed: {
|
|
82
|
+
text: () => "region render failed:",
|
|
83
|
+
details: () => prose`
|
|
84
|
+
Dev only. A region's server render threw, so the islands endpoint answered 500 and the page
|
|
85
|
+
keeps the region's fallback. The error follows the message.
|
|
86
|
+
`
|
|
87
|
+
},
|
|
88
|
+
region_render_abandoned: {
|
|
89
|
+
text: (a) => `a region render ran past ${a.ms} ms and was abandoned: its hole kept its fallback`,
|
|
90
|
+
details: () => prose`
|
|
91
|
+
A hole's render did not finish within its deadline, so the islands endpoint answered with
|
|
92
|
+
the fallback and gave the render's slot to the next hole. The render still runs (a render
|
|
93
|
+
cannot be cancelled) until what it awaits ends. Renders that outlive their deadline usually
|
|
94
|
+
await an upstream that hangs: give that fetch a timeout of its own. Said once each time a
|
|
95
|
+
render is abandoned while no other is.
|
|
96
|
+
`
|
|
97
|
+
},
|
|
98
|
+
endpoint_props_decode_failed: {
|
|
99
|
+
text: () => "region endpoint 403: island module load / props decode failed",
|
|
100
|
+
details: () => prose`
|
|
101
|
+
Dev only. The islands endpoint could not load the region's module, or could not decode
|
|
102
|
+
the props in its address, so it refused the request. The error follows the message.
|
|
103
|
+
`
|
|
104
|
+
},
|
|
105
|
+
endpoint_foreign_key: {
|
|
106
|
+
text: (a) => `region endpoint 403: id "${a.id}" was signed by key ${a.key}, this server signs with ${a.own}`,
|
|
107
|
+
details: () => prose`
|
|
108
|
+
Dev only. The region's address was signed by another deployment's key. Route the islands
|
|
109
|
+
endpoint to the deployment that served the page, or give every deployment the same
|
|
110
|
+
\`OGYGIA_SECRET\`.
|
|
111
|
+
`
|
|
112
|
+
},
|
|
113
|
+
endpoint_bad_signature: {
|
|
114
|
+
text: (a) => `region endpoint 403: bad signature for id "${a.id}"`,
|
|
115
|
+
details: () => prose`
|
|
116
|
+
Dev only. The region's address does not carry a valid signature: it was edited, or
|
|
117
|
+
truncated on the way. The endpoint refuses it.
|
|
118
|
+
`
|
|
119
|
+
},
|
|
120
|
+
endpoint_unknown_id: {
|
|
121
|
+
text: (a) => `region endpoint 403: id "${a.id}"${a.component ? ` (component ${a.component})` : ""} is not in the server manifest (${a.known} known)`,
|
|
122
|
+
details: () => prose`
|
|
123
|
+
Dev only. The address names a region this server's build does not have: the page came
|
|
124
|
+
from another build, or the region was renamed. After a deploy the page reloads its
|
|
125
|
+
regions from the current build.
|
|
126
|
+
`
|
|
127
|
+
},
|
|
128
|
+
live_props_not_serializable: {
|
|
129
|
+
text: (a) => prose`
|
|
130
|
+
render:'live' region ${a.entry} has props that cannot cross the wire (non-serializable or
|
|
131
|
+
>${a.max} b64 chars) — no revalidate endpoint minted (behaves like a static lake).
|
|
132
|
+
`,
|
|
133
|
+
details: () => prose`
|
|
134
|
+
A live region refreshes from a signed address that carries its props. These props cannot
|
|
135
|
+
be serialized, or are too large, so the region gets no address and never refreshes. Pass
|
|
136
|
+
plain, small props.
|
|
137
|
+
`
|
|
138
|
+
},
|
|
139
|
+
build_key_prerender: {
|
|
140
|
+
text: () => prose`
|
|
141
|
+
prerendered page mints region capabilities signed with a per-build random key — they stop
|
|
142
|
+
verifying after your next deploy while the static HTML lives on. Set a stable
|
|
143
|
+
OGYGIA_SECRET env var (or pass it to handle({ secret })) so prerendered holes survive
|
|
144
|
+
redeploys.
|
|
145
|
+
`,
|
|
146
|
+
details: () => prose`
|
|
147
|
+
A prerendered page keeps the addresses of its holes in static HTML. Signed with a random
|
|
148
|
+
per-build key, they stop verifying after the next deploy. ${SECRET_FIX}
|
|
149
|
+
`
|
|
150
|
+
},
|
|
151
|
+
secret_missing: {
|
|
152
|
+
text: () => prose`
|
|
153
|
+
OGYGIA_SECRET is not set: region capabilities are signed with this build's random key, so
|
|
154
|
+
a page cached across a deploy, or served by another deployment than its islands endpoint,
|
|
155
|
+
gets its holes refused (403, x-ogygia-deny: foreign-key). Set a stable OGYGIA_SECRET, or
|
|
156
|
+
pass one to handle({ secret }).
|
|
157
|
+
`,
|
|
158
|
+
details: () => prose`
|
|
159
|
+
Without a secret, each deployment signs with its own random key. A page cached across a
|
|
160
|
+
deploy, or served by one backend while another answers its islands endpoint, gets its holes
|
|
161
|
+
refused. ${SECRET_FIX}
|
|
162
|
+
`
|
|
163
|
+
},
|
|
164
|
+
outside_page_data_unavailable: {
|
|
165
|
+
text: (a) => `${a.path}: the page's data for a render outside it is unavailable: ${a.miss}. The render sees an empty page.data.`,
|
|
166
|
+
details: () => prose`
|
|
167
|
+
A region rendered outside its page (an islands endpoint request) reads that page's
|
|
168
|
+
\`page.data\`, which ogygia looks up from the page. The lookup failed for the reason given,
|
|
169
|
+
so the region rendered with an empty \`page.data\`.
|
|
170
|
+
`
|
|
171
|
+
},
|
|
172
|
+
outside_page_data_key: {
|
|
173
|
+
text: (a) => prose`
|
|
174
|
+
${a.path}: a region rendered outside its page read page.data.${a.key}, which this page's
|
|
175
|
+
server loads do not produce. A key a universal load (+page.ts / +layout.ts) returns exists
|
|
176
|
+
only inside a full page render: return it from a server load, or pass it as a prop.
|
|
177
|
+
`,
|
|
178
|
+
details: () => prose`
|
|
179
|
+
Outside a full page render only the server loads run. A key a universal load returns
|
|
180
|
+
(\`+page.ts\`, \`+layout.ts\`) is missing there. Return it from a server load, or pass it
|
|
181
|
+
to the region as a prop.
|
|
182
|
+
`
|
|
183
|
+
},
|
|
184
|
+
router_css_inactive: {
|
|
185
|
+
text: () => prose`
|
|
186
|
+
a page rendered outside Kit's routes, but no plugin declared page modules, so its
|
|
187
|
+
components' CSS is not linked. Using \`@ogygia/router\`? List \`router()\` from
|
|
188
|
+
\`@ogygia/router/vite\` beside \`ogygia()\` in vite.config \`plugins\`.
|
|
189
|
+
`,
|
|
190
|
+
details: () => prose`
|
|
191
|
+
Dev only. A page rendered outside Kit's routes needs a plugin to name its modules so their
|
|
192
|
+
CSS can be linked. With \`@ogygia/router\`, add \`router()\` from \`@ogygia/router/vite\` to
|
|
193
|
+
the Vite plugins.
|
|
194
|
+
`
|
|
195
|
+
},
|
|
196
|
+
plugin_hook_failed: {
|
|
197
|
+
text: (a) => `a \`${a.name}\` hook failed —`,
|
|
198
|
+
details: () => prose`
|
|
199
|
+
A plugin's hook threw. ogygia logs it and goes on with the next plugin. The error follows
|
|
200
|
+
the message.
|
|
201
|
+
`
|
|
202
|
+
},
|
|
203
|
+
personal_response_unmarked: {
|
|
204
|
+
text: (a) => prose`
|
|
205
|
+
a page made for one browser (status ${a.status}) could not be marked private: its headers
|
|
206
|
+
cannot be changed —
|
|
207
|
+
`,
|
|
208
|
+
details: () => prose`
|
|
209
|
+
A page that carries something for one browser (its devtools events, the profiler's beacon,
|
|
210
|
+
the devtools switch's cookie) is marked \`cache-control: private, no-store\` so no shared
|
|
211
|
+
cache keeps it. This response's headers cannot be changed (a Response from \`fetch()\`, or
|
|
212
|
+
\`Response.redirect()\`, handed back as it is), so it goes out with the headers it has, and a
|
|
213
|
+
shared cache could keep it. The error follows the message. Return a new Response
|
|
214
|
+
(\`new Response(res.body, res)\`) from the hook or route that made it.
|
|
215
|
+
`
|
|
216
|
+
},
|
|
217
|
+
request_cleanup_failed: {
|
|
218
|
+
text: () => `a cleanup at the end of a request failed —`,
|
|
219
|
+
details: () => prose`
|
|
220
|
+
Work a request started (a timer, a stream, a fetch) is let go when its response ends or
|
|
221
|
+
its visitor leaves. One of those cleanups threw. The response was not affected. The error
|
|
222
|
+
follows the message.
|
|
223
|
+
`
|
|
224
|
+
},
|
|
225
|
+
rule_request_scope_open: {
|
|
226
|
+
text: (a) => `rule broken, a request's work ends with its response: ${a.detail}`,
|
|
227
|
+
details: () => prose`
|
|
228
|
+
Dev and e2e builds only (a rule ogygia checks on itself). The work a request starts (its
|
|
229
|
+
timers, streams, fetches) is let go once its response ends. A response ended with its
|
|
230
|
+
request's work still held, which leaks with every request: an ogygia bug, please report it.
|
|
231
|
+
`
|
|
232
|
+
},
|
|
233
|
+
rule_flight_kept_failure: {
|
|
234
|
+
text: (a) => `rule broken, no shared work keeps a failure: ${a.detail}`,
|
|
235
|
+
details: () => prose`
|
|
236
|
+
Dev and e2e builds only (a rule ogygia checks on itself). Shared work (a render, a fetch
|
|
237
|
+
that callers join) keeps its answer for the next caller, but never a failure: the next
|
|
238
|
+
caller tries again. One kept an error as its answer, so every later caller gets it.
|
|
239
|
+
`
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const server = /* @__PURE__ */ define_messages(import.meta.env?.DEV || import.meta.env?.SSR ? SERVER_ERRORS : null, import.meta.env?.DEV || import.meta.env?.SSR ? SERVER_WARNINGS : null, dev_or_prerender);
|
|
243
|
+
const OgygiaError = server.OgygiaError;
|
|
244
|
+
const warn = server.warn;
|
|
245
|
+
const line = server.line;
|
|
246
|
+
export { OgygiaError, SERVER_ERRORS, SERVER_WARNINGS, line, warn };
|
package/dist/nested.d.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* hydrates again (the nearest-boundary rule — DESIGN.md).
|
|
5
5
|
*/
|
|
6
6
|
export declare function setNested(value?: boolean): void;
|
|
7
|
+
/** The context an island is hydrated with: `base` (a `<Provide>` above it), marked "inside an
|
|
8
|
+
* island" — what a wrapper's `setNested()` gave its children, with no wrapper in the tree. */
|
|
9
|
+
export declare function nested_context(base?: Map<unknown, unknown> | null): Map<unknown, unknown>;
|
|
7
10
|
/**
|
|
8
11
|
* True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
|
|
9
12
|
* when no ancestor set it (a top-level island) — that absence is exactly "not nested".
|
package/dist/nested.js
CHANGED
|
@@ -9,6 +9,13 @@ const NESTED_KEY = Symbol.for("ogygia.nested-island");
|
|
|
9
9
|
function setNested(value = true) {
|
|
10
10
|
setContext(NESTED_KEY, value);
|
|
11
11
|
}
|
|
12
|
+
/** The context an island is hydrated with: `base` (a `<Provide>` above it), marked "inside an
|
|
13
|
+
* island" — what a wrapper's `setNested()` gave its children, with no wrapper in the tree. */
|
|
14
|
+
function nested_context(base) {
|
|
15
|
+
const context = new Map(base ?? void 0);
|
|
16
|
+
context.set(NESTED_KEY, true);
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
|
|
14
21
|
* when no ancestor set it (a top-level island) — that absence is exactly "not nested".
|
|
@@ -16,4 +23,4 @@ function setNested(value = true) {
|
|
|
16
23
|
function isNested() {
|
|
17
24
|
return getContext(NESTED_KEY) === true;
|
|
18
25
|
}
|
|
19
|
-
export { isNested, setNested };
|
|
26
|
+
export { isNested, nested_context, setNested };
|