vike-lite-react 1.0.4 → 1.0.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.
@@ -1,9 +1,11 @@
1
1
  import { t as PageContextReactContext } from "./globalContext-BIY5-Fdk.mjs";
2
+ import { jsx } from "react/jsx-runtime";
2
3
  //#region src/hooks/PageContextProvider.tsx
3
4
  function PageContextProvider({ value, children }) {
4
- return <PageContextReactContext.Provider value={value}>
5
- {children}
6
- </PageContextReactContext.Provider>;
5
+ return /* @__PURE__ */ jsx(PageContextReactContext.Provider, {
6
+ value,
7
+ children
8
+ });
7
9
  }
8
10
  //#endregion
9
11
  export { PageContextProvider as t };
@@ -1,8 +1,9 @@
1
- import { t as PageContextProvider } from "../../PageContextProvider-Dec19bRR.mjs";
1
+ import { t as PageContextProvider } from "../../PageContextProvider-C21BRCMp.mjs";
2
2
  import { Component, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { createRoot, hydrateRoot } from "react-dom/client";
4
4
  import { matchRoute } from "vike-lite/__internal/shared";
5
5
  import { hydration } from "virtual:vike-lite/config";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
6
7
  //#region src/__internal/shared/stripBase.ts
7
8
  function stripBase(pathname) {
8
9
  const { BASE_URL } = import.meta.env;
@@ -18,7 +19,7 @@ var RootErrorBoundary = class extends Component {
18
19
  }
19
20
  state = { error: null };
20
21
  render() {
21
- if (this.state.error) return <div>Error: {this.state.error.message}</div>;
22
+ if (this.state.error) return /* @__PURE__ */ jsxs("div", { children: ["Error: ", this.state.error.message] });
22
23
  return this.props.children;
23
24
  }
24
25
  };
@@ -249,15 +250,13 @@ function RouterApp(props) {
249
250
  reloadTick
250
251
  ]);
251
252
  const { Page, Layout } = view;
252
- const contextValue = useMemo(() => ({
253
- pageContext,
254
- setPageContext
255
- }), [pageContext, setPageContext]);
256
- return <RootErrorBoundary>
257
- <PageContextProvider value={contextValue}>
258
- {Layout ? <Layout><Page /></Layout> : <Page />}
259
- </PageContextProvider>
260
- </RootErrorBoundary>;
253
+ return /* @__PURE__ */ jsx(RootErrorBoundary, { children: /* @__PURE__ */ jsx(PageContextProvider, {
254
+ value: useMemo(() => ({
255
+ pageContext,
256
+ setPageContext
257
+ }), [pageContext, setPageContext]),
258
+ children: Layout ? /* @__PURE__ */ jsx(Layout, { children: /* @__PURE__ */ jsx(Page, {}) }) : /* @__PURE__ */ jsx(Page, {})
259
+ }) });
261
260
  }
262
261
  async function onRenderClient(clientOptions) {
263
262
  const container = document.querySelector("#root");
@@ -288,7 +287,12 @@ async function onRenderClient(clientOptions) {
288
287
  };
289
288
  }
290
289
  }
291
- const app = <RouterApp {...clientOptions} initialView={initialView} initialContext={initialContext} initialUrl={globalThis.location.href} />;
290
+ const app = /* @__PURE__ */ jsx(RouterApp, {
291
+ ...clientOptions,
292
+ initialView,
293
+ initialContext,
294
+ initialUrl: globalThis.location.href
295
+ });
292
296
  if (isHydration) hydrateRoot(container, app);
293
297
  else {
294
298
  container.replaceChildren();
@@ -1,5 +1,6 @@
1
- import { t as PageContextProvider } from "../../PageContextProvider-Dec19bRR.mjs";
1
+ import { t as PageContextProvider } from "../../PageContextProvider-C21BRCMp.mjs";
2
2
  import { hydration } from "virtual:vike-lite/config";
3
+ import { jsx } from "react/jsx-runtime";
3
4
  import { renderToString } from "react-dom/server";
4
5
  //#region src/__internal/server/onRenderHtml.tsx
5
6
  function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serializedContext, assets }) {
@@ -16,15 +17,17 @@ function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serialize
16
17
  ${pageTitleTag}
17
18
  ${cssLinks}
18
19
  ${jsPreloads}
19
- ${Head ? renderToString(<PageContextProvider value={providerValue}>
20
- <Head />
21
- </PageContextProvider>) : ""}
20
+ ${Head ? renderToString(/* @__PURE__ */ jsx(PageContextProvider, {
21
+ value: providerValue,
22
+ children: /* @__PURE__ */ jsx(Head, {})
23
+ })) : ""}
22
24
  <script>window.__PAGE_CONTEXT__=${serializedContext}<\/script>
23
25
  </head>
24
26
  <body>
25
- <div id="root" tabindex="-1">${hydration ? renderToString(<PageContextProvider value={providerValue}>
26
- {Layout ? <Layout><Page /></Layout> : <Page />}
27
- </PageContextProvider>) : ""}</div>
27
+ <div id="root" tabindex="-1">${hydration ? renderToString(/* @__PURE__ */ jsx(PageContextProvider, {
28
+ value: providerValue,
29
+ children: Layout ? /* @__PURE__ */ jsx(Layout, { children: /* @__PURE__ */ jsx(Page, {}) }) : /* @__PURE__ */ jsx(Page, {})
30
+ })) : ""}</div>
28
31
  <script type="module" src="${entryClient}"><\/script>
29
32
  </body>
30
33
  </html>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-lite-react",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,7 +63,7 @@
63
63
  "react": "^19.2.7",
64
64
  "react-dom": "^19.2.7",
65
65
  "tsdown": "^0.22.8",
66
- "vike-lite": "1.15.4",
66
+ "vike-lite": "1.15.5",
67
67
  "vite": "^8.1.4"
68
68
  },
69
69
  "peerDependencies": {