bun-plugin-stx 0.2.798 → 0.2.799
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/serve.js +21 -4
- package/package.json +3 -3
package/dist/serve.js
CHANGED
|
@@ -9914,14 +9914,31 @@ After installing: bun add bun-plugin-stx`);
|
|
|
9914
9914
|
return;
|
|
9915
9915
|
});
|
|
9916
9916
|
}
|
|
9917
|
+
const renderCssAssets = new WeakMap;
|
|
9917
9918
|
async function readRenderCache(key) {
|
|
9918
9919
|
const hit = htmlCache.read(key);
|
|
9919
|
-
|
|
9920
|
-
return hit;
|
|
9921
|
-
const kept = await renderCacheStore.read(key).catch(() => {
|
|
9920
|
+
const entry = hit ?? await renderCacheStore?.read(key).catch(() => {
|
|
9922
9921
|
return;
|
|
9923
9922
|
});
|
|
9924
|
-
|
|
9923
|
+
if (!entry)
|
|
9924
|
+
return;
|
|
9925
|
+
let hashes = renderCssAssets.get(entry);
|
|
9926
|
+
if (!hashes) {
|
|
9927
|
+
hashes = [];
|
|
9928
|
+
for (const link of entry.html.matchAll(/<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>/gi)) {
|
|
9929
|
+
const hash = /\bhref=["']\/_stx\/css\.([a-f0-9]{16})\.css["']/i.exec(link[0])?.[1];
|
|
9930
|
+
if (hash)
|
|
9931
|
+
hashes.push(hash);
|
|
9932
|
+
}
|
|
9933
|
+
renderCssAssets.set(entry, hashes);
|
|
9934
|
+
}
|
|
9935
|
+
if (hashes.length) {
|
|
9936
|
+
const stx = await stxModule;
|
|
9937
|
+
for (const hash of hashes)
|
|
9938
|
+
if (stx.getCssServeAsset(hash) === undefined)
|
|
9939
|
+
return;
|
|
9940
|
+
}
|
|
9941
|
+
return hit ?? htmlCache.remember(key, entry);
|
|
9925
9942
|
}
|
|
9926
9943
|
function rememberRender(key, entry, ticket) {
|
|
9927
9944
|
htmlCache.remember(key, entry);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bun-plugin-stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.799",
|
|
5
5
|
"description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typecheck": "bun tsc --noEmit"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@stacksjs/stx": "0.2.
|
|
78
|
-
"stx-router": "0.2.
|
|
77
|
+
"@stacksjs/stx": "0.2.799",
|
|
78
|
+
"stx-router": "0.2.799"
|
|
79
79
|
}
|
|
80
80
|
}
|