@ogygia/core 0.11.4 → 0.11.5

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/KeepHost.svelte +1 -1
  3. package/dist/LiveHost.svelte +1 -1
  4. package/dist/NestedProvider.svelte +1 -1
  5. package/dist/SlotBoundary.svelte +1 -1
  6. package/dist/compiler/driver.js +53 -11
  7. package/dist/compiler/ids.d.ts +3 -0
  8. package/dist/compiler/ids.js +4 -1
  9. package/dist/compiler/index.d.ts +2 -2
  10. package/dist/compiler/index.js +2 -2
  11. package/dist/compiler/kit.d.ts +7 -0
  12. package/dist/compiler/kit.js +22 -10
  13. package/dist/compiler/link/runtime-entry.d.ts +19 -2
  14. package/dist/compiler/link/runtime-entry.js +34 -1
  15. package/dist/compiler/program.d.ts +4 -0
  16. package/dist/compiler/program.js +5 -1
  17. package/dist/context.d.ts +3 -12
  18. package/dist/context.js +1 -16
  19. package/dist/internal.d.ts +2 -1
  20. package/dist/internal.js +2 -1
  21. package/dist/nested.d.ts +11 -0
  22. package/dist/nested.js +19 -0
  23. package/dist/ref-sink.d.ts +15 -0
  24. package/dist/ref-sink.js +19 -0
  25. package/dist/ref.d.ts +2 -2
  26. package/dist/ref.js +1 -11
  27. package/dist/runtime/core.js +7 -5
  28. package/dist/runtime/full.js +5 -1
  29. package/dist/runtime/hydrate-core.d.ts +4 -4
  30. package/dist/runtime/hydrate-core.js +8 -5
  31. package/dist/runtime/nav-handle.d.ts +3 -0
  32. package/dist/runtime/nav-handle.js +12 -5
  33. package/dist/runtime/region-ids.js +2 -2
  34. package/dist/runtime/remote-seeds.js +14 -3
  35. package/dist/runtime/seeds.d.ts +10 -5
  36. package/dist/runtime/seeds.js +16 -12
  37. package/dist/runtime/slots.d.ts +16 -0
  38. package/dist/runtime/slots.js +2 -0
  39. package/dist/runtime/wire-classes.d.ts +2 -0
  40. package/dist/runtime/wire-classes.js +10 -1
  41. package/dist/runtime/wire-format.d.ts +4 -1
  42. package/dist/runtime/wire-format.js +6 -1
  43. package/dist/seed-ref-reviver.d.ts +24 -0
  44. package/dist/seed-ref-reviver.js +44 -0
  45. package/dist/seed-refs.d.ts +2 -16
  46. package/dist/seed-refs.js +1 -33
  47. package/dist/server/props-wire.js +2 -1
  48. package/package.json +3 -3
