@kenjura/ursa 0.81.2 → 0.81.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.81.4
2
+ 2026-05-04
3
+
4
+ - bug fix: directory index html files were never being written...impossibly, but there it is
5
+
6
+ # 0.81.3
7
+ 2026-04-14
8
+
9
+ - bug fix: When script.js changes in serve mode, the bundle cache wasn't being cleared, so documents kept using stale bundles.
10
+ - Added clearScriptCache() and clearStyleCache() functions in generate.js
11
+ - Updated serve.js to call these functions when CSS/JS files change
12
+
13
+
1
14
  # 0.81.2
2
15
  2026-03-28
3
16
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@kenjura/ursa",
3
3
  "author": "Andrew London <andrew@kenjura.com>",
4
4
  "type": "module",
5
- "version": "0.81.2",
5
+ "version": "0.81.4",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "bin": {
@@ -100,6 +100,28 @@ export function clearWatchCache() {
100
100
  clearMetaBundleCache();
101
101
  }
102
102
 
103
+ // Clear just the script-related caches (for when script.js changes)
104
+ export function clearScriptCache() {
105
+ scriptPathCache.clear();
106
+ // Clear all JS bundle cache entries
107
+ for (const key of docBundleCache.keys()) {
108
+ if (key.startsWith('js:')) {
109
+ docBundleCache.delete(key);
110
+ }
111
+ }
112
+ }
113
+
114
+ // Clear just the CSS-related caches (for when style.css changes)
115
+ export function clearStyleCache() {
116
+ cssPathCache.clear();
117
+ // Clear all CSS bundle cache entries
118
+ for (const key of docBundleCache.keys()) {
119
+ if (key.startsWith('css:')) {
120
+ docBundleCache.delete(key);
121
+ }
122
+ }
123
+ }
124
+
103
125
  const progress = new ProgressReporter();
104
126
 
105
127
  const DEFAULT_TEMPLATE_NAME =
@@ -1003,7 +1025,7 @@ export async function generate({
1003
1025
 
1004
1026
  // html
1005
1027
  const htmlOutputFilename = dirPath.replace(source, output) + ".html";
1006
- const indexAlreadyExists = fileExists(htmlOutputFilename);
1028
+ const indexAlreadyExists = await fileExists(htmlOutputFilename);
1007
1029
  if (!indexAlreadyExists) {
1008
1030
  const template = templates["default-template"];
1009
1031
  const indexHtml = `<ul>${pathsInThisDirectory
package/src/serve.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import express from "express";
2
2
  import compression from "compression";
3
3
  import watch from "node-watch";
4
- import { generate, regenerateAffectedDocuments, clearWatchCache } from "./jobs/generate.js";
4
+ import { generate, regenerateAffectedDocuments, clearWatchCache, clearScriptCache, clearStyleCache } from "./jobs/generate.js";
5
5
  import { join, resolve, dirname, basename } from "path";
6
6
  import fs from "fs";
7
7
  import { promises } from "fs";
@@ -463,6 +463,8 @@ export async function serve({
463
463
  for (const change of cssChanges) {
464
464
  const result = await copyCssFile(change.name, sourceDir + '/', outputDir + '/');
465
465
  if (result.success) console.log(`✅ ${result.message}`);
466
+ // Clear CSS bundle cache so affected documents will regenerate bundles
467
+ clearStyleCache();
466
468
  if (watchModeCache.isInitialized) {
467
469
  const plan = dependencyTracker.getInvalidationPlan(change.name, sourceDir);
468
470
  if (plan.requiresFullRebuild) {
@@ -481,6 +483,8 @@ export async function serve({
481
483
  const content = await readFile(change.name, 'utf8');
482
484
  await outputFile(outputPath, content);
483
485
  console.log(`✅ Copied ${relativePath}`);
486
+ // Clear script bundle cache so affected documents will regenerate bundles
487
+ clearScriptCache();
484
488
  if (watchModeCache.isInitialized) {
485
489
  const plan = dependencyTracker.getInvalidationPlan(change.name, sourceDir);
486
490
  plan.affectedDocuments.forEach(d => affectedDocPaths.add(d));