@stacksjs/rpx 0.11.20 → 0.11.21

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/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { OriginGuardOptions } from './origin-guard';
2
+ import type { RedirectRouteConfig } from './redirect';
2
3
  import type { TlsConfig, TlsOption } from '@stacksjs/tlsx';
3
4
  export type { TlsConfig, TlsOption };
4
5
  export declare interface StartOptions {
@@ -17,13 +18,28 @@ export declare interface StaticRouteConfig {
17
18
  pathRewriteStyle?: PathRewriteStyle
18
19
  maxAge?: number
19
20
  }
21
+ /**
22
+ * HTTP Basic auth for a single route. When set, rpx challenges every request to
23
+ * the route with `401`/`WWW-Authenticate` until valid credentials are supplied
24
+ * (proxy, static, and WebSocket transports are all gated). Credentials may be
25
+ * given inline, as a `users[]` list, and/or via an Apache `htpasswd` file.
26
+ */
27
+ export declare interface BasicAuthConfig {
28
+ realm?: string
29
+ username?: string
30
+ password?: string
31
+ users?: Array<{ username: string, password: string }>
32
+ htpasswdFile?: string
33
+ }
20
34
  export declare interface BaseProxyConfig {
21
35
  from?: string
22
36
  to: string
37
+ auth?: BasicAuthConfig
23
38
  path?: string
24
39
  start?: StartOptions
25
40
  pathRewrites?: PathRewrite[]
26
41
  static?: string | StaticRouteConfig
42
+ redirect?: string | RedirectRouteConfig
27
43
  id?: string
28
44
  }
29
45
  export declare interface CleanupConfig {
@@ -79,6 +95,49 @@ export declare interface OnDemandTlsConfig {
79
95
  staging?: boolean
80
96
  certsDir?: string
81
97
  }
98
+ /**
99
+ * One backend a site exposes, mapped to a request path. rpx picks a free port,
100
+ * exports it to the dev command via {@link portEnv}, and proxies {@link path}
101
+ * (under the site host) to `localhost:<port>`.
102
+ *
103
+ * A Stacks app, for example, has three: the frontend at `/` (env `PORT`), the
104
+ * API at `/api` (env `PORT_API`), and the docs at `/docs` (env `PORT_DOCS`).
105
+ */
106
+ export declare interface SiteRouteTemplate {
107
+ path?: string
108
+ portEnv: string
109
+ defaultPort?: number
110
+ stripPrefix?: boolean
111
+ readyGate?: boolean
112
+ }
113
+ /**
114
+ * A lazily-booted project. The first request to {@link to} starts {@link command}
115
+ * in {@link dir}; rpx holds the request behind a "starting…" splash until the
116
+ * site's ready gate passes, then proxies it. After {@link idleTimeoutMs} with no
117
+ * traffic the process is stopped again — so a machine can "have" dozens of sites
118
+ * but only run the ones in active use.
119
+ */
120
+ export declare interface SiteConfig {
121
+ to: string
122
+ dir: string
123
+ command: string
124
+ env?: Record<string, string>
125
+ routes?: SiteRouteTemplate[]
126
+ selfRegisters?: boolean
127
+ idleTimeoutMs?: number
128
+ }
129
+ /**
130
+ * On-demand sites: lazily boot a project's dev server the first time its host is
131
+ * visited, then proxy to it (Valet/puma-dev style). Opt-in via {@link enabled}.
132
+ */
133
+ export declare interface OnDemandSitesConfig {
134
+ enabled?: boolean
135
+ sites?: SiteConfig[]
136
+ roots?: string[]
137
+ tlds?: string[]
138
+ idleTimeoutMs?: number
139
+ startupTimeoutMs?: number
140
+ }
82
141
  export declare interface SharedProxyConfig {
83
142
  https: boolean | TlsOption
84
143
  cleanup: boolean | CleanupOptions
@@ -92,10 +151,12 @@ export declare interface SharedProxyConfig {
92
151
  singlePortMode?: boolean
93
152
  httpPort?: number
94
153
  httpsPort?: number
154
+ acmeChallengeWebroot?: string
95
155
  viaDaemon?: boolean
96
156
  hostsManagement?: boolean
97
157
  productionCerts?: ProductionTlsConfig
98
158
  onDemandTls?: OnDemandTlsConfig
159
+ onDemand?: OnDemandSitesConfig
99
160
  originGuard?: OriginGuardOptions
100
161
  }
101
162
  export declare interface SingleProxyConfig extends BaseProxyConfig, SharedProxyConfig {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/rpx",
3
3
  "type": "module",
4
- "version": "0.11.20",
4
+ "version": "0.11.21",
5
5
  "description": "A modern and smart reverse proxy.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",