package/README.md CHANGED
@@ -6,4 +6,4 @@ Apps install [`ogygia`](https://www.npmjs.com/package/ogygia), which re-exports
6
6
  subpath. Plugin packages (`@ogygia/flags`, `@ogygia/devtools`, …) build on `@ogygia/core` and its
7
7
  `@ogygia/core/plugin` door.
8
8
 
9
- Docs: [ogygiajs.dev](https://ogygiajs.dev)
9
+ Docs: [@ogygia/core](https://ogygiajs.dev/docs/core/overview), with [Writing a plugin](https://ogygiajs.dev/docs/core/plugins).
@@ -4,7 +4,7 @@
4
4
  // as NestedProvider mirrors it). LiveHost has no `{#if}`: it hydrates a live region's render()
5
5
  // output, and a kept island hydrated through it met the server's `[0` branch marker where it
6
6
  // expected the component's own, discarding the server DOM on every load. NOT part of the public API.
7
- import { setNested } from "./context.js";
7
+ import { setNested } from "./nested.js";
8
8
  let { component: Component, initialProps } = $props();
9
9
  // Seed once from the incoming prop; later pages replace it via setProps(). Intentional initial read.
10
10
  // svelte-ignore state_referenced_locally
@@ -4,7 +4,7 @@
4
4
  // NestedProvider, its props are `$state` and it exposes `setProps` — so a live tick updates the
5
5
  // MOUNTED component reactively instead of tearing it down and re-hydrating. Focus and local island
6
6
  // state survive; Svelte reconciles the view. NOT part of the public API.
7
- import { setNested } from "./context.js";
7
+ import { setNested } from "./nested.js";
8
8
  let { component: Component, initialProps } = $props();
9
9
  // Seed once from the incoming prop; later ticks replace it via setProps(). Intentional initial read.
10
10
  // svelte-ignore state_referenced_locally
@@ -5,7 +5,7 @@
5
5
  // `class:`-driven `position: fixed` drops to `static` for a frame). SELF-CLOSING on purpose: any
6
6
  // slot content here would pass an implicit `children` snippet that OVERRIDES the decoded
7
7
  // `props.children` (the revived slot/region snippet) and desyncs hydration with an extra anchor.
8
- import { setNested } from "./context.js";
8
+ import { setNested } from "./nested.js";
9
9
  let { component: Component, props } = $props();
10
10
  setNested();
11
11
  </script>
@@ -5,7 +5,7 @@
5
5
  * (`<ogygia-region>` + payload) so the runtime can wake it independently after the parent ADOPTS the
6
6
  * slot DOM. Server-only in practice (the client adopts, never re-renders slot children).
7
7
  */
8
- import { setNested } from "./context.js";
8
+ import { setNested } from "./nested.js";
9
9
  let { children } = $props();
10
10
  setNested(false);
11
11
  </script>
@@ -1,10 +1,10 @@
1
1
  import { createHash, dir_entries, fs, path } from "./host.js";
2
2
  import { fnv1a32 } from "../runtime/hash.js";
3
3
  import { CLIENT_BINDING_STUB, is_island_path, transformHost, transformTsRegions, wrapperVirtualId } from "./region/transform.js";
4
- import { clean_stale_ogygia_dirs, hasAnyCsrTrueRoute, kit_dirs, routeCsrIsFalse, routeCsrIsTrue } from "./kit.js";
4
+ import { clean_stale_ogygia_dirs, hasAnyCsrTrueRoute, is_route_component, kit_dirs, routeCsrIsFalse, routeCsrIsTrue } from "./kit.js";
5
5
  import { run_module_macros } from "./macros/pipeline.js";
6
6
  import { is_script_request } from "./script-request.js";
7
- import { generateHydrateFeaturesSource, generateRuntimeEntrySource, resolveFeatures } from "./link/runtime-entry.js";
7
+ import { generateHydrateFeaturesSource, generateRuntimeEntrySource, generateRuntimeFlagsSource, resolveFeatures } from "./link/runtime-entry.js";
8
8
  import { resolveFoucImportSpec } from "./fouc-css.js";
9
9
  import { appendSvelteModuleRegistrations, appendTransportRegistrations, moduleHasTransportable, svelteModuleHasTransportable } from "./content/transportables.js";
10
10
  import { APP_SHIM_IMPORT, FOREIGN_HYDRATE_MARK, rewrite_lake_import_to_placeholder } from "./region/emit.js";
@@ -20,7 +20,7 @@ import { PAGE_DATA_READS_TOKEN, server_island_ids, server_islands_module, server
20
20
  import { manifest_module } from "./link/manifest.js";
21
21
  import { dev_hmr_client_source } from "./dev/dev-hmr.js";
22
22
  import { island_vpaths_affected_by_file, same_module_path } from "./dev/hmr.js";
23
- import { 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_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 } from "./ids.js";
23
+ import { 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_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 } from "./ids.js";
24
24
  import { host_key, strip_id } from "./program.js";
25
25
  import { mentions_page_store, page_data_keys_answer } from "./link/page-keys.js";
26
26
  import { export_names, is_registry_stub_id, registry_client_id, registry_client_path, registry_client_source, registry_stub_names, registry_stub_source, static_script_specs } from "./link/registry-stub.js";
@@ -46,8 +46,13 @@ const RUNTIME_ENTRY_NAME = "og-runtime";
46
46
  const LEADING_SLASH = /^\//;
47
47
  const BACKSLASH_G = /\\/g;
48
48
  const COMPONENT_EXT_RE = /\.(svelte|js|ts)$/;
49
- /** A Kit route host file (`+page.svelte`, `+layout.ts`, …) — the page node's own client modules. */
50
- const ROUTE_HOST_FILE_RE = /^\+(page|layout)\.(svelte|ts|js|mjs)$/;
49
+ /** A Kit route option module (`+page.ts`, `+layout.js`, …) — the page node's own client modules
50
+ * beside its component (kit.ts `is_route_component`). */
51
+ const ROUTE_HOST_FILE_RE = /^\+(page|layout)\.(ts|js|mjs)$/;
52
+ /** The real binding modules a host imports for a marked region (ids.ts `regionBindingVirtualId`,
53
+ * transform.ts `wrapperVirtualId`). */
54
+ const REGION_BINDING_PREFIX = "virtual:ogygia/region/";
55
+ const WRAPPER_PREFIX = "virtual:ogygia/wrapper/";
51
56
  /** A `.ts`/`.js` module that can be a region registry (a minted `.ts` region host). */
52
57
  const TS_REGISTRY_EXT_RE = /\.(ts|js|mjs)$/;
53
58
  /** A Svelte rune module (`.svelte.ts` / `.svelte.js`). */
@@ -60,6 +65,10 @@ const SERVER_DIR_RE = /\/(src\/lib\/server|server)\//;
60
65
  /** Static import / export-from / `import()` specifiers, for the island-graph dep walk (shared `g`
61
66
  * regex — `walk_dep` resets `lastIndex` before each scan). */
62
67
  const IMPORT_SPEC_G = /\bfrom\s*['"]([^'"\n]+)['"]|\bimport\s*['"]([^'"\n]+)['"]|\bimport\s*\(\s*['"]([^'"\n]+)['"]/g;
68
+ const PAGE_FREE_APP_MODULES = /* @__PURE__ */ new Set(["$app/environment", "$app/paths"]);
69
+ const ASSET_EXTS = "css|scss|sass|less|styl|pcss|postcss|json|svg|png|jpe?g|gif|webp|avif|ico|bmp|woff2?|ttf|otf|eot|txt|wasm|mp4|webm|mp3|wav";
70
+ const ASSET_EXT_RE = new RegExp(`\\.(?:${ASSET_EXTS})$`, "i");
71
+ const PAGE_FREE_UNRESOLVED_RE = new RegExp(`^svelte(?:\\/[\\w/-]+)?$|\\.(?:${ASSET_EXTS})(?:\\?[^/]*)?$`, "i");
63
72
  /** The extensions an extension-less island import may resolve to (bare, then index files). */
64
73
  const ISLAND_DEP_EXTS = [
65
74
  "",
@@ -283,7 +292,7 @@ var Compiler = class {
283
292
  const { prof, P, outHash } = this.profiler;
284
293
  const ssr = opts.ssr !== false;
285
294
  const routesDir = kit_dirs(ctx.root).routes_dir;
286
- const is_layout_host = path.basename(id) === "+layout.svelte";
295
+ const is_layout_host = is_route_component(path.basename(id), "layout");
287
296
  const link_virtual = opts.linkVirtual !== void 0 ? opts.linkVirtual : ssr || !routeCsrIsFalse(id, routesDir) || is_layout_host && hasAnyCsrTrueRoute(routesDir);
288
297
  const route_csr = routeCsrIsTrue(id, routesDir) ? true : routeCsrIsFalse(id, routesDir) ? false : void 0;
289
298
  const cache_key = `${id}\0${ssr ? "s" : "c"}\0${link_virtual ? "1" : "0"}\0${route_csr === true ? "t" : route_csr === false ? "f" : "n"}`;
@@ -384,7 +393,9 @@ var Compiler = class {
384
393
  const src = ctx.read_file(full);
385
394
  if (src == null) return;
386
395
  if (!runtime_marks.context && source_uses_ogygia_context(src)) runtime_marks.context = true;
387
- if (!program.crosses_wire && (name.endsWith(".remote.ts") || name.endsWith(".remote.js") || source_crosses_wire(src))) program.crosses_wire = true;
396
+ const remote = name.endsWith(".remote.ts") || name.endsWith(".remote.js");
397
+ if (remote) runtime_marks.remoteSeeds = true;
398
+ if (!program.crosses_wire && (remote || source_crosses_wire(src))) program.crosses_wire = true;
388
399
  {
389
400
  const specs = extract_module_specs(src);
390
401
  if (specs.length) program.module_specs.set(full, specs);
@@ -453,6 +464,7 @@ var Compiler = class {
453
464
  }
454
465
  }
455
466
  if (transportable_modules.size > 0) runtime_marks.wire = true;
467
+ runtime_marks.page = program.island_reads_page || ctx.foreign_hydrate || ctx.client_plugins.length > 0;
456
468
  runtime_marks.complete = true;
457
469
  program.runtime_feature_hash = createHash("sha256").update(resolveFeatures(runtime_marks).join(",")).digest("hex").slice(0, 8);
458
470
  }
@@ -519,16 +531,25 @@ var Compiler = class {
519
531
  island_graph.add(norm);
520
532
  added.push(norm);
521
533
  }
522
- if (!SOURCE_EXT_RE.test(norm)) return;
534
+ if (!SOURCE_EXT_RE.test(norm)) {
535
+ if (!ASSET_EXT_RE.test(norm)) this.program.island_reads_page = true;
536
+ return;
537
+ }
523
538
  const src = ctx.read_file(norm);
524
539
  if (src == null) return;
525
540
  IMPORT_SPEC_G.lastIndex = 0;
526
541
  let m;
527
542
  while (m = IMPORT_SPEC_G.exec(src)) {
528
543
  const spec = m[1] || m[2] || m[3];
529
- if (!spec || spec[0] === "\0" || spec.startsWith("$app/") || spec.startsWith("$env/") || spec.startsWith("virtual:")) continue;
544
+ if (!spec || spec[0] === "\0") continue;
545
+ if (spec.startsWith("$app/")) {
546
+ if (!PAGE_FREE_APP_MODULES.has(spec)) this.program.island_reads_page = true;
547
+ continue;
548
+ }
549
+ if (spec.startsWith("$env/") || spec.startsWith("virtual:")) continue;
530
550
  const dep = resolve_dep(spec, norm);
531
551
  if (dep) walk(dep);
552
+ else if (!PAGE_FREE_UNRESOLVED_RE.test(spec)) this.program.island_reads_page = true;
532
553
  }
533
554
  };
534
555
  walk(componentAbs);
@@ -782,6 +803,11 @@ var Compiler = class {
782
803
  const ch = client_hooks_boot(ctx);
783
804
  return ch.imports + code + ch.call;
784
805
  }
806
+ if (id === RESOLVED("virtual:ogygia/runtime-flags")) {
807
+ if (!ctx.is_build) return generateRuntimeFlagsSource({}, true);
808
+ this.prescan();
809
+ return generateRuntimeFlagsSource(program.runtime_marks);
810
+ }
785
811
  if (id === RESOLVED("virtual:ogygia/hydrate-features")) {
786
812
  if (!ctx.is_build) {
787
813
  const rt = dev_runtime_of(ctx.runtime_dir);
@@ -789,7 +815,8 @@ var Compiler = class {
789
815
  return rt?.ts ? code.split(".js\";").join(".ts\";") : code;
790
816
  }
791
817
  this.prescan();
792
- return `import ${JSON.stringify(V_FN_MANIFEST)};\n` + generateHydrateFeaturesSource(program.runtime_marks, ctx.runtime_dir).code;
818
+ const marks = program.runtime_marks;
819
+ return (marks.wire === true || marks.context === true || program.crosses_wire ? `import ${JSON.stringify(V_FN_MANIFEST)};\n` : "") + generateHydrateFeaturesSource(marks, ctx.runtime_dir).code;
793
820
  }
794
821
  if (id === RESOLVED("virtual:ogygia-runtime")) {
795
822
  const ch = client_hooks_boot(ctx);
@@ -901,6 +928,7 @@ var Compiler = class {
901
928
  if (source === "virtual:ogygia-runtime") return RESOLVED(V_RUNTIME);
902
929
  if (source === "virtual:ogygia/runtime-entry") return RESOLVED(V_RUNTIME_ENTRY);
903
930
  if (source === "virtual:ogygia/hydrate-features") return RESOLVED(V_HYDRATE_FEATURES);
931
+ if (source === "virtual:ogygia/runtime-flags") return RESOLVED(V_RUNTIME_FLAGS);
904
932
  if (source === "virtual:ogygia/dev-hmr") return RESOLVED(V_DEV_HMR);
905
933
  if (source === "virtual:ogygia/dev-hmr-url") return RESOLVED(V_DEV_HMR_URL);
906
934
  if (source === "virtual:ogygia/devtools-boot") return RESOLVED(V_DEVTOOLS_BOOT);
@@ -924,6 +952,7 @@ var Compiler = class {
924
952
  if (source === "virtual:ogygia/request-event") return RESOLVED(V_REQUEST_EVENT);
925
953
  if (source === "virtual:ogygia/region-endpoint") return RESOLVED(V_REGION_ENDPOINT);
926
954
  if (source === "virtual:ogygia/client-binding-stub") return ctx.client_binding_stub_file;
955
+ if (!ssr && ctx.is_build && importer && (source.startsWith(REGION_BINDING_PREFIX) || source.startsWith(WRAPPER_PREFIX)) && this.#links_client_stub(importer)) return ctx.client_binding_stub_file;
927
956
  if (source.startsWith("virtual:ogygia/fouc-css/") || source.startsWith("virtual:ogygia/fouc-scoped/")) return RESOLVED(source);
928
957
  if (source === "virtual:ogygia/transport") return RESOLVED(V_TRANSPORT);
929
958
  if (source === "virtual:ogygia/transportables") return RESOLVED(V_TRANSPORTABLES);
@@ -993,11 +1022,24 @@ var Compiler = class {
993
1022
  }
994
1023
  /** True for a csr=false route host file (`+page`/`+layout` `.svelte`/`.ts`/`.js`). A `+page.ts`
995
1024
  * shares its route's world with the sibling `.svelte` host. */
1025
+ /** A route COMPONENT whose client leg links the binding stub — `transform`'s `link_virtual` rule,
1026
+ * for a host that could not apply it itself: csr=false, and not a layout of an app with a
1027
+ * csr=true route (Kit can hydrate that layout: a csr=true child page, or an error render). */
1028
+ #links_client_stub(importer) {
1029
+ const importer_abs = strip_id(importer);
1030
+ const routes_dir = kit_dirs(this.#ctx.root).routes_dir;
1031
+ if (!importer_abs.startsWith(routes_dir + path.sep)) return false;
1032
+ const base = path.basename(importer_abs);
1033
+ if (is_route_component(base, "layout")) return routeCsrIsFalse(importer_abs, routes_dir) && !hasAnyCsrTrueRoute(routes_dir);
1034
+ return is_route_component(base, "page") && routeCsrIsFalse(importer_abs, routes_dir);
1035
+ }
996
1036
  #is_csr_false_route_host(importer) {
997
1037
  const importer_abs = strip_id(importer);
998
1038
  const routes_dir = kit_dirs(this.#ctx.root).routes_dir;
999
1039
  if (!importer_abs.startsWith(routes_dir + path.sep)) return false;
1000
- const m = ROUTE_HOST_FILE_RE.exec(path.basename(importer_abs));
1040
+ const base = path.basename(importer_abs);
1041
+ if (is_route_component(base, "page") || is_route_component(base, "layout")) return routeCsrIsFalse(importer_abs, routes_dir);
1042
+ const m = ROUTE_HOST_FILE_RE.exec(base);
1001
1043
  if (!m) return false;
1002
1044
  return routeCsrIsFalse(path.join(importer_abs, "..", `+${m[1]}.svelte`), routes_dir);
1003
1045
  }
@@ -10,6 +10,9 @@ export declare const V_RUNTIME = "virtual:ogygia-runtime";
10
10
  export declare const V_RUNTIME_ENTRY = "virtual:ogygia/runtime-entry";
11
11
  /** Generated hydrate-phase feature module — imported statically by the hydrate core (link/runtime-entry.ts). */
12
12
  export declare const V_HYDRATE_FEATURES = "virtual:ogygia/hydrate-features";
13
+ /** Generated build-time constants for code the always-on core gates in place (link/runtime-entry.ts
14
+ * `generateRuntimeFlagsSource`): the bundler inlines them and drops what they switch off. */
15
+ export declare const V_RUNTIME_FLAGS = "virtual:ogygia/runtime-flags";
13
16
  export declare const V_DEV_HMR = "virtual:ogygia/dev-hmr";
14
17
  export declare const V_DEV_HMR_URL = "virtual:ogygia/dev-hmr-url";
15
18
  export declare const V_DEVTOOLS_BOOT = "virtual:ogygia/devtools-boot";
@@ -11,6 +11,9 @@ const V_RUNTIME = "virtual:ogygia-runtime";
11
11
  const V_RUNTIME_ENTRY = "virtual:ogygia/runtime-entry";
12
12
  /** Generated hydrate-phase feature module — imported statically by the hydrate core (link/runtime-entry.ts). */
13
13
  const V_HYDRATE_FEATURES = "virtual:ogygia/hydrate-features";
14
+ /** Generated build-time constants for code the always-on core gates in place (link/runtime-entry.ts
15
+ * `generateRuntimeFlagsSource`): the bundler inlines them and drops what they switch off. */
16
+ const V_RUNTIME_FLAGS = "virtual:ogygia/runtime-flags";
14
17
  const V_DEV_HMR = "virtual:ogygia/dev-hmr";
15
18
  const V_DEV_HMR_URL = "virtual:ogygia/dev-hmr-url";
16
19
  const V_DEVTOOLS_BOOT = "virtual:ogygia/devtools-boot";
@@ -83,4 +86,4 @@ const regionBindingVirtualId = (iid) => `virtual:ogygia/region/${iid}.js`;
83
86
  * applies one level up: what a page ships is decided by what it RENDERED, never by its import graph.
84
87
  */
85
88
  const lazyEntryVirtualId = (iid) => `virtual:ogygia/lazy/${iid}.js`;
86
- export { 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 };
89
+ export { 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 };
@@ -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, 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 };
@@ -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, 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 };
@@ -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`
@@ -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) === "+page.svelte") for (const f of OPTION_FILES_PAGE) {
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 === "+page.svelte") return own_chain_csr_false(hostFile, routesDir);
285
- if (base !== "+layout.svelte") return false;
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
- if (base !== "+page.svelte" && base !== "+layout.svelte") return false;
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 (base === "+page.svelte") return !own_chain_csr_false(hostFile, routesDir);
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 === "+page.svelte") leaves.push(full);
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 (names.has("+layout.svelte") || has(LAYOUT_UNIVERSAL) || has(LAYOUT_SERVER)) {
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 (names.has("+page.svelte") || has(PAGE_UNIVERSAL) || has(PAGE_SERVER)) {
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 };
@@ -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;
@@ -12,6 +12,11 @@ const FEATURES = {
12
12
  deps: [],
13
13
  detect: (m) => m.forms === true || m.forms !== false && m.router === true
14
14
  },
15
+ "mpa-nav": {
16
+ module: "nav-handle.js",
17
+ deps: [],
18
+ detect: (m) => m.page !== false
19
+ },
15
20
  router: {
16
21
  module: "router.js",
17
22
  deps: [],
@@ -39,12 +44,23 @@ const FEATURES = {
39
44
  phase: "hydrate",
40
45
  detect: (m) => m.wire === true
41
46
  },
47
+ "wire-classes": {
48
+ module: "wire-classes.js",
49
+ deps: [],
50
+ detect: (m) => m.wire === true
51
+ },
42
52
  "remote-seeds": {
43
53
  module: "remote-seeds.js",
44
54
  deps: [],
45
55
  phase: "hydrate",
46
56
  detect: (m) => m.remoteSeeds !== false
47
57
  },
58
+ page: {
59
+ module: "seeds.js",
60
+ deps: [],
61
+ phase: "hydrate",
62
+ detect: (m) => m.page !== false
63
+ },
48
64
  frames: {
49
65
  module: "frames.js",
50
66
  deps: [],
@@ -59,13 +75,16 @@ const FEATURES = {
59
75
  };
60
76
  const FEATURE_ORDER = [
61
77
  "remote-seeds",
78
+ "page",
62
79
  "wire",
80
+ "wire-classes",
63
81
  "frames",
64
82
  "lakes",
65
83
  "morph",
66
84
  "live",
67
85
  "interaction",
68
86
  "forms",
87
+ "mpa-nav",
69
88
  "router",
70
89
  "context"
71
90
  ];
@@ -129,4 +148,18 @@ function generateHydrateFeaturesSource(marks, runtimeDir, all = false) {
129
148
  features
130
149
  };
131
150
  }
132
- export { FEATURES, FEATURE_ORDER, generateHydrateFeaturesSource, generateRuntimeEntrySource, phaseFeatures, resolveFeatures };
151
+ /**
152
+ * Emit `virtual:ogygia/runtime-flags`: build-time constants for code that lives INSIDE the always-on
153
+ * region element rather than in a feature module, because it works on the element's own state. The
154
+ * bundler inlines an imported `const` and drops the branches it switches off, so the code a flag
155
+ * guards ships exactly when the feature it serves does. Same marks as the entries; `all` (dev / no
156
+ * marks): every flag on.
157
+ *
158
+ * - `FRAMES`: the `frames` feature is in the build — some region streams HTML (a deferred hole, a
159
+ * live region, a lake). Without the frame store a region's fetch has nowhere to land, so the
160
+ * element's fetch / apply / morph / renew path is dead code then.
161
+ */
162
+ function generateRuntimeFlagsSource(marks, all = false) {
163
+ return `export const FRAMES = ${all || resolveFeatures(marks).includes("frames")};\n`;
164
+ }
165
+ export { FEATURES, FEATURE_ORDER, generateHydrateFeaturesSource, generateRuntimeEntrySource, generateRuntimeFlagsSource, phaseFeatures, resolveFeatures };
@@ -120,6 +120,10 @@ export declare class Program {
120
120
  * Set during the prescan walk; with `runtime_marks.wire` it decides whether `ogygia.transport`
121
121
  * (the generated `virtual:ogygia/kit-transport`) carries the codec cluster or is an empty map. */
122
122
  crosses_wire: boolean;
123
+ /** Island code can reach Kit's page world (`$app/state` and kin, or something the island-closure
124
+ * walk could not follow — driver.ts `mark_island_closure`). Folded into `runtime_marks.page` at
125
+ * the end of the prescan, with the other ways islands the walk never saw reach the runtime. */
126
+ island_reads_page: boolean;
123
127
  /** Build-time capability marks for the sticky runtime entry. Incomplete → kitchen-sink. */
124
128
  readonly runtime_marks: RuntimeMarks;
125
129
  /** The resolved feature set folded into the runtime chunk name (busts the immutable URL when the
@@ -72,6 +72,10 @@ var Program = class {
72
72
  * Set during the prescan walk; with `runtime_marks.wire` it decides whether `ogygia.transport`
73
73
  * (the generated `virtual:ogygia/kit-transport`) carries the codec cluster or is an empty map. */
74
74
  crosses_wire = false;
75
+ /** Island code can reach Kit's page world (`$app/state` and kin, or something the island-closure
76
+ * walk could not follow — driver.ts `mark_island_closure`). Folded into `runtime_marks.page` at
77
+ * the end of the prescan, with the other ways islands the walk never saw reach the runtime. */
78
+ island_reads_page = false;
75
79
  /** Build-time capability marks for the sticky runtime entry. Incomplete → kitchen-sink. */
76
80
  runtime_marks;
77
81
  /** The resolved feature set folded into the runtime chunk name (busts the immutable URL when the
@@ -84,7 +88,7 @@ var Program = class {
84
88
  complete: false,
85
89
  forms: init.forms,
86
90
  wire: false,
87
- remoteSeeds: true,
91
+ remoteSeeds: false,
88
92
  hydrate: [],
89
93
  defer: [],
90
94
  persistKeys: [],
package/dist/context.d.ts CHANGED
@@ -1,14 +1,4 @@
1
- /**
2
- * Mark the current subtree's hydration state. `true` = inside a hydrated island (nested islands
3
- * degrade). `false` = a LAKE resets its subtree to "dead", so an island inside the lake self-
4
- * hydrates again (the nearest-boundary rule — DESIGN.md).
5
- */
6
- export declare function setNested(value?: boolean): void;
7
- /**
8
- * True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
9
- * when no ancestor set it (a top-level island) — that absence is exactly "not nested".
10
- */
11
- export declare function isNested(): boolean;
1
+ import { isNested, setNested } from "./nested.js";
12
2
  /** Mark the current subtree as opaque to Kit — a lake's inside (LakeBoundary). */
13
3
  export declare function setInLake(): void;
14
4
  /** True when the subtree is opaque to Kit (a lake's inside, or a held region's render). */
@@ -69,4 +59,5 @@ export declare function claim_region_css(hrefs: string[]): string[];
69
59
  * injects the same script into `<head>` (presence-checked) on pages that have no island to emit it.
70
60
  * Client / no-request → false (SSR already emitted).
71
61
  */
72
- export declare function claimRuntimeEmit(): boolean;
62
+ export declare function claimRuntimeEmit(): boolean;
63
+ export { isNested, setNested };
package/dist/context.js CHANGED
@@ -1,25 +1,10 @@
1
1
  import { kit_hydrates_page } from "./runtime/kit-boot.js";
2
+ import { isNested, setNested } from "./nested.js";
2
3
  import { getContext, setContext } from "svelte";
3
4
  import { BROWSER } from "esm-env";
4
5
  import { getRequestEvent } from "virtual:ogygia/request-event";
5
6
  import { csr_true_routes, error_csr_true_routes, root_layout_csr_true } from "virtual:ogygia/route-csr";
6
7
  // src/context.ts
7
- const NESTED_KEY = Symbol.for("ogygia.nested-island");
8
- /**
9
- * Mark the current subtree's hydration state. `true` = inside a hydrated island (nested islands
10
- * degrade). `false` = a LAKE resets its subtree to "dead", so an island inside the lake self-
11
- * hydrates again (the nearest-boundary rule — DESIGN.md).
12
- */
13
- function setNested(value = true) {
14
- setContext(NESTED_KEY, value);
15
- }
16
- /**
17
- * True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
18
- * when no ancestor set it (a top-level island) — that absence is exactly "not nested".
19
- */
20
- function isNested() {
21
- return getContext(NESTED_KEY) === true;
22
- }
23
8
  const LAKE_KEY = Symbol.for("ogygia.lake-subtree");
24
9
  /** Mark the current subtree as opaque to Kit — a lake's inside (LakeBoundary). */
25
10
  function setInLake() {
@@ -1,6 +1,7 @@
1
1
  import { og_entry_hydrate, og_entry_unmount } from "./entry-hydrate.js";
2
- import { documentIsCsrTrue, isNested, setNested } from "./context.js";
2
+ import { documentIsCsrTrue } from "./context.js";
3
3
  import { __register_transportable } from "./live-transport.js";
4
+ import { isNested, setNested } from "./nested.js";
4
5
  import { __og_$, __register_fn } from "./fn-transport.js";
5
6
  import { __og_store, __register_store_factory, mark_store } from "./store-transport.js";
6
7
  import { __og_boundary, configure_boundary } from "./boundary.js";
package/dist/internal.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { og_entry_hydrate, og_entry_unmount } from "./entry-hydrate.js";
2
- import { documentIsCsrTrue, isNested, setNested } from "./context.js";
2
+ import { documentIsCsrTrue } from "./context.js";
3
3
  import { __register_transportable } from "./live-transport.js";
4
4
  import { __og_$, __register_fn } from "./fn-transport.js";
5
5
  import { __og_store, __register_store_factory, mark_store } from "./store-transport.js";
6
6
  import { __og_boundary, configure_boundary } from "./boundary.js";
7
+ import { isNested, setNested } from "./nested.js";
7
8
  import { __og_source } from "./source.js";
8
9
  import { __tag_context } from "./context-bridge.js";
9
10
  import { og_portable } from "./region-snippet.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mark the current subtree's hydration state. `true` = inside a hydrated island (nested islands
3
+ * degrade). `false` = a LAKE resets its subtree to "dead", so an island inside the lake self-
4
+ * hydrates again (the nearest-boundary rule — DESIGN.md).
5
+ */
6
+ export declare function setNested(value?: boolean): void;
7
+ /**
8
+ * True when an ancestor island wrapper already marked the subtree. `getContext` returns `undefined`
9
+ * when no ancestor set it (a top-level island) — that absence is exactly "not nested".
10
+ */
11
+ export declare function isNested(): boolean;