@stati/core 1.26.0 → 1.26.2

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/README.md CHANGED
@@ -738,7 +738,7 @@ export default defineConfig({
738
738
 
739
739
  ## Requirements
740
740
 
741
- - **Node.js** >=22
741
+ - **Node.js** ^22.12.0 || >=24
742
742
  - **npm** 11.5.1 or higher (or equivalent package manager)
743
743
 
744
744
  ---
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6BrD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAqBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CA6GlF"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6BrD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAqBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CA8GlF"}
@@ -135,7 +135,7 @@ export async function loadConfig(cwd = process.cwd()) {
135
135
  throw new Error(`Invalid ISG configuration in ${configPath}:\n` +
136
136
  `${error.code}: ${error.message}\n` +
137
137
  `Field: ${error.field}, Value: ${JSON.stringify(error.value)}\n\n` +
138
- `Please check your stati.config.ts file and correct the ISG configuration.`);
138
+ `Please check your stati.config.ts file and correct the ISG configuration.`, { cause: error });
139
139
  }
140
140
  throw error; // Re-throw non-ISG errors
141
141
  }
@@ -494,9 +494,6 @@ async function buildInternal(options = {}) {
494
494
  const endConfigSpan = recorder.startSpan('configLoadMs');
495
495
  const { config, outDir, cacheDir } = await loadAndValidateConfig(options);
496
496
  endConfigSpan();
497
- // Initialize cache stats
498
- let cacheHits = 0;
499
- let cacheMisses = 0;
500
497
  // Clean output directory and cache if requested
501
498
  if (options.clean) {
502
499
  logger.status('Cleaning output directory and ISG cache...');
@@ -598,9 +595,7 @@ async function buildInternal(options = {}) {
598
595
  const buildTime = new Date();
599
596
  const pageProcessingResult = await processPagesWithCache(pages, manifest, config, outDir, md, eta, navigation, buildTime, options, logger, compiledBundles, recorder, searchIndexFilename);
600
597
  endPageRenderSpan();
601
- cacheHits = pageProcessingResult.cacheHits;
602
- cacheMisses = pageProcessingResult.cacheMisses;
603
- const searchablePages = pageProcessingResult.searchablePages;
598
+ const { cacheHits, cacheMisses, searchablePages } = pageProcessingResult;
604
599
  // Generate search index if enabled
605
600
  // Uses markdown content and TOC entries
606
601
  let searchIndexMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"build-lock.d.ts","sourceRoot":"","sources":["../../../src/core/isg/build-lock.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAI5B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,WAAW,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE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AOG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBlC;;;;;;;;;;;OAWG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAiBpC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAY9C;;;OAGG;YACW,eAAe;IAQ7B;;OAEG;YACW,cAAc;IAc5B;;OAEG;YACW,YAAY;IAY1B;;OAEG;YACW,gBAAgB;IAY9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,OAAO,CAAC,CAAC,CAAC,CASZ"}
@@ -69,7 +69,7 @@ export class BuildLockManager {
69
69
  await this.sleep(1000);
70
70
  continue;
71
71
  }
72
- throw new Error(`Failed to acquire build lock: ${error instanceof Error ? error.message : String(error)}`);
72
+ throw new Error(`Failed to acquire build lock: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
73
73
  }
74
74
  }
75
75
  throw new Error(`Build lock acquisition timed out after ${timeout}ms. ` +
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server-lock.d.ts","sourceRoot":"","sources":["../../../src/core/isg/dev-server-lock.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAA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1B;;OAEG;YACW,gBAAgB;IAY9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;CAkDhC"}
@@ -62,7 +62,7 @@ export class DevServerLockManager {
62
62
  const nodeError = error;
63
63
  if (nodeError.code === 'EEXIST') {
64
64
  throw new Error(`Another dev server is starting in this directory.\n` +
65
- `Please wait a moment and try again, or delete: ${this.lockPath}`);
65
+ `Please wait a moment and try again, or delete: ${this.lockPath}`, { cause: error });
66
66
  }
67
67
  throw error;
68
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/core/isg/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAC;AAUtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAsGvF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEhG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAInD"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/core/isg/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,sBAAsB,CAAC;AAUtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAsGvF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyEhG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAInD"}
@@ -129,32 +129,32 @@ export async function saveCacheManifest(cacheDir, manifest) {
129
129
  if (nodeError.code === 'EACCES' ||
130
130
  (nodeError.message && nodeError.message.includes('Permission denied'))) {
131
131
  throw new Error(`Permission denied saving cache manifest to ${manifestPath}. ` +
132
- `Please check directory permissions or run with appropriate privileges.`);
132
+ `Please check directory permissions or run with appropriate privileges.`, { cause: error });
133
133
  }
134
134
  if (nodeError.code === 'ENOSPC' ||
135
135
  (nodeError.message && nodeError.message.includes('No space left on device'))) {
136
136
  throw new Error(`No space left on device when saving cache manifest to ${manifestPath}. ` +
137
- `Please free up disk space and try again.`);
137
+ `Please free up disk space and try again.`, { cause: error });
138
138
  }
139
139
  if (nodeError.code === 'EMFILE' || nodeError.code === 'ENFILE') {
140
140
  throw new Error(`Too many open files when saving cache manifest. ` +
141
- `Consider reducing concurrent operations or increasing file descriptor limits.`);
141
+ `Consider reducing concurrent operations or increasing file descriptor limits.`, { cause: error });
142
142
  }
143
143
  if (nodeError.code === 'ENOTDIR') {
144
144
  throw new Error(`Cache directory path ${cacheDir} is not a directory. ` +
145
- `Please remove the conflicting file and try again.`);
145
+ `Please remove the conflicting file and try again.`, { cause: error });
146
146
  }
147
147
  // Re-throw the original error if it's already properly formatted
148
148
  if (error instanceof Error) {
149
149
  if (error.message.includes('Failed to create directory') ||
150
150
  error.message.includes('Failed to write file')) {
151
- throw new Error(`Failed to save cache manifest to ${manifestPath}: ${error.message.split(': ').slice(-1)[0]}`);
151
+ throw new Error(`Failed to save cache manifest to ${manifestPath}: ${error.message.split(': ').slice(-1)[0]}`, { cause: error });
152
152
  }
153
153
  if (error.message.includes('Failed to')) {
154
154
  throw error;
155
155
  }
156
156
  }
157
- throw new Error(`Failed to save cache manifest to ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`);
157
+ throw new Error(`Failed to save cache manifest to ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
158
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M,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE"}
@@ -9,7 +9,7 @@ async function wrapFsOperation(operation, fsCall, path) {
9
9
  }
10
10
  catch (error) {
11
11
  const nodeError = error;
12
- throw new Error(`Failed to ${operation} ${path}: ${nodeError.message}`);
12
+ throw new Error(`Failed to ${operation} ${path}: ${nodeError.message}`, { cause: error });
13
13
  }
14
14
  }
15
15
  /**
@@ -24,7 +24,7 @@ async function wrapFsOperationNullable(operation, fsCall, path) {
24
24
  if (nodeError.code === 'ENOENT') {
25
25
  return null; // File doesn't exist
26
26
  }
27
- throw new Error(`Failed to ${operation} ${path}: ${nodeError.message}`);
27
+ throw new Error(`Failed to ${operation} ${path}: ${nodeError.message}`, { cause: error });
28
28
  }
29
29
  }
30
30
  /**
@@ -75,7 +75,9 @@ export async function readdir(dirPath, options) {
75
75
  }
76
76
  catch (error) {
77
77
  const nodeError = error;
78
- throw new Error(`Failed to read directory ${dirPath}: ${nodeError.message}`);
78
+ throw new Error(`Failed to read directory ${dirPath}: ${nodeError.message}`, {
79
+ cause: error,
80
+ });
79
81
  }
80
82
  }
81
83
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stati/core",
3
- "version": "1.26.0",
3
+ "version": "1.26.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -37,6 +37,9 @@
37
37
  "dev": "tsc -p tsconfig.json --watch",
38
38
  "test": "vitest run"
39
39
  },
40
+ "engines": {
41
+ "node": "^22.12.0 || >=24"
42
+ },
40
43
  "dependencies": {
41
44
  "chokidar": "^5.0.0",
42
45
  "esbuild": "^0.28.2",