vite-react-ssg 0.8.8 → 0.8.9
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
CHANGED
package/dist/node/cli.mjs
CHANGED
|
@@ -1,8 +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.
|
|
5
|
-
import { Headers, Request, Response, fetch, FormData } from '@remix-run/web-fetch';
|
|
4
|
+
import { b as build, d as dev } from '../shared/vite-react-ssg.qp2k9AZ2.mjs';
|
|
6
5
|
import 'node:module';
|
|
7
6
|
import 'node:path';
|
|
8
7
|
import 'fs-extra';
|
|
@@ -19,15 +18,6 @@ import '../shared/vite-react-ssg.C0y5wbxl.mjs';
|
|
|
19
18
|
import 'react-dom/server';
|
|
20
19
|
import '../shared/vite-react-ssg.B-j07kW6.mjs';
|
|
21
20
|
|
|
22
|
-
function installGlobals() {
|
|
23
|
-
global.Headers = Headers;
|
|
24
|
-
global.Request = Request;
|
|
25
|
-
global.Response = Response;
|
|
26
|
-
global.fetch = fetch;
|
|
27
|
-
global.FormData = FormData;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
installGlobals();
|
|
31
21
|
yargs(hideBin(process.argv)).scriptName("vite-react-ssg").usage("$0 [args]").command(
|
|
32
22
|
"build",
|
|
33
23
|
"Build SSG",
|
package/dist/node.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { join,
|
|
2
|
+
import { join, parse, isAbsolute, dirname } from 'node:path';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import { JSDOM } from 'jsdom';
|
|
5
5
|
import { gray, yellow, blue, dim, cyan, red, green, reset, bold, bgLightCyan } from 'kolorist';
|
|
@@ -356,7 +356,7 @@ class WritableAsPromise extends Writable {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
const version = "0.8.
|
|
359
|
+
const version = "0.8.9";
|
|
360
360
|
|
|
361
361
|
function buildLog(text, count) {
|
|
362
362
|
console.log(`
|
|
@@ -704,8 +704,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
704
704
|
const root = config.root || cwd;
|
|
705
705
|
const hash = Math.random().toString(36).substring(2, 12);
|
|
706
706
|
const ssgOut = join(root, ".vite-react-ssg-temp", hash);
|
|
707
|
-
|
|
708
|
-
const out = isAbsolute(outDir) ? outDir : join(root, outDir);
|
|
707
|
+
let outDir = config.build.outDir || "dist";
|
|
709
708
|
const configBase = config.base;
|
|
710
709
|
const mergedOptions = Object.assign({}, config.ssgOptions || {}, ssgOptions);
|
|
711
710
|
const {
|
|
@@ -752,7 +751,13 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
752
751
|
}
|
|
753
752
|
},
|
|
754
753
|
customLogger: clientLogger,
|
|
755
|
-
mode: config.mode
|
|
754
|
+
mode: config.mode,
|
|
755
|
+
plugins: [{
|
|
756
|
+
name: "vite-react-ssg:get-oup-dir",
|
|
757
|
+
configResolved(resolvedConfig) {
|
|
758
|
+
outDir = resolvedConfig.build.outDir || "dist";
|
|
759
|
+
}
|
|
760
|
+
}]
|
|
756
761
|
}));
|
|
757
762
|
let unmock = () => {
|
|
758
763
|
};
|
|
@@ -804,6 +809,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
804
809
|
const beasties = beastiesOptions !== false ? await getBeastiesOrCritters(outDir, { publicPath: configBase, ...beastiesOptions }) : void 0;
|
|
805
810
|
if (beasties)
|
|
806
811
|
console.log(`${gray("[vite-react-ssg]")} ${blue("Critical CSS generation enabled via `beasties`")}`);
|
|
812
|
+
const out = isAbsolute(outDir) ? outDir : join(root, outDir);
|
|
807
813
|
const ssrManifest = JSON.parse(await fs.readFile(join(out, ...dotVitedir, "ssr-manifest.json"), "utf-8"));
|
|
808
814
|
const manifest = JSON.parse(await fs.readFile(join(out, ...dotVitedir, "manifest.json"), "utf-8"));
|
|
809
815
|
let indexHTML = await fs.readFile(join(out, htmlEntry), "utf-8");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-react-ssg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.9",
|
|
5
5
|
"packageManager": "pnpm@10.12.1",
|
|
6
6
|
"description": "Static-site generation for React on Vite.",
|
|
7
7
|
"author": "Riri <Daydreamerriri@outlook.com>",
|
|
@@ -109,7 +109,6 @@
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"@remix-run/web-fetch": "^4.4.2",
|
|
113
112
|
"fs-extra": "^11.3.0",
|
|
114
113
|
"html5parser": "^2.0.2",
|
|
115
114
|
"jsdom": "^24.1.3",
|