@stacksjs/rpx 0.4.0 → 0.4.1
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/README.md +34 -34
- package/dist/cli.js +7 -7
- package/dist/https.d.ts +2 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.js +244 -238
- package/dist/start.d.ts +1 -1
- package/dist/types.d.ts +27 -14
- package/package.json +3 -3
package/dist/start.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare function isPortInUse(port: number, hostname: string, verbose?: boolean):
|
|
|
7
7
|
declare function findAvailablePort(startPort: number, hostname: string, verbose?: boolean): Promise<number>;
|
|
8
8
|
declare function testConnection(hostname: string, port: number, verbose?: boolean): Promise<void>;
|
|
9
9
|
export declare function startServer(options: SingleReverseProxyConfig): Promise<void>;
|
|
10
|
-
declare function createProxyServer(from: string, to: string, fromPort: number, listenPort: number, hostname: string, sourceUrl: Pick<URL, 'hostname' | 'host'>, ssl: SSLConfig | null, verbose?: boolean
|
|
10
|
+
declare function createProxyServer(from: string, to: string, fromPort: number, listenPort: number, hostname: string, sourceUrl: Pick<URL, 'hostname' | 'host'>, ssl: SSLConfig | null, verbose?: boolean): Promise<void>;
|
|
11
11
|
export declare function setupReverseProxy(options: ProxySetupOptions): Promise<void>;
|
|
12
12
|
export declare function startHttpRedirectServer(verbose?: boolean): void;
|
|
13
13
|
export declare function startProxy(options: ReverseProxyOption): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
1
|
import type { TlsConfig } from '@stacksjs/tlsx';
|
|
2
2
|
|
|
3
|
-
export type { TlsConfig }
|
|
3
|
+
export type { TlsConfig }
|
|
4
4
|
export declare type CustomTlsConfig = Partial<Omit<TlsConfig, 'caCertPath' | 'certPath' | 'keyPath'>> &
|
|
5
5
|
Pick<TlsConfig, 'caCertPath' | 'certPath' | 'keyPath'>
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
export interface BaseReverseProxyConfig {
|
|
7
8
|
from: string
|
|
8
9
|
to: string
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
export interface CleanupOptions {
|
|
11
13
|
domains?: string[]
|
|
12
14
|
etcHostsCleanup?: boolean
|
|
13
15
|
verbose?: boolean
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
|
|
18
|
+
export interface SharedProxySettings {
|
|
16
19
|
https: boolean | CustomTlsConfig
|
|
17
20
|
etcHostsCleanup: boolean
|
|
18
21
|
verbose: boolean
|
|
19
22
|
_cachedSSLConfig?: SSLConfig | null
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
export
|
|
24
|
+
|
|
25
|
+
export interface SingleReverseProxyConfig extends BaseReverseProxyConfig, SharedProxySettings {}
|
|
26
|
+
|
|
27
|
+
export interface MultiReverseProxyConfig extends SharedProxySettings {
|
|
23
28
|
proxies: BaseReverseProxyConfig[]
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
export
|
|
30
|
+
|
|
31
|
+
export type ReverseProxyConfigs = SingleReverseProxyConfig | MultiReverseProxyConfig
|
|
32
|
+
|
|
33
|
+
export type BaseReverseProxyOption = Partial<BaseReverseProxyConfig>
|
|
27
34
|
export type PartialSharedSettings = Partial<SharedProxySettings>
|
|
28
|
-
|
|
29
|
-
export
|
|
35
|
+
|
|
36
|
+
export type MultiReverseProxyOption = MultiReverseProxyConfig
|
|
37
|
+
|
|
38
|
+
export type ReverseProxyOption = SingleReverseProxyConfig
|
|
30
39
|
export type ReverseProxyOptions = SingleReverseProxyConfig | MultiReverseProxyOption
|
|
31
|
-
|
|
40
|
+
|
|
41
|
+
export interface SSLConfig {
|
|
32
42
|
key: string
|
|
33
43
|
cert: string
|
|
34
44
|
ca?: string | string[]
|
|
35
45
|
}
|
|
36
|
-
|
|
46
|
+
|
|
47
|
+
export interface ProxySetupOptions extends Omit<ReverseProxyOption, 'from'> {
|
|
37
48
|
fromPort: number
|
|
38
49
|
sourceUrl: Pick<URL, 'hostname' | 'host'>
|
|
39
50
|
ssl: SSLConfig | null
|
|
40
51
|
from: string
|
|
41
52
|
to: string
|
|
42
53
|
}
|
|
43
|
-
|
|
54
|
+
|
|
55
|
+
export interface PortManager {
|
|
44
56
|
usedPorts: Set<number>
|
|
45
57
|
getNextAvailablePort: (startPort: number) => Promise<number>
|
|
46
58
|
}
|
|
47
|
-
|
|
59
|
+
|
|
60
|
+
export interface ProxySetupOptions extends Omit<ReverseProxyOption, 'from'> {
|
|
48
61
|
fromPort: number
|
|
49
62
|
sourceUrl: Pick<URL, 'hostname' | 'host'>
|
|
50
63
|
ssl: SSLConfig | null
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/rpx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"description": "A modern reverse proxy.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@stacksjs/cli": "^0.68.2",
|
|
68
68
|
"@stacksjs/eslint-config": "^3.8.1-beta.2",
|
|
69
69
|
"@stacksjs/storage": "^0.68.2",
|
|
70
|
-
"@types/bun": "^1.1.
|
|
70
|
+
"@types/bun": "^1.1.14",
|
|
71
71
|
"bun-config": "^0.3.2",
|
|
72
|
-
"bun-plugin-dtsx": "^0.21.
|
|
72
|
+
"bun-plugin-dtsx": "^0.21.9",
|
|
73
73
|
"typescript": "^5.7.2",
|
|
74
74
|
"vitepress": "^1.5.0"
|
|
75
75
|
},
|