vite-react-ssg 0.6.0 → 0.6.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.
@@ -110,9 +110,9 @@ interface ViteReactSSGContext<HasRouter extends boolean = true> {
110
110
  routerOptions: HasRouter extends true ? RouterOptions : undefined;
111
111
  initialState: Record<string, any>;
112
112
  isClient: boolean;
113
- onSSRAppRendered(cb: Function): void;
114
- triggerOnSSRAppRendered(route: string, appHTML: string, appCtx: ViteReactSSGContext): Promise<unknown[]>;
115
- transformState?(state: any): any;
113
+ onSSRAppRendered: (cb: Function) => void;
114
+ triggerOnSSRAppRendered: (route: string, appHTML: string, appCtx: ViteReactSSGContext) => Promise<unknown[]>;
115
+ transformState?: (state: any) => any;
116
116
  /**
117
117
  * Current router path on SSG, `undefined` on client side.
118
118
  */
@@ -110,9 +110,9 @@ interface ViteReactSSGContext<HasRouter extends boolean = true> {
110
110
  routerOptions: HasRouter extends true ? RouterOptions : undefined;
111
111
  initialState: Record<string, any>;
112
112
  isClient: boolean;
113
- onSSRAppRendered(cb: Function): void;
114
- triggerOnSSRAppRendered(route: string, appHTML: string, appCtx: ViteReactSSGContext): Promise<unknown[]>;
115
- transformState?(state: any): any;
113
+ onSSRAppRendered: (cb: Function) => void;
114
+ triggerOnSSRAppRendered: (route: string, appHTML: string, appCtx: ViteReactSSGContext) => Promise<unknown[]>;
115
+ transformState?: (state: any) => any;
116
116
  /**
117
117
  * Current router path on SSG, `undefined` on client side.
118
118
  */
@@ -29,8 +29,10 @@ function ClientOnly({
29
29
  const isBrowser = useIsClient();
30
30
  if (isBrowser) {
31
31
  if (typeof children !== "function" && process.env.NODE_ENV === "development") {
32
- throw new Error(`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
33
- Current type: ${isValidElement(children) ? "React element" : typeof children}`);
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
+ );
34
36
  }
35
37
  return /* @__PURE__ */ React.createElement(React.Fragment, null, children?.());
36
38
  }
@@ -35,8 +35,10 @@ function ClientOnly({
35
35
  const isBrowser = useIsClient();
36
36
  if (isBrowser) {
37
37
  if (typeof children !== "function" && process.env.NODE_ENV === "development") {
38
- throw new Error(`vite-react-ssg error: The children of <ClientOnly> must be a "render function", e.g. <ClientOnly>{() => <span>{window.location.href}</span>}</ClientOnly>.
39
- Current type: ${React.isValidElement(children) ? "React element" : typeof children}`);
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
+ );
40
42
  }
41
43
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children?.());
42
44
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-react-ssg",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.6.2",
5
5
  "packageManager": "pnpm@8.6.6",
6
6
  "description": "",
7
7
  "author": "Riri <Daydreamerriri@outlook.com>",
@@ -79,6 +79,7 @@
79
79
  "peerDependencies": {
80
80
  "@childrentime/devcert": "*",
81
81
  "critters": "^0.0.19",
82
+ "prettier": "*",
82
83
  "react": "^18.0.0",
83
84
  "react-dom": "^18.0.0",
84
85
  "react-router-dom": "^6.14.1",
@@ -92,6 +93,9 @@
92
93
  "critters": {
93
94
  "optional": true
94
95
  },
96
+ "prettier": {
97
+ "optional": true
98
+ },
95
99
  "react-router-dom": {
96
100
  "optional": true
97
101
  },
@@ -101,20 +105,17 @@
101
105
  },
102
106
  "dependencies": {
103
107
  "@remix-run/web-fetch": "^4.4.2",
104
- "express": "^4.18.2",
105
108
  "fs-extra": "^11.2.0",
106
109
  "html-minifier": "^4.0.0",
107
110
  "html5parser": "^2.0.2",
108
- "jsdom": "^23.0.1",
111
+ "jsdom": "^24.0.0",
109
112
  "kolorist": "^1.8.0",
110
- "prettier": "^3.0.0",
111
113
  "react-helmet-async": "^1.3.0",
112
114
  "yargs": "^17.7.2"
113
115
  },
114
116
  "devDependencies": {
115
117
  "@childrentime/devcert": "^1.2.5",
116
- "@ririd/eslint-config": "^1.0.0",
117
- "@types/express": "^4.17.17",
118
+ "@ririd/eslint-config": "^1.1.0",
118
119
  "@types/fs-extra": "^11.0.1",
119
120
  "@types/html-minifier": "^4.0.2",
120
121
  "@types/jsdom": "^21.1.1",
@@ -122,12 +123,13 @@
122
123
  "@types/react": "^18.2.14",
123
124
  "@types/react-dom": "^18.2.6",
124
125
  "@types/yargs": "^17.0.24",
125
- "bumpp": "^9.1.0",
126
- "critters": "^0.0.20",
126
+ "bumpp": "^9.4.0",
127
+ "critters": "^0.0.22",
127
128
  "eslint": "^8.56.0",
128
- "esno": "^4.0.0",
129
- "fast-glob": "3.3.1",
130
- "p-queue": "^8.0.0",
129
+ "esno": "^4.7.0",
130
+ "fast-glob": "3.3.2",
131
+ "p-queue": "^8.0.1",
132
+ "prettier": "^3.2.4",
131
133
  "react": "^18.2.0",
132
134
  "react-dom": "^18.2.0",
133
135
  "react-router-dom": "^6.15.0",
@@ -135,7 +137,7 @@
135
137
  "styled-components": "6.0.5",
136
138
  "typescript": "5.1.6",
137
139
  "unbuild": "^2.0.0",
138
- "vite": "^5.0.7",
140
+ "vite": "^5.0.12",
139
141
  "vite-plugin-pwa": "^0.17.4",
140
142
  "vitest": "1.0.4"
141
143
  }