vite-react-ssg 0.6.3 → 0.6.4

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.
@@ -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,86 +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
- // 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
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
89
89
  }
90
90
 
91
91
  exports.jsdomGlobal = jsdomGlobal;
@@ -1,85 +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
- // 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
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
83
83
  }
84
84
 
85
85
  export { jsdomGlobal };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-react-ssg",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "packageManager": "pnpm@9.4.0",
6
6
  "description": "",
7
7
  "author": "Riri <Daydreamerriri@outlook.com>",
@@ -136,4 +136,4 @@
136
136
  "vite-plugin-pwa": "^0.17.4",
137
137
  "vitest": "1.6.0"
138
138
  }
139
- }
139
+ }