@stacksjs/rpx 0.7.1 → 0.8.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 +13 -3
- package/dist/bin/cli.js +1 -2
- package/dist/{chunk-xt6fyy5z.js → chunk-kbhf94ag.js} +229 -229
- package/dist/https.d.ts +2 -1
- package/dist/src/index.js +1 -2
- package/dist/types.d.ts +8 -5
- package/dist/utils.d.ts +2 -1
- package/package.json +13 -8
package/README.md
CHANGED
|
@@ -44,12 +44,17 @@ Given the npm package is installed:
|
|
|
44
44
|
import type { TlsConfig } from '@stacksjs/rpx'
|
|
45
45
|
import { startProxy } from '@stacksjs/rpx'
|
|
46
46
|
|
|
47
|
+
export interface CleanupConfig {
|
|
48
|
+
hosts: boolean // clean up /etc/hosts, defaults to false
|
|
49
|
+
certs: boolean // clean up certificates, defaults to false
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
export interface ReverseProxyConfig {
|
|
48
53
|
from: string // domain to proxy from, defaults to localhost:3000
|
|
49
54
|
to: string // domain to proxy to, defaults to stacks.localhost
|
|
50
55
|
cleanUrls?: boolean // removes the .html extension from URLs, defaults to false
|
|
51
56
|
https: boolean | TlsConfig // automatically uses https, defaults to true, also redirects http to https
|
|
52
|
-
|
|
57
|
+
cleanup?: boolean | CleanupConfig // automatically cleans up /etc/hosts, defaults to false
|
|
53
58
|
verbose: boolean // log verbose output, defaults to false
|
|
54
59
|
}
|
|
55
60
|
|
|
@@ -58,7 +63,7 @@ const config: ReverseProxyOptions = {
|
|
|
58
63
|
to: 'my-docs.localhost',
|
|
59
64
|
cleanUrls: true,
|
|
60
65
|
https: true,
|
|
61
|
-
|
|
66
|
+
cleanup: false,
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
startProxy(config)
|
|
@@ -79,7 +84,10 @@ const config: ReverseProxyOptions = {
|
|
|
79
84
|
keyPath: path.join(os.homedir(), '.stacks', 'ssl', `stacks.localhost.crt.key`),
|
|
80
85
|
},
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
cleanup: {
|
|
88
|
+
hosts: true,
|
|
89
|
+
certs: false,
|
|
90
|
+
},
|
|
83
91
|
|
|
84
92
|
proxies: [
|
|
85
93
|
{
|
|
@@ -121,6 +129,7 @@ import path from 'node:path'
|
|
|
121
129
|
const config: ReverseProxyOptions = {
|
|
122
130
|
from: 'localhost:5173',
|
|
123
131
|
to: 'stacks.localhost',
|
|
132
|
+
|
|
124
133
|
https: {
|
|
125
134
|
domain: 'stacks.localhost',
|
|
126
135
|
hostCertCN: 'stacks.localhost',
|
|
@@ -137,6 +146,7 @@ const config: ReverseProxyOptions = {
|
|
|
137
146
|
validityDays: 180,
|
|
138
147
|
verbose: false,
|
|
139
148
|
},
|
|
149
|
+
|
|
140
150
|
verbose: false,
|
|
141
151
|
}
|
|
142
152
|
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import{B as p,C as c,a as r,b as e,c as a,w as s}from"../chunk-xt6fyy5z.js";var o=new r("reverse-proxy");o.command("start","Start the Reverse Proxy Server").option("--from <from>","The URL to proxy from").option("--to <to>","The URL to proxy to").option("--key-path <path>","Absolute path to the SSL key").option("--cert-path <path>","Absolute path to the SSL certificate").option("--ca-cert-path <path>","Absolute path to the SSL CA certificate").option("--etc-hosts-cleanup","Cleanup /etc/hosts on exit").option("--verbose","Enable verbose logging").example("reverse-proxy start --from localhost:5173 --to my-project.localhost").example("reverse-proxy start --from localhost:3000 --to my-project.localhost/api").example("reverse-proxy start --from localhost:3000 --to localhost:3001").example("reverse-proxy start --from localhost:5173 --to my-project.test --key-path /absolute/path/to/key --cert-path /absolute/path/to/cert").action(async(t)=>{if(!t?.from||!t.to)return c(a);return p({from:t?.from,to:t?.to,https:s(t),etcHostsCleanup:t?.etcHostsCleanup,verbose:t?.verbose})});o.command("version","Show the version of the Reverse Proxy CLI").action(()=>{console.log(e)});o.version(e);o.help();o.parse();
|
|
1
|
+
import{D as p,E as c,a as r,b as e,c as a,x as s}from"../chunk-kbhf94ag.js";var o=new r("reverse-proxy");o.command("start","Start the Reverse Proxy Server").option("--from <from>","The URL to proxy from").option("--to <to>","The URL to proxy to").option("--key-path <path>","Absolute path to the SSL key").option("--cert-path <path>","Absolute path to the SSL certificate").option("--ca-cert-path <path>","Absolute path to the SSL CA certificate").option("--etc-hosts-cleanup","Cleanup /etc/hosts on exit").option("--verbose","Enable verbose logging").example("reverse-proxy start --from localhost:5173 --to my-project.localhost").example("reverse-proxy start --from localhost:3000 --to my-project.localhost/api").example("reverse-proxy start --from localhost:3000 --to localhost:3001").example("reverse-proxy start --from localhost:5173 --to my-project.test --key-path /absolute/path/to/key --cert-path /absolute/path/to/cert").action(async(t)=>{if(!t?.from||!t.to)return c(a);return p({from:t?.from,to:t?.to,https:s(t),etcHostsCleanup:t?.etcHostsCleanup,verbose:t?.verbose})});o.command("version","Show the version of the Reverse Proxy CLI").action(()=>{console.log(e)});o.version(e);o.help();o.parse();
|