vite-react-ssg 0.3.0 → 0.3.1

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 kolorist = require('kolorist');
4
4
  const yargs = require('yargs');
5
5
  const helpers = require('yargs/helpers');
6
6
  const webFetch = require('@remix-run/web-fetch');
7
- const dev = require('../shared/vite-react-ssg.677d2862.cjs');
7
+ const dev = require('../shared/vite-react-ssg.9cf631b2.cjs');
8
8
  require('node:path');
9
9
  require('node:module');
10
10
  require('fs-extra');
package/dist/node/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import { gray, bold, red, reset, underline } from 'kolorist';
2
2
  import yargs from 'yargs';
3
3
  import { hideBin } from 'yargs/helpers';
4
4
  import { Request, Response, fetch as fetch$1, Headers, FormData } from '@remix-run/web-fetch';
5
- import { b as build, d as dev } from '../shared/vite-react-ssg.eb444549.mjs';
5
+ import { b as build, d as dev } from '../shared/vite-react-ssg.f12aa7be.mjs';
6
6
  import 'node:path';
7
7
  import 'node:module';
8
8
  import 'fs-extra';
package/dist/node.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const dev = require('./shared/vite-react-ssg.677d2862.cjs');
3
+ const dev = require('./shared/vite-react-ssg.9cf631b2.cjs');
4
4
  require('node:path');
5
5
  require('node:module');
6
6
  require('kolorist');
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { b as build, d as dev } from './shared/vite-react-ssg.eb444549.mjs';
1
+ export { b as build, d as dev } from './shared/vite-react-ssg.f12aa7be.mjs';
2
2
  import 'node:path';
3
3
  import 'node:module';
4
4
  import 'kolorist';
@@ -950,7 +950,7 @@ async function resolveAlias(config, entry) {
950
950
  return result || node_path.join(config.root, entry);
951
951
  }
952
952
  const { version } = JSON.parse(
953
- node_fs.readFileSync(new URL("../../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('shared/vite-react-ssg.677d2862.cjs', document.baseURI).href)))).toString()
953
+ node_fs.readFileSync(new URL("../../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('shared/vite-react-ssg.9cf631b2.cjs', document.baseURI).href)))).toString()
954
954
  );
955
955
  function createRequest(path) {
956
956
  const url = new URL(path, "http://vite-react-ssg.com");
@@ -1233,7 +1233,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1233
1233
  const prefix = format === "esm" && process.platform === "win32" ? "file://" : "";
1234
1234
  const ext = format === "esm" ? ".mjs" : ".cjs";
1235
1235
  const serverEntry = node_path.join(prefix, ssgOut, node_path.parse(ssrEntry).name + ext);
1236
- const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('shared/vite-react-ssg.677d2862.cjs', document.baseURI).href)));
1236
+ const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('shared/vite-react-ssg.9cf631b2.cjs', document.baseURI).href)));
1237
1237
  const { createRoot, includedRoutes: serverEntryIncludedRoutes } = format === "esm" ? await import(serverEntry) : _require(serverEntry);
1238
1238
  const includedRoutes = serverEntryIncludedRoutes || configIncludedRoutes;
1239
1239
  const { routes } = await createRoot(false);
@@ -1252,15 +1252,16 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1252
1252
  let indexHTML = await fs__default.readFile(node_path.join(out, "index.html"), "utf-8");
1253
1253
  indexHTML = rewriteScripts(indexHTML, script);
1254
1254
  const queue = new PQueue({ concurrency });
1255
+ const crittersQueue = new PQueue({ concurrency: 1 });
1255
1256
  for (const path of routesPaths) {
1256
1257
  queue.add(async () => {
1257
1258
  try {
1258
1259
  const appCtx = await createRoot(false, path);
1259
- const { initialState, triggerOnSSRAppRendered, transformState = SiteMetadataDefaults.serializeState, getStyleCollector } = appCtx;
1260
+ const { initialState, routes: routes2, triggerOnSSRAppRendered, transformState = SiteMetadataDefaults.serializeState, getStyleCollector } = appCtx;
1260
1261
  const styleCollector = getStyleCollector ? await getStyleCollector() : null;
1261
1262
  const transformedIndexHTML = await onBeforePageRender?.(path, indexHTML, appCtx) || indexHTML;
1262
1263
  const request = createRequest(path);
1263
- const { appHTML, bodyAttributes, htmlAttributes, metaAttributes, styleTag } = await render(dataRoutes, request, styleCollector);
1264
+ const { appHTML, bodyAttributes, htmlAttributes, metaAttributes, styleTag } = await render([...routes2], request, styleCollector);
1264
1265
  await triggerOnSSRAppRendered?.(path, appHTML, appCtx);
1265
1266
  const renderedHTML = await renderHTML({
1266
1267
  rootContainerId,
@@ -1277,7 +1278,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1277
1278
  const html = jsdom.serialize();
1278
1279
  let transformed = await onPageRendered?.(path, html, appCtx) || html;
1279
1280
  if (critters)
1280
- transformed = await critters.process(transformed);
1281
+ transformed = await crittersQueue.add(() => critters.process(transformed));
1281
1282
  if (styleTag)
1282
1283
  transformed = transformed.replace("<head>", `<head>${styleTag}`);
1283
1284
  const formatted = await formatHtml(transformed, formatting);
@@ -1244,15 +1244,16 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1244
1244
  let indexHTML = await fs.readFile(join(out, "index.html"), "utf-8");
1245
1245
  indexHTML = rewriteScripts(indexHTML, script);
1246
1246
  const queue = new PQueue({ concurrency });
1247
+ const crittersQueue = new PQueue({ concurrency: 1 });
1247
1248
  for (const path of routesPaths) {
1248
1249
  queue.add(async () => {
1249
1250
  try {
1250
1251
  const appCtx = await createRoot(false, path);
1251
- const { initialState, triggerOnSSRAppRendered, transformState = serializeState, getStyleCollector } = appCtx;
1252
+ const { initialState, routes: routes2, triggerOnSSRAppRendered, transformState = serializeState, getStyleCollector } = appCtx;
1252
1253
  const styleCollector = getStyleCollector ? await getStyleCollector() : null;
1253
1254
  const transformedIndexHTML = await onBeforePageRender?.(path, indexHTML, appCtx) || indexHTML;
1254
1255
  const request = createRequest(path);
1255
- const { appHTML, bodyAttributes, htmlAttributes, metaAttributes, styleTag } = await render(dataRoutes, request, styleCollector);
1256
+ const { appHTML, bodyAttributes, htmlAttributes, metaAttributes, styleTag } = await render([...routes2], request, styleCollector);
1256
1257
  await triggerOnSSRAppRendered?.(path, appHTML, appCtx);
1257
1258
  const renderedHTML = await renderHTML({
1258
1259
  rootContainerId,
@@ -1269,7 +1270,7 @@ async function build(ssgOptions = {}, viteConfig = {}) {
1269
1270
  const html = jsdom.serialize();
1270
1271
  let transformed = await onPageRendered?.(path, html, appCtx) || html;
1271
1272
  if (critters)
1272
- transformed = await critters.process(transformed);
1273
+ transformed = await crittersQueue.add(() => critters.process(transformed));
1273
1274
  if (styleTag)
1274
1275
  transformed = transformed.replace("<head>", `<head>${styleTag}`);
1275
1276
  const formatted = await formatHtml(transformed, formatting);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-react-ssg",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "packageManager": "pnpm@8.6.6",
6
6
  "description": "",
7
7
  "author": "Riri <Daydreamerriri@outlook.com>",