@parlor/cli 0.0.0-stage → 0.2.0

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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -2
  3. package/dist/agent-host-process.d.ts +22 -0
  4. package/dist/agent-host-process.d.ts.map +1 -0
  5. package/dist/agent-host-process.js +35 -0
  6. package/dist/agent-host-process.js.map +1 -0
  7. package/dist/chat-warning.d.ts +8 -0
  8. package/dist/chat-warning.d.ts.map +1 -0
  9. package/dist/chat-warning.js +13 -0
  10. package/dist/chat-warning.js.map +1 -0
  11. package/dist/cloudflare/loader.d.ts +4 -0
  12. package/dist/cloudflare/loader.d.ts.map +1 -0
  13. package/dist/cloudflare/loader.js +11 -0
  14. package/dist/cloudflare/loader.js.map +1 -0
  15. package/dist/cloudflare/platform.d.ts +16 -0
  16. package/dist/cloudflare/platform.d.ts.map +1 -0
  17. package/dist/cloudflare/platform.js +52 -0
  18. package/dist/cloudflare/platform.js.map +1 -0
  19. package/dist/cloudflare/prepare.d.ts +9 -0
  20. package/dist/cloudflare/prepare.d.ts.map +1 -0
  21. package/dist/cloudflare/prepare.js +29 -0
  22. package/dist/cloudflare/prepare.js.map +1 -0
  23. package/dist/cloudflare/workers.d.ts +12 -0
  24. package/dist/cloudflare/workers.d.ts.map +1 -0
  25. package/dist/cloudflare/workers.js +18 -0
  26. package/dist/cloudflare/workers.js.map +1 -0
  27. package/dist/cloudflare/wrangler.d.ts +4 -0
  28. package/dist/cloudflare/wrangler.d.ts.map +1 -0
  29. package/dist/cloudflare/wrangler.js +16 -0
  30. package/dist/cloudflare/wrangler.js.map +1 -0
  31. package/dist/commands/add.d.ts +32 -0
  32. package/dist/commands/add.d.ts.map +1 -0
  33. package/dist/commands/add.js +79 -0
  34. package/dist/commands/add.js.map +1 -0
  35. package/dist/commands/build.d.ts +12 -0
  36. package/dist/commands/build.d.ts.map +1 -0
  37. package/dist/commands/build.js +27 -0
  38. package/dist/commands/build.js.map +1 -0
  39. package/dist/commands/db.d.ts +12 -0
  40. package/dist/commands/db.d.ts.map +1 -0
  41. package/dist/commands/db.js +131 -0
  42. package/dist/commands/db.js.map +1 -0
  43. package/dist/commands/deploy.d.ts +8 -0
  44. package/dist/commands/deploy.d.ts.map +1 -0
  45. package/dist/commands/deploy.js +45 -0
  46. package/dist/commands/deploy.js.map +1 -0
  47. package/dist/commands/dev.d.ts +22 -0
  48. package/dist/commands/dev.d.ts.map +1 -0
  49. package/dist/commands/dev.js +85 -0
  50. package/dist/commands/dev.js.map +1 -0
  51. package/dist/commands/typegen.d.ts +2 -0
  52. package/dist/commands/typegen.d.ts.map +1 -0
  53. package/dist/commands/typegen.js +13 -0
  54. package/dist/commands/typegen.js.map +1 -0
  55. package/dist/desktop-target.d.ts +4 -0
  56. package/dist/desktop-target.d.ts.map +1 -0
  57. package/dist/desktop-target.js +45 -0
  58. package/dist/desktop-target.js.map +1 -0
  59. package/dist/dev-session.d.ts +16 -0
  60. package/dist/dev-session.d.ts.map +1 -0
  61. package/dist/dev-session.js +66 -0
  62. package/dist/dev-session.js.map +1 -0
  63. package/dist/errors.d.ts +4 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +4 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/handlers.d.ts +3 -0
  68. package/dist/handlers.d.ts.map +1 -0
  69. package/dist/handlers.js +12 -0
  70. package/dist/handlers.js.map +1 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +2 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/main.d.ts +3 -0
  76. package/dist/main.d.ts.map +1 -0
  77. package/dist/main.js +37 -0
  78. package/dist/main.js.map +1 -0
  79. package/dist/mobile-target.d.ts +5 -0
  80. package/dist/mobile-target.d.ts.map +1 -0
  81. package/dist/mobile-target.js +40 -0
  82. package/dist/mobile-target.js.map +1 -0
  83. package/dist/ports.d.ts +14 -0
  84. package/dist/ports.d.ts.map +1 -0
  85. package/dist/ports.js +45 -0
  86. package/dist/ports.js.map +1 -0
  87. package/dist/serve-entry.d.ts +2 -0
  88. package/dist/serve-entry.d.ts.map +1 -0
  89. package/dist/serve-entry.js +35 -0
  90. package/dist/serve-entry.js.map +1 -0
  91. package/dist/server-process.d.ts +14 -0
  92. package/dist/server-process.d.ts.map +1 -0
  93. package/dist/server-process.js +75 -0
  94. package/dist/server-process.js.map +1 -0
  95. package/dist/serverless-warning.d.ts +4 -0
  96. package/dist/serverless-warning.d.ts.map +1 -0
  97. package/dist/serverless-warning.js +6 -0
  98. package/dist/serverless-warning.js.map +1 -0
  99. package/dist/shutdown.d.ts +6 -0
  100. package/dist/shutdown.d.ts.map +1 -0
  101. package/dist/shutdown.js +22 -0
  102. package/dist/shutdown.js.map +1 -0
  103. package/dist/targets.d.ts +27 -0
  104. package/dist/targets.d.ts.map +1 -0
  105. package/dist/targets.js +31 -0
  106. package/dist/targets.js.map +1 -0
  107. package/dist/web-target.d.ts +6 -0
  108. package/dist/web-target.d.ts.map +1 -0
  109. package/dist/web-target.js +50 -0
  110. package/dist/web-target.js.map +1 -0
  111. package/package.json +60 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cychien
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,20 @@
1
- # Temporary Holding Version
1
+ # @parlor/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The `parlor` command: `dev`, `build`, `deploy`, `db`, `add` and `typegen` for a Parlor app, on web, desktop and mobile.
4
+
5
+ ```sh
6
+ pnpm add -D @parlor/cli
7
+ pnpm parlor dev
8
+ pnpm parlor add auth
9
+ pnpm parlor dev --target mac
10
+ ```
11
+
12
+ Its configuration is `parlor.config.ts`:
13
+
14
+ ```ts
15
+ import { defineConfig } from "@parlor/config";
16
+
17
+ export default defineConfig({ app: { id: "com.example.todos", name: "Todos" } });
18
+ ```
19
+
20
+ Docs: https://cychien.github.io/parlor/reference/cli/
@@ -0,0 +1,22 @@
1
+ import { type ChildProcess } from "node:child_process";
2
+ import type { LoadedConfig } from "@parlor/config";
3
+ export interface DevAgentHostOptions {
4
+ /** `--no-agent-host` turns it off. */
5
+ readonly enabled: boolean;
6
+ /** The server is running with its own auth provider, so `devAuth` is not there to pair with. */
7
+ readonly serverHasAuth: boolean;
8
+ }
9
+ export declare const AGENT_HOST_BIN = "parlor-host";
10
+ /**
11
+ * The `parlor-host` bin as the installed manifest declares it: `bin/parlor-host-dev.mjs` (tsx on
12
+ * `src/`) in the repo, `dist/main.js` once `publishConfig` is applied. Resolving the exported
13
+ * `package.json` works under CJS resolution, which the package's `import`-only entry does not.
14
+ */
15
+ export declare function agentHostBin(): string;
16
+ /**
17
+ * `parlor dev` runs `parlor-host dev --app http://localhost:<port>` next to the server, so
18
+ * the chat works against the developer's own agents with no pairing. Orchestration only;
19
+ * `undefined` when skipped.
20
+ */
21
+ export declare function startDevAgentHost({ config, rootDir }: LoadedConfig, options: DevAgentHostOptions): ChildProcess | undefined;
22
+ //# sourceMappingURL=agent-host-process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-host-process.d.ts","sourceRoot":"","sources":["../src/agent-host-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAK9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAQrC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,EACjC,OAAO,EAAE,mBAAmB,GAC3B,YAAY,GAAG,SAAS,CAS1B"}
@@ -0,0 +1,35 @@
1
+ import { spawn } from "node:child_process";
2
+ import { readFileSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import { dirname, join } from "node:path";
5
+ import { CliError } from "./errors.js";
6
+ import { stopServerProcess } from "./server-process.js";
7
+ import { onShutdown } from "./shutdown.js";
8
+ const require = createRequire(import.meta.url);
9
+ export const AGENT_HOST_BIN = "parlor-host";
10
+ /**
11
+ * The `parlor-host` bin as the installed manifest declares it: `bin/parlor-host-dev.mjs` (tsx on
12
+ * `src/`) in the repo, `dist/main.js` once `publishConfig` is applied. Resolving the exported
13
+ * `package.json` works under CJS resolution, which the package's `import`-only entry does not.
14
+ */
15
+ export function agentHostBin() {
16
+ const manifestPath = require.resolve("@parlor/agent-host/package.json");
17
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
18
+ const bin = manifest.bin?.[AGENT_HOST_BIN];
19
+ if (!bin)
20
+ throw new CliError(`@parlor/agent-host has no ${AGENT_HOST_BIN} bin`);
21
+ return join(dirname(manifestPath), bin);
22
+ }
23
+ /**
24
+ * `parlor dev` runs `parlor-host dev --app http://localhost:<port>` next to the server, so
25
+ * the chat works against the developer's own agents with no pairing. Orchestration only;
26
+ * `undefined` when skipped.
27
+ */
28
+ export function startDevAgentHost({ config, rootDir }, options) {
29
+ if (!options.enabled || options.serverHasAuth)
30
+ return undefined;
31
+ const child = spawn(process.execPath, [agentHostBin(), "dev", "--app", `http://localhost:${config.server.port}`], { cwd: rootDir, stdio: "inherit", env: process.env });
32
+ onShutdown((signaled) => stopServerProcess(child, signaled ? undefined : 0));
33
+ return child;
34
+ }
35
+ //# sourceMappingURL=agent-host-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-host-process.js","sourceRoot":"","sources":["../src/agent-host-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAS/C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAE7D,CAAC;IACF,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,QAAQ,CAAC,6BAA6B,cAAc,MAAM,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAAE,MAAM,EAAE,OAAO,EAAgB,EACjC,OAA4B;IAE5B,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,aAAa;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,KAAK,GAAG,KAAK,CACjB,OAAO,CAAC,QAAQ,EAChB,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAC1E,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CACrD,CAAC;IACF,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\nimport type { LoadedConfig } from \"@parlor/config\";\n\nimport { CliError } from \"./errors.js\";\nimport { stopServerProcess } from \"./server-process.js\";\nimport { onShutdown } from \"./shutdown.js\";\n\nconst require = createRequire(import.meta.url);\n\nexport interface DevAgentHostOptions {\n /** `--no-agent-host` turns it off. */\n readonly enabled: boolean;\n /** The server is running with its own auth provider, so `devAuth` is not there to pair with. */\n readonly serverHasAuth: boolean;\n}\n\nexport const AGENT_HOST_BIN = \"parlor-host\";\n\n/**\n * The `parlor-host` bin as the installed manifest declares it: `bin/parlor-host-dev.mjs` (tsx on\n * `src/`) in the repo, `dist/main.js` once `publishConfig` is applied. Resolving the exported\n * `package.json` works under CJS resolution, which the package's `import`-only entry does not.\n */\nexport function agentHostBin(): string {\n const manifestPath = require.resolve(\"@parlor/agent-host/package.json\");\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as {\n readonly bin?: Readonly<Record<string, string>>;\n };\n const bin = manifest.bin?.[AGENT_HOST_BIN];\n if (!bin) throw new CliError(`@parlor/agent-host has no ${AGENT_HOST_BIN} bin`);\n return join(dirname(manifestPath), bin);\n}\n\n/**\n * `parlor dev` runs `parlor-host dev --app http://localhost:<port>` next to the server, so\n * the chat works against the developer's own agents with no pairing. Orchestration only;\n * `undefined` when skipped.\n */\nexport function startDevAgentHost(\n { config, rootDir }: LoadedConfig,\n options: DevAgentHostOptions,\n): ChildProcess | undefined {\n if (!options.enabled || options.serverHasAuth) return undefined;\n const child = spawn(\n process.execPath,\n [agentHostBin(), \"dev\", \"--app\", `http://localhost:${config.server.port}`],\n { cwd: rootDir, stdio: \"inherit\", env: process.env },\n );\n onShutdown((signaled) => stopServerProcess(child, signaled ? undefined : 0));\n return child;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type { LoadedConfig } from "@parlor/config";
2
+ import { type ServerShape } from "@parlor/scaffold";
3
+ export declare const AGENT_UNAVAILABLE_WARNING = "Warning: this app installs chat() without sign-in, so in production the agent sidebar is unavailable (useChat().status is \"unavailable\"). Run `parlor add auth` to turn it on.";
4
+ /** Only when sure: an `unknown` shape stays quiet rather than warn about a working app. */
5
+ export declare function agentUnavailableInProduction(server: ServerShape): boolean;
6
+ /** The server is the same for every target, so every production build warns, not only web. */
7
+ export declare function warnChatWithoutAuth({ config, rootDir, }: LoadedConfig): Promise<void>;
8
+ //# sourceMappingURL=chat-warning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-warning.d.ts","sourceRoot":"","sources":["../src/chat-warning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExE,eAAO,MAAM,yBAAyB,qLAC4I,CAAC;AAEnL,2FAA2F;AAC3F,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEzE;AAED,8FAA8F;AAC9F,wBAAsB,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACR,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9B"}
@@ -0,0 +1,13 @@
1
+ import { inspectServerEntry } from "@parlor/scaffold";
2
+ export const AGENT_UNAVAILABLE_WARNING = 'Warning: this app installs chat() without sign-in, so in production the agent sidebar is unavailable (useChat().status is "unavailable"). Run `parlor add auth` to turn it on.';
3
+ /** Only when sure: an `unknown` shape stays quiet rather than warn about a working app. */
4
+ export function agentUnavailableInProduction(server) {
5
+ return server.chat === "installed" && server.auth === "absent";
6
+ }
7
+ /** The server is the same for every target, so every production build warns, not only web. */
8
+ export async function warnChatWithoutAuth({ config, rootDir, }) {
9
+ const server = await inspectServerEntry(rootDir, config.server.entry);
10
+ if (agentUnavailableInProduction(server))
11
+ console.warn(AGENT_UNAVAILABLE_WARNING);
12
+ }
13
+ //# sourceMappingURL=chat-warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-warning.js","sourceRoot":"","sources":["../src/chat-warning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAExE,MAAM,CAAC,MAAM,yBAAyB,GACpC,gLAAgL,CAAC;AAEnL,2FAA2F;AAC3F,MAAM,UAAU,4BAA4B,CAAC,MAAmB;IAC9D,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AACjE,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,MAAM,EACN,OAAO,GACM;IACb,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,IAAI,4BAA4B,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import type { LoadedConfig } from \"@parlor/config\";\nimport { inspectServerEntry, type ServerShape } from \"@parlor/scaffold\";\n\nexport const AGENT_UNAVAILABLE_WARNING =\n 'Warning: this app installs chat() without sign-in, so in production the agent sidebar is unavailable (useChat().status is \"unavailable\"). Run `parlor add auth` to turn it on.';\n\n/** Only when sure: an `unknown` shape stays quiet rather than warn about a working app. */\nexport function agentUnavailableInProduction(server: ServerShape): boolean {\n return server.chat === \"installed\" && server.auth === \"absent\";\n}\n\n/** The server is the same for every target, so every production build warns, not only web. */\nexport async function warnChatWithoutAuth({\n config,\n rootDir,\n}: LoadedConfig): Promise<void> {\n const server = await inspectServerEntry(rootDir, config.server.entry);\n if (agentUnavailableInProduction(server)) console.warn(AGENT_UNAVAILABLE_WARNING);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const CLOUDFLARE_WORKERS = "cloudflare:workers";
2
+ /** Resolves `cloudflare:workers` to `module` for every import that follows. */
3
+ export declare function registerCloudflareWorkers(module?: string): void;
4
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/cloudflare/loader.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,+EAA+E;AAC/E,wBAAgB,yBAAyB,CACvC,MAAM,GAAE,MAA4C,GACnD,IAAI,CAON"}
@@ -0,0 +1,11 @@
1
+ import { registerHooks } from "node:module";
2
+ export const CLOUDFLARE_WORKERS = "cloudflare:workers";
3
+ /** Resolves `cloudflare:workers` to `module` for every import that follows. */
4
+ export function registerCloudflareWorkers(module = import.meta.resolve("./workers.js")) {
5
+ registerHooks({
6
+ resolve: (specifier, context, nextResolve) => specifier === CLOUDFLARE_WORKERS
7
+ ? { url: module, shortCircuit: true }
8
+ : nextResolve(specifier, context),
9
+ });
10
+ }
11
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/cloudflare/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD,+EAA+E;AAC/E,MAAM,UAAU,yBAAyB,CACvC,MAAM,GAAW,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;IAEpD,aAAa,CAAC;QACZ,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,CAC3C,SAAS,KAAK,kBAAkB;YAC9B,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE;YACrC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC;KACtC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { registerHooks } from \"node:module\";\n\nexport const CLOUDFLARE_WORKERS = \"cloudflare:workers\";\n\n/** Resolves `cloudflare:workers` to `module` for every import that follows. */\nexport function registerCloudflareWorkers(\n module: string = import.meta.resolve(\"./workers.js\"),\n): void {\n registerHooks({\n resolve: (specifier, context, nextResolve) =>\n specifier === CLOUDFLARE_WORKERS\n ? { url: module, shortCircuit: true }\n : nextResolve(specifier, context),\n });\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { UnavailableDurableObject } from "@parlor/host";
2
+ import type { CloudflareDev } from "./prepare.js";
3
+ type Env = Record<string, unknown>;
4
+ export declare function platformEnv(): Env;
5
+ export interface CloudflarePlatform {
6
+ readonly env: Env;
7
+ readonly dispose: () => Promise<void>;
8
+ }
9
+ /** Wrangler's order: `.dev.vars` alone when it exists, otherwise `.env` then `.env.local`. */
10
+ export declare function devVarsFiles(rootDir: string): string[];
11
+ /** Workers put text vars and secrets in `process.env` too; variables set in the shell win here. */
12
+ export declare function exposeVars(env: Env, target: NodeJS.ProcessEnv): void;
13
+ export declare function withUnavailable(env: Env, unavailable: readonly UnavailableDurableObject[]): Env;
14
+ export declare function startCloudflarePlatform(rootDir: string, { configPath, unavailable }: CloudflareDev): Promise<CloudflarePlatform>;
15
+ export {};
16
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/cloudflare/platform.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAInC,wBAAgB,WAAW,IAAI,GAAG,CAOjC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAItD;AAED,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAIpE;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,SAAS,wBAAwB,EAAE,GAC/C,GAAG,CAeL;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,aAAa,GACzC,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
@@ -0,0 +1,52 @@
1
+ import { existsSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+ import { resolveWrangler, WRANGLER_MISSING } from "./wrangler.js";
5
+ let current;
6
+ export function platformEnv() {
7
+ if (!current) {
8
+ throw new Error('cloudflare:workers needs deploy.preset "cloudflare-durable" in parlor.config.ts, which makes parlor dev serve the app\'s Cloudflare bindings');
9
+ }
10
+ return current;
11
+ }
12
+ /** Wrangler's order: `.dev.vars` alone when it exists, otherwise `.env` then `.env.local`. */
13
+ export function devVarsFiles(rootDir) {
14
+ const devVars = join(rootDir, ".dev.vars");
15
+ if (existsSync(devVars))
16
+ return [devVars];
17
+ return [join(rootDir, ".env"), join(rootDir, ".env.local")];
18
+ }
19
+ /** Workers put text vars and secrets in `process.env` too; variables set in the shell win here. */
20
+ export function exposeVars(env, target) {
21
+ for (const [name, value] of Object.entries(env)) {
22
+ if (typeof value === "string" && target[name] === undefined)
23
+ target[name] = value;
24
+ }
25
+ }
26
+ export function withUnavailable(env, unavailable) {
27
+ const classes = new Map(unavailable.map(({ binding, className }) => [binding, className]));
28
+ return new Proxy(env, {
29
+ get(target, property) {
30
+ const className = classes.get(property);
31
+ if (className) {
32
+ throw new Error(`env.${String(property)} is unavailable in parlor dev: it binds ${className}, a Durable Object class the app's own Worker defines, and parlor dev emulates bindings with Wrangler's getPlatformProxy(), which runs no Worker code. Run the cloudflare-durable build on wrangler dev to use it.`);
33
+ }
34
+ return Reflect.get(target, property);
35
+ },
36
+ });
37
+ }
38
+ export async function startCloudflarePlatform(rootDir, { configPath, unavailable }) {
39
+ const wrangler = resolveWrangler(rootDir);
40
+ if (!wrangler)
41
+ throw new Error(WRANGLER_MISSING);
42
+ const { getPlatformProxy } = (await import(pathToFileURL(wrangler).href));
43
+ const proxy = await getPlatformProxy({
44
+ configPath,
45
+ envFiles: devVarsFiles(rootDir),
46
+ persist: { path: join(dirname(configPath), "state") },
47
+ });
48
+ exposeVars(proxy.env, process.env);
49
+ current = withUnavailable(proxy.env, unavailable);
50
+ return { env: current, dispose: () => proxy.dispose() };
51
+ }
52
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/cloudflare/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIlE,IAAI,OAAwB,CAAC;AAE7B,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,8IAA8I,CAC/I,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAOD,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3C,IAAI,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,UAAU,CAAC,GAAQ,EAAE,MAAyB;IAC5D,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,I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CAAC,OAAO,CAAC;QAC/B,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EAAE;KACtD,CAAC,CAAC;IACH,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AAC1D,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { UnavailableDurableObject } from \"@parlor/host\";\n\nimport type { CloudflareDev } from \"./prepare.js\";\nimport { resolveWrangler, WRANGLER_MISSING } from \"./wrangler.js\";\n\ntype Env = Record<string, unknown>;\n\nlet current: Env | undefined;\n\nexport function platformEnv(): Env {\n if (!current) {\n throw new Error(\n 'cloudflare:workers needs deploy.preset \"cloudflare-durable\" in parlor.config.ts, which makes parlor dev serve the app\\'s Cloudflare bindings',\n );\n }\n return current;\n}\n\nexport interface CloudflarePlatform {\n readonly env: Env;\n readonly dispose: () => Promise<void>;\n}\n\n/** Wrangler's order: `.dev.vars` alone when it exists, otherwise `.env` then `.env.local`. */\nexport function devVarsFiles(rootDir: string): string[] {\n const devVars = join(rootDir, \".dev.vars\");\n if (existsSync(devVars)) return [devVars];\n return [join(rootDir, \".env\"), join(rootDir, \".env.local\")];\n}\n\n/** Workers put text vars and secrets in `process.env` too; variables set in the shell win here. */\nexport function exposeVars(env: Env, target: NodeJS.ProcessEnv): void {\n for (const [name, value] of Object.entries(env)) {\n if (typeof value === \"string\" && target[name] === undefined) target[name] = value;\n }\n}\n\nexport function withUnavailable(\n env: Env,\n unavailable: readonly UnavailableDurableObject[],\n): Env {\n const classes = new Map<PropertyKey, string>(\n unavailable.map(({ binding, className }) => [binding, className]),\n );\n return new Proxy(env, {\n get(target, property) {\n const className = classes.get(property);\n if (className) {\n throw new Error(\n `env.${String(property)} is unavailable in parlor dev: it binds ${className}, a Durable Object class the app's own Worker defines, and parlor dev emulates bindings with Wrangler's getPlatformProxy(), which runs no Worker code. Run the cloudflare-durable build on wrangler dev to use it.`,\n );\n }\n return Reflect.get(target, property);\n },\n });\n}\n\nexport async function startCloudflarePlatform(\n rootDir: string,\n { configPath, unavailable }: CloudflareDev,\n): Promise<CloudflarePlatform> {\n const wrangler = resolveWrangler(rootDir);\n if (!wrangler) throw new Error(WRANGLER_MISSING);\n const { getPlatformProxy } = (await import(\n pathToFileURL(wrangler).href\n )) as typeof import(\"wrangler\");\n const proxy = await getPlatformProxy<Env>({\n configPath,\n envFiles: devVarsFiles(rootDir),\n persist: { path: join(dirname(configPath), \"state\") },\n });\n exposeVars(proxy.env, process.env);\n current = withUnavailable(proxy.env, unavailable);\n return { env: current, dispose: () => proxy.dispose() };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { type LoadedConfig } from "@parlor/config";
2
+ import { type UnavailableDurableObject } from "@parlor/host";
3
+ export interface CloudflareDev {
4
+ readonly configPath: string;
5
+ readonly unavailable: readonly UnavailableDurableObject[];
6
+ }
7
+ /** Writes the Wrangler config the dev server's bindings come from, when the app deploys to cloudflare-durable. */
8
+ export declare function prepareCloudflareDev({ config, rootDir }: Pick<LoadedConfig, "config" | "rootDir">, env?: NodeJS.ProcessEnv): Promise<CloudflareDev | undefined>;
9
+ //# sourceMappingURL=prepare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/cloudflare/prepare.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAC3D;AAED,kHAAkH;AAClH,wBAAsB,oBAAoB,CACxC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,SAAS,CAAC,EAC7D,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAgBpC"}
@@ -0,0 +1,29 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { generatedDir } from "@parlor/config";
4
+ import { devWranglerConfig, PresetError, resolvePreset, } from "@parlor/host";
5
+ import { CliError } from "../errors.js";
6
+ import { resolveWrangler, WRANGLER_MISSING } from "./wrangler.js";
7
+ /** Writes the Wrangler config the dev server's bindings come from, when the app deploys to cloudflare-durable. */
8
+ export async function prepareCloudflareDev({ config, rootDir }, env = process.env) {
9
+ let preset;
10
+ try {
11
+ preset = resolvePreset(undefined, config.deploy.preset, env).preset;
12
+ }
13
+ catch (error) {
14
+ if (error instanceof PresetError)
15
+ throw new CliError(error.message, { cause: error });
16
+ throw error;
17
+ }
18
+ if (preset !== "cloudflare-durable")
19
+ return undefined;
20
+ if (!resolveWrangler(rootDir))
21
+ throw new CliError(WRANGLER_MISSING);
22
+ const { wrangler, unavailable } = devWranglerConfig(config);
23
+ const dir = join(generatedDir(rootDir, env), "cloudflare");
24
+ await mkdir(dir, { recursive: true });
25
+ const configPath = join(dir, "wrangler.json");
26
+ await writeFile(configPath, `${JSON.stringify(wrangler, null, 2)}\n`);
27
+ return { configPath, unavailable };
28
+ }
29
+ //# sourceMappingURL=prepare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/cloudflare/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,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C,GAAG,EAAE,eAAe,CAAC,CAAC;IAC9C,MAAM,SAAS,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { generatedDir, type LoadedConfig } from \"@parlor/config\";\nimport {\n devWranglerConfig,\n PresetError,\n resolvePreset,\n type UnavailableDurableObject,\n} from \"@parlor/host\";\n\nimport { CliError } from \"../errors.js\";\nimport { resolveWrangler, WRANGLER_MISSING } from \"./wrangler.js\";\n\nexport interface CloudflareDev {\n readonly configPath: string;\n readonly unavailable: readonly UnavailableDurableObject[];\n}\n\n/** Writes the Wrangler config the dev server's bindings come from, when the app deploys to cloudflare-durable. */\nexport async function prepareCloudflareDev(\n { config, rootDir }: Pick<LoadedConfig, \"config\" | \"rootDir\">,\n env: NodeJS.ProcessEnv = process.env,\n): Promise<CloudflareDev | undefined> {\n let preset: string;\n try {\n preset = resolvePreset(undefined, config.deploy.preset, env).preset;\n } catch (error) {\n if (error instanceof PresetError) throw new CliError(error.message, { cause: error });\n throw error;\n }\n if (preset !== \"cloudflare-durable\") return undefined;\n if (!resolveWrangler(rootDir)) throw new CliError(WRANGLER_MISSING);\n const { wrangler, unavailable } = devWranglerConfig(config);\n const dir = join(generatedDir(rootDir, env), \"cloudflare\");\n await mkdir(dir, { recursive: true });\n const configPath = join(dir, \"wrangler.json\");\n await writeFile(configPath, `${JSON.stringify(wrangler, null, 2)}\\n`);\n return { configPath, unavailable };\n}\n"]}
@@ -0,0 +1,12 @@
1
+ export declare const env: {
2
+ [x: string]: unknown;
3
+ };
4
+ /** Lets modules that define Durable Objects load; parlor dev never constructs one. */
5
+ export declare class DurableObject<Env = unknown> {
6
+ protected readonly ctx: unknown;
7
+ protected readonly env: Env;
8
+ constructor(state: unknown, bindings: Env);
9
+ }
10
+ /** On Workers it keeps the request alive for `promise`; a Node process runs on anyway, so this only reports a failure. */
11
+ export declare function waitUntil(promise: Promise<unknown>): void;
12
+ //# sourceMappingURL=workers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workers.d.ts","sourceRoot":"","sources":["../../src/cloudflare/workers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG;;CAAgB,CAAC;AAEjC,sFAAsF;AACtF,qBAAa,aAAa,CAAC,GAAG,GAAG,OAAO;IACtC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAE5B,YAAY,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAGxC;CACF;AAED,0HAA0H;AAC1H,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAIzD"}
@@ -0,0 +1,18 @@
1
+ import { platformEnv } from "./platform.js";
2
+ export const env = platformEnv();
3
+ /** Lets modules that define Durable Objects load; parlor dev never constructs one. */
4
+ export class DurableObject {
5
+ ctx;
6
+ env;
7
+ constructor(state, bindings) {
8
+ this.ctx = state;
9
+ this.env = bindings;
10
+ }
11
+ }
12
+ /** On Workers it keeps the request alive for `promise`; a Node process runs on anyway, so this only reports a failure. */
13
+ export function waitUntil(promise) {
14
+ promise.catch((error) => {
15
+ console.error("[parlor] work passed to waitUntil failed:", error);
16
+ });
17
+ }
18
+ //# sourceMappingURL=workers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workers.js","sourceRoot":"","sources":["../../src/cloudflare/workers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,EAAE,CAAC;AAEjC,sFAAsF;AACtF,MAAM,OAAO,aAAa;IACL,GAAG,CAAU;IACb,GAAG,CAAM;IAE5B,YAAY,KAAc,EAAE,QAAa;QACvC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC;IACtB,CAAC;CACF;AAED,0HAA0H;AAC1H,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { platformEnv } from \"./platform.js\";\n\nexport const env = platformEnv();\n\n/** Lets modules that define Durable Objects load; parlor dev never constructs one. */\nexport class DurableObject<Env = unknown> {\n protected readonly ctx: unknown;\n protected readonly env: Env;\n\n constructor(state: unknown, bindings: Env) {\n this.ctx = state;\n this.env = bindings;\n }\n}\n\n/** On Workers it keeps the request alive for `promise`; a Node process runs on anyway, so this only reports a failure. */\nexport function waitUntil(promise: Promise<unknown>): void {\n promise.catch((error: unknown) => {\n console.error(\"[parlor] work passed to waitUntil failed:\", error);\n });\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const WRANGLER_MISSING = "The cloudflare-durable preset runs the app's Cloudflare bindings in parlor dev with Wrangler. Add wrangler to the app's devDependencies.";
2
+ /** The app's own Wrangler, the one that builds and deploys it: a node_modules lookup, never NODE_PATH. */
3
+ export declare function resolveWrangler(rootDir: string): string | undefined;
4
+ //# sourceMappingURL=wrangler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.d.ts","sourceRoot":"","sources":["../../src/cloudflare/wrangler.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,6IAC+G,CAAC;AAE7I,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMnE"}
@@ -0,0 +1,16 @@
1
+ import { existsSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ const require = createRequire(import.meta.url);
5
+ export const WRANGLER_MISSING = "The cloudflare-durable preset runs the app's Cloudflare bindings in parlor dev with Wrangler. Add wrangler to the app's devDependencies.";
6
+ /** The app's own Wrangler, the one that builds and deploys it: a node_modules lookup, never NODE_PATH. */
7
+ export function resolveWrangler(rootDir) {
8
+ for (let dir = rootDir;; dir = dirname(dir)) {
9
+ const installed = join(dir, "node_modules", "wrangler");
10
+ if (existsSync(join(installed, "package.json")))
11
+ return require.resolve(installed);
12
+ if (dirname(dir) === dir)
13
+ return undefined;
14
+ }
15
+ }
16
+ //# sourceMappingURL=wrangler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.js","sourceRoot":"","sources":["../../src/cloudflare/wrangler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAC3B,0IAA0I,CAAC;AAE7I,0GAA0G;AAC1G,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,KAAK,IAAI,GAAG,GAAG,OAAO,GAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QACxD,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACnF,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;YAAE,OAAO,SAAS,CAAC;IAC7C,CAAC;AACH,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\nconst require = createRequire(import.meta.url);\n\nexport const WRANGLER_MISSING =\n \"The cloudflare-durable preset runs the app's Cloudflare bindings in parlor dev with Wrangler. Add wrangler to the app's devDependencies.\";\n\n/** The app's own Wrangler, the one that builds and deploys it: a node_modules lookup, never NODE_PATH. */\nexport function resolveWrangler(rootDir: string): string | undefined {\n for (let dir = rootDir; ; dir = dirname(dir)) {\n const installed = join(dir, \"node_modules\", \"wrangler\");\n if (existsSync(join(installed, \"package.json\"))) return require.resolve(installed);\n if (dirname(dir) === dir) return undefined;\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { type LoadedConfig } from "@parlor/config";
2
+ import { type AddonName, type AddTools, type ProjectLayout } from "@parlor/scaffold";
3
+ export declare function projectLayout({ config, rootDir }: LoadedConfig): ProjectLayout;
4
+ /**
5
+ * The same code `parlor typegen` and `parlor db generate` run, pointed at whatever directory
6
+ * the transaction names: the staging copy, never the project.
7
+ */
8
+ export declare function addTools(loaded: LoadedConfig): AddTools;
9
+ export declare function parseAddonNames(values: readonly string[]): readonly AddonName[];
10
+ export declare const add: import("citty").CommandDef<{
11
+ readonly addon: {
12
+ readonly type: "positional";
13
+ readonly description: string;
14
+ readonly required: false;
15
+ };
16
+ readonly "dry-run": {
17
+ readonly type: "boolean";
18
+ readonly default: false;
19
+ readonly description: "Print the changes without writing or installing anything";
20
+ };
21
+ readonly install: {
22
+ readonly type: "boolean";
23
+ readonly default: true;
24
+ readonly description: "Install dependencies and generate files (--no-install to only write files)";
25
+ };
26
+ readonly "git-check": {
27
+ readonly type: "boolean";
28
+ readonly default: true;
29
+ readonly description: "Refuse to edit a project with uncommitted changes (--no-git-check to proceed)";
30
+ };
31
+ }>;
32
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,QAAQ,EAIb,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAO1B,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,aAAa,CAQ9E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,CAUvD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,SAAS,EAAE,CAW/E;AAED,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;EA2Cd,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { loadParlorConfig } from "@parlor/config";
2
+ import { ADDON_NAMES, addAddons, detectProjectPackageManager, formatAddResult, isAddonName, } from "@parlor/scaffold";
3
+ import { generateRouteTree, routeTreeFile } from "@parlor/shell-web";
4
+ import { defineCommand } from "citty";
5
+ import { CliError } from "../errors.js";
6
+ import { drizzleKitArgs, runDrizzleKit } from "./db.js";
7
+ export function projectLayout({ config, rootDir }) {
8
+ return {
9
+ rootDir,
10
+ serverEntry: config.server.entry,
11
+ schemaDir: config.database.schema,
12
+ migrationsDir: config.database.migrations,
13
+ routeTree: routeTreeFile(config),
14
+ };
15
+ }
16
+ /**
17
+ * The same code `parlor typegen` and `parlor db generate` run, pointed at whatever directory
18
+ * the transaction names: the staging copy, never the project.
19
+ */
20
+ export function addTools(loaded) {
21
+ const { config } = loaded;
22
+ return {
23
+ routeTree: (rootDir) => generateRouteTree({ ...loaded, rootDir }),
24
+ migration: (rootDir, name) => runDrizzleKit(drizzleKitArgs(config.database.schema, config.database.migrations, name), rootDir),
25
+ };
26
+ }
27
+ export function parseAddonNames(values) {
28
+ if (values.length === 0) {
29
+ throw new CliError(`Name what to add: ${ADDON_NAMES.join(", ")}`);
30
+ }
31
+ const unknown = values.filter((value) => !isAddonName(value));
32
+ if (unknown.length > 0) {
33
+ throw new CliError(`Unknown add-on ${unknown.map((name) => `"${name}"`).join(", ")}. Expected one of: ${ADDON_NAMES.join(", ")}`);
34
+ }
35
+ return [...new Set(values)];
36
+ }
37
+ export const add = defineCommand({
38
+ meta: {
39
+ name: "add",
40
+ description: `Add a feature to this app by editing its files: ${ADDON_NAMES.join(", ")}`,
41
+ },
42
+ args: {
43
+ addon: { type: "positional", description: ADDON_NAMES.join(" | "), required: false },
44
+ "dry-run": {
45
+ type: "boolean",
46
+ default: false,
47
+ description: "Print the changes without writing or installing anything",
48
+ },
49
+ install: {
50
+ type: "boolean",
51
+ default: true,
52
+ description: "Install dependencies and generate files (--no-install to only write files)",
53
+ },
54
+ "git-check": {
55
+ type: "boolean",
56
+ default: true,
57
+ description: "Refuse to edit a project with uncommitted changes (--no-git-check to proceed)",
58
+ },
59
+ },
60
+ async run({ args }) {
61
+ const loaded = await loadParlorConfig();
62
+ const addons = parseAddonNames(args._);
63
+ const packageManager = await detectProjectPackageManager(loaded.rootDir);
64
+ const result = await addAddons({
65
+ layout: projectLayout(loaded),
66
+ addons,
67
+ packageManager,
68
+ tools: addTools(loaded),
69
+ mode: args["dry-run"] ? "dry-run" : "apply",
70
+ install: args.install,
71
+ gitCheck: args["git-check"],
72
+ log: (line) => console.log(line),
73
+ });
74
+ const { text, exitCode } = formatAddResult(result, packageManager);
75
+ console.log(text);
76
+ process.exitCode = exitCode;
77
+ },
78
+ });
79
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,WAAW,EACX,SAAS,EAGT,2BAA2B,EAC3B,eAAe,EACf,WAAW,GAEZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA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MAAM,SAAS,CAAC;YAC7B,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;YAC7B,MAAM;YACN,cAAc;YACd,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;YACvB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;YAC3C,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;YAC3B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;SACjC,CAAC,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type LoadedConfig, loadParlorConfig } from \"@parlor/config\";\nimport {\n ADDON_NAMES,\n addAddons,\n type AddonName,\n type AddTools,\n detectProjectPackageManager,\n formatAddResult,\n isAddonName,\n type ProjectLayout,\n} from \"@parlor/scaffold\";\nimport { generateRouteTree, routeTreeFile } from \"@parlor/shell-web\";\nimport { defineCommand } from \"citty\";\n\nimport { CliError } from \"../errors.js\";\nimport { drizzleKitArgs, runDrizzleKit } from \"./db.js\";\n\nexport function projectLayout({ config, rootDir }: LoadedConfig): ProjectLayout {\n return {\n rootDir,\n serverEntry: config.server.entry,\n schemaDir: config.database.schema,\n migrationsDir: config.database.migrations,\n routeTree: routeTreeFile(config),\n };\n}\n\n/**\n * The same code `parlor typegen` and `parlor db generate` run, pointed at whatever directory\n * the transaction names: the staging copy, never the project.\n */\nexport function addTools(loaded: LoadedConfig): AddTools {\n const { config } = loaded;\n return {\n routeTree: (rootDir) => generateRouteTree({ ...loaded, rootDir }),\n migration: (rootDir, name) =>\n runDrizzleKit(\n drizzleKitArgs(config.database.schema, config.database.migrations, name),\n rootDir,\n ),\n };\n}\n\nexport function parseAddonNames(values: readonly string[]): readonly AddonName[] {\n if (values.length === 0) {\n throw new CliError(`Name what to add: ${ADDON_NAMES.join(\", \")}`);\n }\n const unknown = values.filter((value) => !isAddonName(value));\n if (unknown.length > 0) {\n throw new CliError(\n `Unknown add-on ${unknown.map((name) => `\"${name}\"`).join(\", \")}. Expected one of: ${ADDON_NAMES.join(\", \")}`,\n );\n }\n return [...new Set(values as AddonName[])];\n}\n\nexport const add = defineCommand({\n meta: {\n name: \"add\",\n description: `Add a feature to this app by editing its files: ${ADDON_NAMES.join(\", \")}`,\n },\n args: {\n addon: { type: \"positional\", description: ADDON_NAMES.join(\" | \"), required: false },\n \"dry-run\": {\n type: \"boolean\",\n default: false,\n description: \"Print the changes without writing or installing anything\",\n },\n install: {\n type: \"boolean\",\n default: true,\n description:\n \"Install dependencies and generate files (--no-install to only write files)\",\n },\n \"git-check\": {\n type: \"boolean\",\n default: true,\n description:\n \"Refuse to edit a project with uncommitted changes (--no-git-check to proceed)\",\n },\n },\n async run({ args }) {\n const loaded = await loadParlorConfig();\n const addons = parseAddonNames(args._);\n const packageManager = await detectProjectPackageManager(loaded.rootDir);\n const result = await addAddons({\n layout: projectLayout(loaded),\n addons,\n packageManager,\n tools: addTools(loaded),\n mode: args[\"dry-run\"] ? \"dry-run\" : \"apply\",\n install: args.install,\n gitCheck: args[\"git-check\"],\n log: (line) => console.log(line),\n });\n const { text, exitCode } = formatAddResult(result, packageManager);\n console.log(text);\n process.exitCode = exitCode;\n },\n});\n"]}
@@ -0,0 +1,12 @@
1
+ export declare const build: import("citty").CommandDef<{
2
+ readonly target: {
3
+ readonly type: "string";
4
+ readonly description: "web | ios | android | mac | windows | linux";
5
+ readonly default: "web";
6
+ };
7
+ readonly preset: {
8
+ readonly type: "string";
9
+ readonly description: "Server deploy preset for the web target: node-server, vercel, netlify, …";
10
+ };
11
+ }>;
12
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,KAAK;;;;;;;;;;EAqBhB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { loadParlorConfig } from "@parlor/config";
2
+ import { defineCommand } from "citty";
3
+ import { warnChatWithoutAuth } from "../chat-warning.js";
4
+ import { handlers } from "../handlers.js";
5
+ import { parseTarget, resolveHandler } from "../targets.js";
6
+ export const build = defineCommand({
7
+ meta: { name: "build", description: "Build the app for a target" },
8
+ args: {
9
+ target: {
10
+ type: "string",
11
+ description: "web | ios | android | mac | windows | linux",
12
+ default: "web",
13
+ },
14
+ preset: {
15
+ type: "string",
16
+ description: "Server deploy preset for the web target: node-server, vercel, netlify, …",
17
+ },
18
+ },
19
+ async run({ args }) {
20
+ const target = parseTarget(args.target);
21
+ const handler = resolveHandler(handlers, target);
22
+ const loaded = await loadParlorConfig();
23
+ await warnChatWithoutAuth(loaded);
24
+ await handler.build(loaded, { preset: args.preset });
25
+ },
26
+ });
27
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAClE,IAAI,EAAE;QACJ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,OAAO,EAAE,KAAK;SACf;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0EAA0E;SAC7E;KACF;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;QAChB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;QACxC,MAAM,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACvD,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { loadParlorConfig } from \"@parlor/config\";\nimport { defineCommand } from \"citty\";\n\nimport { warnChatWithoutAuth } from \"../chat-warning.js\";\nimport { handlers } from \"../handlers.js\";\nimport { parseTarget, resolveHandler } from \"../targets.js\";\n\nexport const build = defineCommand({\n meta: { name: \"build\", description: \"Build the app for a target\" },\n args: {\n target: {\n type: \"string\",\n description: \"web | ios | android | mac | windows | linux\",\n default: \"web\",\n },\n preset: {\n type: \"string\",\n description:\n \"Server deploy preset for the web target: node-server, vercel, netlify, …\",\n },\n },\n async run({ args }) {\n const target = parseTarget(args.target);\n const handler = resolveHandler(handlers, target);\n const loaded = await loadParlorConfig();\n await warnChatWithoutAuth(loaded);\n await handler.build(loaded, { preset: args.preset });\n },\n});\n"]}
@@ -0,0 +1,12 @@
1
+ import type { Writable } from "node:stream";
2
+ /** `name` replaces drizzle-kit's random suffix, so a generated migration has a stable file name. */
3
+ export declare function drizzleKitArgs(schema: string, migrations: string, name?: string): string[];
4
+ export interface DrizzleKitOptions {
5
+ readonly stdout?: "inherit" | "ignore";
6
+ readonly stderr?: Writable;
7
+ readonly signal?: AbortSignal;
8
+ readonly timeoutMs?: number;
9
+ }
10
+ export declare function runDrizzleKit(args: readonly string[], cwd: string, options?: DrizzleKitOptions): Promise<void>;
11
+ export declare const db: import("citty").CommandDef<import("citty").ArgsDef>;
12
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/commands/db.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAU5C,oGAAoG;AACpG,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,EAAE,CAWV;AAOD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAwEf;AAmCD,eAAO,MAAM,EAAE,qDAGb,CAAC"}