vite-react-ssg 0.8.0-beta.3 → 0.8.0
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 +9 -9
- package/bin/vite-react-ssg.js +0 -0
- package/dist/client/single-page.d.cts +3 -2
- package/dist/client/single-page.d.mts +3 -2
- package/dist/client/single-page.d.ts +3 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/node/cli.cjs +2 -2
- package/dist/node/cli.mjs +2 -2
- package/dist/node.cjs +2 -2
- package/dist/node.d.cts +2 -1
- package/dist/node.d.mts +2 -1
- package/dist/node.d.ts +2 -1
- package/dist/node.mjs +2 -2
- package/dist/shared/{vite-react-ssg.4y2OEiyV.mjs → vite-react-ssg.B-j07kW6.mjs} +1 -1
- package/dist/shared/{vite-react-ssg.B_F2Ry8F.cjs → vite-react-ssg.D5dVt1Iv.cjs} +27 -13
- package/dist/shared/{vite-react-ssg.CphxiYA9.mjs → vite-react-ssg.DObRRhiz.mjs} +26 -12
- package/dist/shared/{vite-react-ssg.D0EGioth.cjs → vite-react-ssg.DWHmkjdM.cjs} +1 -1
- package/dist/shared/{vite-react-ssg.Txy2EJkI.d.cts → vite-react-ssg.MPbH7GTN.d.cts} +8 -0
- package/dist/shared/{vite-react-ssg.Txy2EJkI.d.mts → vite-react-ssg.MPbH7GTN.d.mts} +8 -0
- package/dist/shared/{vite-react-ssg.Txy2EJkI.d.ts → vite-react-ssg.MPbH7GTN.d.ts} +8 -0
- package/dist/tanstack.cjs +3 -3
- package/dist/tanstack.d.cts +5 -4
- package/dist/tanstack.d.mts +5 -4
- package/dist/tanstack.d.ts +5 -4
- package/dist/tanstack.mjs +4 -4
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -392,26 +392,26 @@ You can provide your own by looking at the [implementation](./src/style-collecto
|
|
|
392
392
|
|
|
393
393
|
## Critical CSS
|
|
394
394
|
|
|
395
|
-
Vite React SSG has built-in support for generating [Critical CSS](https://web.dev/extract-critical-css/) inlined in the HTML via the [`
|
|
395
|
+
Vite React SSG has built-in support for generating [Critical CSS](https://web.dev/extract-critical-css/) inlined in the HTML via the [`beasties`](https://github.com/danielroe/beasties) package.
|
|
396
396
|
Install it with:
|
|
397
397
|
|
|
398
398
|
```bash
|
|
399
|
-
npm i -D
|
|
399
|
+
npm i -D beasties
|
|
400
400
|
```
|
|
401
401
|
|
|
402
402
|
Critical CSS generation will automatically be enabled for you.
|
|
403
403
|
|
|
404
|
-
To configure `
|
|
405
|
-
into `ssgOptions.
|
|
404
|
+
To configure `beasties`, pass [its options](https://github.com/danielroe/beasties#usage)
|
|
405
|
+
into `ssgOptions.beastiesOptions` in `vite.config.ts`:
|
|
406
406
|
|
|
407
407
|
```ts
|
|
408
408
|
// vite.config.ts
|
|
409
409
|
export default defineConfig({
|
|
410
410
|
ssgOptions: {
|
|
411
|
-
|
|
411
|
+
beastiesOptions: {
|
|
412
412
|
// E.g., change the preload strategy
|
|
413
413
|
preload: 'media',
|
|
414
|
-
// Other options: https://github.com/
|
|
414
|
+
// Other options: https://github.com/danielroe/beasties#usage
|
|
415
415
|
},
|
|
416
416
|
},
|
|
417
417
|
})
|
|
@@ -488,11 +488,11 @@ interface ViteReactSSGOptions {
|
|
|
488
488
|
*/
|
|
489
489
|
includeAllRoutes?: boolean
|
|
490
490
|
/**
|
|
491
|
-
* Options for the
|
|
491
|
+
* Options for the beasties packages.
|
|
492
492
|
*
|
|
493
|
-
* @see https://github.com/
|
|
493
|
+
* @see https://github.com/danielroe/beasties#usage
|
|
494
494
|
*/
|
|
495
|
-
|
|
495
|
+
beastiesOptions?: BeastiesOptions | false
|
|
496
496
|
/**
|
|
497
497
|
* Custom function to modify the routes to do the SSG.
|
|
498
498
|
*
|
package/bin/vite-react-ssg.js
CHANGED
|
File without changes
|
|
@@ -1,8 +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 RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.Cm9gBlfg.cjs';
|
|
5
5
|
import 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare function ViteReactSSG(App: ReactNode, fn?: (context: ViteReactSSGContext<false>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<false>>;
|
|
@@ -1,8 +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 RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.Cm9gBlfg.mjs';
|
|
5
5
|
import 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare function ViteReactSSG(App: ReactNode, fn?: (context: ViteReactSSGContext<false>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<false>>;
|
|
@@ -1,8 +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 RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.MPbH7GTN.js';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.MPbH7GTN.js';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.Cm9gBlfg.js';
|
|
5
5
|
import 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare function ViteReactSSG(App: ReactNode, fn?: (context: ViteReactSSGContext<false>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<false>>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
1
|
+
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
2
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.cjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
1
|
+
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
2
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.mjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
1
|
+
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.js';
|
|
2
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.js';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.js';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
6
|
+
import 'beasties';
|
|
6
7
|
import 'react-helmet-async';
|
|
7
8
|
|
|
8
9
|
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
package/dist/node/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const kolorist = require('kolorist');
|
|
4
4
|
const yargs = require('yargs');
|
|
5
5
|
const helpers = require('yargs/helpers');
|
|
6
|
-
const dev = require('../shared/vite-react-ssg.
|
|
6
|
+
const dev = require('../shared/vite-react-ssg.D5dVt1Iv.cjs');
|
|
7
7
|
const webFetch = require('@remix-run/web-fetch');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:module');
|
|
@@ -19,7 +19,7 @@ require('node:stream');
|
|
|
19
19
|
require('react-dom/server');
|
|
20
20
|
require('node:events');
|
|
21
21
|
require('../shared/vite-react-ssg.C2GpVZF1.cjs');
|
|
22
|
-
require('../shared/vite-react-ssg.
|
|
22
|
+
require('../shared/vite-react-ssg.DWHmkjdM.cjs');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
25
25
|
|
package/dist/node/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.DObRRhiz.mjs';
|
|
5
5
|
import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:module';
|
|
@@ -17,7 +17,7 @@ import 'node:stream';
|
|
|
17
17
|
import 'react-dom/server';
|
|
18
18
|
import 'node:events';
|
|
19
19
|
import '../shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
20
|
-
import '../shared/vite-react-ssg.
|
|
20
|
+
import '../shared/vite-react-ssg.B-j07kW6.mjs';
|
|
21
21
|
|
|
22
22
|
function installGlobals() {
|
|
23
23
|
global.Headers = Headers;
|
package/dist/node.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const dev = require('./shared/vite-react-ssg.
|
|
3
|
+
const dev = require('./shared/vite-react-ssg.D5dVt1Iv.cjs');
|
|
4
4
|
require('node:path');
|
|
5
5
|
require('node:module');
|
|
6
6
|
require('kolorist');
|
|
@@ -16,7 +16,7 @@ require('node:stream');
|
|
|
16
16
|
require('react-dom/server');
|
|
17
17
|
require('node:events');
|
|
18
18
|
require('./shared/vite-react-ssg.C2GpVZF1.cjs');
|
|
19
|
-
require('./shared/vite-react-ssg.
|
|
19
|
+
require('./shared/vite-react-ssg.DWHmkjdM.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
package/dist/node.d.cts
CHANGED
|
@@ -1,7 +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.MPbH7GTN.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'react-router-dom';
|
|
5
|
+
import 'beasties';
|
|
5
6
|
|
|
6
7
|
declare function build(ssgOptions?: Partial<ViteReactSSGOptions>, viteConfig?: InlineConfig): Promise<void>;
|
|
7
8
|
|
package/dist/node.d.mts
CHANGED
|
@@ -1,7 +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.MPbH7GTN.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'react-router-dom';
|
|
5
|
+
import 'beasties';
|
|
5
6
|
|
|
6
7
|
declare function build(ssgOptions?: Partial<ViteReactSSGOptions>, viteConfig?: InlineConfig): Promise<void>;
|
|
7
8
|
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +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.MPbH7GTN.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'react-router-dom';
|
|
5
|
+
import 'beasties';
|
|
5
6
|
|
|
6
7
|
declare function build(ssgOptions?: Partial<ViteReactSSGOptions>, viteConfig?: InlineConfig): Promise<void>;
|
|
7
8
|
|
package/dist/node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, d as dev } from './shared/vite-react-ssg.
|
|
1
|
+
export { b as build, d as dev } from './shared/vite-react-ssg.DObRRhiz.mjs';
|
|
2
2
|
import 'node:path';
|
|
3
3
|
import 'node:module';
|
|
4
4
|
import 'kolorist';
|
|
@@ -14,4 +14,4 @@ import 'node:stream';
|
|
|
14
14
|
import 'react-dom/server';
|
|
15
15
|
import 'node:events';
|
|
16
16
|
import './shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
17
|
-
import './shared/vite-react-ssg.
|
|
17
|
+
import './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
@@ -5,7 +5,7 @@ function registerPaths(id, getStaticPaths) {
|
|
|
5
5
|
async function convertRouteTreeToRouteOption(routeTree, client, visitNode) {
|
|
6
6
|
const routes = [];
|
|
7
7
|
async function traverseRouteTree(node) {
|
|
8
|
-
if (!client && node.path
|
|
8
|
+
if (!client && node.path?.includes("$") && node.lazyFn) {
|
|
9
9
|
await node.lazyFn();
|
|
10
10
|
}
|
|
11
11
|
visitNode?.(node);
|
|
@@ -15,7 +15,7 @@ const node_stream = require('node:stream');
|
|
|
15
15
|
const server = require('react-dom/server');
|
|
16
16
|
const node_events = require('node:events');
|
|
17
17
|
const remixRouter = require('./vite-react-ssg.C2GpVZF1.cjs');
|
|
18
|
-
const tanstackRouter = require('./vite-react-ssg.
|
|
18
|
+
const tanstackRouter = require('./vite-react-ssg.DWHmkjdM.cjs');
|
|
19
19
|
|
|
20
20
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
21
21
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -23,7 +23,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
23
23
|
const PQueue__default = /*#__PURE__*/_interopDefaultCompat(PQueue);
|
|
24
24
|
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
25
25
|
|
|
26
|
-
const version = "0.8.0
|
|
26
|
+
const version = "0.8.0";
|
|
27
27
|
|
|
28
28
|
function buildLog(text, count) {
|
|
29
29
|
console.log(`
|
|
@@ -94,9 +94,22 @@ function isDynamicSegmentsRoute(route) {
|
|
|
94
94
|
return dynamicRE.test(route);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
async function
|
|
97
|
+
async function getBeastiesOrCritters(outDir, options = {}) {
|
|
98
|
+
try {
|
|
99
|
+
const BeastiesClass = (await import('beasties')).default;
|
|
100
|
+
return new BeastiesClass({
|
|
101
|
+
path: outDir,
|
|
102
|
+
logLevel: "warn",
|
|
103
|
+
external: true,
|
|
104
|
+
inlineFonts: true,
|
|
105
|
+
preloadFonts: true,
|
|
106
|
+
...options
|
|
107
|
+
});
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
98
110
|
try {
|
|
99
111
|
const CrittersClass = (await import('critters')).default;
|
|
112
|
+
console.warn("`critters` is deprecated. Please use `beasties` instead.");
|
|
100
113
|
return new CrittersClass({
|
|
101
114
|
path: outDir,
|
|
102
115
|
logLevel: "warn",
|
|
@@ -581,9 +594,9 @@ class TanstackAdapter {
|
|
|
581
594
|
this.context = context;
|
|
582
595
|
}
|
|
583
596
|
render = async (path$1) => {
|
|
584
|
-
const { getStyleCollector, router: _router } = this.context;
|
|
597
|
+
const { getStyleCollector, router: _router, base } = this.context;
|
|
585
598
|
const styleCollector = getStyleCollector ? await getStyleCollector() : null;
|
|
586
|
-
path$1 = path.
|
|
599
|
+
path$1 = `${path.withTrailingSlash(base)}${path.removeLeadingSlash(path$1)}`;
|
|
587
600
|
const { createRouter, createMemoryHistory } = await import('@tanstack/react-router');
|
|
588
601
|
const router = createRouter(_router.options);
|
|
589
602
|
const { StartServer } = await import('@tanstack/start/server');
|
|
@@ -698,12 +711,12 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
698
711
|
const outDir = config.build.outDir || "dist";
|
|
699
712
|
const out = node_path.isAbsolute(outDir) ? outDir : node_path.join(root, outDir);
|
|
700
713
|
const configBase = config.base;
|
|
714
|
+
const mergedOptions = Object.assign({}, config.ssgOptions || {}, ssgOptions);
|
|
701
715
|
const {
|
|
702
716
|
script = "sync",
|
|
703
717
|
mock = false,
|
|
704
718
|
entry = await detectEntry(root),
|
|
705
719
|
formatting = "none",
|
|
706
|
-
crittersOptions = {},
|
|
707
720
|
includedRoutes: configIncludedRoutes = DefaultIncludedRoutes,
|
|
708
721
|
onBeforePageRender,
|
|
709
722
|
onPageRendered,
|
|
@@ -713,7 +726,8 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
713
726
|
format = "esm",
|
|
714
727
|
concurrency = 20,
|
|
715
728
|
rootContainerId = "root"
|
|
716
|
-
} =
|
|
729
|
+
} = mergedOptions;
|
|
730
|
+
const beastiesOptions = mergedOptions.beastiesOptions ?? mergedOptions.crittersOptions ?? {};
|
|
717
731
|
if (fs__default.existsSync(ssgOut))
|
|
718
732
|
await fs__default.remove(ssgOut);
|
|
719
733
|
const clientLogger = vite.createLogger();
|
|
@@ -781,7 +795,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
781
795
|
const ext = format === "esm" ? ".mjs" : ".cjs";
|
|
782
796
|
const serverEntry = node_path.join(prefix, ssgOut, node_path.parse(ssrEntry).name + ext);
|
|
783
797
|
const serverManifest = JSON.parse(await fs__default.readFile(node_path.join(ssgOut, ...dotVitedir, "manifest.json"), "utf-8"));
|
|
784
|
-
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-react-ssg.
|
|
798
|
+
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-react-ssg.D5dVt1Iv.cjs', document.baseURI).href)));
|
|
785
799
|
const { createRoot, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
|
|
786
800
|
const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
|
|
787
801
|
const { routes } = await createRoot(false);
|
|
@@ -790,9 +804,9 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
790
804
|
routesPaths = DefaultIncludedRoutes(routesPaths);
|
|
791
805
|
routesPaths = Array.from(new Set(routesPaths));
|
|
792
806
|
buildLog("Rendering Pages...", routesPaths.length);
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
795
|
-
console.log(`${kolorist.gray("[vite-react-ssg]")} ${kolorist.blue("Critical CSS generation enabled via `
|
|
807
|
+
const beasties = beastiesOptions !== false ? await getBeastiesOrCritters(outDir, { publicPath: configBase, ...beastiesOptions }) : void 0;
|
|
808
|
+
if (beasties)
|
|
809
|
+
console.log(`${kolorist.gray("[vite-react-ssg]")} ${kolorist.blue("Critical CSS generation enabled via `beasties`")}`);
|
|
796
810
|
const ssrManifest = JSON.parse(await fs__default.readFile(node_path.join(out, ...dotVitedir, "ssr-manifest.json"), "utf-8"));
|
|
797
811
|
const manifest = JSON.parse(await fs__default.readFile(node_path.join(out, ...dotVitedir, "manifest.json"), "utf-8"));
|
|
798
812
|
let indexHTML = await fs__default.readFile(node_path.join(out, "index.html"), "utf-8");
|
|
@@ -826,8 +840,8 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
826
840
|
const html = jsdom.serialize();
|
|
827
841
|
let transformed = await onPageRendered?.(path$1, html, appCtx) || html;
|
|
828
842
|
transformed = transformed.replace(SCRIPT_COMMENT_PLACEHOLDER, `window.__VITE_REACT_SSG_HASH__ = '${hash}'`);
|
|
829
|
-
if (
|
|
830
|
-
transformed = await crittersQueue.add(() =>
|
|
843
|
+
if (beasties) {
|
|
844
|
+
transformed = await crittersQueue.add(() => beasties.process(transformed));
|
|
831
845
|
transformed = transformed.replace(/<link\srel="stylesheet"/g, '<link rel="stylesheet" crossorigin');
|
|
832
846
|
}
|
|
833
847
|
if (styleTag)
|
|
@@ -13,9 +13,9 @@ import { Writable, Readable } from 'node:stream';
|
|
|
13
13
|
import { renderToPipeableStream } from 'react-dom/server';
|
|
14
14
|
import { once } from 'node:events';
|
|
15
15
|
import { c as convertRoutesToDataRoutes } from './vite-react-ssg.C0y5wbxl.mjs';
|
|
16
|
-
import { M as META_CONTAINER_ID } from './vite-react-ssg.
|
|
16
|
+
import { M as META_CONTAINER_ID } from './vite-react-ssg.B-j07kW6.mjs';
|
|
17
17
|
|
|
18
|
-
const version = "0.8.0
|
|
18
|
+
const version = "0.8.0";
|
|
19
19
|
|
|
20
20
|
function buildLog(text, count) {
|
|
21
21
|
console.log(`
|
|
@@ -86,9 +86,22 @@ function isDynamicSegmentsRoute(route) {
|
|
|
86
86
|
return dynamicRE.test(route);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
async function
|
|
89
|
+
async function getBeastiesOrCritters(outDir, options = {}) {
|
|
90
|
+
try {
|
|
91
|
+
const BeastiesClass = (await import('beasties')).default;
|
|
92
|
+
return new BeastiesClass({
|
|
93
|
+
path: outDir,
|
|
94
|
+
logLevel: "warn",
|
|
95
|
+
external: true,
|
|
96
|
+
inlineFonts: true,
|
|
97
|
+
preloadFonts: true,
|
|
98
|
+
...options
|
|
99
|
+
});
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
90
102
|
try {
|
|
91
103
|
const CrittersClass = (await import('critters')).default;
|
|
104
|
+
console.warn("`critters` is deprecated. Please use `beasties` instead.");
|
|
92
105
|
return new CrittersClass({
|
|
93
106
|
path: outDir,
|
|
94
107
|
logLevel: "warn",
|
|
@@ -573,9 +586,9 @@ class TanstackAdapter {
|
|
|
573
586
|
this.context = context;
|
|
574
587
|
}
|
|
575
588
|
render = async (path) => {
|
|
576
|
-
const { getStyleCollector, router: _router } = this.context;
|
|
589
|
+
const { getStyleCollector, router: _router, base } = this.context;
|
|
577
590
|
const styleCollector = getStyleCollector ? await getStyleCollector() : null;
|
|
578
|
-
path =
|
|
591
|
+
path = `${withTrailingSlash(base)}${removeLeadingSlash(path)}`;
|
|
579
592
|
const { createRouter, createMemoryHistory } = await import('@tanstack/react-router');
|
|
580
593
|
const router = createRouter(_router.options);
|
|
581
594
|
const { StartServer } = await import('@tanstack/start/server');
|
|
@@ -690,12 +703,12 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
690
703
|
const outDir = config.build.outDir || "dist";
|
|
691
704
|
const out = isAbsolute(outDir) ? outDir : join(root, outDir);
|
|
692
705
|
const configBase = config.base;
|
|
706
|
+
const mergedOptions = Object.assign({}, config.ssgOptions || {}, ssgOptions);
|
|
693
707
|
const {
|
|
694
708
|
script = "sync",
|
|
695
709
|
mock = false,
|
|
696
710
|
entry = await detectEntry(root),
|
|
697
711
|
formatting = "none",
|
|
698
|
-
crittersOptions = {},
|
|
699
712
|
includedRoutes: configIncludedRoutes = DefaultIncludedRoutes,
|
|
700
713
|
onBeforePageRender,
|
|
701
714
|
onPageRendered,
|
|
@@ -705,7 +718,8 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
705
718
|
format = "esm",
|
|
706
719
|
concurrency = 20,
|
|
707
720
|
rootContainerId = "root"
|
|
708
|
-
} =
|
|
721
|
+
} = mergedOptions;
|
|
722
|
+
const beastiesOptions = mergedOptions.beastiesOptions ?? mergedOptions.crittersOptions ?? {};
|
|
709
723
|
if (fs.existsSync(ssgOut))
|
|
710
724
|
await fs.remove(ssgOut);
|
|
711
725
|
const clientLogger = createLogger();
|
|
@@ -782,9 +796,9 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
782
796
|
routesPaths = DefaultIncludedRoutes(routesPaths);
|
|
783
797
|
routesPaths = Array.from(new Set(routesPaths));
|
|
784
798
|
buildLog("Rendering Pages...", routesPaths.length);
|
|
785
|
-
const
|
|
786
|
-
if (
|
|
787
|
-
console.log(`${gray("[vite-react-ssg]")} ${blue("Critical CSS generation enabled via `
|
|
799
|
+
const beasties = beastiesOptions !== false ? await getBeastiesOrCritters(outDir, { publicPath: configBase, ...beastiesOptions }) : void 0;
|
|
800
|
+
if (beasties)
|
|
801
|
+
console.log(`${gray("[vite-react-ssg]")} ${blue("Critical CSS generation enabled via `beasties`")}`);
|
|
788
802
|
const ssrManifest = JSON.parse(await fs.readFile(join(out, ...dotVitedir, "ssr-manifest.json"), "utf-8"));
|
|
789
803
|
const manifest = JSON.parse(await fs.readFile(join(out, ...dotVitedir, "manifest.json"), "utf-8"));
|
|
790
804
|
let indexHTML = await fs.readFile(join(out, "index.html"), "utf-8");
|
|
@@ -818,8 +832,8 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
818
832
|
const html = jsdom.serialize();
|
|
819
833
|
let transformed = await onPageRendered?.(path, html, appCtx) || html;
|
|
820
834
|
transformed = transformed.replace(SCRIPT_COMMENT_PLACEHOLDER, `window.__VITE_REACT_SSG_HASH__ = '${hash}'`);
|
|
821
|
-
if (
|
|
822
|
-
transformed = await crittersQueue.add(() =>
|
|
835
|
+
if (beasties) {
|
|
836
|
+
transformed = await crittersQueue.add(() => beasties.process(transformed));
|
|
823
837
|
transformed = transformed.replace(/<link\srel="stylesheet"/g, '<link rel="stylesheet" crossorigin');
|
|
824
838
|
}
|
|
825
839
|
if (styleTag)
|
|
@@ -7,7 +7,7 @@ function registerPaths(id, getStaticPaths) {
|
|
|
7
7
|
async function convertRouteTreeToRouteOption(routeTree, client, visitNode) {
|
|
8
8
|
const routes = [];
|
|
9
9
|
async function traverseRouteTree(node) {
|
|
10
|
-
if (!client && node.path
|
|
10
|
+
if (!client && node.path?.includes("$") && node.lazyFn) {
|
|
11
11
|
await node.lazyFn();
|
|
12
12
|
}
|
|
13
13
|
visitNode?.(node);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { Options } from 'beasties';
|
|
3
4
|
|
|
4
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
5
6
|
interface CrittersOptions {
|
|
@@ -78,9 +79,16 @@ interface ViteReactSSGOptions<Context = ViteReactSSGContext> {
|
|
|
78
79
|
/**
|
|
79
80
|
* Options for the critters packages.
|
|
80
81
|
*
|
|
82
|
+
* @deprecated Use `beastiesOptions` instead.
|
|
81
83
|
* @see https://github.com/GoogleChromeLabs/critters
|
|
82
84
|
*/
|
|
83
85
|
crittersOptions?: CrittersOptions | false;
|
|
86
|
+
/**
|
|
87
|
+
* Options for the beasties package.
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/danielroe/beasties
|
|
90
|
+
*/
|
|
91
|
+
beastiesOptions?: Options | false;
|
|
84
92
|
/**
|
|
85
93
|
* Custom function to modify the routes to do the SSG.
|
|
86
94
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { Options } from 'beasties';
|
|
3
4
|
|
|
4
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
5
6
|
interface CrittersOptions {
|
|
@@ -78,9 +79,16 @@ interface ViteReactSSGOptions<Context = ViteReactSSGContext> {
|
|
|
78
79
|
/**
|
|
79
80
|
* Options for the critters packages.
|
|
80
81
|
*
|
|
82
|
+
* @deprecated Use `beastiesOptions` instead.
|
|
81
83
|
* @see https://github.com/GoogleChromeLabs/critters
|
|
82
84
|
*/
|
|
83
85
|
crittersOptions?: CrittersOptions | false;
|
|
86
|
+
/**
|
|
87
|
+
* Options for the beasties package.
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/danielroe/beasties
|
|
90
|
+
*/
|
|
91
|
+
beastiesOptions?: Options | false;
|
|
84
92
|
/**
|
|
85
93
|
* Custom function to modify the routes to do the SSG.
|
|
86
94
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { NonIndexRouteObject, IndexRouteObject, createBrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { Options } from 'beasties';
|
|
3
4
|
|
|
4
5
|
type Router = ReturnType<typeof createBrowserRouter>;
|
|
5
6
|
interface CrittersOptions {
|
|
@@ -78,9 +79,16 @@ interface ViteReactSSGOptions<Context = ViteReactSSGContext> {
|
|
|
78
79
|
/**
|
|
79
80
|
* Options for the critters packages.
|
|
80
81
|
*
|
|
82
|
+
* @deprecated Use `beastiesOptions` instead.
|
|
81
83
|
* @see https://github.com/GoogleChromeLabs/critters
|
|
82
84
|
*/
|
|
83
85
|
crittersOptions?: CrittersOptions | false;
|
|
86
|
+
/**
|
|
87
|
+
* Options for the beasties package.
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/danielroe/beasties
|
|
90
|
+
*/
|
|
91
|
+
beastiesOptions?: Options | false;
|
|
84
92
|
/**
|
|
85
93
|
* Custom function to modify the routes to do the SSG.
|
|
86
94
|
*
|
package/dist/tanstack.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const reactRouter = require('@tanstack/react-router');
|
|
|
8
8
|
const start = require('@tanstack/start');
|
|
9
9
|
const ClientOnly = require('./shared/vite-react-ssg.BuZVBVT6.cjs');
|
|
10
10
|
const state = require('./shared/vite-react-ssg.CjsEygxB.cjs');
|
|
11
|
-
const tanstackRouter = require('./shared/vite-react-ssg.
|
|
11
|
+
const tanstackRouter = require('./shared/vite-react-ssg.DWHmkjdM.cjs');
|
|
12
12
|
const path = require('./shared/vite-react-ssg.CFQGqC60.cjs');
|
|
13
13
|
|
|
14
14
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -16,7 +16,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
const React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
17
|
|
|
18
18
|
const HAS_ADD_META_FLAG_KEY = "HAS_ADD_META_FLAG_KEY";
|
|
19
|
-
function
|
|
19
|
+
function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
20
20
|
const {
|
|
21
21
|
transformState,
|
|
22
22
|
rootContainer = "#root",
|
|
@@ -147,4 +147,4 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
147
147
|
exports.ClientOnly = ClientOnly.ClientOnly;
|
|
148
148
|
exports.Head = ClientOnly.Head;
|
|
149
149
|
exports.registerPaths = tanstackRouter.registerPaths;
|
|
150
|
-
exports.
|
|
150
|
+
exports.Experimental_ViteReactSSG = Experimental_ViteReactSSG;
|
package/dist/tanstack.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AnyRouter } from '@tanstack/react-router';
|
|
2
|
-
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
3
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.cjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-router-dom';
|
|
7
|
+
import 'beasties';
|
|
7
8
|
import 'react-helmet-async';
|
|
8
9
|
|
|
9
10
|
declare function registerPaths(id: string, getStaticPaths: () => string[] | Promise<string[]>): void;
|
|
@@ -18,7 +19,7 @@ type ViteReactSSGContext<HasRouter extends boolean = true> = Omit<ViteReactSSGCo
|
|
|
18
19
|
routeTree?: AnyRouter['routeTree'];
|
|
19
20
|
routerType: 'tanstack';
|
|
20
21
|
};
|
|
21
|
-
declare function
|
|
22
|
+
declare function Experimental_ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
22
23
|
declare global {
|
|
23
24
|
interface Window {
|
|
24
25
|
__VITE_REACT_SSG_STATIC_LOADER_DATA__: any;
|
|
@@ -26,4 +27,4 @@ declare global {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export { type RouterOptions,
|
|
30
|
+
export { Experimental_ViteReactSSG, type RouterOptions, ViteReactSSGClientOptions, type ViteReactSSGContext, registerPaths };
|
package/dist/tanstack.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AnyRouter } from '@tanstack/react-router';
|
|
2
|
-
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
3
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.mjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-router-dom';
|
|
7
|
+
import 'beasties';
|
|
7
8
|
import 'react-helmet-async';
|
|
8
9
|
|
|
9
10
|
declare function registerPaths(id: string, getStaticPaths: () => string[] | Promise<string[]>): void;
|
|
@@ -18,7 +19,7 @@ type ViteReactSSGContext<HasRouter extends boolean = true> = Omit<ViteReactSSGCo
|
|
|
18
19
|
routeTree?: AnyRouter['routeTree'];
|
|
19
20
|
routerType: 'tanstack';
|
|
20
21
|
};
|
|
21
|
-
declare function
|
|
22
|
+
declare function Experimental_ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
22
23
|
declare global {
|
|
23
24
|
interface Window {
|
|
24
25
|
__VITE_REACT_SSG_STATIC_LOADER_DATA__: any;
|
|
@@ -26,4 +27,4 @@ declare global {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export { type RouterOptions,
|
|
30
|
+
export { Experimental_ViteReactSSG, type RouterOptions, ViteReactSSGClientOptions, type ViteReactSSGContext, registerPaths };
|
package/dist/tanstack.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AnyRouter } from '@tanstack/react-router';
|
|
2
|
-
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
3
|
-
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.
|
|
2
|
+
import { V as ViteReactSSGContext$1, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.MPbH7GTN.js';
|
|
3
|
+
export { C as CrittersOptions, I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.MPbH7GTN.js';
|
|
4
4
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.Cm9gBlfg.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-router-dom';
|
|
7
|
+
import 'beasties';
|
|
7
8
|
import 'react-helmet-async';
|
|
8
9
|
|
|
9
10
|
declare function registerPaths(id: string, getStaticPaths: () => string[] | Promise<string[]>): void;
|
|
@@ -18,7 +19,7 @@ type ViteReactSSGContext<HasRouter extends boolean = true> = Omit<ViteReactSSGCo
|
|
|
18
19
|
routeTree?: AnyRouter['routeTree'];
|
|
19
20
|
routerType: 'tanstack';
|
|
20
21
|
};
|
|
21
|
-
declare function
|
|
22
|
+
declare function Experimental_ViteReactSSG(routerOptions: RouterOptions, fn?: (context: ViteReactSSGContext<true>) => Promise<void> | void, options?: ViteReactSSGClientOptions): (client?: boolean, routePath?: string) => Promise<ViteReactSSGContext<true>>;
|
|
22
23
|
declare global {
|
|
23
24
|
interface Window {
|
|
24
25
|
__VITE_REACT_SSG_STATIC_LOADER_DATA__: any;
|
|
@@ -26,4 +27,4 @@ declare global {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export { type RouterOptions,
|
|
30
|
+
export { Experimental_ViteReactSSG, type RouterOptions, ViteReactSSGClientOptions, type ViteReactSSGContext, registerPaths };
|
package/dist/tanstack.mjs
CHANGED
|
@@ -7,12 +7,12 @@ import { StartClient, Meta } from '@tanstack/start';
|
|
|
7
7
|
import { d as documentReady } from './shared/vite-react-ssg.B6SGTWpD.mjs';
|
|
8
8
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.B6SGTWpD.mjs';
|
|
9
9
|
import { d as deserializeState } from './shared/vite-react-ssg.C6pK7rvr.mjs';
|
|
10
|
-
import { M as META_CONTAINER_ID, c as convertRouteTreeToRouteOption } from './shared/vite-react-ssg.
|
|
11
|
-
export { r as registerPaths } from './shared/vite-react-ssg.
|
|
10
|
+
import { M as META_CONTAINER_ID, c as convertRouteTreeToRouteOption } from './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
11
|
+
export { r as registerPaths } from './shared/vite-react-ssg.B-j07kW6.mjs';
|
|
12
12
|
import { j as joinUrlSegments, w as withLeadingSlash, s as stripBase } from './shared/vite-react-ssg.CjIppNIS.mjs';
|
|
13
13
|
|
|
14
14
|
const HAS_ADD_META_FLAG_KEY = "HAS_ADD_META_FLAG_KEY";
|
|
15
|
-
function
|
|
15
|
+
function Experimental_ViteReactSSG(routerOptions, fn, options = {}) {
|
|
16
16
|
const {
|
|
17
17
|
transformState,
|
|
18
18
|
rootContainer = "#root",
|
|
@@ -140,4 +140,4 @@ function ViteReactSSG(routerOptions, fn, options = {}) {
|
|
|
140
140
|
return createRoot$1;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
export {
|
|
143
|
+
export { Experimental_ViteReactSSG };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-react-ssg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.0
|
|
5
|
-
"packageManager": "pnpm@9.
|
|
4
|
+
"version": "0.8.0",
|
|
5
|
+
"packageManager": "pnpm@9.12.3",
|
|
6
6
|
"description": "Static-site generation for React on Vite.",
|
|
7
7
|
"author": "Riri <Daydreamerriri@outlook.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"typecheck": "tsc --noEmit"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"
|
|
85
|
+
"beasties": "^0.1.0",
|
|
86
|
+
"critters": "^0.0.24",
|
|
86
87
|
"prettier": "*",
|
|
87
88
|
"react": "^18.0.0",
|
|
88
89
|
"react-dom": "^18.0.0",
|
|
@@ -97,6 +98,9 @@
|
|
|
97
98
|
"@tanstack/start": {
|
|
98
99
|
"optional": true
|
|
99
100
|
},
|
|
101
|
+
"beasties": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
100
104
|
"critters": {
|
|
101
105
|
"optional": true
|
|
102
106
|
},
|
|
@@ -131,10 +135,11 @@
|
|
|
131
135
|
"@types/react-dom": "~18.2.6",
|
|
132
136
|
"@types/yargs": "^17.0.33",
|
|
133
137
|
"@vitejs/plugin-react-swc": "^3.7.1",
|
|
134
|
-
"
|
|
138
|
+
"beasties": "^0.1.0",
|
|
139
|
+
"bumpp": "^9.8.0",
|
|
135
140
|
"critters": "^0.0.24",
|
|
136
|
-
"eslint": "^9.
|
|
137
|
-
"esno": "^4.
|
|
141
|
+
"eslint": "^9.13.0",
|
|
142
|
+
"esno": "^4.8.0",
|
|
138
143
|
"fast-glob": "3.3.2",
|
|
139
144
|
"prettier": "^3.3.3",
|
|
140
145
|
"react": "^18.2.0",
|
|
@@ -144,7 +149,7 @@
|
|
|
144
149
|
"styled-components": "6.0.5",
|
|
145
150
|
"typescript": "^5.6.2",
|
|
146
151
|
"unbuild": "^3.0.0-rc.11",
|
|
147
|
-
"vite": "
|
|
152
|
+
"vite": "catalog:",
|
|
148
153
|
"vitest": "1.6.0"
|
|
149
154
|
}
|
|
150
155
|
}
|