@ogygia/compiler 0.0.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -1
  3. package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
  4. package/dist/app-spec.d.ts +18 -0
  5. package/dist/app-spec.js +22 -0
  6. package/dist/blank-styles.d.ts +1 -0
  7. package/dist/blank-styles.js +24 -0
  8. package/dist/bom.d.ts +2 -0
  9. package/dist/bom.js +7 -0
  10. package/dist/build-cache.d.ts +13 -0
  11. package/dist/build-cache.js +65 -0
  12. package/dist/ctx.d.ts +238 -0
  13. package/dist/ctx.js +221 -0
  14. package/dist/dev/css-scope.d.ts +16 -0
  15. package/dist/dev/css-scope.js +32 -0
  16. package/dist/dev/dev-hmr.d.ts +24 -0
  17. package/dist/dev/dev-hmr.js +51 -0
  18. package/dist/dev/hmr.d.ts +34 -0
  19. package/dist/dev/hmr.js +52 -0
  20. package/dist/driver.d.ts +351 -0
  21. package/dist/driver.js +1402 -0
  22. package/dist/exports/index.d.ts +77 -0
  23. package/dist/exports/index.js +349 -0
  24. package/dist/exports/parse.d.ts +65 -0
  25. package/dist/exports/parse.js +251 -0
  26. package/dist/fouc-css.d.ts +112 -0
  27. package/dist/fouc-css.js +314 -0
  28. package/dist/free-vars.d.ts +32 -0
  29. package/dist/free-vars.js +454 -0
  30. package/dist/fs.d.ts +31 -0
  31. package/dist/fs.js +82 -0
  32. package/dist/ids.d.ts +49 -0
  33. package/dist/ids.js +52 -0
  34. package/dist/index.d.ts +23 -0
  35. package/dist/index.js +23 -0
  36. package/dist/kit.d.ts +204 -0
  37. package/dist/kit.js +554 -0
  38. package/dist/leg.d.ts +34 -0
  39. package/dist/leg.js +26 -0
  40. package/dist/link/analyses.d.ts +26 -0
  41. package/dist/link/analyses.js +237 -0
  42. package/dist/link/build-output.d.ts +47 -0
  43. package/dist/link/build-output.js +168 -0
  44. package/dist/link/caps.d.ts +32 -0
  45. package/dist/link/caps.js +39 -0
  46. package/dist/link/context-detect.d.ts +28 -0
  47. package/dist/link/context-detect.js +143 -0
  48. package/dist/link/emit-gate.d.ts +43 -0
  49. package/dist/link/emit-gate.js +55 -0
  50. package/dist/link/file-token.d.ts +11 -0
  51. package/dist/link/file-token.js +15 -0
  52. package/dist/link/island-deps.d.ts +183 -0
  53. package/dist/link/island-deps.js +802 -0
  54. package/dist/link/location-map.d.ts +24 -0
  55. package/dist/link/location-map.js +51 -0
  56. package/dist/link/own-reach.d.ts +15 -0
  57. package/dist/link/own-reach.js +188 -0
  58. package/dist/link/registry-stub.d.ts +50 -0
  59. package/dist/link/registry-stub.js +163 -0
  60. package/dist/link/relocations.d.ts +79 -0
  61. package/dist/link/relocations.js +204 -0
  62. package/dist/link/router-css.d.ts +38 -0
  63. package/dist/link/router-css.js +124 -0
  64. package/dist/link/runtime-entry.d.ts +103 -0
  65. package/dist/link/runtime-entry.js +183 -0
  66. package/dist/link/server-manifest.d.ts +25 -0
  67. package/dist/link/server-manifest.js +102 -0
  68. package/dist/link/transport.d.ts +42 -0
  69. package/dist/link/transport.js +91 -0
  70. package/dist/macros/dollar.d.ts +24 -0
  71. package/dist/macros/dollar.js +397 -0
  72. package/dist/macros/pipeline.d.ts +50 -0
  73. package/dist/macros/pipeline.js +133 -0
  74. package/dist/macros/source.d.ts +9 -0
  75. package/dist/macros/source.js +115 -0
  76. package/dist/macros/store.d.ts +22 -0
  77. package/dist/macros/store.js +217 -0
  78. package/dist/macros/wire.d.ts +17 -0
  79. package/dist/macros/wire.js +116 -0
  80. package/dist/map-chain.d.ts +18 -0
  81. package/dist/map-chain.js +42 -0
  82. package/dist/messages.d.ts +673 -0
  83. package/dist/messages.js +938 -0
  84. package/dist/ownership-stamps.d.ts +11 -0
  85. package/dist/ownership-stamps.js +112 -0
  86. package/dist/parse/oxc.d.ts +36 -0
  87. package/dist/parse/oxc.js +35 -0
  88. package/dist/parse/roots.d.ts +4 -0
  89. package/dist/parse/roots.js +27 -0
  90. package/dist/parse/scan.d.ts +65 -0
  91. package/dist/parse/scan.js +297 -0
  92. package/dist/parse/svelte-ast.d.ts +7 -0
  93. package/dist/parse/svelte-ast.js +99 -0
  94. package/dist/program.d.ts +140 -0
  95. package/dist/program.js +304 -0
  96. package/dist/queries.d.ts +105 -0
  97. package/dist/queries.js +326 -0
  98. package/dist/region/emit.d.ts +168 -0
  99. package/dist/region/emit.js +292 -0
  100. package/dist/region/identity.d.ts +32 -0
  101. package/dist/region/identity.js +46 -0
  102. package/dist/region/ir.d.ts +56 -0
  103. package/dist/region/ir.js +0 -0
  104. package/dist/region/marked-imports.d.ts +27 -0
  105. package/dist/region/marked-imports.js +265 -0
  106. package/dist/region/transform.d.ts +189 -0
  107. package/dist/region/transform.js +1565 -0
  108. package/dist/scan-facts.d.ts +36 -0
  109. package/dist/scan-facts.js +54 -0
  110. package/dist/script-request.d.ts +1 -0
  111. package/dist/script-request.js +33 -0
  112. package/dist/splice.d.ts +11 -0
  113. package/dist/splice.js +33 -0
  114. package/dist/transportables.d.ts +23 -0
  115. package/dist/transportables.js +144 -0
  116. package/dist/virtual/core.d.ts +158 -0
  117. package/dist/virtual/core.js +588 -0
  118. package/dist/virtual/resolver.d.ts +62 -0
  119. package/dist/virtual/resolver.js +265 -0
  120. package/dist/virtual/specifier.d.ts +10 -0
  121. package/dist/virtual/specifier.js +6 -0
  122. package/dist/virtual/table.d.ts +120 -0
  123. package/dist/virtual/table.js +54 -0
  124. package/dist/virtual/types.d.ts +17 -0
  125. package/dist/virtual/types.js +100 -0
  126. package/dist/virtual/value-names.d.ts +2 -0
  127. package/dist/virtual/value-names.js +18 -0
  128. package/dist/vite/definers.d.ts +16 -0
  129. package/dist/vite/definers.js +69 -0
  130. package/dist/vite/dev-maps.d.ts +34 -0
  131. package/dist/vite/dev-maps.js +91 -0
  132. package/dist/vite/index.d.ts +21 -0
  133. package/dist/vite/index.js +890 -0
  134. package/dist/vite/kit-dirs.d.ts +6 -0
  135. package/dist/vite/kit-dirs.js +53 -0
  136. package/dist/vite/late-island.d.ts +8 -0
  137. package/dist/vite/late-island.js +18 -0
  138. package/dist/vite/lazy-files.d.ts +2 -0
  139. package/dist/vite/lazy-files.js +72 -0
  140. package/dist/vite/options.d.ts +195 -0
  141. package/dist/vite/options.js +72 -0
  142. package/dist/vite/package-files.d.ts +3 -0
  143. package/dist/vite/package-files.js +88 -0
  144. package/dist/vite/paths.d.ts +16 -0
  145. package/dist/vite/paths.js +39 -0
  146. package/dist/vite/plugin-api.d.ts +316 -0
  147. package/dist/vite/plugin-api.js +328 -0
  148. package/dist/vite/route-watch.d.ts +15 -0
  149. package/dist/vite/route-watch.js +32 -0
  150. package/dist/vite/session.d.ts +28 -0
  151. package/dist/vite/session.js +43 -0
  152. package/dist/vite/sourcemaps.d.ts +19 -0
  153. package/dist/vite/sourcemaps.js +75 -0
  154. package/dist/vite/style-preprocess.d.ts +2 -0
  155. package/dist/vite/style-preprocess.js +84 -0
  156. package/dist/vite/svelte-entries.d.ts +4 -0
  157. package/dist/vite/svelte-entries.js +10 -0
  158. package/dist/vite/svelte-options.d.ts +20 -0
  159. package/dist/vite/svelte-options.js +22 -0
  160. package/package.json +87 -12
