bun-plugin-stx 0.2.914 → 0.2.915

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.
Files changed (2) hide show
  1. package/dist/serve.js +11 -1
  2. package/package.json +3 -3
package/dist/serve.js CHANGED
@@ -12120,7 +12120,17 @@ ${trailingPageScripts.join(`
12120
12120
  if (options.onResponse) {
12121
12121
  const hooked = await options.onResponse(req, _finalResp);
12122
12122
  if (hooked instanceof Response)
12123
- return hooked;
12123
+ _finalResp = hooked;
12124
+ }
12125
+ if (stxConfig.deferScripts && req.method !== "HEAD" && _finalResp.body && !_finalResp.bodyUsed && _finalResp.headers.get("content-type")?.includes("text/html") && !_finalResp.headers.has("content-encoding")) {
12126
+ const stx = await stxModule;
12127
+ const headers = new Headers(_finalResp.headers);
12128
+ headers.delete("content-length");
12129
+ _finalResp = new Response(stx.prepareServePageAssets(await _finalResp.text()), {
12130
+ status: _finalResp.status,
12131
+ statusText: _finalResp.statusText,
12132
+ headers
12133
+ });
12124
12134
  }
12125
12135
  return _finalResp;
12126
12136
  })());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.914",
4
+ "version": "0.2.915",
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.914",
78
- "stx-router": "0.2.914"
77
+ "@stacksjs/stx": "0.2.915",
78
+ "stx-router": "0.2.915"
79
79
  }
80
80
  }