@ogygia/compiler 0.0.0 → 0.14.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.
Files changed (156) 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 +349 -0
  21. package/dist/driver.js +1401 -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 +102 -0
  27. package/dist/fouc-css.js +304 -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 +198 -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 +672 -0
  83. package/dist/messages.js +938 -0
  84. package/dist/ownership-stamps.d.ts +9 -0
  85. package/dist/ownership-stamps.js +101 -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 +56 -0
  119. package/dist/virtual/resolver.js +249 -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 +118 -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 +874 -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 +11 -0
  137. package/dist/vite/late-island.js +19 -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 +14 -0
  145. package/dist/vite/paths.js +37 -0
  146. package/dist/vite/plugin-api.d.ts +316 -0
  147. package/dist/vite/plugin-api.js +328 -0
  148. package/dist/vite/session.d.ts +28 -0
  149. package/dist/vite/session.js +43 -0
  150. package/dist/vite/sourcemaps.d.ts +19 -0
  151. package/dist/vite/sourcemaps.js +75 -0
  152. package/dist/vite/style-preprocess.d.ts +2 -0
  153. package/dist/vite/style-preprocess.js +84 -0
  154. package/dist/vite/svelte-entries.d.ts +4 -0
  155. package/dist/vite/svelte-entries.js +10 -0
  156. package/package.json +87 -12
