@powerhousedao/ph-run 0.0.0-stage → 6.2.3-dev.101
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/LICENSE +661 -0
- package/dist/classic-args-BYccyIIC.mjs +36 -0
- package/dist/classic-args-BYccyIIC.mjs.map +1 -0
- package/dist/classic-args-Dm0_3O5p.d.mts +194 -0
- package/dist/classic-args-Dm0_3O5p.d.mts.map +1 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +32 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/connect-plugin-configs-CPRA8hQJ.mjs +50 -0
- package/dist/connect-plugin-configs-CPRA8hQJ.mjs.map +1 -0
- package/dist/connect-serve-1WAi0KJL.mjs +201 -0
- package/dist/connect-serve-1WAi0KJL.mjs.map +1 -0
- package/dist/connect-serve-COWXf_41.d.mts +64 -0
- package/dist/connect-serve-COWXf_41.d.mts.map +1 -0
- package/dist/member-config-Bs3yOT6y.mjs +161 -0
- package/dist/member-config-Bs3yOT6y.mjs.map +1 -0
- package/dist/runners/connect.d.mts +1271 -0
- package/dist/runners/connect.d.mts.map +1 -0
- package/dist/runners/connect.mjs +273 -0
- package/dist/runners/connect.mjs.map +1 -0
- package/dist/runners/member-config.d.mts +796 -0
- package/dist/runners/member-config.d.mts.map +1 -0
- package/dist/runners/member-config.mjs +4 -0
- package/dist/runners/switchboard.d.mts +1754 -0
- package/dist/runners/switchboard.d.mts.map +1 -0
- package/dist/runners/switchboard.mjs +714 -0
- package/dist/runners/switchboard.mjs.map +1 -0
- package/dist/services/classic-args.d.mts +3 -0
- package/dist/services/classic-args.mjs +4 -0
- package/dist/services/connect-serve.d.mts +3 -0
- package/dist/services/connect-serve.mjs +4 -0
- package/dist/services/connect-server.d.mts +26 -0
- package/dist/services/connect-server.d.mts.map +1 -0
- package/dist/services/connect-server.mjs +219 -0
- package/dist/services/connect-server.mjs.map +1 -0
- package/dist/services/run/start-run.d.mts +29 -0
- package/dist/services/run/start-run.d.mts.map +1 -0
- package/dist/services/run/start-run.mjs +4 -0
- package/dist/services/switchboard.d.mts +79 -0
- package/dist/services/switchboard.d.mts.map +1 -0
- package/dist/services/switchboard.mjs +191 -0
- package/dist/services/switchboard.mjs.map +1 -0
- package/dist/start-run-DWn2cVyi.mjs +125 -0
- package/dist/start-run-DWn2cVyi.mjs.map +1 -0
- package/dist/superseded-config-CpHrCuNq.mjs +53 -0
- package/dist/superseded-config-CpHrCuNq.mjs.map +1 -0
- package/package.json +93 -3
- package/README.md +0 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="25f4ecc9-e49b-546f-9baa-cec84d0ddc4d")}catch(e){}}();
|
|
3
|
+
import { connectPreviewArgs, switchboardArgs } from "@powerhousedao/shared/clis/args";
|
|
4
|
+
import { command, runSafely } from "cmd-ts";
|
|
5
|
+
//#region src/services/classic-args.ts
|
|
6
|
+
/**
|
|
7
|
+
* The classic `ph switchboard` argument shape, produced by the SAME cmd-ts
|
|
8
|
+
* definitions the classic command parses — not re-derived by hand. A runner
|
|
9
|
+
* starts from this object and overlays only the keys its host file owns, so
|
|
10
|
+
* every key the classic command carries (including the ones it carries as
|
|
11
|
+
* `undefined`, e.g. `dbPath`) reaches the service exactly as it does on the
|
|
12
|
+
* classic path. The uniform-runners switchboard runner once hand-built a
|
|
13
|
+
* partial object that omitted `dbPath`; the service's then-default
|
|
14
|
+
* `.ph/read-model.db` became both the reactor and the read-model PGlite dir —
|
|
15
|
+
* two instances on one PGDATA (see uniform-runners-plan/legacy-parity-rectification.md).
|
|
16
|
+
*/
|
|
17
|
+
const classicSwitchboard = command({
|
|
18
|
+
name: "switchboard",
|
|
19
|
+
args: switchboardArgs,
|
|
20
|
+
handler: (args) => args
|
|
21
|
+
});
|
|
22
|
+
command({
|
|
23
|
+
name: "preview",
|
|
24
|
+
args: connectPreviewArgs,
|
|
25
|
+
handler: (args) => args
|
|
26
|
+
});
|
|
27
|
+
async function classicSwitchboardArgs(argv = []) {
|
|
28
|
+
const result = await runSafely(classicSwitchboard, argv);
|
|
29
|
+
if (result._tag === "error") throw new Error(`classic switchboard args did not parse: ${result.error.config.message}`);
|
|
30
|
+
return result.value;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { classicSwitchboardArgs as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=classic-args-BYccyIIC.mjs.map
|
|
36
|
+
//# debugId=25f4ecc9-e49b-546f-9baa-cec84d0ddc4d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classic-args-BYccyIIC.mjs","sources":["../src/services/classic-args.ts"],"sourcesContent":["import type { ParsedCmdResult } from \"@powerhousedao/shared/clis\";\nimport {\n connectPreviewArgs,\n switchboardArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, runSafely } from \"cmd-ts\";\n\n/**\n * The classic `ph switchboard` argument shape, produced by the SAME cmd-ts\n * definitions the classic command parses — not re-derived by hand. A runner\n * starts from this object and overlays only the keys its host file owns, so\n * every key the classic command carries (including the ones it carries as\n * `undefined`, e.g. `dbPath`) reaches the service exactly as it does on the\n * classic path. The uniform-runners switchboard runner once hand-built a\n * partial object that omitted `dbPath`; the service's then-default\n * `.ph/read-model.db` became both the reactor and the read-model PGlite dir —\n * two instances on one PGDATA (see uniform-runners-plan/legacy-parity-rectification.md).\n */\nconst classicSwitchboard = command({\n name: \"switchboard\",\n args: switchboardArgs,\n handler: (args) => args,\n});\n\nconst classicConnectPreview = command({\n name: \"preview\",\n args: connectPreviewArgs,\n handler: (args) => args,\n});\n\nexport type SwitchboardArgs = ParsedCmdResult<typeof classicSwitchboard>;\nexport type ConnectPreviewArgs = ParsedCmdResult<typeof classicConnectPreview>;\n\nexport async function classicSwitchboardArgs(\n argv: string[] = [],\n): Promise<SwitchboardArgs> {\n const result = await runSafely(classicSwitchboard, argv);\n if (result._tag === \"error\") {\n throw new Error(\n `classic switchboard args did not parse: ${result.error.config.message}`,\n );\n }\n return result.value;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,qBAAqB,QAAQ;CACjC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAE6B,QAAQ;CACpC,MAAM;CACN,MAAM;CACN,UAAU,SAAS;AACrB,CAAC;AAKD,eAAsB,uBACpB,OAAiB,CAAC,GACQ;CAC1B,MAAM,SAAS,MAAM,UAAU,oBAAoB,IAAI;CACvD,IAAI,OAAO,SAAS,SAClB,MAAM,IAAI,MACR,2CAA2C,OAAO,MAAM,OAAO,SACjE;CAEF,OAAO,OAAO;AAChB","debug_id":"25f4ecc9-e49b-546f-9baa-cec84d0ddc4d"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { ParsedCmdResult } from "@powerhousedao/shared/clis";
|
|
2
|
+
//#region src/services/classic-args.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The classic `ph switchboard` argument shape, produced by the SAME cmd-ts
|
|
5
|
+
* definitions the classic command parses — not re-derived by hand. A runner
|
|
6
|
+
* starts from this object and overlays only the keys its host file owns, so
|
|
7
|
+
* every key the classic command carries (including the ones it carries as
|
|
8
|
+
* `undefined`, e.g. `dbPath`) reaches the service exactly as it does on the
|
|
9
|
+
* classic path. The uniform-runners switchboard runner once hand-built a
|
|
10
|
+
* partial object that omitted `dbPath`; the service's then-default
|
|
11
|
+
* `.ph/read-model.db` became both the reactor and the read-model PGlite dir —
|
|
12
|
+
* two instances on one PGDATA (see uniform-runners-plan/legacy-parity-rectification.md).
|
|
13
|
+
*/
|
|
14
|
+
declare const classicSwitchboard: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
15
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
16
|
+
debug: boolean | undefined;
|
|
17
|
+
https: boolean | undefined;
|
|
18
|
+
httpsKeyFile: string | undefined;
|
|
19
|
+
httpsCertFile: string | undefined;
|
|
20
|
+
dev: boolean | undefined;
|
|
21
|
+
remoteDrives: string[];
|
|
22
|
+
disableLocalPackages: boolean | undefined;
|
|
23
|
+
packages: string | undefined;
|
|
24
|
+
port: number;
|
|
25
|
+
basePath: string | undefined;
|
|
26
|
+
keypairPath: string | undefined;
|
|
27
|
+
vetraDriveId: string;
|
|
28
|
+
dbPath: string | undefined;
|
|
29
|
+
useIdentity: boolean | undefined;
|
|
30
|
+
requireIdentity: boolean | undefined;
|
|
31
|
+
migrate: boolean | undefined;
|
|
32
|
+
migrateStatus: boolean | undefined;
|
|
33
|
+
reset: boolean | undefined;
|
|
34
|
+
yes: boolean | undefined;
|
|
35
|
+
mcp: boolean;
|
|
36
|
+
useVetraDrive: boolean;
|
|
37
|
+
}>>;
|
|
38
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
39
|
+
debug: boolean | undefined;
|
|
40
|
+
https: boolean | undefined;
|
|
41
|
+
httpsKeyFile: string | undefined;
|
|
42
|
+
httpsCertFile: string | undefined;
|
|
43
|
+
dev: boolean | undefined;
|
|
44
|
+
remoteDrives: string[];
|
|
45
|
+
disableLocalPackages: boolean | undefined;
|
|
46
|
+
packages: string | undefined;
|
|
47
|
+
port: number;
|
|
48
|
+
basePath: string | undefined;
|
|
49
|
+
keypairPath: string | undefined;
|
|
50
|
+
vetraDriveId: string;
|
|
51
|
+
dbPath: string | undefined;
|
|
52
|
+
useIdentity: boolean | undefined;
|
|
53
|
+
requireIdentity: boolean | undefined;
|
|
54
|
+
migrate: boolean | undefined;
|
|
55
|
+
migrateStatus: boolean | undefined;
|
|
56
|
+
reset: boolean | undefined;
|
|
57
|
+
yes: boolean | undefined;
|
|
58
|
+
mcp: boolean;
|
|
59
|
+
useVetraDrive: boolean;
|
|
60
|
+
}, {
|
|
61
|
+
debug: boolean | undefined;
|
|
62
|
+
https: boolean | undefined;
|
|
63
|
+
httpsKeyFile: string | undefined;
|
|
64
|
+
httpsCertFile: string | undefined;
|
|
65
|
+
dev: boolean | undefined;
|
|
66
|
+
remoteDrives: string[];
|
|
67
|
+
disableLocalPackages: boolean | undefined;
|
|
68
|
+
packages: string | undefined;
|
|
69
|
+
port: number;
|
|
70
|
+
basePath: string | undefined;
|
|
71
|
+
keypairPath: string | undefined;
|
|
72
|
+
vetraDriveId: string;
|
|
73
|
+
dbPath: string | undefined;
|
|
74
|
+
useIdentity: boolean | undefined;
|
|
75
|
+
requireIdentity: boolean | undefined;
|
|
76
|
+
migrate: boolean | undefined;
|
|
77
|
+
migrateStatus: boolean | undefined;
|
|
78
|
+
reset: boolean | undefined;
|
|
79
|
+
yes: boolean | undefined;
|
|
80
|
+
mcp: boolean;
|
|
81
|
+
useVetraDrive: boolean;
|
|
82
|
+
}> & {
|
|
83
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
84
|
+
debug: boolean | undefined;
|
|
85
|
+
https: boolean | undefined;
|
|
86
|
+
httpsKeyFile: string | undefined;
|
|
87
|
+
httpsCertFile: string | undefined;
|
|
88
|
+
dev: boolean | undefined;
|
|
89
|
+
remoteDrives: string[];
|
|
90
|
+
disableLocalPackages: boolean | undefined;
|
|
91
|
+
packages: string | undefined;
|
|
92
|
+
port: number;
|
|
93
|
+
basePath: string | undefined;
|
|
94
|
+
keypairPath: string | undefined;
|
|
95
|
+
vetraDriveId: string;
|
|
96
|
+
dbPath: string | undefined;
|
|
97
|
+
useIdentity: boolean | undefined;
|
|
98
|
+
requireIdentity: boolean | undefined;
|
|
99
|
+
migrate: boolean | undefined;
|
|
100
|
+
migrateStatus: boolean | undefined;
|
|
101
|
+
reset: boolean | undefined;
|
|
102
|
+
yes: boolean | undefined;
|
|
103
|
+
mcp: boolean;
|
|
104
|
+
useVetraDrive: boolean;
|
|
105
|
+
}>>;
|
|
106
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
107
|
+
declare const classicConnectPreview: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
108
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
109
|
+
debug: boolean | undefined;
|
|
110
|
+
connectBasePath: string;
|
|
111
|
+
logLevel: "debug" | "error" | "info" | "verbose" | "warn";
|
|
112
|
+
packages: string | undefined;
|
|
113
|
+
localPackage: string | undefined;
|
|
114
|
+
disableLocalPackages: boolean | undefined;
|
|
115
|
+
defaultDrivesUrl: string | undefined;
|
|
116
|
+
drivesPreserveStrategy: "preserve-all" | "preserve-by-url-and-detach";
|
|
117
|
+
force: boolean | undefined;
|
|
118
|
+
host: string | undefined;
|
|
119
|
+
open: boolean | undefined;
|
|
120
|
+
cors: boolean | undefined;
|
|
121
|
+
strictPort: boolean | undefined;
|
|
122
|
+
printUrls: boolean;
|
|
123
|
+
bindCLIShortcuts: boolean;
|
|
124
|
+
watchTimeout: number;
|
|
125
|
+
port: number;
|
|
126
|
+
outDir: string;
|
|
127
|
+
}>>;
|
|
128
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
129
|
+
debug: boolean | undefined;
|
|
130
|
+
connectBasePath: string;
|
|
131
|
+
logLevel: "debug" | "error" | "info" | "verbose" | "warn";
|
|
132
|
+
packages: string | undefined;
|
|
133
|
+
localPackage: string | undefined;
|
|
134
|
+
disableLocalPackages: boolean | undefined;
|
|
135
|
+
defaultDrivesUrl: string | undefined;
|
|
136
|
+
drivesPreserveStrategy: "preserve-all" | "preserve-by-url-and-detach";
|
|
137
|
+
force: boolean | undefined;
|
|
138
|
+
host: string | undefined;
|
|
139
|
+
open: boolean | undefined;
|
|
140
|
+
cors: boolean | undefined;
|
|
141
|
+
strictPort: boolean | undefined;
|
|
142
|
+
printUrls: boolean;
|
|
143
|
+
bindCLIShortcuts: boolean;
|
|
144
|
+
watchTimeout: number;
|
|
145
|
+
port: number;
|
|
146
|
+
outDir: string;
|
|
147
|
+
}, {
|
|
148
|
+
debug: boolean | undefined;
|
|
149
|
+
connectBasePath: string;
|
|
150
|
+
logLevel: "debug" | "error" | "info" | "verbose" | "warn";
|
|
151
|
+
packages: string | undefined;
|
|
152
|
+
localPackage: string | undefined;
|
|
153
|
+
disableLocalPackages: boolean | undefined;
|
|
154
|
+
defaultDrivesUrl: string | undefined;
|
|
155
|
+
drivesPreserveStrategy: "preserve-all" | "preserve-by-url-and-detach";
|
|
156
|
+
force: boolean | undefined;
|
|
157
|
+
host: string | undefined;
|
|
158
|
+
open: boolean | undefined;
|
|
159
|
+
cors: boolean | undefined;
|
|
160
|
+
strictPort: boolean | undefined;
|
|
161
|
+
printUrls: boolean;
|
|
162
|
+
bindCLIShortcuts: boolean;
|
|
163
|
+
watchTimeout: number;
|
|
164
|
+
port: number;
|
|
165
|
+
outDir: string;
|
|
166
|
+
}> & {
|
|
167
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
168
|
+
debug: boolean | undefined;
|
|
169
|
+
connectBasePath: string;
|
|
170
|
+
logLevel: "debug" | "error" | "info" | "verbose" | "warn";
|
|
171
|
+
packages: string | undefined;
|
|
172
|
+
localPackage: string | undefined;
|
|
173
|
+
disableLocalPackages: boolean | undefined;
|
|
174
|
+
defaultDrivesUrl: string | undefined;
|
|
175
|
+
drivesPreserveStrategy: "preserve-all" | "preserve-by-url-and-detach";
|
|
176
|
+
force: boolean | undefined;
|
|
177
|
+
host: string | undefined;
|
|
178
|
+
open: boolean | undefined;
|
|
179
|
+
cors: boolean | undefined;
|
|
180
|
+
strictPort: boolean | undefined;
|
|
181
|
+
printUrls: boolean;
|
|
182
|
+
bindCLIShortcuts: boolean;
|
|
183
|
+
watchTimeout: number;
|
|
184
|
+
port: number;
|
|
185
|
+
outDir: string;
|
|
186
|
+
}>>;
|
|
187
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
188
|
+
type SwitchboardArgs = ParsedCmdResult<typeof classicSwitchboard>;
|
|
189
|
+
type ConnectPreviewArgs = ParsedCmdResult<typeof classicConnectPreview>;
|
|
190
|
+
declare function classicSwitchboardArgs(argv?: string[]): Promise<SwitchboardArgs>;
|
|
191
|
+
//#endregion
|
|
192
|
+
export { SwitchboardArgs as n, classicSwitchboardArgs as r, ConnectPreviewArgs as t };
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=classic-args-Dm0_3O5p.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classic-args-Dm0_3O5p.d.mts","names":[],"sources":["../src/services/classic-args.ts"],"mappings":";;;;;;;;;;;;;cAkBM,oBAAkB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB,6CAAA,iDAAA,mDAAA;cAEI,uBAAqB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIzB,6CAAA,iDAAA,mDAAA;KAEU,kBAAkB,uBAAuB;KACzC,qBAAqB,uBAAuB;iBAElC,uBACpB,kBACC,QAAQ"}
|
package/dist/cli.d.mts
ADDED
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3109cda4-a037-595b-8c8a-1725272205e1")}catch(e){}}();
|
|
4
|
+
import { t as startRun } from "./start-run-DWn2cVyi.mjs";
|
|
5
|
+
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
6
|
+
//#region src/cli.ts
|
|
7
|
+
/**
|
|
8
|
+
* `ph-run run <host> [verb]`: what `ph run` does and nothing else `ph` does, so
|
|
9
|
+
* a packaged app can run a host with none of the tools that build one. It takes
|
|
10
|
+
* `run` as its first word so a supervisor can start either of the two the same
|
|
11
|
+
* way.
|
|
12
|
+
*/
|
|
13
|
+
async function main(args) {
|
|
14
|
+
assertNodeVersion();
|
|
15
|
+
const debug = args.includes("--debug");
|
|
16
|
+
const [command, host, verb] = args.filter((arg) => arg !== "--debug");
|
|
17
|
+
if (command !== "run" || !host) throw new Error("Usage: ph-run run <host> [verb] [--debug]");
|
|
18
|
+
await startRun({
|
|
19
|
+
host,
|
|
20
|
+
verb,
|
|
21
|
+
debug
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
await main(process.argv.slice(2)).catch((error) => {
|
|
25
|
+
console.error(error instanceof Error ? error.message : error);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export {};
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=cli.mjs.map
|
|
32
|
+
//# debugId=3109cda4-a037-595b-8c8a-1725272205e1
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { assertNodeVersion } from \"@powerhousedao/shared/clis/utils\";\nimport { startRun } from \"./services/run/start-run.js\";\n\n/**\n * `ph-run run <host> [verb]`: what `ph run` does and nothing else `ph` does, so\n * a packaged app can run a host with none of the tools that build one. It takes\n * `run` as its first word so a supervisor can start either of the two the same\n * way.\n */\nasync function main(args: string[]) {\n assertNodeVersion();\n const debug = args.includes(\"--debug\");\n const [command, host, verb] = args.filter((arg) => arg !== \"--debug\");\n if (command !== \"run\" || !host) {\n throw new Error(\"Usage: ph-run run <host> [verb] [--debug]\");\n }\n await startRun({ host, verb, debug });\n}\n\nawait main(process.argv.slice(2)).catch((error: unknown) => {\n console.error(error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAUA,eAAe,KAAK,MAAgB;CAClC,kBAAkB;CAClB,MAAM,QAAQ,KAAK,SAAS,SAAS;CACrC,MAAM,CAAC,SAAS,MAAM,QAAQ,KAAK,QAAQ,QAAQ,QAAQ,SAAS;CACpE,IAAI,YAAY,SAAS,CAAC,MACxB,MAAM,IAAI,MAAM,2CAA2C;CAE7D,MAAM,SAAS;EAAE;EAAM;EAAM;CAAM,CAAC;AACtC;AAEA,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,UAAmB;CAC1D,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAK;CAC5D,QAAQ,KAAK,CAAC;AAChB,CAAC","debug_id":"3109cda4-a037-595b-8c8a-1725272205e1"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="343788e5-4606-5080-b02b-274217034899")}catch(e){}}();
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { PluginError, entryActiveForVerb, isSchemaLike, normalizePluginEntries } from "@powerhousedao/host-core";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
7
|
+
//#region src/runners/connect-plugin-configs.ts
|
|
8
|
+
/** The zod-only entry Connect publishes with every built-in plugin's entry
|
|
9
|
+
* config schema, keyed by plugin specifier. */
|
|
10
|
+
const PLUGIN_CONFIGS_ENTRY = "@powerhousedao/connect/plugin-configs";
|
|
11
|
+
/**
|
|
12
|
+
* Validate the entry configs of the Connect plugins composed for `verb`
|
|
13
|
+
* before Connect boots, so a typo fails at `ph run` naming the plugin and the
|
|
14
|
+
* key instead of at browser boot. The schemas come from the project's own
|
|
15
|
+
* `@powerhousedao/connect/plugin-configs` (resolved from the project tree,
|
|
16
|
+
* like runner and plugin modules); without it, or for a specifier it has no
|
|
17
|
+
* schema for, the browser's own validation stays the only check.
|
|
18
|
+
*/
|
|
19
|
+
async function validateConnectPluginConfigs(projectRoot, entries, verb, where) {
|
|
20
|
+
if (entries === void 0 || entries.length === 0) return;
|
|
21
|
+
const schemas = await loadPluginConfigSchemas(projectRoot);
|
|
22
|
+
if (!schemas) return;
|
|
23
|
+
for (const entry of normalizePluginEntries(entries, where)) {
|
|
24
|
+
if (!entryActiveForVerb(entry, verb)) continue;
|
|
25
|
+
const schema = schemas[entry.module];
|
|
26
|
+
if (!isSchemaLike(schema)) continue;
|
|
27
|
+
const parsed = schema.safeParse(entry.config);
|
|
28
|
+
if (parsed.success) continue;
|
|
29
|
+
const issues = parsed.error.issues.map((issue) => {
|
|
30
|
+
return ` - ${["config", ...issue.path.map(String)].join(".")}: ${issue.message}`;
|
|
31
|
+
});
|
|
32
|
+
throw new PluginError(`${where}: config for plugin "${entry.module}" is invalid:\n${issues.join("\n")}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function loadPluginConfigSchemas(projectRoot) {
|
|
36
|
+
const projectRequire = createRequire(pathToFileURL(path.join(projectRoot, "package.json")).href);
|
|
37
|
+
let file;
|
|
38
|
+
try {
|
|
39
|
+
file = projectRequire.resolve(PLUGIN_CONFIGS_ENTRY);
|
|
40
|
+
} catch {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const schemas = (await import(pathToFileURL(file).href)).connectPluginConfigSchemas;
|
|
44
|
+
return typeof schemas === "object" && schemas !== null ? schemas : void 0;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { validateConnectPluginConfigs };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=connect-plugin-configs-CPRA8hQJ.mjs.map
|
|
50
|
+
//# debugId=343788e5-4606-5080-b02b-274217034899
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-plugin-configs-CPRA8hQJ.mjs","sources":["../src/runners/connect-plugin-configs.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport {\n entryActiveForVerb,\n isSchemaLike,\n normalizePluginEntries,\n PluginError,\n type PluginEntryData,\n} from \"@powerhousedao/host-core\";\n\n/** The zod-only entry Connect publishes with every built-in plugin's entry\n * config schema, keyed by plugin specifier. */\nconst PLUGIN_CONFIGS_ENTRY = \"@powerhousedao/connect/plugin-configs\";\n\n/**\n * Validate the entry configs of the Connect plugins composed for `verb`\n * before Connect boots, so a typo fails at `ph run` naming the plugin and the\n * key instead of at browser boot. The schemas come from the project's own\n * `@powerhousedao/connect/plugin-configs` (resolved from the project tree,\n * like runner and plugin modules); without it, or for a specifier it has no\n * schema for, the browser's own validation stays the only check.\n */\nexport async function validateConnectPluginConfigs(\n projectRoot: string,\n entries: readonly PluginEntryData[] | undefined,\n verb: string,\n where: string,\n): Promise<void> {\n if (entries === undefined || entries.length === 0) return;\n const schemas = await loadPluginConfigSchemas(projectRoot);\n if (!schemas) return;\n for (const entry of normalizePluginEntries(entries, where)) {\n if (!entryActiveForVerb(entry, verb)) continue;\n const schema = schemas[entry.module];\n if (!isSchemaLike(schema)) continue;\n const parsed = schema.safeParse(entry.config);\n if (parsed.success) continue;\n const issues = parsed.error.issues.map((issue) => {\n const key = [\"config\", ...issue.path.map(String)].join(\".\");\n return ` - ${key}: ${issue.message}`;\n });\n throw new PluginError(\n `${where}: config for plugin \"${entry.module}\" is invalid:\\n${issues.join(\"\\n\")}`,\n );\n }\n}\n\nasync function loadPluginConfigSchemas(\n projectRoot: string,\n): Promise<Record<string, unknown> | undefined> {\n const projectRequire = createRequire(\n pathToFileURL(path.join(projectRoot, \"package.json\")).href,\n );\n let file: string;\n try {\n file = projectRequire.resolve(PLUGIN_CONFIGS_ENTRY);\n } catch {\n return undefined;\n }\n const module = (await import(pathToFileURL(file).href)) as {\n connectPluginConfigSchemas?: unknown;\n };\n const schemas = module.connectPluginConfigSchemas;\n return typeof schemas === \"object\" && schemas !== null\n ? (schemas as Record<string, unknown>)\n : undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;AAaA,MAAM,uBAAuB;;;;;;;;;AAU7B,eAAsB,6BACpB,aACA,SACA,MACA,OACe;CACf,IAAI,YAAY,KAAA,KAAa,QAAQ,WAAW,GAAG;CACnD,MAAM,UAAU,MAAM,wBAAwB,WAAW;CACzD,IAAI,CAAC,SAAS;CACd,KAAK,MAAM,SAAS,uBAAuB,SAAS,KAAK,GAAG;EAC1D,IAAI,CAAC,mBAAmB,OAAO,IAAI,GAAG;EACtC,MAAM,SAAS,QAAQ,MAAM;EAC7B,IAAI,CAAC,aAAa,MAAM,GAAG;EAC3B,MAAM,SAAS,OAAO,UAAU,MAAM,MAAM;EAC5C,IAAI,OAAO,SAAS;EACpB,MAAM,SAAS,OAAO,MAAM,OAAO,KAAK,UAAU;GAEhD,OAAO,OADK,CAAC,UAAU,GAAG,MAAM,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,GACvC,EAAE,IAAI,MAAM;EAC9B,CAAC;EACD,MAAM,IAAI,YACR,GAAG,MAAM,uBAAuB,MAAM,OAAO,iBAAiB,OAAO,KAAK,IAAI,GAChF;CACF;AACF;AAEA,eAAe,wBACb,aAC8C;CAC9C,MAAM,iBAAiB,cACrB,cAAc,KAAK,KAAK,aAAa,cAAc,CAAC,CAAC,CAAC,IACxD;CACA,IAAI;CACJ,IAAI;EACF,OAAO,eAAe,QAAQ,oBAAoB;CACpD,QAAQ;EACN;CACF;CAIA,MAAM,WAAU,MAHM,OAAO,cAAc,IAAI,CAAC,CAAC,MAAA,CAG1B;CACvB,OAAO,OAAO,YAAY,YAAY,YAAY,OAC7C,UACD,KAAA;AACN","debug_id":"343788e5-4606-5080-b02b-274217034899"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="152aac10-515c-55ef-9f11-64c6a3fbff77")}catch(e){}}();
|
|
3
|
+
import { DEFAULT_CONNECT_OUTDIR } from "@powerhousedao/shared/clis";
|
|
4
|
+
import { isHtmlNavigation, isSwitchboardProxyPath } from "@powerhousedao/shared/connect/origin-placeholder";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
+
import { getConfig } from "@powerhousedao/config/node";
|
|
8
|
+
import { deepMerge, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
9
|
+
import { APP_SHELLS_FILE, appShellVariant, appShellVariantOf, readShellPluginsIn, swapAppShell, withShellAppName } from "@powerhousedao/shared/connect/app-shell";
|
|
10
|
+
import sirv from "sirv";
|
|
11
|
+
//#region src/services/connect-serve.ts
|
|
12
|
+
/**
|
|
13
|
+
* The env contract a supervisor can drive the preview with — the same
|
|
14
|
+
* variables the Docker entrypoint and clint's service manager already speak:
|
|
15
|
+
* PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into
|
|
16
|
+
* drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and
|
|
17
|
+
* PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP
|
|
18
|
+
* patch). Lets `ph connect preview` replace hand-rolled static servers
|
|
19
|
+
* (clint's connect-server, the ph-win sidecar) without losing injection.
|
|
20
|
+
*/
|
|
21
|
+
function overrideFromEnv(env = process.env) {
|
|
22
|
+
const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;
|
|
23
|
+
const registry = env.PH_CONNECT_PACKAGES_REGISTRY;
|
|
24
|
+
if (!drivesUrl && !registry) return void 0;
|
|
25
|
+
const override = {};
|
|
26
|
+
if (drivesUrl) override.connect = { drives: {
|
|
27
|
+
defaultDrives: drivesUrl.split(",").map((s) => s.trim()).filter(Boolean).map((url) => ({
|
|
28
|
+
url,
|
|
29
|
+
name: null,
|
|
30
|
+
icon: null
|
|
31
|
+
})),
|
|
32
|
+
preserveStrategy: env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? "preserve-all"
|
|
33
|
+
} };
|
|
34
|
+
if (registry) {
|
|
35
|
+
override.packageRegistryUrl = registry;
|
|
36
|
+
override.cspRegistrySync = true;
|
|
37
|
+
}
|
|
38
|
+
return override;
|
|
39
|
+
}
|
|
40
|
+
function mergedConfigBody(outDir, override) {
|
|
41
|
+
const file = path.join(outDir, "powerhouse.config.json");
|
|
42
|
+
const baked = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
|
|
43
|
+
const connect = override.connect ? deepMerge(baked.connect ?? {}, override.connect) : baked.connect;
|
|
44
|
+
return JSON.stringify({
|
|
45
|
+
...baked,
|
|
46
|
+
connect,
|
|
47
|
+
...override.packageRegistryUrl ? { packageRegistryUrl: override.packageRegistryUrl } : {}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Append the registry origin to the baked CSP's script-src. The attribute
|
|
52
|
+
* value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a
|
|
53
|
+
* semicolon), so decode before touching directives and re-escape after —
|
|
54
|
+
* ported from the ph-win-desktop sidecar, which this path replaces.
|
|
55
|
+
*/
|
|
56
|
+
function patchCspScriptSrc(html, registryUrl) {
|
|
57
|
+
return html.replace(/(<meta\s+http-equiv="Content-Security-Policy"\s+content=")([^"]*)(")/i, (_match, open, escaped, close) => {
|
|
58
|
+
const policy = escaped.replace(/&/g, "&").replace(/'/g, "'");
|
|
59
|
+
if (policy.includes(registryUrl)) return open + escaped + close;
|
|
60
|
+
return open + policy.replace(/script-src\s+([^;]*)/i, (_directive, sources) => `script-src ${sources.trim()} ${registryUrl}`).replace(/&/g, "&").replace(/'/g, "'") + close;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function resolvePreviewBase(argBase, outDirAbs) {
|
|
64
|
+
if (argBase && argBase !== "/") return normalizeBasePath(argBase);
|
|
65
|
+
try {
|
|
66
|
+
const basePath = JSON.parse(readFileSync(path.join(outDirAbs, "powerhouse.config.json"), "utf8")).connect?.app?.basePath;
|
|
67
|
+
if (typeof basePath === "string" && basePath) return normalizeBasePath(basePath);
|
|
68
|
+
} catch {}
|
|
69
|
+
}
|
|
70
|
+
function stripBase(pathname, base) {
|
|
71
|
+
return base !== "/" && pathname.startsWith(base) ? `/${pathname.slice(base.length)}` : pathname;
|
|
72
|
+
}
|
|
73
|
+
const IMMUTABLE = "public, max-age=31536000, immutable";
|
|
74
|
+
const HASHED_DIRS = [
|
|
75
|
+
"/assets/",
|
|
76
|
+
"/fonts/",
|
|
77
|
+
"/__reactor_worker__/assets/"
|
|
78
|
+
];
|
|
79
|
+
function previewCacheControl(pathname, search) {
|
|
80
|
+
if (HASHED_DIRS.some((dir) => pathname.startsWith(dir))) return IMMUTABLE;
|
|
81
|
+
if (pathname.startsWith("/__vendor__/")) return /\/(shared-deps|import-map)\.js(on)?$/.test(pathname) ? "no-cache" : IMMUTABLE;
|
|
82
|
+
if (pathname.startsWith("/__react__/")) return IMMUTABLE;
|
|
83
|
+
if (pathname.startsWith("/__reactor_worker__/")) return new URLSearchParams(search).has("v") ? IMMUTABLE : "no-cache";
|
|
84
|
+
}
|
|
85
|
+
function cacheHeaders(outDir, base) {
|
|
86
|
+
return (req, res, next) => {
|
|
87
|
+
const [rawPath, search = ""] = (req.url ?? "/").split("?");
|
|
88
|
+
const rel = stripBase(rawPath, base);
|
|
89
|
+
let value = previewCacheControl(rel, search);
|
|
90
|
+
if (value === IMMUTABLE && !existsSync(path.join(outDir, rel))) value = void 0;
|
|
91
|
+
if (value) res.setHeader("Cache-Control", value);
|
|
92
|
+
next();
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** The dist's shell for the served config: its composition's variant and its app name. */
|
|
96
|
+
function shellSwapFor(outDir, override, base = "/") {
|
|
97
|
+
const composition = override.connect?.composition;
|
|
98
|
+
const renamed = override.connect?.branding?.appName !== void 0;
|
|
99
|
+
if (!composition && !renamed) return void 0;
|
|
100
|
+
const file = path.join(outDir, APP_SHELLS_FILE);
|
|
101
|
+
const variant = composition && appShellVariant(composition, readShellPluginsIn(outDir));
|
|
102
|
+
const shell = variant && existsSync(file) ? JSON.parse(readFileSync(file, "utf8"))[variant] : void 0;
|
|
103
|
+
const appName = JSON.parse(mergedConfigBody(outDir, override)).connect?.branding?.appName;
|
|
104
|
+
return (html) => shell && appShellVariantOf(html) !== variant ? swapAppShell(html, shell, base, appName) : withShellAppName(html, appName);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether a request on a proxying server belongs to the switchboard: its
|
|
108
|
+
* paths go to the proxy, untouched, except a browser navigation under `/d/`
|
|
109
|
+
* (Connect's own drive routes), as switchboardProxy splits them.
|
|
110
|
+
*/
|
|
111
|
+
function isProxiedRequest(urlPath, accept) {
|
|
112
|
+
if (!isSwitchboardProxyPath(urlPath)) return false;
|
|
113
|
+
return !(urlPath.startsWith("/d/") && isHtmlNavigation(accept));
|
|
114
|
+
}
|
|
115
|
+
function serveOverrideStep(outDir, override, base = "/", swapShell, proxied = false) {
|
|
116
|
+
return (req, res, next) => {
|
|
117
|
+
const urlPath = stripBase((req.url ?? "/").split("?")[0], base);
|
|
118
|
+
if (urlPath === "/powerhouse.config.json") {
|
|
119
|
+
res.writeHead(200, {
|
|
120
|
+
"content-type": "application/json; charset=utf-8",
|
|
121
|
+
"cache-control": "no-store"
|
|
122
|
+
});
|
|
123
|
+
res.end(mergedConfigBody(outDir, override));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (proxied && isProxiedRequest(urlPath, req.headers.accept)) {
|
|
127
|
+
next();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const isHtml = urlPath === "/" || urlPath.endsWith("/index.html") || !path.extname(urlPath);
|
|
131
|
+
if ((override.cspRegistrySync || swapShell) && isHtml) {
|
|
132
|
+
const file = path.join(outDir, "index.html");
|
|
133
|
+
if (existsSync(file)) {
|
|
134
|
+
let html = readFileSync(file, "utf8");
|
|
135
|
+
if (override.cspRegistrySync) {
|
|
136
|
+
const registry = JSON.parse(mergedConfigBody(outDir, override)).packageRegistryUrl;
|
|
137
|
+
if (registry) html = patchCspScriptSrc(html, registry);
|
|
138
|
+
}
|
|
139
|
+
if (swapShell) html = swapShell(html);
|
|
140
|
+
res.writeHead(200, {
|
|
141
|
+
"content-type": "text/html; charset=utf-8",
|
|
142
|
+
"cache-control": "no-store"
|
|
143
|
+
});
|
|
144
|
+
res.end(html);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
next();
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/** Extensions whose files have `.gz` siblings. */
|
|
152
|
+
const PRECOMPRESS_EXTENSIONS = [".wasm", ".data"];
|
|
153
|
+
const PRECOMPRESSED_TYPES = {
|
|
154
|
+
".wasm": "application/wasm",
|
|
155
|
+
".data": "application/octet-stream"
|
|
156
|
+
};
|
|
157
|
+
function precompressedAssets(outDir, base = "/") {
|
|
158
|
+
const serve = sirv(outDir, {
|
|
159
|
+
dev: true,
|
|
160
|
+
etag: true,
|
|
161
|
+
gzip: true,
|
|
162
|
+
extensions: [],
|
|
163
|
+
setHeaders(res, pathname) {
|
|
164
|
+
res.setHeader("Content-Type", PRECOMPRESSED_TYPES[path.extname(pathname)]);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return (req, res, next) => {
|
|
168
|
+
const url = req.url ?? "/";
|
|
169
|
+
const [rawPath, search] = url.split("?");
|
|
170
|
+
const rel = stripBase(rawPath, base);
|
|
171
|
+
if (!PRECOMPRESS_EXTENSIONS.includes(path.extname(rel)) || req.headers.range || base !== "/" && rel === rawPath) {
|
|
172
|
+
next();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
req.url = search === void 0 ? rel : `${rel}?${search}`;
|
|
176
|
+
serve(req, res, () => {
|
|
177
|
+
req.url = url;
|
|
178
|
+
next();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** Throws, naming the missing file and the build, when `outDirAbs` holds no build. */
|
|
183
|
+
function assertConnectBuild(outDirArg, outDirAbs, dirname) {
|
|
184
|
+
const file = path.join(outDirAbs, "index.html");
|
|
185
|
+
if (existsSync(file)) return;
|
|
186
|
+
const relative = path.relative(dirname, file);
|
|
187
|
+
const shown = (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative) ? file : relative).split(path.sep).join("/");
|
|
188
|
+
const project = path.resolve(outDirAbs, "../../..");
|
|
189
|
+
const build = path.resolve(project, DEFAULT_CONNECT_OUTDIR) !== outDirAbs ? `\`ph connect build --outDir ${JSON.stringify(outDirArg)}\`` : project === path.resolve(dirname) ? "`ph connect build`" : `\`ph connect build\` in ${project.split(path.sep).join("/")}`;
|
|
190
|
+
throw new Error(`No Connect build to serve: ${shown} is missing. Build it first with ${build}, or \`ph run <host> build\` for a host's Connect.`);
|
|
191
|
+
}
|
|
192
|
+
/** The served base: `--base`, else what the dist or the project was built with. */
|
|
193
|
+
function connectBaseOf(args, outDirAbs, dirname) {
|
|
194
|
+
const sourceBasePath = getConfig(path.join(dirname, "powerhouse.config.json")).connect?.app?.basePath;
|
|
195
|
+
return resolvePreviewBase(args.connectBasePath, outDirAbs) ?? (sourceBasePath ? normalizeBasePath(sourceBasePath) : "/");
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
export { isProxiedRequest as a, precompressedAssets as c, serveOverrideStep as d, shellSwapFor as f, connectBaseOf as i, previewCacheControl as l, assertConnectBuild as n, overrideFromEnv as o, stripBase as p, cacheHeaders as r, patchCspScriptSrc as s, PRECOMPRESS_EXTENSIONS as t, resolvePreviewBase as u };
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=connect-serve-1WAi0KJL.mjs.map
|
|
201
|
+
//# debugId=152aac10-515c-55ef-9f11-64c6a3fbff77
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-serve-1WAi0KJL.mjs","sources":["../src/services/connect-serve.ts"],"sourcesContent":["import { getConfig } from \"@powerhousedao/config/node\";\nimport {\n DEFAULT_CONNECT_OUTDIR,\n type PHConnectRuntimeConfig,\n} from \"@powerhousedao/shared/clis\";\nimport { deepMerge, normalizeBasePath } from \"@powerhousedao/shared/connect\";\nimport {\n APP_SHELLS_FILE,\n appShellVariant,\n appShellVariantOf,\n readShellPluginsIn,\n swapAppShell,\n withShellAppName,\n type AppShells,\n} from \"@powerhousedao/shared/connect/app-shell\";\nimport {\n isHtmlNavigation,\n isSwitchboardProxyPath,\n} from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport path from \"node:path\";\nimport sirv from \"sirv\";\nimport type { ConnectPreviewArgs } from \"./classic-args.js\";\n\n/**\n * Runtime shaping for a served (built) Connect, desktop shape: the compound\n * projects the live switchboard's drive into the connect member's config, and\n * this override makes the STATIC dist serve it — the built\n * powerhouse.config.json is baked, so without this the drive injection never\n * reaches the SPA. `cspRegistrySync` additionally patches the baked CSP's\n * script-src with the runtime registry (the build bakes the CSP for the\n * registry it was built against; setting the registry at run time breaks that\n * coupling and every package import gets blocked otherwise).\n */\nexport interface ConnectServeOverride {\n connect?: PHConnectRuntimeConfig;\n cspRegistrySync?: boolean;\n /** Overrides the baked top-level packageRegistryUrl in the served config. */\n packageRegistryUrl?: string;\n}\n\n/**\n * The env contract a supervisor can drive the preview with — the same\n * variables the Docker entrypoint and clint's service manager already speak:\n * PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into\n * drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and\n * PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP\n * patch). Lets `ph connect preview` replace hand-rolled static servers\n * (clint's connect-server, the ph-win sidecar) without losing injection.\n */\nexport function overrideFromEnv(\n env: Record<string, string | undefined> = process.env,\n): ConnectServeOverride | undefined {\n const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;\n const registry = env.PH_CONNECT_PACKAGES_REGISTRY;\n if (!drivesUrl && !registry) return undefined;\n const override: ConnectServeOverride = {};\n if (drivesUrl) {\n override.connect = {\n drives: {\n defaultDrives: drivesUrl\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n .map((url) => ({ url, name: null, icon: null })),\n preserveStrategy:\n env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? \"preserve-all\",\n },\n } as PHConnectRuntimeConfig;\n }\n if (registry) {\n override.packageRegistryUrl = registry;\n override.cspRegistrySync = true;\n }\n return override;\n}\n\nfunction mergedConfigBody(\n outDir: string,\n override: ConnectServeOverride,\n): string {\n const file = path.join(outDir, \"powerhouse.config.json\");\n const baked = existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>)\n : {};\n const connect = override.connect\n ? deepMerge(\n (baked.connect ?? {}) as PHConnectRuntimeConfig,\n override.connect,\n )\n : baked.connect;\n return JSON.stringify({\n ...baked,\n connect,\n ...(override.packageRegistryUrl\n ? { packageRegistryUrl: override.packageRegistryUrl }\n : {}),\n });\n}\n\n/**\n * Append the registry origin to the baked CSP's script-src. The attribute\n * value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a\n * semicolon), so decode before touching directives and re-escape after —\n * ported from the ph-win-desktop sidecar, which this path replaces.\n */\nexport function patchCspScriptSrc(html: string, registryUrl: string): string {\n return html.replace(\n /(<meta\\s+http-equiv=\"Content-Security-Policy\"\\s+content=\")([^\"]*)(\")/i,\n (_match, open: string, escaped: string, close: string) => {\n const policy = escaped.replace(/&/g, \"&\").replace(/'/g, \"'\");\n if (policy.includes(registryUrl)) return open + escaped + close;\n const patched = policy.replace(\n /script-src\\s+([^;]*)/i,\n (_directive, sources: string) =>\n `script-src ${sources.trim()} ${registryUrl}`,\n );\n const reEscaped = patched.replace(/&/g, \"&\").replace(/'/g, \"'\");\n return open + reEscaped + close;\n },\n );\n}\n\n// The serve base: an explicit `--base`, else the basePath the dist was built with.\nexport function resolvePreviewBase(\n argBase: string | undefined,\n outDirAbs: string,\n): string | undefined {\n if (argBase && argBase !== \"/\") return normalizeBasePath(argBase);\n try {\n const built = JSON.parse(\n readFileSync(path.join(outDirAbs, \"powerhouse.config.json\"), \"utf8\"),\n ) as { connect?: { app?: { basePath?: unknown } } };\n const basePath = built.connect?.app?.basePath;\n if (typeof basePath === \"string\" && basePath) {\n return normalizeBasePath(basePath);\n }\n } catch {\n // no readable dist config\n }\n return undefined;\n}\n\n// `pathname` relative to the deploy base (\"/\" + rest), or itself when outside it.\nexport function stripBase(pathname: string, base: string): string {\n return base !== \"/\" && pathname.startsWith(base)\n ? `/${pathname.slice(base.length)}`\n : pathname;\n}\n\n/** The steps both Connect servers run, in the order they run them. */\nexport type ConnectMiddleware = (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void,\n) => void;\n\nconst IMMUTABLE = \"public, max-age=31536000, immutable\";\n\nconst HASHED_DIRS = [\"/assets/\", \"/fonts/\", \"/__reactor_worker__/assets/\"];\n\n// Content-addressed output (hashed names, or a `v` query on the worker's), as in the nginx image.\nexport function previewCacheControl(\n pathname: string,\n search: string,\n): string | undefined {\n if (HASHED_DIRS.some((dir) => pathname.startsWith(dir))) return IMMUTABLE;\n if (pathname.startsWith(\"/__vendor__/\")) {\n return /\\/(shared-deps|import-map)\\.js(on)?$/.test(pathname)\n ? \"no-cache\"\n : IMMUTABLE;\n }\n if (pathname.startsWith(\"/__react__/\")) return IMMUTABLE;\n if (pathname.startsWith(\"/__reactor_worker__/\")) {\n return new URLSearchParams(search).has(\"v\") ? IMMUTABLE : \"no-cache\";\n }\n return undefined;\n}\n\nexport function cacheHeaders(outDir: string, base: string): ConnectMiddleware {\n return (req, res, next) => {\n const [rawPath, search = \"\"] = (req.url ?? \"/\").split(\"?\");\n const rel = stripBase(rawPath, base);\n let value = previewCacheControl(rel, search);\n // A cached 404 would outlive the next deploy.\n if (value === IMMUTABLE && !existsSync(path.join(outDir, rel))) {\n value = undefined;\n }\n if (value) res.setHeader(\"Cache-Control\", value);\n next();\n };\n}\n\ntype HtmlTransform = (html: string) => string;\n\n/** The dist's shell for the served config: its composition's variant and its app name. */\nexport function shellSwapFor(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n): HtmlTransform | undefined {\n const composition = override.connect?.composition;\n const renamed = override.connect?.branding?.appName !== undefined;\n if (!composition && !renamed) return undefined;\n const file = path.join(outDir, APP_SHELLS_FILE);\n // The manifest the build copied from the Connect it used.\n const variant =\n composition && appShellVariant(composition, readShellPluginsIn(outDir));\n const shell =\n variant && existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as AppShells)[variant]\n : undefined;\n // The name the app will title itself with: the served (baked + override) config's.\n const appName = (\n JSON.parse(mergedConfigBody(outDir, override)) as {\n connect?: { branding?: { appName?: string } };\n }\n ).connect?.branding?.appName;\n return (html) =>\n shell && appShellVariantOf(html) !== variant\n ? swapAppShell(html, shell, base, appName)\n : withShellAppName(html, appName);\n}\n\n/**\n * Whether a request on a proxying server belongs to the switchboard: its\n * paths go to the proxy, untouched, except a browser navigation under `/d/`\n * (Connect's own drive routes), as switchboardProxy splits them.\n */\nexport function isProxiedRequest(urlPath: string, accept: string | undefined) {\n if (!isSwitchboardProxyPath(urlPath)) return false;\n return !(urlPath.startsWith(\"/d/\") && isHtmlNavigation(accept));\n}\n\nexport function serveOverrideStep(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n swapShell?: HtmlTransform,\n proxied = false,\n): ConnectMiddleware {\n return (req, res, next) => {\n const urlPath = stripBase((req.url ?? \"/\").split(\"?\")[0], base);\n if (urlPath === \"/powerhouse.config.json\") {\n res.writeHead(200, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(mergedConfigBody(outDir, override));\n return;\n }\n // The switchboard's paths are the proxy's, which runs after this:\n // served the SPA shell instead, /graphql would never reach it.\n if (proxied && isProxiedRequest(urlPath, req.headers.accept)) {\n next();\n return;\n }\n // index.html and extensionless SPA routes get the CSP patch.\n const isHtml =\n urlPath === \"/\" ||\n urlPath.endsWith(\"/index.html\") ||\n !path.extname(urlPath);\n if ((override.cspRegistrySync || swapShell) && isHtml) {\n const file = path.join(outDir, \"index.html\");\n if (existsSync(file)) {\n let html = readFileSync(file, \"utf8\");\n if (override.cspRegistrySync) {\n const merged = JSON.parse(mergedConfigBody(outDir, override)) as {\n packageRegistryUrl?: string;\n };\n const registry = merged.packageRegistryUrl;\n if (registry) html = patchCspScriptSrc(html, registry);\n }\n if (swapShell) html = swapShell(html);\n res.writeHead(200, {\n \"content-type\": \"text/html; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(html);\n return;\n }\n }\n next();\n };\n}\n\n/** Extensions whose files have `.gz` siblings. */\nexport const PRECOMPRESS_EXTENSIONS = [\".wasm\", \".data\"] as const;\n\nconst PRECOMPRESSED_TYPES: Record<string, string> = {\n \".wasm\": \"application/wasm\",\n \".data\": \"application/octet-stream\",\n};\n\n// Serves the build's `.gz` siblings of wasm/data, which the main sirv ignores.\nexport function precompressedAssets(\n outDir: string,\n base = \"/\",\n): ConnectMiddleware {\n const serve = sirv(outDir, {\n dev: true,\n etag: true,\n gzip: true,\n extensions: [],\n setHeaders(res, pathname) {\n res.setHeader(\n \"Content-Type\",\n PRECOMPRESSED_TYPES[path.extname(pathname)],\n );\n },\n });\n return (req, res, next) => {\n const url = req.url ?? \"/\";\n const [rawPath, search] = url.split(\"?\");\n const rel = stripBase(rawPath, base);\n // Ranges are byte offsets into the identity body: leave them to the server.\n if (\n !(PRECOMPRESS_EXTENSIONS as readonly string[]).includes(\n path.extname(rel),\n ) ||\n req.headers.range ||\n (base !== \"/\" && rel === rawPath)\n ) {\n next();\n return;\n }\n req.url = search === undefined ? rel : `${rel}?${search}`;\n serve(req, res, () => {\n req.url = url;\n next();\n });\n };\n}\n\n/** Throws, naming the missing file and the build, when `outDirAbs` holds no build. */\nexport function assertConnectBuild(\n outDirArg: string,\n outDirAbs: string,\n dirname: string,\n): void {\n const file = path.join(outDirAbs, \"index.html\");\n if (existsSync(file)) return;\n const relative = path.relative(dirname, file);\n const shown = (\n relative === \"..\" ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ? file\n : relative\n )\n .split(path.sep)\n .join(\"/\");\n // A default build, maybe another project's (a monitor copy serves its source's).\n const project = path.resolve(outDirAbs, \"../../..\");\n const build =\n path.resolve(project, DEFAULT_CONNECT_OUTDIR) !== outDirAbs\n ? `\\`ph connect build --outDir ${JSON.stringify(outDirArg)}\\``\n : project === path.resolve(dirname)\n ? \"`ph connect build`\"\n : `\\`ph connect build\\` in ${project.split(path.sep).join(\"/\")}`;\n throw new Error(\n `No Connect build to serve: ${shown} is missing. Build it first with ${build}, or \\`ph run <host> build\\` for a host's Connect.`,\n );\n}\n\n/** The served base: `--base`, else what the dist or the project was built with. */\nexport function connectBaseOf(\n args: Pick<ConnectPreviewArgs, \"connectBasePath\">,\n outDirAbs: string,\n dirname: string,\n): string {\n // Serving a dist needs only its base, not the build's plugin stack.\n const sourceBasePath = getConfig(path.join(dirname, \"powerhouse.config.json\"))\n .connect?.app?.basePath;\n return (\n resolvePreviewBase(args.connectBasePath, outDirAbs) ??\n (sourceBasePath ? normalizeBasePath(sourceBasePath) : \"/\")\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,gBACd,MAA0C,QAAQ,KAChB;CAClC,MAAM,YAAY,IAAI;CACtB,MAAM,WAAW,IAAI;CACrB,IAAI,CAAC,aAAa,CAAC,UAAU,OAAO,KAAA;CACpC,MAAM,WAAiC,CAAC;CACxC,IAAI,WACF,SAAS,UAAU,EACjB,QAAQ;EACN,eAAe,UACZ,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,OAAO,OAAO,CAAC,CACf,KAAK,SAAS;GAAE;GAAK,MAAM;GAAM,MAAM;EAAK,EAAE;EACjD,kBACE,IAAI,uCAAuC;CAC/C,EACF;CAEF,IAAI,UAAU;EACZ,SAAS,qBAAqB;EAC9B,SAAS,kBAAkB;CAC7B;CACA,OAAO;AACT;AAEA,SAAS,iBACP,QACA,UACQ;CACR,MAAM,OAAO,KAAK,KAAK,QAAQ,wBAAwB;CACvD,MAAM,QAAQ,WAAW,IAAI,IACxB,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,IACtC,CAAC;CACL,MAAM,UAAU,SAAS,UACrB,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