@ogygia/compiler 0.14.2 → 0.15.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.
- package/dist/driver.d.ts +23 -8
- package/dist/driver.js +157 -23
- package/dist/kit.d.ts +17 -0
- package/dist/kit.js +51 -1
- package/dist/link/caps.d.ts +7 -1
- package/dist/link/caps.js +10 -2
- package/dist/link/dead-exports.d.ts +49 -0
- package/dist/link/dead-exports.js +500 -0
- package/dist/link/emit-gate.d.ts +13 -2
- package/dist/link/emit-gate.js +11 -3
- package/dist/link/hooks.d.ts +17 -0
- package/dist/link/hooks.js +35 -0
- package/dist/link/island-deps.d.ts +8 -1
- package/dist/link/island-deps.js +27 -1
- package/dist/link/relocations.d.ts +2 -0
- package/dist/link/relocations.js +11 -1
- package/dist/link/runtime-entry.d.ts +79 -17
- package/dist/link/runtime-entry.js +134 -32
- package/dist/link/server-manifest.d.ts +3 -0
- package/dist/link/server-manifest.js +4 -1
- package/dist/messages.d.ts +24 -0
- package/dist/messages.js +57 -2
- package/dist/program.d.ts +13 -1
- package/dist/program.js +26 -0
- package/dist/region/transform.js +3 -1
- package/dist/virtual/core.d.ts +23 -44
- package/dist/virtual/core.js +107 -78
- package/dist/virtual/resolver.d.ts +2 -0
- package/dist/virtual/resolver.js +5 -0
- package/dist/virtual/table.d.ts +6 -0
- package/dist/vite/graph-compiled.d.ts +21 -0
- package/dist/vite/graph-compiled.js +24 -0
- package/dist/vite/index.js +29 -19
- package/dist/vite/plugin-api.d.ts +10 -6
- package/dist/vite/plugin-api.js +39 -22
- package/package.json +4 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/vite/graph-compiled.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolves once the bundler has compiled every module of the bundle (loaded, transformed, its
|
|
4
|
+
* imports resolved), dynamic imports and their imports included, but the ones `skip` names: the
|
|
5
|
+
* modules that wait here themselves, which would otherwise wait on each other. Each round loads
|
|
6
|
+
* what the last one found, until a round finds nothing new. An external module is never loaded.
|
|
7
|
+
*/
|
|
8
|
+
async function graph_compiled(graph, skip) {
|
|
9
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10
|
+
for (;;) {
|
|
11
|
+
const next = [...graph.getModuleIds()].filter((id) => !seen.has(id) && !skip(id));
|
|
12
|
+
if (next.length === 0) return;
|
|
13
|
+
for (const id of next) seen.add(id);
|
|
14
|
+
await Promise.all(next.map((id) => compiled(graph, id)));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function compiled(graph, id) {
|
|
18
|
+
if (graph.getModuleInfo(id)?.code == null && (await graph.resolve(id))?.external) return;
|
|
19
|
+
await graph.load({
|
|
20
|
+
id,
|
|
21
|
+
resolveDependencies: true
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { graph_compiled };
|
package/dist/vite/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { configure_build_cache } from "../build-cache.js";
|
|
2
2
|
import { island_sourcemaps_plugin } from "./sourcemaps.js";
|
|
3
3
|
import { lazy_files } from "./lazy-files.js";
|
|
4
|
+
import { graph_compiled } from "./graph-compiled.js";
|
|
4
5
|
import { install_dev_client_maps, install_dev_maps, install_dev_page_keys } from "./dev-maps.js";
|
|
5
|
-
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys } from "../region/transform.js";
|
|
6
6
|
import { wrapperVirtualId } from "../ids.js";
|
|
7
|
-
import {
|
|
7
|
+
import { CLIENT_BINDING_STUB, DEFAULT_IMPORT_KEYS, import_keys_hint, is_island_path, islandChunkFileName, islandId, islandPublicUrl, normalize_import_keys } from "../region/transform.js";
|
|
8
8
|
import { regionId, regionIdentity, strategyKey } from "../region/identity.js";
|
|
9
|
+
import { rewrite_lake_import_to_placeholder } from "../region/emit.js";
|
|
9
10
|
import { definePlugin, find_plugins, resolve_plugins } from "./plugin-api.js";
|
|
10
11
|
import { definers_plugin } from "./definers.js";
|
|
11
12
|
import { assert_known_options, resolve_options, validate_region_presets } from "./options.js";
|
|
12
|
-
import { clientBuildWillSkip, default_kit_dirs, hasAnyCsrFalseRoute, inject_keep_client_route, keep_client_dir, kit_major, resolve_kit_paths, route_reader } from "../kit.js";
|
|
13
|
+
import { clientBuildWillSkip, default_kit_dirs, hasAnyCsrFalseRoute, inject_keep_client_route, keep_client_dir, kit_major, kit_may_hydrate, resolve_kit_paths, route_reader } from "../kit.js";
|
|
13
14
|
import { node_fs } from "../fs.js";
|
|
14
15
|
import { load_kit_config } from "./kit-dirs.js";
|
|
15
16
|
import { buildFoucCssModuleSource, collectFoucCssReachable, foucRelFromId, isFoucCssId, isFoucScopedId, scoped_component_css, svelteHasStyle, through_caller } from "../fouc-css.js";
|
|
@@ -21,6 +22,7 @@ import { derive_css_scope_owners } from "../dev/css-scope.js";
|
|
|
21
22
|
import { DEV_FN_MANIFEST_KEY, collectIslandDepModulepreloads, collect_inline_css, remote_hash_of, summarize_chunk_contents } from "../link/island-deps.js";
|
|
22
23
|
import { emit_island_deps_handoff, refuse_client_secrets, report_seed_shaping } from "../link/build-output.js";
|
|
23
24
|
import { unpatched } from "../link/relocations.js";
|
|
25
|
+
import { bundler_reshake, shake_server_bundle } from "../link/dead-exports.js";
|
|
24
26
|
import { read_server_handoff, server_handoff_json, server_handoff_path } from "../link/emit-gate.js";
|
|
25
27
|
import { router_css_key } from "../link/router-css.js";
|
|
26
28
|
import { Program, strip_id } from "../program.js";
|
|
@@ -84,7 +86,6 @@ function ogygia(options = {}) {
|
|
|
84
86
|
let app_plugins = [];
|
|
85
87
|
let server_plugins = [];
|
|
86
88
|
let client_plugins = [];
|
|
87
|
-
let runtime_hooks = [];
|
|
88
89
|
let route_config = [];
|
|
89
90
|
let foreign_hydrate = false;
|
|
90
91
|
let macros = [];
|
|
@@ -296,7 +297,7 @@ function ogygia(options = {}) {
|
|
|
296
297
|
const resolved = resolve_plugins(app_plugins, path.resolve(userConfig.root ?? "."), env.command === "serve", (source, filename) => compiler_of(session, "markup").transform_content_island(source, filename), seams);
|
|
297
298
|
stage_transforms = resolved.transforms;
|
|
298
299
|
stayed_answers = resolved.stayed;
|
|
299
|
-
({servers: server_plugins, clients: client_plugins,
|
|
300
|
+
({servers: server_plugins, clients: client_plugins, route_config, foreign_hydrate, macros, prescans, markup, definers, page_reads} = resolved);
|
|
300
301
|
listed_plugins = app_plugins.map((p) => p.name);
|
|
301
302
|
measure = resolved.measure;
|
|
302
303
|
devtools_effective = resolved.events !== false;
|
|
@@ -312,9 +313,11 @@ function ogygia(options = {}) {
|
|
|
312
313
|
files: p.files.map(real_posix)
|
|
313
314
|
});
|
|
314
315
|
}
|
|
316
|
+
const route_files = route_reader(node_fs);
|
|
317
|
+
if (env.command === "build") route_files.db.reread();
|
|
315
318
|
if (env.command === "build" && !standalone && isMainThread) {
|
|
316
319
|
const routes = kit.dirs.routes_dir;
|
|
317
|
-
if (clientBuildWillSkip(
|
|
320
|
+
if (clientBuildWillSkip(route_files, routes)) {
|
|
318
321
|
inject_keep_client_route(routes);
|
|
319
322
|
arm_keep_client_cleanup(routes);
|
|
320
323
|
} else fs.rmSync(keep_client_dir(routes), {
|
|
@@ -345,9 +348,8 @@ function ogygia(options = {}) {
|
|
|
345
348
|
devtools: devtools_effective,
|
|
346
349
|
devtools_lazy,
|
|
347
350
|
rules: process.env.OGYGIA_RULES === "1",
|
|
348
|
-
client_plugins: client_plugins.length > 0,
|
|
349
|
-
hooks: runtime_hooks,
|
|
350
351
|
kit_major: kit_major(path.resolve(userConfig.root ?? ".")),
|
|
352
|
+
kit_pages: env.command === "serve" || foreign_hydrate || kit_may_hydrate(route_files, kit.dirs.routes_dir),
|
|
351
353
|
version: OGYGIA_VERSION,
|
|
352
354
|
dev_server: env.command === "serve"
|
|
353
355
|
}),
|
|
@@ -485,7 +487,8 @@ function ogygia(options = {}) {
|
|
|
485
487
|
name: is_ssr ? "ssr" : "client",
|
|
486
488
|
server: is_ssr
|
|
487
489
|
};
|
|
488
|
-
const
|
|
490
|
+
const handoff = is_build && !env.server ? read_server_handoff(kit.dirs.out_dir) : null;
|
|
491
|
+
const begins = compiler.start_leg(env.name, env.server, handoff);
|
|
489
492
|
const leg = compiler.leg(env);
|
|
490
493
|
const server_leg = leg.server;
|
|
491
494
|
if (is_build && server_leg) fs.rmSync(server_handoff_path(kit.dirs.out_dir), { force: true });
|
|
@@ -498,7 +501,6 @@ function ogygia(options = {}) {
|
|
|
498
501
|
}
|
|
499
502
|
if (is_build && !server_leg) {
|
|
500
503
|
const emit_runtime = !standalone && (hasAnyCsrFalseRoute(compiler.ctx.routes, kit.dirs.routes_dir) || compiler.has_hydrate_regions());
|
|
501
|
-
const handoff = read_server_handoff(kit.dirs.out_dir);
|
|
502
504
|
const loaded = handoff?.hosts ?? null;
|
|
503
505
|
const server_regions = handoff?.server_regions ?? null;
|
|
504
506
|
const skipped = compiler.emit_build_chunks(leg, (chunk) => this.emitFile(chunk), {
|
|
@@ -560,12 +562,16 @@ function ogygia(options = {}) {
|
|
|
560
562
|
buildEnd() {
|
|
561
563
|
const compiler = compiler_of(session, "buildEnd");
|
|
562
564
|
const server_leg = leg_of(this).server;
|
|
563
|
-
if (is_build && server_leg && !standalone)
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
565
|
+
if (is_build && server_leg && !standalone) {
|
|
566
|
+
const json = server_handoff_json(compiler.ssr_transformed_hosts(), build_secret, compiler.server_island_css_roots(), compiler.server_runtime(), compiler.server_word());
|
|
567
|
+
try {
|
|
568
|
+
const handoff = server_handoff_path(kit.dirs.out_dir);
|
|
569
|
+
fs.mkdirSync(path.dirname(handoff), { recursive: true });
|
|
570
|
+
fs.writeFileSync(handoff, json);
|
|
571
|
+
} catch (e) {
|
|
572
|
+
if (isMainThread) warn("island_handoff_write_failed", e);
|
|
573
|
+
throw e;
|
|
574
|
+
}
|
|
569
575
|
}
|
|
570
576
|
if (__P) {
|
|
571
577
|
const keys = [...__outHash.keys()].sort();
|
|
@@ -693,7 +699,8 @@ function ogygia(options = {}) {
|
|
|
693
699
|
resolve: bundler_resolve(this),
|
|
694
700
|
exports: css_walk_index(this.environment.name),
|
|
695
701
|
kitCodec: kit_transport_init,
|
|
696
|
-
via: () => import_chain(id, (m) => this.getModuleInfo(m)?.importers, root)
|
|
702
|
+
via: () => import_chain(id, (m) => this.getModuleInfo(m)?.importers, root),
|
|
703
|
+
...is_build && ssr ? { compiled: (skip) => graph_compiled(this, skip) } : {}
|
|
697
704
|
});
|
|
698
705
|
},
|
|
699
706
|
async transform(code, id) {
|
|
@@ -750,7 +757,10 @@ function ogygia(options = {}) {
|
|
|
750
757
|
name: r.name,
|
|
751
758
|
leg: leg.name
|
|
752
759
|
});
|
|
753
|
-
if (leg.server)
|
|
760
|
+
if (leg.server) {
|
|
761
|
+
await shake_server_bundle(bundle, await bundler_reshake());
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
754
764
|
for (const file of compiler.location_maps(leg, (ref) => this.getFileName(ref))) this.emitFile({
|
|
755
765
|
type: "asset",
|
|
756
766
|
fileName: file.fileName,
|
|
@@ -820,7 +830,7 @@ function ogygia(options = {}) {
|
|
|
820
830
|
const map = collectIslandDepModulepreloads(bundle, [APP_SHIMS["$app/state"], APP_SHIMS["$app/stores"]], remote_hash, page_reads && ((module_id) => page_reads.keys(module_id)), readFile, entries.runtime_file, {
|
|
821
831
|
islands: entries.islands,
|
|
822
832
|
runtime: entries.runtime
|
|
823
|
-
});
|
|
833
|
+
}, real_posix(path.join(RUNTIME_DIR, "hydrate-core.js")));
|
|
824
834
|
const page_why = page_reads ? report_seed_shaping(map, bundle, (module) => page_reads.why(module), root, (identity) => entries.locations[identity] ?? identity) : {};
|
|
825
835
|
for (const [key, ref] of leg.router_css_refs) try {
|
|
826
836
|
const file = this.getFileName(ref);
|
|
@@ -3,7 +3,7 @@ import { ClientRealmFile, ServerRealm } from "../link/caps.js";
|
|
|
3
3
|
import { Definers } from "./definers.js";
|
|
4
4
|
import { MacroContext } from "../macros/pipeline.js";
|
|
5
5
|
import { PrescanHook } from "../ctx.js";
|
|
6
|
-
import { BarrelLeftReason, RuntimeHookName } from "@ogygia/core/contract";
|
|
6
|
+
import { BarrelLeftReason, RuntimeHookName, ServerHookName } from "@ogygia/core/contract";
|
|
7
7
|
import MagicString from "magic-string";
|
|
8
8
|
import { Plugin } from "vite";
|
|
9
9
|
/** Where `definePlugin` puts the definition on the Vite plugin it returns. A registered symbol, so a
|
|
@@ -139,8 +139,10 @@ export interface BuildContext {
|
|
|
139
139
|
routeConfig(key: string): void;
|
|
140
140
|
/** Keep the foreign-hydrate exports on this app's island entries: another app's page may host
|
|
141
141
|
* them and wake them through its own runtime (fragment federation). Off by default — they cost
|
|
142
|
-
* every island ~185 B gz and a preload. It also says this app's pages carry
|
|
143
|
-
*
|
|
142
|
+
* every island ~185 B gz and a preload. It also says this app's pages carry regions this build
|
|
143
|
+
* never compiled (another app's, or ones this plugin's browser half places), so its runtime
|
|
144
|
+
* ships every feature, schedule and island reader a region in the HTML can need. Nothing else
|
|
145
|
+
* says it: a browser half alone (boot and told hooks) hides no schedule. */
|
|
144
146
|
foreignHydrate(): void;
|
|
145
147
|
/** An `import.meta.og.<name>(…)` construct this plugin compiles (`'code'`, `'loader'`). Plugin
|
|
146
148
|
* macros run after core's own (`wire`, `$`, `source`, `store`), in plugin order; `last`: after
|
|
@@ -237,10 +239,8 @@ export declare function find_plugins(list: unknown): Promise<PluginDefinition[]>
|
|
|
237
239
|
export interface ResolvedPlugins {
|
|
238
240
|
/** each server realm, in plugin order (`enforce` applied) */
|
|
239
241
|
servers: ServerRealm[];
|
|
240
|
-
/** each browser realm (its plugin's name, its absolute path), in plugin order */
|
|
242
|
+
/** each browser realm (its plugin's name, its absolute path, its hooks), in plugin order */
|
|
241
243
|
clients: ClientRealmFile[];
|
|
242
|
-
/** every runtime hook some browser realm subscribes to */
|
|
243
|
-
client_hooks: RuntimeHookName[];
|
|
244
244
|
/** every key any plugin claims inside Kit's `config` page option */
|
|
245
245
|
route_config: string[];
|
|
246
246
|
/** a plugin asked for island entries' foreign-hydrate exports */
|
|
@@ -307,6 +307,10 @@ export declare function check_plugins(plugins: readonly unknown[]): PluginDefini
|
|
|
307
307
|
/** The runtime hooks a client realm subscribes to: the keys of the `hooks` object literal in its
|
|
308
308
|
* default `defineClient({ … })`, read from the file. */
|
|
309
309
|
export declare function client_hook_names(plugin: string, file: string): RuntimeHookName[];
|
|
310
|
+
/** Core's shared server hooks a server half implements: the keys of its default
|
|
311
|
+
* `defineServer({ … })` that name one. A file the build cannot read implements every one, as far
|
|
312
|
+
* as the build knows (a hook folded out that a plugin answers would be a silent loss). */
|
|
313
|
+
export declare function server_hook_names(file: string): ServerHookName[];
|
|
310
314
|
/**
|
|
311
315
|
* When the app's root and mode are known (the `config` hook): order the plugins (`enforce`), check their
|
|
312
316
|
* realms, run their `build` hooks. `markup_transform` is the configured compiler's island
|
package/dist/vite/plugin-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OgygiaError } from "../messages.js";
|
|
2
2
|
import { parse_module } from "../parse/oxc.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { RUNTIME_HOOK_NAMES, SERVER_HOOK_NAMES } from "@ogygia/core/contract";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
@@ -117,15 +117,9 @@ function realm_path(plugin, realm) {
|
|
|
117
117
|
});
|
|
118
118
|
return abs.split(path.sep).join("/");
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
* default `defineClient({ … })`, read from the file. */
|
|
122
|
-
function client_hook_names(plugin, file) {
|
|
123
|
-
const unread = () => new OgygiaError("plugin_client_hooks_unread", {
|
|
124
|
-
plugin,
|
|
125
|
-
location: file
|
|
126
|
-
});
|
|
120
|
+
function realm_object(file) {
|
|
127
121
|
const { program } = parse_module(fs.readFileSync(file, "utf8"), file);
|
|
128
|
-
if (!program)
|
|
122
|
+
if (!program) return null;
|
|
129
123
|
const body = program.body;
|
|
130
124
|
const consts = /* @__PURE__ */ new Map();
|
|
131
125
|
for (const s of body) if (s.type === "VariableDeclaration" && s.kind === "const") {
|
|
@@ -143,14 +137,30 @@ function client_hook_names(plugin, file) {
|
|
|
143
137
|
const default_local = body.filter((s) => s.type === "ExportNamedDeclaration" && !s.source).flatMap((s) => s.specifiers).find((sp) => (sp.exported?.name ?? sp.exported?.value) === "default")?.local;
|
|
144
138
|
let value = unwrap(body.find((s) => s.type === "ExportDefaultDeclaration")?.declaration ?? default_local);
|
|
145
139
|
if (value?.type === "CallExpression") value = unwrap(value.arguments?.[0]);
|
|
146
|
-
if (value?.type !== "ObjectExpression")
|
|
140
|
+
if (value?.type !== "ObjectExpression") return null;
|
|
147
141
|
const key_of = (p) => {
|
|
148
142
|
if (p.type !== "Property" || p.computed) return null;
|
|
149
143
|
if (p.key.type === "Identifier") return p.key.name;
|
|
150
144
|
return p.key.type === "Literal" && typeof p.key.value === "string" ? p.key.value : null;
|
|
151
145
|
};
|
|
152
146
|
const props = value.properties;
|
|
153
|
-
if (props.some((p) => key_of(p) === null))
|
|
147
|
+
if (props.some((p) => key_of(p) === null)) return null;
|
|
148
|
+
return {
|
|
149
|
+
props,
|
|
150
|
+
key_of,
|
|
151
|
+
unwrap
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** The runtime hooks a client realm subscribes to: the keys of the `hooks` object literal in its
|
|
155
|
+
* default `defineClient({ … })`, read from the file. */
|
|
156
|
+
function client_hook_names(plugin, file) {
|
|
157
|
+
const unread = () => new OgygiaError("plugin_client_hooks_unread", {
|
|
158
|
+
plugin,
|
|
159
|
+
location: file
|
|
160
|
+
});
|
|
161
|
+
const realm = realm_object(file);
|
|
162
|
+
if (!realm) throw unread();
|
|
163
|
+
const { props, key_of, unwrap } = realm;
|
|
154
164
|
const hooks = unwrap(props.find((p) => key_of(p) === "hooks")?.value);
|
|
155
165
|
if (!hooks) return [];
|
|
156
166
|
if (hooks.type !== "ObjectExpression") throw unread();
|
|
@@ -158,7 +168,7 @@ function client_hook_names(plugin, file) {
|
|
|
158
168
|
for (const p of hooks.properties) {
|
|
159
169
|
const key = key_of(p);
|
|
160
170
|
if (key === null) throw unread();
|
|
161
|
-
if (!
|
|
171
|
+
if (!RUNTIME_HOOK_NAMES.includes(key)) throw new OgygiaError("plugin_client_hook_unknown", {
|
|
162
172
|
plugin,
|
|
163
173
|
hook: key
|
|
164
174
|
});
|
|
@@ -166,6 +176,15 @@ function client_hook_names(plugin, file) {
|
|
|
166
176
|
}
|
|
167
177
|
return names;
|
|
168
178
|
}
|
|
179
|
+
/** Core's shared server hooks a server half implements: the keys of its default
|
|
180
|
+
* `defineServer({ … })` that name one. A file the build cannot read implements every one, as far
|
|
181
|
+
* as the build knows (a hook folded out that a plugin answers would be a silent loss). */
|
|
182
|
+
function server_hook_names(file) {
|
|
183
|
+
const realm = realm_object(file);
|
|
184
|
+
if (!realm) return [...SERVER_HOOK_NAMES];
|
|
185
|
+
const keys = new Set(realm.props.map(realm.key_of));
|
|
186
|
+
return SERVER_HOOK_NAMES.filter((h) => keys.has(h));
|
|
187
|
+
}
|
|
169
188
|
function package_resolves(req, name) {
|
|
170
189
|
try {
|
|
171
190
|
req.resolve(`${name}/package.json`);
|
|
@@ -185,7 +204,6 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null, seam
|
|
|
185
204
|
const out = {
|
|
186
205
|
servers: [],
|
|
187
206
|
clients: [],
|
|
188
|
-
client_hooks: [],
|
|
189
207
|
route_config: [],
|
|
190
208
|
foreign_hydrate: false,
|
|
191
209
|
macros: [],
|
|
@@ -216,16 +234,15 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null, seam
|
|
|
216
234
|
if (server) out.servers.push({
|
|
217
235
|
name: plugin.name,
|
|
218
236
|
module: server,
|
|
219
|
-
options: plugin.options ?? {}
|
|
237
|
+
options: plugin.options ?? {},
|
|
238
|
+
hooks: server_hook_names(server)
|
|
220
239
|
});
|
|
221
240
|
const client = realm_path(plugin, "client");
|
|
222
|
-
if (client) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
for (const name of client_hook_names(plugin.name, client)) if (!out.client_hooks.includes(name)) out.client_hooks.push(name);
|
|
228
|
-
}
|
|
241
|
+
if (client) out.clients.push({
|
|
242
|
+
name: plugin.name,
|
|
243
|
+
module: client,
|
|
244
|
+
hooks: client_hook_names(plugin.name, client)
|
|
245
|
+
});
|
|
229
246
|
plugin.build?.({
|
|
230
247
|
root,
|
|
231
248
|
dev,
|
|
@@ -325,4 +342,4 @@ function resolve_plugins(plugins, root, dev, markup_transform = () => null, seam
|
|
|
325
342
|
out.macros.push(...last_macros);
|
|
326
343
|
return out;
|
|
327
344
|
}
|
|
328
|
-
export { PLUGIN, check_plugins, client_hook_names, definePlugin, find_plugins, resolve_plugins };
|
|
345
|
+
export { PLUGIN, check_plugins, client_hook_names, definePlugin, find_plugins, resolve_plugins, server_hook_names };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogygia/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "The compiler of ogygia (SSR islands for SvelteKit): the region transform, the build's link step and the Vite plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@jridgewell/remapping": "^2.3.5",
|
|
47
|
-
"@ogygia/machine": "^0.
|
|
47
|
+
"@ogygia/machine": "^0.15.1",
|
|
48
48
|
"devalue": "^5.9.3",
|
|
49
49
|
"estree-walker": "^3.0.3",
|
|
50
50
|
"magic-string": "^1.4.5",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
55
55
|
"@ogygia/config": "0.0.0",
|
|
56
|
-
"@ogygia/core": "0.
|
|
56
|
+
"@ogygia/core": "0.15.1",
|
|
57
57
|
"@sveltejs/kit": "^2.70.2",
|
|
58
58
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
59
59
|
"@types/node": "^26.1.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vitest": "^4.1.12"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@ogygia/core": "^0.
|
|
71
|
+
"@ogygia/core": "^0.15.1",
|
|
72
72
|
"@sveltejs/kit": ">=2.70.2 <4",
|
|
73
73
|
"rolldown": ">=1.0.0",
|
|
74
74
|
"svelte": "^5.56.8",
|