@ogygia/core 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/KeepHost.svelte +1 -1
  3. package/dist/LiveHost.svelte +1 -1
  4. package/dist/NestedProvider.svelte +1 -1
  5. package/dist/SlotBoundary.svelte +1 -1
  6. package/dist/compiler/driver.js +53 -11
  7. package/dist/compiler/ids.d.ts +3 -0
  8. package/dist/compiler/ids.js +4 -1
  9. package/dist/compiler/index.d.ts +2 -2
  10. package/dist/compiler/index.js +2 -2
  11. package/dist/compiler/kit.d.ts +7 -0
  12. package/dist/compiler/kit.js +22 -10
  13. package/dist/compiler/link/runtime-entry.d.ts +19 -2
  14. package/dist/compiler/link/runtime-entry.js +34 -1
  15. package/dist/compiler/program.d.ts +4 -0
  16. package/dist/compiler/program.js +5 -1
  17. package/dist/context.d.ts +3 -12
  18. package/dist/context.js +1 -16
  19. package/dist/internal.d.ts +2 -1
  20. package/dist/internal.js +2 -1
  21. package/dist/nested.d.ts +11 -0
  22. package/dist/nested.js +19 -0
  23. package/dist/ref-sink.d.ts +15 -0
  24. package/dist/ref-sink.js +19 -0
  25. package/dist/ref.d.ts +2 -2
  26. package/dist/ref.js +1 -11
  27. package/dist/runtime/core.js +7 -5
  28. package/dist/runtime/full.js +5 -1
  29. package/dist/runtime/hydrate-core.d.ts +4 -4
  30. package/dist/runtime/hydrate-core.js +8 -5
  31. package/dist/runtime/nav-handle.d.ts +3 -0
  32. package/dist/runtime/nav-handle.js +12 -5
  33. package/dist/runtime/region-ids.js +2 -2
  34. package/dist/runtime/remote-seeds.js +14 -3
  35. package/dist/runtime/seeds.d.ts +10 -5
  36. package/dist/runtime/seeds.js +16 -12
  37. package/dist/runtime/slots.d.ts +16 -0
  38. package/dist/runtime/slots.js +2 -0
  39. package/dist/runtime/wire-classes.d.ts +2 -0
  40. package/dist/runtime/wire-classes.js +10 -1
  41. package/dist/runtime/wire-format.d.ts +4 -1
  42. package/dist/runtime/wire-format.js +6 -1
  43. package/dist/seed-ref-reviver.d.ts +24 -0
  44. package/dist/seed-ref-reviver.js +44 -0
  45. package/dist/seed-refs.d.ts +2 -16
  46. package/dist/seed-refs.js +1 -33
  47. package/dist/server/props-wire.js +2 -1
  48. package/package.json +3 -3
@@ -1,6 +1,4 @@
1
- /** The devalue type tag. */
2
- export declare const SEED_REF_KEY = "OgygiaSeedRef";
3
- export type SeedPath = (string | number)[];
1
+ import { SEED_REF_KEY, SeedPath, resolve_seed_ref, seed_ref_reviver } from "./seed-ref-reviver.js";
4
2
  export interface SeedIndex {
5
3
  /** node → its path from `page.data` (identity matches: the app passed the seed's own object).
6
4
  * The path is materialised on the first ask — an indexed node that no island references
@@ -90,16 +88,4 @@ export interface SeedRefPlan {
90
88
  * no walk of its own beyond the pointer lookups.
91
89
  */
92
90
  export declare function plan_seed_refs(index: SeedIndex, props: unknown, min_bytes?: number): SeedRefPlan;
93
- /** Client: the node a path points at, or `undefined` when the seed does not have it. */
94
- export declare function resolve_seed_ref(data: unknown, path: SeedPath): unknown;
95
- /**
96
- * Client reviver for the devalue type: resolve BY REFERENCE. The island receives the seed's own
97
- * node — the same object its `page.data` read would hand it, shared exactly the way `page.data`
98
- * already is between islands. A deep copy per reference (129 of them on a measured page) bought
99
- * nothing: island props are a snapshot either way, and the DEV mutation guard the runtime wraps
100
- * every island's props in (`PropMutationGuard`) already warns on a write into them. `get_data` is
101
- * called lazily, once per reviver — the first reference resolves the seed. A dangling path (no seed,
102
- * or a seed that does not carry the node) revives to `undefined` and, in dev, says why.
103
- */
104
- export declare function seed_ref_reviver(get_data: () => unknown): (path: SeedPath) => unknown;
105
- export {};
91
+ export { SEED_REF_KEY, type SeedPath, resolve_seed_ref, seed_ref_reviver };
package/dist/seed-refs.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fnv1a } from "./runtime/hash.js";
2
+ import { SEED_REF_KEY, resolve_seed_ref, seed_ref_reviver } from "./seed-ref-reviver.js";
2
3
  // src/seed-refs.ts
