@nifrajs/web-solid 3.5.0 → 4.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAmBnE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAE/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAkE7D"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAiBnE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAE/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CA0C7D"}
package/dist/client.js CHANGED
@@ -1,6 +1,3 @@
1
- // `/client`, not the root: the root's graph carries the server, and Vite's dev server evaluates it
2
- // instead of tree-shaking it - which broke hydration before the browser ran a line of app code.
3
- import { searchOfChain } from "@nifrajs/web/client";
4
1
  /**
5
2
  * @nifrajs/web-solid/client - Solid client runtime. `hydrate` hydrates a single SSR'd route;
6
3
  * `mountRouter` hydrates the initial route then drives navigation through a Solid signal - so a
@@ -13,6 +10,7 @@ import { createSignal } from "solid-js";
13
10
  import { hydrate as solidHydrate, render as solidRender } from "solid-js/web";
14
11
  import { compose } from "./compose.js";
15
12
  import { setMountedRouter } from "./fetcher.js";
13
+ import { routeProps } from "./route-props.js";
16
14
  // The `_error` boundary chain element - defined in its own module, re-exported here so nifra's client
17
15
  // codegen resolves it from `@nifrajs/web-solid/client` alongside `mountRouter`.
18
16
  export { errorBoundary } from "./error.js";
@@ -33,7 +31,7 @@ export function hydrate(chain, props, container) {
33
31
  * they don't shift Solid's structural hydration keys - unlike a `<Show>`, which would.)
34
32
  */
