@ogygia/core 0.11.4 → 0.12.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/README.md +1 -1
- package/dist/KeepHost.svelte +1 -1
- package/dist/LiveHost.svelte +1 -1
- package/dist/NestedProvider.svelte +1 -1
- package/dist/Region.svelte +28 -21
- package/dist/Region.svelte.d.ts +0 -2
- package/dist/SlotBoundary.svelte +1 -1
- package/dist/compiler/bom.js +1 -1
- package/dist/compiler/browser.d.ts +1 -1
- package/dist/compiler/browser.js +1 -1
- package/dist/compiler/ctx.d.ts +1 -1
- package/dist/compiler/ctx.js +3 -3
- package/dist/compiler/{macros/dedent.d.ts → dedent.d.ts} +12 -1
- package/dist/compiler/dedent.js +43 -0
- package/dist/compiler/driver.d.ts +9 -6
- package/dist/compiler/driver.js +69 -35
- package/dist/compiler/ids.d.ts +3 -0
- package/dist/compiler/ids.js +4 -1
- package/dist/compiler/index.d.ts +3 -3
- package/dist/compiler/index.js +3 -3
- package/dist/compiler/kit.d.ts +7 -0
- package/dist/compiler/kit.js +22 -10
- package/dist/compiler/link/caps.js +59 -9
- package/dist/compiler/link/island-deps.js +225 -22
- package/dist/compiler/link/location-map.d.ts +10 -0
- package/dist/compiler/link/location-map.js +53 -0
- package/dist/compiler/link/manifest.js +5 -1
- package/dist/compiler/link/runtime-entry.d.ts +19 -2
- package/dist/compiler/link/runtime-entry.js +34 -1
- package/dist/compiler/link/server-manifest.js +43 -7
- package/dist/compiler/link/transport.js +39 -7
- package/dist/compiler/macros/source.js +2 -2
- package/dist/compiler/program.d.ts +4 -0
- package/dist/compiler/program.js +5 -1
- package/dist/compiler/region/transform.d.ts +13 -4
- package/dist/compiler/region/transform.js +15 -6
- package/dist/context.d.ts +3 -12
- package/dist/context.js +1 -16
- package/dist/hooks.d.ts +16 -0
- package/dist/hooks.js +4 -2
- package/dist/insights/page-insights.js +2 -2
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +2 -1
- package/dist/nested.d.ts +11 -0
- package/dist/nested.js +19 -0
- package/dist/ref-sink.d.ts +15 -0
- package/dist/ref-sink.js +19 -0
- package/dist/ref.d.ts +2 -2
- package/dist/ref.js +1 -11
- package/dist/runtime/beacon.js +1 -1
- package/dist/runtime/boot-link.js +4 -1
- package/dist/runtime/core.js +10 -7
- package/dist/runtime/entry-locations.d.ts +10 -3
- package/dist/runtime/entry-locations.js +132 -21
- package/dist/runtime/full.js +5 -1
- package/dist/runtime/hydrate-core.d.ts +4 -4
- package/dist/runtime/hydrate-core.js +8 -5
- package/dist/runtime/morph.d.ts +7 -0
- package/dist/runtime/morph.js +21 -15
- package/dist/runtime/nav-handle.d.ts +3 -0
- package/dist/runtime/nav-handle.js +12 -5
- package/dist/runtime/ownership.d.ts +10 -1
- package/dist/runtime/ownership.js +19 -1
- package/dist/runtime/reconcile.d.ts +5 -2
- package/dist/runtime/reconcile.js +52 -16
- package/dist/runtime/region-endpoint-url.js +1 -0
- package/dist/runtime/region-ids.js +2 -2
- package/dist/runtime/remote-seeds.js +14 -3
- package/dist/runtime/router-nav.js +15 -0
- package/dist/runtime/router.js +3 -0
- package/dist/runtime/seeds.d.ts +10 -5
- package/dist/runtime/seeds.js +16 -12
- package/dist/runtime/slots.d.ts +24 -2
- package/dist/runtime/slots.js +2 -0
- package/dist/runtime/wire-classes.d.ts +2 -0
- package/dist/runtime/wire-classes.js +10 -1
- package/dist/runtime/wire-format.d.ts +4 -1
- package/dist/runtime/wire-format.js +6 -1
- package/dist/seed-ref-reviver.d.ts +24 -0
- package/dist/seed-ref-reviver.js +44 -0
- package/dist/seed-refs.d.ts +2 -16
- package/dist/seed-refs.js +1 -33
- package/dist/server/document-tail.d.ts +3 -2
- package/dist/server/document-tail.js +4 -3
- package/dist/server/entry-location.js +11 -8
- package/dist/server/props-wire.js +4 -3
- package/dist/server/signing-key.d.ts +10 -2
- package/dist/server/signing-key.js +49 -15
- package/dist/vite/index.js +5 -4
- package/dist/vite/kit-dirs.js +1 -1
- package/package.json +3 -3
- package/dist/compiler/link/entry-shim.d.ts +0 -4
- package/dist/compiler/link/entry-shim.js +0 -29
- package/dist/compiler/macros/dedent.js +0 -36
package/dist/compiler/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, ImportKeys, asRegionLocals, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions, wrapperVirtualId } from "./region/transform.js";
|
|
1
|
+
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, ImportKeys, STABLE_NAME_DIR, asRegionLocals, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions, wrapperVirtualId } from "./region/transform.js";
|
|
2
2
|
import { RawParse, set_parser } from "./parse/oxc.js";
|
|
3
3
|
import { CssReachOptions, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, FoucAlias, buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, isFoucCssId, isFoucScopedId, listStaticImports, resolveFoucImportSpec, svelteHasStyle } from "./fouc-css.js";
|
|
4
4
|
import { regionId, regionIdentity, strategyKey } from "./region/identity.js";
|
|
@@ -6,6 +6,6 @@ import { collectCaptureInfo, collectFreeIdentifiers, collectSnippetNames } from
|
|
|
6
6
|
import { Compiler, Profiler } from "./driver.js";
|
|
7
7
|
import { Program, host_key, strip_id } from "./program.js";
|
|
8
8
|
import { CompileCtx, CompileCtxInit } from "./ctx.js";
|
|
9
|
-
import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, RESOLVED, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId } from "./ids.js";
|
|
9
|
+
import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, RESOLVED, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_FLAGS, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId } from "./ids.js";
|
|
10
10
|
import { FLAGS_SPEC, FlagSite, collect_flag_sites, flags_manifest } from "./flags.js";
|
|
11
|
-
export { CLIENT_BINDING_STUB, CompileCtx, type CompileCtxInit, Compiler, CssReachOptions, DEFAULT_IMPORT_KEYS, FLAGS_SPEC, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, type FlagSite, FoucAlias, ISLAND_DIR, ImportKeys, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, type Profiler, Program, RESOLVED, type RawParse, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, asRegionLocals, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_flag_sites, compileFoucScopedCss, flags_manifest, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, normalize_hydrate_value, normalize_import_keys, normalize_region_value, regionBindingVirtualId, regionId, regionIdentity, resolveFoucImportSpec, set_parser, strategyKey, strip_id, svelteHasStyle, transformHost, transformTsRegions, wrapperVirtualId };
|
|
11
|
+
export { CLIENT_BINDING_STUB, CompileCtx, type CompileCtxInit, Compiler, CssReachOptions, DEFAULT_IMPORT_KEYS, FLAGS_SPEC, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, type FlagSite, FoucAlias, ISLAND_DIR, ImportKeys, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, type Profiler, Program, RESOLVED, type RawParse, STABLE_NAME_DIR, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_FLAGS, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, asRegionLocals, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_flag_sites, compileFoucScopedCss, flags_manifest, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, normalize_hydrate_value, normalize_import_keys, normalize_region_value, regionBindingVirtualId, regionId, regionIdentity, resolveFoucImportSpec, set_parser, strategyKey, strip_id, svelteHasStyle, transformHost, transformTsRegions, wrapperVirtualId };
|
package/dist/compiler/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, asRegionLocals, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions, wrapperVirtualId } from "./region/transform.js";
|
|
1
|
+
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, STABLE_NAME_DIR, asRegionLocals, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions, wrapperVirtualId } from "./region/transform.js";
|
|
2
2
|
import { set_parser } from "./parse/oxc.js";
|
|
3
3
|
import { FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, isFoucCssId, isFoucScopedId, listStaticImports, resolveFoucImportSpec, svelteHasStyle } from "./fouc-css.js";
|
|
4
4
|
import { regionId, regionIdentity, strategyKey } from "./region/identity.js";
|
|
@@ -6,6 +6,6 @@ import { collectCaptureInfo, collectFreeIdentifiers, collectSnippetNames } from
|
|
|
6
6
|
import { Compiler } from "./driver.js";
|
|
7
7
|
import { Program, host_key, strip_id } from "./program.js";
|
|
8
8
|
import { CompileCtx } from "./ctx.js";
|
|
9
|
-
import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, RESOLVED, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId } from "./ids.js";
|
|
9
|
+
import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, RESOLVED, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_FLAGS, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId } from "./ids.js";
|
|
10
10
|
import { FLAGS_SPEC, collect_flag_sites, flags_manifest } from "./flags.js";
|
|
11
|
-
export { CLIENT_BINDING_STUB, CompileCtx, Compiler, DEFAULT_IMPORT_KEYS, FLAGS_SPEC, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, ISLAND_DIR, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, Program, RESOLVED, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, asRegionLocals, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_flag_sites, compileFoucScopedCss, flags_manifest, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, normalize_hydrate_value, normalize_import_keys, normalize_region_value, regionBindingVirtualId, regionId, regionIdentity, resolveFoucImportSpec, set_parser, strategyKey, strip_id, svelteHasStyle, transformHost, transformTsRegions, wrapperVirtualId };
|
|
11
|
+
export { CLIENT_BINDING_STUB, CompileCtx, Compiler, DEFAULT_IMPORT_KEYS, FLAGS_SPEC, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, ISLAND_DIR, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, Program, RESOLVED, STABLE_NAME_DIR, V_DEVTOOLS_BOOT, V_DEVTOOLS_BOOT_URL, V_DEVTOOLS_META, V_DEV_HMR, V_DEV_HMR_URL, V_FN_MANIFEST, V_HYDRATE_FEATURES, V_ISLAND_DEPS, V_KIT_TRANSPORT, V_KIT_WIRE, V_MANIFEST, V_PROFILER_MAPS, V_RATE_LIMIT, V_REGION_ENDPOINT, V_REGION_TTL, V_REQUEST_EVENT, V_ROUTER_CONFIG, V_ROUTER_CSS, V_ROUTE_CONFIG, V_ROUTE_CSR, V_RUNTIME, V_RUNTIME_ENTRY, V_RUNTIME_FLAGS, V_RUNTIME_URL, V_SECRET, V_SERVER_ISLANDS, V_SERVER_MANIFEST, V_SERVER_PLUGINS, V_SESSION_COOKIE, V_SIGN, V_TRANSPORT, V_TRANSPORTABLES, V_TRANSPORTABLES_EAGER, asRegionLocals, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_flag_sites, compileFoucScopedCss, flags_manifest, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, normalize_hydrate_value, normalize_import_keys, normalize_region_value, regionBindingVirtualId, regionId, regionIdentity, resolveFoucImportSpec, set_parser, strategyKey, strip_id, svelteHasStyle, transformHost, transformTsRegions, wrapperVirtualId };
|
package/dist/compiler/kit.d.ts
CHANGED
|
@@ -52,6 +52,13 @@ export declare function read_csr(file: string): boolean | undefined;
|
|
|
52
52
|
* value is a build error: it is read at build time, so ogygia could not honour it.
|
|
53
53
|
*/
|
|
54
54
|
export declare function read_route_config(file: string, keys: readonly string[]): Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* A route COMPONENT of `kind`: `+page.svelte`, or the same file in any other extension the app
|
|
57
|
+
* compiles to a component (`+page.md`, `+page.svx`): every `+page.*` but the option scripts. Kit
|
|
58
|
+
* routes all of them alike, so the csr topology does too — a markdown page counted for nothing
|
|
59
|
+
* here, and its layout's world and its own client leg were decided as if it did not exist.
|
|
60
|
+
*/
|
|
61
|
+
export declare function is_route_component(name: string, kind: "page" | "layout"): boolean;
|
|
55
62
|
/**
|
|
56
63
|
* The ERROR-RENDER csr of every page route: Kit renders a page's `+error.svelte` with the LAYOUT
|
|
57
64
|
* branch only (`PageNodes(layouts)` in its server renderer — the page node is dropped), so `csr`
|
package/dist/compiler/kit.js
CHANGED
|
@@ -197,6 +197,16 @@ const OPTION_FILES_LAYOUT = [
|
|
|
197
197
|
"+layout.server.js",
|
|
198
198
|
"+layout.server.ts"
|
|
199
199
|
];
|
|
200
|
+
const SCRIPT_FILE_RE = /\.[cm]?[jt]s$/;
|
|
201
|
+
/**
|
|
202
|
+
* A route COMPONENT of `kind`: `+page.svelte`, or the same file in any other extension the app
|
|
203
|
+
* compiles to a component (`+page.md`, `+page.svx`): every `+page.*` but the option scripts. Kit
|
|
204
|
+
* routes all of them alike, so the csr topology does too — a markdown page counted for nothing
|
|
205
|
+
* here, and its layout's world and its own client leg were decided as if it did not exist.
|
|
206
|
+
*/
|
|
207
|
+
function is_route_component(name, kind) {
|
|
208
|
+
return name.startsWith(`+${kind}.`) && !SCRIPT_FILE_RE.test(name);
|
|
209
|
+
}
|
|
200
210
|
/**
|
|
201
211
|
* Own-chain Kit-effective `csr === false` for one route host — Kit's per-PAGE rule verbatim:
|
|
202
212
|
* walk the layout option files root → host dir (then the page's own option files), deepest
|
|
@@ -217,7 +227,7 @@ function own_chain_csr_false(hostFile, routesDir, layouts_only = false) {
|
|
|
217
227
|
const v = read_csr(path.join(d, f));
|
|
218
228
|
if (v !== void 0) csr = v;
|
|
219
229
|
}
|
|
220
|
-
if (!layouts_only && path.basename(hostFile)
|
|
230
|
+
if (!layouts_only && is_route_component(path.basename(hostFile), "page")) for (const f of OPTION_FILES_PAGE) {
|
|
221
231
|
const v = read_csr(path.join(dir, f));
|
|
222
232
|
if (v !== void 0) csr = v;
|
|
223
233
|
}
|
|
@@ -281,8 +291,8 @@ function layout_page_worlds(layoutDir, routesDir) {
|
|
|
281
291
|
function routeCsrIsFalse(hostFile, routesDir) {
|
|
282
292
|
if (!hostFile.startsWith(routesDir)) return false;
|
|
283
293
|
const base = path.basename(hostFile);
|
|
284
|
-
if (base
|
|
285
|
-
if (base
|
|
294
|
+
if (is_route_component(base, "page")) return own_chain_csr_false(hostFile, routesDir);
|
|
295
|
+
if (!is_route_component(base, "layout")) return false;
|
|
286
296
|
const { any_false, any_true } = layout_page_worlds(path.dirname(hostFile), routesDir);
|
|
287
297
|
if (any_false && !any_true) return true;
|
|
288
298
|
if (any_false || any_true) return false;
|
|
@@ -298,9 +308,10 @@ function routeCsrIsFalse(hostFile, routesDir) {
|
|
|
298
308
|
*/
|
|
299
309
|
function routeCsrIsTrue(hostFile, routesDir) {
|
|
300
310
|
const base = path.basename(hostFile);
|
|
301
|
-
|
|
311
|
+
const is_page = is_route_component(base, "page");
|
|
312
|
+
if (!is_page && !is_route_component(base, "layout")) return false;
|
|
302
313
|
if (!hostFile.startsWith(routesDir)) return false;
|
|
303
|
-
if (
|
|
314
|
+
if (is_page) return !own_chain_csr_false(hostFile, routesDir);
|
|
304
315
|
const { any_false, any_true } = layout_page_worlds(path.dirname(hostFile), routesDir);
|
|
305
316
|
if (any_false) return false;
|
|
306
317
|
if (any_true) return true;
|
|
@@ -339,7 +350,7 @@ function pageLeaves(routesDir) {
|
|
|
339
350
|
for (const e of route_entries(dir)) {
|
|
340
351
|
const full = path.join(dir, e.name);
|
|
341
352
|
if (e.is_dir) walk(full);
|
|
342
|
-
else if (e.name
|
|
353
|
+
else if (is_route_component(e.name, "page")) leaves.push(full);
|
|
343
354
|
}
|
|
344
355
|
};
|
|
345
356
|
walk(routesDir);
|
|
@@ -378,7 +389,7 @@ function config_page_dirs(routesDir) {
|
|
|
378
389
|
for (const e of route_entries(dir)) {
|
|
379
390
|
const full = path.join(dir, e.name);
|
|
380
391
|
if (e.is_dir) walk(full);
|
|
381
|
-
else if (PAGE_FILE_RE.test(e.name)) dirs.add(dir);
|
|
392
|
+
else if (PAGE_FILE_RE.test(e.name) || is_route_component(e.name, "page")) dirs.add(dir);
|
|
382
393
|
}
|
|
383
394
|
};
|
|
384
395
|
walk(routesDir);
|
|
@@ -486,13 +497,14 @@ function collectNodeEffectiveCsr(routesDir) {
|
|
|
486
497
|
const entries = route_entries(dir);
|
|
487
498
|
const names = new Set(entries.filter((e) => e.is_file).map((e) => e.name));
|
|
488
499
|
const has = (list) => list.some((f) => names.has(f));
|
|
500
|
+
const has_component = (kind) => [...names].some((n) => is_route_component(n, kind));
|
|
489
501
|
const layout_own = own_csr(dir, LAYOUT_UNIVERSAL, LAYOUT_SERVER);
|
|
490
502
|
const chain = layout_own !== void 0 ? layout_own : inherited;
|
|
491
|
-
if (
|
|
503
|
+
if (has_component("layout") || has(LAYOUT_UNIVERSAL) || has(LAYOUT_SERVER)) {
|
|
492
504
|
if (is_root) saw_root_layout = true;
|
|
493
505
|
nodes.push(chain);
|
|
494
506
|
}
|
|
495
|
-
if (
|
|
507
|
+
if (has_component("page") || has(PAGE_UNIVERSAL) || has(PAGE_SERVER)) {
|
|
496
508
|
const page_own = own_csr(dir, PAGE_UNIVERSAL, PAGE_SERVER);
|
|
497
509
|
nodes.push(page_own !== void 0 ? page_own : chain);
|
|
498
510
|
}
|
|
@@ -560,4 +572,4 @@ function clean_stale_ogygia_dirs(dir) {
|
|
|
560
572
|
clean_stale_ogygia_dirs(full);
|
|
561
573
|
}
|
|
562
574
|
}
|
|
563
|
-
export { DEFAULT_KIT_DIRS, KEEP_CLIENT_DIR, clean_stale_ogygia_dirs, clear_route_csr_cache, clientBuildWillSkip, csrTrueRouteIds, errorCsrTrueRouteIds, hasAnyCsrFalseRoute, hasAnyCsrTrueRoute, inject_keep_client_route, keep_client_dir, kit_dirs, kit_inline_style_threshold, kit_major, normalize_route_id, page_route_config, read_csr, read_route_config, resolve_kit_paths, rootLayoutCsrTrue, routeCsrIsFalse, routeCsrIsTrue, set_kit_dirs, set_kit_inline_style_threshold };
|
|
575
|
+
export { DEFAULT_KIT_DIRS, KEEP_CLIENT_DIR, clean_stale_ogygia_dirs, clear_route_csr_cache, clientBuildWillSkip, csrTrueRouteIds, errorCsrTrueRouteIds, hasAnyCsrFalseRoute, hasAnyCsrTrueRoute, inject_keep_client_route, is_route_component, keep_client_dir, kit_dirs, kit_inline_style_threshold, kit_major, normalize_route_id, page_route_config, read_csr, read_route_config, resolve_kit_paths, rootLayoutCsrTrue, routeCsrIsFalse, routeCsrIsTrue, set_kit_dirs, set_kit_inline_style_threshold };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { csrTrueRouteIds, errorCsrTrueRouteIds, page_route_config, rootLayoutCsrTrue } from "../kit.js";
|
|
2
|
+
import { dedent } from "../dedent.js";
|
|
2
3
|
// src/compiler/link/caps.ts
|
|
3
4
|
/**
|
|
4
5
|
* Capability virtual-module emitters — the leg-split sources for the signed-capability family:
|
|
@@ -14,8 +15,14 @@ import { csrTrueRouteIds, errorCsrTrueRouteIds, page_route_config, rootLayoutCsr
|
|
|
14
15
|
* counts — else this build's key.
|
|
15
16
|
*/
|
|
16
17
|
function secret_module(ssr, build_secret, build_had_secret) {
|
|
17
|
-
if (!ssr) return `
|
|
18
|
-
|
|
18
|
+
if (!ssr) return dedent`
|
|
19
|
+
export const buildKey = '';
|
|
20
|
+
export const buildHadSecret = false;
|
|
21
|
+
`;
|
|
22
|
+
return dedent`
|
|
23
|
+
export const buildKey = ${JSON.stringify(build_secret)};
|
|
24
|
+
export const buildHadSecret = ${build_had_secret};
|
|
25
|
+
`;
|
|
19
26
|
}
|
|
20
27
|
/**
|
|
21
28
|
* `virtual:ogygia/sign` — same split as secret: SSR mints with node:crypto (re-exports the real
|
|
@@ -23,12 +30,37 @@ function secret_module(ssr, build_secret, build_had_secret) {
|
|
|
23
30
|
* length-prefixed canonical form the runtime compares against.
|
|
24
31
|
*/
|
|
25
32
|
function sign_module(ssr, hmac_module) {
|
|
26
|
-
if (!ssr) return
|
|
27
|
-
|
|
33
|
+
if (!ssr) return dedent`
|
|
34
|
+
export function sign(_secret, _message) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function verify(_secret, _message, _sig) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function region_mac_message(id, exp, props, session = '', ttl = '', render = '') {
|
|
43
|
+
const enc = new TextEncoder();
|
|
44
|
+
const lp = (s) => enc.encode(String(s)).byteLength + ':' + String(s);
|
|
45
|
+
const v1 = lp(id) + '|' + lp(exp) + '|' + lp(props) + '|' + lp(session) + '|' + lp(ttl);
|
|
46
|
+
return render === '' ? 'v1|' + v1 : 'v2|' + v1 + '|' + lp(render);
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
return dedent`
|
|
50
|
+
export { sign, verify, region_mac_message } from ${JSON.stringify(hmac_module)};
|
|
51
|
+
`;
|
|
28
52
|
}
|
|
29
53
|
function server_plugins_module(ssr, realms) {
|
|
30
54
|
if (!ssr || realms.length === 0) return `export const plugins = [];`;
|
|
31
|
-
|
|
55
|
+
const imports = realms.map((r, i) => `import p${i} from ${JSON.stringify(r.module)};`).join("\n");
|
|
56
|
+
const list = realms.map((r, i) => `{ name: ${JSON.stringify(r.name)}, options: ${JSON.stringify(r.options)}, server: p${i} }`).join(",\n ");
|
|
57
|
+
return dedent`
|
|
58
|
+
${imports}
|
|
59
|
+
|
|
60
|
+
export const plugins = [
|
|
61
|
+
${list}
|
|
62
|
+
];
|
|
63
|
+
`;
|
|
32
64
|
}
|
|
33
65
|
/** `virtual:ogygia/route-config` — SERVER only: every Kit page route id → the keys the plugins claim
|
|
34
66
|
* inside Kit's `config` page option, merged the way Kit merges it (a key no level sets is absent).
|
|
@@ -50,15 +82,33 @@ function session_cookie_module(ssr, session_cookie) {
|
|
|
50
82
|
/** `virtual:ogygia/region-ttl` — SERVER only; the capability expiry window for mint, and how long
|
|
51
83
|
* after expiry an anonymous capability still renews. */
|
|
52
84
|
function region_ttl_module(ssr, region_ttl, renew_window) {
|
|
53
|
-
if (!ssr) return `
|
|
54
|
-
|
|
85
|
+
if (!ssr) return dedent`
|
|
86
|
+
export const regionTtl = 3600;
|
|
87
|
+
export const renewWindow = 0;
|
|
88
|
+
`;
|
|
89
|
+
return dedent`
|
|
90
|
+
export const regionTtl = ${region_ttl};
|
|
91
|
+
export const renewWindow = ${renew_window};
|
|
92
|
+
`;
|
|
55
93
|
}
|
|
56
94
|
/** `virtual:ogygia/route-csr` — SERVER only: the csr=true route ids, so a csr=false layout's islands
|
|
57
95
|
* degrade to inline when the LEAF page is csr=true (Kit hydrates the whole document). The CLIENT leg
|
|
58
96
|
* is an empty set — the client reads the identical signal from `kit_hydrates_page()`, and the route
|
|
59
97
|
* list never ships to the browser. */
|
|
60
98
|
function route_csr_module(ssr, routesDir) {
|
|
61
|
-
if (!ssr) return
|
|
62
|
-
|
|
99
|
+
if (!ssr) return dedent`
|
|
100
|
+
export const csr_true_routes = new Set();
|
|
101
|
+
export const error_csr_true_routes = new Set();
|
|
102
|
+
export const root_layout_csr_true = true;
|
|
103
|
+
`;
|
|
104
|
+
return dedent`
|
|
105
|
+
export const csr_true_routes = new Set(${JSON.stringify(csrTrueRouteIds(routesDir))});
|
|
106
|
+
|
|
107
|
+
// The error-render map beside the page map: Kit renders a route's error page with its LAYOUT
|
|
108
|
+
// branch only, so a 404 under a csr=false page is hydrated whenever the layouts say so.
|
|
109
|
+
export const error_csr_true_routes = new Set(${JSON.stringify(errorCsrTrueRouteIds(routesDir))});
|
|
110
|
+
|
|
111
|
+
export const root_layout_csr_true = ${rootLayoutCsrTrue(routesDir)};
|
|
112
|
+
`;
|
|
63
113
|
}
|
|
64
114
|
export { rate_limit_module, region_ttl_module, route_config_module, route_csr_module, secret_module, server_plugins_module, session_cookie_module, sign_module };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { path } from "../host.js";
|
|
2
|
+
import { dedent } from "../dedent.js";
|
|
2
3
|
import { merge_page_keys } from "./page-keys.js";
|
|
3
4
|
import { hydration_hazards } from "../../insights/hydration-hazards.js";
|
|
4
5
|
import { OWN_FILE_RE, OWN_PACKAGE_NAMES } from "../../own-package.js";
|
|
@@ -499,27 +500,229 @@ function collect_inline_css(bundle, hrefs, threshold) {
|
|
|
499
500
|
return out;
|
|
500
501
|
}
|
|
501
502
|
function island_deps_module(ssr, is_dev, out_dir_rel = ".svelte-kit") {
|
|
502
|
-
if (!ssr) return `
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
function
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
503
|
+
if (!ssr) return dedent`
|
|
504
|
+
export function islandDeps(_entry) { return []; }
|
|
505
|
+
export function islandCss(_entry) { return []; }
|
|
506
|
+
export function islandCssInline(_href) { return null; }
|
|
507
|
+
export function contentCss(_id) { return []; }
|
|
508
|
+
export function islandReadsPage(_entry) { return false; }
|
|
509
|
+
export function islandPageKeys(_entry) { return null; }
|
|
510
|
+
export function islandPageWhy(_entry) { return null; }
|
|
511
|
+
export function islandRemotes(_entry) { return null; }
|
|
512
|
+
export function islandInteractivity(_entry) { return null; }
|
|
513
|
+
export function islandHazards(_entry) { return null; }
|
|
514
|
+
export function chunkContents(_href) { return null; }
|
|
515
|
+
export function chunkHeavy(_href) { return null; }
|
|
516
|
+
export function chunkBarrels(_href) { return null; }
|
|
517
|
+
export function chunkDuplicates() { return null; }
|
|
518
|
+
export function fnManifest() { return null; }
|
|
519
|
+
export function entryLocation(_identity) { return null; }
|
|
520
|
+
export function locationMap() { return null; }
|
|
521
|
+
`;
|
|
522
|
+
if (is_dev) return dedent`
|
|
523
|
+
export function islandDeps(_entry) { return []; }
|
|
524
|
+
export function islandCss(entry) { return entry ? [entry] : []; }
|
|
525
|
+
export function islandCssInline(_href) { return null; }
|
|
526
|
+
export function contentCss(_id) { return []; }
|
|
527
|
+
export function islandReadsPage(_entry) { return true; }
|
|
528
|
+
export function islandPageKeys(_entry) { return null; }
|
|
529
|
+
export function islandPageWhy(_entry) { return null; }
|
|
530
|
+
export function islandRemotes(_entry) { return null; }
|
|
531
|
+
export function islandInteractivity(_entry) { return null; }
|
|
532
|
+
export function islandHazards(_entry) { return null; }
|
|
533
|
+
export function chunkContents(_href) { return null; }
|
|
534
|
+
export function chunkHeavy(_href) { return null; }
|
|
535
|
+
export function chunkBarrels(_href) { return null; }
|
|
536
|
+
export function chunkDuplicates() { return null; }
|
|
537
|
+
export function fnManifest() { return null; }
|
|
538
|
+
export function entryLocation(identity) { return identity || null; }
|
|
539
|
+
export function locationMap() { return null; }
|
|
540
|
+
`;
|
|
541
|
+
const out_dir = JSON.stringify(out_dir_rel);
|
|
542
|
+
return dedent`
|
|
543
|
+
import fs from 'node:fs';
|
|
544
|
+
import path from 'node:path';
|
|
545
|
+
import { fileURLToPath } from 'node:url';
|
|
546
|
+
|
|
547
|
+
// PRIMARY source: a string slot the client build patches in place with the manifest JSON (see
|
|
548
|
+
// writeBundle). Inlined into the server bundle, it survives serverless tracing: Vercel/Netlify
|
|
549
|
+
// (@vercel/nft) bundle only imported files, not runtime fs reads, so the co-located JSON below
|
|
550
|
+
// is dropped there. The fs walk stays the fallback for adapter-node and dev-preview (the whole
|
|
551
|
+
// server dir ships). Unpatched, the token starts with '_' (char 95), the guard is false, and
|
|
552
|
+
// the walk runs. A bad patch degrades to the walk, never crashes the server at import.
|
|
553
|
+
const __OG_INLINE = '__OGYGIA_ISLAND_DEPS_INLINE__';
|
|
554
|
+
let cache = null;
|
|
555
|
+
try { if (__OG_INLINE.charCodeAt(0) === 123) cache = JSON.parse(__OG_INLINE); } catch {}
|
|
556
|
+
|
|
557
|
+
function candidates() {
|
|
558
|
+
const out = [];
|
|
559
|
+
try {
|
|
560
|
+
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
561
|
+
for (let i = 0; i < 8; i++) {
|
|
562
|
+
out.push(path.join(dir, 'og-region-deps.json'));
|
|
563
|
+
const parent = path.dirname(dir);
|
|
564
|
+
if (parent === dir) break;
|
|
565
|
+
dir = parent;
|
|
566
|
+
}
|
|
567
|
+
} catch {}
|
|
568
|
+
if (typeof process !== 'undefined' && process.cwd) {
|
|
569
|
+
const cwd = process.cwd();
|
|
570
|
+
out.push(path.join(cwd, ${out_dir}, 'og-region-deps.json'));
|
|
571
|
+
out.push(path.join(cwd, ${out_dir}, 'output', 'server', 'og-region-deps.json'));
|
|
572
|
+
}
|
|
573
|
+
return out;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function load() {
|
|
577
|
+
if (cache) return cache;
|
|
578
|
+
for (const p of candidates()) {
|
|
579
|
+
try { cache = JSON.parse(fs.readFileSync(p, 'utf8')); return cache; } catch {}
|
|
580
|
+
}
|
|
581
|
+
cache = {};
|
|
582
|
+
return cache;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Handoff shape: { js: { entryUrl: [...] }, css: { entryUrl: [...] } }. A stale flat
|
|
586
|
+
// map (pre-css build) degrades gracefully: js falls back to the root, css to [].
|
|
587
|
+
function pick(kind, entry) {
|
|
588
|
+
const all = load();
|
|
589
|
+
const map = all && typeof all[kind] === 'object' ? all[kind] : kind === 'js' ? all : null;
|
|
590
|
+
const list = map ? map[entry] : null;
|
|
591
|
+
return Array.isArray(list) ? list : [];
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/** One entry of a handoff map (\`field\`), or null: no map, no key, or the wrong shape. */
|
|
595
|
+
function lookup(field, key, ok) {
|
|
596
|
+
const all = load();
|
|
597
|
+
const map = all && typeof all[field] === 'object' && all[field] ? all[field] : null;
|
|
598
|
+
if (!map || !key) return null;
|
|
599
|
+
const v = map[key];
|
|
600
|
+
return ok(v) ? v : null;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/** A chunk href's key: root-absolute, as the build wrote it. */
|
|
604
|
+
function chunk_key(href) {
|
|
605
|
+
return href.startsWith('/') ? href : '/' + href.replace(/^\\.\\//, '');
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export function islandDeps(entry) {
|
|
609
|
+
return entry ? pick('js', entry) : [];
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export function islandCss(entry) {
|
|
613
|
+
return entry ? pick('css', entry) : [];
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// INLINE REGION CSS: the text of a region CSS asset the build kept under Kit's
|
|
617
|
+
// inlineStyleThreshold (collect_inline_css), keyed by the same public href islandCss hands
|
|
618
|
+
// out. null = link it (over the threshold, no threshold, or a pre-inline handoff).
|
|
619
|
+
export function islandCssInline(href) {
|
|
620
|
+
return lookup('css_inline', href, (v) => typeof v === 'string');
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
export function contentCss(id) {
|
|
624
|
+
return id ? pick('content_css', id) : [];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Does this island's client closure read $page? FAIL-OPEN: no map (a pre-page handoff), or an
|
|
628
|
+
// entry the build never saw (a foreign fragment's island mounted from another app) → true, so
|
|
629
|
+
// the seed ships and nothing that might read it finds it missing.
|
|
630
|
+
export function islandReadsPage(entry) {
|
|
631
|
+
const all = load();
|
|
632
|
+
const map = all && typeof all.page === 'object' && all.page ? all.page : null;
|
|
633
|
+
if (!map || !entry) return true;
|
|
634
|
+
const v = map[entry];
|
|
635
|
+
return v === undefined ? true : !!v;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// SEED SHAPING: which top-level page.data keys this island's closure reads. FAIL-OPEN as null
|
|
639
|
+
// ("ship all"): no map (a pre-shaping handoff), an entry the build never saw, or a closure
|
|
640
|
+
// whose reads could not be pinned to literal keys.
|
|
641
|
+
export function islandPageKeys(entry) {
|
|
642
|
+
return lookup('page_keys', entry, Array.isArray);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Why this island ships all of page.data: the modules in its closure whose reads the build
|
|
646
|
+
// could not pin (file, line, why). Profiler builds only; null = none recorded.
|
|
647
|
+
export function islandPageWhy(entry) {
|
|
648
|
+
return lookup('page_why', entry, Array.isArray);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// Which remotes (Kit id-hashes) this island's client closure can call: REMOTE SEED ONLY WHEN
|
|
652
|
+
// REACHABLE. FAIL-OPEN as null ("may call anything"): no map (a pre-remotes handoff), or an
|
|
653
|
+
// entry the build never saw (a foreign fragment's island) → every SSR-resolved remote seeds.
|
|
654
|
+
export function islandRemotes(entry) {
|
|
655
|
+
return lookup('remotes', entry, Array.isArray);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// WAKE ADVISOR facts per entry (handlers / $state / bind: counts over the island's own
|
|
659
|
+
// components), for the profiler's Islands table. null = the handoff has none.
|
|
660
|
+
export function islandInteractivity(entry) {
|
|
661
|
+
return lookup('interactivity', entry, (v) => !!v && typeof v === 'object');
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// each island's lines that draw differently in the browser (the profiler's mismatch findings)
|
|
665
|
+
export function islandHazards(entry) {
|
|
666
|
+
return lookup('hazards', entry, Array.isArray);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// WHAT IS INSIDE a chunk (readable source list): the profiler names hashed chunks with it
|
|
670
|
+
export function chunkContents(href) {
|
|
671
|
+
const all = load();
|
|
672
|
+
const map = all && typeof all.contents === 'object' && all.contents ? all.contents : null;
|
|
673
|
+
if (!map || !href) return null;
|
|
674
|
+
const v = map[chunk_key(href)] ?? map[href];
|
|
675
|
+
return Array.isArray(v) ? v : null;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// …and its heaviest modules with their rendered bytes (the report's heavy-module finding)
|
|
679
|
+
export function chunkHeavy(href) {
|
|
680
|
+
const all = load();
|
|
681
|
+
const map = all && typeof all.heavy === 'object' && all.heavy ? all.heavy : null;
|
|
682
|
+
if (!map || !href) return null;
|
|
683
|
+
const v = map[chunk_key(href)] ?? map[href];
|
|
684
|
+
return v && typeof v === 'object' && Array.isArray(v.top) ? v : null;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// …and the re-export barrels it still holds (the report's island-barrel note)
|
|
688
|
+
export function chunkBarrels(href) {
|
|
689
|
+
const all = load();
|
|
690
|
+
const map = all && typeof all.barrels === 'object' && all.barrels ? all.barrels : null;
|
|
691
|
+
if (!map || !href) return null;
|
|
692
|
+
const v = map[chunk_key(href)] ?? map[href];
|
|
693
|
+
return Array.isArray(v) ? v : null;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// the modules the build shipped twice, each copy's chunk (the report's duplicate-module finding)
|
|
697
|
+
export function chunkDuplicates() {
|
|
698
|
+
const all = load();
|
|
699
|
+
const v = all && Array.isArray(all.dupes) ? all.dupes : null;
|
|
700
|
+
return v && v.length ? v : null;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// og.$ factories for the page-inline registration script (CSP-clean prod path): written by
|
|
704
|
+
// the CLIENT build's writeBundle, read here at SSR render time, the same ordering-safe channel
|
|
705
|
+
// islandCss uses.
|
|
706
|
+
export function fnManifest() {
|
|
707
|
+
const m = load().fn_manifest;
|
|
708
|
+
return m && typeof m === 'object' && Object.keys(m).length ? m : null;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// IDENTITY → LOCATION: the content-hashed file an entry (an island's stable URL, the runtime's)
|
|
712
|
+
// is served from. null = no location known (a handoff from before hashing, a foreign island):
|
|
713
|
+
// the identity itself is written, and the browser finds it in the build's location maps.
|
|
714
|
+
export function entryLocation(identity) {
|
|
715
|
+
const m = load().entries;
|
|
716
|
+
const v = m && typeof m === 'object' && identity ? m[identity] : null;
|
|
717
|
+
return typeof v === 'string' ? v : null;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// The build's content-hashed location map (link/location-map.ts), the file the browser reads:
|
|
721
|
+
// its served path, base-less (asset() adds it), or null (no island, a handoff from before it).
|
|
722
|
+
export function locationMap() {
|
|
723
|
+
const v = load().locations;
|
|
724
|
+
return typeof v === 'string' ? v : null;
|
|
725
|
+
}
|
|
726
|
+
`;
|
|
524
727
|
}
|
|
525
728
|
export { chunk_module_bytes, collectIslandDepModulepreloads, collect_inline_css, duplicate_modules, interactivity_facts, islandDepsHandoffPath, island_deps_module, kit_remote_hash, module_key, module_origin, remote_hash_of, summarize_chunk_contents };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The fixed-name map's file, in the app dir (beside Kit's `version.json`). */
|
|
2
|
+
export declare const CURRENT_LOCATIONS_FILE = "ogygia.json";
|
|
3
|
+
/**
|
|
4
|
+
* Both maps, as output files: the content-hashed one first. `pairs`: identity file → hashed file,
|
|
5
|
+
* output-relative. Empty when there is nothing to map.
|
|
6
|
+
*/
|
|
7
|
+
export declare function location_map_files(app_dir: string, pairs: Iterable<readonly [string, string]>, hash: (source: string) => string): {
|
|
8
|
+
fileName: string;
|
|
9
|
+
source: string;
|
|
10
|
+
}[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { path } from "../host.js";
|
|
2
|
+
// src/compiler/link/location-map.ts
|
|
3
|
+
/**
|
|
4
|
+
* THE LOCATION MAPS. Island entries are content-hashed files under `immutable/`; an island's IDENTITY
|
|
5
|
+
* (`<appDir>/ogygia/og-region.<iid>.js`, the name every key uses) is a name, not a file. The build
|
|
6
|
+
* writes its identity → location pairs twice, as the same map:
|
|
7
|
+
*
|
|
8
|
+
* - `<appDir>/immutable/og-locations.<hash>.json`, named by its content. The runtime's script names
|
|
9
|
+
* it (`data-og-locations`), and a load that arrives with an identity alone (a region the browser
|
|
10
|
+
* rendered, a held region from the wire, a portable snippet) reads it: this build's locations, for
|
|
11
|
+
* this build's page.
|
|
12
|
+
* - `<appDir>/ogygia.json`, the ONE file at a fixed name: the current build's, beside Kit's own
|
|
13
|
+
* `<appDir>/version.json` and found from an identity alone (its app dir is the identity's, so any
|
|
14
|
+
* app's is found). A page that outlived its build reads it when its own files are gone, and wakes
|
|
15
|
+
* on the current code. Outside `immutable/`: a host revalidates it, as it does Kit's.
|
|
16
|
+
*
|
|
17
|
+
* Every other file the build writes is named by its content and lives in `immutable/`, so a host's
|
|
18
|
+
* year-long rule fits all of them; no directory of ogygia's own is written (`ogygia/` in an identity
|
|
19
|
+
* is a name). Both sides of each pair are written relative to the file holding them: the browser
|
|
20
|
+
* resolves them against wherever the build is served (a base, an assets CDN), and an identity that
|
|
21
|
+
* resolves elsewhere (another app's) never matches.
|
|
22
|
+
*/
|
|
23
|
+
/** The fixed-name map's file, in the app dir (beside Kit's `version.json`). */
|
|
24
|
+
const CURRENT_LOCATIONS_FILE = "ogygia.json";
|
|
25
|
+
/** A path from `from_file`'s directory to `to_file` (both output-relative), always dot-led. */
|
|
26
|
+
function relative_specifier(from_file, to_file) {
|
|
27
|
+
const rel = path.posix.relative(path.posix.dirname(from_file), to_file);
|
|
28
|
+
return rel.startsWith(".") ? rel : "./" + rel;
|
|
29
|
+
}
|
|
30
|
+
function map_source(file, pairs) {
|
|
31
|
+
const map = {};
|
|
32
|
+
for (const [identity, location] of pairs) map[relative_specifier(file, identity)] = relative_specifier(file, location);
|
|
33
|
+
return JSON.stringify(map);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Both maps, as output files: the content-hashed one first. `pairs`: identity file → hashed file,
|
|
37
|
+
* output-relative. Empty when there is nothing to map.
|
|
38
|
+
*/
|
|
39
|
+
function location_map_files(app_dir, pairs, hash) {
|
|
40
|
+
const list = [...pairs];
|
|
41
|
+
if (!list.length) return [];
|
|
42
|
+
const hashed_dir = `${app_dir}/immutable`;
|
|
43
|
+
const hashed_source = map_source(hashed_dir + "/og-locations.json", list);
|
|
44
|
+
const current = `${app_dir}/${CURRENT_LOCATIONS_FILE}`;
|
|
45
|
+
return [{
|
|
46
|
+
fileName: `${hashed_dir}/og-locations.${hash(hashed_source)}.json`,
|
|
47
|
+
source: hashed_source
|
|
48
|
+
}, {
|
|
49
|
+
fileName: current,
|
|
50
|
+
source: map_source(current, list)
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
export { CURRENT_LOCATIONS_FILE, location_map_files };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { dedent } from "../dedent.js";
|
|
1
2
|
// src/compiler/link/manifest.ts
|
|
2
3
|
/**
|
|
3
4
|
* `virtual:ogygia/manifest` emitter — a legacy stub. Hydrate modules are loaded via
|
|
4
5
|
* `<ogygia-region entry>` URLs, not this map; only the `dev` flag is still read.
|
|
5
6
|
*/
|
|
6
7
|
function manifest_module(is_dev) {
|
|
7
|
-
return `
|
|
8
|
+
return dedent`
|
|
9
|
+
export const dev = ${is_dev ? "true" : "false"};
|
|
10
|
+
export const regions = {};
|
|
11
|
+
`;
|
|
8
12
|
}
|
|
9
13
|
export { manifest_module };
|
|
@@ -20,8 +20,13 @@ export type RuntimeMarks = {
|
|
|
20
20
|
* driver's import scan; gates the cross-island context bridge (~4.7 kB) out of apps that never
|
|
21
21
|
* provide context. Read-only providers (`getContext`) don't set it — there's nothing to bridge. */
|
|
22
22
|
context?: boolean;
|
|
23
|
+
/** Island code can reach Kit's page world: `$app/state` / `$app/stores` / `$app/navigation`
|
|
24
|
+
* (anything under `$app/` but `environment` and `paths`), or code the driver's island-closure walk
|
|
25
|
+
* cannot follow (a package, an unresolvable import), or a client plugin / federation that hands
|
|
26
|
+
* the runtime islands the walk never saw. Gates the page seed and the MPA navigation handle. */
|
|
27
|
+
page?: boolean;
|
|
23
28
|
};
|
|
24
|
-
export type FeatureId = "remote-seeds" | "wire" | "frames" | "lakes" | "morph" | "live" | "interaction" | "forms" | "router" | "context";
|
|
29
|
+
export type FeatureId = "remote-seeds" | "page" | "wire" | "wire-classes" | "frames" | "lakes" | "morph" | "live" | "interaction" | "forms" | "mpa-nav" | "router" | "context";
|
|
25
30
|
/**
|
|
26
31
|
* WHICH CHUNK a feature lives in. The runtime ships as two static, feature-sized phases:
|
|
27
32
|
*
|
|
@@ -68,4 +73,16 @@ export declare function generateRuntimeEntrySource(marks: RuntimeMarks, runtimeD
|
|
|
68
73
|
export declare function generateHydrateFeaturesSource(marks: RuntimeMarks, runtimeDir: string, all?: boolean): {
|
|
69
74
|
code: string;
|
|
70
75
|
features: FeatureId[];
|
|
71
|
-
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Emit `virtual:ogygia/runtime-flags`: build-time constants for code that lives INSIDE the always-on
|
|
79
|
+
* region element rather than in a feature module, because it works on the element's own state. The
|
|
80
|
+
* bundler inlines an imported `const` and drops the branches it switches off, so the code a flag
|
|
81
|
+
* guards ships exactly when the feature it serves does. Same marks as the entries; `all` (dev / no
|
|
82
|
+
* marks): every flag on.
|
|
83
|
+
*
|
|
84
|
+
* - `FRAMES`: the `frames` feature is in the build — some region streams HTML (a deferred hole, a
|
|
85
|
+
* live region, a lake). Without the frame store a region's fetch has nowhere to land, so the
|
|
86
|
+
* element's fetch / apply / morph / renew path is dead code then.
|
|
87
|
+
*/
|
|
88
|
+
export declare function generateRuntimeFlagsSource(marks: RuntimeMarks, all?: boolean): string;
|