bun-plugin-stx 0.2.79 → 0.2.81
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 +8 -0
- package/dist/serve.js +7 -1
- package/package.json +1 -1
package/dist/serve.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export declare function buildDynamicRouteRegexes(fileRouteBase: string): RegExp[
|
|
|
21
21
|
* has no pre-existing prod/dev flag threaded through its options, so these
|
|
22
22
|
* env vars are the canonical signal (the same ones the wider stacks codebase
|
|
23
23
|
* keys production behaviour off of).
|
|
24
|
+
*
|
|
25
|
+
* Safe by default: the browsable route list is a development-only affordance,
|
|
26
|
+
* so we only treat a serve as development when it is EXPLICITLY marked so
|
|
27
|
+
* (`development`/`dev`/`local`/`test`). A served app with no env configured —
|
|
28
|
+
* the easy-to-hit misconfiguration — is therefore treated as production and
|
|
29
|
+
* does NOT leak its route list. Local `buddy dev` already runs with
|
|
30
|
+
* `NODE_ENV=development`, so it keeps the helpful list.
|
|
24
31
|
*/
|
|
25
32
|
export declare function isProductionServe(): boolean;
|
|
26
33
|
/**
|
|
@@ -57,6 +64,7 @@ export declare interface ServeOptions {
|
|
|
57
64
|
publicDir?: string
|
|
58
65
|
quiet?: boolean
|
|
59
66
|
autoIncrementPort?: boolean | number
|
|
67
|
+
reusePort?: boolean
|
|
60
68
|
stxModule?: typeof import('@stacksjs/stx') | Promise<typeof import('@stacksjs/stx')>
|
|
61
69
|
i18n?: import('@stacksjs/stx').ResolvedI18n
|
|
62
70
|
site?: import('@stacksjs/stx').SiteConfig
|
package/dist/serve.js
CHANGED
|
@@ -8713,7 +8713,10 @@ function escapeHtml(input) {
|
|
|
8713
8713
|
return input.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8714
8714
|
}
|
|
8715
8715
|
function isProductionServe() {
|
|
8716
|
-
|
|
8716
|
+
const node = (process19.env.NODE_ENV || "").toLowerCase();
|
|
8717
|
+
const app = (process19.env.APP_ENV || "").toLowerCase();
|
|
8718
|
+
const devEnvs = new Set(["development", "dev", "local", "test", "testing"]);
|
|
8719
|
+
return !(devEnvs.has(node) || devEnvs.has(app));
|
|
8717
8720
|
}
|
|
8718
8721
|
function render404Page(opts) {
|
|
8719
8722
|
const { path, routes = [], isProduction } = opts;
|
|
@@ -9455,6 +9458,7 @@ After installing: bun add bun-plugin-stx`);
|
|
|
9455
9458
|
context.__stx_head_preset = true;
|
|
9456
9459
|
const config5 = {
|
|
9457
9460
|
...defaultConfig4,
|
|
9461
|
+
root: process19.cwd(),
|
|
9458
9462
|
...componentsDir && { componentsDir },
|
|
9459
9463
|
...layoutsDir && { layoutsDir },
|
|
9460
9464
|
...partialsDir && { partialsDir },
|
|
@@ -9624,6 +9628,7 @@ After installing: bun add bun-plugin-stx`);
|
|
|
9624
9628
|
context.__stx_head_preset = true;
|
|
9625
9629
|
const config5 = {
|
|
9626
9630
|
...defaultConfig4,
|
|
9631
|
+
root: process19.cwd(),
|
|
9627
9632
|
...componentsDir && { componentsDir },
|
|
9628
9633
|
...layoutsDir && { layoutsDir },
|
|
9629
9634
|
...partialsDir && { partialsDir },
|
|
@@ -9787,6 +9792,7 @@ ${html}`;
|
|
|
9787
9792
|
try {
|
|
9788
9793
|
_server = bunServe({
|
|
9789
9794
|
port: actualPort,
|
|
9795
|
+
reusePort: options.reusePort ?? false,
|
|
9790
9796
|
idleTimeout: 0,
|
|
9791
9797
|
async fetch(req, server) {
|
|
9792
9798
|
const url = new URL(req.url);
|
package/package.json
CHANGED