@vojtaholik/static-kit-core 2.1.4 → 2.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vojtaholik/static-kit-core",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -86,6 +86,8 @@ export interface RenderPageOptions {
86
86
  assetBase?: string;
87
87
  /** Function to read template file content */
88
88
  readFile?: (path: string) => Promise<string>;
89
+ /** Timestamp to append as ?v= to .css and .js references for cache-busting */
90
+ cacheBust?: number;
89
91
  }
90
92
 
91
93
  /**
@@ -127,6 +129,23 @@ export async function renderPage(
127
129
  setAttr(node, "data-density", page.density);
128
130
  }
129
131
 
132
+ // Cache-bust .css and .js references
133
+ if (options.cacheBust) {
134
+ if (node.nodeName === "link") {
135
+ const rel = getAttr(node, "rel");
136
+ const href = getAttr(node, "href");
137
+ if (rel === "stylesheet" && href && href.endsWith(".css")) {
138
+ setAttr(node, "href", `${href}?v=${options.cacheBust}`);
139
+ }
140
+ }
141
+ if (node.nodeName === "script") {
142
+ const src = getAttr(node, "src");
143
+ if (src && src.endsWith(".js")) {
144
+ setAttr(node, "src", `${src}?v=${options.cacheBust}`);
145
+ }
146
+ }
147
+ }
148
+
130
149
  // Process regions - inject a marker that we'll replace after serialization
131
150
  const regionName = getAttr(node, "data-region");
132
151
  if (regionName) {