bun-plugin-stx 0.2.406 → 0.2.408
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/{chunk-9z4zav9s.js → chunk-6svt7a27.js} +1024 -57
- package/dist/serve.d.ts +2 -0
- package/dist/serve.js +16 -6
- package/package.json +3 -3
package/dist/serve.d.ts
CHANGED
|
@@ -227,6 +227,8 @@ export declare function isRenderableCacheCandidate(html: string): boolean;
|
|
|
227
227
|
* candidate / the marker body (#1854).
|
|
228
228
|
*/
|
|
229
229
|
export declare function usableErrorPage(rendered: string | null): string | null;
|
|
230
|
+
/** The Content-Type a static file is served with, by its name, then its extension. */
|
|
231
|
+
export declare function staticContentType(path: string): string;
|
|
230
232
|
export declare function bundleBrowserAsset(entrypoint: string): Promise<Response>;
|
|
231
233
|
/**
|
|
232
234
|
* The bind budget from an option or config value. Anything that is not a
|
package/dist/serve.js
CHANGED
|
@@ -9184,6 +9184,17 @@ var staticContentTypes = {
|
|
|
9184
9184
|
otf: "font/otf",
|
|
9185
9185
|
eot: "application/vnd.ms-fontobject"
|
|
9186
9186
|
};
|
|
9187
|
+
var wellKnownContentTypes = {
|
|
9188
|
+
"apple-app-site-association": "application/json",
|
|
9189
|
+
"apple-developer-merchantid-domain-association": "text/plain"
|
|
9190
|
+
};
|
|
9191
|
+
function staticContentType(path) {
|
|
9192
|
+
const name = path.split(/[/\\]/).pop() || "";
|
|
9193
|
+
if (wellKnownContentTypes[name])
|
|
9194
|
+
return wellKnownContentTypes[name];
|
|
9195
|
+
const ext = name.includes(".") ? name.split(".").pop()?.toLowerCase() : "";
|
|
9196
|
+
return staticContentTypes[ext || ""] || "application/octet-stream";
|
|
9197
|
+
}
|
|
9187
9198
|
var bundledAssetExtensions = new Set(["ts", "tsx", "mts", "cts"]);
|
|
9188
9199
|
function isBundledAssetExtension(ext) {
|
|
9189
9200
|
return Boolean(ext && bundledAssetExtensions.has(ext));
|
|
@@ -9814,7 +9825,7 @@ function __stxOverlay(errs){
|
|
|
9814
9825
|
rebuildDiscoveredPagePaths(kept);
|
|
9815
9826
|
await indexPageMiddleware(kept);
|
|
9816
9827
|
try {
|
|
9817
|
-
const { Router } = await import("./chunk-
|
|
9828
|
+
const { Router } = await import("./chunk-6svt7a27.js");
|
|
9818
9829
|
const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
|
|
9819
9830
|
const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName(), exclude: options.exclude });
|
|
9820
9831
|
if (!options.quiet)
|
|
@@ -10646,9 +10657,8 @@ ${block}`;
|
|
|
10646
10657
|
if (await file.exists()) {
|
|
10647
10658
|
const stat4 = await file.stat().catch(() => null);
|
|
10648
10659
|
if (stat4 && !stat4.isDirectory()) {
|
|
10649
|
-
const ext = resolvedPath.split(".").pop()?.toLowerCase();
|
|
10650
10660
|
const headers = {
|
|
10651
|
-
"Content-Type":
|
|
10661
|
+
"Content-Type": staticContentType(resolvedPath),
|
|
10652
10662
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
10653
10663
|
...corsHeaders
|
|
10654
10664
|
};
|
|
@@ -11077,7 +11087,7 @@ ${trailingPageScripts.join(`
|
|
|
11077
11087
|
return bundleBrowserAsset(filePath);
|
|
11078
11088
|
return new Response(file, {
|
|
11079
11089
|
headers: {
|
|
11080
|
-
"Content-Type":
|
|
11090
|
+
"Content-Type": staticContentType(assetPath),
|
|
11081
11091
|
"Cache-Control": "no-store"
|
|
11082
11092
|
}
|
|
11083
11093
|
});
|
|
@@ -11104,10 +11114,9 @@ ${trailingPageScripts.join(`
|
|
|
11104
11114
|
if (await file.exists()) {
|
|
11105
11115
|
const stat4 = await file.stat().catch(() => null);
|
|
11106
11116
|
if (stat4 && !stat4.isDirectory()) {
|
|
11107
|
-
const ext = resolvedPath.split(".").pop()?.toLowerCase();
|
|
11108
11117
|
return new Response(file, {
|
|
11109
11118
|
headers: {
|
|
11110
|
-
"Content-Type":
|
|
11119
|
+
"Content-Type": staticContentType(resolvedPath),
|
|
11111
11120
|
"Cache-Control": staticCacheControl(resolvedPath)
|
|
11112
11121
|
}
|
|
11113
11122
|
});
|
|
@@ -11358,6 +11367,7 @@ async function projectUsesImageBuiltins(root) {
|
|
|
11358
11367
|
}
|
|
11359
11368
|
export {
|
|
11360
11369
|
usableErrorPage,
|
|
11370
|
+
staticContentType,
|
|
11361
11371
|
staticCacheControl,
|
|
11362
11372
|
sharedScriptCacheControl,
|
|
11363
11373
|
settleWithin,
|
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.408",
|
|
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.408",
|
|
78
|
+
"stx-router": "0.2.408"
|
|
79
79
|
}
|
|
80
80
|
}
|