vite-ssg-optimized 0.24.2-optimized.48 → 0.24.2-optimized.49
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 +1 -1
- package/dist/shared/build.worker.mjs +1 -1
- package/dist/shared/{vite-ssg-optimized.72fc9757.mjs → vite-ssg-optimized.0dfc50c9.mjs} +8 -3
- package/dist/shared/{vite-ssg-optimized.bb5ba938.cjs → vite-ssg-optimized.635b4c57.cjs} +10 -5
- 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.635b4c57.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.0dfc50c9.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.635b4c57.cjs');
|
|
6
6
|
const kolorist = require('kolorist');
|
|
7
7
|
const vite = require('vite');
|
|
8
8
|
require('node:path');
|
|
@@ -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.0dfc50c9.mjs';
|
|
4
4
|
import { red, gray, blue } from 'kolorist';
|
|
5
5
|
import { resolveConfig } from 'vite';
|
|
6
6
|
import 'node:path';
|
|
@@ -1015,7 +1015,9 @@ class BuildWorkerProxy {
|
|
|
1015
1015
|
constructor(path, options) {
|
|
1016
1016
|
__publicField(this, "worker");
|
|
1017
1017
|
__publicField(this, "pending", /* @__PURE__ */ new Map());
|
|
1018
|
+
__publicField(this, "_id");
|
|
1018
1019
|
this.worker = new Worker(path, options);
|
|
1020
|
+
this._id = options.workerData.workerId;
|
|
1019
1021
|
this.worker.on("message", (message) => {
|
|
1020
1022
|
const { type, level = "info", args = [] } = message;
|
|
1021
1023
|
if (type !== "log")
|
|
@@ -1037,6 +1039,9 @@ class BuildWorkerProxy {
|
|
|
1037
1039
|
}
|
|
1038
1040
|
});
|
|
1039
1041
|
}
|
|
1042
|
+
get id() {
|
|
1043
|
+
return this._id;
|
|
1044
|
+
}
|
|
1040
1045
|
on(type, listener) {
|
|
1041
1046
|
this.worker.on(type, listener);
|
|
1042
1047
|
}
|
|
@@ -1265,7 +1270,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1265
1270
|
const IS_PROD = nodeEnv === "production";
|
|
1266
1271
|
indexHTML = await formatHtml(indexHTML, IS_PROD ? "minify" : formatting, minifyOptions);
|
|
1267
1272
|
const workerRunCount = /* @__PURE__ */ new WeakMap();
|
|
1268
|
-
const MAX_RUNS_PER_WORKER =
|
|
1273
|
+
const MAX_RUNS_PER_WORKER = 100;
|
|
1269
1274
|
let lastWorkerIndex = workers.length - 1;
|
|
1270
1275
|
function replaceWorker(workerProxy) {
|
|
1271
1276
|
const index = workers.indexOf(workerProxy);
|
|
@@ -1273,14 +1278,14 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1273
1278
|
return workerProxy;
|
|
1274
1279
|
}
|
|
1275
1280
|
++lastWorkerIndex;
|
|
1276
|
-
config.logger.info(`${blue("[vite-ssg]")} ${yellow(`Replace worker #${
|
|
1281
|
+
config.logger.info(`${blue("[vite-ssg]")} ${yellow(`Replace worker #${workerProxy.id} => #${lastWorkerIndex}`)}`);
|
|
1277
1282
|
const workerPromises = workersInUse.get(workerProxy) || [];
|
|
1278
1283
|
const newWorkerProxy = createProxy({
|
|
1279
1284
|
...createProxyOptions,
|
|
1280
1285
|
workerId: lastWorkerIndex
|
|
1281
1286
|
});
|
|
1282
1287
|
workers[index] = newWorkerProxy;
|
|
1283
|
-
Promise.allSettled(workerPromises).then(async () => {
|
|
1288
|
+
Promise.allSettled([...workerPromises, Promise.resolve()]).then(async () => {
|
|
1284
1289
|
await terminateWorker(workerProxy, onFinished);
|
|
1285
1290
|
});
|
|
1286
1291
|
return newWorkerProxy;
|
|
@@ -1024,7 +1024,9 @@ class BuildWorkerProxy {
|
|
|
1024
1024
|
constructor(path, options) {
|
|
1025
1025
|
__publicField(this, "worker");
|
|
1026
1026
|
__publicField(this, "pending", /* @__PURE__ */ new Map());
|
|
1027
|
+
__publicField(this, "_id");
|
|
1027
1028
|
this.worker = new node_worker_threads.Worker(path, options);
|
|
1029
|
+
this._id = options.workerData.workerId;
|
|
1028
1030
|
this.worker.on("message", (message) => {
|
|
1029
1031
|
const { type, level = "info", args = [] } = message;
|
|
1030
1032
|
if (type !== "log")
|
|
@@ -1046,6 +1048,9 @@ class BuildWorkerProxy {
|
|
|
1046
1048
|
}
|
|
1047
1049
|
});
|
|
1048
1050
|
}
|
|
1051
|
+
get id() {
|
|
1052
|
+
return this._id;
|
|
1053
|
+
}
|
|
1049
1054
|
on(type, listener) {
|
|
1050
1055
|
this.worker.on(type, listener);
|
|
1051
1056
|
}
|
|
@@ -1127,7 +1132,7 @@ async function buildServer(config, viteConfig, { ssrEntry, ssgOut, format, mock
|
|
|
1127
1132
|
}
|
|
1128
1133
|
function createProxy(options) {
|
|
1129
1134
|
const workerExt = options.format === "esm" ? ".mjs" : ".cjs";
|
|
1130
|
-
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.
|
|
1135
|
+
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.635b4c57.cjs', document.baseURI).href))), {
|
|
1131
1136
|
env: process__default.env,
|
|
1132
1137
|
workerData: options
|
|
1133
1138
|
});
|
|
@@ -1252,7 +1257,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1252
1257
|
return worker;
|
|
1253
1258
|
};
|
|
1254
1259
|
const serverEntry = prefix + node_path.join(ssgOut, node_path.parse(ssrEntry).name + ext).replace(/\\/g, "/");
|
|
1255
|
-
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.
|
|
1260
|
+
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.635b4c57.cjs', document.baseURI).href)));
|
|
1256
1261
|
const { createApp, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
|
|
1257
1262
|
const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
|
|
1258
1263
|
const { routes } = await createApp(false);
|
|
@@ -1274,7 +1279,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1274
1279
|
const IS_PROD = nodeEnv === "production";
|
|
1275
1280
|
indexHTML = await formatHtml(indexHTML, IS_PROD ? "minify" : formatting, minifyOptions);
|
|
1276
1281
|
const workerRunCount = /* @__PURE__ */ new WeakMap();
|
|
1277
|
-
const MAX_RUNS_PER_WORKER =
|
|
1282
|
+
const MAX_RUNS_PER_WORKER = 100;
|
|
1278
1283
|
let lastWorkerIndex = workers.length - 1;
|
|
1279
1284
|
function replaceWorker(workerProxy) {
|
|
1280
1285
|
const index = workers.indexOf(workerProxy);
|
|
@@ -1282,14 +1287,14 @@ async function build(ssgOptions = {}, viteConfig = {}) {
|
|
|
1282
1287
|
return workerProxy;
|
|
1283
1288
|
}
|
|
1284
1289
|
++lastWorkerIndex;
|
|
1285
|
-
config.logger.info(`${kolorist.blue("[vite-ssg]")} ${kolorist.yellow(`Replace worker #${
|
|
1290
|
+
config.logger.info(`${kolorist.blue("[vite-ssg]")} ${kolorist.yellow(`Replace worker #${workerProxy.id} => #${lastWorkerIndex}`)}`);
|
|
1286
1291
|
const workerPromises = workersInUse.get(workerProxy) || [];
|
|
1287
1292
|
const newWorkerProxy = createProxy({
|
|
1288
1293
|
...createProxyOptions,
|
|
1289
1294
|
workerId: lastWorkerIndex
|
|
1290
1295
|
});
|
|
1291
1296
|
workers[index] = newWorkerProxy;
|
|
1292
|
-
Promise.allSettled(workerPromises).then(async () => {
|
|
1297
|
+
Promise.allSettled([...workerPromises, Promise.resolve()]).then(async () => {
|
|
1293
1298
|
await terminateWorker(workerProxy, onFinished);
|
|
1294
1299
|
});
|
|
1295
1300
|
return newWorkerProxy;
|