3
4
  /**
4
5
  * SEED REFERENCES — island props that point into the page seed instead of copying it.
@@ -43,8 +44,6 @@ import { fnv1a } from "./runtime/hash.js";
43
44
  * Universal module (no Node imports): the index + reducer run on the server, the resolver on the
44
45
  * client, and the unit tests exercise both ends against a real devalue round trip.
45
46
  */
46
- /** The devalue type tag. */
47
- const SEED_REF_KEY = "OgygiaSeedRef";
48
47
  /** A node the codec may reference: a plain object or an array (own prototype only). */
49
48
  function is_plain(v) {
50
49
  if (v === null || typeof v !== "object") return false;
@@ -453,35 +452,4 @@ function plan_seed_refs(index, props, min_bytes = 96) {
453
452
  keys
454
453
  };
455
454
  }
456
- /** Client: the node a path points at, or `undefined` when the seed does not have it. */
457
- function resolve_seed_ref(data, path) {
458
- let cur = data;
459
- for (const key of path) {
460
- if (cur === null || typeof cur !== "object") return void 0;
461
- cur = cur[key];
462
- }
463
- return cur;
464
- }
465
- /**
466
- * Client reviver for the devalue type: resolve BY REFERENCE. The island receives the seed's own
467
- * node — the same object its `page.data` read would hand it, shared exactly the way `page.data`
468
- * already is between islands. A deep copy per reference (129 of them on a measured page) bought
469
- * nothing: island props are a snapshot either way, and the DEV mutation guard the runtime wraps
470
- * every island's props in (`PropMutationGuard`) already warns on a write into them. `get_data` is
471
- * called lazily, once per reviver — the first reference resolves the seed. A dangling path (no seed,
472
- * or a seed that does not carry the node) revives to `undefined` and, in dev, says why.
473
- */
474
- function seed_ref_reviver(get_data) {
475
- let data;
476
- let resolved = false;
477
- return (path) => {
478
- if (!resolved) {
479
- data = get_data();
480
- resolved = true;
481
- }
482
- const node = resolve_seed_ref(data, path);
483
- if (node === void 0 && typeof console !== "undefined" && import.meta.env?.DEV) console.warn(`[ogygia] island props reference page.data at ${JSON.stringify(path)} but the page seed does not carry it — the island receives undefined there.`);
484
- return node;
485
- };
486
- }
487
455
  export { SEED_REF_KEY, analyze, deep_equal_plain, index_seed, json_culprit, plan_seed_refs, resolve_seed_ref, seed_ref_reviver, set_measure_memo_reader };
@@ -1,10 +1,11 @@
1
1
  import { escape_script_text } from "../escape.js";
2
+ import { SEED_REF_KEY } from "../seed-ref-reviver.js";
2
3
  import { REF_WIRE_KEY, ref_reducer } from "../ref.js";
3
4
  import { register_wire_kind } from "../live-transport.js";
4
5
  import { register_derived_kind, register_store_kind } from "../store-transport.js";
5
6
  import { register_snippet_kind } from "../region-snippet.js";
6
7
  import { register_fn_kind } from "../fn-transport.js";
7
- import { SEED_REF_KEY, analyze, json_culprit, plan_seed_refs } from "../seed-refs.js";
8
+ import { analyze, json_culprit, plan_seed_refs } from "../seed-refs.js";
8
9
  import { stringify } from "devalue";
9
10
  // src/server/props-wire.ts
10
11
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ogygia/core",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "The core of ogygia (SSR islands for SvelteKit): apps install `ogygia`, plugins build on this",
5
5
  "homepage": "https://ogygiajs.dev",
6
6
  "bugs": {
@@ -141,6 +141,7 @@
141
141
  "tinyglobby": "^0.2.17"
142
142
  },
143
143
  "devDependencies": {
144
+ "@ogygia/tsdown-plugin-svelte": "1.1.1",
144
145
  "@sveltejs/kit": "^2.70.2",
145
146
  "@sveltejs/vite-plugin-svelte": "^7.2.0",
146
147
  "@types/node": "^26.1.2",
@@ -156,8 +157,7 @@
156
157
  "typescript": "^6.0.3",
157
158
  "valibot": "^1.4.2",
158
159
  "vite": "^8.3.5",
159
- "vitest": "^4.1.12",
160
- "@ogygia/tsdown-plugin-svelte": "1.1.0"
160
+ "vitest": "^4.1.12"
161
161
  },
162
162
  "peerDependencies": {
163
163
  "@sveltejs/kit": ">=2.70.2 <4",