@kenjura/ursa 0.63.0 → 0.64.0

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,11 @@
1
+ # 0.64.0
2
+ 2026-01-31
3
+
4
+ - Handles scenario where a new image is added while serving (previously the image wouldn't show without a full restart)
5
+ - New images are now processed on-the-fly when detected in serve mode
6
+ - Image previews are generated and copied to output automatically
7
+ - HTML is updated to use preview images without needing a full rebuild
8
+
1
9
  # 0.63.0
2
10
  2026-01-31
3
11
 
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.63.0",
5
+ "version": "0.64.0",
6
6
  "description": "static site generator from MD/wikitext/YML",
7
7
  "main": "lib/index.js",
8
8
  "bin": {
package/src/serve.js CHANGED
@@ -7,6 +7,7 @@ import fs from "fs";
7
7
  import { promises } from "fs";
8
8
  import { outputFile } from "fs-extra";
9
9
  import { processImage } from "./helper/imageProcessor.js";
10
+ import { watchModeCache } from "./helper/build/watchCache.js";
10
11
  import { WebSocketServer } from "ws";
11
12
  import { createServer } from "http";
12
13
  const { readdir, mkdir, readFile, copyFile } = promises;
@@ -126,7 +127,7 @@ const IMAGE_EXTENSIONS = /\.(jpg|jpeg|png|gif|webp|svg|ico)$/i;
126
127
 
127
128
  /**
128
129
  * Copy a single static file to the output directory
129
- * For images, also generates a preview version
130
+ * For images, also generates a preview version and updates the imageMap cache
130
131
  * @param {string} filePath - Absolute path to the static file
131
132
  * @param {string} sourceDir - Source directory root
132
133
  * @param {string} outputDir - Output directory root
@@ -142,6 +143,14 @@ async function copyStaticFile(filePath, sourceDir, outputDir) {
142
143
  if (IMAGE_EXTENSIONS.test(filePath)) {
143
144
  const result = await processImage(filePath, absoluteOutputDir, relativeDir);
144
145
  const elapsed = Date.now() - startTime;
146
+
147
+ // Update the watchModeCache.imageMap so regenerated documents can use the new image
148
+ if (result && watchModeCache.imageMap) {
149
+ // The key is the absolute URL path (e.g., /campaigns/ABS/img/map.jpg)
150
+ const imageKey = result.original;
151
+ watchModeCache.imageMap.set(imageKey, result);
152
+ }
153
+
145
154
  if (result && result.preview !== result.original) {
146
155
  return { success: true, message: `Processed ${relativePath} with preview in ${elapsed}ms` };
147
156
  }