vite-react-ssg 0.6.1 → 0.6.3
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/LICENSE +21 -21
- package/README.md +555 -557
- package/bin/vite-react-ssg.js +3 -3
- package/dist/chunks/jsdomGlobal.cjs +80 -79
- package/dist/chunks/jsdomGlobal.mjs +80 -79
- package/dist/client/single-page.cjs +1 -1
- package/dist/client/single-page.d.cts +2 -2
- package/dist/client/single-page.d.mts +2 -2
- package/dist/client/single-page.d.ts +2 -2
- package/dist/client/single-page.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/node/cli.cjs +10 -39
- package/dist/node/cli.mjs +9 -38
- package/dist/node.cjs +201 -312
- package/dist/node.d.cts +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/node.mjs +203 -312
- package/dist/shared/{vite-react-ssg.a009fbf1.mjs → vite-react-ssg.579feabb.mjs} +1 -1
- package/dist/shared/{vite-react-ssg.d734eb79.d.cts → vite-react-ssg.870c683b.d.cts} +3 -3
- package/dist/shared/{vite-react-ssg.d734eb79.d.mts → vite-react-ssg.870c683b.d.mts} +3 -3
- package/dist/shared/{vite-react-ssg.d734eb79.d.ts → vite-react-ssg.870c683b.d.ts} +3 -3
- package/dist/shared/{vite-react-ssg.e6991406.cjs → vite-react-ssg.bee8a5a9.cjs} +1 -1
- package/package.json +12 -15
package/bin/vite-react-ssg.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict'
|
|
3
|
-
import('../dist/node/cli.mjs')
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict'
|
|
3
|
+
import('../dist/node/cli.mjs')
|
|
@@ -6,85 +6,86 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
6
6
|
|
|
7
7
|
const JSDOM__default = /*#__PURE__*/_interopDefaultCompat(JSDOM);
|
|
8
8
|
|
|
9
|
-
/*
|
|
10
|
-
MIT License
|
|
11
|
-
|
|
12
|
-
Copyright for portions of global-jsdom are held by Rico Sta. Cruz, 2016 as part of
|
|
13
|
-
jsdom-global. All other copyright for global-jsdom are held by jonathan schatz, 2017.
|
|
14
|
-
|
|
15
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
-
in the Software without restriction, including without limitation the rights
|
|
18
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
-
furnished to do so, subject to the following conditions:
|
|
21
|
-
|
|
22
|
-
The above copyright notice and this permission notice shall be included in all
|
|
23
|
-
copies or substantial portions of the Software.
|
|
24
|
-
|
|
25
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
-
SOFTWARE.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const defaultHtml = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>';
|
|
36
|
-
|
|
37
|
-
// define this here so that we only ever dynamically populate KEYS once.
|
|
38
|
-
|
|
39
|
-
const KEYS = [];
|
|
40
|
-
|
|
41
|
-
function jsdomGlobal(html = defaultHtml, options = {}) {
|
|
42
|
-
// Idempotency
|
|
43
|
-
if (global.navigator
|
|
44
|
-
&& global.navigator.userAgent
|
|
45
|
-
&& global.navigator.userAgent.includes('Node.js')
|
|
46
|
-
&& global.document
|
|
47
|
-
&& typeof global.document.destroy === 'function')
|
|
48
|
-
return global.document.destroy
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
global.
|
|
78
|
-
window
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
9
|
+
/*
|
|
10
|
+
MIT License
|
|
11
|
+
|
|
12
|
+
Copyright for portions of global-jsdom are held by Rico Sta. Cruz, 2016 as part of
|
|
13
|
+
jsdom-global. All other copyright for global-jsdom are held by jonathan schatz, 2017.
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const defaultHtml = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>';
|
|
36
|
+
|
|
37
|
+
// define this here so that we only ever dynamically populate KEYS once.
|
|
38
|
+
|
|
39
|
+
const KEYS = [];
|
|
40
|
+
|
|
41
|
+
function jsdomGlobal(html = defaultHtml, options = {}) {
|
|
42
|
+
// Idempotency
|
|
43
|
+
if (global.navigator
|
|
44
|
+
&& global.navigator.userAgent
|
|
45
|
+
&& global.navigator.userAgent.includes('Node.js')
|
|
46
|
+
&& global.document
|
|
47
|
+
&& typeof global.document.destroy === 'function') {
|
|
48
|
+
return global.document.destroy
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// set a default url if we don't get one - otherwise things explode when we copy localstorage keys
|
|
52
|
+
if (!('url' in options))
|
|
53
|
+
Object.assign(options, { url: 'http://localhost:3000' });
|
|
54
|
+
|
|
55
|
+
// enable pretendToBeVisual by default since react needs
|
|
56
|
+
// window.requestAnimationFrame, see https://github.com/jsdom/jsdom#pretending-to-be-a-visual-browser
|
|
57
|
+
if (!('pretendToBeVisual' in options))
|
|
58
|
+
Object.assign(options, { pretendToBeVisual: true });
|
|
59
|
+
|
|
60
|
+
const jsdom = new JSDOM__default.JSDOM(html, options);
|
|
61
|
+
const { window } = jsdom;
|
|
62
|
+
const { document } = window;
|
|
63
|
+
|
|
64
|
+
// generate our list of keys by enumerating document.window - this list may vary
|
|
65
|
+
// based on the jsdom version. filter out internal methods as well as anything
|
|
66
|
+
// that node already defines
|
|
67
|
+
|
|
68
|
+
if (KEYS.length === 0) {
|
|
69
|
+
KEYS.push(...Object.getOwnPropertyNames(window).filter(k => !k.startsWith('_')).filter(k => !(k in global)));
|
|
70
|
+
// going to add our jsdom instance, see below
|
|
71
|
+
KEYS.push('$jsdom');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
KEYS.forEach(key => global[key] = window[key]);
|
|
75
|
+
|
|
76
|
+
// setup document / window / window.console
|
|
77
|
+
global.document = document;
|
|
78
|
+
global.window = window;
|
|
79
|
+
window.console = global.console;
|
|
80
|
+
|
|
81
|
+
// add access to our jsdom instance
|
|
82
|
+
global.$jsdom = jsdom;
|
|
83
|
+
|
|
84
|
+
const cleanup = () => KEYS.forEach(key => delete global[key]);
|
|
85
|
+
|
|
86
|
+
document.destroy = cleanup;
|
|
87
|
+
|
|
88
|
+
return cleanup
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
exports.jsdomGlobal = jsdomGlobal;
|
|
@@ -1,84 +1,85 @@
|
|
|
1
1
|
import JSDOM from 'jsdom';
|
|
2
2
|
|
|
3
|
-
/*
|
|
4
|
-
MIT License
|
|
5
|
-
|
|
6
|
-
Copyright for portions of global-jsdom are held by Rico Sta. Cruz, 2016 as part of
|
|
7
|
-
jsdom-global. All other copyright for global-jsdom are held by jonathan schatz, 2017.
|
|
8
|
-
|
|
9
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
in the Software without restriction, including without limitation the rights
|
|
12
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
furnished to do so, subject to the following conditions:
|
|
15
|
-
|
|
16
|
-
The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
copies or substantial portions of the Software.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const defaultHtml = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>';
|
|
30
|
-
|
|
31
|
-
// define this here so that we only ever dynamically populate KEYS once.
|
|
32
|
-
|
|
33
|
-
const KEYS = [];
|
|
34
|
-
|
|
35
|
-
function jsdomGlobal(html = defaultHtml, options = {}) {
|
|
36
|
-
// Idempotency
|
|
37
|
-
if (global.navigator
|
|
38
|
-
&& global.navigator.userAgent
|
|
39
|
-
&& global.navigator.userAgent.includes('Node.js')
|
|
40
|
-
&& global.document
|
|
41
|
-
&& typeof global.document.destroy === 'function')
|
|
42
|
-
return global.document.destroy
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
const {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
global.
|
|
72
|
-
window
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
3
|
+
/*
|
|
4
|
+
MIT License
|
|
5
|
+
|
|
6
|
+
Copyright for portions of global-jsdom are held by Rico Sta. Cruz, 2016 as part of
|
|
7
|
+
jsdom-global. All other copyright for global-jsdom are held by jonathan schatz, 2017.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const defaultHtml = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>';
|
|
30
|
+
|
|
31
|
+
// define this here so that we only ever dynamically populate KEYS once.
|
|
32
|
+
|
|
33
|
+
const KEYS = [];
|
|
34
|
+
|
|
35
|
+
function jsdomGlobal(html = defaultHtml, options = {}) {
|
|
36
|
+
// Idempotency
|
|
37
|
+
if (global.navigator
|
|
38
|
+
&& global.navigator.userAgent
|
|
39
|
+
&& global.navigator.userAgent.includes('Node.js')
|
|
40
|
+
&& global.document
|
|
41
|
+
&& typeof global.document.destroy === 'function') {
|
|
42
|
+
return global.document.destroy
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// set a default url if we don't get one - otherwise things explode when we copy localstorage keys
|
|
46
|
+
if (!('url' in options))
|
|
47
|
+
Object.assign(options, { url: 'http://localhost:3000' });
|
|
48
|
+
|
|
49
|
+
// enable pretendToBeVisual by default since react needs
|
|
50
|
+
// window.requestAnimationFrame, see https://github.com/jsdom/jsdom#pretending-to-be-a-visual-browser
|
|
51
|
+
if (!('pretendToBeVisual' in options))
|
|
52
|
+
Object.assign(options, { pretendToBeVisual: true });
|
|
53
|
+
|
|
54
|
+
const jsdom = new JSDOM.JSDOM(html, options);
|
|
55
|
+
const { window } = jsdom;
|
|
56
|
+
const { document } = window;
|
|
57
|
+
|
|
58
|
+
// generate our list of keys by enumerating document.window - this list may vary
|
|
59
|
+
// based on the jsdom version. filter out internal methods as well as anything
|
|
60
|
+
// that node already defines
|
|
61
|
+
|
|
62
|
+
if (KEYS.length === 0) {
|
|
63
|
+
KEYS.push(...Object.getOwnPropertyNames(window).filter(k => !k.startsWith('_')).filter(k => !(k in global)));
|
|
64
|
+
// going to add our jsdom instance, see below
|
|
65
|
+
KEYS.push('$jsdom');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
KEYS.forEach(key => global[key] = window[key]);
|
|
69
|
+
|
|
70
|
+
// setup document / window / window.console
|
|
71
|
+
global.document = document;
|
|
72
|
+
global.window = window;
|
|
73
|
+
window.console = global.console;
|
|
74
|
+
|
|
75
|
+
// add access to our jsdom instance
|
|
76
|
+
global.$jsdom = jsdom;
|
|
77
|
+
|
|
78
|
+
const cleanup = () => KEYS.forEach(key => delete global[key]);
|
|
79
|
+
|
|
80
|
+
document.destroy = cleanup;
|
|
81
|
+
|
|
82
|
+
return cleanup
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export { jsdomGlobal };
|
|
@@ -4,7 +4,7 @@ const client = require('react-dom/client');
|
|
|
4
4
|
const reactHelmetAsync = require('react-helmet-async');
|
|
5
5
|
const React = require('react');
|
|
6
6
|
const ClientOnly = require('../shared/vite-react-ssg.c1d49976.cjs');
|
|
7
|
-
const state = require('../shared/vite-react-ssg.
|
|
7
|
+
const state = require('../shared/vite-react-ssg.bee8a5a9.cjs');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.
|
|
3
|
-
export { 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.870c683b.cjs';
|
|
3
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.cjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.cjs';
|
|
5
5
|
import 'critters';
|
|
6
6
|
import 'react-router-dom';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.
|
|
3
|
-
export { 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.870c683b.mjs';
|
|
3
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.mjs';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.mjs';
|
|
5
5
|
import 'critters';
|
|
6
6
|
import 'react-router-dom';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from '../shared/vite-react-ssg.
|
|
3
|
-
export { 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.870c683b.js';
|
|
3
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, c as RouterOptions, S as StyleCollector, b as ViteReactSSGOptions } from '../shared/vite-react-ssg.870c683b.js';
|
|
4
4
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.faf3855a.js';
|
|
5
5
|
import 'critters';
|
|
6
6
|
import 'react-router-dom';
|
|
@@ -3,7 +3,7 @@ import { HelmetProvider } from 'react-helmet-async';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { d as documentReady } from '../shared/vite-react-ssg.a292c181.mjs';
|
|
5
5
|
export { C as ClientOnly, H as Head } from '../shared/vite-react-ssg.a292c181.mjs';
|
|
6
|
-
import { d as deserializeState } from '../shared/vite-react-ssg.
|
|
6
|
+
import { d as deserializeState } from '../shared/vite-react-ssg.579feabb.mjs';
|
|
7
7
|
|
|
8
8
|
function ViteReactSSG(App, fn, options = {}) {
|
|
9
9
|
const {
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const client = require('react-dom/client');
|
|
|
5
5
|
const reactHelmetAsync = require('react-helmet-async');
|
|
6
6
|
const reactRouterDom = require('react-router-dom');
|
|
7
7
|
const ClientOnly = require('./shared/vite-react-ssg.c1d49976.cjs');
|
|
8
|
-
const state = require('./shared/vite-react-ssg.
|
|
8
|
+
const state = require('./shared/vite-react-ssg.bee8a5a9.cjs');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
11
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { 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.870c683b.cjs';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.cjs';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.cjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { 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.870c683b.mjs';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.mjs';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.mjs';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as RouterOptions, V as ViteReactSSGContext, a as ViteReactSSGClientOptions } from './shared/vite-react-ssg.
|
|
2
|
-
export { 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.870c683b.js';
|
|
2
|
+
export { I as IndexRouteRecord, N as NonIndexRouteRecord, R as RouteRecord, S as StyleCollector, b as ViteReactSSGOptions } from './shared/vite-react-ssg.870c683b.js';
|
|
3
3
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.faf3855a.js';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { HelmetProvider } from 'react-helmet-async';
|
|
|
4
4
|
import { useLinkClickHandler, Link as Link$1, NavLink as NavLink$1, matchRoutes, createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
5
5
|
import { d as documentReady } from './shared/vite-react-ssg.a292c181.mjs';
|
|
6
6
|
export { C as ClientOnly, H as Head } from './shared/vite-react-ssg.a292c181.mjs';
|
|
7
|
-
import { d as deserializeState } from './shared/vite-react-ssg.
|
|
7
|
+
import { d as deserializeState } from './shared/vite-react-ssg.579feabb.mjs';
|
|
8
8
|
|
|
9
9
|
const Link = forwardRef((props, ref) => {
|
|
10
10
|
const {
|
package/dist/node/cli.cjs
CHANGED
|
@@ -3,61 +3,29 @@
|
|
|
3
3
|
const kolorist = require('kolorist');
|
|
4
4
|
const yargs = require('yargs');
|
|
5
5
|
const helpers = require('yargs/helpers');
|
|
6
|
-
const webFetch = require('@remix-run/web-fetch');
|
|
7
6
|
const node = require('../node.cjs');
|
|
7
|
+
const webFetch = require('@remix-run/web-fetch');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:module');
|
|
10
10
|
require('fs-extra');
|
|
11
11
|
require('vite');
|
|
12
12
|
require('jsdom');
|
|
13
|
-
require('../shared/vite-react-ssg.
|
|
13
|
+
require('../shared/vite-react-ssg.bee8a5a9.cjs');
|
|
14
14
|
require('node:fs');
|
|
15
15
|
require('react');
|
|
16
16
|
require('react-helmet-async');
|
|
17
17
|
require('node:stream');
|
|
18
18
|
require('react-dom/server');
|
|
19
|
-
require('node:https');
|
|
20
|
-
require('express');
|
|
21
|
-
require('@childrentime/devcert');
|
|
22
19
|
|
|
23
20
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
24
21
|
|
|
25
22
|
const yargs__default = /*#__PURE__*/_interopDefaultCompat(yargs);
|
|
26
23
|
|
|
27
|
-
class NodeRequest extends webFetch.Request {
|
|
28
|
-
constructor(info, init) {
|
|
29
|
-
super(info, init);
|
|
30
|
-
}
|
|
31
|
-
get headers() {
|
|
32
|
-
return super.headers;
|
|
33
|
-
}
|
|
34
|
-
clone() {
|
|
35
|
-
return new NodeRequest(this);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
class NodeResponse extends webFetch.Response {
|
|
39
|
-
get headers() {
|
|
40
|
-
return super.headers;
|
|
41
|
-
}
|
|
42
|
-
clone() {
|
|
43
|
-
return super.clone();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const fetch = (info, init) => {
|
|
47
|
-
init = {
|
|
48
|
-
// Disable compression handling so people can return the result of a fetch
|
|
49
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
50
|
-
compress: false,
|
|
51
|
-
...init
|
|
52
|
-
};
|
|
53
|
-
return webFetch.fetch(info, init);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
24
|
function installGlobals() {
|
|
57
25
|
global.Headers = webFetch.Headers;
|
|
58
|
-
global.Request =
|
|
59
|
-
global.Response =
|
|
60
|
-
global.fetch = fetch;
|
|
26
|
+
global.Request = webFetch.Request;
|
|
27
|
+
global.Response = webFetch.Response;
|
|
28
|
+
global.fetch = webFetch.fetch;
|
|
61
29
|
global.FormData = webFetch.FormData;
|
|
62
30
|
}
|
|
63
31
|
|
|
@@ -101,10 +69,13 @@ yargs__default(helpers.hideBin(process.argv)).scriptName("vite-react-ssg").usage
|
|
|
101
69
|
alias: "b",
|
|
102
70
|
type: "string",
|
|
103
71
|
describe: "The base path to render"
|
|
72
|
+
}).option("host", {
|
|
73
|
+
type: "boolean",
|
|
74
|
+
describe: "The host to expose"
|
|
104
75
|
}),
|
|
105
76
|
async (args) => {
|
|
106
|
-
const { config: configFile = void 0, ...ssgOptions } = args;
|
|
107
|
-
await node.dev(ssgOptions, { configFile });
|
|
77
|
+
const { config: configFile = void 0, host, ...ssgOptions } = args;
|
|
78
|
+
await node.dev(ssgOptions, { configFile, server: { host } });
|
|
108
79
|
}
|
|
109
80
|
).fail((msg, err, yargs2) => {
|
|
110
81
|
console.error(`
|
package/dist/node/cli.mjs
CHANGED
|
@@ -1,56 +1,24 @@
|
|
|
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 { Request, Response, fetch as fetch$1, Headers, FormData } from '@remix-run/web-fetch';
|
|
5
4
|
import { build, dev } from '../node.mjs';
|
|
5
|
+
import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:module';
|
|
8
8
|
import 'fs-extra';
|
|
9
9
|
import 'vite';
|
|
10
10
|
import 'jsdom';
|
|
11
|
-
import '../shared/vite-react-ssg.
|
|
11
|
+
import '../shared/vite-react-ssg.579feabb.mjs';
|
|
12
12
|
import 'node:fs';
|
|
13
13
|
import 'react';
|
|
14
14
|
import 'react-helmet-async';
|
|
15
15
|
import 'node:stream';
|
|
16
16
|
import 'react-dom/server';
|
|
17
|
-
import 'node:https';
|
|
18
|
-
import 'express';
|
|
19
|
-
import '@childrentime/devcert';
|
|
20
|
-
|
|
21
|
-
class NodeRequest extends Request {
|
|
22
|
-
constructor(info, init) {
|
|
23
|
-
super(info, init);
|
|
24
|
-
}
|
|
25
|
-
get headers() {
|
|
26
|
-
return super.headers;
|
|
27
|
-
}
|
|
28
|
-
clone() {
|
|
29
|
-
return new NodeRequest(this);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
class NodeResponse extends Response {
|
|
33
|
-
get headers() {
|
|
34
|
-
return super.headers;
|
|
35
|
-
}
|
|
36
|
-
clone() {
|
|
37
|
-
return super.clone();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const fetch = (info, init) => {
|
|
41
|
-
init = {
|
|
42
|
-
// Disable compression handling so people can return the result of a fetch
|
|
43
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
44
|
-
compress: false,
|
|
45
|
-
...init
|
|
46
|
-
};
|
|
47
|
-
return fetch$1(info, init);
|
|
48
|
-
};
|
|
49
17
|
|
|
50
18
|
function installGlobals() {
|
|
51
19
|
global.Headers = Headers;
|
|
52
|
-
global.Request =
|
|
53
|
-
global.Response =
|
|
20
|
+
global.Request = Request;
|
|
21
|
+
global.Response = Response;
|
|
54
22
|
global.fetch = fetch;
|
|
55
23
|
global.FormData = FormData;
|
|
56
24
|
}
|
|
@@ -95,10 +63,13 @@ yargs(hideBin(process.argv)).scriptName("vite-react-ssg").usage("$0 [args]").com
|
|
|
95
63
|
alias: "b",
|
|
96
64
|
type: "string",
|
|
97
65
|
describe: "The base path to render"
|
|
66
|
+
}).option("host", {
|
|
67
|
+
type: "boolean",
|
|
68
|
+
describe: "The host to expose"
|
|
98
69
|
}),
|
|
99
70
|
async (args) => {
|
|
100
|
-
const { config: configFile = void 0, ...ssgOptions } = args;
|
|
101
|
-
await dev(ssgOptions, { configFile });
|
|
71
|
+
const { config: configFile = void 0, host, ...ssgOptions } = args;
|
|
72
|
+
await dev(ssgOptions, { configFile, server: { host } });
|
|
102
73
|
}
|
|
103
74
|
).fail((msg, err, yargs2) => {
|
|
104
75
|
console.error(`
|