35
33
  export function mountRouter(options) {
36
- const { router, routes, searchSchemas, container } = options;
34
+ const { router, routes, searchSchemas, matchChains, container } = options;
37
35
  setMountedRouter(router); // expose it to createFetcher/useFetchers (same page, client-only)
38
36
  const el = container;
39
37
  let dispose;
@@ -45,47 +43,23 @@ export function mountRouter(options) {
45
43
  mountedRouteId = initial.routeId;
46
44
  const renderer = first ? solidHydrate : solidRender;
47
45
  dispose = renderer(() => {
48
- // Signal owned by THIS render root (so it's never ownerless). `props` are getters over it; a
46
+ // Signal owned by THIS render root (so it's never ownerless). `routeProps` are getters over it; a
49
47
  // same-route settle calls `update(snapshot)` and the reading components update in place - no
50
- // recompose, so the layout chain + focus + scroll survive. Cast bridges
51
- // `exactOptionalPropertyTypes` (a getter is always present, returning `undefined` when idle -
52
- // the documented "absent on idle" semantics for `submission`).
48
+ // recompose, so the layout chain + focus + scroll survive.
53
49
  const [snapshot, setSnapshot] = createSignal(initial);
54
50
  update = setSnapshot;
55
- const props = {
56
- get data() {
57
- return snapshot().data;
58
- },
59
- get actionData() {
60
- return snapshot().actionData;
61
- },
62
- get pending() {
63
- return snapshot().pending;
64
- },
65
- get search() {
66
- // The SAME searchOfChain the server ran, over this snapshot's URL - a same-route search change
67
- // updates in place (fine-grained), matching the SSR value on hydration.
68
- const s = snapshot();
69
- const idx = s.path.indexOf("?");
70
- return searchOfChain(searchSchemas?.[s.routeId] ?? [], idx === -1 ? "" : s.path.slice(idx));
71
- },
72
- get submission() {
73
- return snapshot().submission;
74
- },
75
- get boundaries() {
76
- return snapshot().boundaries;
77
- },
78
- };
79
51
  // The matched chain is fixed for this mount (routeId is constant here); a route *change* disposes
80
52
  // and re-mounts below, so the root render fn reads no signal and never re-runs on its own.
81
- return compose(routes[initial.routeId] ?? [], props)();
53
+ return compose(routes[initial.routeId] ?? [], routeProps(snapshot, searchSchemas, matchChains))();
82
54
  }, el);
83
55
  };
84
56
  mount(true);
85
57
  router.subscribe(() => {
86
58
  const snapshot = router.snapshot();
87
- if (snapshot.pending)
88
- return; // skip the in-flight tick; act once settled
59
+ // Skip the in-flight tick and act once settled - unless the store names a different chain while
60
+ // pending, which is a `_loading` page taking the page slot for the navigation in flight.
61
+ if (snapshot.pending && snapshot.routeId === mountedRouteId)
62
+ return;
89
63
  if (snapshot.routeId === mountedRouteId) {
90
64
  update?.(snapshot); // same route → reactive in-place update (preserves layout/focus/scroll)
91
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,mGAAmG;AACnG,gGAAgG;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,sGAAsG;AACtG,gFAAgF;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,mGAAmG;AACnG,MAAM,UAAU,OAAO,CAAC,KAAyB,EAAE,KAAkB,EAAE,SAAkB;IACvF,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAA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G,WAAW,CAAA;YACpB,kGAAkG;YAClG,2FAA2F;YAC3F,OAAO,OAAO,CACZ,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAC7B,UAAU,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,CAAC,CACjD,EAAE,CAAA;QACL,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,CAAA;IACX,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE;QACpB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;QAClC,gGAAgG;QAChG,yFAAyF;QACzF,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,KAAK,cAAc;YAAE,OAAM;QACnE,IAAI,QAAQ,CAAC,OAAO,KAAK,cAAc,EAAE,CAAC;YACxC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAA,CAAC,wEAAwE;QAC7F,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,EAAE,CAAA,CAAC,qDAAqD;YACjE,KAAK,CAAC,KAAK,CAAC,CAAA;QACd,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAmC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAMpE;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,CAAC,OAAO,CA2BxF"}
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAmC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAMpE;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,CAAC,OAAO,CAmCxF"}
package/dist/compose.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createComponent } from "solid-js";
2
- import { SearchContext } from "./router.js";
2
+ import { RenderPropsContext, SearchContext } from "./router.js";
3
3
  // Frozen empty search so a render with no search context has a stable provider value.
4
4
  const EMPTY_SEARCH = Object.freeze({});
5
5
  /**
@@ -19,9 +19,12 @@ export function compose(chain, props) {
19
19
  // Each layout receives its own loader data at its own index. Layouts are the chain's leading
20
20
  // prefix, so `layoutData[i]` belongs to `chain[i]`; anything past that end (a client-only `_error`
21
21
  // boundary marker, the page) reads `undefined` and is unaffected.
22
- const layoutData = props.layoutData?.[i] ?? null;
22
+ // Read through a getter: on the client `props` are getters over the router snapshot, so a
23
+ // same-route settle that brings new layout data updates the layout in place.
23
24
  node = () => createComponent(Layout, {
24
- data: layoutData,
25
+ get data() {
26
+ return props.layoutData?.[i] ?? null;
27
+ },
25
28
  ...(props.boundaries !== undefined ? { boundaries: props.boundaries } : {}),
26
29
  children: child(),
27
30
  });
@@ -32,7 +35,12 @@ export function compose(chain, props) {
32
35
  return () => createComponent(SearchContext.Provider, {
33
36
  value: () => (props.search ?? EMPTY_SEARCH),
34
37
  get children() {
35
- return inner();
38
+ return createComponent(RenderPropsContext.Provider, {
39
+ value: props,
40
+ get children() {
41
+ return inner();
42
+ },
43
+ });
36
44
  },
37
45
  });
38
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,eAAe,EAAY,MAAM,UAAU,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,sFAAsF;AACtF,MAAM,YAAY,GAAsC,MAAM,CAAC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AAC,KAAK,CAAC,MAAM,IAAI,YAAY,CAA4B;QACtE,IAAI,QAAQ;YACV,OAAO,eAAe,CAAC,kBAAkB,CAAC,QAAQ,EAAE;gBAClD,KAAK,EAAE,KAAK;gBACZ,IAAI,QAAQ;oBACV,OAAO,KAAK,EAAE,CAAA;gBAChB,CAAC;aACF,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;AACN,CAAC"}
package/dist/i18n.d.ts CHANGED
@@ -5,17 +5,29 @@
5
5
  * negotiated catalog on the server, and the client rebuilds the same formatter on hydrate (no
6
6
  * mismatch). Imports only `solid-js` + `@nifrajs/i18n`; no JSX (`createComponent`).
7
7
  */
8
- import { type Formatter, type Messages } from "@nifrajs/i18n";
8
+ import { type Formatter, type FormatterOptions, type MessageKey, type RegisteredMessages, type Translation } from "@nifrajs/i18n";
9
9
  import { type JSX } from "solid-js";
10
- export interface I18nProviderProps {
10
+ export interface I18nProviderProps extends FormatterOptions {
11
11
  readonly locale: string;
12
- readonly messages: Messages;
12
+ /** The catalog for `locale`, checked against the registered catalog type when one is declared. */
13
+ readonly messages: Translation;
13
14
  readonly children?: JSX.Element;
14
15
  }
15
- /** Provide a {@link Formatter} (built from `locale` + `messages`) to the subtree. Memoized on
16
- * `locale`/`messages`, so switching locale rebuilds it. */
16
+ /** Provide a {@link Formatter} (built from `locale` + `messages`, with the optional `fallback`,
17
+ * `onMissing`, `timeZone` and `numberingSystem` of `createFormatter`) to the subtree. Memoized
18
+ * on those props, so switching locale rebuilds it. */
17
19
  export declare function I18nProvider(props: I18nProviderProps): JSX.Element;
18
- /** Read the current {@link Formatter} (`{ locale, t, n, d }`). Throws if no `<I18nProvider>` is above.
20
+ /** Read the current {@link Formatter} (`{ locale, t, get, n, d }`). Throws if no `<I18nProvider>` is above.
19
21
  * nifra switches locale by re-navigating, which re-runs the consuming component with the new catalog. */
20
22
  export declare function useT(): Formatter;
23
+ /** Tag handlers for {@link rich}, by tag name: each receives its tag's content as one node. */
24
+ export type RichTags = Readonly<Record<string, (content: JSX.Element) => JSX.Element>>;
25
+ /**
26
+ * The message at `key` with its tags rendered by `tags`, as Solid nodes - no HTML, no `innerHTML`.
27
+ * `"Read the <link>terms</link>"` with `{ link: (content) => <a href="/terms">{content}</a> }`
28
+ * renders the link around "terms"; a tag with no handler renders its content as text, `<br/>` is a
29
+ * `<br>`, and interpolated values are always text. It runs once: wrap the call in a function
30
+ * (`{() => rich(t, key, tags, { n: count() })}`) to track signals in `vars`. See `@nifrajs/i18n/rich`.
31
+ */
32
+ export declare function rich<M extends object = RegisteredMessages>(formatter: Formatter<M>, key: MessageKey<M>, tags?: RichTags, vars?: Readonly<Record<string, unknown>>): JSX.Element;
21
33
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAKL,KAAK,GAAG,EAET,MAAM,UAAU,CAAA;AAIjB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAChC;AAED;2DAC2D;AAC3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAQlE;AAED;yGACyG;AACzG,wBAAgB,IAAI,IAAI,SAAS,CAMhC"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAKL,KAAK,GAAG,EAET,MAAM,UAAU,CAAA;AAKjB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,kGAAkG;IAClG,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAChC;AAED;;sDAEsD;AACtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAelE;AAED;yGACyG;AACzG,wBAAgB,IAAI,IAAI,SAAS,CAMhC;AAED,+FAA+F;AAC/F,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;AAStF;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,GAAG,kBAAkB,EACxD,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAClB,IAAI,CAAC,EAAE,QAAQ,EACf,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACvC,GAAG,CAAC,OAAO,CAEb"}
package/dist/i18n.js CHANGED
@@ -5,13 +5,21 @@
5
5
  * negotiated catalog on the server, and the client rebuilds the same formatter on hydrate (no
6
6
  * mismatch). Imports only `solid-js` + `@nifrajs/i18n`; no JSX (`createComponent`).
7
7
  */
8
- import { createFormatter } from "@nifrajs/i18n";
8
+ import { createFormatter, } from "@nifrajs/i18n";
9
+ import { renderRich } from "@nifrajs/i18n/rich";
9
10
  import { createComponent, createContext, createMemo, useContext, } from "solid-js";
11
+ import { Dynamic } from "solid-js/web";
10
12
  const I18nContext = createContext();
11
- /** Provide a {@link Formatter} (built from `locale` + `messages`) to the subtree. Memoized on
12
- * `locale`/`messages`, so switching locale rebuilds it. */
13
+ /** Provide a {@link Formatter} (built from `locale` + `messages`, with the optional `fallback`,
14
+ * `onMissing`, `timeZone` and `numberingSystem` of `createFormatter`) to the subtree. Memoized
15
+ * on those props, so switching locale rebuilds it. */
13
16
  export function I18nProvider(props) {
14
- const formatter = createMemo(() => createFormatter(props.locale, props.messages));
17
+ const formatter = createMemo(() => createFormatter(props.locale, props.messages, {
18
+ fallback: props.fallback,
19
+ onMissing: props.onMissing,
20
+ timeZone: props.timeZone,
21
+ numberingSystem: props.numberingSystem,
22
+ }));
15
23
  return createComponent(I18nContext.Provider, {
16
24
  value: formatter,
17
25
  get children() {
@@ -19,7 +27,7 @@ export function I18nProvider(props) {
19
27
  },
20
28
  });
21
29
  }
22
- /** Read the current {@link Formatter} (`{ locale, t, n, d }`). Throws if no `<I18nProvider>` is above.
30
+ /** Read the current {@link Formatter} (`{ locale, t, get, n, d }`). Throws if no `<I18nProvider>` is above.
23
31
  * nifra switches locale by re-navigating, which re-runs the consuming component with the new catalog. */
24
32
  export function useT() {
25
33
  const formatter = useContext(I18nContext);
@@ -28,4 +36,19 @@ export function useT() {
28
36
  }
29
37
  return formatter();
30
38
  }
39
+ const join = (chunks) => chunks.length === 0 ? undefined : chunks.length === 1 ? chunks[0] : [...chunks];
40
+ const SOLID_RICH = {
41
+ join,
42
+ lineBreak: () => createComponent(Dynamic, { component: "br" }),
43
+ };
44
+ /**
45
+ * The message at `key` with its tags rendered by `tags`, as Solid nodes - no HTML, no `innerHTML`.
46
+ * `"Read the <link>terms</link>"` with `{ link: (content) => <a href="/terms">{content}</a> }`
47
+ * renders the link around "terms"; a tag with no handler renders its content as text, `<br/>` is a
48
+ * `<br>`, and interpolated values are always text. It runs once: wrap the call in a function
49
+ * (`{() => rich(t, key, tags, { n: count() })}`) to track signals in `vars`. See `@nifrajs/i18n/rich`.
50
+ */
51
+ export function rich(formatter, key, tags, vars) {
52
+ return renderRich(SOLID_RICH, formatter, key, tags, vars);
53
+ }
31
54
  //# sourceMappingURL=i18n.js.map
package/dist/i18n.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAiC,MAAM,eAAe,CAAA;AAC9E,OAAO,EAEL,eAAe,EACf,aAAa,EACb,UAAU,EAEV,UAAU,GACX,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,GAAG,aAAa,EAAuB,CAAA;AAQxD;2DAC2D;AAC3D,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACjF,OAAO,eAAe,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC3C,KAAK,EAAE,SAAS;QAChB,IAAI,QAAQ;YACV,OAAO,KAAK,CAAC,QAAQ,CAAA;QACvB,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;yGACyG;AACzG,MAAM,UAAU,IAAI;IAClB,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACzC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,SAAS,EAAE,CAAA;AACpB,CAAC"}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,eAAe,GAMhB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAsC,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACnF,OAAO,EAEL,eAAe,EACf,aAAa,EACb,UAAU,EAEV,UAAU,GACX,MAAM,UAAU,CAAA;AACjB,OA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AED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAClB,SAAuB,EACvB,GAAkB,EAClB,IAAe,EACf,IAAwC;IAExC,OAAO,UAAU,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAC3D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,10 @@
1
+ /**
2
+ * @nifrajs/web-solid - the Solid render adapter for @nifrajs/web (server side). Streaming SSR via
3
+ * `renderToStream` + `generateHydrationScript`; the layout-chain fold is in `./compose`. Client
4
+ * hydration lives in `@nifrajs/web-solid/client` (Solid's browser build), and the Solid Babel
5
+ * Bun-plugin in `@nifrajs/web-solid/plugin`.
6
+ */
1
7
  import type { RenderAdapter } from "@nifrajs/web";
2
- import type { BunPlugin } from "bun";
3
8
  /** The Solid server render adapter - pass to @nifrajs/web's `renderPage`. */
4
9
  export declare const solidAdapter: RenderAdapter;
5
- /**
6
- * Bun build/runtime plugin that compiles Solid components with Babel - `generate: "ssr"`
7
- * for the server, `"dom"` for the client, `hydratable` so SSR and hydrate align. Solid's
8
- * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at
9
- * build time, on `.tsx` files only.
10
- *
11
- * Under a dev server the client half additionally runs `solid-refresh`, which is what makes an edit
12
- * patch the running component tree instead of reloading the page - see {@link setupSolidRefresh}.
13
- */
14
- export declare function solidBunPlugin(generate: "dom" | "ssr"): BunPlugin;
15
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAWpC,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,aAsB1B,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CA0BjE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAUjD,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,aA2B1B,CAAA"}
package/dist/index.js CHANGED
@@ -1,18 +1,5 @@
1
- /**
2
- * @nifrajs/web-solid - the Solid render adapter for @nifrajs/web (server side) + the Solid Babel
3
- * Bun-plugin. Streaming SSR via `renderToStream` + `generateHydrationScript`; the layout-chain
4
- * fold is in `./compose`. Client hydration lives in `@nifrajs/web-solid/client` (Solid's browser
5
- * build).
6
- */
7
- import { transformAsync } from "@babel/core";
8
- // @ts-expect-error - no type declarations published
9
- import presetTypeScript from "@babel/preset-typescript";
10
- import { devServerCompile, normalizeFilePath, rewriteSsrImports } from "@nifrajs/web/plugins/kit";
11
- // @ts-expect-error - no type declarations published
12
- import presetSolid from "babel-preset-solid";
13
1
  import { generateHydrationScript, renderToStream as solidRenderToStream, renderToString as solidRenderToString, } from "solid-js/web";
14
2
  import { compose } from "./compose.js";
15
- import solidRefreshBunHot, { SOLID_HOT_MODULE } from "./refresh-babel.js";
16
3
  const HYDRATION_HEAD = generateHydrationScript();
17
4
  /** The Solid server render adapter - pass to @nifrajs/web's `renderPage`. */
18
5
  export const solidAdapter = {
@@ -24,93 +11,22 @@ export const solidAdapter = {
24
11
  renderToString(chain, props) {
25
12
  return solidRenderToString(compose(chain, props));
26
13
  },
27
- renderToStream(chain, props) {
14
+ renderToStream(chain, props, options) {
28
15
  // Solid's `renderToStream` streams `Uint8Array` chunks into a Web `WritableStream` via
29
16
  // `pipeTo` (fire-and-forget - returns void); pipe into a TransformStream and hand back the
30
17
  // readable side. Suspense boundaries stream as they resolve; `generateHydrationScript()` (in
31
18
  // <head>) seeds client hydration. A render failure errors `ts.readable`, which `renderPage`
32
- // surfaces on the response body.
19
+ // surfaces on the response body. The nonce reaches the resource and boundary scripts Solid streams.
33
20
  const ts = new TransformStream();
34
- solidRenderToStream(compose(chain, props)).pipeTo(ts.writable);
21
+ const app = compose(chain, props);
22
+ const stream = options?.nonce === undefined
23
+ ? solidRenderToStream(app)
24
+ : solidRenderToStream(app, { nonce: options.nonce });
25
+ stream.pipeTo(ts.writable);
35
26
  return ts.readable;
36
27
  },
37
28
  hydrationHead() {
38
29
  return HYDRATION_HEAD;
39
30
  },
40
31
  };
41
- /**
42
- * Bun build/runtime plugin that compiles Solid components with Babel - `generate: "ssr"`
43
- * for the server, `"dom"` for the client, `hydratable` so SSR and hydrate align. Solid's
44
- * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at
45
- * build time, on `.tsx` files only.
46
- *
47
- * Under a dev server the client half additionally runs `solid-refresh`, which is what makes an edit
48
- * patch the running component tree instead of reloading the page - see {@link setupSolidRefresh}.
49
- */
50
- export function solidBunPlugin(generate) {
51
- return {
52
- name: `nifra-solid-${generate}`,
53
- setup(build) {
54
- const refresh = generate === "dom" && devServerCompile() ? setupSolidRefresh(build) : undefined;
55
- // Match `.tsx`, tolerating a `?query` suffix (dev servers append one to bust Bun's import
56
- // cache); strip it before reading the file off disk.
57
- build.onLoad({ filter: /\.tsx(\?|$)/ }, async (args) => {
58
- const path = normalizeFilePath(args.path);
59
- const source = await Bun.file(path).text();
60
- const result = await transformAsync(source, {
61
- filename: path,
62
- // babel applies presets last→first: strip TS first, then Solid transforms JSX.
63
- presets: [
64
- [presetSolid, { generate, hydratable: true }],
65
- [presetTypeScript, { onlyRemoveTypeImports: true }],
66
- ],
67
- ...(refresh !== undefined
68
- ? { plugins: [[await refresh.babel(), REFRESH_OPTIONS], solidRefreshBunHot] }
69
- : {}),
70
- });
71
- return { contents: rewriteSsrImports(result?.code ?? "", path, generate), loader: "js" };
72
- });
73
- },
74
- };
75
- }
76
- /**
77
- * `"esm"` is the closest of `solid-refresh`'s bundler modes to what Bun implements: one
78
- * `accept(mod => …)` per module, falling back to `invalidate()` when a component's signature changed too
79
- * much to patch in place. `"vite"` differs only by also calling a bare `accept()` first, which would make
80
- * every module self-accepting twice over. The call it emits is still Vite-shaped, and
81
- * `solidRefreshBunHot` translates it.
82
- *
83
- * `jsx: false` turns OFF the pass that lifts a component's returned JSX into a second, nested component.
84
- * That extra component is an extra hydration level on the client and none on the server, so with it on,
85
- * every hydratable page dies on `Unable to find DOM nodes for hydration key` before a single edit. It buys
86
- * finer-grained patching of markup-only edits; correct hydration is worth more.
87
- */
88
- const REFRESH_OPTIONS = { bundler: "esm", jsx: false };
89
- /**
90
- * Wire `solid-refresh` into a dev-server client compile.
91
- *
92
- * Solid components are compiled reactive closures, not functions re-run on render, so a new module
93
- * version cannot simply replace the old one - `solid-refresh` wraps every component in a registry and, on
94
- * an update, patches the live instances, keeping signal state. Without it the update finds no accepting
95
- * module, bubbles up to the generated entry, and Bun reloads the whole page.
96
- *
97
- * The Babel half loads lazily: it is dev-only, and this module is the adapter root every Solid SSR
98
- * server imports.
99
- *
100
- * Both runtime specifiers need pinning, because the transform emits them INTO the app's own files, where
101
- * a bare specifier resolves against the app. `solid-refresh` is only a transitive dependency there and
102
- * need not be hoisted; `nifra:solid-hot` is this package's own bridge module and has no app-side name at
103
- * all. Resolving both here is what keeps the emitted imports working without an app depending on either.
104
- */
105
- function setupSolidRefresh(build) {
106
- const runtime = Bun.resolveSync("solid-refresh", import.meta.dir);
107
- build.onResolve({ filter: /^solid-refresh$/ }, () => ({ path: runtime }));
108
- // `.ts` from source (Bun takes the package's `bun` export condition), `.js` from the published build.
109
- const bridge = `${import.meta.dir}/refresh-hot${import.meta.path.endsWith(".ts") ? ".ts" : ".js"}`;
110
- build.onResolve({ filter: new RegExp(`^${SOLID_HOT_MODULE}$`) }, () => ({ path: bridge }));
111
- let babel;
112
- return {
113
- babel: () => (babel ??= import("solid-refresh/babel").then((m) => m.default)),
114
- };
115
- }
116
32
  //# sourceMappingURL=index.js.map
package/dist/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AAEtC,MAAM,cAAc,GAAG,uBAAuB,EAAE,CAAA;AAEhD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAkB;IACzC,gGAAgG;IAChG,mFAAmF;IACnF,4FAA4F;IAC5F,iGAAiG;IACjG,kEAAkE;IAClE,cAAc,CAAC,KAAK,EAAE,KAAK;QACzB,OAAO,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;IACnD,CAAC;IACD,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO;QAClC,uFAAuF;QACvF,2FAA2F;QAC3F,6FAA6F;QAC7F,4FAA4F;QAC5F,oGAAoG;QACpG,MAAM,EAAE,GAAG,IAAI,eAAe,EAA0B,CAAA;QACxD,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QACjC,MAAM,MAAM,GACV,OAAO,EAAE,KAAK,KAAK,SAAS;YAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC;YAC1B,CAAC,CAAC,mBAAmB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;QACxD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAA;QAC1B,OAAO,EAAE,CAAC,QAAQ,CAAA;IACpB,CAAC;IACD,aAAa;QACX,OAAO,cAAc,CAAA;IACvB,CAAC;CACF,CAAA"}
@@ -1,4 +1,11 @@
1
+ /**
2
+ * Solid MDX runtime - the `useMDXComponents` provider that `@nifrajs/web-solid/mdx`'s compiled MDX imports
3
+ * (via `@mdx-js`'s `providerImportSource`). MDX emits intrinsic elements (`h1`, `p`, …) as *string*
4
+ * component references, but Solid can't `createComponent("h1")` - its JSX is compile-time. So we map
5
+ * each Markdown-output tag to a Solid component that renders it via `<Dynamic component={tag}>`.
6
+ */
7
+ import { type JSX } from "solid-js";
1
8
  /** Returns the intrinsic-element → Solid-component map MDX content uses. Merge in your own overrides by
2
9
  * passing `components` to the MDX content component (they take precedence). */
3
- export declare function useMDXComponents(): Record<string, (props: Record<string, unknown>) => unknown>;
10
+ export declare function useMDXComponents(): Record<string, (props: Record<string, unknown>) => JSX.Element>;
4
11
  //# sourceMappingURL=mdx-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mdx-runtime.d.ts","sourceRoot":"","sources":["../src/mdx-runtime.ts"],"names":[],"mappings":"AAiDA;+EAC+E;AAC/E,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAE9F"}
1
+ {"version":3,"file":"mdx-runtime.d.ts","sourceRoot":"","sources":["../src/mdx-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAmB,KAAK,GAAG,EAAc,MAAM,UAAU,CAAA;AA6ChE;+EAC+E;AAC/E,wBAAgB,gBAAgB,IAAI,MAAM,CACxC,MAAM,EACN,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC,OAAO,CAChD,CAEA"}
@@ -4,7 +4,7 @@
4
4
  * component references, but Solid can't `createComponent("h1")` - its JSX is compile-time. So we map
5
5
  * each Markdown-output tag to a Solid component that renders it via `<Dynamic component={tag}>`.
6
6
  */
7
- import { createComponent } from "solid-js";
7
+ import { createComponent, mergeProps } from "solid-js";
8
8
  import { Dynamic } from "solid-js/web";
9
9
  // The HTML element set CommonMark + GFM produce. An explicit map (not a Proxy): `@mdx-js` *spreads* the
10
10
  // provider's result into a plain object, so only own-enumerable keys survive.
@@ -42,7 +42,9 @@ const MARKDOWN_TAGS = [
42
42
  ];
43
43
  const components = {};
44
44
  for (const tag of MARKDOWN_TAGS) {
45
- components[tag] = (props) => createComponent(Dynamic, Object.assign({ component: tag }, props));
45
+ // The tag merges last, so a `component` prop in the content cannot swap the element, and
46
+ // `mergeProps` keeps Solid's prop getters live where a plain copy would read them once.
47
+ components[tag] = (props) => createComponent(Dynamic, mergeProps(props, { component: tag }));
46
48
  }
47
49
  /** Returns the intrinsic-element → Solid-component map MDX content uses. Merge in your own overrides by
48
50
  * passing `components` to the MDX content component (they take precedence). */
@@ -1 +1 @@
1
- {"version":3,"file":"mdx-runtime.js","sourceRoot":"","sources":["../src/mdx-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,wGAAwG;AACxG,8EAA8E;AAC9E,MAAM,aAAa,GAAG;IACpB,GAAG;IACH,YAAY;IACZ,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,KAAK;IACL,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;CACI,CAAA;AAEV,MAAM,UAAU,GAAgE,EAAE,CAAA;AAClF,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IAChC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,CAAA;AACjG,CAAC;AAED;+EAC+E;AAC/E,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAA;AACnB,CAAC"}
1
+ {"version":3,"file":"mdx-runtime.js","sourceRoot":"","sources":["../src/mdx-runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAY,UAAU,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,wGAAwG;AACxG,8EAA8E;AAC9E,MAAM,aAAa,GAAG;IACpB,GAAG;IACH,YAAY;IACZ,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,KAAK;IACL,SAAS;IACT,MAAM;IACN,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;CACI,CAAA;AAEV,MAAM,UAAU,GAAoE,EAAE,CAAA;AACtF,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IAChC,yFAAyF;IACzF,wFAAwF;IACxF,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;AAC9F,CAAC;AAED;+EAC+E;AAC/E,MAAM,UAAU,gBAAgB;IAI9B,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { BunPlugin } from "bun";
2
+ /**
3
+ * Bun build/runtime plugin that compiles Solid components with Babel - `generate: "ssr"`
4
+ * for the server, `"dom"` for the client, `hydratable` so SSR and hydrate align. Solid's
5
+ * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at
6
+ * build time, on `.tsx` files only.
7
+ *
8
+ * Under a dev server the client half additionally runs `solid-refresh`, which is what makes an edit
9
+ * patch the running component tree instead of reloading the page - see {@link setupSolidRefresh}.
10
+ */
11
+ export declare function solidBunPlugin(generate: "dom" | "ssr"): BunPlugin;
12
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAGpC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CA0BjE"}
package/dist/plugin.js ADDED
@@ -0,0 +1,87 @@
1
+ /**
2
+ * `@nifrajs/web-solid/plugin` - the Solid Babel Bun plugin, in its OWN module so the adapter root (which
3
+ * every Solid SSR server and edge worker bundles) never links build-time code. Mirrors
4
+ * `@nifrajs/web-vue/plugin`: pass `"dom"` for the client bundle and `"ssr"` for the server.
5
+ */
6
+ import { transformAsync } from "@babel/core";
7
+ // @ts-expect-error - no type declarations published
8
+ import presetTypeScript from "@babel/preset-typescript";
9
+ import { devServerCompile, normalizeFilePath, rewriteSsrImports } from "@nifrajs/web/plugins/kit";
10
+ // @ts-expect-error - no type declarations published
11
+ import presetSolid from "babel-preset-solid";
12
+ import solidRefreshBunHot, { SOLID_HOT_MODULE } from "./refresh-babel.js";
13
+ /**
14
+ * Bun build/runtime plugin that compiles Solid components with Babel - `generate: "ssr"`
15
+ * for the server, `"dom"` for the client, `hydratable` so SSR and hydrate align. Solid's
16
+ * reactive-JSX compiler ships only as a Babel plugin (no swc/native port); this runs at
17
+ * build time, on `.tsx` files only.
18
+ *
19
+ * Under a dev server the client half additionally runs `solid-refresh`, which is what makes an edit
20
+ * patch the running component tree instead of reloading the page - see {@link setupSolidRefresh}.
21
+ */
22
+ export function solidBunPlugin(generate) {
23
+ return {
24
+ name: `nifra-solid-${generate}`,
25
+ setup(build) {
26
+ const refresh = generate === "dom" && devServerCompile() ? setupSolidRefresh(build) : undefined;
27
+ // Match `.tsx`, tolerating a `?query` suffix (dev servers append one to bust Bun's import
28
+ // cache); strip it before reading the file off disk.
29
+ build.onLoad({ filter: /\.tsx(\?|$)/ }, async (args) => {
30
+ const path = normalizeFilePath(args.path);
31
+ const source = await Bun.file(path).text();
32
+ const result = await transformAsync(source, {
33
+ filename: path,
34
+ // babel applies presets last→first: strip TS first, then Solid transforms JSX.
35
+ presets: [
36
+ [presetSolid, { generate, hydratable: true }],
37
+ [presetTypeScript, { onlyRemoveTypeImports: true }],
38
+ ],
39
+ ...(refresh !== undefined
40
+ ? { plugins: [[await refresh.babel(), REFRESH_OPTIONS], solidRefreshBunHot] }
41
+ : {}),
42
+ });
43
+ return { contents: rewriteSsrImports(result?.code ?? "", path, generate), loader: "js" };
44
+ });
45
+ },
46
+ };
47
+ }
48
+ /**
49
+ * `"esm"` is the closest of `solid-refresh`'s bundler modes to what Bun implements: one
50
+ * `accept(mod => …)` per module, falling back to `invalidate()` when a component's signature changed too
51
+ * much to patch in place. `"vite"` differs only by also calling a bare `accept()` first, which would make
52
+ * every module self-accepting twice over. The call it emits is still Vite-shaped, and
53
+ * `solidRefreshBunHot` translates it.
54
+ *
55
+ * `jsx: false` turns OFF the pass that lifts a component's returned JSX into a second, nested component.
56
+ * That extra component is an extra hydration level on the client and none on the server, so with it on,
57
+ * every hydratable page dies on `Unable to find DOM nodes for hydration key` before a single edit. It buys
58
+ * finer-grained patching of markup-only edits; correct hydration is worth more.
59
+ */
60
+ const REFRESH_OPTIONS = { bundler: "esm", jsx: false };
61
+ /**
62
+ * Wire `solid-refresh` into a dev-server client compile.
63
+ *
64
+ * Solid components are compiled reactive closures, not functions re-run on render, so a new module
65
+ * version cannot simply replace the old one - `solid-refresh` wraps every component in a registry and, on
66
+ * an update, patches the live instances, keeping signal state. Without it the update finds no accepting
67
+ * module, bubbles up to the generated entry, and Bun reloads the whole page.
68
+ *
69
+ * The Babel half loads lazily: it is dev-only, and every production build loads this plugin too.
70
+ *
71
+ * Both runtime specifiers need pinning, because the transform emits them INTO the app's own files, where
72
+ * a bare specifier resolves against the app. `solid-refresh` is only a transitive dependency there and
73
+ * need not be hoisted; `nifra:solid-hot` is this package's own bridge module and has no app-side name at
74
+ * all. Resolving both here is what keeps the emitted imports working without an app depending on either.
75
+ */
76
+ function setupSolidRefresh(build) {
77
+ const runtime = Bun.resolveSync("solid-refresh", import.meta.dir);
78
+ build.onResolve({ filter: /^solid-refresh$/ }, () => ({ path: runtime }));
79
+ // `.ts` from source (Bun takes the package's `bun` export condition), `.js` from the published build.
80
+ const bridge = `${import.meta.dir}/refresh-hot${import.meta.path.endsWith(".ts") ? ".ts" : ".js"}`;
81
+ build.onResolve({ filter: new RegExp(`^${SOLID_HOT_MODULE}$`) }, () => ({ path: bridge }));
82
+ let babel;
83
+ return {
84
+ babel: () => (babel ??= import("solid-refresh/babel").then((m) => m.default)),
85
+ };
86
+ }
87
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,oDAAoD;AACpD,OAAO,gBAAgB,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjG,oDAAoD;AACpD,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAE5C,OAAO,kBAAkB,EAAE,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAEzE;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,QAAuB;IACpD,OAAO;QACL,IAAI,EAAE,eAAe,QAAQ,EAAE;QAC/B,KAAK,CAAC,KAAK;YACT,MAAM,OAAO,GACX,QAAQ,KAAK,KAAK,IAAI,gBAAgB,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACjF,0FAA0F;YAC1F,qDAAqD;YACr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C,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IACzE,sGAAsG;IACtG,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;IAClG,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,gBAAgB,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAC1F,IAAI,KAAmC,CAAA;IACvC,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KAC9E,CAAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { MountRouterOptions, RenderProps, RouterState } from "@nifrajs/web";
2
+ /**
3
+ * The client half of the server's `RenderProps`, as getters so a settle re-renders only what reads the
4
+ * changed field. Cast: a getter always exists where `exactOptionalPropertyTypes` expects absence.
5
+ */
6
+ export declare function routeProps(snapshot: () => RouterState, searchSchemas: MountRouterOptions["searchSchemas"], matchChains?: MountRouterOptions["matchChains"]): RenderProps;
7
+ //# sourceMappingURL=route-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-props.d.ts","sourceRoot":"","sources":["../src/route-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAKhF;;;GAGG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,WAAW,EAC3B,aAAa,EAAE,kBAAkB,CAAC,eAAe,CAAC,EAClD,WAAW,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAC9C,WAAW,CAyCb"}