@@ -0,0 +1,349 @@
1
+ import { transformTsRegions } from "./region/transform.js";
2
+ import { FileEvent } from "./kit.js";
3
+ import { RelocateCx } from "./link/relocations.js";
4
+ import { CoreApp, CorePlugins } from "./virtual/core.js";
5
+ import { Leg, Part } from "./virtual/table.js";
6
+ import { StepMap } from "./map-chain.js";
7
+ import { BuildLeg } from "./leg.js";
8
+ import { Program } from "./program.js";
9
+ import { CompileCtx } from "./ctx.js";
10
+ import { SourceMap } from "magic-string";
11
+ /** The bundler's `emitFile` for an entry chunk, by `name` (the output pattern content-hashes it).
12
+ * Returns the reference id. */
13
+ export type EmitChunk = (chunk: {
14
+ type: "chunk";
15
+ id: string;
16
+ name: string;
17
+ }) => string;
18
+ /** The app's scan, finished (`Compiler.prescan`): what the build knows before the bundler walks. */
19
+ export interface Scan {
20
+ /** The resolved runtime feature set, folded into the runtime chunk's name: it busts the immutable
21
+ * URL when the app's features change. Both legs scan the same source, so both name it alike. */
22
+ readonly feature_hash: string;
23
+ }
24
+ /** Shared OGYGIA_PROFILE instrument — the adapter owns the maps/counters; the driver writes into
25
+ * them so the transform-phase metrics (and the determinism digest source) live with the transform. */
26
+ export interface Profiler {
27
+ prof: {
28
+ transformMs: number;
29
+ transformN: number;
30
+ transformHit: number;
31
+ prescanMs: number;
32
+ /** time in plugin macros (`b.macro`), and how many calls */
33
+ macroMs: number;
34
+ macroN: number;
35
+ resolveMs: number;
36
+ loadMs: number;
37
+ };
38
+ P: boolean;
39
+ outHash: Map<string, number>;
40
+ }
41
+ /**
42
+ * The island shim for an `$app/*` import, by specifier or by where Kit's alias sent it: Vite's alias
43
+ * plugin runs before any plugin's resolveId, so an import the transform did not rewrite (a module
44
+ * that joined the island graph late) arrives as `<kit>/src/runtime/app/state`, `…/state/index.js`.
45
+ */
46
+ export declare function app_shim_for(source: string, shims: Record<string, string>): string | null;
47
+ export declare class Compiler implements CoreApp {
48
+ #private;
49
+ readonly profiler: Profiler;
50
+ /** The build's program: registry, graph and the scan's facts. */
51
+ get program(): Program;
52
+ get transform_cache(): Map<string, {
53
+ code: string;
54
+ result: unknown;
55
+ }>;
56
+ /** Every `import.meta.og.$` hoist collected across the build (tag → factory source). Filled by
57
+ * `macros()`; drained by the adapter's fn-manifest emit (dev load leg, renderChunk, writeBundle). */
58
+ get dollar_hoists(): Map<string, string>;
59
+ /**
60
+ * Open leg `name` (the bundler environment a build hook runs in; `server` when its output runs in
61
+ * Node). A leg that already ran in this build begins the next one (watch, a second `build()` in
62
+ * one process): everything the last build learned is dropped. Dev is one build for the session.
63
+ * True when this leg begins a build, so the caller runs its once-per-build work; Kit's route
64
+ * answers are read afresh from there.
65
+ */
66
+ start_leg(name: string, server: boolean): boolean;
67
+ /**
68
+ * The leg a hook runs in: its environment's, else (a hook the bundler calls without one) the one
69
+ * leg open now. Refused when that is not one leg (`build_leg_unclear`): two legs open at once
70
+ * cannot be told apart. Dev opens an environment's leg on its first use.
71
+ */
72
+ leg(env: {
73
+ name: string;
74
+ server: boolean;
75
+ } | null): BuildLeg;
76
+ /** Leg `name` of this build, if it started (a reader that may run outside any leg). */
77
+ find_leg(name: string): BuildLeg | undefined;
78
+ /**
79
+ * A leg ends (its bundle is written): `env`'s, else (a hook the bundler calls without one) the one
80
+ * leg open now. With two open (a dev server closing: its legs live for the session) there is no
81
+ * one leg to end, and none ends. Ending a leg that already ended does nothing (closeBundle may run
82
+ * again).
83
+ */
84
+ end_leg(env: string | null): void;
85
+ /**
86
+ * DEV, after each transform: the virtual modules whose last load read something (the registry,
87
+ * the marks, a fold over the files' scan facts) that has since changed, for the adapter to
88
+ * invalidate. One rule for every reader: the server manifest emitted while a host's rows were
89
+ * dropped for its edit (every hole answered 403 until a restart), the runtime entry chosen before
90
+ * a page's first `idle` region (it never woke: test/dev-regions-reload.test.ts), and the wire
91
+ * loaders, Kit's codecs and the router CSS roots read before a file's facts changed
92
+ * (test/dev-scan-facts.test.ts). A registry module a load answered null while no host held it is
93
+ * named once a host registers it.
94
+ */
95
+ moved(): string[];
96
+ /** The resolved compile context (the bundler's resolved config, read once it is resolved). */
97
+ get ctx(): CompileCtx;
98
+ /** The app's Kit routes directory (a virtual module that reads it reloads on a route change). */
99
+ routes_dir(): string;
100
+ /** The plugins listed beside `ogygia()`. */
101
+ plugins(): CorePlugins;
102
+ /** The modules of one leg's built output that its realms may not hold (./virtual/resolver.ts). */
103
+ misplaced_modules(module_ids: Iterable<string>, ssr: boolean): [string, string][];
104
+ /** A module's named imports of a realm module, per entry (./virtual/resolver.ts). */
105
+ split_realm_imports(code: string): string | null;
106
+ /** A dev change to a part of the session: the resolved ids of the virtual modules whose last load
107
+ * read it (or anything else that has moved), for the caller to invalidate. */
108
+ changed(part: Part): string[];
109
+ /**
110
+ * DEV: a file was added, changed or removed. What the route answers read of it is read again
111
+ * (`Routes.touch`); when none of that changed, nothing is invalidated. Else the ids to invalidate
112
+ * are the virtual modules that read the routes AND every module compiled for a csr world that is
113
+ * no longer its own: a host compiled for csr=true has its marks stripped, so a page that became
114
+ * csr=false kept no regions until a restart (test/dev-csr-change.test.ts). Its old rows go now;
115
+ * its next transform registers anew.
116
+ */
117
+ routes_changed(file: string, event: FileEvent): string[];
118
+ /** A compile session, made once the bundler has resolved the build (`ctx`): nothing runs before
119
+ * its context exists. */
120
+ constructor(program: Program, profiler: Profiler, ctx: CompileCtx);
121
+ /** A compiler with context `ctx` that carries on this one's build (its program, legs and caches):
122
+ * the next environment of a builder that shares one plugin across them. */
123
+ with_ctx(ctx: CompileCtx): Compiler;
124
+ /**
125
+ * Devtools: the `island id → component name` map, read at call time off the live registry (so a
126
+ * dev-server middleware serves a COMPLETE, current map — no stale virtual-module snapshot). Keys
127
+ * are the island id (`<hash>` in `ogygia:region/entry/<hash>.js`); values the component's
128
+ * basename. A held/generated island with no source file is skipped (the tab keeps its short hash).
129
+ */
130
+ region_names(): Record<string, string>;
131
+ /**
132
+ * Each module that marks region imports (a host, by its absolute path), with the module ids its
133
+ * regions are built from: their components and the modules minted for them. Read at call time
134
+ * off the live registry, like {@link region_names}.
135
+ */
136
+ region_hosts(): Map<string, Set<string>>;
137
+ /**
138
+ * Run the module-macro passes (`wire`/`$`/`source`/`store`/auto-brand, then the plugins' macros)
139
+ * over one module — the leg that must land before the island transform / svelte compile /
140
+ * ts-region minting sees it. `source` is the CURRENT text (a plugin's pre-transform may already have
141
+ * edited it). Returns `{ code, touched, maps }`, one map per pass that changed the text.
142
+ */
143
+ macros(source: string, id: string, watch?: (file: string) => void): Promise<{
144
+ code: string;
145
+ touched: boolean;
146
+ maps: StepMap[];
147
+ }>;
148
+ /**
149
+ * Transform a content (`.svx`/`.md`) island source the markdown preprocessor hands back — always
150
+ * wrapper-linked (`linkVirtual: true`), because a preprocessor output is shared across the ssr/client
151
+ * legs and can't take the csr=false stub split; content files aren't routes, so they'd get wrappers
152
+ * anyway. Registers the descriptors and returns the rewritten code, or `null` when it has no islands.
153
+ * This is the transform the adapter installs on the content-island bridge.
154
+ */
155
+ transform_content_island(source: string, filename: string): string | null;
156
+ /**
157
+ * Lower one file and register nothing: the caller registers the returned descriptors into the
158
+ * `Program`. Memoized per id, leg and csr world, and only while the source is the same.
159
+ */
160
+ transform(source: string, id: string, opts?: {
161
+ ssr?: boolean;
162
+ linkVirtual?: boolean;
163
+ }): unknown;
164
+ /**
165
+ * Mint the `.ts` / `.js` regions in one module — `with { wake: … }` load/remote imports become
166
+ * island descriptors. The ts-region half of the front-end, sharing the driver's resolved context
167
+ * (so both the prescan and the transform hook mint identically). Not memoized — the caller gates it
168
+ * on the id + marker; the returned descriptors are the caller's to `register`.
169
+ */
170
+ ts_regions(source: string, id: string): ReturnType<typeof transformTsRegions>;
171
+ /**
172
+ * Discover every island up front — walk `src/`, transform each `.svelte` host and mint each
173
+ * `.ts`/`.js` region, register the descriptors, then complete `island_graph` TRANSITIVELY and
174
+ * finalize the runtime capability marks (so the sticky runtime entry bundles only what the app
175
+ * uses, and its immutable chunk name busts on a feature-set change). Once per build, so the
176
+ * adapter can call it from any hook. Populates the `Program`; the fs walk is the only side effect.
177
+ */
178
+ prescan(): Scan;
179
+ /** DEV: take the modules newly marked as island code since the last drain (see above). */
180
+ drain_closure_marks(): string[];
181
+ /**
182
+ * Mark `componentAbs` and everything it imports through relative paths and the app's aliases as
183
+ * island code, before the bundler resolves any of it; a bare package specifier stops the walk.
184
+ * Returns the modules marked for the first time by this call.
185
+ */
186
+ mark_island_closure(componentAbs: string): string[];
187
+ /**
188
+ * Scan ENTRIES for Vite's dep optimizer: every hydrate island's component file and the host file
189
+ * that places it — real, absolute, on-disk source paths. Under `csr = false` Kit ships no client
190
+ * entry and registers only `routes/**\/+*` as scan entries, so Vite's scanner reaches an island
191
+ * only when a route file imports it statically. An island behind a block registry, an
192
+ * `import.meta.og.regions()` glob or a `.remote.ts` mint is never crawled: its client deps are
193
+ * discovered LAZILY on its first wake, and every discovery re-optimizes, rotates the optimizer's
194
+ * browserHash and full-reloads — on a large app a reload storm that never settles. The adapter
195
+ * appends these to `optimizeDeps.entries` (dev) so Vite's OWN scanner crawls them at startup with
196
+ * the full plugin pipeline: its resolver, every plugin's `resolveId` (a `?client` import resolves
197
+ * through vite-plugin-iso-import), a linked workspace package followed as SOURCE and never
198
+ * pre-bundled, the app's `exclude` honoured.
199
+ *
200
+ * Deliberately NOT a self-computed `optimizeDeps.include` list. A resolver that is not Vite's
201
+ * mis-classifies something Vite knows — a plugin query, a workspace link, an `exports` map — and
202
+ * a wrong `include` hands rolldown an id it cannot load: `UNLOADABLE_DEPENDENCY`, a dead dev
203
+ * server (two field-reported regressions). An entry can only ever ADD a crawl root; what the
204
+ * crawl finds is Vite's call. A `defer` island renders on the server (its closure is not client
205
+ * code) and a lake ships no client JS, so neither is an entry; the host file covers a
206
+ * portable-snippet synth, which has no component file of its own. Needs `prescan()`; deduped,
207
+ * sorted, existing source files only.
208
+ */
209
+ island_scan_entries(): string[];
210
+ /** The feature-selected runtime chunk name (immutable-cached). Needs prescan to have run for a
211
+ * non-empty feature hash; both build legs prescan the same source → the same name. */
212
+ runtime_chunk_filename(): string;
213
+ /** Public URL of the runtime chunk (asset prefix + filename — honors a non-root base / assets CDN). */
214
+ runtime_chunk_url(): string;
215
+ /** The server-router component roots (link/router-css.ts). Build: prescan is complete before any
216
+ * consumer runs — memoized for the build. Dev: modules appear lazily (HMR), recompute per call. */
217
+ router_css_roots(): string[];
218
+ /**
219
+ * Server-only islands — `render: 'deferred'` with no client chunk — and the component file each
220
+ * renders. Nothing on any page links such a component's CSS (Kit collects stylesheets from the
221
+ * client graph; this subtree is never in it), so the client leg compiles each one's whole tree
222
+ * CSS into a dedicated asset the hole response links (vite/index.ts, `region_css_links`).
223
+ * Sorted for determinism; a component shared by several ids is emitted once (by `abs`).
224
+ */
225
+ server_island_css_roots(): Array<{
226
+ iid: string;
227
+ abs: string;
228
+ }>;
229
+ /** The public URL key a server island's CSS is handed off under (matches `island_url[id]`). */
230
+ island_public_url(iid: string): string;
231
+ /** Whether the program holds any hydrate region, wherever it is placed (a Kit page or not). */
232
+ has_hydrate_regions(): boolean;
233
+ /** The server leg's real module graph, for the client-leg handoff (link/emit-gate.ts). */
234
+ ssr_transformed_hosts(): string[];
235
+ /**
236
+ * Client leg: the runtime chunk + one deterministic chunk per deduped hydrate region. `loaded` —
237
+ * the server leg's transformed-module set (the handoff the plugin reads) — gates the emit to
238
+ * islands whose HOST the server bundle actually contains; `null` (no handoff: standalone, or a
239
+ * client-only build) keeps every prescanned island, as before. Returns how many were skipped.
240
+ */
241
+ emit_build_chunks(leg: BuildLeg, emitFile: EmitChunk, { emitRuntime, loaded }: {
242
+ emitRuntime: boolean;
243
+ loaded?: Set<string> | null;
244
+ }): number;
245
+ /**
246
+ * At the bundle's end (the names are final): each entry's IDENTITY → its LOCATION. `islands` maps
247
+ * an island entry's hashed file to its identity (the collector keys every map by identity);
248
+ * `locations` is what the handoff carries to the server (`entries`): identity → served path.
249
+ * `get_file_name` is the bundler's `this.getFileName`.
250
+ */
251
+ entry_locations(leg: BuildLeg, get_file_name: (ref: string) => string): {
252
+ islands: Map<string, string>;
253
+ runtime: string | null;
254
+ runtime_file: string | null;
255
+ locations: Record<string, string>;
256
+ };
257
+ /** Emit one hydrate region's entry chunk into `leg`, by name: the bundler content-hashes it. */
258
+ emit_island_entry(leg: BuildLeg, emitFile: EmitChunk, rid: string, virtualPath: string): void;
259
+ /**
260
+ * The output file pattern for one of OUR entries (by the chunk name `emit_island_entry` / the
261
+ * runtime emit gave it), else null (the app's own naming applies). Readable and content-hashed:
262
+ * `<appDir>/immutable/og-region.<iid>.<hash>.js`, `…/og-runtime-<features>.<hash>.js` — the hash is the
263
+ * cache law, the name is for people (a network tab, a CDN rule, a profile). It never equals a
264
+ * stable name, which has no hash segment.
265
+ */
266
+ entry_file_pattern(chunk_name: string | undefined): string | null;
267
+ /**
268
+ * The build's location maps (link/location-map.ts), for the bundle's end (the names are final):
269
+ * every island entry's identity → its hashed file, content-hashed and at the one fixed name.
270
+ * `get_file_name` is the bundler's `this.getFileName`. Empty with no island.
271
+ */
272
+ location_maps(leg: BuildLeg, get_file_name: (ref: string) => string): {
273
+ fileName: string;
274
+ source: string;
275
+ }[];
276
+ /**
277
+ * Emit one ogygia VIRTUAL module's source: the config/capability virtuals (secret / sign / rate-limit
278
+ * / router / session / ttl / manifests / runtime entry+url / transport / dev-hmr / request-event /
279
+ * region-endpoint), and the registered island/region sources (with the client leg's `$app/*`-shim +
280
+ * lake-placeholder rewrites). Returns the source string, or `null` if `id` is not an ogygia virtual —
281
+ * the adapter owns only the FOUC-css virtuals (they carry a Vite `moduleType`) and the Vite build
282
+ * value threaded in here (the `universalHooks` path).
283
+ */
284
+ emit(id: string, leg: Leg): string | {
285
+ code: string;
286
+ moduleSideEffects: false;
287
+ } | Promise<string> | null;
288
+ /**
289
+ * Resolve an ogygia-owned import id: the virtual-module vocabulary (config/manifest virtuals + FOUC
290
+ * graph + client-binding stub), and the island CLIENT graph — `$app/*` shims for island importers,
291
+ * virtual island/wrapper ids, and relative imports of a generated island module resolved against its
292
+ * host (marking each resolved dep into `island_graph` so its own `$app/*` stays shimmed). `resolve` is
293
+ * the bundler's own resolver (Vite `this.resolve`), threaded in so the driver stays bundler-agnostic.
294
+ * Returns a resolved id / result, or `null` to defer to the bundler. The adapter handles the few
295
+ * package/Kit-specific ids first (ogygia injected imports, Kit's remote runtime, the kit-wire path).
296
+ */
297
+ resolve_id(source: string, importer: string | undefined, { ssr, resolve }: {
298
+ ssr: boolean;
299
+ resolve: (source: string, importer: string, opts: {
300
+ skipSelf: boolean;
301
+ }) => Promise<{
302
+ id: string;
303
+ } | null>;
304
+ }): Promise<string | {
305
+ id: string;
306
+ } | null>;
307
+ /**
308
+ * The per-file transform pass: content-preset tagging ▸ `import.meta.og.*` macros ▸ the host-island
309
+ * transform (`.svelte`) ▸ ts/js region minting (`.ts/.js`) ▸ the client `$app/*` shim. Registers the
310
+ * discovered descriptors into the `Program`, and (client build only) emits the deterministic chunk for
311
+ * any hydrate island a library component declares that the prescan couldn't see — via the `emitFile`
312
+ * callback (the one Vite primitive threaded in), into `leg` (the leg the transform runs in).
313
+ * Returns the Vite transform result, or `null` if the module was untouched. `prescan()` runs first
314
+ * so `island_graph` is complete before any module lowers.
315
+ */
316
+ transform_module(code: string, id: string, { leg, emitFile, watch }: {
317
+ /** The leg it runs in: its `server` is the one answer to "which side is this" (#1439). */
318
+ leg: BuildLeg;
319
+ emitFile: EmitChunk;
320
+ /** The bundler's watch for this module: a macro names the files it read. */
321
+ watch?: (file: string) => void;
322
+ }): Promise<{
323
+ code: string;
324
+ map: unknown;
325
+ } | null>;
326
+ /** The fn-manifest for the build handoff (tag → factory source), sorted by tag. */
327
+ fn_manifest(): Record<string, string>;
328
+ /**
329
+ * A finished chunk with its relocation tokens replaced from the final records (every transform has
330
+ * run by renderChunk, and the graph is complete), each patch counted on the leg
331
+ * (link/relocations.ts). `null` when the chunk carries none.
332
+ */
333
+ relocate(code: string, leg: Pick<BuildLeg, "server" | "relocated" | "late_server_regions">, bundle: Pick<RelocateCx, "graph" | "module_ids" | "chunk_file" | "file_name" | "facade_file">): {
334
+ code: string;
335
+ map: SourceMap | null;
336
+ } | null;
337
+ /** True when `file` is a registered island HOST (a component that declares islands). */
338
+ is_registered_host(file: string): boolean;
339
+ /**
340
+ * Drop the cached virtual island modules + the registry rows for `file` — call when a HOST changes
341
+ * (an import-target rename keeps the same island id) or an ENTRY component is deleted (NOT on ordinary
342
+ * entry-component content edits — those are soft HMR). Mutates the Program; `invalidate` is the
343
+ * bundler's module-invalidation (Vite's moduleGraph), threaded in. Returns whether anything changed.
344
+ */
345
+ invalidate_for_file(file: string, { deleted, invalidate }: {
346
+ deleted?: boolean;
347
+ invalidate: (id: string) => void;
348
+ }): boolean;
349
+ }