@xtrable-ltd/nanoesis 0.1.18 → 0.1.19

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  contentTypeFor
3
- } from "./chunk-CBLBQP27.js";
3
+ } from "./chunk-WHK3SBV7.js";
4
4
 
5
5
  // ../../adapters/azure-blob/src/container.ts
6
6
  var InMemoryBlobContainer = class {
@@ -15,7 +15,7 @@ import {
15
15
  renderReferenceMarkdown,
16
16
  validateSite,
17
17
  workingStoreRoundTripDiagnostic
18
- } from "./chunk-CBLBQP27.js";
18
+ } from "./chunk-WHK3SBV7.js";
19
19
 
20
20
  // ../editor-api/src/scaffold.ts
21
21
  var HOME_HTML = `<!doctype html>
@@ -3032,6 +3032,36 @@ async function listComponentFiles(source) {
3032
3032
  return out.sort();
3033
3033
  }
3034
3034
 
3035
+ // ../engine/src/compile/cache-bust.ts
3036
+ function cacheBustAssets(html, hashFor) {
3037
+ const stamp = (url) => {
3038
+ if (!isStampable(url)) return url;
3039
+ const token = hashFor(url.slice(1));
3040
+ return token === void 0 ? url : `${url}?v=${token}`;
3041
+ };
3042
+ return html.replace(
3043
+ /(\s(?:src|poster)=")([^"]*)"/g,
3044
+ (_m, pre, url) => `${pre}${stamp(url)}"`
3045
+ ).replace(
3046
+ /(<link\b[^>]*?\shref=")([^"]*)"/gi,
3047
+ (_m, pre, url) => `${pre}${stamp(url)}"`
3048
+ ).replace(/(\ssrcset=")([^"]*)"/g, (_m, pre, value) => {
3049
+ const rewritten = value.split(",").map((candidate) => {
3050
+ const trimmed = candidate.trim();
3051
+ if (trimmed === "") return "";
3052
+ const [url, ...descriptor] = trimmed.split(/\s+/);
3053
+ return [stamp(url ?? ""), ...descriptor].join(" ");
3054
+ }).filter((candidate) => candidate !== "").join(", ");
3055
+ return `${pre}${rewritten}"`;
3056
+ }).replace(
3057
+ /url\(\s*(['"]?)([^)'"]*)\1\s*\)/gi,
3058
+ (_m, quote, url) => `url(${quote}${stamp(url)}${quote})`
3059
+ );
3060
+ }
3061
+ function isStampable(url) {
3062
+ return url.startsWith("/") && !url.startsWith("//") && !url.startsWith("/api/") && !url.includes("?") && !url.includes("#");
3063
+ }
3064
+
3035
3065
  // ../engine/src/publish/purge.ts
3036
3066
  var noopPurgeService = {
3037
3067
  async purgeAll() {
@@ -3058,9 +3088,15 @@ async function publishSite(source, sink, options = {}) {
3058
3088
  }
3059
3089
  const artifacts = await compileSite(source, compileOptions);
3060
3090
  const passthrough = await collectPublic(source, publicDir);
3061
- const byPath = /* @__PURE__ */ new Map();
3091
+ const hashByPath = /* @__PURE__ */ new Map();
3062
3092
  for (const artifact of [...artifacts, ...passthrough])
3063
- byPath.set(artifact.path, artifact.contents);
3093
+ hashByPath.set(artifact.path, contentHash(asBytes(artifact.contents)));
3094
+ const hashFor = (path) => hashByPath.get(path);
3095
+ const stamped = artifacts.map(
3096
+ (artifact) => typeof artifact.contents === "string" && artifact.path.endsWith(".html") ? { path: artifact.path, contents: cacheBustAssets(artifact.contents, hashFor) } : artifact
3097
+ );
3098
+ const byPath = /* @__PURE__ */ new Map();
3099
+ for (const artifact of [...stamped, ...passthrough]) byPath.set(artifact.path, artifact.contents);
3064
3100
  await mapWithConcurrency(
3065
3101
  [...byPath],
3066
3102
  writeConcurrency,
@@ -3069,6 +3105,9 @@ async function publishSite(source, sink, options = {}) {
3069
3105
  await purge.purgeAll();
3070
3106
  return { ok: true, validation, written: [...byPath.keys()].sort(), summary };
3071
3107
  }
3108
+ function asBytes(contents) {
3109
+ return typeof contents === "string" ? new TextEncoder().encode(contents) : contents;
3110
+ }
3072
3111
  function summarizeTree(root) {
3073
3112
  let published = 0;
3074
3113
  let drafts = 0;
@@ -18,8 +18,8 @@ import {
18
18
  recreateHomeTemplateRepair,
19
19
  templateSnapshotIntegrityDiagnostic,
20
20
  templateSuffixConflictDiagnostic
21
- } from "./chunk-PKCYTOHW.js";
22
- import "./chunk-CBLBQP27.js";
21
+ } from "./chunk-26VCV3IE.js";
22
+ import "./chunk-WHK3SBV7.js";
23
23
  export {
24
24
  FileBrandingStore,
25
25
  InMemoryBrandingStore,
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ import {
75
75
  versionNumber,
76
76
  wholeValueToken,
77
77
  workingStoreRoundTripDiagnostic
78
- } from "./chunk-CBLBQP27.js";
78
+ } from "./chunk-WHK3SBV7.js";
79
79
  export {
80
80
  ContentParseError,
81
81
  DEFAULT_DIRS,
package/dist/mcp.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  MCP_TOOLS,
4
4
  callMcpTool,
5
5
  readMcpResource
6
- } from "./chunk-PKCYTOHW.js";
7
- import "./chunk-CBLBQP27.js";
6
+ } from "./chunk-26VCV3IE.js";
7
+ import "./chunk-WHK3SBV7.js";
8
8
 
9
9
  // ../../hosts/host-mcp/src/http.ts
10
10
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
@@ -56,7 +56,7 @@ function createMcpServer(deps, identity) {
56
56
  }
57
57
 
58
58
  // ../../hosts/host-mcp/src/http.ts
59
- var DEFAULT_VERSION = true ? "0.1.18" : "0.0.0-workspace";
59
+ var DEFAULT_VERSION = true ? "0.1.19" : "0.0.0-workspace";
60
60
  async function handleMcpRequest(deps, request, opts) {
61
61
  const server = createMcpServer(deps, {
62
62
  name: opts?.name ?? "nanoesis",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtrable-ltd/nanoesis",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "nanoesis: a static-first publishing compiler. The engine, the mountable editor API, the storage/image/auth adapters, and the editor UI bundle, in one package (DESIGN 11c).",
5
5
  "license": "MIT",
6
6
  "author": "Xtrable Ltd",