vite-react-ssg 0.5.2 → 0.6.1
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 +40 -38
- package/dist/client/single-page.cjs +82 -0
- package/dist/client/single-page.d.cts +11 -0
- package/dist/client/single-page.d.mts +11 -0
- package/dist/client/single-page.d.ts +11 -0
- package/dist/client/single-page.mjs +75 -0
- package/dist/index.cjs +17 -44
- package/dist/index.d.cts +6 -16
- package/dist/index.d.mts +6 -16
- package/dist/index.d.ts +6 -16
- package/dist/index.mjs +16 -43
- package/dist/node/cli.cjs +3 -16
- package/dist/node/cli.mjs +3 -16
- package/dist/node.cjs +184 -27707
- package/dist/node.d.cts +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +197 -27707
- package/dist/shared/vite-react-ssg.a009fbf1.mjs +34 -0
- package/dist/shared/vite-react-ssg.a292c181.mjs +42 -0
- package/dist/shared/vite-react-ssg.c1d49976.cjs +50 -0
- package/dist/shared/{vite-react-ssg.4d8d5138.d.cts → vite-react-ssg.d734eb79.d.cts} +5 -8
- package/dist/shared/{vite-react-ssg.4d8d5138.d.mts → vite-react-ssg.d734eb79.d.mts} +5 -8
- package/dist/shared/{vite-react-ssg.4d8d5138.d.ts → vite-react-ssg.d734eb79.d.ts} +5 -8
- package/dist/shared/{vite-react-ssg.9d005d5e.mjs → vite-react-ssg.e6991406.cjs} +3 -11
- package/dist/shared/vite-react-ssg.faf3855a.d.cts +15 -0
- package/dist/shared/vite-react-ssg.faf3855a.d.mts +15 -0
- package/dist/shared/vite-react-ssg.faf3855a.d.ts +15 -0
- package/package.json +22 -10
- package/dist/shared/vite-react-ssg.4ca822c0.cjs +0 -54
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
|
|
2
|
+
const ESCAPED_CHARS = {
|
|
3
|
+
"<": "\\u003C",
|
|
4
|
+
">": "\\u003E",
|
|
5
|
+
"/": "\\u002F",
|
|
6
|
+
"\u2028": "\\u2028",
|
|
7
|
+
"\u2029": "\\u2029"
|
|
8
|
+
};
|
|
9
|
+
function escapeUnsafeChars(unsafeChar) {
|
|
10
|
+
return ESCAPED_CHARS[unsafeChar];
|
|
11
|
+
}
|
|
12
|
+
function serializeState(state) {
|
|
13
|
+
if (state == null || Object.keys(state).length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
try {
|
|
16
|
+
return JSON.stringify(JSON.stringify(state || {})).replace(
|
|
17
|
+
UNSAFE_CHARS_REGEXP,
|
|
18
|
+
escapeUnsafeChars
|
|
19
|
+
);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("[SSG] On state serialization -", error, state);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function deserializeState(state) {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(state || "{}");
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error("[SSG] On state deserialization -", error, state);
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { deserializeState as d, serializeState as s };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useState, useEffect, isValidElement } from 'react';
|
|
2
|
+
import { Helmet } from 'react-helmet-async';
|
|
3
|
+
|
|
4
|
+
function documentReady(_passThrough) {
|
|
5
|
+
if (document.readyState === "loading") {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
document.addEventListener("DOMContentLoaded", () => resolve(_passThrough));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return Promise.resolve(_passThrough);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function Head(props) {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Helmet, { ...props });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function useIsClient() {
|
|
18
|
+
const [isBrowser, setIsBrowser] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setIsBrowser(true);
|
|
21
|
+
}, []);
|
|
22
|
+
return isBrowser;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function ClientOnly({
|
|
26
|
+
children,
|
|
27
|
+
fallback
|
|
28
|
+
}) {
|
|
29
|
+
const isBrowser = useIsClient();
|
|
30
|
+
if (isBrowser) {
|
|
31
|
+
if (typeof children !== "function" && process.env.NODE_ENV === "development") {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
|
|
34
|
+
Current type: ${isValidElement(children) ? "React element" : typeof children}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children?.());
|
|
38
|
+
}
|
|
39
|
+
return fallback ?? null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { ClientOnly as C, Head as H, documentReady as d };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const React = require('react');
|
|
4
|
+
const reactHelmetAsync = require('react-helmet-async');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
7
|
+
|
|
8
|
+
const React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
|
+
|
|
10
|
+
function documentReady(_passThrough) {
|
|
11
|
+
if (document.readyState === "loading") {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
document.addEventListener("DOMContentLoaded", () => resolve(_passThrough));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return Promise.resolve(_passThrough);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function Head(props) {
|
|
20
|
+
return /* @__PURE__ */ React__default.createElement(reactHelmetAsync.Helmet, { ...props });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function useIsClient() {
|
|
24
|
+
const [isBrowser, setIsBrowser] = React.useState(false);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
setIsBrowser(true);
|
|
27
|
+
}, []);
|
|
28
|
+
return isBrowser;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ClientOnly({
|
|
32
|
+
children,
|
|
33
|
+
fallback
|
|
34
|
+
}) {
|
|
35
|
+
const isBrowser = useIsClient();
|
|
36
|
+
if (isBrowser) {
|
|
37
|
+
if (typeof children !== "function" && process.env.NODE_ENV === "development") {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
|
|
40
|
+
Current type: ${React.isValidElement(children) ? "React element" : typeof children}`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children?.());
|
|
44
|
+
}
|
|
45
|
+
return fallback ?? null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.ClientOnly = ClientOnly;
|
|
49
|
+
exports.Head = Head;
|
|
50
|
+
exports.documentReady = documentReady;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Options } from 'critters';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
@@ -107,7 +107,7 @@ interface ViteReactSSGOptions {
|
|
|
107
107
|
interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
108
108
|
router?: HasRouter extends true ? Router : undefined;
|
|
109
109
|
routes: HasRouter extends true ? Readonly<RouteRecord[]> : undefined;
|
|
110
|
-
routerOptions: RouterOptions;
|
|
110
|
+
routerOptions: HasRouter extends true ? RouterOptions : undefined;
|
|
111
111
|
initialState: Record<string, any>;
|
|
112
112
|
isClient: boolean;
|
|
113
113
|
onSSRAppRendered(cb: Function): void;
|
|
@@ -119,6 +119,7 @@ interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
|
119
119
|
routePath?: string;
|
|
120
120
|
base: string;
|
|
121
121
|
getStyleCollector: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
122
|
+
app?: HasRouter extends true ? never : ReactNode;
|
|
122
123
|
}
|
|
123
124
|
interface ViteReactSSGClientOptions {
|
|
124
125
|
transformState?: (state: any) => any;
|
|
@@ -130,11 +131,7 @@ interface ViteReactSSGClientOptions {
|
|
|
130
131
|
*/
|
|
131
132
|
rootContainer?: string | Element;
|
|
132
133
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* If false, the 'dev' script in 'package.json' needs to be set to `"vite"`.
|
|
136
|
-
*
|
|
137
|
-
* @default true
|
|
134
|
+
* @deprecated This option is no longer needed
|
|
138
135
|
*/
|
|
139
136
|
ssrWhenDev?: boolean;
|
|
140
137
|
getStyleCollector?: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
@@ -177,4 +174,4 @@ declare module 'vite' {
|
|
|
177
174
|
}
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
export type { IndexRouteRecord as I, NonIndexRouteRecord as N,
|
|
177
|
+
export type { IndexRouteRecord as I, NonIndexRouteRecord as N, RouteRecord as R, StyleCollector as S, ViteReactSSGContext as V, ViteReactSSGClientOptions as a, ViteReactSSGOptions as b, RouterOptions as c };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Options } from 'critters';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
@@ -107,7 +107,7 @@ interface ViteReactSSGOptions {
|
|
|
107
107
|
interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
108
108
|
router?: HasRouter extends true ? Router : undefined;
|
|
109
109
|
routes: HasRouter extends true ? Readonly<RouteRecord[]> : undefined;
|
|
110
|
-
routerOptions: RouterOptions;
|
|
110
|
+
routerOptions: HasRouter extends true ? RouterOptions : undefined;
|
|
111
111
|
initialState: Record<string, any>;
|
|
112
112
|
isClient: boolean;
|
|
113
113
|
onSSRAppRendered(cb: Function): void;
|
|
@@ -119,6 +119,7 @@ interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
|
119
119
|
routePath?: string;
|
|
120
120
|
base: string;
|
|
121
121
|
getStyleCollector: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
122
|
+
app?: HasRouter extends true ? never : ReactNode;
|
|
122
123
|
}
|
|
123
124
|
interface ViteReactSSGClientOptions {
|
|
124
125
|
transformState?: (state: any) => any;
|
|
@@ -130,11 +131,7 @@ interface ViteReactSSGClientOptions {
|
|
|
130
131
|
*/
|
|
131
132
|
rootContainer?: string | Element;
|
|
132
133
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* If false, the 'dev' script in 'package.json' needs to be set to `"vite"`.
|
|
136
|
-
*
|
|
137
|
-
* @default true
|
|
134
|
+
* @deprecated This option is no longer needed
|
|
138
135
|
*/
|
|
139
136
|
ssrWhenDev?: boolean;
|
|
140
137
|
getStyleCollector?: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
@@ -177,4 +174,4 @@ declare module 'vite' {
|
|
|
177
174
|
}
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
export type { IndexRouteRecord as I, NonIndexRouteRecord as N,
|
|
177
|
+
export type { IndexRouteRecord as I, NonIndexRouteRecord as N, RouteRecord as R, StyleCollector as S, ViteReactSSGContext as V, ViteReactSSGClientOptions as a, ViteReactSSGOptions as b, RouterOptions as c };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Options } from 'critters';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
@@ -107,7 +107,7 @@ interface ViteReactSSGOptions {
|
|
|
107
107
|
interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
108
108
|
router?: HasRouter extends true ? Router : undefined;
|
|
109
109
|
routes: HasRouter extends true ? Readonly<RouteRecord[]> : undefined;
|
|
110
|
-
routerOptions: RouterOptions;
|
|
110
|
+
routerOptions: HasRouter extends true ? RouterOptions : undefined;
|
|
111
111
|
initialState: Record<string, any>;
|
|
112
112
|
isClient: boolean;
|
|
113
113
|
onSSRAppRendered(cb: Function): void;
|
|
@@ -119,6 +119,7 @@ interface ViteReactSSGContext<HasRouter extends boolean = true> {
|
|
|
119
119
|
routePath?: string;
|
|
120
120
|
base: string;
|
|
121
121
|
getStyleCollector: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
122
|
+
app?: HasRouter extends true ? never : ReactNode;
|
|
122
123
|
}
|
|
123
124
|
interface ViteReactSSGClientOptions {
|
|
124
125
|
transformState?: (state: any) => any;
|
|
@@ -130,11 +131,7 @@ interface ViteReactSSGClientOptions {
|
|
|
130
131
|
*/
|
|
131
132
|
rootContainer?: string | Element;
|
|
132
133
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* If false, the 'dev' script in 'package.json' needs to be set to `"vite"`.
|
|
136
|
-
*
|
|
137
|
-
* @default true
|
|
134
|
+
* @deprecated This option is no longer needed
|
|
138
135
|
*/
|
|
139
136
|
ssrWhenDev?: boolean;
|
|
140
137
|
getStyleCollector?: (() => StyleCollector | Promise<StyleCollector>) | null;
|
|
@@ -177,4 +174,4 @@ declare module 'vite' {
|
|
|
177
174
|
}
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
export type { IndexRouteRecord as I, NonIndexRouteRecord as N,
|
|
177
|
+
export type { IndexRouteRecord as I, NonIndexRouteRecord as N, RouteRecord as R, StyleCollector as S, ViteReactSSGContext as V, ViteReactSSGClientOptions as a, ViteReactSSGOptions as b, RouterOptions as c };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Helmet } from 'react-helmet-async';
|
|
1
|
+
'use strict';
|
|
3
2
|
|
|
4
3
|
const UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
|
|
5
4
|
const ESCAPED_CHARS = {
|
|
@@ -34,12 +33,5 @@ function deserializeState(state) {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function SiteMetadataDefaults() {
|
|
42
|
-
return /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("html", null), /* @__PURE__ */ React.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { Head as H, SiteMetadataDefaults as S, deserializeState as d, serializeState as s };
|
|
36
|
+
exports.deserializeState = deserializeState;
|
|
37
|
+
exports.serializeState = serializeState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HelmetProps } from 'react-helmet-async';
|
|
3
|
+
|
|
4
|
+
type Props = HelmetProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function Head(props: Props): JSX.Element;
|
|
8
|
+
|
|
9
|
+
interface ClientOnlyProps {
|
|
10
|
+
children?: () => JSX.Element;
|
|
11
|
+
fallback?: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { ClientOnly as C, Head as H };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HelmetProps } from 'react-helmet-async';
|
|
3
|
+
|
|
4
|
+
type Props = HelmetProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function Head(props: Props): JSX.Element;
|
|
8
|
+
|
|
9
|
+
interface ClientOnlyProps {
|
|
10
|
+
children?: () => JSX.Element;
|
|
11
|
+
fallback?: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { ClientOnly as C, Head as H };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { HelmetProps } from 'react-helmet-async';
|
|
3
|
+
|
|
4
|
+
type Props = HelmetProps & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function Head(props: Props): JSX.Element;
|
|
8
|
+
|
|
9
|
+
interface ClientOnlyProps {
|
|
10
|
+
children?: () => JSX.Element;
|
|
11
|
+
fallback?: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { ClientOnly as C, Head as H };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-react-ssg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"packageManager": "pnpm@8.6.6",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "Riri <Daydreamerriri@outlook.com>",
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
"import": "./dist/node.mjs",
|
|
32
32
|
"require": "./dist/node.cjs"
|
|
33
33
|
},
|
|
34
|
+
"./single-page": {
|
|
35
|
+
"types": "./dist/client/single-page.d.ts",
|
|
36
|
+
"import": "./dist/client/single-page.mjs",
|
|
37
|
+
"require": "./dist/client/single-page.cjs"
|
|
38
|
+
},
|
|
34
39
|
"./style-collectors/styled-components": {
|
|
35
40
|
"types": "./dist/style-collectors/styled-components.d.ts",
|
|
36
41
|
"import": "./dist/style-collectors/styled-components.mjs",
|
|
@@ -45,6 +50,9 @@
|
|
|
45
50
|
"node": [
|
|
46
51
|
"./dist/node.d.ts"
|
|
47
52
|
],
|
|
53
|
+
"single-page": [
|
|
54
|
+
"dist/client/single-page.d.ts"
|
|
55
|
+
],
|
|
48
56
|
"style-collectors/styled-components": [
|
|
49
57
|
"./dist/style-collectors/styled-components.d.ts"
|
|
50
58
|
]
|
|
@@ -69,6 +77,7 @@
|
|
|
69
77
|
"typecheck": "tsc --noEmit"
|
|
70
78
|
},
|
|
71
79
|
"peerDependencies": {
|
|
80
|
+
"@childrentime/devcert": "*",
|
|
72
81
|
"critters": "^0.0.19",
|
|
73
82
|
"react": "^18.0.0",
|
|
74
83
|
"react-dom": "^18.0.0",
|
|
@@ -77,6 +86,9 @@
|
|
|
77
86
|
"vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
|
|
78
87
|
},
|
|
79
88
|
"peerDependenciesMeta": {
|
|
89
|
+
"@childrentime/devcert": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
80
92
|
"critters": {
|
|
81
93
|
"optional": true
|
|
82
94
|
},
|
|
@@ -93,15 +105,15 @@
|
|
|
93
105
|
"fs-extra": "^11.2.0",
|
|
94
106
|
"html-minifier": "^4.0.0",
|
|
95
107
|
"html5parser": "^2.0.2",
|
|
96
|
-
"jsdom": "^
|
|
108
|
+
"jsdom": "^24.0.0",
|
|
97
109
|
"kolorist": "^1.8.0",
|
|
98
|
-
"prettier": "^3.
|
|
110
|
+
"prettier": "^3.2.4",
|
|
99
111
|
"react-helmet-async": "^1.3.0",
|
|
100
112
|
"yargs": "^17.7.2"
|
|
101
113
|
},
|
|
102
114
|
"devDependencies": {
|
|
103
115
|
"@childrentime/devcert": "^1.2.5",
|
|
104
|
-
"@ririd/eslint-config": "^1.0.
|
|
116
|
+
"@ririd/eslint-config": "^1.0.4",
|
|
105
117
|
"@types/express": "^4.17.17",
|
|
106
118
|
"@types/fs-extra": "^11.0.1",
|
|
107
119
|
"@types/html-minifier": "^4.0.2",
|
|
@@ -110,12 +122,12 @@
|
|
|
110
122
|
"@types/react": "^18.2.14",
|
|
111
123
|
"@types/react-dom": "^18.2.6",
|
|
112
124
|
"@types/yargs": "^17.0.24",
|
|
113
|
-
"bumpp": "^9.
|
|
114
|
-
"critters": "^0.0.
|
|
125
|
+
"bumpp": "^9.4.0",
|
|
126
|
+
"critters": "^0.0.22",
|
|
115
127
|
"eslint": "^8.56.0",
|
|
116
|
-
"esno": "^4.
|
|
117
|
-
"fast-glob": "3.3.
|
|
118
|
-
"p-queue": "^8.0.
|
|
128
|
+
"esno": "^4.7.0",
|
|
129
|
+
"fast-glob": "3.3.2",
|
|
130
|
+
"p-queue": "^8.0.1",
|
|
119
131
|
"react": "^18.2.0",
|
|
120
132
|
"react-dom": "^18.2.0",
|
|
121
133
|
"react-router-dom": "^6.15.0",
|
|
@@ -123,7 +135,7 @@
|
|
|
123
135
|
"styled-components": "6.0.5",
|
|
124
136
|
"typescript": "5.1.6",
|
|
125
137
|
"unbuild": "^2.0.0",
|
|
126
|
-
"vite": "^5.0.
|
|
138
|
+
"vite": "^5.0.12",
|
|
127
139
|
"vite-plugin-pwa": "^0.17.4",
|
|
128
140
|
"vitest": "1.0.4"
|
|
129
141
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const React = require('react');
|
|
4
|
-
const reactHelmetAsync = require('react-helmet-async');
|
|
5
|
-
|
|
6
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
7
|
-
|
|
8
|
-
const React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
9
|
-
|
|
10
|
-
const UNSAFE_CHARS_REGEXP = /[<>\/\u2028\u2029]/g;
|
|
11
|
-
const ESCAPED_CHARS = {
|
|
12
|
-
"<": "\\u003C",
|
|
13
|
-
">": "\\u003E",
|
|
14
|
-
"/": "\\u002F",
|
|
15
|
-
"\u2028": "\\u2028",
|
|
16
|
-
"\u2029": "\\u2029"
|
|
17
|
-
};
|
|
18
|
-
function escapeUnsafeChars(unsafeChar) {
|
|
19
|
-
return ESCAPED_CHARS[unsafeChar];
|
|
20
|
-
}
|
|
21
|
-
function serializeState(state) {
|
|
22
|
-
if (state == null || Object.keys(state).length === 0)
|
|
23
|
-
return null;
|
|
24
|
-
try {
|
|
25
|
-
return JSON.stringify(JSON.stringify(state || {})).replace(
|
|
26
|
-
UNSAFE_CHARS_REGEXP,
|
|
27
|
-
escapeUnsafeChars
|
|
28
|
-
);
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error("[SSG] On state serialization -", error, state);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function deserializeState(state) {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(state || "{}");
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error("[SSG] On state deserialization -", error, state);
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function Head(props) {
|
|
44
|
-
return /* @__PURE__ */ React__default.createElement(reactHelmetAsync.Helmet, { ...props });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function SiteMetadataDefaults() {
|
|
48
|
-
return /* @__PURE__ */ React__default.createElement(Head, null, /* @__PURE__ */ React__default.createElement("html", null), /* @__PURE__ */ React__default.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.Head = Head;
|
|
52
|
-
exports.SiteMetadataDefaults = SiteMetadataDefaults;
|
|
53
|
-
exports.deserializeState = deserializeState;
|
|
54
|
-
exports.serializeState = serializeState;
|