@ogygia/core 0.11.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/KeepHost.svelte +1 -1
- package/dist/LiveHost.svelte +1 -1
- package/dist/NestedProvider.svelte +1 -1
- package/dist/Region.svelte +28 -21
- package/dist/Region.svelte.d.ts +0 -2
- package/dist/SlotBoundary.svelte +1 -1
- package/dist/compiler/bom.js +1 -1
- package/dist/compiler/browser.d.ts +1 -1
- package/dist/compiler/browser.js +1 -1
- package/dist/compiler/ctx.d.ts +1 -1
- package/dist/compiler/ctx.js +3 -3
- package/dist/compiler/{macros/dedent.d.ts → dedent.d.ts} +12 -1
- package/dist/compiler/dedent.js +43 -0
- package/dist/compiler/driver.d.ts +9 -6
- package/dist/compiler/driver.js +69 -35
- package/dist/compiler/ids.d.ts +3 -0
- package/dist/compiler/ids.js +4 -1
- package/dist/compiler/index.d.ts +3 -3
- package/dist/compiler/index.js +3 -3
- package/dist/compiler/kit.d.ts +7 -0
- package/dist/compiler/kit.js +22 -10
- package/dist/compiler/link/caps.js +59 -9
- package/dist/compiler/link/island-deps.js +225 -22
- package/dist/compiler/link/location-map.d.ts +10 -0
- package/dist/compiler/link/location-map.js +53 -0
- package/dist/compiler/link/manifest.js +5 -1
- package/dist/compiler/link/runtime-entry.d.ts +19 -2
- package/dist/compiler/link/runtime-entry.js +34 -1
- package/dist/compiler/link/server-manifest.js +43 -7
- package/dist/compiler/link/transport.js +39 -7
- package/dist/compiler/macros/source.js +2 -2
- package/dist/compiler/program.d.ts +4 -0
- package/dist/compiler/program.js +5 -1
- package/dist/compiler/region/transform.d.ts +13 -4
- package/dist/compiler/region/transform.js +15 -6
- package/dist/context.d.ts +3 -12
- package/dist/context.js +1 -16
- package/dist/hooks.d.ts +16 -0
- package/dist/hooks.js +4 -2
- package/dist/insights/page-insights.js +2 -2
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +2 -1
- package/dist/nested.d.ts +11 -0
- package/dist/nested.js +19 -0
- package/dist/ref-sink.d.ts +15 -0
- package/dist/ref-sink.js +19 -0
- package/dist/ref.d.ts +2 -2
- package/dist/ref.js +1 -11
- package/dist/runtime/beacon.js +1 -1
- package/dist/runtime/boot-link.js +4 -1
- package/dist/runtime/core.js +10 -7
- package/dist/runtime/entry-locations.d.ts +10 -3
- package/dist/runtime/entry-locations.js +132 -21
- package/dist/runtime/full.js +5 -1
- package/dist/runtime/hydrate-core.d.ts +4 -4
- package/dist/runtime/hydrate-core.js +8 -5
- package/dist/runtime/morph.d.ts +7 -0
- package/dist/runtime/morph.js +21 -15
- package/dist/runtime/nav-handle.d.ts +3 -0
- package/dist/runtime/nav-handle.js +12 -5
- package/dist/runtime/ownership.d.ts +10 -1
- package/dist/runtime/ownership.js +19 -1
- package/dist/runtime/reconcile.d.ts +5 -2
- package/dist/runtime/reconcile.js +52 -16
- package/dist/runtime/region-endpoint-url.js +1 -0
- package/dist/runtime/region-ids.js +2 -2
- package/dist/runtime/remote-seeds.js +14 -3
- package/dist/runtime/router-nav.js +15 -0
- package/dist/runtime/router.js +3 -0
- package/dist/runtime/seeds.d.ts +10 -5
- package/dist/runtime/seeds.js +16 -12
- package/dist/runtime/slots.d.ts +24 -2
- package/dist/runtime/slots.js +2 -0
- package/dist/runtime/wire-classes.d.ts +2 -0
- package/dist/runtime/wire-classes.js +10 -1
- package/dist/runtime/wire-format.d.ts +4 -1
- package/dist/runtime/wire-format.js +6 -1
- package/dist/seed-ref-reviver.d.ts +24 -0
- package/dist/seed-ref-reviver.js +44 -0
- package/dist/seed-refs.d.ts +2 -16
- package/dist/seed-refs.js +1 -33
- package/dist/server/document-tail.d.ts +3 -2
- package/dist/server/document-tail.js +4 -3
- package/dist/server/entry-location.js +11 -8
- package/dist/server/props-wire.js +4 -3
- package/dist/server/signing-key.d.ts +10 -2
- package/dist/server/signing-key.js +49 -15
- package/dist/vite/index.js +5 -4
- package/dist/vite/kit-dirs.js +1 -1
- package/package.json +3 -3
- package/dist/compiler/link/entry-shim.d.ts +0 -4
- package/dist/compiler/link/entry-shim.js +0 -29
- package/dist/compiler/macros/dedent.js +0 -36
package/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).
|
package/dist/KeepHost.svelte
CHANGED
|
@@ -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 "./
|
|
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
|
package/dist/LiveHost.svelte
CHANGED
|
@@ -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 "./
|
|
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 "./
|
|
8
|
+
import { setNested } from "./nested.js";
|
|
9
9
|
let { component: Component, props } = $props();
|
|
10
10
|
setNested();
|
|
11
11
|
</script>
|
package/dist/Region.svelte
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
* children?: import('svelte').Snippet;
|
|
105
105
|
* __mode?: 'island' | 'server' | 'lake'; __baked?: boolean;
|
|
106
106
|
* visible?: string | boolean; idle?: boolean; media?: string; load?: boolean; interaction?: boolean;
|
|
107
|
-
* __keep?: string; __entry?: string;
|
|
107
|
+
* __keep?: string; __entry?: string; __component?: import('svelte').Component; __css?: unknown;
|
|
108
108
|
* __load?: () => Promise<import('svelte').Component>;
|
|
109
109
|
* __props?: Record<string, unknown>; __defer?: string; __margin?: string; __hydrate?: string;
|
|
110
110
|
* __hydrateMargin?: string; __module?: string; __cacheTtl?: number; __stitch?: string; __prefetch?: string;
|
|
@@ -132,11 +132,9 @@
|
|
|
132
132
|
load,
|
|
133
133
|
interaction,
|
|
134
134
|
__keep,
|
|
135
|
-
// island + server shared. `__entry` is the island's IDENTITY (its stable URL);
|
|
136
|
-
// LOCATION
|
|
137
|
-
// passes the bundler's own name for it). The server finds the location in the build handoff.
|
|
135
|
+
// island + server shared. `__entry` is the island's IDENTITY (its stable URL, a name); its
|
|
136
|
+
// LOCATION, the content-hashed file to load, the server finds in the build handoff.
|
|
138
137
|
__entry = '',
|
|
139
|
-
__src = '',
|
|
140
138
|
__component,
|
|
141
139
|
__css,
|
|
142
140
|
// The client wrapper's on-demand component fetch (its lazy module answered `undefined`: a
|
|
@@ -497,13 +495,15 @@
|
|
|
497
495
|
const island_module_url = $derived(nested || !island_entry ? '' : asset(island_entry));
|
|
498
496
|
// IDENTITY vs LOCATION (server/entry-location.ts): `island_module_url` is the island's identity
|
|
499
497
|
// (the `entry` attribute, the graph key, the fingerprint input); the file the runtime loads is its
|
|
500
|
-
// location — content-hashed, so an `immutable` cache never serves a stale one. The
|
|
501
|
-
//
|
|
498
|
+
// location — content-hashed, so an `immutable` cache never serves a stale one. The server reads it
|
|
499
|
+
// from the build handoff (in dev the identity is the location); a region the browser renders has
|
|
500
|
+
// none, and the runtime finds it in the build's location map (runtime/entry-locations.ts). Only a
|
|
501
|
+
// location is ever written as a URL to fetch: no location, no URL.
|
|
502
502
|
const location_of = (/** @type {string} */ identity) => {
|
|
503
503
|
const found = identity ? entryLocation(identity) : null;
|
|
504
504
|
return found ? asset(found) : '';
|
|
505
505
|
};
|
|
506
|
-
const island_src = $derived(nested || !island_entry ? '' :
|
|
506
|
+
const island_src = $derived(nested || !island_entry ? '' : location_of(island_entry));
|
|
507
507
|
// (written LAST on the element: every attribute before it keeps the order it had before
|
|
508
508
|
// locations, so HTML rewriters and scans keyed on `entry="…" wake="…"` still match)
|
|
509
509
|
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
for (const dep of deps) add(asset(dep));
|
|
606
606
|
for (const m of live_entries) {
|
|
607
607
|
// (the file the snippet's import fetches: its location, when the build named one)
|
|
608
|
-
add(location_of(m)
|
|
608
|
+
add(location_of(m));
|
|
609
609
|
for (const dep of islandDeps(m)) add(asset(dep));
|
|
610
610
|
}
|
|
611
611
|
return hrefs;
|
|
@@ -637,10 +637,8 @@
|
|
|
637
637
|
// island only, at `fetchpriority="low"` (document-tail.ts `modulepreload_tag`): nothing it
|
|
638
638
|
// downloads is needed for first paint, so it must never outrank the CSS and the LCP image.
|
|
639
639
|
const island_kit_hint_hrefs = $derived(
|
|
640
|
-
// (the entry's LOCATION: the file its import fetches
|
|
641
|
-
is_csr && hydrate_attr === 'load' &&
|
|
642
|
-
? [island_src || island_module_url, ...island_graph_hrefs]
|
|
643
|
-
: []
|
|
640
|
+
// (the entry's LOCATION: the file its import fetches; an entry with none gets no hint)
|
|
641
|
+
is_csr && hydrate_attr === 'load' && island_src ? [island_src, ...island_graph_hrefs] : []
|
|
644
642
|
);
|
|
645
643
|
// Both ride the document tail on a Kit page (see `tail` above); the head everywhere else, so a
|
|
646
644
|
// self-contained render root carries its own.
|
|
@@ -688,7 +686,7 @@
|
|
|
688
686
|
// nav. The endpoint (which fetches the hole's HTML) is minted from `__entry` above, independently.
|
|
689
687
|
const server_region_entry = $derived(!nested && __module ? asset(__module) : '');
|
|
690
688
|
// …and its location, the file that import fetches (as for an island)
|
|
691
|
-
const server_region_src = $derived(!nested && __module ?
|
|
689
|
+
const server_region_src = $derived(!nested && __module ? location_of(__module) : '');
|
|
692
690
|
|
|
693
691
|
// A hydrating hole's props: ADJACENT and self-contained (the hole's HTML is spliced by the
|
|
694
692
|
// runtime), unkeyed, in whichever lane the props qualify for (props-wire.ts).
|
|
@@ -966,14 +964,23 @@
|
|
|
966
964
|
return html;
|
|
967
965
|
});
|
|
968
966
|
|
|
967
|
+
// THE HEAD IS SERVER OUTPUT. Every piece of it is a fact only the render knows (the build's
|
|
968
|
+
// handoff, the request's claims), and the browser knows none of them: a URL it built here would
|
|
969
|
+
// be a guess — an identity, a name with no file. Svelte keeps the server's nodes when it hydrates
|
|
970
|
+
// the head, but a Kit-hydrated document's head is often mounted afresh (the handle rewrote it),
|
|
971
|
+
// and a region Kit mounts on a client-side navigation has no server render at all: either way
|
|
972
|
+
// the client writes nothing. What a client-mounted region loads it loads through its own
|
|
973
|
+
// `import()`, which the bundler resolves to the file and preloads with its dependencies.
|
|
969
974
|
const head_html = $derived(
|
|
970
|
-
|
|
971
|
-
?
|
|
972
|
-
:
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
975
|
+
typeof window !== 'undefined'
|
|
976
|
+
? ''
|
|
977
|
+
: (is_island
|
|
978
|
+
? runtime_script + island_preload_head + island_css_html + kit_island_meta
|
|
979
|
+
: is_server
|
|
980
|
+
? runtime_script + server_preload + hole_css_html
|
|
981
|
+
: runtime_script) +
|
|
982
|
+
region_css_html +
|
|
983
|
+
content_css_html
|
|
977
984
|
);
|
|
978
985
|
|
|
979
986
|
// ────────────────────────────────────────────────────── held: live / deferred ──
|
package/dist/Region.svelte.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ type Region = {
|
|
|
14
14
|
interaction?: boolean | undefined;
|
|
15
15
|
__keep?: string | undefined;
|
|
16
16
|
__entry?: string | undefined;
|
|
17
|
-
__src?: string | undefined;
|
|
18
17
|
__component?: Component<any, any, string> | undefined;
|
|
19
18
|
__css?: unknown;
|
|
20
19
|
__load?: (() => Promise<Component<any, any, string>>) | undefined;
|
|
@@ -47,7 +46,6 @@ declare const Region: import("svelte").Component<{
|
|
|
47
46
|
interaction?: boolean;
|
|
48
47
|
__keep?: string;
|
|
49
48
|
__entry?: string;
|
|
50
|
-
__src?: string;
|
|
51
49
|
__component?: import("svelte").Component;
|
|
52
50
|
__css?: unknown;
|
|
53
51
|
__load?: () => Promise<import("svelte").Component>;
|
package/dist/SlotBoundary.svelte
CHANGED
|
@@ -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 "./
|
|
8
|
+
import { setNested } from "./nested.js";
|
|
9
9
|
let { children } = $props();
|
|
10
10
|
setNested(false);
|
|
11
11
|
</script>
|
package/dist/compiler/bom.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* A leading UTF-8 byte-order mark is invisible text. Svelte's `parse` drops it, so every AST offset
|
|
4
4
|
* it reports is one short of the raw source, and a pass that edits the raw source by those offsets
|
|
5
|
-
* (MagicString) lands one character early — splitting a tag name (`<
|
|
5
|
+
* (MagicString) lands one character early — splitting a tag name (`<ds-butto data-og-opaquen`, a
|
|
6
6
|
* field build). The compiler therefore takes the mark off at the doors where source comes in (the
|
|
7
7
|
* per-file transform, the barrel rewrite, the file reader), so every pass sees exactly the text its
|
|
8
8
|
* parser saw. Dropping it changes nothing a browser or a bundler reads.
|
|
@@ -6,6 +6,6 @@ import { JsRegion, OgCall, find_og_calls, is_js_module, og_js_regions, split_fir
|
|
|
6
6
|
import { og_member } from "./macros/wire.js";
|
|
7
7
|
import { BuildCache, __set_build_cache_root, configure_build_cache } from "../build-cache.js";
|
|
8
8
|
import { contentCssKey as content_css_key } from "../plugin/utils.js";
|
|
9
|
-
import { dedent } from "./
|
|
9
|
+
import { dedent } from "./dedent.js";
|
|
10
10
|
import { run_browser_macros } from "./macros/browser.js";
|
|
11
11
|
export { BuildCache, CLIENT_BINDING_STUB, type CompilerHost, type JsRegion, type OgCall, type ParseResult, type RawParse, __set_build_cache_root, configure_build_cache, content_css_key, createHash, dedent, find_og_calls, fs, is_js_module, islandVirtualId, og_js_regions, og_member, parse_module, path, run_browser_macros, set_host, set_parser, split_first_string, transformHost, transformTsRegions, wrapperVirtualId };
|
package/dist/compiler/browser.js
CHANGED
|
@@ -6,6 +6,6 @@ import { find_og_calls, is_js_module, og_js_regions, split_first_string } from "
|
|
|
6
6
|
import { og_member } from "./macros/wire.js";
|
|
7
7
|
import { BuildCache, __set_build_cache_root, configure_build_cache } from "../build-cache.js";
|
|
8
8
|
import { contentCssKey as content_css_key } from "../plugin/utils.js";
|
|
9
|
-
import { dedent } from "./
|
|
9
|
+
import { dedent } from "./dedent.js";
|
|
10
10
|
import { run_browser_macros } from "./macros/browser.js";
|
|
11
11
|
export { BuildCache, CLIENT_BINDING_STUB, __set_build_cache_root, configure_build_cache, content_css_key, createHash, dedent, find_og_calls, fs, is_js_module, islandVirtualId, og_js_regions, og_member, parse_module, path, run_browser_macros, set_host, set_parser, split_first_string, transformHost, transformTsRegions, wrapperVirtualId };
|
package/dist/compiler/ctx.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export declare class CompileCtx {
|
|
|
160
160
|
* runs. Both the stable name and the content-hashed file carry it, so a name says which runtime. */
|
|
161
161
|
runtime_features(program_feature_hash: string): string;
|
|
162
162
|
/** The runtime's STABLE name (`RUNTIME_HASH` ⊕ its features): its identity — the key the handoff
|
|
163
|
-
* maps to the content-hashed file the page loads
|
|
163
|
+
* maps to the content-hashed file the page loads (a name, not a file). Computed here
|
|
164
164
|
* (not the caller) so both build legs name it identically. `program_feature_hash` is
|
|
165
165
|
* `Program.runtime_feature_hash`, threaded in by the caller so this stays a pure naming function. */
|
|
166
166
|
runtime_chunk_filename(program_feature_hash: string): string;
|
package/dist/compiler/ctx.js
CHANGED
|
@@ -2,7 +2,7 @@ import { fs } from "./host.js";
|
|
|
2
2
|
import { strip_bom } from "./bom.js";
|
|
3
3
|
import { islandVirtualId } from "./ids.js";
|
|
4
4
|
import { parse_module } from "./parse/oxc.js";
|
|
5
|
-
import { islandChunkFileName, islandPublicUrl, wrapperVirtualId } from "./region/transform.js";
|
|
5
|
+
import { STABLE_NAME_DIR, islandChunkFileName, islandPublicUrl, wrapperVirtualId } from "./region/transform.js";
|
|
6
6
|
// src/compiler/ctx.ts
|
|
7
7
|
/**
|
|
8
8
|
* `CompileCtx` — the resolved compile context: the config the transform phase reads, plus its
|
|
@@ -156,12 +156,12 @@ var CompileCtx = class {
|
|
|
156
156
|
return `${program_feature_hash}${this.client_hooks ? "h" : ""}`;
|
|
157
157
|
}
|
|
158
158
|
/** The runtime's STABLE name (`RUNTIME_HASH` ⊕ its features): its identity — the key the handoff
|
|
159
|
-
* maps to the content-hashed file the page loads
|
|
159
|
+
* maps to the content-hashed file the page loads (a name, not a file). Computed here
|
|
160
160
|
* (not the caller) so both build legs name it identically. `program_feature_hash` is
|
|
161
161
|
* `Program.runtime_feature_hash`, threaded in by the caller so this stays a pure naming function. */
|
|
162
162
|
runtime_chunk_filename(program_feature_hash) {
|
|
163
163
|
const feat = this.runtime_features(program_feature_hash);
|
|
164
|
-
return `${this.app_dir}/
|
|
164
|
+
return `${this.app_dir}/${STABLE_NAME_DIR}/og-runtime.${this.runtime_hash}${feat ? "-" + feat : ""}.js`;
|
|
165
165
|
}
|
|
166
166
|
/** App-internal URL of the runtime chunk (leading slash + appDir; NO base). SSR bakes it as the
|
|
167
167
|
* `<script src>`, then `asset()` prepends base / the assets CDN at render time. */
|
|
@@ -8,5 +8,16 @@
|
|
|
8
8
|
* their literal column contribution to the prefix (the common prefix is computed on raw characters,
|
|
9
9
|
* so mixed tabs/spaces still de-indent correctly as long as the leading run is consistent — which it
|
|
10
10
|
* is for machine-indented source).
|
|
11
|
+
*
|
|
12
|
+
* Also a TAG, for the code the compiler generates (its virtual modules), written as the code itself:
|
|
13
|
+
*
|
|
14
|
+
* dedent`
|
|
15
|
+
* export const dev = ${is_dev};
|
|
16
|
+
* `
|
|
17
|
+
*
|
|
18
|
+
* The template's own text is de-indented first and the values go in after, so a value spanning lines
|
|
19
|
+
* (a generated block) never decides the indent. Values are interpolated as a template literal would
|
|
20
|
+
* (cooked strings: `\\n` in the template is a newline).
|
|
11
21
|
*/
|
|
12
|
-
export declare function dedent(text: string): string;
|
|
22
|
+
export declare function dedent(text: string): string;
|
|
23
|
+
export declare function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/compiler/dedent.ts
|
|
2
|
+
const CRLF_G = /\r\n?/g;
|
|
3
|
+
const LEADING_INDENT_RE = /^[\t ]*/;
|
|
4
|
+
function dedent(first, ...values) {
|
|
5
|
+
if (typeof first === "string") return dedent_text(first);
|
|
6
|
+
let text = first[0];
|
|
7
|
+
for (let i = 1; i < first.length; i++) text += SLOT + (i - 1) + SLOT + first[i];
|
|
8
|
+
const flat = dedent_text(text);
|
|
9
|
+
if (values.length === 0) return flat;
|
|
10
|
+
let out = "";
|
|
11
|
+
let at = 0;
|
|
12
|
+
for (;;) {
|
|
13
|
+
const open = flat.indexOf(SLOT, at);
|
|
14
|
+
if (open === -1) return out + flat.slice(at);
|
|
15
|
+
const close = flat.indexOf(SLOT, open + 1);
|
|
16
|
+
out += flat.slice(at, open) + String(values[Number(flat.slice(open + 1, close))]);
|
|
17
|
+
at = close + 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** The placeholder edge for a tag's value while its template is de-indented. */
|
|
21
|
+
const SLOT = "\0";
|
|
22
|
+
function dedent_text(text) {
|
|
23
|
+
const lines = text.replace(CRLF_G, "\n").split("\n");
|
|
24
|
+
while (lines.length && lines[0].trim() === "") lines.shift();
|
|
25
|
+
while (lines.length && lines[lines.length - 1].trim() === "") lines.pop();
|
|
26
|
+
if (!lines.length) return "";
|
|
27
|
+
let common = null;
|
|
28
|
+
for (const line of lines) {
|
|
29
|
+
if (line.trim() === "") continue;
|
|
30
|
+
const lead = LEADING_INDENT_RE.exec(line)[0];
|
|
31
|
+
if (common === null) common = lead;
|
|
32
|
+
else {
|
|
33
|
+
let i = 0;
|
|
34
|
+
const max = Math.min(common.length, lead.length);
|
|
35
|
+
while (i < max && common[i] === lead[i]) i++;
|
|
36
|
+
common = common.slice(0, i);
|
|
37
|
+
}
|
|
38
|
+
if (common === "") break;
|
|
39
|
+
}
|
|
40
|
+
const n = common?.length ?? 0;
|
|
41
|
+
return lines.map((line) => line.trim() === "" ? "" : line.slice(n)).join("\n");
|
|
42
|
+
}
|
|
43
|
+
export { dedent };
|
|
@@ -158,6 +158,9 @@ export declare class Compiler {
|
|
|
158
158
|
* bundle end turns them into the hashed file names the handoff maps the stable names to. */
|
|
159
159
|
readonly island_entry_refs: Map<string, string>;
|
|
160
160
|
runtime_entry_ref: string | null;
|
|
161
|
+
/** The location map's served path (`/<appDir>/immutable/og-locations.<hash>.json`), once
|
|
162
|
+
* `location_map` wrote it: the handoff carries it to the server (`locations`). */
|
|
163
|
+
location_map_url: string | null;
|
|
161
164
|
/**
|
|
162
165
|
* At the bundle's end (the names are final): each entry's IDENTITY → its LOCATION. `islands` maps
|
|
163
166
|
* an island entry's hashed file to its identity (the collector keys every map by identity);
|
|
@@ -170,8 +173,8 @@ export declare class Compiler {
|
|
|
170
173
|
runtime_file: string | null;
|
|
171
174
|
locations: Record<string, string>;
|
|
172
175
|
};
|
|
173
|
-
/** One hydrate island's entry, content-hashed by the bundler (
|
|
174
|
-
* the bundle's end: `
|
|
176
|
+
/** One hydrate island's entry, content-hashed by the bundler (the location maps that name it are
|
|
177
|
+
* written at the bundle's end: `location_maps`). */
|
|
175
178
|
emit_island_entry(emitFile: EmitChunk, rid: string, virtualPath: string): void;
|
|
176
179
|
/**
|
|
177
180
|
* The output file pattern for one of OUR entries (by the chunk name `emit_island_entry` / the
|
|
@@ -182,11 +185,11 @@ export declare class Compiler {
|
|
|
182
185
|
*/
|
|
183
186
|
entry_file_pattern(chunk_name: string | undefined): string | null;
|
|
184
187
|
/**
|
|
185
|
-
* The
|
|
186
|
-
* island entry
|
|
187
|
-
*
|
|
188
|
+
* The build's location maps (link/location-map.ts), for the bundle's end (the names are final):
|
|
189
|
+
* every island entry's identity → its hashed file, content-hashed and at the one fixed name.
|
|
190
|
+
* `get_file_name` is the bundler's `this.getFileName`. Empty with no island.
|
|
188
191
|
*/
|
|
189
|
-
|
|
192
|
+
location_maps(get_file_name: (ref: string) => string): {
|
|
190
193
|
fileName: string;
|
|
191
194
|
source: string;
|
|
192
195
|
}[];
|
package/dist/compiler/driver.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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";
|
|
11
11
|
import { island_deps_module } from "./link/island-deps.js";
|
|
12
|
-
import {
|
|
12
|
+
import { location_map_files } from "./link/location-map.js";
|
|
13
13
|
import { context_string_keys, source_uses_ogygia_context } from "./link/context-detect.js";
|
|
14
14
|
import { collect_flag_sites } from "./flags.js";
|
|
15
15
|
import { router_css_module, router_css_roots } from "./link/router-css.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
|
|
50
|
-
|
|
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)
|
|
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
|
-
|
|
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))
|
|
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"
|
|
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);
|
|
@@ -589,7 +610,7 @@ var Compiler = class {
|
|
|
589
610
|
* `emitRuntime`), then one chunk per deduped HYDRATE region id. IDENTITY vs LOCATION: SSR bakes the
|
|
590
611
|
* stable name (`island_public_url`) as the region's identity; the file the browser loads is named
|
|
591
612
|
* by its content (the bundler hashes it), and the bundle end hands the stable → hashed map to the
|
|
592
|
-
* server (the handoff's `entries`)
|
|
613
|
+
* server (the handoff's `entries`) and to the browser (the location maps).
|
|
593
614
|
* csr=false hosts omit wrapper imports so this emit owns the module. Idempotent per id.
|
|
594
615
|
*/
|
|
595
616
|
#router_css_roots_cache = null;
|
|
@@ -674,6 +695,9 @@ var Compiler = class {
|
|
|
674
695
|
* bundle end turns them into the hashed file names the handoff maps the stable names to. */
|
|
675
696
|
island_entry_refs = /* @__PURE__ */ new Map();
|
|
676
697
|
runtime_entry_ref = null;
|
|
698
|
+
/** The location map's served path (`/<appDir>/immutable/og-locations.<hash>.json`), once
|
|
699
|
+
* `location_map` wrote it: the handoff carries it to the server (`locations`). */
|
|
700
|
+
location_map_url = null;
|
|
677
701
|
/**
|
|
678
702
|
* At the bundle's end (the names are final): each entry's IDENTITY → its LOCATION. `islands` maps
|
|
679
703
|
* an island entry's hashed file to its identity (the collector keys every map by identity);
|
|
@@ -704,8 +728,8 @@ var Compiler = class {
|
|
|
704
728
|
locations
|
|
705
729
|
};
|
|
706
730
|
}
|
|
707
|
-
/** One hydrate island's entry, content-hashed by the bundler (
|
|
708
|
-
* the bundle's end: `
|
|
731
|
+
/** One hydrate island's entry, content-hashed by the bundler (the location maps that name it are
|
|
732
|
+
* written at the bundle's end: `location_maps`). */
|
|
709
733
|
emit_island_entry(emitFile, rid, virtualPath) {
|
|
710
734
|
this.program.emitted_island_chunks.add(rid);
|
|
711
735
|
this.island_entry_refs.set(rid, emitFile({
|
|
@@ -727,28 +751,17 @@ var Compiler = class {
|
|
|
727
751
|
return `${this.#ctx.app_dir}/immutable/[name].[hash].js`;
|
|
728
752
|
}
|
|
729
753
|
/**
|
|
730
|
-
* The
|
|
731
|
-
* island entry
|
|
732
|
-
*
|
|
754
|
+
* The build's location maps (link/location-map.ts), for the bundle's end (the names are final):
|
|
755
|
+
* every island entry's identity → its hashed file, content-hashed and at the one fixed name.
|
|
756
|
+
* `get_file_name` is the bundler's `this.getFileName`. Empty with no island.
|
|
733
757
|
*/
|
|
734
|
-
|
|
758
|
+
location_maps(get_file_name) {
|
|
735
759
|
const ctx = this.#ctx;
|
|
736
|
-
const
|
|
737
|
-
for (const [rid, ref] of this.island_entry_refs)
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
source: island_shim_source(fileName, get_file_name(ref))
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
if (this.runtime_entry_ref) {
|
|
745
|
-
const fileName = this.runtime_chunk_filename();
|
|
746
|
-
out.push({
|
|
747
|
-
fileName,
|
|
748
|
-
source: runtime_shim_source(fileName, get_file_name(this.runtime_entry_ref))
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
return out;
|
|
760
|
+
const pairs = [];
|
|
761
|
+
for (const [rid, ref] of this.island_entry_refs) pairs.push([ctx.island_chunk_filename(rid), get_file_name(ref)]);
|
|
762
|
+
const files = location_map_files(ctx.app_dir, pairs, (source) => createHash("sha256").update(source).digest("hex").slice(0, 12));
|
|
763
|
+
this.location_map_url = files.length ? "/" + files[0].fileName : null;
|
|
764
|
+
return files;
|
|
752
765
|
}
|
|
753
766
|
/**
|
|
754
767
|
* Emit one ogygia VIRTUAL module's source: the config/capability virtuals (secret / sign / rate-limit
|
|
@@ -782,6 +795,11 @@ var Compiler = class {
|
|
|
782
795
|
const ch = client_hooks_boot(ctx);
|
|
783
796
|
return ch.imports + code + ch.call;
|
|
784
797
|
}
|
|
798
|
+
if (id === RESOLVED("virtual:ogygia/runtime-flags")) {
|
|
799
|
+
if (!ctx.is_build) return generateRuntimeFlagsSource({}, true);
|
|
800
|
+
this.prescan();
|
|
801
|
+
return generateRuntimeFlagsSource(program.runtime_marks);
|
|
802
|
+
}
|
|
785
803
|
if (id === RESOLVED("virtual:ogygia/hydrate-features")) {
|
|
786
804
|
if (!ctx.is_build) {
|
|
787
805
|
const rt = dev_runtime_of(ctx.runtime_dir);
|
|
@@ -789,7 +807,8 @@ var Compiler = class {
|
|
|
789
807
|
return rt?.ts ? code.split(".js\";").join(".ts\";") : code;
|
|
790
808
|
}
|
|
791
809
|
this.prescan();
|
|
792
|
-
|
|
810
|
+
const marks = program.runtime_marks;
|
|
811
|
+
return (marks.wire === true || marks.context === true || program.crosses_wire ? `import ${JSON.stringify(V_FN_MANIFEST)};\n` : "") + generateHydrateFeaturesSource(marks, ctx.runtime_dir).code;
|
|
793
812
|
}
|
|
794
813
|
if (id === RESOLVED("virtual:ogygia-runtime")) {
|
|
795
814
|
const ch = client_hooks_boot(ctx);
|
|
@@ -901,6 +920,7 @@ var Compiler = class {
|
|
|
901
920
|
if (source === "virtual:ogygia-runtime") return RESOLVED(V_RUNTIME);
|
|
902
921
|
if (source === "virtual:ogygia/runtime-entry") return RESOLVED(V_RUNTIME_ENTRY);
|
|
903
922
|
if (source === "virtual:ogygia/hydrate-features") return RESOLVED(V_HYDRATE_FEATURES);
|
|
923
|
+
if (source === "virtual:ogygia/runtime-flags") return RESOLVED(V_RUNTIME_FLAGS);
|
|
904
924
|
if (source === "virtual:ogygia/dev-hmr") return RESOLVED(V_DEV_HMR);
|
|
905
925
|
if (source === "virtual:ogygia/dev-hmr-url") return RESOLVED(V_DEV_HMR_URL);
|
|
906
926
|
if (source === "virtual:ogygia/devtools-boot") return RESOLVED(V_DEVTOOLS_BOOT);
|
|
@@ -924,6 +944,7 @@ var Compiler = class {
|
|
|
924
944
|
if (source === "virtual:ogygia/request-event") return RESOLVED(V_REQUEST_EVENT);
|
|
925
945
|
if (source === "virtual:ogygia/region-endpoint") return RESOLVED(V_REGION_ENDPOINT);
|
|
926
946
|
if (source === "virtual:ogygia/client-binding-stub") return ctx.client_binding_stub_file;
|
|
947
|
+
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
948
|
if (source.startsWith("virtual:ogygia/fouc-css/") || source.startsWith("virtual:ogygia/fouc-scoped/")) return RESOLVED(source);
|
|
928
949
|
if (source === "virtual:ogygia/transport") return RESOLVED(V_TRANSPORT);
|
|
929
950
|
if (source === "virtual:ogygia/transportables") return RESOLVED(V_TRANSPORTABLES);
|
|
@@ -993,11 +1014,24 @@ var Compiler = class {
|
|
|
993
1014
|
}
|
|
994
1015
|
/** True for a csr=false route host file (`+page`/`+layout` `.svelte`/`.ts`/`.js`). A `+page.ts`
|
|
995
1016
|
* shares its route's world with the sibling `.svelte` host. */
|
|
1017
|
+
/** A route COMPONENT whose client leg links the binding stub — `transform`'s `link_virtual` rule,
|
|
1018
|
+
* for a host that could not apply it itself: csr=false, and not a layout of an app with a
|
|
1019
|
+
* csr=true route (Kit can hydrate that layout: a csr=true child page, or an error render). */
|
|
1020
|
+
#links_client_stub(importer) {
|
|
1021
|
+
const importer_abs = strip_id(importer);
|
|
1022
|
+
const routes_dir = kit_dirs(this.#ctx.root).routes_dir;
|
|
1023
|
+
if (!importer_abs.startsWith(routes_dir + path.sep)) return false;
|
|
1024
|
+
const base = path.basename(importer_abs);
|
|
1025
|
+
if (is_route_component(base, "layout")) return routeCsrIsFalse(importer_abs, routes_dir) && !hasAnyCsrTrueRoute(routes_dir);
|
|
1026
|
+
return is_route_component(base, "page") && routeCsrIsFalse(importer_abs, routes_dir);
|
|
1027
|
+
}
|
|
996
1028
|
#is_csr_false_route_host(importer) {
|
|
997
1029
|
const importer_abs = strip_id(importer);
|
|
998
1030
|
const routes_dir = kit_dirs(this.#ctx.root).routes_dir;
|
|
999
1031
|
if (!importer_abs.startsWith(routes_dir + path.sep)) return false;
|
|
1000
|
-
const
|
|
1032
|
+
const base = path.basename(importer_abs);
|
|
1033
|
+
if (is_route_component(base, "page") || is_route_component(base, "layout")) return routeCsrIsFalse(importer_abs, routes_dir);
|
|
1034
|
+
const m = ROUTE_HOST_FILE_RE.exec(base);
|
|
1001
1035
|
if (!m) return false;
|
|
1002
1036
|
return routeCsrIsFalse(path.join(importer_abs, "..", `+${m[1]}.svelte`), routes_dir);
|
|
1003
1037
|
}
|
package/dist/compiler/ids.d.ts
CHANGED
|
@@ -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";
|
package/dist/compiler/ids.js
CHANGED
|
@@ -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 };
|