vite-react-ssg 0.8.3 → 0.8.5-beta.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 +37 -8
- package/dist/client/single-page.d.mts +4 -4
- package/dist/client/single-page.d.ts +4 -4
- package/dist/client/single-page.mjs +7 -6
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.mjs +11 -9
- package/dist/node/cli.mjs +9 -9
- package/dist/node.d.mts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.mjs +7 -7
- package/dist/shared/{vite-react-ssg.Cm9gBlfg.d.ts → vite-react-ssg.-NlgsPvg.d.mts} +8 -8
- package/dist/shared/{vite-react-ssg.Cm9gBlfg.d.mts → vite-react-ssg.-NlgsPvg.d.ts} +8 -8
- package/dist/shared/{vite-react-ssg.BgawrvuJ.mjs → vite-react-ssg.2P3UhU88.mjs} +216 -212
- package/dist/shared/{vite-react-ssg.C0y5wbxl.mjs → vite-react-ssg.C_MPXL9p.mjs} +1 -1
- package/dist/shared/{vite-react-ssg.CfJcpdWF.mjs → vite-react-ssg.Dx4ca9OM.mjs} +18 -4
- package/dist/tanstack.d.mts +5 -4
- package/dist/tanstack.d.ts +5 -4
- package/dist/tanstack.mjs +9 -7
- package/package.json +32 -33
- package/dist/chunks/jsdomGlobal.cjs +0 -36
- package/dist/client/single-page.cjs +0 -75
- package/dist/client/single-page.d.cts +0 -11
- package/dist/index.cjs +0 -196
- package/dist/index.d.cts +0 -20
- package/dist/node/cli.cjs +0 -89
- package/dist/node/cli.d.cts +0 -2
- package/dist/node.cjs +0 -24
- package/dist/node.d.cts +0 -11
- package/dist/shared/vite-react-ssg.B4jDfvXh.cjs +0 -106
- package/dist/shared/vite-react-ssg.C2GpVZF1.cjs +0 -38
- package/dist/shared/vite-react-ssg.CFQGqC60.cjs +0 -36
- package/dist/shared/vite-react-ssg.CjsEygxB.cjs +0 -37
- package/dist/shared/vite-react-ssg.Cm9gBlfg.d.cts +0 -15
- package/dist/shared/vite-react-ssg.D5xBH08M.cjs +0 -1079
- package/dist/shared/vite-react-ssg.DWHmkjdM.cjs +0 -35
- package/dist/shared/vite-react-ssg.Di0pROyF.d.ts +0 -214
- package/dist/style-collectors/styled-components.cjs +0 -20
- package/dist/style-collectors/styled-components.d.cts +0 -9
- package/dist/tanstack.cjs +0 -144
- package/dist/tanstack.d.cts +0 -30
- package/dist/shared/{vite-react-ssg.Di0pROyF.d.cts → vite-react-ssg.BrImbdZU.d.mts} +1 -1
- package/dist/shared/{vite-react-ssg.Di0pROyF.d.mts → vite-react-ssg.BrImbdZU.d.ts} +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,9 @@ For usage examples, see: [`main`/examples/tanstack/src/main.tsx](https://github.
|
|
|
24
24
|
- [`<ClientOnly/>`](#clientonly)
|
|
25
25
|
- [Document head](#document-head)
|
|
26
26
|
- [Reactive head](#reactive-head)
|
|
27
|
+
- [Redirect](#redirect)
|
|
27
28
|
- [Public Base Path](#public-base-path)
|
|
29
|
+
- [Future config](#future-config)
|
|
28
30
|
- [CSS in JS](#css-in-js)
|
|
29
31
|
- [Critical CSS](#critical-css)
|
|
30
32
|
- [Configuration](#configuration)
|
|
@@ -71,10 +73,10 @@ export const createRoot = ViteReactSSG(
|
|
|
71
73
|
|
|
72
74
|
```tsx
|
|
73
75
|
// src/App.tsx
|
|
74
|
-
import React from 'react'
|
|
75
76
|
import type { RouteRecord } from 'vite-react-ssg'
|
|
76
|
-
import '
|
|
77
|
+
import React from 'react'
|
|
77
78
|
import Layout from './Layout'
|
|
79
|
+
import './App.css'
|
|
78
80
|
|
|
79
81
|
export const routes: RouteRecord[] = [
|
|
80
82
|
{
|
|
@@ -337,14 +339,44 @@ export default function MyHead() {
|
|
|
337
339
|
}
|
|
338
340
|
```
|
|
339
341
|
|
|
342
|
+
## Redirect
|
|
343
|
+
|
|
344
|
+
You should not use redirect in the loader.
|
|
345
|
+
In vite-react-ssg, the loader only executes during the build process for data fetching.
|
|
346
|
+
If you need to perform a redirect in certain situations, you can use the following method to redirect on the client side:
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
export const routes: RouteRecord[] = [
|
|
350
|
+
{
|
|
351
|
+
path: '/:lng',
|
|
352
|
+
Component: Layout,
|
|
353
|
+
getStaticPaths: () => Object.keys(resources),
|
|
354
|
+
children: [
|
|
355
|
+
// ... some routes
|
|
356
|
+
],
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
path: '/',
|
|
360
|
+
Component: () => {
|
|
361
|
+
const navigate = useNavigate()
|
|
362
|
+
useEffect(() => {
|
|
363
|
+
navigate('/en', { replace: true })
|
|
364
|
+
}, [navigate])
|
|
365
|
+
|
|
366
|
+
return null
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
]
|
|
370
|
+
```
|
|
371
|
+
|
|
340
372
|
## Public Base Path
|
|
341
373
|
|
|
342
374
|
Just set `base` in vite.config.ts like:
|
|
343
375
|
|
|
344
376
|
```ts
|
|
377
|
+
import react from '@vitejs/plugin-react-swc'
|
|
345
378
|
// vite.config.ts
|
|
346
379
|
import { defineConfig } from 'vite'
|
|
347
|
-
import react from '@vitejs/plugin-react-swc'
|
|
348
380
|
|
|
349
381
|
// https://vitejs.dev/config/
|
|
350
382
|
export default defineConfig({
|
|
@@ -616,11 +648,8 @@ export default defineConfig({
|
|
|
616
648
|
|
|
617
649
|
## Roadmap
|
|
618
650
|
|
|
619
|
-
- [
|
|
620
|
-
- [
|
|
621
|
-
- [x] SSR in dev environment
|
|
622
|
-
- [x] More Client components, such as `<ClientOnly />`
|
|
623
|
-
- [x] `getStaticPaths` for dynamic routes
|
|
651
|
+
- [ ] Support `react19`
|
|
652
|
+
- [ ] no index.html mode
|
|
624
653
|
|
|
625
654
|
## Credits
|
|
626
655
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.
|
|
3
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, d as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.
|
|
4
|
-
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.
|
|
5
|
-
import 'react-router-dom';
|
|
2
|
+
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.BrImbdZU.mjs';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, d as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.BrImbdZU.mjs';
|
|
4
|
+
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.-NlgsPvg.mjs';
|
|
6
5
|
import 'beasties';
|
|
6
|
+
import 'react-router-dom';
|
|
7
7
|
import 'react-helmet-async';
|
|
8
8
|
|
|
9
9
|
declare function ViteReactSSG(App: ReactNode, fn?: (context: ViteReactSSGContext<false>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<false>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.
|
|
3
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, d as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.
|
|
4
|
-
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.
|
|
5
|
-
import 'react-router-dom';
|
|
2
|
+
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.BrImbdZU.js';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, d as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.BrImbdZU.js';
|
|
4
|
+
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.-NlgsPvg.js';
|
|
6
5
|
import 'beasties';
|
|
6
|
+
import 'react-router-dom';
|
|
7
7
|
import 'react-helmet-async';
|
|
8
8
|
|
|
9
9
|
declare function ViteReactSSG(App: ReactNode, fn?: (context: ViteReactSSGContext<false>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<false>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { HelmetProvider } from 'react-helmet-async';
|
|
3
|
-
import { r as render, h as hydrate, d as documentReady } from '../shared/vite-react-ssg.
|
|
4
|
-
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.
|
|
3
|
+
import { r as render, h as hydrate, d as documentReady } from '../shared/vite-react-ssg.Dx4ca9OM.mjs';
|
|
4
|
+
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.Dx4ca9OM.mjs';
|
|
5
5
|
import { d as deserializeState } from '../shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
6
6
|
import 'react';
|
|
7
7
|
import 'react-dom';
|
|
@@ -13,7 +13,7 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
13
13
|
ssrWhenDev,
|
|
14
14
|
getStyleCollector = null
|
|
15
15
|
} = options;
|
|
16
|
-
if (process.env.NODE_ENV === "development" && ssrWhenDev !==
|
|
16
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== undefined)
|
|
17
17
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
18
18
|
const isClient = typeof window !== "undefined";
|
|
19
19
|
async function createRoot(client = false, routePath) {
|
|
@@ -31,8 +31,8 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
31
31
|
transformState,
|
|
32
32
|
routePath,
|
|
33
33
|
getStyleCollector,
|
|
34
|
-
routes:
|
|
35
|
-
routerOptions:
|
|
34
|
+
routes: undefined,
|
|
35
|
+
routerOptions: undefined,
|
|
36
36
|
base: "/",
|
|
37
37
|
app: App,
|
|
38
38
|
routerType: "single-page"
|
|
@@ -56,7 +56,8 @@ function ViteReactSSG(App, fn, options = {}) {
|
|
|
56
56
|
console.warn("[vite-react-ssg] Root container not found.");
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
await createRoot(true);
|
|
59
|
+
const context = await createRoot(true);
|
|
60
|
+
window.__VITE_REACT_SSG_CONTEXT__ = context;
|
|
60
61
|
const app = /* @__PURE__ */ jsx(HelmetProvider, { children: App });
|
|
61
62
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
62
63
|
if (!isSSR && process.env.NODE_ENV === "development") {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
3
|
-
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.
|
|
4
|
-
import React from 'react';
|
|
1
|
+
import { V as ViteReactSSGContext, d as RouterOptions, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.BrImbdZU.mjs';
|
|
2
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.BrImbdZU.mjs';
|
|
3
|
+
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.-NlgsPvg.mjs';
|
|
5
4
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import 'beasties';
|
|
7
7
|
import 'react-helmet-async';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Please use `Link` from 'react-router-dom' instead.
|
|
11
|
+
*/
|
|
9
12
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Please use `NavLink` from 'react-router-dom' instead.
|
|
15
|
+
*/
|
|
10
16
|
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
17
|
|
|
12
18
|
declare function ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
@@ -14,6 +20,7 @@ declare global {
|
|
|
14
20
|
interface Window {
|
|
15
21
|
__VITE_REACT_SSG_STATIC_LOADER_DATA__: any;
|
|
16
22
|
__VITE_REACT_SSG_HASH__: string;
|
|
23
|
+
__VITE_REACT_SSG_CONTEXT__: ViteReactSSGContext<true>;
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
3
|
-
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.
|
|
4
|
-
import React from 'react';
|
|
1
|
+
import { V as ViteReactSSGContext, d as RouterOptions, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.BrImbdZU.js';
|
|
2
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterFutureConfig, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.BrImbdZU.js';
|
|
3
|
+
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.-NlgsPvg.js';
|
|
5
4
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import 'beasties';
|
|
7
7
|
import 'react-helmet-async';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Please use `Link` from 'react-router-dom' instead.
|
|
11
|
+
*/
|
|
9
12
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Please use `NavLink` from 'react-router-dom' instead.
|
|
15
|
+
*/
|
|
10
16
|
declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
17
|
|
|
12
18
|
declare function ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
@@ -14,6 +20,7 @@ declare global {
|
|
|
14
20
|
interface Window {
|
|
15
21
|
__VITE_REACT_SSG_STATIC_LOADER_DATA__: any;
|
|
16
22
|
__VITE_REACT_SSG_HASH__: string;
|
|
23
|
+
__VITE_REACT_SSG_CONTEXT__: ViteReactSSGContext<true>;
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { HelmetProvider } from 'react-helmet-async';
|
|
3
3
|
import { useLinkClickHandler, Link as Link$1, NavLink as NavLink$1, matchRoutes, createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
4
|
-
import { r as render, h as hydrate, d as documentReady } from './shared/vite-react-ssg.
|
|
5
|
-
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.
|
|
6
|
-
import { d as deserializeState } from './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
4
|
+
import { r as render, h as hydrate, d as documentReady } from './shared/vite-react-ssg.Dx4ca9OM.mjs';
|
|
5
|
+
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Dx4ca9OM.mjs';
|
|
7
6
|
import { j as joinUrlSegments, w as withLeadingSlash, s as stripBase } from './shared/vite-react-ssg.CjIppNIS.mjs';
|
|
8
|
-
import { c as convertRoutesToDataRoutes } from './shared/vite-react-ssg.
|
|
7
|
+
import { c as convertRoutesToDataRoutes } from './shared/vite-react-ssg.C_MPXL9p.mjs';
|
|
8
|
+
import { d as deserializeState } from './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
9
9
|
import React, { forwardRef } from 'react';
|
|
10
10
|
import 'react-dom';
|
|
11
11
|
|
|
@@ -79,16 +79,16 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
79
79
|
ssrWhenDev,
|
|
80
80
|
getStyleCollector = null
|
|
81
81
|
} = options;
|
|
82
|
-
if (process.env.NODE_ENV === "development" && ssrWhenDev !==
|
|
82
|
+
if (process.env.NODE_ENV === "development" && ssrWhenDev !== undefined)
|
|
83
83
|
console.warn("[vite-react-ssg] `ssrWhenDev` option is no longer needed. If you want to use csr, just replace `vite-react-ssg dev` with `vite`.");
|
|
84
84
|
const isClient = typeof window !== "undefined";
|
|
85
85
|
const BASE_URL = routerOptions.basename ?? "/";
|
|
86
|
-
const { v7_startTransition, ...routerFeature } = routerOptions.future ?? {};
|
|
86
|
+
const { v7_startTransition = true, ...routerFeature } = routerOptions.future ?? {};
|
|
87
87
|
async function createRoot(client = false, routePath) {
|
|
88
88
|
const browserRouter = client ? createBrowserRouter(
|
|
89
89
|
convertRoutesToDataRoutes(routerOptions.routes, transformStaticLoaderRoute),
|
|
90
90
|
{ basename: BASE_URL, future: routerFeature }
|
|
91
|
-
) :
|
|
91
|
+
) : undefined;
|
|
92
92
|
const appRenderCallbacks = [];
|
|
93
93
|
const onSSRAppRendered = client ? () => {
|
|
94
94
|
} : (cb) => appRenderCallbacks.push(cb);
|
|
@@ -135,11 +135,13 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
135
135
|
await Promise.all(
|
|
136
136
|
lazeMatches.map(async (m) => {
|
|
137
137
|
const routeModule = await m.route.lazy();
|
|
138
|
-
Object.assign(m.route, { ...routeModule, lazy:
|
|
138
|
+
Object.assign(m.route, { ...routeModule, lazy: undefined });
|
|
139
139
|
})
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const context = await createRoot(true);
|
|
143
|
+
window.__VITE_REACT_SSG_CONTEXT__ = context;
|
|
144
|
+
const { router } = context;
|
|
143
145
|
const app = /* @__PURE__ */ jsx(HelmetProvider, { children: /* @__PURE__ */ jsx(RouterProvider, { router, future: { v7_startTransition } }) });
|
|
144
146
|
const isSSR = document.querySelector("[data-server-rendered=true]") !== null;
|
|
145
147
|
if (!isSSR && process.env.NODE_ENV === "development") {
|
package/dist/node/cli.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { gray, bold, red, reset, underline } from 'kolorist';
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
|
-
import { b as build, d as dev } from '../shared/vite-react-ssg.
|
|
4
|
+
import { b as build, d as dev } from '../shared/vite-react-ssg.2P3UhU88.mjs';
|
|
5
5
|
import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
|
|
6
|
-
import 'node:path';
|
|
7
6
|
import 'node:module';
|
|
8
|
-
import '
|
|
7
|
+
import 'node:path';
|
|
9
8
|
import 'fs-extra';
|
|
10
|
-
import 'vite';
|
|
11
9
|
import 'jsdom';
|
|
12
|
-
import '
|
|
10
|
+
import 'p-queue';
|
|
11
|
+
import 'vite';
|
|
13
12
|
import '../shared/vite-react-ssg.CjIppNIS.mjs';
|
|
13
|
+
import '../shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
14
14
|
import 'react/jsx-runtime';
|
|
15
15
|
import 'react-helmet-async';
|
|
16
|
+
import 'node:events';
|
|
16
17
|
import 'node:stream';
|
|
18
|
+
import '../shared/vite-react-ssg.C_MPXL9p.mjs';
|
|
17
19
|
import 'react-dom/server';
|
|
18
|
-
import 'node:events';
|
|
19
|
-
import '../shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
20
20
|
import '../shared/vite-react-ssg.B-j07kW6.mjs';
|
|
21
21
|
|
|
22
22
|
function installGlobals() {
|
|
@@ -47,7 +47,7 @@ yargs(hideBin(process.argv)).scriptName("vite-react-ssg").usage("$0 [args]").com
|
|
|
47
47
|
describe: "The base path to render"
|
|
48
48
|
}),
|
|
49
49
|
async (args) => {
|
|
50
|
-
const { config: configFile =
|
|
50
|
+
const { config: configFile = undefined, ...ssgOptions } = args;
|
|
51
51
|
await build(ssgOptions, { configFile });
|
|
52
52
|
}
|
|
53
53
|
).command(
|
|
@@ -72,7 +72,7 @@ yargs(hideBin(process.argv)).scriptName("vite-react-ssg").usage("$0 [args]").com
|
|
|
72
72
|
describe: "The host to expose"
|
|
73
73
|
}),
|
|
74
74
|
async (args) => {
|
|
75
|
-
const { config: configFile =
|
|
75
|
+
const { config: configFile = undefined, host, ...ssgOptions } = args;
|
|
76
76
|
await dev(ssgOptions, { configFile, server: { host } });
|
|
77
77
|
}
|
|
78
78
|
).fail((msg, err, yargs2) => {
|
package/dist/node.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InlineConfig } from 'vite';
|
|
2
|
-
import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
2
|
+
import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.BrImbdZU.mjs';
|
|
3
|
+
import 'beasties';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'react-router-dom';
|
|
5
|
-
import 'beasties';
|
|
6
6
|
|
|
7
7
|
declare function build(ssgOptions?: Partial<ViteReactSSGOptions>, viteConfig?: InlineConfig): Promise<void>;
|
|
8
8
|
|
package/dist/node.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InlineConfig } from 'vite';
|
|
2
|
-
import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
2
|
+
import { b as ViteReactSSGOptions } from './shared/vite-react-ssg.BrImbdZU.js';
|
|
3
|
+
import 'beasties';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'react-router-dom';
|
|
5
|
-
import 'beasties';
|
|
6
6
|
|
|
7
7
|
declare function build(ssgOptions?: Partial<ViteReactSSGOptions>, viteConfig?: InlineConfig): Promise<void>;
|
|
8
8
|
|
package/dist/node.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { b as build, d as dev } from './shared/vite-react-ssg.
|
|
2
|
-
import 'node:path';
|
|
1
|
+
export { b as build, d as dev } from './shared/vite-react-ssg.2P3UhU88.mjs';
|
|
3
2
|
import 'node:module';
|
|
3
|
+
import 'node:path';
|
|
4
|
+
import 'fs-extra';
|
|
5
|
+
import 'jsdom';
|
|
4
6
|
import 'kolorist';
|
|
5
7
|
import 'p-queue';
|
|
6
|
-
import 'fs-extra';
|
|
7
8
|
import 'vite';
|
|
8
|
-
import 'jsdom';
|
|
9
|
-
import './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
10
9
|
import './shared/vite-react-ssg.CjIppNIS.mjs';
|
|
10
|
+
import './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
11
11
|
import 'react/jsx-runtime';
|
|
12
12
|
import 'react-helmet-async';
|
|
13
|
+
import 'node:events';
|
|
13
14
|
import 'node:stream';
|
|
15
|
+
import './shared/vite-react-ssg.C_MPXL9p.mjs';
|
|
14
16
|
import 'react-dom/server';
|
|
15
|
-
import 'node:events';
|
|
16
|
-
import './shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
17
17
|
import './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { HelmetProps } from 'react-helmet-async';
|
|
3
3
|
|
|
4
|
+
interface ClientOnlyProps {
|
|
5
|
+
children?: () => React.ReactNode;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): React.ReactNode | null;
|
|
9
|
+
|
|
4
10
|
type Props = HelmetProps & {
|
|
5
11
|
children: ReactNode;
|
|
6
12
|
};
|
|
7
|
-
declare function Head(props: Props):
|
|
8
|
-
|
|
9
|
-
interface ClientOnlyProps {
|
|
10
|
-
children?: () => JSX.Element;
|
|
11
|
-
fallback?: JSX.Element;
|
|
12
|
-
}
|
|
13
|
-
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
13
|
+
declare function Head(props: Props): React.ReactNode;
|
|
14
14
|
|
|
15
15
|
export { ClientOnly as C, Head as H };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { HelmetProps } from 'react-helmet-async';
|
|
3
3
|
|
|
4
|
+
interface ClientOnlyProps {
|
|
5
|
+
children?: () => React.ReactNode;
|
|
6
|
+
fallback?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): React.ReactNode | null;
|
|
9
|
+
|
|
4
10
|
type Props = HelmetProps & {
|
|
5
11
|
children: ReactNode;
|
|
6
12
|
};
|
|
7
|
-
declare function Head(props: Props):
|
|
8
|
-
|
|
9
|
-
interface ClientOnlyProps {
|
|
10
|
-
children?: () => JSX.Element;
|
|
11
|
-
fallback?: JSX.Element;
|
|
12
|
-
}
|
|
13
|
-
declare function ClientOnly({ children, fallback, }: ClientOnlyProps): JSX.Element | null;
|
|
13
|
+
declare function Head(props: Props): React.ReactNode;
|
|
14
14
|
|
|
15
15
|
export { ClientOnly as C, Head as H };
|