valaxy 1.0.0-rc.14 → 1.0.0-rc.15

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.
@@ -8,6 +8,11 @@ export let contentUpdatedCallbacks: (() => any)[] = []
8
8
  * in the DOM.
9
9
  */
10
10
  export function onContentUpdated(fn: () => any) {
11
+ // SSR never unmounts components, so this module-level array would retain
12
+ // every rendered page and its router. In the browser, register during setup
13
+ // so parent listeners exist when child content first mounts.
14
+ if (import.meta.env.SSR)
15
+ return
11
16
  contentUpdatedCallbacks.push(fn)
12
17
  onUnmounted(() => {
13
18
  contentUpdatedCallbacks = contentUpdatedCallbacks.filter(f => f !== fn)
@@ -2,7 +2,7 @@ import 'node:path';
2
2
  import 'node:process';
3
3
  import 'yargs';
4
4
  import 'yargs/helpers';
5
- export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a1 as run, a3 as startValaxyDev } from '../../shared/valaxy.DzzDX_BR.mjs';
5
+ export { c as createCli, s as desktopRuntimeVersion, u as execBuild, O as registerDevCommand, a1 as run, a3 as startValaxyDev } from '../../shared/valaxy.bxGGKf9c.mjs';
6
6
  import 'node:os';
7
7
  import 'consola';
8
8
  import 'consola/utils';
@@ -59,12 +59,11 @@ import 'unocss';
59
59
  import 'pascalcase';
60
60
  import 'html-to-text';
61
61
  import 'vue-router/vite';
62
- import 'node:child_process';
63
- import 'node:v8';
64
62
  import 'vite-ssg-sitemap';
65
63
  import '@unhead/vue/server';
66
64
  import 'vue-router/unplugin';
67
65
  import 'vue/compiler-sfc';
66
+ import 'node:child_process';
68
67
  import '@clack/prompts';
69
68
  import 'node:net';
70
69
  import 'node:readline';
@@ -1,4 +1,4 @@
1
- export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveImportPath, T as resolveImportUrl, U as resolveOptions, W as resolveSiteConfig, X as resolveSiteConfigFromRoot, Y as resolveThemeConfigFromRoot, Z as resolveThemeValaxyConfig, _ as resolveUserThemeConfig, $ as resolveValaxyConfig, a0 as resolveValaxyConfigFromRoot, a1 as run, a2 as ssgBuild, a3 as startValaxyDev, a4 as toAtFS, a5 as transformObject, a6 as version } from '../shared/valaxy.DzzDX_BR.mjs';
1
+ export { A as ALL_ROUTE, E as EXCERPT_SEPARATOR, G as GLOBAL_STATE, P as PATHNAME_PROTOCOL_RE, S as StateManager, V as ViteValaxyPlugins, b as build, c as createCli, a as createContentService, d as createMemoryReleasePlugin, e as createServer, f as createValaxyNode, g as createValaxyPlugin, h as customElements, i as defaultSiteConfig, j as defaultValaxyConfig, k as defaultViteConfig, l as defineAddon, m as defineConfig, n as defineSiteConfig, o as defineTheme, p as defineValaxyAddon, q as defineValaxyConfig, r as defineValaxyTheme, s as desktopRuntimeVersion, t as encryptContent, u as execBuild, v as generateClientRedirects, w as getGitTimestamp, x as getIndexHtml, y as getServerInfoText, z as isExternal, B as isInstalledGlobally, C as isKatexEnabled, D as isKatexPluginNeeded, F as isMathJaxEnabled, H as isPath, I as loadAllContent, J as loadConfigFromFile, K as mergeValaxyConfig, L as mergeViteConfigs, M as postProcessForSSG, N as processValaxyOptions, O as registerDevCommand, Q as resolveAddonsConfig, R as resolveImportPath, T as resolveImportUrl, U as resolveOptions, W as resolveSiteConfig, X as resolveSiteConfigFromRoot, Y as resolveThemeConfigFromRoot, Z as resolveThemeValaxyConfig, _ as resolveUserThemeConfig, $ as resolveValaxyConfig, a0 as resolveValaxyConfigFromRoot, a1 as run, a2 as ssgBuild, a3 as startValaxyDev, a4 as toAtFS, a5 as transformObject, a6 as version } from '../shared/valaxy.bxGGKf9c.mjs';
2
2
  import 'node:path';
3
3
  import 'consola';
4
4
  import 'fs-extra';
@@ -59,12 +59,11 @@ import 'unocss';
59
59
  import 'pascalcase';
60
60
  import 'html-to-text';
61
61
  import 'vue-router/vite';
62
- import 'node:child_process';
63
- import 'node:v8';
64
62
  import 'vite-ssg-sitemap';
65
63
  import '@unhead/vue/server';
66
64
  import 'vue-router/unplugin';
67
65
  import 'vue/compiler-sfc';
66
+ import 'node:child_process';
68
67
  import '@clack/prompts';
69
68
  import 'node:net';
70
69
  import 'node:readline';
@@ -59,19 +59,18 @@ import { transformerDirectives, transformerVariantGroup, presetWind4, presetAttr
59
59
  import pascalCase from 'pascalcase';
60
60
  import { convert } from 'html-to-text';
61
61
  import VueRouter from 'vue-router/vite';
62
- import { execFileSync, execSync, exec } from 'node:child_process';
63
- import v8 from 'node:v8';
64
62
  import generateSitemap from 'vite-ssg-sitemap';
65
63
  import { renderSSRHead } from '@unhead/vue/server';
66
64
  import { createRoutesContext, resolveOptions as resolveOptions$1 } from 'vue-router/unplugin';
67
65
  import { babelParse } from 'vue/compiler-sfc';
66
+ import { execSync, exec } from 'node:child_process';
68
67
  import { intro, confirm, isCancel, cancel, select, outro } from '@clack/prompts';
69
68
  import net from 'node:net';
70
69
  import * as readline from 'node:readline';
71
70
  import qrcode from 'qrcode';
72
71
  import ejs from 'ejs';
73
72
 
74
- const version = "1.0.0-rc.14";
73
+ const version = "1.0.0-rc.15";
75
74
 
76
75
  const GLOBAL_STATE = {
77
76
  valaxyApp: void 0,
@@ -5359,9 +5358,6 @@ function tryGC() {
5359
5358
  if (typeof globalThis.gc === "function")
5360
5359
  globalThis.gc();
5361
5360
  }
5362
- function getHeapLimitMB() {
5363
- return v8.getHeapStatistics().heap_size_limit / 1024 / 1024;
5364
- }
5365
5361
  function routesToPaths(routes) {
5366
5362
  if (!routes)
5367
5363
  return ["/"];
@@ -5389,40 +5385,6 @@ function getSsgSsrConfig() {
5389
5385
  }
5390
5386
  async function ssgBuild(valaxyApp, viteConfig = {}, userSsgOptions = {}) {
5391
5387
  const { options } = valaxyApp;
5392
- if (!process.env.__VALAXY_SSG_NO_RESPAWN__) {
5393
- const needGC = typeof globalThis.gc !== "function";
5394
- const currentHeapMB = getHeapLimitMB();
5395
- const minRequiredMB = 4096;
5396
- const needMoreHeap = currentHeapMB < minRequiredMB;
5397
- const needRespawn = needMoreHeap || needGC && currentHeapMB < minRequiredMB;
5398
- if (needRespawn) {
5399
- const extraNodeArgs = [];
5400
- if (needGC)
5401
- extraNodeArgs.push("--expose-gc");
5402
- if (needMoreHeap)
5403
- extraNodeArgs.push(`--max-old-space-size=${minRequiredMB}`);
5404
- consola.info(`Restarting SSG build with ${extraNodeArgs.join(" ")} (current heap: ${Math.round(currentHeapMB)} MB)...`);
5405
- const filteredExecArgv = needMoreHeap ? process.execArgv.filter((arg) => !arg.startsWith("--max-old-space-size") && !arg.startsWith("--max_old_space_size")) : process.execArgv;
5406
- const nodeArgs = [...extraNodeArgs, ...filteredExecArgv, ...process.argv.slice(1)];
5407
- try {
5408
- execFileSync(process.execPath, nodeArgs, {
5409
- cwd: process.cwd(),
5410
- stdio: "inherit",
5411
- env: { ...process.env, __VALAXY_SSG_NO_RESPAWN__: "1" },
5412
- timeout: 30 * 60 * 1e3
5413
- });
5414
- return;
5415
- } catch (e) {
5416
- if (e.signal) {
5417
- throw new Error(`SSG build was killed by signal ${e.signal}${e.signal === "SIGTERM" ? " (possible timeout)" : ""}`, { cause: e });
5418
- }
5419
- if (e.status != null && e.status !== 0) {
5420
- throw new Error(`SSG build failed (exit code: ${e.status})`, { cause: e });
5421
- }
5422
- throw e;
5423
- }
5424
- }
5425
- }
5426
5388
  const configOutDir = viteConfig.build?.outDir || "dist";
5427
5389
  const outDir = isAbsolute$1(configOutDir) ? configOutDir : resolve$1(options.userRoot, configOutDir);
5428
5390
  const ssgTemp = resolve$1(outDir, ".vite-ssg-temp");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.14",
4
+ "version": "1.0.0-rc.15",
5
5
  "description": "📄 Vite & Vue powered static blog generator.",
6
6
  "author": {
7
7
  "email": "me@yunyoujun.cn",
@@ -74,8 +74,8 @@
74
74
  "@unhead/bundler": "^3.4.1",
75
75
  "@unhead/schema-org": "^3.4.1",
76
76
  "@unhead/vue": "^3.4.1",
77
- "@valaxyjs/devtools": "1.0.0-rc.14",
78
- "@valaxyjs/utils": "1.0.0-rc.14",
77
+ "@valaxyjs/devtools": "1.0.0-rc.15",
78
+ "@valaxyjs/utils": "1.0.0-rc.15",
79
79
  "@vitejs/devtools": "0.7.5",
80
80
  "@vitejs/plugin-vue": "^6.0.9",
81
81
  "@vueuse/core": "^15.0.0",