bun-plugin-stx 0.2.407 → 0.2.409

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.
@@ -1523,6 +1523,9 @@ function routerSource() {
1523
1523
  // twice \u2014 leave the document without it. These are loaded once and stay,
1524
1524
  // the same as the external head scripts beside them.
1525
1525
  el.setAttribute('data-stx-external','');
1526
+ // In document order: a fragment's composables bundle reads the module
1527
+ // registry loaded beside it, and an inserted script is async by default.
1528
+ el.async=false;
1526
1529
  el.onload=function(){resolve()};
1527
1530
  el.onerror=function(){log('[router] container script failed:',key);resolve()};
1528
1531
  dhead().appendChild(el);
@@ -2202,10 +2205,10 @@ else {
2202
2205
  });
2203
2206
  var loopRoot=placeholder.previousSibling;
2204
2207
  while(loopRoot&&(
2205
- (loopRoot.nodeType===Node.TEXT_NODE&&!(loopRoot.textContent||'').trim())
2206
- ||loopRoot.nodeType===Node.COMMENT_NODE
2208
+ (loopRoot.nodeType===3&&!(loopRoot.textContent||'').trim())
2209
+ ||loopRoot.nodeType===8
2207
2210
  ))loopRoot=loopRoot.previousSibling;
2208
- if(loopRoot&&loopRoot.nodeType===Node.ELEMENT_NODE&&loopRoot.hasAttribute('data-stx-scope')
2211
+ if(loopRoot&&loopRoot.nodeType===1&&loopRoot.hasAttribute('data-stx-scope')
2209
2212
  &&(loopRoot.hasAttribute(':for')||loopRoot.hasAttribute('@for')||loopRoot.hasAttribute('x-for'))){
2210
2213
  var loopScopeId=loopRoot.getAttribute('data-stx-scope');
2211
2214
  scopedLoopSetup=!!loopScopeId&&code.indexOf(loopScopeId)!==-1;
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-6svt7a27.js");
9828
+ const { Router } = await import("./chunk-51r5j16q.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": staticContentTypes[ext || ""] || "application/octet-stream",
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": staticContentTypes[ext || ""] || "application/octet-stream",
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": staticContentTypes[ext || ""] || "application/octet-stream",
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.407",
4
+ "version": "0.2.409",
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.407",
78
- "stx-router": "0.2.407"
77
+ "@stacksjs/stx": "0.2.409",
78
+ "stx-router": "0.2.409"
79
79
  }
80
80
  }