vite-ssg-optimized 0.24.2-optimized.31 → 0.24.2-optimized.32
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/dist/node/cli.cjs +1 -1
- package/dist/node/cli.mjs +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +1 -1
- package/dist/shared/build.worker.cjs +6 -6
- package/dist/shared/build.worker.mjs +6 -6
- package/dist/shared/{vite-ssg-optimized.44cef1f4.mjs → vite-ssg-optimized.15723e40.mjs} +5 -1
- package/dist/shared/{vite-ssg-optimized.1efabb47.cjs → vite-ssg-optimized.a7858429.cjs} +7 -3
- package/package.json +1 -1
package/dist/node/cli.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const process = require('node:process');
|
|
|
4
4
|
const kolorist = require('kolorist');
|
|
5
5
|
const yargs = require('yargs');
|
|
6
6
|
const helpers = require('yargs/helpers');
|
|
7
|
-
const node = require('../shared/vite-ssg-optimized.
|
|
7
|
+
const node = require('../shared/vite-ssg-optimized.a7858429.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('node:path');
|
|
10
10
|
require('@unhead/ssr');
|
package/dist/node/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import process from 'node:process';
|
|
|
2
2
|
import { gray, bold, red, reset, underline } from 'kolorist';
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
|
-
import { b as build } from '../shared/vite-ssg-optimized.
|
|
5
|
+
import { b as build } from '../shared/vite-ssg-optimized.15723e40.mjs';
|
|
6
6
|
import 'node:module';
|
|
7
7
|
import 'node:path';
|
|
8
8
|
import '@unhead/ssr';
|
package/dist/node.cjs
CHANGED
package/dist/node.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const node_module = require('node:module');
|
|
4
4
|
const node_worker_threads = require('node:worker_threads');
|
|
5
|
-
const node = require('./vite-ssg-optimized.
|
|
5
|
+
const node = require('./vite-ssg-optimized.a7858429.cjs');
|
|
6
6
|
const kolorist = require('kolorist');
|
|
7
7
|
const vite = require('vite');
|
|
8
8
|
require('node:path');
|
|
@@ -84,13 +84,13 @@ async function getBeastiesOrCritters(outDir, options = {}) {
|
|
|
84
84
|
createAppPromise ?? (createAppPromise = Promise.resolve(format === "esm" ? import(serverEntry) : _require(serverEntry)).then(({ createApp: createApp2 }) => createApp2));
|
|
85
85
|
const createApp = await createAppPromise;
|
|
86
86
|
const beastiesOptions = opts.beastiesOptions;
|
|
87
|
-
beastiesPromise ?? (beastiesPromise = Promise.resolve(beastiesOptions !== false ? getBeastiesOrCritters(outDir, beastiesOptions) : void 0).then((
|
|
88
|
-
if (!
|
|
87
|
+
beastiesPromise ?? (beastiesPromise = Promise.resolve(beastiesOptions !== false ? getBeastiesOrCritters(outDir, beastiesOptions) : void 0).then((beasties2) => {
|
|
88
|
+
if (!beasties2)
|
|
89
89
|
return;
|
|
90
90
|
console.log(`${kolorist.gray("[vite-ssg]")} ${kolorist.blue("Critical CSS generation enabled via `beasties`")}`);
|
|
91
|
-
return
|
|
91
|
+
return beasties2;
|
|
92
92
|
}));
|
|
93
|
-
const
|
|
93
|
+
const beasties = await beastiesPromise;
|
|
94
94
|
const newOpts = {
|
|
95
95
|
...extraOpts,
|
|
96
96
|
out,
|
|
@@ -100,7 +100,7 @@ async function getBeastiesOrCritters(outDir, options = {}) {
|
|
|
100
100
|
onPageRendered,
|
|
101
101
|
onBeforePageRender,
|
|
102
102
|
// onDonePageRender: onDonePageRender,
|
|
103
|
-
beasties
|
|
103
|
+
beasties,
|
|
104
104
|
config: { logger: { info: (msg) => {
|
|
105
105
|
node_worker_threads.parentPort.postMessage({ type: "log", args: [msg] });
|
|
106
106
|
} } },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { parentPort, workerData } from 'node:worker_threads';
|
|
3
|
-
import { p as plainify, e as executeTaskFn, a as buildClient, c as buildServer } from './vite-ssg-optimized.
|
|
3
|
+
import { p as plainify, e as executeTaskFn, a as buildClient, c as buildServer } from './vite-ssg-optimized.15723e40.mjs';
|
|
4
4
|
import { red, gray, blue } from 'kolorist';
|
|
5
5
|
import { resolveConfig } from 'vite';
|
|
6
6
|
import 'node:path';
|
|
@@ -81,13 +81,13 @@ async function getBeastiesOrCritters(outDir, options = {}) {
|
|
|
81
81
|
createAppPromise ?? (createAppPromise = Promise.resolve(format === "esm" ? import(serverEntry) : _require(serverEntry)).then(({ createApp: createApp2 }) => createApp2));
|
|
82
82
|
const createApp = await createAppPromise;
|
|
83
83
|
const beastiesOptions = opts.beastiesOptions;
|
|
84
|
-
beastiesPromise ?? (beastiesPromise = Promise.resolve(beastiesOptions !== false ? getBeastiesOrCritters(outDir, beastiesOptions) : void 0).then((
|
|
85
|
-
if (!
|
|
84
|
+
beastiesPromise ?? (beastiesPromise = Promise.resolve(beastiesOptions !== false ? getBeastiesOrCritters(outDir, beastiesOptions) : void 0).then((beasties2) => {
|
|
85
|
+
if (!beasties2)
|
|
86
86
|
return;
|
|
87
87
|
console.log(`${gray("[vite-ssg]")} ${blue("Critical CSS generation enabled via `beasties`")}`);
|
|
88
|
-
return
|
|
88
|
+
return beasties2;
|
|
89
89
|
}));
|
|
90
|
-
const
|
|
90
|
+
const beasties = await beastiesPromise;
|
|
91
91
|
const newOpts = {
|
|
92
92
|
...extraOpts,
|
|
93
93
|
out,
|
|
@@ -97,7 +97,7 @@ async function getBeastiesOrCritters(outDir, options = {}) {
|
|
|
97
97
|
onPageRendered,
|
|
98
98
|
onBeforePageRender,
|
|
99
99
|
// onDonePageRender: onDonePageRender,
|
|
100
|
-
beasties
|
|
100
|
+
beasties,
|
|
101
101
|
config: { logger: { info: (msg) => {
|
|
102
102
|
parentPort.postMessage({ type: "log", args: [msg] });
|
|
103
103
|
} } },
|
|
@@ -1022,7 +1022,11 @@ class BuildWorkerProxy {
|
|
|
1022
1022
|
return;
|
|
1023
1023
|
const fn = console[level]?.bind(console);
|
|
1024
1024
|
const workerId = options.workerData.workerId;
|
|
1025
|
-
|
|
1025
|
+
const [first, ...rest] = args;
|
|
1026
|
+
const msg = typeof first === "string" ? first.replace(/^(?:\r?\n?)([\s\S]+?)(?:\r?\n?)$/, "$1") : void 0;
|
|
1027
|
+
const last = rest[rest.length - 1];
|
|
1028
|
+
const endMsg = last === void 0 ? reset("") : "";
|
|
1029
|
+
fn?.(`[woker #${workerId}] ${msg}${endMsg}`, msg, ...rest.slice(0, -1));
|
|
1026
1030
|
});
|
|
1027
1031
|
this.worker.on("message", (message) => {
|
|
1028
1032
|
const { id, type, result = void 0, error = void 0 } = message;
|
|
@@ -1031,7 +1031,11 @@ class BuildWorkerProxy {
|
|
|
1031
1031
|
return;
|
|
1032
1032
|
const fn = console[level]?.bind(console);
|
|
1033
1033
|
const workerId = options.workerData.workerId;
|
|
1034
|
-
|
|
1034
|
+
const [first, ...rest] = args;
|
|
1035
|
+
const msg = typeof first === "string" ? first.replace(/^(?:\r?\n?)([\s\S]+?)(?:\r?\n?)$/, "$1") : void 0;
|
|
1036
|
+
const last = rest[rest.length - 1];
|
|
1037
|
+
const endMsg = last === void 0 ? kolorist.reset("") : "";
|
|
1038
|
+
fn?.(`[woker #${workerId}] ${msg}${endMsg}`, msg, ...rest.slice(0, -1));
|
|
1035
1039
|
});
|
|
1036
1040
|
this.worker.on("message", (message) => {
|
|
1037
1041
|
const { id, type, result = void 0, error = void 0 } = message;
|
|
@@ -1122,7 +1126,7 @@ async function buildServer(config, viteConfig, { ssrEntry, ssgOut, format, mock
|
|
|
1122
1126
|
}
|
|
1123
1127
|
function createProxy(options) {
|
|
1124
1128
|
const workerExt = options.format === "esm" ? ".mjs" : ".cjs";
|
|
1125
|
-
const workerProxy = new BuildWorkerProxy(new URL(`./build.worker${workerExt}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-ssg-optimized.
|
|
1129
|
+
const workerProxy = new BuildWorkerProxy(new URL(`./build.worker${workerExt}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/vite-ssg-optimized.a7858429.cjs', document.baseURI).href))), {
|
|
1126
1130
|
env: process__default.env,
|
|
1127
1131
|
workerData: options
|
|
1128
1132
|
});
|
|
@@ -1230,7 +1234,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1230
1234
|
return worker;
|
|
1231
1235
|
};
|
|
1232
1236
|
const serverEntry = prefix + node_path.join(ssgOut, node_path.parse(ssrEntry).name + ext).replace(/\\/g, "/");
|
|
1233
|
-
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-ssg-optimized.
|
|
1237
|
+
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-ssg-optimized.a7858429.cjs', document.baseURI).href)));
|
|
1234
1238
|
const { createApp, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
|
|
1235
1239
|
const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
|
|
1236
1240
|
const { routes } = await createApp(false);
|