vite-ssg-optimized 0.24.2-optimized.7 → 0.24.2-optimized.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/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.79b21d74.cjs');
7
+ const node = require('../shared/vite-ssg-optimized.9966b43f.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.3819f58f.mjs';
5
+ import { b as build } from '../shared/vite-ssg-optimized.15646db4.mjs';
6
6
  import 'node:module';
7
7
  import 'node:path';
8
8
  import '@unhead/ssr';
package/dist/node.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const node = require('./shared/vite-ssg-optimized.79b21d74.cjs');
3
+ const node = require('./shared/vite-ssg-optimized.9966b43f.cjs');
4
4
  require('node:module');
5
5
  require('node:path');
6
6
  require('node:process');
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { b as build } from './shared/vite-ssg-optimized.3819f58f.mjs';
1
+ export { b as build } from './shared/vite-ssg-optimized.15646db4.mjs';
2
2
  import 'node:module';
3
3
  import 'node:path';
4
4
  import 'node:process';
@@ -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.79b21d74.cjs');
5
+ const node = require('./vite-ssg-optimized.9966b43f.cjs');
6
6
  const kolorist = require('kolorist');
7
7
  const vite = require('vite');
8
8
  require('node:path');
@@ -14,8 +14,28 @@ require('html5parser');
14
14
 
15
15
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
16
16
  (async () => {
17
- const fnLog = (level = "info", msg) => {
18
- node_worker_threads.parentPort.postMessage({ type: "log", args: [msg], level });
17
+ const plainnify = (m) => {
18
+ if (m instanceof Function) {
19
+ return void 0;
20
+ }
21
+ if (Array.isArray(m)) {
22
+ return m.map(plainnify);
23
+ }
24
+ if (typeof m === "object" && m !== null) {
25
+ return Object.entries(m).reduce((acc, [key, value]) => {
26
+ acc[key] = plainnify(value);
27
+ return acc;
28
+ }, {});
29
+ }
30
+ return m?.toString();
31
+ };
32
+ const fnLog = (level = "info", ...msg) => {
33
+ const newMsg = msg.map(plainnify);
34
+ if (level === "error") {
35
+ process.stderr.write(`${kolorist.red("[vite-ssg-worker]")} ${newMsg}
36
+ `);
37
+ }
38
+ node_worker_threads.parentPort.postMessage({ type: "log", args: newMsg, level });
19
39
  };
20
40
  globalThis.console = Object.assign(globalThis.console, {
21
41
  info: fnLog.bind(globalThis.console, "info"),
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import { parentPort, workerData } from 'node:worker_threads';
3
- import { g as getBeastiesOrCritters, e as executeTaskFn } from './vite-ssg-optimized.3819f58f.mjs';
3
+ import { g as getBeastiesOrCritters, e as executeTaskFn } from './vite-ssg-optimized.15646db4.mjs';
4
4
  import { gray, blue, red } from 'kolorist';
5
5
  import { resolveConfig } from 'vite';
6
6
  import 'node:path';
@@ -11,8 +11,28 @@ import './vite-ssg-optimized.579feabb.mjs';
11
11
  import 'html5parser';
12
12
 
13
13
  (async () => {
14
- const fnLog = (level = "info", msg) => {
15
- parentPort.postMessage({ type: "log", args: [msg], level });
14
+ const plainnify = (m) => {
15
+ if (m instanceof Function) {
16
+ return void 0;
17
+ }
18
+ if (Array.isArray(m)) {
19
+ return m.map(plainnify);
20
+ }
21
+ if (typeof m === "object" && m !== null) {
22
+ return Object.entries(m).reduce((acc, [key, value]) => {
23
+ acc[key] = plainnify(value);
24
+ return acc;
25
+ }, {});
26
+ }
27
+ return m?.toString();
28
+ };
29
+ const fnLog = (level = "info", ...msg) => {
30
+ const newMsg = msg.map(plainnify);
31
+ if (level === "error") {
32
+ process.stderr.write(`${red("[vite-ssg-worker]")} ${newMsg}
33
+ `);
34
+ }
35
+ parentPort.postMessage({ type: "log", args: newMsg, level });
16
36
  };
17
37
  globalThis.console = Object.assign(globalThis.console, {
18
38
  info: fnLog.bind(globalThis.console, "info"),
@@ -1050,9 +1050,8 @@ class BuildWorkerProxy {
1050
1050
  if (type !== "log")
1051
1051
  return;
1052
1052
  const fn = console[level]?.bind(console);
1053
- let msg = args.map((arg) => typeof arg === "object" && !!arg ? "[object]" : arg).join(" ");
1054
1053
  const workerId = options.workerData.workerId;
1055
- fn?.(`[woker #${workerId}] ${msg}`);
1054
+ fn?.(`[woker #${workerId}] `, ...args);
1056
1055
  });
1057
1056
  this.worker.on("message", (message) => {
1058
1057
  const { id, type, result = void 0, error = void 0 } = message;
@@ -1059,9 +1059,8 @@ class BuildWorkerProxy {
1059
1059
  if (type !== "log")
1060
1060
  return;
1061
1061
  const fn = console[level]?.bind(console);
1062
- let msg = args.map((arg) => typeof arg === "object" && !!arg ? "[object]" : arg).join(" ");
1063
1062
  const workerId = options.workerData.workerId;
1064
- fn?.(`[woker #${workerId}] ${msg}`);
1063
+ fn?.(`[woker #${workerId}] `, ...args);
1065
1064
  });
1066
1065
  this.worker.on("message", (message) => {
1067
1066
  const { id, type, result = void 0, error = void 0 } = message;
@@ -1193,7 +1192,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1193
1192
  const prefix = format === "esm" && process__default.platform === "win32" ? "file://" : "";
1194
1193
  const ext = format === "esm" ? ".mjs" : ".cjs";
1195
1194
  const serverEntry = prefix + node_path.join(ssgOut, node_path.parse(ssrEntry).name + ext).replace(/\\/g, "/");
1196
- 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.79b21d74.cjs', document.baseURI).href)));
1195
+ 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.9966b43f.cjs', document.baseURI).href)));
1197
1196
  const { createApp, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
1198
1197
  const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
1199
1198
  const { routes } = await createApp(false);
@@ -1220,7 +1219,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1220
1219
  const queue = new PQueue({ concurrency });
1221
1220
  const workerExt = format === "esm" ? ".mjs" : ".cjs";
1222
1221
  const createProxy = (index) => {
1223
- 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.79b21d74.cjs', document.baseURI).href))), {
1222
+ 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.9966b43f.cjs', document.baseURI).href))), {
1224
1223
  env: process__default.env,
1225
1224
  workerData: {
1226
1225
  workerId: index,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-ssg-optimized",
3
- "version": "0.24.2-optimized.7",
3
+ "version": "0.24.2-optimized.9",
4
4
  "description": "Server-side generation for Vite",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",