bun-plugin-stx 0.2.913 → 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.
- package/dist/serve.d.ts +4 -7
- package/dist/serve.js +11 -1
- package/package.json +3 -3
package/dist/serve.d.ts
CHANGED
|
@@ -3,9 +3,13 @@ import { compileDomainRoutes, describeDomainRoutes, requestHost, resolveDomainEl
|
|
|
3
3
|
import type { DomainRoutesOption } from './domain-routes';
|
|
4
4
|
import type { ImageTemplateScope } from './image-warmup-scope';
|
|
5
5
|
import type { MiddlewareContext, MiddlewareHandler, MiddlewareRequest, PageMiddleware, PrepareMiddlewareRequest } from './page-middleware';
|
|
6
|
+
import type { PageWarmupOptions } from '@stacksjs/stx';
|
|
6
7
|
import type { RenderAdmissionOptions } from './render-admission';
|
|
7
8
|
export type { DomainRoute, DomainRoutesOption } from './domain-routes';
|
|
8
9
|
export type { MiddlewareContext, MiddlewareDefinition, MiddlewareHandler, MiddlewareRequest, PageMiddleware, PrepareMiddlewareRequest } from './page-middleware';
|
|
10
|
+
// Declared beside StxConfig, where `pageWarmup` is also read from the
|
|
11
|
+
// project's stx/ui config; re-exported so this package's API is unchanged.
|
|
12
|
+
export type { PageWarmupOptions } from '@stacksjs/stx';
|
|
9
13
|
/**
|
|
10
14
|
* Extract real top-level `<script server>` elements without matching tag-like
|
|
11
15
|
* text inside HTML comments or another script body. A regex over the whole
|
|
@@ -442,13 +446,6 @@ export declare interface ServeOptions extends RenderAdmissionOptions {
|
|
|
442
446
|
protectedPaths?: string[]
|
|
443
447
|
}
|
|
444
448
|
}
|
|
445
|
-
export declare interface PageWarmupOptions {
|
|
446
|
-
paths?: string[]
|
|
447
|
-
holdBind?: 'replacing' | 'always'
|
|
448
|
-
budgetMs?: number
|
|
449
|
-
concurrency?: number
|
|
450
|
-
report?: boolean
|
|
451
|
-
}
|
|
452
449
|
export declare interface ResolvedPageWarmup {
|
|
453
450
|
enabled: boolean
|
|
454
451
|
paths: string[]
|
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
|
-
|
|
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.
|
|
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.
|
|
78
|
-
"stx-router": "0.2.
|
|
77
|
+
"@stacksjs/stx": "0.2.915",
|
|
78
|
+
"stx-router": "0.2.915"
|
|
79
79
|
}
|
|
80
80
|
}
|