@riebeckite/honox 0.0.42 → 0.0.43

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/index.js CHANGED
@@ -1456,11 +1456,14 @@ async function saveOutputCacheEntries(directory, outputDirectory, outputs, final
1456
1456
  if (existing.cachePath !== outputCacheEntryName(outputPath) || !isChecksum(existing.checksum)) {
1457
1457
  throw new Error(`Invalid SSG output cache entry: ${outputPath}`);
1458
1458
  }
1459
- entries[outputPath] = await withOutputCacheEntryStat(
1459
+ const cached = await existingOutputCacheEntry(
1460
1460
  existing,
1461
1461
  join4(directory, existing.cachePath)
1462
1462
  );
1463
- continue;
1463
+ if (cached) {
1464
+ entries[outputPath] = cached;
1465
+ continue;
1466
+ }
1464
1467
  }
1465
1468
  const source = resolveOutputCacheFile(outputDirectory, outputPath);
1466
1469
  const cachePath = outputCacheEntryName(outputPath);
@@ -1490,6 +1493,11 @@ async function withOutputCacheEntryStat(entry, path12) {
1490
1493
  if (!info?.isFile() || info.isSymbolicLink()) return entry;
1491
1494
  return { ...entry, size: info.size, modifiedAtMs: info.mtimeMs };
1492
1495
  }
1496
+ async function existingOutputCacheEntry(entry, path12) {
1497
+ const info = await lstat2(path12).catch(() => void 0);
1498
+ if (!info?.isFile() || info.isSymbolicLink()) return void 0;
1499
+ return { ...entry, size: info.size, modifiedAtMs: info.mtimeMs };
1500
+ }
1493
1501
  async function validateOutputCacheEntries(outputCachePath, entries, timingsMs) {
1494
1502
  try {
1495
1503
  const directory = outputCacheEntriesPath(outputCachePath);
@@ -2243,12 +2251,14 @@ function riebeckiteSsg(options = {}) {
2243
2251
  "outputWrite",
2244
2252
  () => writer.write(fileName, data)
2245
2253
  );
2246
- outputChecksums.set(fileName, fingerprintOutputContent(data));
2254
+ const checksum = fingerprintOutputContent(data);
2255
+ outputChecksums.set(fileName, checksum);
2247
2256
  metrics.emittedOutputCount += 1;
2248
- nextOutputCache.outputs[fileName] = {
2249
- cachePath: "",
2250
- checksum: ""
2251
- };
2257
+ nextOutputCache.outputs[fileName] = outputCacheEntryFor(
2258
+ previousOutputCache,
2259
+ fileName,
2260
+ checksum
2261
+ );
2252
2262
  }
2253
2263
  })
2254
2264
  );
@@ -2280,15 +2290,14 @@ function riebeckiteSsg(options = {}) {
2280
2290
  "outputWrite",
2281
2291
  () => writer.write(asset.fileName, asset.source)
2282
2292
  );
2283
- outputChecksums.set(
2293
+ const checksum = fingerprintOutputContent(asset.source);
2294
+ outputChecksums.set(asset.fileName, checksum);
2295
+ metrics.emittedOutputCount += 1;
2296
+ nextOutputCache.outputs[asset.fileName] = outputCacheEntryFor(
2297
+ previousOutputCache,
2284
2298
  asset.fileName,
2285
- fingerprintOutputContent(asset.source)
2299
+ checksum
2286
2300
  );
2287
- metrics.emittedOutputCount += 1;
2288
- nextOutputCache.outputs[asset.fileName] = {
2289
- cachePath: "",
2290
- checksum: ""
2291
- };
2292
2301
  },
2293
2302
  canUseIncremental ? new Set(
2294
2303
  (outputChangeSet?.affected ?? []).filter((output) => output.kind === "generated").map((output) => output.path)
@@ -2563,6 +2572,10 @@ function assertRequiredOutputsWereGenerated(comparison) {
2563
2572
  `SSG did not generate required output: ${comparison.missingInDist.join(", ")}`
2564
2573
  );
2565
2574
  }
2575
+ function outputCacheEntryFor(previous, path12, checksum) {
2576
+ const cached = previous?.outputs[path12];
2577
+ return cached?.checksum === checksum ? cached : { cachePath: "", checksum: "" };
2578
+ }
2566
2579
  async function emitGeneratedOutputs(module, emit, affectedPaths, shadowedPaths, onShadowed) {
2567
2580
  const content = module.content;
2568
2581
  if (!content) return 0;
package/dist/server.js CHANGED
@@ -114,7 +114,7 @@ function isDynamicRoute(path) {
114
114
  }
115
115
  function normalizeRequestPath(pathname) {
116
116
  const trailingSlash = pathname.length > 1 && pathname.endsWith("/");
117
- const segments = pathname.split("/").filter(Boolean).map(decodeSegment);
117
+ const segments = pathname.split("/").filter(Boolean).map(encodeSegment);
118
118
  const path = `/${segments.join("/")}`;
119
119
  return trailingSlash ? `${path}/` : path;
120
120
  }
@@ -131,11 +131,11 @@ function redirectSsgPaths(manifest) {
131
131
  function routeOutputPath(pathname) {
132
132
  return htmlOutputPath(pathname);
133
133
  }
134
- function decodeSegment(segment) {
134
+ function encodeSegment(segment) {
135
135
  try {
136
- return decodeURIComponent(segment);
136
+ return encodeURIComponent(decodeURIComponent(segment));
137
137
  } catch {
138
- return segment;
138
+ return encodeURIComponent(segment);
139
139
  }
140
140
  }
141
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/honox",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,12 +44,12 @@
44
44
  "hono": "^4.12.25",
45
45
  "honox": "0.1.62",
46
46
  "vite": "^8.3.5",
47
- "@riebeckite/plugin-color-mode": "0.0.42",
48
- "@riebeckite/core": "0.0.42",
49
- "@riebeckite/dev-inspector": "0.0.42",
50
- "@riebeckite/node": "0.0.42",
51
- "@riebeckite/spa": "0.0.42",
52
- "@riebeckite/ui": "0.0.42"
47
+ "@riebeckite/core": "0.0.43",
48
+ "@riebeckite/plugin-color-mode": "0.0.43",
49
+ "@riebeckite/node": "0.0.43",
50
+ "@riebeckite/dev-inspector": "0.0.43",
51
+ "@riebeckite/spa": "0.0.43",
52
+ "@riebeckite/ui": "0.0.43"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@d2lang/d2": "^0.1.34",
@@ -57,8 +57,8 @@
57
57
  "@hono/vite-build": "^1.11.1",
58
58
  "@marp-team/marp-core": "^4.4.0",
59
59
  "tsx": "^4.22.4",
60
- "@riebeckite/plugin-bases": "0.0.42",
61
- "@riebeckite/test": "0.0.42"
60
+ "@riebeckite/test": "0.0.43",
61
+ "@riebeckite/plugin-bases": "0.0.43"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"