package/dist/ids.js ADDED
@@ -0,0 +1,52 @@
1
+ import { specifier } from "./virtual/specifier.js";
2
+ // src/ids.ts
3
+ /** Generated sticky entry — static-imports only the features selected from build marks. */
4
+ const V_RUNTIME_ENTRY = specifier("boot", "runtime-entry");
5
+ const V_SERVER_MANIFEST = specifier("server", "server-manifest");
6
+ /** The server regions' loaders (`id → () => import(entry)`), reached only through the manifest's
7
+ * `load_server_regions()` — see link/server-manifest.ts for why they live one dynamic import away. */
8
+ const V_SERVER_REGIONS = specifier("server", "server-regions");
9
+ const V_TRANSPORT = specifier("region", "transport");
10
+ const V_TRANSPORTABLES = specifier("region", "transportables");
11
+ /** the string the profiler maps module exports until the build fills it (build-time only: never in
12
+ * runtime code, so the one literal in the output is the one to replace) */
13
+ const PROFILER_MAPS_PLACEHOLDER = "__ogygia_profiler_maps_placeholder__";
14
+ /** the filled maps payload's mark: gzipped JSON, base64 (devtools' build/profiler-maps.ts writes it, the
15
+ * profiler's embedded-maps reads it) */
16
+ const PROFILER_MAPS_GZ_PREFIX = "gz:";
17
+ /** The region realm's per-file families (declared in ./virtual/core.ts), by their id under the
18
+ * realm: a prefix ends in `/`, and the rest of the id names the file. */
19
+ const REGION_FAMILY = {
20
+ entry: "entry/",
21
+ binding: "binding/",
22
+ lazy: "lazy/",
23
+ wrapper: "wrapper/",
24
+ fouc_css: "fouc-css/",
25
+ fouc_scoped: "fouc-scoped/",
26
+ registry_stub: "registry-stub/",
27
+ client_binding_stub: "client-binding-stub"
28
+ };
29
+ /** A region family's specifier (a prefix, for the per-file ones). */
30
+ const region_family = (k) => specifier("region", REGION_FAMILY[k]);
31
+ /** Resolve a virtual id to its `\0`-prefixed resolved form (Vite/rollup convention). */
32
+ const RESOLVED = (id) => `\0${id}`;
33
+ /** Virtual region ENTRY module id — JS re-export of the real component (not a thin .svelte). */
34
+ const islandVirtualId = (iid) => `${region_family("entry")}${iid}.js`;
35
+ /**
36
+ * Region-binding module id. A `with { region: 'raw' }` import is rewritten to import this JS
37
+ * module, whose source is leg-split by the plugin `load` hook: the SSR leg carries the server
38
+ * signer (so `region()` can mint a capability), the client leg is metadata-only (no server
39
+ * code crosses into the browser bundle).
40
+ */
41
+ const regionBindingVirtualId = (iid) => `${region_family("binding")}${iid}.js`;
42
+ /**
43
+ * The wake region wrapper's CLIENT-leg component source — the leg-split twin of the wrapper: the SSR
44
+ * wrapper imports the region entry (it must render), the client wrapper imports THIS, a module that
45
+ * imports the entry only when the document rendered the region (emit.ts `lazy_entry_source`). It is
46
+ * how a csr=true host's page graph stops at the wrapper, the same rule the csr=false registry stub
47
+ * applies one level up: what a page ships is decided by what it RENDERED, never by its import graph.
48
+ */
49
+ const lazyEntryVirtualId = (iid) => `${region_family("lazy")}${iid}.js`;
50
+ /** The wake region wrapper's component id. */
51
+ const wrapperVirtualId = (iid) => `${region_family("wrapper")}${iid}.svelte`;
52
+ export { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, REGION_FAMILY, RESOLVED, V_RUNTIME_ENTRY, V_SERVER_MANIFEST, V_SERVER_REGIONS, V_TRANSPORT, V_TRANSPORTABLES, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId, region_family, wrapperVirtualId };
@@ -0,0 +1,23 @@
1
+ import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, ImportKeys, PRESET_KEYS, STABLE_NAME_DIR, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions } from "./region/transform.js";
2
+ import { AstNode, parse_module } from "./parse/oxc.js";
3
+ import { parse_roots } from "./parse/roots.js";
4
+ import { ComponentCss, CssReachOptions, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, WalkResolve, buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, isFoucCssId, isFoucScopedId, listStaticImports, scoped_component_css, svelteHasStyle, through_caller } from "./fouc-css.js";
5
+ import { collectCaptureInfo, collectFreeIdentifiers, collectSnippetNames, collect_pattern_names, free_references, scope_bindings } from "./free-vars.js";
6
+ import { regionId, regionIdentity, strategyKey } from "./region/identity.js";
7
+ import { Compiler, Profiler } from "./driver.js";
8
+ import { Program, host_key, strip_id } from "./program.js";
9
+ import { CompileCtx, CompileCtxInit } from "./ctx.js";
10
+ import { Fs, FsEntry, MemoryFs, memory_fs, node_fs } from "./fs.js";
11
+ import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, REGION_FAMILY, RESOLVED, V_RUNTIME_ENTRY, V_SERVER_MANIFEST, V_SERVER_REGIONS, V_TRANSPORT, V_TRANSPORTABLES, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId, region_family, wrapperVirtualId } from "./ids.js";
12
+ import { OGYGIA_SCHEME } from "./virtual/specifier.js";
13
+ import { Change, ExportIndex, ExportMap, Leaf, Policy, Shapes } from "./exports/index.js";
14
+ import { ImportDecl, ImportSpec, analyze_imports } from "./exports/parse.js";
15
+ import { blank_styles } from "./blank-styles.js";
16
+ import { is_script_request } from "./script-request.js";
17
+ import "./virtual/table.js";
18
+ import { BUILD_ERRORS, BUILD_WARNINGS } from "./messages.js";
19
+ import { JsRegion, OgCall, find_og_calls, is_js_module, og_js_regions, split_first_string } from "./parse/scan.js";
20
+ import { og_member } from "./macros/wire.js";
21
+ import { BuildCache, __set_build_cache_root, configure_build_cache } from "./build-cache.js";
22
+ import { OWN_FILE_RE, content_css_key, dedent } from "@ogygia/core/contract";
23
+ export { type AstNode, BUILD_ERRORS, BUILD_WARNINGS, BuildCache, CLIENT_BINDING_STUB, type Change, CompileCtx, type CompileCtxInit, Compiler, ComponentCss, CssReachOptions, DEFAULT_IMPORT_KEYS, ExportIndex, type ExportMap, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, type Fs, type FsEntry, ISLAND_DIR, type ImportDecl, ImportKeys, type ImportSpec, type JsRegion, type Leaf, type MemoryFs, OGYGIA_SCHEME, OWN_FILE_RE, type OgCall, PRESET_KEYS, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, type Policy, type Profiler, Program, REGION_FAMILY, RESOLVED, STABLE_NAME_DIR, Shapes, V_RUNTIME_ENTRY, V_SERVER_MANIFEST, V_SERVER_REGIONS, V_TRANSPORT, V_TRANSPORTABLES, WalkResolve, __set_build_cache_root, analyze_imports, blank_styles, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_pattern_names, compileFoucScopedCss, configure_build_cache, content_css_key, dedent, find_og_calls, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, free_references, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, is_js_module, is_script_request, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, memory_fs, node_fs, normalize_hydrate_value, normalize_import_keys, normalize_region_value, og_js_regions, og_member, parse_module, parse_roots, regionBindingVirtualId, regionId, regionIdentity, region_family, scope_bindings, scoped_component_css, split_first_string, strategyKey, strip_id, svelteHasStyle, through_caller, transformHost, transformTsRegions, wrapperVirtualId };
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, ISLAND_DIR, PRESET_KEYS, STABLE_NAME_DIR, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_hydrate_value, normalize_import_keys, normalize_region_value, transformHost, transformTsRegions } from "./region/transform.js";
2
+ import { parse_module } from "./parse/oxc.js";
3
+ import { parse_roots } from "./parse/roots.js";
4
+ import { FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, buildFoucCssModuleSource, collectFoucCssReachable, compileFoucScopedCss, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, isFoucCssId, isFoucScopedId, listStaticImports, scoped_component_css, svelteHasStyle, through_caller } from "./fouc-css.js";
5
+ import { collectCaptureInfo, collectFreeIdentifiers, collectSnippetNames, collect_pattern_names, free_references, scope_bindings } from "./free-vars.js";
6
+ import { Compiler } from "./driver.js";
7
+ import { Program, host_key, strip_id } from "./program.js";
8
+ import { CompileCtx } from "./ctx.js";
9
+ import { OGYGIA_SCHEME } from "./virtual/specifier.js";
10
+ import { memory_fs, node_fs } from "./fs.js";
11
+ import { PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, REGION_FAMILY, RESOLVED, V_RUNTIME_ENTRY, V_SERVER_MANIFEST, V_SERVER_REGIONS, V_TRANSPORT, V_TRANSPORTABLES, islandVirtualId, lazyEntryVirtualId, regionBindingVirtualId, region_family, wrapperVirtualId } from "./ids.js";
12
+ import { ExportIndex, Shapes } from "./exports/index.js";
13
+ import { regionId, regionIdentity, strategyKey } from "./region/identity.js";
14
+ import { analyze_imports } from "./exports/parse.js";
15
+ import { blank_styles } from "./blank-styles.js";
16
+ import { is_script_request } from "./script-request.js";
17
+ import "./virtual/table.js";
18
+ import { BUILD_ERRORS, BUILD_WARNINGS } from "./messages.js";
19
+ import { find_og_calls, is_js_module, og_js_regions, split_first_string } from "./parse/scan.js";
20
+ import { og_member } from "./macros/wire.js";
21
+ import { BuildCache, __set_build_cache_root, configure_build_cache } from "./build-cache.js";
22
+ import { OWN_FILE_RE, content_css_key, dedent } from "@ogygia/core/contract";
23
+ export { BUILD_ERRORS, BUILD_WARNINGS, BuildCache, CLIENT_BINDING_STUB, CompileCtx, Compiler, DEFAULT_IMPORT_KEYS, ExportIndex, FOUC_CSS_PREFIX, FOUC_SCOPED_PREFIX, ISLAND_DIR, OGYGIA_SCHEME, OWN_FILE_RE, PRESET_KEYS, PROFILER_MAPS_GZ_PREFIX, PROFILER_MAPS_PLACEHOLDER, Program, REGION_FAMILY, RESOLVED, STABLE_NAME_DIR, Shapes, V_RUNTIME_ENTRY, V_SERVER_MANIFEST, V_SERVER_REGIONS, V_TRANSPORT, V_TRANSPORTABLES, __set_build_cache_root, analyze_imports, blank_styles, buildFoucCssModuleSource, collectCaptureInfo, collectFoucCssReachable, collectFreeIdentifiers, collectSnippetNames, collect_pattern_names, compileFoucScopedCss, configure_build_cache, content_css_key, dedent, find_og_calls, foucCssVirtualId, foucRelFromId, foucScopedVirtualId, free_references, host_key, import_keys_hint, isFoucCssId, isFoucScopedId, is_island_path, is_js_module, is_script_request, islandChunkFileName, islandId, islandPublicUrl, islandVirtualId, lazyEntryVirtualId, listStaticImports, memory_fs, node_fs, normalize_hydrate_value, normalize_import_keys, normalize_region_value, og_js_regions, og_member, parse_module, parse_roots, regionBindingVirtualId, regionId, regionIdentity, region_family, scope_bindings, scoped_component_css, split_first_string, strategyKey, strip_id, svelteHasStyle, through_caller, transformHost, transformTsRegions, wrapperVirtualId };
package/dist/kit.d.ts ADDED
@@ -0,0 +1,204 @@
1
+ import { Fs, FsEntry } from "./fs.js";
2
+ import { Queries, Query } from "./queries.js";
3
+ /** A file event, as the bundler's watcher names it. */
4
+ export type FileEvent = "create" | "update" | "delete";
5
+ /** Route config is asked for by route file and by the keys the plugins claim. */
6
+ export type Keyed = readonly [file: string, keys: readonly string[]];
7
+ /**
8
+ * Kit's route trees and route config as one file system holds them: each answer is a query
9
+ * (./queries.ts) over the files and directory listings it read, so a file event reads again only
10
+ * what was read of that file, and computes again only the answers that read it (`touch`).
11
+ */
12
+ export interface Routes {
13
+ readonly fs: Fs;
14
+ readonly db: Queries;
15
+ /** A file's text (null: none). */
16
+ readonly text: Query<string, string | null>;
17
+ /** A directory's entries as it lists them (null: not a directory). */
18
+ readonly listing: Query<string, readonly FsEntry[] | null>;
19
+ /** What is at a path, links followed. */
20
+ readonly at: Query<string, "file" | "dir" | null>;
21
+ /** Each option file's `csr`. */
22
+ readonly csr_of_file: Query<string, boolean | undefined>;
23
+ /** Each module's claimed `config` keys. */
24
+ readonly config_of_file: Query<Keyed, Record<string, unknown>>;
25
+ /** routesDir → Kit's route tree of it (its shape: which nodes, which layouts each page uses). */
26
+ readonly route_tree: Query<string, RouteTree>;
27
+ /** routesDir → each node's csr as Kit's static analysis computes it, by `RouteNode.index`. */
28
+ readonly node_csr: Query<string, readonly (boolean | undefined)[]>;
29
+ /** routesDir + keys → every page's merged config. */
30
+ readonly page_config: Query<Keyed, Record<string, Record<string, unknown>>>;
31
+ /** routesDir → does any page have csr=true. */
32
+ readonly has_csr_true: Query<string, boolean>;
33
+ /**
34
+ * A file event at `abs`: read again what anything read of it (its text, what is at it, and on an
35
+ * add or a delete every listing above it). Whether a route answer changed: an edit that leaves
36
+ * every route's options as they were changes none.
37
+ */
38
+ touch(abs: string, event: FileEvent): boolean;
39
+ }
40
+ /** The route reader for one file system: the same one each time it is asked for, so the disk has
41
+ * one set of answers however many compile contexts read it. */
42
+ export declare function route_reader(files: Fs): Routes;
43
+ /** The Kit-internal + app paths ogygia deep-imports (resolved off the APP root, not this package). */
44
+ export interface KitPaths {
45
+ /** Kit's internal wire-protocol module (deep import), or null → built-in devalue codec fallback. */
46
+ kit_wire_path: string | null;
47
+ /** Kit's client remote-functions entry (Plan A reuse), or null. */
48
+ kit_remote_index: string | null;
49
+ /** The app's universal hooks (`src/hooks.{ts,js}`) for `transport`, or null when absent. */
50
+ universal_hooks: string | null;
51
+ /** The app's CLIENT hooks (`src/hooks.client.{ts,js}`), or null. Kit runs this file only when its
52
+ * client app boots — which a csr=false page never does — so ogygia runs its `init` on boot there
53
+ * (client-side monitoring, third-party bootstraps otherwise silently never load). */
54
+ client_hooks: string | null;
55
+ /** Kit 3's client codec module (`#app/internal/transport`), or null on Kit 2. Kit 3's remote
56
+ * argument encoding reads the app's transport from it, and only Kit's client boot fills it — so on
57
+ * a csr=false page a custom-type remote argument failed to encode until ogygia filled it too. */
58
+ kit_transport_init: string | null;
59
+ }
60
+ /**
61
+ * Locate Kit's internal wire-protocol + client remote-functions modules by resolving `@sveltejs/kit`'s
62
+ * package.json (that IS exported) and joining the src path — deep-importing the file bypasses the exports
63
+ * map. Also finds the app's universal hooks. Resolved from the APP root (`createRequire` off a root path),
64
+ * so a monorepo sub-package still finds Kit. Never throws (a missing Kit → the devalue-codec fallback).
65
+ */
66
+ export declare function resolve_kit_paths(root: string): KitPaths;
67
+ /**
68
+ * The app's Kit MAJOR version (resolved off the app root, like {@link resolve_kit_paths}), or null when
69
+ * no Kit resolves. The one fact `kit_asset` needs: Kit 2's `asset()` takes a path with its leading
70
+ * slash, Kit 3's without — and no runtime probe can tell them apart (Kit 2 refuses a slash-less path
71
+ * only in dev; in a build it returns it page-relative, and every island entry on a nested page 404'd).
72
+ */
73
+ export declare function kit_major(root: string): number | null;
74
+ export interface KitDirs {
75
+ /** absolute `kit.files.routes` (default `<root>/src/routes`) */
76
+ routes_dir: string;
77
+ /** absolute `kit.outDir` (default `<root>/.svelte-kit`) */
78
+ out_dir: string;
79
+ }
80
+ export declare const DEFAULT_KIT_DIRS: {
81
+ readonly routes: "src/routes";
82
+ readonly out: ".svelte-kit";
83
+ };
84
+ /** An app's Kit config, as the plugin that read it holds it (vite/kit-dirs.ts). */
85
+ export interface KitConfig {
86
+ dirs: KitDirs;
87
+ /** `kit.inlineStyleThreshold` in bytes (0: inline nothing) */
88
+ inline_style_threshold: number;
89
+ }
90
+ /** The dirs an app with no Kit config has. */
91
+ export declare function default_kit_dirs(root: string): KitDirs;
92
+ /** Read `export const csr = true|false` from a route options file; `undefined` if unset/absent. */
93
+ export declare function read_csr(r: Routes, file: string): boolean | undefined;
94
+ /**
95
+ * The claimed keys `export const config = {…}` sets in one route module: its literal-valued top-level
96
+ * properties named in `keys`. `{}` when the file, the export or the keys are absent (a spread or a
97
+ * `config` that is not an object literal is Kit's to read, not ours). A claimed key with a computed
98
+ * value is a build error: it is read at build time, so ogygia could not honour it.
99
+ */
100
+ export declare function read_route_config(r: Routes, file: string, keys: readonly string[]): Record<string, unknown>;
101
+ /**
102
+ * A route COMPONENT of `kind`: `+page.svelte`, a page with a layout reset (`+page@.svelte`,
103
+ * `+page@(app).svelte`), or either in any other extension the app compiles to a component
104
+ * (`+page.md`, `+page.svx`): every `+page` file but the option scripts, as Kit routes them.
105
+ */
106
+ export declare function is_route_component(name: string, kind: "page" | "layout"): boolean;
107
+ type RouteNodeKind = "layout" | "error" | "leaf";
108
+ interface RouteNode {
109
+ readonly kind: RouteNodeKind;
110
+ readonly route: Route;
111
+ component: string | null;
112
+ reset: string | undefined;
113
+ parent: RouteNode | null;
114
+ layouts: RouteNode[];
115
+ pages: RouteNode[];
116
+ index: number;
117
+ }
118
+ interface Route {
119
+ readonly dir: string;
120
+ readonly segment: string;
121
+ readonly parent: Route | null;
122
+ layout: RouteNode | null;
123
+ error: RouteNode | null;
124
+ leaf: RouteNode | null;
125
+ }
126
+ interface RouteTree {
127
+ readonly routes: Route[];
128
+ readonly nodes: RouteNode[];
129
+ }
130
+ /**
131
+ * The ERROR-RENDER csr of every page route: Kit renders a page's `+error.svelte` with the page's
132
+ * layouts only (`PageNodes(layouts)` in its server renderer, the page node dropped), so `csr` for a
133
+ * 404 / 500 under a `csr = false` page is the layouts' answer, usually `true`.
134
+ */
135
+ export declare function errorCsrTrueRouteIds(r: Routes, routesDir: string): string[];
136
+ /** The error-render csr of a ROUTELESS response (no route matched: Kit renders the root layout and
137
+ * the root error page) — the root layout's own option, Kit's default `true` when unset. */
138
+ export declare function rootLayoutCsrTrue(r: Routes, routesDir: string): boolean;
139
+ /**
140
+ * Kit-effective `csr === false` for a page or layout host. A page reads Kit's chain: its own
141
+ * option, else the layouts it renders in (a `@` reset skips the ones between). A LAYOUT is
142
+ * csr=false exactly when EVERY page it serves is csr=false; a layout no page renders in reads its
143
+ * own chain.
144
+ * @param hostFile abs path to a route component
145
+ * @param routesDir abs `src/routes`
146
+ */
147
+ export declare function routeCsrIsFalse(r: Routes, hostFile: string, routesDir: string): boolean;
148
+ /**
149
+ * True when `hostFile` is a route host whose islands ogygia must STRIP (Kit hydrates every page
150
+ * this host serves). Pages: Kit's own-chain rule (default true, or an explicit `csr = true` that
151
+ * beats a `false` up the chain). LAYOUTS: strippable ONLY when no page at/below them is
152
+ * csr=false — on a mixed layout both this and {@link routeCsrIsFalse} are false (shared world:
153
+ * islands kept, `documentIsCsrTrue` degrades them per document). `false` for non-route files
154
+ * (shared components): their csr depends on which page renders them, so they keep their islands.
155
+ */
156
+ export declare function routeCsrIsTrue(r: Routes, hostFile: string, routesDir: string): boolean;
157
+ /** Kit's `route.id` for a page host, with layout GROUP segments (`(app)`) stripped — the same
158
+ * normalization {@link csrTrueRouteIds} applies, so the two sides match whether or not Kit keeps
159
+ * groups in `route.id`. Root → `/`. */
160
+ export declare function normalize_route_id(id: string): string;
161
+ /**
162
+ * The set of route ids (Kit `route.id`, group-stripped) whose EFFECTIVE csr is TRUE — i.e. Kit
163
+ * hydrates the whole document there. A csr=false layout's islands rendered under one of these must
164
+ * degrade to inline on BOTH legs (Kit owns hydration); Region reads this map on the server, and
165
+ * `kit_hydrates_page()` is the identical client signal. Empty for a fully csr=false app (the norm);
166
+ * only the csr=true exceptions land here.
167
+ */
168
+ export declare function csrTrueRouteIds(r: Routes, routesDir: string): string[];
169
+ /** Every page route id (group-stripped) → its merged config, claimed keys only. Every route with a
170
+ * `+page` file counts, a redirect-only `+page.server.ts` too. A key no level sets is absent, so the
171
+ * plugin applies its default; a page that sets none maps to `{}`. */
172
+ export declare function page_route_config(r: Routes, routesDir: string, keys: readonly string[]): Record<string, Record<string, unknown>>;
173
+ /**
174
+ * Does the app have ANY csr=true page (Kit hydrates the whole document there)? Drives whether a
175
+ * csr=false LAYOUT must link its island wrapper on the CLIENT leg: on a csr=true child page Kit
176
+ * hydrates the layout, so its chrome islands must be REAL wrappers (Region degrades them inline),
177
+ * not the thin stub the pure-csr=false path uses. A pure-csr=false app keeps the stub (thin client
178
+ * graph); only mixed apps pay for the layout wrappers.
179
+ */
180
+ export declare function hasAnyCsrTrueRoute(r: Routes, routesDir: string): boolean;
181
+ /** The directory of the build-time keepalive layout; the route tree never walks into it. */
182
+ export declare const KEEP_CLIENT_DIR = ".ogygia-keep-client";
183
+ /**
184
+ * Replicates Kit's `manifest_data.nodes.every(n => n.page_options?.csr === false)`, the exact
185
+ * condition under which Kit skips the client build, over every node of the route tree (layouts,
186
+ * error pages and pages, Kit's fallback root layout and error page included) with each node's csr
187
+ * resolved as Kit resolves it. A single node whose csr is `true` or unset keeps the build alive.
188
+ * When this is true, ogygia's runtime is never emitted, so index.ts injects the keepalive (its own
189
+ * directory is not part of the tree). A statically unanalysable option file can only err toward a
190
+ * keepalive Kit did not need: a harmless extra client build, never a 404.
191
+ */
192
+ export declare function clientBuildWillSkip(r: Routes, routesDir: string): boolean;
193
+ /**
194
+ * True when AT LEAST ONE page route is csr=false. A pure csr=true app (this returns false) needs no
195
+ * ogygia runtime at all — Kit hydrates everything itself — so the runtime chunk is skipped entirely.
196
+ */
197
+ export declare function hasAnyCsrFalseRoute(r: Routes, routesDir: string): boolean;
198
+ /** On-disk path of the injected keepalive route in an app's routes dir. */
199
+ export declare function keep_client_dir(routes_dir: string): string;
200
+ /** Write the URL-less `csr = true` keepalive layout into the app's routes (removed at process exit). */
201
+ export declare function inject_keep_client_route(routes_dir: string): void;
202
+ /** Remove leftover on-disk `.ogygia` trees from an earlier materialization approach. */
203
+ export declare function clean_stale_ogygia_dirs(dir: string): void;
204
+ export {};