vike-lite-react 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PageContextProvider-DfE3nMiU.mjs → PageContextProvider-CTiW2Vsa.mjs} +2 -2
- package/dist/__internal/client/onRenderClient.mjs +1 -1
- package/dist/__internal/server/onRenderHtml.d.mts +1 -1
- package/dist/__internal/server/onRenderHtml.mjs +5 -4
- package/dist/{globalContext-6JEqyfKe.mjs → globalContext-CuAgMUAs.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as PageContextReactContext } from "./globalContext-
|
|
1
|
+
import { t as PageContextReactContext } from "./globalContext-CuAgMUAs.mjs";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/__internal/shared/PageContextProvider.tsx
|
|
4
4
|
function PageContextProvider({ value, children }) {
|
|
5
5
|
return /* @__PURE__ */ jsx(PageContextReactContext.Provider, {
|
|
6
6
|
value,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PageContextProvider } from "../../PageContextProvider-
|
|
1
|
+
import { t as PageContextProvider } from "../../PageContextProvider-CTiW2Vsa.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, stripBase } from "vike-lite/__internal/shared";
|
|
@@ -9,6 +9,6 @@ interface ReactRenderContext extends RenderContext {
|
|
|
9
9
|
}>;
|
|
10
10
|
hydration: boolean;
|
|
11
11
|
}
|
|
12
|
-
declare function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serializedContext, assets, hydration }: ReactRenderContext): string;
|
|
12
|
+
declare function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serializedContext, assets, hydration, nonce }: ReactRenderContext): string;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ReactRenderContext, onRenderHtml };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { t as PageContextProvider } from "../../PageContextProvider-
|
|
1
|
+
import { t as PageContextProvider } from "../../PageContextProvider-CTiW2Vsa.mjs";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { renderToString } from "react-dom/server";
|
|
4
4
|
//#region src/__internal/server/onRenderHtml.tsx
|
|
5
|
-
function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serializedContext, assets, hydration }) {
|
|
5
|
+
function onRenderHtml({ pageContext, Page, Head, Layout, pageTitleTag, serializedContext, assets, hydration, nonce }) {
|
|
6
6
|
const { cssLinks, jsPreloads, entryClient } = assets;
|
|
7
|
+
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
7
8
|
const providerValue = {
|
|
8
9
|
pageContext,
|
|
9
10
|
setPageContext: () => {}
|
|
@@ -20,14 +21,14 @@ ${Head ? renderToString(/* @__PURE__ */ jsx(PageContextProvider, {
|
|
|
20
21
|
value: providerValue,
|
|
21
22
|
children: /* @__PURE__ */ jsx(Head, {})
|
|
22
23
|
})) : ""}
|
|
23
|
-
<script>window.__PAGE_CONTEXT__=${serializedContext}<\/script>
|
|
24
|
+
<script${nonceAttr}>window.__PAGE_CONTEXT__=${serializedContext}<\/script>
|
|
24
25
|
</head>
|
|
25
26
|
<body>
|
|
26
27
|
<div id="root" tabindex="-1">${hydration ? renderToString(/* @__PURE__ */ jsx(PageContextProvider, {
|
|
27
28
|
value: providerValue,
|
|
28
29
|
children: Layout ? /* @__PURE__ */ jsx(Layout, { children: /* @__PURE__ */ jsx(Page, {}) }) : /* @__PURE__ */ jsx(Page, {})
|
|
29
30
|
})) : ""}</div>
|
|
30
|
-
<script type="module" src="${entryClient}"><\/script>
|
|
31
|
+
<script type="module" src="${entryClient}"${nonceAttr}><\/script>
|
|
31
32
|
</body>
|
|
32
33
|
</html>`;
|
|
33
34
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ declare function useHydrated(): boolean;
|
|
|
12
12
|
//#region src/hooks/useUrl.d.ts
|
|
13
13
|
declare function useUrl(): URL;
|
|
14
14
|
//#endregion
|
|
15
|
-
//#region src/
|
|
15
|
+
//#region src/shared/globalContext.d.ts
|
|
16
16
|
interface PageContextValue {
|
|
17
17
|
pageContext: PageContextClient;
|
|
18
18
|
setPageContext: (updater: (prev: PageContextClient) => PageContextClient) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PageContextReactContext } from "./globalContext-
|
|
1
|
+
import { t as PageContextReactContext } from "./globalContext-CuAgMUAs.mjs";
|
|
2
2
|
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
3
3
|
//#region src/hooks/useData.tsx
|
|
4
4
|
function useData() {
|