@stacksjs/rpx 0.1.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.
@@ -0,0 +1,14 @@
1
+ import type { ProxySetupOptions, ReverseProxyOption, ReverseProxyOptions, SSLConfig } from './types';
2
+
3
+ declare const activeServers: Set<http.Server | https.Server>;
4
+ declare function cleanup(): void;
5
+ declare function loadSSLConfig(options: ReverseProxyOption): Promise<SSLConfig | null>;
6
+ declare function isPortInUse(port: number, hostname: string, verbose?: boolean): Promise<boolean>;
7
+ declare function findAvailablePort(startPort: number, hostname: string, verbose?: boolean): Promise<number>;
8
+ declare function testConnection(hostname: string, port: number, verbose?: boolean): Promise<void>;
9
+ export declare function startServer(options?: ReverseProxyOption): 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,): Promise<void>;
11
+ export declare function setupReverseProxy(options: ProxySetupOptions): Promise<void>;
12
+ export declare function startHttpRedirectServer(verbose?: boolean): void;
13
+ export declare function startProxy(options?: ReverseProxyOption): void;
14
+ export declare function startProxies(options?: ReverseProxyOptions): void;
@@ -0,0 +1,24 @@
1
+ import type { TlsConfig } from '@stacksjs/tlsx';
2
+
3
+ export type { TlsConfig };
4
+ export declare interface ReverseProxyConfig {
5
+ from: string
6
+ to: string
7
+ https: TlsConfig
8
+ verbose: boolean
9
+ }
10
+ export declare type ReverseProxyOption = Partial<ReverseProxyConfig>
11
+ export type ReverseProxyOptions = ReverseProxyOption | ReverseProxyOption[]
12
+ export declare interface SSLConfig {
13
+ key: string
14
+ cert: string
15
+ ca?: string | string[]
16
+ secureOptions?: number
17
+ }
18
+ export declare interface ProxySetupOptions extends Omit<ReverseProxyOption, 'from'> {
19
+ fromPort: number
20
+ sourceUrl: Pick<URL, 'hostname' | 'host'>
21
+ ssl: SSLConfig | null
22
+ from: string
23
+ to: string
24
+ }
@@ -0,0 +1 @@
1
+ export declare function debugLog(category: string, message: string, verbose?: boolean): void;
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@stacksjs/rpx",
3
+ "type": "module",
4
+ "version": "0.1.1",
5
+ "description": "A modern reverse proxy.",
6
+ "author": "Chris Breuer <chris@stacksjs.org>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/stacksjs/rpx#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/stacksjs/rpx.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/stacksjs/rpx/issues"
15
+ },
16
+ "keywords": [
17
+ "reverse proxy",
18
+ "ssl",
19
+ "development",
20
+ "environment",
21
+ "proxy",
22
+ "bun",
23
+ "stacks",
24
+ "typescript",
25
+ "javascript"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./*": {
32
+ "import": "./dist/*"
33
+ }
34
+ },
35
+ "module": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "bin": {
38
+ "rpx": "./dist/cli.js",
39
+ "reverse-proxy": "./dist/cli.js"
40
+ },
41
+ "files": ["README.md", "dist"],
42
+ "scripts": {
43
+ "build": "bun build.ts && bun run compile",
44
+ "compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/rpx",
45
+ "compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
46
+ "compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/rpx-linux-x64",
47
+ "compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/rpx-linux-arm64",
48
+ "compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/rpx-windows-x64.exe",
49
+ "compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/rpx-darwin-x64",
50
+ "compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/rpx-darwin-arm64",
51
+ "lint": "bunx eslint .",
52
+ "lint:fix": "bunx eslint . --fix",
53
+ "fresh": "bunx rimraf node_modules/ bun.lock && bun i",
54
+ "changelog": "bunx changelogen --output CHANGELOG.md",
55
+ "prepublishOnly": "bun --bun run build && bun run compile:all",
56
+ "release": "bun run changelog && bunx bumpp package.json --all",
57
+ "test": "bun test",
58
+ "typecheck": "bunx tsc --noEmit",
59
+ "dev:docs": "vitepress dev docs",
60
+ "build:docs": "vitepress build docs",
61
+ "preview:docs": "vitepress preview docs"
62
+ },
63
+ "dependencies": {
64
+ "@stacksjs/tlsx": "^0.5.6"
65
+ },
66
+ "devDependencies": {
67
+ "@stacksjs/cli": "^0.68.2",
68
+ "@stacksjs/eslint-config": "^3.8.1-beta.2",
69
+ "@stacksjs/storage": "^0.68.2",
70
+ "@types/bun": "^1.1.13",
71
+ "bun-config": "^0.2.0",
72
+ "bun-plugin-dtsx": "^0.21.8",
73
+ "typescript": "^5.6.3",
74
+ "vitepress": "^1.5.0"
75
+ },
76
+ "simple-git-hooks": {
77
+ "pre-commit": "bunx lint-staged"
78
+ },
79
+ "lint-staged": {
80
+ "*.{js,ts}": "bunx eslint . --fix"
81
+ }
82
+ }