@ogygia/core 0.12.3 → 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 +17 -10
- 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.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
package/dist/vite/paths.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** This package's root (the plugin runs from `dist/vite/`, so `../..` is the package root). A NATIVE
|
|
2
2
|
* path (backslashes on Windows): for the file system, never to compare against a module id. */
|
|
3
3
|
export declare const PKG_ROOT: string;
|
|
4
|
+
/** This package's version, as installed (the runtime discloses it: runtime/disclose-version.ts). */
|
|
5
|
+
export declare const OGYGIA_VERSION: string;
|
|
4
6
|
/** A native path as Vite writes module ids: symlinks resolved (pnpm), forward slashes (Windows). */
|
|
5
7
|
export declare function real_posix(p: string): string;
|
|
6
8
|
/** A native directory as the PREFIX of the module ids inside it: `real_posix` + one trailing `/`, so a
|
package/dist/vite/paths.js
CHANGED
|
@@ -12,6 +12,8 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
/** This package's root (the plugin runs from `dist/vite/`, so `../..` is the package root). A NATIVE
|
|
13
13
|
* path (backslashes on Windows): for the file system, never to compare against a module id. */
|
|
14
14
|
const PKG_ROOT = fileURLToPath(new URL("../..", import.meta.url));
|
|
15
|
+
/** This package's version, as installed (the runtime discloses it: runtime/disclose-version.ts). */
|
|
16
|
+
const OGYGIA_VERSION = JSON.parse(fs.readFileSync(path.join(PKG_ROOT, "package.json"), "utf8")).version;
|
|
15
17
|
/** Windows separators → posix. */
|
|
16
18
|
const WIN_SEP_RE = /\\/g;
|
|
17
19
|
/** A native path as Vite writes module ids: symlinks resolved (pnpm), forward slashes (Windows). */
|
|
@@ -93,9 +95,7 @@ function runtime_content_hash() {
|
|
|
93
95
|
fileURLToPath(new URL("../keep-fallback-marker.js", import.meta.url)),
|
|
94
96
|
fileURLToPath(new URL("../shims/page-store.svelte.js", import.meta.url)),
|
|
95
97
|
fileURLToPath(new URL("../shims/kit-remote/client-stub.js", import.meta.url)),
|
|
96
|
-
fileURLToPath(new URL("../
|
|
97
|
-
fileURLToPath(new URL("../LiveHost.svelte", import.meta.url)),
|
|
98
|
-
fileURLToPath(new URL("../KeepHost.svelte", import.meta.url))
|
|
98
|
+
fileURLToPath(new URL("../nested.js", import.meta.url))
|
|
99
99
|
];
|
|
100
100
|
try {
|
|
101
101
|
const rt_dir = fileURLToPath(new URL("../runtime", import.meta.url));
|
|
@@ -109,4 +109,4 @@ function runtime_content_hash() {
|
|
|
109
109
|
}
|
|
110
110
|
/** The runtime chunk's source-content hash (the immutable-filename base; feature hash rides on top). */
|
|
111
111
|
const RUNTIME_HASH = runtime_content_hash();
|
|
112
|
-
export { APP_SHIMS, CLIENT_BINDING_STUB_FILE, HMAC_MODULE, KIT_REMOTE_CLIENT, KIT_REMOTE_STATE, OGYGIA_INJECTED_FILES, OGYGIA_INJECTED_IMPORTS, OGYGIA_REGION_MODULES, PKG_ROOT, PKG_ROOT_ID, REGION_ENDPOINT_MODULE, RUNTIME_DIR, RUNTIME_HASH, STUB_CLIENT, STUB_PATHS, STUB_STATE, id_dir, real_posix, scan_entry_pattern };
|
|
112
|
+
export { APP_SHIMS, CLIENT_BINDING_STUB_FILE, HMAC_MODULE, KIT_REMOTE_CLIENT, KIT_REMOTE_STATE, OGYGIA_INJECTED_FILES, OGYGIA_INJECTED_IMPORTS, OGYGIA_REGION_MODULES, OGYGIA_VERSION, PKG_ROOT, PKG_ROOT_ID, REGION_ENDPOINT_MODULE, RUNTIME_DIR, RUNTIME_HASH, STUB_CLIENT, STUB_PATHS, STUB_STATE, id_dir, real_posix, scan_entry_pattern };
|
package/dist/vite/plugin-api.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OgygiaError } from "../messages/build.js";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
@@ -34,7 +35,7 @@ function definePlugin(definition) {
|
|
|
34
35
|
name: definition.name,
|
|
35
36
|
[PLUGIN]: definition,
|
|
36
37
|
configResolved(config) {
|
|
37
|
-
if (!config.plugins.some((p) => p.name === OGYGIA_VITE_PLUGIN)) throw new
|
|
38
|
+
if (!config.plugins.some((p) => p.name === OGYGIA_VITE_PLUGIN)) throw new OgygiaError("plugin_without_ogygia", { plugin: definition.name });
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
}
|
|
@@ -53,13 +54,13 @@ async function find_plugins(list) {
|
|
|
53
54
|
for (const item of value) await walk(item);
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
if (typeof value === "function") throw new
|
|
57
|
+
if (typeof value === "function") throw new OgygiaError("plugin_factory_not_called");
|
|
57
58
|
const plugin = value;
|
|
58
59
|
const name = typeof plugin?.name === "string" ? plugin.name : "";
|
|
59
60
|
const definition = plugin?.[PLUGIN];
|
|
60
61
|
if (name.startsWith(KIT_VITE_PLUGIN_PREFIX)) kit_seen = true;
|
|
61
62
|
const own = name === OGYGIA_VITE_PLUGIN;
|
|
62
|
-
if ((own || definition) && kit_seen) throw new
|
|
63
|
+
if ((own || definition) && kit_seen) throw new OgygiaError("plugin_after_sveltekit", { plugin: own ? "ogygia()" : String(definition?.name) });
|
|
63
64
|
if (definition) found.push(definition);
|
|
64
65
|
};
|
|
65
66
|
await walk(list);
|
|
@@ -90,14 +91,17 @@ function check_plugins(plugins) {
|
|
|
90
91
|
const seen = /* @__PURE__ */ new Set();
|
|
91
92
|
for (const p of plugins) {
|
|
92
93
|
const plugin = p;
|
|
93
|
-
if (!plugin || typeof plugin !== "object" || typeof plugin.name !== "string" || plugin.name === "") throw new
|
|
94
|
-
if (seen.has(plugin.name)) throw new
|
|
94
|
+
if (!plugin || typeof plugin !== "object" || typeof plugin.name !== "string" || plugin.name === "") throw new OgygiaError("plugin_name_missing");
|
|
95
|
+
if (seen.has(plugin.name)) throw new OgygiaError("plugin_listed_twice", { plugin: plugin.name });
|
|
95
96
|
seen.add(plugin.name);
|
|
96
|
-
for (const realm of ["server", "client"]) if (plugin[realm] !== void 0 && typeof plugin[realm] !== "string") throw new
|
|
97
|
+
for (const realm of ["server", "client"]) if (plugin[realm] !== void 0 && typeof plugin[realm] !== "string") throw new OgygiaError("plugin_realm_not_location", {
|
|
98
|
+
plugin: plugin.name,
|
|
99
|
+
realm
|
|
100
|
+
});
|
|
97
101
|
if (plugin.options !== void 0) try {
|
|
98
102
|
JSON.stringify(plugin.options);
|
|
99
103
|
} catch {
|
|
100
|
-
throw new
|
|
104
|
+
throw new OgygiaError("plugin_options_not_json", { plugin: plugin.name });
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
return plugins;
|
|
@@ -108,7 +112,11 @@ function realm_path(plugin, realm) {
|
|
|
108
112
|
const where = plugin[realm];
|
|
109
113
|
if (where === void 0) return null;
|
|
110
114
|
const abs = where.startsWith("file:") ? fileURLToPath(where) : where;
|
|
111
|
-
if (!path.isAbsolute(abs) || !fs.existsSync(abs)) throw new
|
|
115
|
+
if (!path.isAbsolute(abs) || !fs.existsSync(abs)) throw new OgygiaError("plugin_realm_not_file", {
|
|
116
|
+
plugin: plugin.name,
|
|
117
|
+
realm,
|
|
118
|
+
location: where
|
|
119
|
+
});
|
|
112
120
|
return abs.split(path.sep).join("/");
|
|
113
121
|
}
|
|
114
122
|
function package_resolves(req, name) {
|
|
@@ -145,7 +153,10 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null) {
|
|
|
145
153
|
const config_owner = /* @__PURE__ */ new Map();
|
|
146
154
|
const macro_owner = /* @__PURE__ */ new Map();
|
|
147
155
|
for (const plugin of ordered) {
|
|
148
|
-
if (!package_resolves(req, plugin.name)) throw new
|
|
156
|
+
if (!package_resolves(req, plugin.name)) throw new OgygiaError("plugin_package_unresolved", {
|
|
157
|
+
plugin: plugin.name,
|
|
158
|
+
root
|
|
159
|
+
});
|
|
149
160
|
const server = realm_path(plugin, "server");
|
|
150
161
|
if (server) out.servers.push({
|
|
151
162
|
name: plugin.name,
|
|
@@ -158,9 +169,16 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null) {
|
|
|
158
169
|
root,
|
|
159
170
|
dev,
|
|
160
171
|
routeConfig(key) {
|
|
161
|
-
if (!ROUTE_CONFIG_KEY_RE.test(key)) throw new
|
|
172
|
+
if (!ROUTE_CONFIG_KEY_RE.test(key)) throw new OgygiaError("route_config_key_invalid", {
|
|
173
|
+
plugin: plugin.name,
|
|
174
|
+
key
|
|
175
|
+
});
|
|
162
176
|
const owner = config_owner.get(key);
|
|
163
|
-
if (owner && owner !== plugin.name) throw new
|
|
177
|
+
if (owner && owner !== plugin.name) throw new OgygiaError("route_config_key_claimed", {
|
|
178
|
+
key,
|
|
179
|
+
owner,
|
|
180
|
+
plugin: plugin.name
|
|
181
|
+
});
|
|
164
182
|
if (!owner) {
|
|
165
183
|
config_owner.set(key, plugin.name);
|
|
166
184
|
out.route_config.push(key);
|
|
@@ -170,9 +188,16 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null) {
|
|
|
170
188
|
out.foreign_hydrate = true;
|
|
171
189
|
},
|
|
172
190
|
macro(name, handler) {
|
|
173
|
-
if (!MACRO_NAME_RE.test(name) || CORE_MACROS.has(name)) throw new
|
|
191
|
+
if (!MACRO_NAME_RE.test(name) || CORE_MACROS.has(name)) throw new OgygiaError("plugin_macro_name_invalid", {
|
|
192
|
+
plugin: plugin.name,
|
|
193
|
+
name
|
|
194
|
+
});
|
|
174
195
|
const owner = macro_owner.get(name);
|
|
175
|
-
if (owner) throw new
|
|
196
|
+
if (owner) throw new OgygiaError("plugin_macro_claimed", {
|
|
197
|
+
name,
|
|
198
|
+
owner,
|
|
199
|
+
plugin: plugin.name
|
|
200
|
+
});
|
|
176
201
|
macro_owner.set(name, plugin.name);
|
|
177
202
|
out.macros.push({
|
|
178
203
|
name,
|
|
@@ -201,7 +226,10 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null) {
|
|
|
201
226
|
pageModules(modules) {
|
|
202
227
|
for (const spec of modules.importers ?? []) if (!out.page_modules.importers.includes(spec)) out.page_modules.importers.push(spec);
|
|
203
228
|
for (const file of modules.files ?? []) {
|
|
204
|
-
if (!path.isAbsolute(file)) throw new
|
|
229
|
+
if (!path.isAbsolute(file)) throw new OgygiaError("page_modules_not_absolute", {
|
|
230
|
+
plugin: plugin.name,
|
|
231
|
+
file
|
|
232
|
+
});
|
|
205
233
|
if (!out.page_modules.files.includes(file)) out.page_modules.files.push(file);
|
|
206
234
|
}
|
|
207
235
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warn } from "../messages/build.js";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
// src/vite/style-preprocess.ts
|
|
@@ -52,7 +53,7 @@ async function preprocess_component_for_css(source, abs, root) {
|
|
|
52
53
|
if (!compiler) {
|
|
53
54
|
if (!sass_warned) {
|
|
54
55
|
sass_warned = true;
|
|
55
|
-
|
|
56
|
+
warn("sass_missing");
|
|
56
57
|
}
|
|
57
58
|
} else out = out.replace(STYLE_BLOCK_G, (whole, attrs, body) => {
|
|
58
59
|
const lang = STYLE_LANG_ATTR.exec(attrs)?.[1]?.toLowerCase();
|
|
@@ -70,7 +71,10 @@ async function preprocess_component_for_css(source, abs, root) {
|
|
|
70
71
|
});
|
|
71
72
|
return `<style${attrs.replace(STYLE_LANG_ATTR, "")}>${css}</style>`;
|
|
72
73
|
} catch (err) {
|
|
73
|
-
|
|
74
|
+
warn("scss_compile_failed", {
|
|
75
|
+
file: path.relative(root, abs),
|
|
76
|
+
reason: err.message
|
|
77
|
+
});
|
|
74
78
|
return whole;
|
|
75
79
|
}
|
|
76
80
|
});
|
|
@@ -86,7 +90,10 @@ async function preprocess_component_for_css(source, abs, root) {
|
|
|
86
90
|
const { code } = await ts(body, abs + ".ts");
|
|
87
91
|
out = out.replace(whole, `<script${attrs}>${code}<\/script>`);
|
|
88
92
|
} catch (err) {
|
|
89
|
-
|
|
93
|
+
warn("ts_strip_failed", {
|
|
94
|
+
file: path.relative(root, abs),
|
|
95
|
+
reason: err.message
|
|
96
|
+
});
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogygia/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "The core of ogygia (SSR islands for SvelteKit): apps install `ogygia`, plugins build on this",
|
|
5
5
|
"homepage": "https://ogygiajs.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -58,6 +58,11 @@
|
|
|
58
58
|
"svelte": "./dist/internal-instruments.js",
|
|
59
59
|
"default": "./dist/internal-instruments.js"
|
|
60
60
|
},
|
|
61
|
+
"./internal/messages": {
|
|
62
|
+
"types": "./dist/messages/index.d.ts",
|
|
63
|
+
"svelte": "./dist/messages/index.js",
|
|
64
|
+
"default": "./dist/messages/index.js"
|
|
65
|
+
},
|
|
61
66
|
"./internal/register": {
|
|
62
67
|
"types": "./dist/internal-register.d.ts",
|
|
63
68
|
"svelte": "./dist/internal-register.js",
|
|
@@ -134,6 +139,7 @@
|
|
|
134
139
|
"access": "public"
|
|
135
140
|
},
|
|
136
141
|
"dependencies": {
|
|
142
|
+
"@ogygia/machine": "^0.13.0",
|
|
137
143
|
"devalue": "^5.9.3",
|
|
138
144
|
"esm-env": "^1.2.2",
|
|
139
145
|
"estree-walker": "^3.0.3",
|
|
@@ -141,6 +147,7 @@
|
|
|
141
147
|
"tinyglobby": "^0.2.17"
|
|
142
148
|
},
|
|
143
149
|
"devDependencies": {
|
|
150
|
+
"@ogygia/config": "0.0.0",
|
|
144
151
|
"@ogygia/tsdown-plugin-svelte": "1.1.1",
|
|
145
152
|
"@sveltejs/kit": "^2.70.2",
|
|
146
153
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
package/dist/KeepHost.svelte
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script>// Keep-alive host for a KEPT island (`keep:`): LiveHost's props-pushable host — the "inside an
|
|
2
|
-
// island" context, `$state` props, `setProps` so the next page's props reach the relocated island —
|
|
3
|
-
// in the SSR shape of a placed island (Region.svelte's `{#if Component}<Component {...props} />{/if}`,
|
|
4
|
-
// as NestedProvider mirrors it). LiveHost has no `{#if}`: it hydrates a live region's render()
|
|
5
|
-
// output, and a kept island hydrated through it met the server's `[0` branch marker where it
|
|
6
|
-
// expected the component's own, discarding the server DOM on every load. NOT part of the public API.
|
|
7
|
-
import { setNested } from "./nested.js";
|
|
8
|
-
let { component: Component, initialProps } = $props();
|
|
9
|
-
// Seed once from the incoming prop; later pages replace it via setProps(). Intentional initial read.
|
|
10
|
-
// svelte-ignore state_referenced_locally
|
|
11
|
-
let current = $state(initialProps);
|
|
12
|
-
/** Called by the runtime when the island crosses to the next page — reactive prop push. */
|
|
13
|
-
export function setProps(next) {
|
|
14
|
-
current = next;
|
|
15
|
-
}
|
|
16
|
-
setNested();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
{#if Component}<Component {...current} />{/if}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
component: SvelteComponent<Record<string, unknown>>;
|
|
4
|
-
initialProps: Record<string, unknown>;
|
|
5
|
-
};
|
|
6
|
-
declare const KeepHost: import("svelte").Component<$$ComponentProps, {
|
|
7
|
-
setProps: (next: Record<string, unknown>) => void;
|
|
8
|
-
}, "">;
|
|
9
|
-
type KeepHost = ReturnType<typeof KeepHost>;
|
|
10
|
-
export default KeepHost;
|
package/dist/LiveHost.svelte
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script>// Keep-alive host for an INTERACTIVE live region (`query.live` yielding `region(C, props)`
|
|
2
|
-
// with a wake schedule). Like NestedProvider, it sets the "inside an island" context and renders
|
|
3
|
-
// the component with no DOM of its own (so it hydrates the server render() output cleanly). Unlike
|
|
4
|
-
// NestedProvider, its props are `$state` and it exposes `setProps` — so a live tick updates the
|
|
5
|
-
// MOUNTED component reactively instead of tearing it down and re-hydrating. Focus and local island
|
|
6
|
-
// state survive; Svelte reconciles the view. NOT part of the public API.
|
|
7
|
-
import { setNested } from "./nested.js";
|
|
8
|
-
let { component: Component, initialProps } = $props();
|
|
9
|
-
// Seed once from the incoming prop; later ticks replace it via setProps(). Intentional initial read.
|
|
10
|
-
// svelte-ignore state_referenced_locally
|
|
11
|
-
let current = $state(initialProps);
|
|
12
|
-
/** Called by the runtime on each live tick with the same component — reactive prop push. */
|
|
13
|
-
export function setProps(next) {
|
|
14
|
-
current = next;
|
|
15
|
-
}
|
|
16
|
-
setNested();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<Component {...current} />
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
component: SvelteComponent<Record<string, unknown>>;
|
|
4
|
-
initialProps: Record<string, unknown>;
|
|
5
|
-
};
|
|
6
|
-
declare const LiveHost: import("svelte").Component<$$ComponentProps, {
|
|
7
|
-
setProps: (next: Record<string, unknown>) => void;
|
|
8
|
-
}, "">;
|
|
9
|
-
type LiveHost = ReturnType<typeof LiveHost>;
|
|
10
|
-
export default LiveHost;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<script>// Passthrough the runtime hydrates a top-level island into, so descendants see the
|
|
2
|
-
// "inside an island" context. Mirrors Region.svelte's island SSR shape EXACTLY
|
|
3
|
-
// (`{#if Component}<Component {...props} />{/if}`) so Svelte adopts the SSR nodes in place instead
|
|
4
|
-
// of discarding and re-creating the island root (a re-created root is class-less for a tick → a
|
|
5
|
-
// `class:`-driven `position: fixed` drops to `static` for a frame). SELF-CLOSING on purpose: any
|
|
6
|
-
// slot content here would pass an implicit `children` snippet that OVERRIDES the decoded
|
|
7
|
-
// `props.children` (the revived slot/region snippet) and desyncs hydration with an extra anchor.
|
|
8
|
-
import { setNested } from "./nested.js";
|
|
9
|
-
let { component: Component, props } = $props();
|
|
10
|
-
setNested();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
{#if Component}<Component {...props} />{/if}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
component: SvelteComponent<Record<string, unknown>>;
|
|
4
|
-
props: Record<string, unknown>;
|
|
5
|
-
};
|
|
6
|
-
declare const NestedProvider: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type NestedProvider = ReturnType<typeof NestedProvider>;
|
|
8
|
-
export default NestedProvider;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bounded SPA HTML cache: TTL + max entries + approximate byte budget.
|
|
3
|
-
* Expired entries are dropped on read/insert; overflow drops oldest by timestamp.
|
|
4
|
-
*/
|
|
5
|
-
export type PageCacheEntry = {
|
|
6
|
-
html: string;
|
|
7
|
-
t: number;
|
|
8
|
-
bytes: number;
|
|
9
|
-
};
|
|
10
|
-
export declare class PageCache {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(opts?: {
|
|
13
|
-
ttlMs?: number;
|
|
14
|
-
maxEntries?: number;
|
|
15
|
-
maxBytes?: number;
|
|
16
|
-
});
|
|
17
|
-
get(href: string): string | null;
|
|
18
|
-
set(href: string, html: string): void;
|
|
19
|
-
delete(href: string): void;
|
|
20
|
-
clear(): void;
|
|
21
|
-
get size(): number;
|
|
22
|
-
get bytes(): number;
|
|
23
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// src/runtime/page-cache.ts
|
|
2
|
-
var PageCache = class {
|
|
3
|
-
#map = /* @__PURE__ */ new Map();
|
|
4
|
-
#total_bytes = 0;
|
|
5
|
-
#ttlMs;
|
|
6
|
-
#maxEntries;
|
|
7
|
-
#maxBytes;
|
|
8
|
-
constructor(opts) {
|
|
9
|
-
this.#ttlMs = opts?.ttlMs ?? 8e3;
|
|
10
|
-
this.#maxEntries = opts?.maxEntries ?? 32;
|
|
11
|
-
this.#maxBytes = opts?.maxBytes ?? 4e6;
|
|
12
|
-
}
|
|
13
|
-
#drop(href) {
|
|
14
|
-
const e = this.#map.get(href);
|
|
15
|
-
if (!e) return;
|
|
16
|
-
this.#map.delete(href);
|
|
17
|
-
this.#total_bytes -= e.bytes;
|
|
18
|
-
}
|
|
19
|
-
#evict_expired(now) {
|
|
20
|
-
for (const [href, e] of this.#map) if (now - e.t >= this.#ttlMs) this.#drop(href);
|
|
21
|
-
}
|
|
22
|
-
#evict_overflow() {
|
|
23
|
-
while (this.#map.size > this.#maxEntries || this.#total_bytes > this.#maxBytes) {
|
|
24
|
-
let oldest_href = null;
|
|
25
|
-
let oldest_t = Infinity;
|
|
26
|
-
for (const [href, e] of this.#map) if (e.t < oldest_t) {
|
|
27
|
-
oldest_t = e.t;
|
|
28
|
-
oldest_href = href;
|
|
29
|
-
}
|
|
30
|
-
if (!oldest_href) break;
|
|
31
|
-
this.#drop(oldest_href);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
get(href) {
|
|
35
|
-
const now = Date.now();
|
|
36
|
-
const e = this.#map.get(href);
|
|
37
|
-
if (!e) return null;
|
|
38
|
-
if (now - e.t >= this.#ttlMs) {
|
|
39
|
-
this.#drop(href);
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
this.#map.delete(href);
|
|
43
|
-
e.t = now;
|
|
44
|
-
this.#map.set(href, e);
|
|
45
|
-
return e.html;
|
|
46
|
-
}
|
|
47
|
-
set(href, html) {
|
|
48
|
-
const now = Date.now();
|
|
49
|
-
this.#evict_expired(now);
|
|
50
|
-
this.#drop(href);
|
|
51
|
-
const bytes = html.length * 2;
|
|
52
|
-
this.#map.set(href, {
|
|
53
|
-
html,
|
|
54
|
-
t: now,
|
|
55
|
-
bytes
|
|
56
|
-
});
|
|
57
|
-
this.#total_bytes += bytes;
|
|
58
|
-
this.#evict_overflow();
|
|
59
|
-
}
|
|
60
|
-
delete(href) {
|
|
61
|
-
this.#drop(href);
|
|
62
|
-
}
|
|
63
|
-
clear() {
|
|
64
|
-
this.#map.clear();
|
|
65
|
-
this.#total_bytes = 0;
|
|
66
|
-
}
|
|
67
|
-
get size() {
|
|
68
|
-
return this.#map.size;
|
|
69
|
-
}
|
|
70
|
-
get bytes() {
|
|
71
|
-
return this.#total_bytes;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
export { PageCache };
|