convex 1.31.4 → 1.31.6-alpha.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 (179) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/browser.bundle.js +1 -1
  3. package/dist/browser.bundle.js.map +1 -1
  4. package/dist/cjs/bundler/debugBundle.js +1 -1
  5. package/dist/cjs/bundler/debugBundle.js.map +1 -1
  6. package/dist/cjs/bundler/index.js +1 -1
  7. package/dist/cjs/bundler/index.js.map +1 -1
  8. package/dist/cjs/cli/configure.js +2 -10
  9. package/dist/cjs/cli/configure.js.map +2 -2
  10. package/dist/cjs/cli/deploy.js +16 -2
  11. package/dist/cjs/cli/deploy.js.map +2 -2
  12. package/dist/cjs/cli/dev.js +4 -1
  13. package/dist/cjs/cli/dev.js.map +2 -2
  14. package/dist/cjs/cli/generatedApi.js.map +1 -1
  15. package/dist/cjs/cli/integration.js +198 -10
  16. package/dist/cjs/cli/integration.js.map +2 -2
  17. package/dist/cjs/cli/lib/command.js +9 -4
  18. package/dist/cjs/cli/lib/command.js.map +2 -2
  19. package/dist/cjs/cli/lib/components/definition/bundle.js +1 -1
  20. package/dist/cjs/cli/lib/components/definition/bundle.js.map +1 -1
  21. package/dist/cjs/cli/lib/components.js +2 -1
  22. package/dist/cjs/cli/lib/components.js.map +2 -2
  23. package/dist/cjs/cli/lib/config.js +87 -212
  24. package/dist/cjs/cli/lib/config.js.map +3 -3
  25. package/dist/cjs/cli/lib/deploy2.js +27 -4
  26. package/dist/cjs/cli/lib/deploy2.js.map +2 -2
  27. package/dist/cjs/cli/lib/deploymentSelection.js +0 -12
  28. package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
  29. package/dist/cjs/cli/lib/dev.js +30 -0
  30. package/dist/cjs/cli/lib/dev.js.map +2 -2
  31. package/dist/cjs/cli/lib/mcp/tools/index.js.map +2 -2
  32. package/dist/cjs/cli/lib/utils/prompts.js +1 -1
  33. package/dist/cjs/cli/lib/utils/prompts.js.map +2 -2
  34. package/dist/cjs/cli/lib/workos/environmentApi.js +27 -1
  35. package/dist/cjs/cli/lib/workos/environmentApi.js.map +2 -2
  36. package/dist/cjs/cli/lib/workos/platformApi.js +41 -7
  37. package/dist/cjs/cli/lib/workos/platformApi.js.map +2 -2
  38. package/dist/cjs/cli/lib/workos/workos.js +532 -93
  39. package/dist/cjs/cli/lib/workos/workos.js.map +2 -2
  40. package/dist/cjs/index.js +1 -1
  41. package/dist/cjs/index.js.map +1 -1
  42. package/dist/cjs-types/bundler/debugBundle.d.ts.map +1 -1
  43. package/dist/cjs-types/bundler/index.d.ts.map +1 -1
  44. package/dist/cjs-types/cli/configure.d.ts.map +1 -1
  45. package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
  46. package/dist/cjs-types/cli/dev.d.ts.map +1 -1
  47. package/dist/cjs-types/cli/generatedApi.d.ts +260 -1
  48. package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
  49. package/dist/cjs-types/cli/integration.d.ts.map +1 -1
  50. package/dist/cjs-types/cli/lib/command.d.ts +7 -1
  51. package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
  52. package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  53. package/dist/cjs-types/cli/lib/components.d.ts +2 -0
  54. package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
  55. package/dist/cjs-types/cli/lib/config.d.ts +38 -26
  56. package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
  57. package/dist/cjs-types/cli/lib/deploy2.d.ts +5 -0
  58. package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
  59. package/dist/cjs-types/cli/lib/deployment.d.ts +1 -1
  60. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  61. package/dist/cjs-types/cli/lib/dev.d.ts +2 -0
  62. package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
  63. package/dist/cjs-types/cli/lib/mcp/tools/index.d.ts.map +1 -1
  64. package/dist/cjs-types/cli/lib/utils/prompts.d.ts +1 -0
  65. package/dist/cjs-types/cli/lib/utils/prompts.d.ts.map +1 -1
  66. package/dist/cjs-types/cli/lib/workos/environmentApi.d.ts +4 -0
  67. package/dist/cjs-types/cli/lib/workos/environmentApi.d.ts.map +1 -1
  68. package/dist/cjs-types/cli/lib/workos/platformApi.d.ts +9 -1
  69. package/dist/cjs-types/cli/lib/workos/platformApi.d.ts.map +1 -1
  70. package/dist/cjs-types/cli/lib/workos/workos.d.ts +39 -8
  71. package/dist/cjs-types/cli/lib/workos/workos.d.ts.map +1 -1
  72. package/dist/cjs-types/cli/lib/workos/workos.test.d.ts +2 -0
  73. package/dist/cjs-types/cli/lib/workos/workos.test.d.ts.map +1 -0
  74. package/dist/cjs-types/cli/network_test.d.ts +1 -0
  75. package/dist/cjs-types/cli/network_test.d.ts.map +1 -1
  76. package/dist/cjs-types/index.d.ts +1 -1
  77. package/dist/cjs-types/index.d.ts.map +1 -1
  78. package/dist/cli.bundle.cjs +3337 -5468
  79. package/dist/cli.bundle.cjs.map +4 -4
  80. package/dist/esm/bundler/debugBundle.js +1 -1
  81. package/dist/esm/bundler/debugBundle.js.map +1 -1
  82. package/dist/esm/bundler/index.js +1 -1
  83. package/dist/esm/bundler/index.js.map +1 -1
  84. package/dist/esm/cli/configure.js +3 -16
  85. package/dist/esm/cli/configure.js.map +2 -2
  86. package/dist/esm/cli/deploy.js +16 -2
  87. package/dist/esm/cli/deploy.js.map +2 -2
  88. package/dist/esm/cli/dev.js +4 -1
  89. package/dist/esm/cli/dev.js.map +2 -2
  90. package/dist/esm/cli/integration.js +209 -12
  91. package/dist/esm/cli/integration.js.map +2 -2
  92. package/dist/esm/cli/lib/command.js +9 -4
  93. package/dist/esm/cli/lib/command.js.map +2 -2
  94. package/dist/esm/cli/lib/components/definition/bundle.js +1 -1
  95. package/dist/esm/cli/lib/components/definition/bundle.js.map +1 -1
  96. package/dist/esm/cli/lib/components.js +2 -1
  97. package/dist/esm/cli/lib/components.js.map +2 -2
  98. package/dist/esm/cli/lib/config.js +86 -210
  99. package/dist/esm/cli/lib/config.js.map +3 -3
  100. package/dist/esm/cli/lib/deploy2.js +32 -5
  101. package/dist/esm/cli/lib/deploy2.js.map +2 -2
  102. package/dist/esm/cli/lib/deploymentSelection.js +0 -12
  103. package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
  104. package/dist/esm/cli/lib/dev.js +33 -0
  105. package/dist/esm/cli/lib/dev.js.map +2 -2
  106. package/dist/esm/cli/lib/mcp/tools/index.js.map +2 -2
  107. package/dist/esm/cli/lib/utils/prompts.js +1 -1
  108. package/dist/esm/cli/lib/utils/prompts.js.map +2 -2
  109. package/dist/esm/cli/lib/workos/environmentApi.js +25 -0
  110. package/dist/esm/cli/lib/workos/environmentApi.js.map +2 -2
  111. package/dist/esm/cli/lib/workos/platformApi.js +36 -6
  112. package/dist/esm/cli/lib/workos/platformApi.js.map +2 -2
  113. package/dist/esm/cli/lib/workos/workos.js +535 -94
  114. package/dist/esm/cli/lib/workos/workos.js.map +2 -2
  115. package/dist/esm/index.js +1 -1
  116. package/dist/esm/index.js.map +1 -1
  117. package/dist/esm-types/bundler/debugBundle.d.ts.map +1 -1
  118. package/dist/esm-types/bundler/index.d.ts.map +1 -1
  119. package/dist/esm-types/cli/configure.d.ts.map +1 -1
  120. package/dist/esm-types/cli/deploy.d.ts.map +1 -1
  121. package/dist/esm-types/cli/dev.d.ts.map +1 -1
  122. package/dist/esm-types/cli/generatedApi.d.ts +260 -1
  123. package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
  124. package/dist/esm-types/cli/integration.d.ts.map +1 -1
  125. package/dist/esm-types/cli/lib/command.d.ts +7 -1
  126. package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
  127. package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  128. package/dist/esm-types/cli/lib/components.d.ts +2 -0
  129. package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
  130. package/dist/esm-types/cli/lib/config.d.ts +38 -26
  131. package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
  132. package/dist/esm-types/cli/lib/deploy2.d.ts +5 -0
  133. package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
  134. package/dist/esm-types/cli/lib/deployment.d.ts +1 -1
  135. package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  136. package/dist/esm-types/cli/lib/dev.d.ts +2 -0
  137. package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
  138. package/dist/esm-types/cli/lib/mcp/tools/index.d.ts.map +1 -1
  139. package/dist/esm-types/cli/lib/utils/prompts.d.ts +1 -0
  140. package/dist/esm-types/cli/lib/utils/prompts.d.ts.map +1 -1
  141. package/dist/esm-types/cli/lib/workos/environmentApi.d.ts +4 -0
  142. package/dist/esm-types/cli/lib/workos/environmentApi.d.ts.map +1 -1
  143. package/dist/esm-types/cli/lib/workos/platformApi.d.ts +9 -1
  144. package/dist/esm-types/cli/lib/workos/platformApi.d.ts.map +1 -1
  145. package/dist/esm-types/cli/lib/workos/workos.d.ts +39 -8
  146. package/dist/esm-types/cli/lib/workos/workos.d.ts.map +1 -1
  147. package/dist/esm-types/cli/lib/workos/workos.test.d.ts +2 -0
  148. package/dist/esm-types/cli/lib/workos/workos.test.d.ts.map +1 -0
  149. package/dist/esm-types/cli/network_test.d.ts +1 -0
  150. package/dist/esm-types/cli/network_test.d.ts.map +1 -1
  151. package/dist/esm-types/index.d.ts +1 -1
  152. package/dist/esm-types/index.d.ts.map +1 -1
  153. package/dist/react.bundle.js +1 -1
  154. package/dist/react.bundle.js.map +1 -1
  155. package/package.json +5 -5
  156. package/schemas/convex.schema.json +2 -1
  157. package/src/bundler/debugBundle.ts +1 -1
  158. package/src/bundler/index.ts +1 -1
  159. package/src/cli/configure.ts +3 -18
  160. package/src/cli/deploy.ts +23 -1
  161. package/src/cli/dev.ts +6 -0
  162. package/src/cli/generatedApi.ts +260 -1
  163. package/src/cli/integration.ts +289 -15
  164. package/src/cli/lib/command.ts +19 -6
  165. package/src/cli/lib/components/definition/bundle.ts +1 -1
  166. package/src/cli/lib/components.ts +7 -1
  167. package/src/cli/lib/config.test.ts +444 -547
  168. package/src/cli/lib/config.ts +166 -309
  169. package/src/cli/lib/deploy2.ts +47 -4
  170. package/src/cli/lib/deploymentSelection.ts +0 -14
  171. package/src/cli/lib/dev.ts +58 -0
  172. package/src/cli/lib/mcp/tools/index.ts +1 -2
  173. package/src/cli/lib/utils/prompts.ts +4 -1
  174. package/src/cli/lib/workos/environmentApi.ts +38 -0
  175. package/src/cli/lib/workos/platformApi.ts +69 -6
  176. package/src/cli/lib/workos/workos.test.ts +242 -0
  177. package/src/cli/lib/workos/workos.ts +807 -134
  178. package/src/cli/network_test.ts +1 -1
  179. package/src/index.ts +1 -1
@@ -24,10 +24,15 @@ __export(command_exports, {
24
24
  module.exports = __toCommonJS(command_exports);
25
25
  var import_extra_typings = require("@commander-js/extra-typings");
26
26
  var import_utils = require("./utils/utils.js");
27
- import_extra_typings.Command.prototype.addDeploymentSelectionOptions = function(action) {
28
- return this.addOption(
29
- new import_extra_typings.Option("--url <url>").conflicts(["--prod", "--preview-name", "--deployment-name"]).hideHelp()
30
- ).addOption(new import_extra_typings.Option("--admin-key <adminKey>").hideHelp()).addOption(
27
+ import_extra_typings.Command.prototype.addDeploymentSelectionOptions = function(action, options) {
28
+ const urlOption = new import_extra_typings.Option(
29
+ "--url <url>",
30
+ options?.showUrlHelp ? action + " the deployment at the given URL." : void 0
31
+ ).conflicts(["--prod", "--preview-name", "--deployment-name"]);
32
+ if (!options?.showUrlHelp) {
33
+ urlOption.hideHelp();
34
+ }
35
+ return this.addOption(urlOption).addOption(new import_extra_typings.Option("--admin-key <adminKey>").hideHelp()).addOption(
31
36
  new import_extra_typings.Option(
32
37
  "--env-file <envFile>",
33
38
  `Path to a custom file of environment variables, for choosing the deployment, e.g. ${import_utils.CONVEX_DEPLOYMENT_ENV_VAR_NAME} or ${import_utils.CONVEX_SELF_HOSTED_URL_VAR_NAME}. Same format as .env.local or .env files, and overrides them.`
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lib/command.ts"],
4
- "sourcesContent": ["import { Command, Option } from \"@commander-js/extra-typings\";\nimport { OneoffCtx } from \"../../bundler/context.js\";\nimport { LogMode } from \"./logs.js\";\nimport {\n CONVEX_DEPLOYMENT_ENV_VAR_NAME,\n CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME,\n CONVEX_SELF_HOSTED_URL_VAR_NAME,\n parseInteger,\n parsePositiveInteger,\n} from \"./utils/utils.js\";\n\ndeclare module \"@commander-js/extra-typings\" {\n interface Command<Args extends any[] = [], Opts extends OptionValues = {}> {\n /**\n * For a command that talks to the configured dev deployment by default,\n * add flags for talking to prod, preview, or other deployment in the same\n * project.\n *\n * These flags are added to the end of `command` (ordering matters for `--help`\n * output). `action` should look like \"Import data into\" because it is prefixed\n * onto help strings.\n *\n * The options can be passed to `deploymentSelectionFromOptions`.\n *\n * NOTE: This method only exists at runtime if this file is imported.\n * To help avoid this bug, this method takes in an `ActionDescription` which\n * can only be constructed via `actionDescription` from this file.\n */\n addDeploymentSelectionOptions(action: ActionDescription): Command<\n Args,\n Opts & {\n envFile?: string;\n url?: string;\n adminKey?: string;\n prod?: boolean;\n previewName?: string;\n deploymentName?: string;\n }\n >;\n\n /**\n * Adds options for the `deploy` command.\n */\n addDeployOptions(): Command<\n Args,\n Opts & {\n verbose?: boolean;\n dryRun?: boolean;\n yes?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n cmd?: string;\n cmdUrlEnvVarName?: string;\n debugBundlePath?: string;\n debug?: boolean;\n writePushRequest?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for `self-host` subcommands.\n */\n addSelfHostOptions(): Command<\n Args,\n Opts & {\n url?: string;\n adminKey?: string;\n env?: string;\n }\n >;\n\n /**\n * Adds options and arguments for the `run` command.\n */\n addRunOptions(): Command<\n [...Args, string, string | undefined],\n Opts & {\n watch?: boolean;\n push?: boolean;\n identity?: string;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n component?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for the `import` command.\n */\n addImportOptions(): Command<\n [...Args, string],\n Opts & {\n table?: string;\n format?: \"csv\" | \"jsonLines\" | \"jsonArray\" | \"zip\";\n replace?: boolean;\n append?: boolean;\n replaceAll?: boolean;\n yes?: boolean;\n component?: string;\n }\n >;\n\n /**\n * Adds options for the `export` command.\n */\n addExportOptions(): Command<\n Args,\n Opts & {\n path: string;\n includeFileStorage?: boolean;\n }\n >;\n\n /**\n * Adds options for the `data` command.\n */\n addDataOptions(): Command<\n [...Args, string | undefined],\n Opts & {\n limit: number;\n order: \"asc\" | \"desc\";\n component?: string;\n format?: \"json\" | \"jsonArray\" | \"jsonLines\" | \"jsonl\" | \"pretty\";\n }\n >;\n\n /**\n * Adds options for the `logs` command.\n */\n addLogsOptions(): Command<\n Args,\n Opts & {\n history: number;\n success: boolean;\n jsonl: boolean;\n }\n >;\n\n /**\n * Adds options for the `network-test` command.\n */\n addNetworkTestOptions(): Command<\n Args,\n Opts & {\n timeout?: string;\n ipFamily?: string;\n speedTest?: boolean;\n }\n >;\n }\n}\n\nCommand.prototype.addDeploymentSelectionOptions = function (\n action: ActionDescription,\n) {\n return this.addOption(\n new Option(\"--url <url>\")\n .conflicts([\"--prod\", \"--preview-name\", \"--deployment-name\"])\n .hideHelp(),\n )\n .addOption(new Option(\"--admin-key <adminKey>\").hideHelp())\n .addOption(\n new Option(\n \"--env-file <envFile>\",\n `Path to a custom file of environment variables, for choosing the \\\ndeployment, e.g. ${CONVEX_DEPLOYMENT_ENV_VAR_NAME} or ${CONVEX_SELF_HOSTED_URL_VAR_NAME}. \\\nSame format as .env.local or .env files, and overrides them.`,\n ),\n )\n .addOption(\n new Option(\n \"--prod\",\n action + \" this project's production deployment.\",\n ).conflicts([\"--preview-name\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--preview-name <previewName>\",\n action + \" the preview deployment with the given name.\",\n ).conflicts([\"--prod\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--deployment-name <deploymentName>\",\n action + \" the specified deployment.\",\n ).conflicts([\"--prod\", \"--preview-name\", \"--url\"]),\n ) as any;\n};\n\ndeclare const tag: unique symbol;\ntype ActionDescription = string & { readonly [tag]: \"noop\" };\nexport function actionDescription(action: string): ActionDescription {\n return action as any;\n}\n\nexport async function normalizeDevOptions(\n ctx: OneoffCtx,\n cmdOptions: {\n verbose?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents?: boolean;\n codegen: \"enable\" | \"disable\";\n once?: boolean;\n untilSuccess: boolean;\n run?: string | undefined;\n runSh?: string;\n runComponent?: string;\n tailLogs?: string | true;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis?: boolean;\n liveComponentSources?: boolean;\n while?: string;\n },\n): Promise<{\n verbose: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: boolean;\n once: boolean;\n untilSuccess: boolean;\n run?:\n | { kind: \"function\"; name: string; component?: string | undefined }\n | { kind: \"shell\"; command: string }\n | undefined;\n tailLogs: LogMode;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n liveComponentSources: boolean;\n}> {\n if (cmdOptions.runComponent && !cmdOptions.run) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"Can't specify `--run-component` option without `--run`\",\n });\n }\n\n if (cmdOptions.debugBundlePath !== undefined && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-bundle-path` can only be used with `--once`.\",\n });\n }\n if (cmdOptions.debugNodeApis && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-node-apis` can only be used with `--once`.\",\n });\n }\n\n return {\n verbose: !!cmdOptions.verbose,\n typecheck: cmdOptions.typecheck,\n typecheckComponents: !!cmdOptions.typecheckComponents,\n codegen: cmdOptions.codegen === \"enable\",\n once: !!cmdOptions.once,\n untilSuccess: cmdOptions.untilSuccess,\n run:\n cmdOptions.run !== undefined\n ? {\n kind: \"function\",\n name: cmdOptions.run,\n component: cmdOptions.runComponent,\n }\n : cmdOptions.runSh !== undefined\n ? {\n kind: \"shell\",\n command: cmdOptions.runSh,\n }\n : undefined,\n tailLogs:\n typeof cmdOptions.tailLogs === \"string\"\n ? (cmdOptions.tailLogs as LogMode)\n : \"pause-on-deploy\",\n traceEvents: cmdOptions.traceEvents,\n debugBundlePath: cmdOptions.debugBundlePath,\n debugNodeApis: !!cmdOptions.debugNodeApis,\n liveComponentSources: !!cmdOptions.liveComponentSources,\n };\n}\n\nCommand.prototype.addDeployOptions = function () {\n return this.option(\"-v, --verbose\", \"Show full listing of changes\")\n .option(\n \"--dry-run\",\n \"Print out the generated configuration without deploying to your Convex deployment\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompt when running locally\")\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\` before deploying.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Whether to regenerate code in `convex/_generated/` before pushing.\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--cmd <command>\",\n \"Command to run as part of deploying your app (e.g. `vite build`). This command can depend on the environment variables specified in `--cmd-url-env-var-name` being set.\",\n ),\n )\n .addOption(\n new Option(\n \"--cmd-url-env-var-name <name>\",\n \"Environment variable name to set Convex deployment URL (e.g. `VITE_CONVEX_URL`) when using `--cmd`\",\n ),\n )\n .addOption(new Option(\"--debug-bundle-path <path>\").hideHelp())\n .addOption(new Option(\"--debug\").hideHelp())\n .addOption(new Option(\"--write-push-request <writePushRequest>\").hideHelp())\n .addOption(new Option(\"--live-component-sources\").hideHelp());\n};\n\nCommand.prototype.addSelfHostOptions = function () {\n return this.option(\n \"--admin-key <adminKey>\",\n `An admin key for the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--url <url>\",\n `The url of the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--env <env>\",\n `Path to a custom file of environment variables, containing \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` and \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\`.`,\n );\n};\n\nCommand.prototype.addRunOptions = function () {\n return (\n this.argument(\n \"functionName\",\n \"identifier of the function to run, like `listMessages` or `dir/file:myFunction`\",\n )\n .argument(\n \"[args]\",\n \"JSON-formatted arguments object to pass to the function.\",\n )\n .option(\n \"-w, --watch\",\n \"Watch a query, printing its result if the underlying data changes. Given function must be a query.\",\n )\n .option(\"--push\", \"Push code to deployment before running the function.\")\n .addOption(\n new Option(\n \"--identity <identity>\",\n 'JSON-formatted UserIdentity object, e.g. \\'{ name: \"John\", address: \"0x123\" }\\'',\n ),\n )\n // For backwards compatibility we still support --no-push which is a noop\n .addOption(new Option(\"--no-push\").hideHelp())\n // Options for the deploy that --push does\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\`.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Regenerate code in `convex/_generated/`\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n )\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n );\n};\n\nCommand.prototype.addImportOptions = function () {\n return this.argument(\"<path>\", \"Path to the input file\")\n .addOption(\n new Option(\n \"--table <table>\",\n \"Destination table name. Required if format is csv, jsonLines, or jsonArray. Not supported if format is zip.\",\n ),\n )\n .addOption(\n new Option(\n \"--replace\",\n \"Replace all existing data in any of the imported tables\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace-all\"),\n )\n .addOption(\n new Option(\"--append\", \"Append imported data to any existing tables\")\n .conflicts(\"--replace-all\")\n .conflicts(\"--replace\"),\n )\n .addOption(\n new Option(\n \"--replace-all\",\n \"Replace all existing data in the deployment with the imported tables,\\n\" +\n \" deleting tables that don't appear in the import file or the schema,\\n\" +\n \" and clearing tables that appear in the schema but not in the import file\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace\"),\n )\n .option(\n \"-y, --yes\",\n \"Skip confirmation prompt when import leads to deleting existing documents\",\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Input file format. This flag is only required if the filename is missing an extension.\\n\" +\n \"- CSV files must have a header, and each row's entries are interpreted either as a (floating point) number or a string.\\n\" +\n \"- JSON files must be an array of JSON objects.\\n\" +\n \"- JSONLines files must have a JSON object per line.\\n\" +\n \"- ZIP files must have one directory per table, containing <table>/documents.jsonl. Snapshot exports from the Convex dashboard have this format.\",\n ).choices([\"csv\", \"jsonLines\", \"jsonArray\", \"zip\"]),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n );\n};\n\nCommand.prototype.addExportOptions = function () {\n return this.requiredOption(\n \"--path <zipFilePath>\",\n \"Exports data into a ZIP file at this path, which may be a directory or unoccupied .zip path\",\n ).addOption(\n new Option(\n \"--include-file-storage\",\n \"Includes stored files (https://dashboard.convex.dev/deployment/files) in a _storage folder within the ZIP file\",\n ),\n );\n};\n\nCommand.prototype.addDataOptions = function () {\n return this.addOption(\n new Option(\n \"--limit <n>\",\n \"List only the `n` the most recently created documents.\",\n )\n .default(100)\n .argParser(parsePositiveInteger),\n )\n .addOption(\n new Option(\n \"--order <choice>\",\n \"Order the documents by their `_creationTime`.\",\n )\n .choices([\"asc\", \"desc\"])\n .default(\"desc\"),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Format to print the data in. This flag is only required if the filename is missing an extension.\\n\" +\n \"- jsonArray (aka json): print the data as a JSON array of objects.\\n\" +\n \"- jsonLines (aka jsonl): print the data as a JSON object per line.\\n\" +\n \"- pretty: print the data in a human-readable format.\",\n ).choices([\"jsonArray\", \"json\", \"jsonLines\", \"jsonl\", \"pretty\"]),\n )\n .argument(\"[table]\", \"If specified, list documents in this table.\");\n};\n\nCommand.prototype.addLogsOptions = function () {\n return this.option(\n \"--history [n]\",\n \"Show `n` most recent logs. Defaults to showing all available logs.\",\n parseInteger,\n )\n .option(\n \"--success\",\n \"Print a log line for every successful function execution\",\n false,\n )\n .option(\"--jsonl\", \"Output raw log events as JSONL\", false);\n};\n\nCommand.prototype.addNetworkTestOptions = function () {\n return this.addOption(\n new Option(\n \"--timeout <timeout>\",\n \"Timeout in seconds for the network test (default: 30).\",\n ),\n )\n .addOption(\n new Option(\n \"--ip-family <ipFamily>\",\n \"IP family to use (ipv4, ipv6, or auto)\",\n ),\n )\n .addOption(\n new Option(\n \"--speed-test\",\n \"Perform a large echo test to measure network speed.\",\n ),\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAgC;A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7C,SAAO,KAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,WAAW,kCAAkC,KAAK;AAC9D;AAEA,6BAAQ,UAAU,wBAAwB,WAAY;AACpD,SAAO,KAAK;AAAA,IACV,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACG;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACJ;",
4
+ "sourcesContent": ["import { Command, Option } from \"@commander-js/extra-typings\";\nimport { OneoffCtx } from \"../../bundler/context.js\";\nimport { LogMode } from \"./logs.js\";\nimport {\n CONVEX_DEPLOYMENT_ENV_VAR_NAME,\n CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME,\n CONVEX_SELF_HOSTED_URL_VAR_NAME,\n parseInteger,\n parsePositiveInteger,\n} from \"./utils/utils.js\";\n\ndeclare module \"@commander-js/extra-typings\" {\n interface Command<Args extends any[] = [], Opts extends OptionValues = {}> {\n /**\n * For a command that talks to the configured dev deployment by default,\n * add flags for talking to prod, preview, or other deployment in the same\n * project.\n *\n * These flags are added to the end of `command` (ordering matters for `--help`\n * output). `action` should look like \"Import data into\" because it is prefixed\n * onto help strings.\n *\n * The options can be passed to `deploymentSelectionFromOptions`.\n *\n * NOTE: This method only exists at runtime if this file is imported.\n * To help avoid this bug, this method takes in an `ActionDescription` which\n * can only be constructed via `actionDescription` from this file.\n *\n * @param action - The action description\n * @param options - Optional settings\n * @param options.showUrlHelp - If true, show the --url option in help output\n */\n addDeploymentSelectionOptions(\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n ): Command<\n Args,\n Opts & {\n envFile?: string;\n url?: string;\n adminKey?: string;\n prod?: boolean;\n previewName?: string;\n deploymentName?: string;\n }\n >;\n\n /**\n * Adds options for the `deploy` command.\n */\n addDeployOptions(): Command<\n Args,\n Opts & {\n verbose?: boolean;\n dryRun?: boolean;\n yes?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n cmd?: string;\n cmdUrlEnvVarName?: string;\n debugBundlePath?: string;\n debug?: boolean;\n writePushRequest?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for `self-host` subcommands.\n */\n addSelfHostOptions(): Command<\n Args,\n Opts & {\n url?: string;\n adminKey?: string;\n env?: string;\n }\n >;\n\n /**\n * Adds options and arguments for the `run` command.\n */\n addRunOptions(): Command<\n [...Args, string, string | undefined],\n Opts & {\n watch?: boolean;\n push?: boolean;\n identity?: string;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n component?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for the `import` command.\n */\n addImportOptions(): Command<\n [...Args, string],\n Opts & {\n table?: string;\n format?: \"csv\" | \"jsonLines\" | \"jsonArray\" | \"zip\";\n replace?: boolean;\n append?: boolean;\n replaceAll?: boolean;\n yes?: boolean;\n component?: string;\n }\n >;\n\n /**\n * Adds options for the `export` command.\n */\n addExportOptions(): Command<\n Args,\n Opts & {\n path: string;\n includeFileStorage?: boolean;\n }\n >;\n\n /**\n * Adds options for the `data` command.\n */\n addDataOptions(): Command<\n [...Args, string | undefined],\n Opts & {\n limit: number;\n order: \"asc\" | \"desc\";\n component?: string;\n format?: \"json\" | \"jsonArray\" | \"jsonLines\" | \"jsonl\" | \"pretty\";\n }\n >;\n\n /**\n * Adds options for the `logs` command.\n */\n addLogsOptions(): Command<\n Args,\n Opts & {\n history: number;\n success: boolean;\n jsonl: boolean;\n }\n >;\n\n /**\n * Adds options for the `network-test` command.\n */\n addNetworkTestOptions(): Command<\n Args,\n Opts & {\n timeout?: string;\n ipFamily?: string;\n speedTest?: boolean;\n }\n >;\n }\n}\n\nCommand.prototype.addDeploymentSelectionOptions = function (\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n) {\n const urlOption = new Option(\n \"--url <url>\",\n options?.showUrlHelp\n ? action + \" the deployment at the given URL.\"\n : undefined,\n ).conflicts([\"--prod\", \"--preview-name\", \"--deployment-name\"]);\n if (!options?.showUrlHelp) {\n urlOption.hideHelp();\n }\n return this.addOption(urlOption)\n .addOption(new Option(\"--admin-key <adminKey>\").hideHelp())\n .addOption(\n new Option(\n \"--env-file <envFile>\",\n `Path to a custom file of environment variables, for choosing the \\\ndeployment, e.g. ${CONVEX_DEPLOYMENT_ENV_VAR_NAME} or ${CONVEX_SELF_HOSTED_URL_VAR_NAME}. \\\nSame format as .env.local or .env files, and overrides them.`,\n ),\n )\n .addOption(\n new Option(\n \"--prod\",\n action + \" this project's production deployment.\",\n ).conflicts([\"--preview-name\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--preview-name <previewName>\",\n action + \" the preview deployment with the given name.\",\n ).conflicts([\"--prod\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--deployment-name <deploymentName>\",\n action + \" the specified deployment.\",\n ).conflicts([\"--prod\", \"--preview-name\", \"--url\"]),\n ) as any;\n};\n\ndeclare const tag: unique symbol;\ntype ActionDescription = string & { readonly [tag]: \"noop\" };\nexport function actionDescription(action: string): ActionDescription {\n return action as any;\n}\n\nexport async function normalizeDevOptions(\n ctx: OneoffCtx,\n cmdOptions: {\n verbose?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents?: boolean;\n codegen: \"enable\" | \"disable\";\n once?: boolean;\n untilSuccess: boolean;\n run?: string | undefined;\n runSh?: string;\n runComponent?: string;\n tailLogs?: string | true;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis?: boolean;\n liveComponentSources?: boolean;\n while?: string;\n },\n): Promise<{\n verbose: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: boolean;\n once: boolean;\n untilSuccess: boolean;\n run?:\n | { kind: \"function\"; name: string; component?: string | undefined }\n | { kind: \"shell\"; command: string }\n | undefined;\n tailLogs: LogMode;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n liveComponentSources: boolean;\n}> {\n if (cmdOptions.runComponent && !cmdOptions.run) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"Can't specify `--run-component` option without `--run`\",\n });\n }\n\n if (cmdOptions.debugBundlePath !== undefined && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-bundle-path` can only be used with `--once`.\",\n });\n }\n if (cmdOptions.debugNodeApis && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-node-apis` can only be used with `--once`.\",\n });\n }\n\n return {\n verbose: !!cmdOptions.verbose,\n typecheck: cmdOptions.typecheck,\n typecheckComponents: !!cmdOptions.typecheckComponents,\n codegen: cmdOptions.codegen === \"enable\",\n once: !!cmdOptions.once,\n untilSuccess: cmdOptions.untilSuccess,\n run:\n cmdOptions.run !== undefined\n ? {\n kind: \"function\",\n name: cmdOptions.run,\n component: cmdOptions.runComponent,\n }\n : cmdOptions.runSh !== undefined\n ? {\n kind: \"shell\",\n command: cmdOptions.runSh,\n }\n : undefined,\n tailLogs:\n typeof cmdOptions.tailLogs === \"string\"\n ? (cmdOptions.tailLogs as LogMode)\n : \"pause-on-deploy\",\n traceEvents: cmdOptions.traceEvents,\n debugBundlePath: cmdOptions.debugBundlePath,\n debugNodeApis: !!cmdOptions.debugNodeApis,\n liveComponentSources: !!cmdOptions.liveComponentSources,\n };\n}\n\nCommand.prototype.addDeployOptions = function () {\n return this.option(\"-v, --verbose\", \"Show full listing of changes\")\n .option(\n \"--dry-run\",\n \"Print out the generated configuration without deploying to your Convex deployment\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompt when running locally\")\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\` before deploying.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Whether to regenerate code in `convex/_generated/` before pushing.\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--cmd <command>\",\n \"Command to run as part of deploying your app (e.g. `vite build`). This command can depend on the environment variables specified in `--cmd-url-env-var-name` being set.\",\n ),\n )\n .addOption(\n new Option(\n \"--cmd-url-env-var-name <name>\",\n \"Environment variable name to set Convex deployment URL (e.g. `VITE_CONVEX_URL`) when using `--cmd`\",\n ),\n )\n .addOption(new Option(\"--debug-bundle-path <path>\").hideHelp())\n .addOption(new Option(\"--debug\").hideHelp())\n .addOption(new Option(\"--write-push-request <writePushRequest>\").hideHelp())\n .addOption(new Option(\"--live-component-sources\").hideHelp());\n};\n\nCommand.prototype.addSelfHostOptions = function () {\n return this.option(\n \"--admin-key <adminKey>\",\n `An admin key for the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--url <url>\",\n `The url of the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--env <env>\",\n `Path to a custom file of environment variables, containing \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` and \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\`.`,\n );\n};\n\nCommand.prototype.addRunOptions = function () {\n return (\n this.argument(\n \"functionName\",\n \"identifier of the function to run, like `listMessages` or `dir/file:myFunction`\",\n )\n .argument(\n \"[args]\",\n \"JSON-formatted arguments object to pass to the function.\",\n )\n .option(\n \"-w, --watch\",\n \"Watch a query, printing its result if the underlying data changes. Given function must be a query.\",\n )\n .option(\"--push\", \"Push code to deployment before running the function.\")\n .addOption(\n new Option(\n \"--identity <identity>\",\n 'JSON-formatted UserIdentity object, e.g. \\'{ name: \"John\", address: \"0x123\" }\\'',\n ),\n )\n // For backwards compatibility we still support --no-push which is a noop\n .addOption(new Option(\"--no-push\").hideHelp())\n // Options for the deploy that --push does\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\`.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Regenerate code in `convex/_generated/`\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n )\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n );\n};\n\nCommand.prototype.addImportOptions = function () {\n return this.argument(\"<path>\", \"Path to the input file\")\n .addOption(\n new Option(\n \"--table <table>\",\n \"Destination table name. Required if format is csv, jsonLines, or jsonArray. Not supported if format is zip.\",\n ),\n )\n .addOption(\n new Option(\n \"--replace\",\n \"Replace all existing data in any of the imported tables\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace-all\"),\n )\n .addOption(\n new Option(\"--append\", \"Append imported data to any existing tables\")\n .conflicts(\"--replace-all\")\n .conflicts(\"--replace\"),\n )\n .addOption(\n new Option(\n \"--replace-all\",\n \"Replace all existing data in the deployment with the imported tables,\\n\" +\n \" deleting tables that don't appear in the import file or the schema,\\n\" +\n \" and clearing tables that appear in the schema but not in the import file\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace\"),\n )\n .option(\n \"-y, --yes\",\n \"Skip confirmation prompt when import leads to deleting existing documents\",\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Input file format. This flag is only required if the filename is missing an extension.\\n\" +\n \"- CSV files must have a header, and each row's entries are interpreted either as a (floating point) number or a string.\\n\" +\n \"- JSON files must be an array of JSON objects.\\n\" +\n \"- JSONLines files must have a JSON object per line.\\n\" +\n \"- ZIP files must have one directory per table, containing <table>/documents.jsonl. Snapshot exports from the Convex dashboard have this format.\",\n ).choices([\"csv\", \"jsonLines\", \"jsonArray\", \"zip\"]),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n );\n};\n\nCommand.prototype.addExportOptions = function () {\n return this.requiredOption(\n \"--path <zipFilePath>\",\n \"Exports data into a ZIP file at this path, which may be a directory or unoccupied .zip path\",\n ).addOption(\n new Option(\n \"--include-file-storage\",\n \"Includes stored files (https://dashboard.convex.dev/deployment/files) in a _storage folder within the ZIP file\",\n ),\n );\n};\n\nCommand.prototype.addDataOptions = function () {\n return this.addOption(\n new Option(\n \"--limit <n>\",\n \"List only the `n` the most recently created documents.\",\n )\n .default(100)\n .argParser(parsePositiveInteger),\n )\n .addOption(\n new Option(\n \"--order <choice>\",\n \"Order the documents by their `_creationTime`.\",\n )\n .choices([\"asc\", \"desc\"])\n .default(\"desc\"),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n \"Path to the component in the component tree defined in convex.config.ts.\",\n ),\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Format to print the data in. This flag is only required if the filename is missing an extension.\\n\" +\n \"- jsonArray (aka json): print the data as a JSON array of objects.\\n\" +\n \"- jsonLines (aka jsonl): print the data as a JSON object per line.\\n\" +\n \"- pretty: print the data in a human-readable format.\",\n ).choices([\"jsonArray\", \"json\", \"jsonLines\", \"jsonl\", \"pretty\"]),\n )\n .argument(\"[table]\", \"If specified, list documents in this table.\");\n};\n\nCommand.prototype.addLogsOptions = function () {\n return this.option(\n \"--history [n]\",\n \"Show `n` most recent logs. Defaults to showing all available logs.\",\n parseInteger,\n )\n .option(\n \"--success\",\n \"Print a log line for every successful function execution\",\n false,\n )\n .option(\"--jsonl\", \"Output raw log events as JSONL\", false);\n};\n\nCommand.prototype.addNetworkTestOptions = function () {\n return this.addOption(\n new Option(\n \"--timeout <timeout>\",\n \"Timeout in seconds for the network test (default: 30).\",\n ),\n )\n .addOption(\n new Option(\n \"--ip-family <ipFamily>\",\n \"IP family to use (ipv4, ipv6, or auto)\",\n ),\n )\n .addOption(\n new Option(\n \"--speed-test\",\n \"Perform a large echo test to measure network speed.\",\n ),\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAgC;AAGhC,mBAMO;AA0JP,6BAAQ,UAAU,gCAAgC,SAChD,QACA,SACA;AACA,QAAM,YAAY,IAAI;AAAA,IACpB;AAAA,IACA,SAAS,cACL,SAAS,sCACT;AAAA,EACN,EAAE,UAAU,CAAC,UAAU,kBAAkB,mBAAmB,CAAC;AAC7D,MAAI,CAAC,SAAS,aAAa;AACzB,cAAU,SAAS;AAAA,EACrB;AACA,SAAO,KAAK,UAAU,SAAS,EAC5B,UAAU,IAAI,4BAAO,wBAAwB,EAAE,SAAS,CAAC,EACzD;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,qFACW,2CAA8B,OAAO,4CAA+B;AAAA,IAEjF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACX,EAAE,UAAU,CAAC,kBAAkB,qBAAqB,OAAO,CAAC;AAAA,EAC9D,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACX,EAAE,UAAU,CAAC,UAAU,qBAAqB,OAAO,CAAC;AAAA,EACtD,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACX,EAAE,UAAU,CAAC,UAAU,kBAAkB,OAAO,CAAC;AAAA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MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,6BAAQ,UAAU,iBAAiB,WAAY;AAC7C,SAAO,KAAK;AAAA,IACV,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,QAAQ,GAAG,EACX,UAAU,iCAAoB;AAAA,EACnC,EACG;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,QAAQ,CAAC,OAAO,MAAM,CAAC,EACvB,QAAQ,MAAM;AAAA,EACnB,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IAIF,EAAE,QAAQ,CAAC,aAAa,QAAQ,aAAa,SAAS,QAAQ,CAAC;AAAA,EACjE,EACC,SAAS,WAAW,6CAA6C;AACtE;AAEA,6BAAQ,UAAU,iBAAiB,WAAY;AAC7C,SAAO,KAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,WAAW,kCAAkC,KAAK;AAC9D;AAEA,6BAAQ,UAAU,wBAAwB,WAAY;AACpD,SAAO,KAAK;AAAA,IACV,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACG;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACJ;",
6
6
  "names": []
7
7
  }
@@ -452,7 +452,7 @@ async function bundleImplementations({
452
452
  nodeExternalPackages,
453
453
  extraConditions,
454
454
  verbose = false,
455
- includeSourcesContent = true
455
+ includeSourcesContent = false
456
456
  }) {
457
457
  let appImplementation;
458
458
  const componentImplementations = [];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/cli/lib/components/definition/bundle.ts"],
4
- "sourcesContent": ["import path from \"path\";\nimport {\n ComponentDirectory,\n ComponentDefinitionPath,\n buildComponentDirectory,\n isComponentDirectory,\n qualifiedDefinitionPath,\n toComponentDefinitionPath,\n} from \"./directoryStructure.js\";\nimport { Context } from \"../../../../bundler/context.js\";\nimport {\n logMessage,\n logWarning,\n showSpinner,\n} from \"../../../../bundler/log.js\";\nimport esbuild, { BuildOptions, Metafile, OutputFile, Plugin } from \"esbuild\";\nimport { chalkStderr } from \"chalk\";\nimport {\n AppDefinitionSpecWithoutImpls,\n ComponentDefinitionSpecWithoutImpls,\n} from \"../../config.js\";\nimport {\n Bundle,\n bundle,\n bundleAuthConfig,\n bundleSchema,\n entryPointsByEnvironment,\n} from \"../../../../bundler/index.js\";\nimport { NodeDependency } from \"../../deployApi/modules.js\";\n\nconst VIRTUAL_CONFIG_NAMESPACE = \"convex-virtual-config\";\nconst VIRTUAL_CONFIG_CONTENTS = `import { defineApp } from \"convex/server\";\\nconst app = defineApp();\\nexport default app;`;\n\n/**\n * An esbuild plugin to insert a virtual `convex.config.js` file into the bundle\n * when Convex project doesn't have one explicitly defined.\n *\n * This allows us to use the components push path even when the Convex project doesn't\n * have a config file defined.\n *\n * When importComponentPath is provided, the virtual config will import and use the\n * component found at that path.\n */\nfunction virtualConfig({\n rootComponentDirectory,\n importComponentPath,\n}: {\n rootComponentDirectory: ComponentDirectory;\n importComponentPath?: string;\n}): Plugin {\n // Empty config with no components\n let contents = VIRTUAL_CONFIG_CONTENTS;\n\n if (importComponentPath) {\n // Generate config that imports the specified component\n const relativeImport = path.relative(\n rootComponentDirectory.path,\n importComponentPath,\n );\n let normalizedImport = relativeImport\n .replace(/\\\\/g, \"/\")\n .replace(/\\.ts$/, \".js\");\n\n // We don't generate code for this synthetic root component so the name we\n // use for the component doesn't matter.\n contents = `import { defineApp } from \"convex/server\";\nimport component from \"${normalizedImport}\";\n\nconst app = defineApp();\napp.use(component, { name: \"exampleComponentInstance\" });\nexport default app;`;\n }\n\n return {\n name: `convex-virtual-config`,\n async setup(build) {\n const filter = pathToRegexFilter(rootComponentDirectory);\n build.onResolve({ filter }, async (args) => {\n return { path: args.path, namespace: VIRTUAL_CONFIG_NAMESPACE };\n });\n build.onLoad(\n { filter, namespace: VIRTUAL_CONFIG_NAMESPACE },\n async (_args) => {\n return {\n contents,\n resolveDir: rootComponentDirectory.path,\n };\n },\n );\n },\n };\n}\n\nfunction pathToRegexFilter(root: ComponentDirectory) {\n let path = qualifiedDefinitionPath(root);\n const escaped = path\n .replace(/\\\\/g, \"/\")\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return new RegExp(`^${escaped}$`);\n}\n\n/**\n * An esbuild plugin to mark component definitions external or return a list of\n * all component definitions.\n *\n * By default this plugin runs in \"bundle\" mode and marks all imported component\n * definition files as external, not traversing further.\n *\n * If \"discover\" mode is specified it traverses the entire tree.\n */\nfunction componentPlugin({\n mode = \"bundle\",\n rootComponentDirectory,\n verbose,\n ctx,\n}: {\n mode: \"discover\" | \"bundle\";\n rootComponentDirectory: ComponentDirectory;\n verbose?: boolean;\n ctx: Context;\n}): Plugin {\n const components = new Map<string, ComponentDirectory>();\n return {\n name: `convex-${mode === \"discover\" ? \"discover-components\" : \"bundle-components\"}`,\n async setup(build) {\n // This regex can't be really precise since developers could import\n // \"convex.config\", \"convex.config.js\", \"convex.config.ts\", etc.\n build.onResolve({ filter: /.*convex.config.*/ }, async (args) => {\n verbose && logMessage(\"esbuild resolving import:\", args);\n if (\n args.namespace !== \"file\" &&\n args.namespace !== VIRTUAL_CONFIG_NAMESPACE\n ) {\n verbose && logMessage(\" Not a file or virtual config.\");\n return;\n }\n if (args.kind === \"entry-point\") {\n verbose && logMessage(\" -> Top-level entry-point.\");\n const componentDirectory = await buildComponentDirectory(\n ctx,\n path.resolve(args.path),\n );\n\n // No attempt to resolve args.path is made for entry points so they\n // must be relative or absolute file paths, not npm packages.\n // Whether we're bundling or discovering, we're done.\n if (components.get(args.path)) {\n // We always invoke esbuild in a try/catch.\n // eslint-disable-next-line no-restricted-syntax\n throw new Error(\n `Entry point component \"${args.path}\" already registered.`,\n );\n }\n components.set(args.path, componentDirectory);\n return;\n }\n\n const candidates = [args.path];\n const ext = path.extname(args.path);\n if (ext === \".js\") {\n candidates.push(args.path.slice(0, -\".js\".length) + \".ts\");\n }\n if (ext !== \".js\" && ext !== \".ts\") {\n candidates.push(args.path + \".js\");\n candidates.push(args.path + \".ts\");\n }\n let resolvedPath = undefined;\n for (const candidate of candidates) {\n const result = await build.resolve(candidate, {\n // We expect this to be \"import-statement\" but pass 'kind' through\n // to say honest to normal esbuild behavior.\n kind: args.kind,\n resolveDir: args.resolveDir,\n });\n if (result.path) {\n resolvedPath = result.path;\n break;\n }\n }\n if (resolvedPath === undefined) {\n verbose && logMessage(` -> ${args.path} not found.`);\n return;\n }\n\n const parentDir = path.dirname(resolvedPath);\n let imported = components.get(resolvedPath);\n if (!imported) {\n const isComponent = isComponentDirectory(ctx, parentDir, false);\n if (isComponent.kind !== \"ok\") {\n verbose && logMessage(\" -> Not a component:\", isComponent);\n return;\n }\n imported = isComponent.component;\n components.set(resolvedPath, imported);\n }\n\n verbose &&\n logMessage(\n \" -> Component import! Recording it.\",\n args.path,\n resolvedPath,\n );\n\n if (mode === \"discover\") {\n return {\n path: resolvedPath,\n };\n } else {\n // In bundle mode, transform external imports to use componentPaths:\n // import rateLimiter from \"convex_ratelimiter\";\n // => import rateLimiter from `_componentDeps/${base64('../node_modules/convex_ratelimiter')}`;\n\n // A componentPath is path from the root component to the directory\n // of the this component's definition file.\n const componentPath = toComponentDefinitionPath(\n rootComponentDirectory,\n imported,\n );\n const importPath = definitionImportPath(componentPath);\n return {\n path: importPath,\n external: true,\n };\n }\n });\n },\n };\n}\n\n/** The path on the deployment that identifier a component definition. */\nfunction definitionImportPath(componentPath: ComponentDefinitionPath): string {\n return `./_componentDeps/${Buffer.from(componentPath).toString(\"base64url\")}`;\n}\n\n// Share configuration between the component definition discovery and bundling passes.\nfunction sharedEsbuildOptions({\n liveComponentSources = false,\n}: {\n liveComponentSources?: boolean;\n}) {\n const options = {\n bundle: true,\n platform: \"browser\",\n format: \"esm\",\n target: \"esnext\",\n\n conditions: [\"convex\", \"module\"] as string[],\n\n // `false` is the default for splitting. It's simpler to evaluate these on\n // the server as a single file.\n // Splitting could be enabled for speed once the server supports it.\n splitting: false,\n\n // place output files in memory at their source locations\n write: false,\n outdir: path.parse(process.cwd()).root,\n outbase: path.parse(process.cwd()).root,\n\n minify: true, // Note that this implies NODE_ENV=\"production\".\n keepNames: true,\n\n metafile: true,\n } as const satisfies BuildOptions;\n\n // Link directly to component sources (usually .ts) in order to\n // skip the build step. This also causes codegen to run for components\n // loaded from npm packages.\n if (liveComponentSources) {\n options.conditions.push(\"@convex-dev/component-source\");\n }\n return options;\n}\n\n// Use the esbuild metafile to discover the dependency graph in which component\n// definitions are nodes.\nexport async function componentGraph(\n ctx: Context,\n absWorkingDir: string,\n rootComponentDirectory: ComponentDirectory,\n liveComponentSources: boolean,\n verbose: boolean = true,\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n if (\n rootComponentDirectory.isRootWithoutConfig &&\n !rootComponentDirectory.syntheticComponentImport\n ) {\n return {\n components: new Map([\n [rootComponentDirectory.path, rootComponentDirectory],\n ]),\n dependencyGraph: [],\n };\n }\n let result;\n try {\n result = await esbuild.build({\n absWorkingDir, // This is mostly useful for formatting error messages.\n entryPoints: [qualifiedDefinitionPath(rootComponentDirectory)],\n plugins: [\n componentPlugin({\n ctx,\n mode: \"discover\",\n verbose,\n rootComponentDirectory,\n }),\n ...(rootComponentDirectory.syntheticComponentImport\n ? [\n virtualConfig({\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }),\n ]\n : []),\n ],\n sourcemap: \"external\",\n sourcesContent: false,\n\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n if (rootComponentDirectory.syntheticComponentImport) {\n // Virtual configs appear in the metafile with a namespace prefix\n // and can't have ComponentDirectory objects built by reading the filesystem\n // so swap in this rootComponentDirectory.\n return await findComponentDependencies(ctx, result.metafile, {\n [`${VIRTUAL_CONFIG_NAMESPACE}:${qualifiedDefinitionPath(rootComponentDirectory)}`]:\n rootComponentDirectory,\n });\n }\n\n return await findComponentDependencies(ctx, result.metafile);\n}\n\n/**\n * Get dependencies of a ComponenDirectory as ComponentPaths.\n *\n * Component paths are paths relative to the root component.\n */\nexport function getDeps(\n rootComponent: ComponentDirectory,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n definitionPath: string,\n): ComponentDefinitionPath[] {\n return dependencyGraph\n .filter(\n ([importer, _imported]) => importer.definitionPath === definitionPath,\n )\n .map(([_importer, imported]) =>\n toComponentDefinitionPath(rootComponent, imported),\n );\n}\n\n/**\n * The returned dependency graph is an array of tuples of [importer, imported]\n *\n * This doesn't work on just any esbuild metafile because it assumes input\n * imports have not been transformed. We run it on the metafile produced by\n * the esbuild invocation that uses the component plugin in \"discover\" mode.\n *\n * @param inputOverrides - ComponentDirectory objects to be used for metafile.inputs\n * keys, in case they don't exist (namely virtual configs via esbuild plugin namespaces).\n */\nasync function findComponentDependencies(\n ctx: Context,\n metafile: Metafile,\n inputOverrides: Record<string, ComponentDirectory> = {},\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n const { inputs } = metafile;\n\n const componentsByKey = new Map<string, ComponentDirectory>();\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n const override: ComponentDirectory | undefined = inputOverrides[inputPath];\n if (override) {\n componentsByKey.set(inputPath, override);\n } else {\n // Normal component - build from filesystem\n const component = await buildComponentDirectory(ctx, inputPath);\n componentsByKey.set(path.resolve(inputPath), component);\n }\n }\n\n const dependencyGraph: [ComponentDirectory, ComponentDirectory][] = [];\n\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n // For overridden inputs, use the original key; for normal components, use resolved path\n const importerKey =\n inputPath in inputOverrides ? inputPath : path.resolve(inputPath);\n\n const importer = componentsByKey.get(importerKey);\n if (!importer) continue;\n\n const { imports } = inputs[inputPath];\n const componentImports = imports.filter((imp) =>\n imp.path.includes(\".config.\"),\n );\n\n for (const imp of componentImports) {\n const imported = componentsByKey.get(path.resolve(imp.path));\n if (!imported) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Didn't find ${path.resolve(imp.path)} in ${[...componentsByKey.keys()].toString()}`,\n });\n }\n\n // Grab the import specifier from the metafile (e.g. `@convex-dev/workpool/convex.config`) so\n // we can use it to import component APIs\n if (imp.original) {\n const importSpecifier = imp.original;\n const relativeSpecifier = importSpecifier.replace(\n /\\/convex\\.config.*$/,\n \"\",\n );\n\n imported.importSpecifier = relativeSpecifier;\n }\n\n dependencyGraph.push([importer, imported]);\n }\n }\n\n const components = new Map<string, ComponentDirectory>();\n for (const directory of componentsByKey.values()) {\n components.set(directory.path, directory);\n }\n\n return { components, dependencyGraph };\n}\n\n// NB: If a directory linked to is not a member of the passed\n// componentDirectories array then there will be external links\n// with no corresponding definition bundle.\n// That could be made to throw an error but maybe those are already available\n// on the Convex definition filesystem somehow, e.g. builtin components.\n/** Bundle the component definitions listed. */\nexport async function bundleDefinitions(\n ctx: Context,\n absWorkingDir: string,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n rootComponentDirectory: ComponentDirectory,\n componentDirectories: ComponentDirectory[],\n liveComponentSources: boolean,\n verbose: boolean = false,\n): Promise<{\n appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls;\n componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[];\n}> {\n let result;\n try {\n let plugins = [\n componentPlugin({\n ctx,\n mode: \"bundle\",\n verbose,\n rootComponentDirectory,\n }),\n ];\n if (\n rootComponentDirectory.syntheticComponentImport ||\n rootComponentDirectory.isRootWithoutConfig\n ) {\n // Use virtual config (either with a component import or empty)\n plugins.push(\n virtualConfig(\n rootComponentDirectory.syntheticComponentImport\n ? {\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }\n : { rootComponentDirectory },\n ),\n );\n }\n result = await esbuild.build({\n absWorkingDir,\n entryPoints: componentDirectories.map((dir) =>\n qualifiedDefinitionPath(dir),\n ),\n plugins,\n sourcemap: true,\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n const outputs: {\n outputJs: OutputFile;\n outputJsMap?: OutputFile;\n directory: ComponentDirectory;\n }[] = [];\n for (const directory of componentDirectories) {\n const absInput = path.resolve(absWorkingDir, directory.definitionPath);\n const expectedOutputJs =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js\";\n const expectedOutputMap =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js.map\";\n const outputJs = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputJs,\n )[0];\n if (!outputJs) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `no JS found matching ${expectedOutputJs} in ${result.outputFiles.map((x) => x.path).toString()}`,\n });\n }\n const outputJsMap = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputMap,\n )[0];\n outputs.push({\n outputJs,\n outputJsMap,\n directory,\n });\n }\n\n const appBundles = outputs.filter(\n (out) => out.directory.path === rootComponentDirectory.path,\n );\n if (appBundles.length !== 1) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"found wrong number of app bundles\",\n });\n }\n const appBundle = appBundles[0];\n const componentBundles = outputs.filter(\n (out) => out.directory.path !== rootComponentDirectory.path,\n );\n\n const componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[] =\n componentBundles.map(({ directory, outputJs, outputJsMap }) => ({\n definitionPath: toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n ),\n definition: {\n path: path.relative(directory.path, outputJs.path),\n source: outputJs.text,\n sourceMap: outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: getDeps(\n rootComponentDirectory,\n dependencyGraph,\n directory.definitionPath,\n ),\n }));\n const appDeps = getDeps(\n rootComponentDirectory,\n dependencyGraph,\n appBundle.directory.definitionPath,\n );\n const appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls = {\n definition: {\n path: path.relative(rootComponentDirectory.path, appBundle.outputJs.path),\n source: appBundle.outputJs.text,\n sourceMap: appBundle.outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: appDeps,\n };\n return {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n };\n}\n\nexport async function bundleImplementations({\n ctx,\n rootComponentDirectory,\n componentDirectories,\n nodeExternalPackages,\n extraConditions,\n verbose = false,\n includeSourcesContent = true,\n}: {\n ctx: Context;\n rootComponentDirectory: ComponentDirectory;\n componentDirectories: ComponentDirectory[];\n nodeExternalPackages: string[];\n extraConditions: string[];\n verbose: boolean;\n includeSourcesContent?: boolean;\n}): Promise<{\n appImplementation: {\n schema: Bundle | null;\n functions: Bundle[];\n externalNodeDependencies: NodeDependency[];\n };\n componentImplementations: {\n schema: Bundle | null;\n functions: Bundle[];\n definitionPath: ComponentDefinitionPath;\n }[];\n}> {\n let appImplementation;\n const componentImplementations = [];\n\n // For --component-dir flag, skip bundling root implementations (no real code to bundle)\n const directoriesToBundle = rootComponentDirectory.syntheticComponentImport\n ? componentDirectories\n : [rootComponentDirectory, ...componentDirectories];\n\n for (const directory of directoriesToBundle) {\n const isRoot = directory.path === rootComponentDirectory.path;\n const resolvedPath = path.resolve(\n rootComponentDirectory.path,\n directory.path,\n );\n let schema;\n if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.ts\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.js\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else {\n schema = null;\n }\n\n const entryPoints = await entryPointsByEnvironment(ctx, resolvedPath);\n const convexResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.isolate,\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n includeSourcesContent,\n });\n\n if (convexResult.externalDependencies.size !== 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"external dependencies not supported\",\n });\n }\n const functions = convexResult.modules;\n if (isRoot) {\n if (verbose) {\n showSpinner(\"Bundling modules for Node.js runtime...\");\n }\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n\n const externalNodeDependencies: NodeDependency[] = [];\n for (const [\n moduleName,\n moduleVersion,\n ] of nodeResult.externalDependencies) {\n externalNodeDependencies.push({\n name: moduleName,\n version: moduleVersion,\n });\n }\n const authBundle = await bundleAuthConfig(ctx, resolvedPath);\n appImplementation = {\n schema,\n functions: functions.concat(nodeResult.modules).concat(authBundle),\n externalNodeDependencies,\n };\n } else {\n // Reject push if components have node bundles in non-root directories.\n if (directory.path !== rootComponentDirectory.path) {\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n if (nodeResult.modules.length > 0) {\n // TODO(ENG-7116) Remove error and bundle the component node actions when we are ready to support them.\n await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not supported in components. Remove it from the component at: ${resolvedPath}.`,\n });\n }\n }\n // definitionPath is the canonical form\n const definitionPath = toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n );\n componentImplementations.push({ definitionPath, schema, functions });\n }\n }\n\n if (!appImplementation) {\n // For --component-dir flag, we don't bundle root implementations so provide an empty one\n if (rootComponentDirectory.syntheticComponentImport) {\n appImplementation = {\n schema: null,\n functions: [],\n externalNodeDependencies: [],\n };\n } else {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"No app implementation found\",\n });\n }\n }\n\n return { appImplementation, componentImplementations };\n}\n\nasync function registerEsbuildReads(\n ctx: Context,\n absWorkingDir: string,\n metafile: Metafile,\n) {\n for (const [relPath, input] of Object.entries(metafile.inputs)) {\n if (\n // We rewrite these files so this integrity check isn't useful.\n path.basename(relPath).includes(\"convex.config\") ||\n // TODO: esbuild outputs paths prefixed with \"(disabled)\" when bundling our internal\n // udf-system package. The files do actually exist locally, though.\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\")\n ) {\n continue;\n }\n const absPath = path.resolve(absWorkingDir, relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n}\n"],
4
+ "sourcesContent": ["import path from \"path\";\nimport {\n ComponentDirectory,\n ComponentDefinitionPath,\n buildComponentDirectory,\n isComponentDirectory,\n qualifiedDefinitionPath,\n toComponentDefinitionPath,\n} from \"./directoryStructure.js\";\nimport { Context } from \"../../../../bundler/context.js\";\nimport {\n logMessage,\n logWarning,\n showSpinner,\n} from \"../../../../bundler/log.js\";\nimport esbuild, { BuildOptions, Metafile, OutputFile, Plugin } from \"esbuild\";\nimport { chalkStderr } from \"chalk\";\nimport {\n AppDefinitionSpecWithoutImpls,\n ComponentDefinitionSpecWithoutImpls,\n} from \"../../config.js\";\nimport {\n Bundle,\n bundle,\n bundleAuthConfig,\n bundleSchema,\n entryPointsByEnvironment,\n} from \"../../../../bundler/index.js\";\nimport { NodeDependency } from \"../../deployApi/modules.js\";\n\nconst VIRTUAL_CONFIG_NAMESPACE = \"convex-virtual-config\";\nconst VIRTUAL_CONFIG_CONTENTS = `import { defineApp } from \"convex/server\";\\nconst app = defineApp();\\nexport default app;`;\n\n/**\n * An esbuild plugin to insert a virtual `convex.config.js` file into the bundle\n * when Convex project doesn't have one explicitly defined.\n *\n * This allows us to use the components push path even when the Convex project doesn't\n * have a config file defined.\n *\n * When importComponentPath is provided, the virtual config will import and use the\n * component found at that path.\n */\nfunction virtualConfig({\n rootComponentDirectory,\n importComponentPath,\n}: {\n rootComponentDirectory: ComponentDirectory;\n importComponentPath?: string;\n}): Plugin {\n // Empty config with no components\n let contents = VIRTUAL_CONFIG_CONTENTS;\n\n if (importComponentPath) {\n // Generate config that imports the specified component\n const relativeImport = path.relative(\n rootComponentDirectory.path,\n importComponentPath,\n );\n let normalizedImport = relativeImport\n .replace(/\\\\/g, \"/\")\n .replace(/\\.ts$/, \".js\");\n\n // We don't generate code for this synthetic root component so the name we\n // use for the component doesn't matter.\n contents = `import { defineApp } from \"convex/server\";\nimport component from \"${normalizedImport}\";\n\nconst app = defineApp();\napp.use(component, { name: \"exampleComponentInstance\" });\nexport default app;`;\n }\n\n return {\n name: `convex-virtual-config`,\n async setup(build) {\n const filter = pathToRegexFilter(rootComponentDirectory);\n build.onResolve({ filter }, async (args) => {\n return { path: args.path, namespace: VIRTUAL_CONFIG_NAMESPACE };\n });\n build.onLoad(\n { filter, namespace: VIRTUAL_CONFIG_NAMESPACE },\n async (_args) => {\n return {\n contents,\n resolveDir: rootComponentDirectory.path,\n };\n },\n );\n },\n };\n}\n\nfunction pathToRegexFilter(root: ComponentDirectory) {\n let path = qualifiedDefinitionPath(root);\n const escaped = path\n .replace(/\\\\/g, \"/\")\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return new RegExp(`^${escaped}$`);\n}\n\n/**\n * An esbuild plugin to mark component definitions external or return a list of\n * all component definitions.\n *\n * By default this plugin runs in \"bundle\" mode and marks all imported component\n * definition files as external, not traversing further.\n *\n * If \"discover\" mode is specified it traverses the entire tree.\n */\nfunction componentPlugin({\n mode = \"bundle\",\n rootComponentDirectory,\n verbose,\n ctx,\n}: {\n mode: \"discover\" | \"bundle\";\n rootComponentDirectory: ComponentDirectory;\n verbose?: boolean;\n ctx: Context;\n}): Plugin {\n const components = new Map<string, ComponentDirectory>();\n return {\n name: `convex-${mode === \"discover\" ? \"discover-components\" : \"bundle-components\"}`,\n async setup(build) {\n // This regex can't be really precise since developers could import\n // \"convex.config\", \"convex.config.js\", \"convex.config.ts\", etc.\n build.onResolve({ filter: /.*convex.config.*/ }, async (args) => {\n verbose && logMessage(\"esbuild resolving import:\", args);\n if (\n args.namespace !== \"file\" &&\n args.namespace !== VIRTUAL_CONFIG_NAMESPACE\n ) {\n verbose && logMessage(\" Not a file or virtual config.\");\n return;\n }\n if (args.kind === \"entry-point\") {\n verbose && logMessage(\" -> Top-level entry-point.\");\n const componentDirectory = await buildComponentDirectory(\n ctx,\n path.resolve(args.path),\n );\n\n // No attempt to resolve args.path is made for entry points so they\n // must be relative or absolute file paths, not npm packages.\n // Whether we're bundling or discovering, we're done.\n if (components.get(args.path)) {\n // We always invoke esbuild in a try/catch.\n // eslint-disable-next-line no-restricted-syntax\n throw new Error(\n `Entry point component \"${args.path}\" already registered.`,\n );\n }\n components.set(args.path, componentDirectory);\n return;\n }\n\n const candidates = [args.path];\n const ext = path.extname(args.path);\n if (ext === \".js\") {\n candidates.push(args.path.slice(0, -\".js\".length) + \".ts\");\n }\n if (ext !== \".js\" && ext !== \".ts\") {\n candidates.push(args.path + \".js\");\n candidates.push(args.path + \".ts\");\n }\n let resolvedPath = undefined;\n for (const candidate of candidates) {\n const result = await build.resolve(candidate, {\n // We expect this to be \"import-statement\" but pass 'kind' through\n // to say honest to normal esbuild behavior.\n kind: args.kind,\n resolveDir: args.resolveDir,\n });\n if (result.path) {\n resolvedPath = result.path;\n break;\n }\n }\n if (resolvedPath === undefined) {\n verbose && logMessage(` -> ${args.path} not found.`);\n return;\n }\n\n const parentDir = path.dirname(resolvedPath);\n let imported = components.get(resolvedPath);\n if (!imported) {\n const isComponent = isComponentDirectory(ctx, parentDir, false);\n if (isComponent.kind !== \"ok\") {\n verbose && logMessage(\" -> Not a component:\", isComponent);\n return;\n }\n imported = isComponent.component;\n components.set(resolvedPath, imported);\n }\n\n verbose &&\n logMessage(\n \" -> Component import! Recording it.\",\n args.path,\n resolvedPath,\n );\n\n if (mode === \"discover\") {\n return {\n path: resolvedPath,\n };\n } else {\n // In bundle mode, transform external imports to use componentPaths:\n // import rateLimiter from \"convex_ratelimiter\";\n // => import rateLimiter from `_componentDeps/${base64('../node_modules/convex_ratelimiter')}`;\n\n // A componentPath is path from the root component to the directory\n // of the this component's definition file.\n const componentPath = toComponentDefinitionPath(\n rootComponentDirectory,\n imported,\n );\n const importPath = definitionImportPath(componentPath);\n return {\n path: importPath,\n external: true,\n };\n }\n });\n },\n };\n}\n\n/** The path on the deployment that identifier a component definition. */\nfunction definitionImportPath(componentPath: ComponentDefinitionPath): string {\n return `./_componentDeps/${Buffer.from(componentPath).toString(\"base64url\")}`;\n}\n\n// Share configuration between the component definition discovery and bundling passes.\nfunction sharedEsbuildOptions({\n liveComponentSources = false,\n}: {\n liveComponentSources?: boolean;\n}) {\n const options = {\n bundle: true,\n platform: \"browser\",\n format: \"esm\",\n target: \"esnext\",\n\n conditions: [\"convex\", \"module\"] as string[],\n\n // `false` is the default for splitting. It's simpler to evaluate these on\n // the server as a single file.\n // Splitting could be enabled for speed once the server supports it.\n splitting: false,\n\n // place output files in memory at their source locations\n write: false,\n outdir: path.parse(process.cwd()).root,\n outbase: path.parse(process.cwd()).root,\n\n minify: true, // Note that this implies NODE_ENV=\"production\".\n keepNames: true,\n\n metafile: true,\n } as const satisfies BuildOptions;\n\n // Link directly to component sources (usually .ts) in order to\n // skip the build step. This also causes codegen to run for components\n // loaded from npm packages.\n if (liveComponentSources) {\n options.conditions.push(\"@convex-dev/component-source\");\n }\n return options;\n}\n\n// Use the esbuild metafile to discover the dependency graph in which component\n// definitions are nodes.\nexport async function componentGraph(\n ctx: Context,\n absWorkingDir: string,\n rootComponentDirectory: ComponentDirectory,\n liveComponentSources: boolean,\n verbose: boolean = true,\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n if (\n rootComponentDirectory.isRootWithoutConfig &&\n !rootComponentDirectory.syntheticComponentImport\n ) {\n return {\n components: new Map([\n [rootComponentDirectory.path, rootComponentDirectory],\n ]),\n dependencyGraph: [],\n };\n }\n let result;\n try {\n result = await esbuild.build({\n absWorkingDir, // This is mostly useful for formatting error messages.\n entryPoints: [qualifiedDefinitionPath(rootComponentDirectory)],\n plugins: [\n componentPlugin({\n ctx,\n mode: \"discover\",\n verbose,\n rootComponentDirectory,\n }),\n ...(rootComponentDirectory.syntheticComponentImport\n ? [\n virtualConfig({\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }),\n ]\n : []),\n ],\n sourcemap: \"external\",\n sourcesContent: false,\n\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n if (rootComponentDirectory.syntheticComponentImport) {\n // Virtual configs appear in the metafile with a namespace prefix\n // and can't have ComponentDirectory objects built by reading the filesystem\n // so swap in this rootComponentDirectory.\n return await findComponentDependencies(ctx, result.metafile, {\n [`${VIRTUAL_CONFIG_NAMESPACE}:${qualifiedDefinitionPath(rootComponentDirectory)}`]:\n rootComponentDirectory,\n });\n }\n\n return await findComponentDependencies(ctx, result.metafile);\n}\n\n/**\n * Get dependencies of a ComponenDirectory as ComponentPaths.\n *\n * Component paths are paths relative to the root component.\n */\nexport function getDeps(\n rootComponent: ComponentDirectory,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n definitionPath: string,\n): ComponentDefinitionPath[] {\n return dependencyGraph\n .filter(\n ([importer, _imported]) => importer.definitionPath === definitionPath,\n )\n .map(([_importer, imported]) =>\n toComponentDefinitionPath(rootComponent, imported),\n );\n}\n\n/**\n * The returned dependency graph is an array of tuples of [importer, imported]\n *\n * This doesn't work on just any esbuild metafile because it assumes input\n * imports have not been transformed. We run it on the metafile produced by\n * the esbuild invocation that uses the component plugin in \"discover\" mode.\n *\n * @param inputOverrides - ComponentDirectory objects to be used for metafile.inputs\n * keys, in case they don't exist (namely virtual configs via esbuild plugin namespaces).\n */\nasync function findComponentDependencies(\n ctx: Context,\n metafile: Metafile,\n inputOverrides: Record<string, ComponentDirectory> = {},\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n const { inputs } = metafile;\n\n const componentsByKey = new Map<string, ComponentDirectory>();\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n const override: ComponentDirectory | undefined = inputOverrides[inputPath];\n if (override) {\n componentsByKey.set(inputPath, override);\n } else {\n // Normal component - build from filesystem\n const component = await buildComponentDirectory(ctx, inputPath);\n componentsByKey.set(path.resolve(inputPath), component);\n }\n }\n\n const dependencyGraph: [ComponentDirectory, ComponentDirectory][] = [];\n\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n // For overridden inputs, use the original key; for normal components, use resolved path\n const importerKey =\n inputPath in inputOverrides ? inputPath : path.resolve(inputPath);\n\n const importer = componentsByKey.get(importerKey);\n if (!importer) continue;\n\n const { imports } = inputs[inputPath];\n const componentImports = imports.filter((imp) =>\n imp.path.includes(\".config.\"),\n );\n\n for (const imp of componentImports) {\n const imported = componentsByKey.get(path.resolve(imp.path));\n if (!imported) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Didn't find ${path.resolve(imp.path)} in ${[...componentsByKey.keys()].toString()}`,\n });\n }\n\n // Grab the import specifier from the metafile (e.g. `@convex-dev/workpool/convex.config`) so\n // we can use it to import component APIs\n if (imp.original) {\n const importSpecifier = imp.original;\n const relativeSpecifier = importSpecifier.replace(\n /\\/convex\\.config.*$/,\n \"\",\n );\n\n imported.importSpecifier = relativeSpecifier;\n }\n\n dependencyGraph.push([importer, imported]);\n }\n }\n\n const components = new Map<string, ComponentDirectory>();\n for (const directory of componentsByKey.values()) {\n components.set(directory.path, directory);\n }\n\n return { components, dependencyGraph };\n}\n\n// NB: If a directory linked to is not a member of the passed\n// componentDirectories array then there will be external links\n// with no corresponding definition bundle.\n// That could be made to throw an error but maybe those are already available\n// on the Convex definition filesystem somehow, e.g. builtin components.\n/** Bundle the component definitions listed. */\nexport async function bundleDefinitions(\n ctx: Context,\n absWorkingDir: string,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n rootComponentDirectory: ComponentDirectory,\n componentDirectories: ComponentDirectory[],\n liveComponentSources: boolean,\n verbose: boolean = false,\n): Promise<{\n appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls;\n componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[];\n}> {\n let result;\n try {\n let plugins = [\n componentPlugin({\n ctx,\n mode: \"bundle\",\n verbose,\n rootComponentDirectory,\n }),\n ];\n if (\n rootComponentDirectory.syntheticComponentImport ||\n rootComponentDirectory.isRootWithoutConfig\n ) {\n // Use virtual config (either with a component import or empty)\n plugins.push(\n virtualConfig(\n rootComponentDirectory.syntheticComponentImport\n ? {\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }\n : { rootComponentDirectory },\n ),\n );\n }\n result = await esbuild.build({\n absWorkingDir,\n entryPoints: componentDirectories.map((dir) =>\n qualifiedDefinitionPath(dir),\n ),\n plugins,\n sourcemap: true,\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n const outputs: {\n outputJs: OutputFile;\n outputJsMap?: OutputFile;\n directory: ComponentDirectory;\n }[] = [];\n for (const directory of componentDirectories) {\n const absInput = path.resolve(absWorkingDir, directory.definitionPath);\n const expectedOutputJs =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js\";\n const expectedOutputMap =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js.map\";\n const outputJs = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputJs,\n )[0];\n if (!outputJs) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `no JS found matching ${expectedOutputJs} in ${result.outputFiles.map((x) => x.path).toString()}`,\n });\n }\n const outputJsMap = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputMap,\n )[0];\n outputs.push({\n outputJs,\n outputJsMap,\n directory,\n });\n }\n\n const appBundles = outputs.filter(\n (out) => out.directory.path === rootComponentDirectory.path,\n );\n if (appBundles.length !== 1) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"found wrong number of app bundles\",\n });\n }\n const appBundle = appBundles[0];\n const componentBundles = outputs.filter(\n (out) => out.directory.path !== rootComponentDirectory.path,\n );\n\n const componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[] =\n componentBundles.map(({ directory, outputJs, outputJsMap }) => ({\n definitionPath: toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n ),\n definition: {\n path: path.relative(directory.path, outputJs.path),\n source: outputJs.text,\n sourceMap: outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: getDeps(\n rootComponentDirectory,\n dependencyGraph,\n directory.definitionPath,\n ),\n }));\n const appDeps = getDeps(\n rootComponentDirectory,\n dependencyGraph,\n appBundle.directory.definitionPath,\n );\n const appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls = {\n definition: {\n path: path.relative(rootComponentDirectory.path, appBundle.outputJs.path),\n source: appBundle.outputJs.text,\n sourceMap: appBundle.outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: appDeps,\n };\n return {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n };\n}\n\nexport async function bundleImplementations({\n ctx,\n rootComponentDirectory,\n componentDirectories,\n nodeExternalPackages,\n extraConditions,\n verbose = false,\n includeSourcesContent = false,\n}: {\n ctx: Context;\n rootComponentDirectory: ComponentDirectory;\n componentDirectories: ComponentDirectory[];\n nodeExternalPackages: string[];\n extraConditions: string[];\n verbose: boolean;\n includeSourcesContent?: boolean;\n}): Promise<{\n appImplementation: {\n schema: Bundle | null;\n functions: Bundle[];\n externalNodeDependencies: NodeDependency[];\n };\n componentImplementations: {\n schema: Bundle | null;\n functions: Bundle[];\n definitionPath: ComponentDefinitionPath;\n }[];\n}> {\n let appImplementation;\n const componentImplementations = [];\n\n // For --component-dir flag, skip bundling root implementations (no real code to bundle)\n const directoriesToBundle = rootComponentDirectory.syntheticComponentImport\n ? componentDirectories\n : [rootComponentDirectory, ...componentDirectories];\n\n for (const directory of directoriesToBundle) {\n const isRoot = directory.path === rootComponentDirectory.path;\n const resolvedPath = path.resolve(\n rootComponentDirectory.path,\n directory.path,\n );\n let schema;\n if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.ts\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.js\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else {\n schema = null;\n }\n\n const entryPoints = await entryPointsByEnvironment(ctx, resolvedPath);\n const convexResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.isolate,\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n includeSourcesContent,\n });\n\n if (convexResult.externalDependencies.size !== 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"external dependencies not supported\",\n });\n }\n const functions = convexResult.modules;\n if (isRoot) {\n if (verbose) {\n showSpinner(\"Bundling modules for Node.js runtime...\");\n }\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n\n const externalNodeDependencies: NodeDependency[] = [];\n for (const [\n moduleName,\n moduleVersion,\n ] of nodeResult.externalDependencies) {\n externalNodeDependencies.push({\n name: moduleName,\n version: moduleVersion,\n });\n }\n const authBundle = await bundleAuthConfig(ctx, resolvedPath);\n appImplementation = {\n schema,\n functions: functions.concat(nodeResult.modules).concat(authBundle),\n externalNodeDependencies,\n };\n } else {\n // Reject push if components have node bundles in non-root directories.\n if (directory.path !== rootComponentDirectory.path) {\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n if (nodeResult.modules.length > 0) {\n // TODO(ENG-7116) Remove error and bundle the component node actions when we are ready to support them.\n await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not supported in components. Remove it from the component at: ${resolvedPath}.`,\n });\n }\n }\n // definitionPath is the canonical form\n const definitionPath = toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n );\n componentImplementations.push({ definitionPath, schema, functions });\n }\n }\n\n if (!appImplementation) {\n // For --component-dir flag, we don't bundle root implementations so provide an empty one\n if (rootComponentDirectory.syntheticComponentImport) {\n appImplementation = {\n schema: null,\n functions: [],\n externalNodeDependencies: [],\n };\n } else {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"No app implementation found\",\n });\n }\n }\n\n return { appImplementation, componentImplementations };\n}\n\nasync function registerEsbuildReads(\n ctx: Context,\n absWorkingDir: string,\n metafile: Metafile,\n) {\n for (const [relPath, input] of Object.entries(metafile.inputs)) {\n if (\n // We rewrite these files so this integrity check isn't useful.\n path.basename(relPath).includes(\"convex.config\") ||\n // TODO: esbuild outputs paths prefixed with \"(disabled)\" when bundling our internal\n // udf-system package. The files do actually exist locally, though.\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\")\n ) {\n continue;\n }\n const absPath = path.resolve(absWorkingDir, relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,gCAOO;AAEP,iBAIO;AACP,qBAAoE;AACpE,mBAA4B;AAK5B,qBAMO;AAGP,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAAA;AAAA;AAYhC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGW;AAET,MAAI,WAAW;AAEf,MAAI,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EE,YAAAA,QAAK,SAAS,OAAO,EAAE,SAAS,eAAe;AAAA;AAAA,MAG/C,QAAQ,QAAQ,aAAa,MAAM,MACnC,QAAQ,WAAW,cAAc,KACjC,QAAQ,WAAW,YAAY;AAAA,MAC/B;AACA;AAAA,IACF;AACA,UAAM,UAAU,YAAAA,QAAK,QAAQ,eAAe,OAAO;AACnD,UAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AAC9B,QAAI,GAAG,SAAS,MAAM,OAAO;AAG3B;AAAA,QACE,gBAAgB,OAAO;AAAA,MACzB;AACA,aAAO,MAAM,IAAI,MAAM;AAAA,QACrB,UAAU;AAAA,QACV,WAAW;AAAA,QACX,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AACA,QAAI,GAAG,aAAa,SAAS,EAAE;AAAA,EACjC;AACF;",
6
6
  "names": ["path", "esbuild"]
7
7
  }
@@ -86,6 +86,7 @@ https://docs.convex.dev/understanding/best-practices/other-recommendations#check
86
86
  {
87
87
  ...options,
88
88
  deploymentName: credentials.deploymentFields?.deploymentName ?? null,
89
+ ...credentials.deploymentFields?.deploymentType !== void 0 ? { deploymentType: credentials.deploymentFields.deploymentType } : {},
89
90
  url: credentials.url,
90
91
  adminKey: credentials.adminKey,
91
92
  generateCommonJSApi: options.commonjs,
@@ -214,7 +215,7 @@ async function startComponentsPushAndCodegen(ctx, parentSpan, projectConfig, con
214
215
  nodeExternalPackages: projectConfig.node.externalPackages,
215
216
  extraConditions: options.liveComponentSources ? ["@convex-dev/component-source"] : [],
216
217
  verbose: options.verbose,
217
- includeSourcesContent: projectConfig.bundler?.includeSourcesContent ?? true
218
+ includeSourcesContent: projectConfig.bundler?.includeSourcesContent ?? false
218
219
  })
219
220
  );
220
221
  if (options.debugBundlePath) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lib/components.ts"],
4
- "sourcesContent": ["import path from \"path\";\nimport { Context } from \"../../bundler/context.js\";\nimport {\n changeSpinner,\n logFinishedStep,\n logMessage,\n} from \"../../bundler/log.js\";\nimport {\n ProjectConfig,\n configFromProjectConfig,\n debugIsolateEndpointBundles,\n getFunctionsDirectoryPath,\n readProjectConfig,\n pullConfig,\n diffConfig,\n} from \"./config.js\";\nimport {\n finishPush,\n reportPushCompleted,\n startPush,\n waitForSchema,\n} from \"./deploy2.js\";\nimport { version } from \"../version.js\";\nimport { ensureHasConvexDependency, functionsDir } from \"./utils/utils.js\";\nimport {\n bundleDefinitions,\n bundleImplementations,\n componentGraph,\n} from \"./components/definition/bundle.js\";\nimport { isComponentDirectory } from \"./components/definition/directoryStructure.js\";\nimport {\n doFinalComponentCodegen,\n doInitialComponentCodegen,\n CodegenOptions,\n doInitConvexFolder,\n doCodegen,\n} from \"./codegen.js\";\nimport {\n AppDefinitionConfig,\n ComponentDefinitionConfig,\n} from \"./deployApi/definitionConfig.js\";\nimport { typeCheckFunctionsInMode, TypeCheckMode } from \"./typecheck.js\";\nimport { withTmpDir } from \"../../bundler/fs.js\";\nimport { handleDebugBundlePath } from \"./debugBundlePath.js\";\nimport { chalkStderr } from \"chalk\";\nimport { StartPushRequest, StartPushResponse } from \"./deployApi/startPush.js\";\nimport {\n deploymentSelectionWithinProjectFromOptions,\n loadSelectedDeploymentCredentials,\n} from \"./api.js\";\nimport { FinishPushDiff } from \"./deployApi/finishPush.js\";\nimport { Reporter, Span } from \"./tracing.js\";\nimport { DEFINITION_FILENAME_TS } from \"./components/constants.js\";\nimport { DeploymentSelection } from \"./deploymentSelection.js\";\nimport { deploymentDashboardUrlPage } from \"./dashboard.js\";\nimport { formatIndex, LargeIndexDeletionCheck } from \"./indexes.js\";\nimport { checkForLargeIndexDeletion } from \"./checkForLargeIndexDeletion.js\";\nimport { LogManager } from \"./logs.js\";\n\nexport type PushOptions = {\n adminKey: string;\n verbose: boolean;\n dryRun: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n debug: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n codegen: boolean;\n url: string;\n deploymentName: string | null;\n writePushRequest?: string | undefined;\n liveComponentSources: boolean;\n logManager?: LogManager | undefined;\n largeIndexDeletionCheck: LargeIndexDeletionCheck;\n};\n\nexport async function runCodegen(\n ctx: Context,\n deploymentSelection: DeploymentSelection,\n options: CodegenOptions,\n) {\n // This also ensures the current directory is the project root.\n await ensureHasConvexDependency(ctx, \"codegen\");\n\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n const functionsDirectoryPath = functionsDir(configPath, projectConfig);\n\n if (options.init) {\n await doInitConvexFolder(ctx, functionsDirectoryPath, {\n dryRun: options.dryRun,\n debug: options.debug,\n });\n }\n\n if (!options.systemUdfs) {\n // Early exit for a better error message trying to use a preview key.\n if (deploymentSelection.kind === \"preview\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Codegen requires an existing deployment so doesn't support CONVEX_DEPLOY_KEY.\\nGenerate code in dev and commit it to the repo instead.\\nhttps://docs.convex.dev/understanding/best-practices/other-recommendations#check-generated-code-into-version-control`,\n });\n }\n\n const selectionWithinProject =\n deploymentSelectionWithinProjectFromOptions(options);\n const credentials = await loadSelectedDeploymentCredentials(\n ctx,\n deploymentSelection,\n selectionWithinProject,\n );\n\n await startComponentsPushAndCodegen(\n ctx,\n Span.noop(),\n projectConfig,\n configPath,\n {\n ...options,\n deploymentName: credentials.deploymentFields?.deploymentName ?? null,\n url: credentials.url,\n adminKey: credentials.adminKey,\n generateCommonJSApi: options.commonjs,\n verbose: !!process.env.CONVEX_VERBOSE,\n codegen: true,\n liveComponentSources: options.liveComponentSources,\n typecheckComponents: false,\n debugNodeApis: options.debugNodeApis,\n },\n );\n } else {\n if (options.typecheck !== \"disable\") {\n logMessage(chalkStderr.gray(\"Running TypeScript typecheck\u2026\"));\n }\n\n await doCodegen(ctx, functionsDirectoryPath, options.typecheck, {\n dryRun: options.dryRun,\n debug: options.debug,\n generateCommonJSApi: options.commonjs,\n });\n }\n}\n\nexport async function runPush(ctx: Context, options: PushOptions) {\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n await runComponentsPush(ctx, options, configPath, projectConfig);\n}\n\nasync function startComponentsPushAndCodegen(\n ctx: Context,\n parentSpan: Span,\n projectConfig: ProjectConfig,\n configPath: string,\n options: {\n typecheck: TypeCheckMode;\n typecheckComponents: boolean;\n adminKey: string;\n url: string;\n deploymentName: string | null;\n verbose: boolean;\n debugBundlePath?: string | undefined;\n dryRun: boolean;\n generateCommonJSApi?: boolean;\n debug: boolean;\n writePushRequest?: string | undefined;\n codegen: boolean;\n liveComponentSources?: boolean;\n debugNodeApis: boolean;\n largeIndexDeletionCheck: LargeIndexDeletionCheck;\n codegenOnlyThisComponent?: string | undefined;\n },\n): Promise<StartPushResponse | null> {\n const convexDir = await getFunctionsDirectoryPath(ctx);\n\n // '.' means use the process current working directory, it's the default behavior.\n // Spelling it out here to be explicit for a future where this code can run\n // from other directories.\n // In esbuild the working directory is used to print error messages and resolving\n // relatives paths passed to it. It generally doesn't matter for resolving imports,\n // imports are resolved from the file where they are written.\n const absWorkingDir = path.resolve(\".\");\n const isComponent = isComponentDirectory(ctx, convexDir, true);\n if (isComponent.kind === \"err\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Invalid component root directory (${isComponent.why}): ${convexDir}`,\n });\n }\n\n let rootComponent = isComponent.component;\n if (options.codegenOnlyThisComponent) {\n const absolutePath = path.resolve(options.codegenOnlyThisComponent);\n let componentConfigPath: string;\n\n // Must be a directory containing a convex.config.ts\n componentConfigPath = path.join(absolutePath, DEFINITION_FILENAME_TS);\n if (!ctx.fs.exists(componentConfigPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Only directories with convex.config.ts files are supported, this directory does not: ${absolutePath}`,\n });\n }\n\n const syntheticConfigPath = path.join(\n rootComponent.path,\n DEFINITION_FILENAME_TS,\n );\n rootComponent = {\n isRoot: true,\n path: rootComponent.path,\n definitionPath: syntheticConfigPath,\n isRootWithoutConfig: false,\n syntheticComponentImport: componentConfigPath,\n };\n }\n\n changeSpinner(\"Finding component definitions...\");\n // Create a list of relevant component directories. These are just for knowing\n // while directories to bundle in bundleDefinitions and bundleImplementations.\n // This produces a bundle in memory as a side effect but it's thrown away.\n const { components, dependencyGraph } = await parentSpan.enterAsync(\n \"componentGraph\",\n () =>\n componentGraph(\n ctx,\n absWorkingDir,\n rootComponent,\n !!options.liveComponentSources,\n options.verbose,\n ),\n );\n\n // Initial codegen is everything we need to get code runnable:\n // root components and other components need a basic _generated/api.ts etc.\n // just to make the code bundleable and runnable so we can analyze.\n if (options.codegen) {\n changeSpinner(\"Generating server code...\");\n await parentSpan.enterAsync(\"doInitialComponentCodegen\", () =>\n withTmpDir(async (tmpDir) => {\n // Skip the root in component cases\n if (!rootComponent.syntheticComponentImport) {\n // Do root first so if a component fails, we'll at least have a working root.\n await doInitialComponentCodegen(ctx, tmpDir, rootComponent, options);\n }\n for (const directory of components.values()) {\n if (directory.isRoot) {\n continue;\n }\n // When --component-dir is used, only generate code for the target component\n if (\n rootComponent.syntheticComponentImport &&\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await doInitialComponentCodegen(ctx, tmpDir, directory, options);\n }\n }),\n );\n }\n\n changeSpinner(\"Bundling component definitions...\");\n // This bundles everything but the actual function definitions\n const {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n } = await parentSpan.enterAsync(\"bundleDefinitions\", () =>\n bundleDefinitions(\n ctx,\n absWorkingDir,\n dependencyGraph,\n rootComponent,\n // Note that this *includes* the root component.\n [...components.values()],\n !!options.liveComponentSources,\n options.verbose,\n ),\n );\n\n if (options.debugNodeApis) {\n await debugIsolateEndpointBundles(ctx, projectConfig, configPath);\n logFinishedStep(\n \"All non-'use node' entry points successfully bundled. Skipping rest of push.\",\n );\n return null;\n }\n\n changeSpinner(\"Bundling component schemas and implementations...\");\n const { appImplementation, componentImplementations } =\n await parentSpan.enterAsync(\"bundleImplementations\", () =>\n bundleImplementations({\n ctx,\n rootComponentDirectory: rootComponent,\n // When running codegen for a specific component, don't bundle the root.\n componentDirectories: [...components.values()].filter(\n (dir) => !dir.isRoot && !dir.syntheticComponentImport,\n ),\n nodeExternalPackages: projectConfig.node.externalPackages,\n extraConditions: options.liveComponentSources\n ? [\"@convex-dev/component-source\"]\n : [],\n verbose: options.verbose,\n includeSourcesContent:\n projectConfig.bundler?.includeSourcesContent ?? true,\n }),\n );\n if (options.debugBundlePath) {\n const { config: localConfig } = await configFromProjectConfig(\n ctx,\n projectConfig,\n configPath,\n options.verbose,\n );\n // TODO(ENG-6972): Actually write the bundles for components.\n await handleDebugBundlePath(ctx, options.debugBundlePath, localConfig);\n logMessage(\n `Wrote bundle and metadata for modules in the root to ${options.debugBundlePath}. Skipping rest of push.`,\n );\n return null;\n }\n\n // We're just using the version this CLI is running with for now.\n // This could be different than the version of `convex` the app runs with\n // if the CLI is installed globally.\n // TODO: This should be the version of the `convex` package used by each\n // component, and may be different for each component.\n const udfServerVersion = version;\n\n const appDefinition: AppDefinitionConfig = {\n ...appDefinitionSpecWithoutImpls,\n ...appImplementation,\n udfServerVersion,\n };\n\n const componentDefinitions: ComponentDefinitionConfig[] = [];\n for (const componentDefinition of componentDefinitionSpecsWithoutImpls) {\n const impl = componentImplementations.filter(\n (impl) => impl.definitionPath === componentDefinition.definitionPath,\n )[0];\n if (!impl) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `missing! couldn't find ${componentDefinition.definitionPath} in ${componentImplementations.map((impl) => impl.definitionPath).toString()}`,\n });\n }\n componentDefinitions.push({\n ...componentDefinition,\n ...impl,\n udfServerVersion,\n });\n }\n const startPushRequest = {\n adminKey: options.adminKey,\n dryRun: options.dryRun,\n functions: projectConfig.functions,\n appDefinition,\n componentDefinitions,\n nodeDependencies: appImplementation.externalNodeDependencies,\n nodeVersion: projectConfig.node.nodeVersion,\n };\n if (options.writePushRequest) {\n const pushRequestPath = path.resolve(options.writePushRequest);\n ctx.fs.writeUtf8File(\n `${pushRequestPath}.json`,\n JSON.stringify(startPushRequest),\n );\n return null;\n }\n logStartPushSizes(parentSpan, startPushRequest);\n\n if (options.largeIndexDeletionCheck !== \"no verification\") {\n await parentSpan.enterAsync(\"checkForLargeIndexDeletion\", (span) =>\n checkForLargeIndexDeletion({\n ctx,\n span,\n request: startPushRequest,\n options,\n askForConfirmation:\n options.largeIndexDeletionCheck === \"ask for confirmation\",\n }),\n );\n }\n\n changeSpinner(\"Uploading functions to Convex...\");\n const startPushResponse = await parentSpan.enterAsync(\"startPush\", (span) =>\n startPush(ctx, span, startPushRequest, options),\n );\n\n if (options.verbose) {\n logMessage(\"startPush: \" + JSON.stringify(startPushResponse, null, 2));\n }\n\n if (options.codegen) {\n changeSpinner(\"Generating TypeScript bindings...\");\n await parentSpan.enterAsync(\"doFinalComponentCodegen\", () =>\n withTmpDir(async (tmpDir) => {\n // TODO generating code for the root component last might be better DX\n // When running codegen for a specific component, don't generate types for the root\n if (!rootComponent.syntheticComponentImport) {\n // Do the root first\n await doFinalComponentCodegen(\n ctx,\n tmpDir,\n rootComponent,\n rootComponent,\n startPushResponse,\n components,\n options,\n );\n }\n for (const directory of components.values()) {\n if (directory.isRoot) {\n continue;\n }\n // When --component-dir is used, only generate code for the target component\n if (\n rootComponent.syntheticComponentImport &&\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await doFinalComponentCodegen(\n ctx,\n tmpDir,\n rootComponent,\n directory,\n startPushResponse,\n components,\n options,\n );\n }\n }),\n );\n }\n\n changeSpinner(\"Running TypeScript...\");\n await parentSpan.enterAsync(\"typeCheckFunctionsInMode\", async () => {\n // When running codegen for a specific component, don't typecheck the root\n if (!rootComponent.syntheticComponentImport) {\n await typeCheckFunctionsInMode(\n ctx,\n options.typecheck,\n rootComponent.path,\n );\n }\n if (options.typecheckComponents) {\n for (const directory of components.values()) {\n if (!directory.isRoot) {\n await typeCheckFunctionsInMode(\n ctx,\n options.typecheck,\n directory.path,\n );\n }\n }\n } else if (rootComponent.syntheticComponentImport) {\n // When running codegen for a specific component, only typecheck that component.\n for (const directory of components.values()) {\n if (\n directory.isRoot ||\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await typeCheckFunctionsInMode(ctx, options.typecheck, directory.path);\n }\n }\n });\n\n return startPushResponse;\n}\n\nfunction logStartPushSizes(span: Span, startPushRequest: StartPushRequest) {\n let v8Size = 0;\n let v8Count = 0;\n let nodeSize = 0;\n let nodeCount = 0;\n\n for (const componentDefinition of startPushRequest.componentDefinitions) {\n for (const module of componentDefinition.functions) {\n if (module.environment === \"isolate\") {\n v8Size += module.source.length + (module.sourceMap ?? \"\").length;\n v8Count += 1;\n } else if (module.environment === \"node\") {\n nodeSize += module.source.length + (module.sourceMap ?? \"\").length;\n nodeCount += 1;\n }\n }\n }\n span.setProperty(\"v8_size\", v8Size.toString());\n span.setProperty(\"v8_count\", v8Count.toString());\n span.setProperty(\"node_size\", nodeSize.toString());\n span.setProperty(\"node_count\", nodeCount.toString());\n}\n\nexport async function runComponentsPush(\n ctx: Context,\n options: PushOptions,\n configPath: string,\n projectConfig: ProjectConfig,\n) {\n const reporter = new Reporter();\n const pushSpan = Span.root(reporter, \"runComponentsPush\");\n pushSpan.setProperty(\"cli_version\", version);\n const verbose = options.verbose || options.dryRun;\n\n await ensureHasConvexDependency(ctx, \"push\");\n\n const startPushResponse = await pushSpan.enterAsync(\n \"startComponentsPushAndCodegen\",\n (span) =>\n startComponentsPushAndCodegen(\n ctx,\n span,\n projectConfig,\n configPath,\n options,\n ),\n );\n if (!startPushResponse) {\n return;\n }\n\n await pushSpan.enterAsync(\"waitForSchema\", (span) =>\n waitForSchema(ctx, span, startPushResponse, options),\n );\n\n if (verbose) {\n const remoteConfigWithModuleHashes = await pullConfig(\n ctx,\n undefined,\n undefined,\n options.url,\n options.adminKey,\n );\n\n const { config: localConfig } = await configFromProjectConfig(\n ctx,\n projectConfig,\n configPath,\n options.verbose,\n );\n\n changeSpinner(\"Diffing local code and deployment state...\");\n const { diffString } = diffConfig(\n remoteConfigWithModuleHashes,\n localConfig,\n );\n\n logFinishedStep(\n `Remote config ${\n options.dryRun ? \"would\" : \"will\"\n } be overwritten with the following changes:\\n ` +\n diffString.replace(/\\n/g, \"\\n \"),\n );\n }\n\n const finishPushResponse = await pushSpan.enterAsync(\"finishPush\", (span) =>\n finishPush(ctx, span, startPushResponse, options),\n );\n printDiff(startPushResponse, finishPushResponse, options);\n pushSpan.end();\n\n // Asynchronously report that the push completed.\n if (!options.dryRun) {\n void reportPushCompleted(ctx, options.adminKey, options.url, reporter);\n }\n}\n\nfunction printDiff(\n startPushResponse: StartPushResponse,\n finishPushResponse: FinishPushDiff,\n opts: { verbose: boolean; dryRun: boolean; deploymentName: string | null },\n) {\n if (opts.verbose) {\n const diffString = JSON.stringify(finishPushResponse, null, 2);\n logMessage(diffString);\n return;\n }\n const indexDiffs = startPushResponse.schemaChange.indexDiffs;\n const { componentDiffs } = finishPushResponse;\n\n // Print out index diffs for the root component.\n let rootDiff = indexDiffs?.[\"\"] || componentDiffs[\"\"]?.indexDiff;\n if (rootDiff) {\n if (rootDiff.removed_indexes.length > 0) {\n let msg = `${opts.dryRun ? \"Would delete\" : \"Deleted\"} table indexes:\\n`;\n for (const index of rootDiff.removed_indexes) {\n msg += ` [-] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n const addedEnabled = rootDiff.added_indexes.filter((i) => !i.staged);\n if (addedEnabled.length > 0) {\n let msg = `${opts.dryRun ? \"Would add\" : \"Added\"} table indexes:\\n`;\n for (const index of addedEnabled) {\n msg += ` [+] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n const addedStaged = rootDiff.added_indexes.filter((i) => i.staged);\n if (addedStaged.length > 0) {\n let msg = `${opts.dryRun ? \"Would add\" : \"Added\"} staged table indexes:\\n`;\n for (const index of addedStaged) {\n const table = index.name.split(\".\")[0];\n const progressLink = deploymentDashboardUrlPage(\n opts.deploymentName,\n `/data?table=${table}&showIndexes=true`,\n );\n msg += ` [+] ${formatIndex(index)}\\n`;\n msg += ` See progress: ${progressLink}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n if (rootDiff.enabled_indexes && rootDiff.enabled_indexes.length > 0) {\n let msg = opts.dryRun\n ? `These indexes would be enabled:\\n`\n : `These indexes are now enabled:\\n`;\n for (const index of rootDiff.enabled_indexes) {\n msg += ` [*] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n if (rootDiff.disabled_indexes && rootDiff.disabled_indexes.length > 0) {\n let msg = opts.dryRun\n ? `These indexes would be staged:\\n`\n : `These indexes are now staged:\\n`;\n for (const index of rootDiff.disabled_indexes) {\n msg += ` [*] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n }\n\n // Only show component level diffs for other components.\n for (const [componentPath, componentDiff] of Object.entries(componentDiffs)) {\n if (componentPath === \"\") {\n continue;\n }\n if (componentDiff.diffType.type === \"create\") {\n logFinishedStep(`Installed component ${componentPath}.`);\n }\n if (componentDiff.diffType.type === \"unmount\") {\n logFinishedStep(`Unmounted component ${componentPath}.`);\n }\n if (componentDiff.diffType.type === \"remount\") {\n logFinishedStep(`Remounted component ${componentPath}.`);\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAIO;AACP,oBAQO;AACP,qBAKO;AACP,qBAAwB;AACxB,mBAAwD;AACxD,oBAIO;AACP,gCAAqC;AACrC,qBAMO;AAKP,uBAAwD;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AACrB,sCAAgB,GAAG;AAAA,IACrB;AAEA,QAAI,SAAS,mBAAmB,SAAS,gBAAgB,SAAS,GAAG;AACnE,UAAI,MAAM,KAAK,SACX;AAAA,IACA;AAAA;AACJ,iBAAW,SAAS,SAAS,iBAAiB;AAC5C,eAAO,aAAS,4BAAY,KAAK,CAAC;AAAA;AAAA,MACpC;AACA,YAAM,IAAI,MAAM,GAAG,EAAE;AACrB,sCAAgB,GAAG;AAAA,IACrB;AAEA,QAAI,SAAS,oBAAoB,SAAS,iBAAiB,SAAS,GAAG;AACrE,UAAI,MAAM,KAAK,SACX;AAAA,IACA;AAAA;AACJ,iBAAW,SAAS,SAAS,kBAAkB;AAC7C,eAAO,aAAS,4BAAY,KAAK,CAAC;AAAA;AAAA,MACpC;AACA,YAAM,IAAI,MAAM,GAAG,EAAE;AACrB,sCAAgB,GAAG;AAAA,IACrB;AAAA,EACF;AAGA,aAAW,CAAC,eAAe,aAAa,KAAK,OAAO,QAAQ,cAAc,GAAG;AAC3E,QAAI,kBAAkB,IAAI;AACxB;AAAA,IACF;AACA,QAAI,cAAc,SAAS,SAAS,UAAU;AAC5C,sCAAgB,uBAAuB,aAAa,GAAG;AAAA,IACzD;AACA,QAAI,cAAc,SAAS,SAAS,WAAW;AAC7C,sCAAgB,uBAAuB,aAAa,GAAG;AAAA,IACzD;AACA,QAAI,cAAc,SAAS,SAAS,WAAW;AAC7C,sCAAgB,uBAAuB,aAAa,GAAG;AAAA,IACzD;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import path from \"path\";\nimport { Context } from \"../../bundler/context.js\";\nimport {\n changeSpinner,\n logFinishedStep,\n logMessage,\n} from \"../../bundler/log.js\";\nimport {\n ProjectConfig,\n configFromProjectConfig,\n debugIsolateEndpointBundles,\n getFunctionsDirectoryPath,\n readProjectConfig,\n pullConfig,\n diffConfig,\n} from \"./config.js\";\nimport {\n finishPush,\n reportPushCompleted,\n startPush,\n waitForSchema,\n} from \"./deploy2.js\";\nimport { version } from \"../version.js\";\nimport { ensureHasConvexDependency, functionsDir } from \"./utils/utils.js\";\nimport {\n bundleDefinitions,\n bundleImplementations,\n componentGraph,\n} from \"./components/definition/bundle.js\";\nimport { isComponentDirectory } from \"./components/definition/directoryStructure.js\";\nimport {\n doFinalComponentCodegen,\n doInitialComponentCodegen,\n CodegenOptions,\n doInitConvexFolder,\n doCodegen,\n} from \"./codegen.js\";\nimport {\n AppDefinitionConfig,\n ComponentDefinitionConfig,\n} from \"./deployApi/definitionConfig.js\";\nimport { typeCheckFunctionsInMode, TypeCheckMode } from \"./typecheck.js\";\nimport { withTmpDir } from \"../../bundler/fs.js\";\nimport { handleDebugBundlePath } from \"./debugBundlePath.js\";\nimport { chalkStderr } from \"chalk\";\nimport { StartPushRequest, StartPushResponse } from \"./deployApi/startPush.js\";\nimport {\n deploymentSelectionWithinProjectFromOptions,\n loadSelectedDeploymentCredentials,\n} from \"./api.js\";\nimport { FinishPushDiff } from \"./deployApi/finishPush.js\";\nimport { Reporter, Span } from \"./tracing.js\";\nimport { DEFINITION_FILENAME_TS } from \"./components/constants.js\";\nimport { DeploymentSelection } from \"./deploymentSelection.js\";\nimport { DeploymentType } from \"./api.js\";\nimport { deploymentDashboardUrlPage } from \"./dashboard.js\";\nimport { formatIndex, LargeIndexDeletionCheck } from \"./indexes.js\";\nimport { checkForLargeIndexDeletion } from \"./checkForLargeIndexDeletion.js\";\nimport { LogManager } from \"./logs.js\";\n\nexport type PushOptions = {\n adminKey: string;\n verbose: boolean;\n dryRun: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n debug: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n codegen: boolean;\n url: string;\n deploymentName: string | null;\n deploymentType?: DeploymentType;\n writePushRequest?: string | undefined;\n liveComponentSources: boolean;\n logManager?: LogManager | undefined;\n largeIndexDeletionCheck: LargeIndexDeletionCheck;\n};\n\nexport async function runCodegen(\n ctx: Context,\n deploymentSelection: DeploymentSelection,\n options: CodegenOptions,\n) {\n // This also ensures the current directory is the project root.\n await ensureHasConvexDependency(ctx, \"codegen\");\n\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n const functionsDirectoryPath = functionsDir(configPath, projectConfig);\n\n if (options.init) {\n await doInitConvexFolder(ctx, functionsDirectoryPath, {\n dryRun: options.dryRun,\n debug: options.debug,\n });\n }\n\n if (!options.systemUdfs) {\n // Early exit for a better error message trying to use a preview key.\n if (deploymentSelection.kind === \"preview\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Codegen requires an existing deployment so doesn't support CONVEX_DEPLOY_KEY.\\nGenerate code in dev and commit it to the repo instead.\\nhttps://docs.convex.dev/understanding/best-practices/other-recommendations#check-generated-code-into-version-control`,\n });\n }\n\n const selectionWithinProject =\n deploymentSelectionWithinProjectFromOptions(options);\n const credentials = await loadSelectedDeploymentCredentials(\n ctx,\n deploymentSelection,\n selectionWithinProject,\n );\n\n await startComponentsPushAndCodegen(\n ctx,\n Span.noop(),\n projectConfig,\n configPath,\n {\n ...options,\n deploymentName: credentials.deploymentFields?.deploymentName ?? null,\n ...(credentials.deploymentFields?.deploymentType !== undefined\n ? { deploymentType: credentials.deploymentFields.deploymentType }\n : {}),\n url: credentials.url,\n adminKey: credentials.adminKey,\n generateCommonJSApi: options.commonjs,\n verbose: !!process.env.CONVEX_VERBOSE,\n codegen: true,\n liveComponentSources: options.liveComponentSources,\n typecheckComponents: false,\n debugNodeApis: options.debugNodeApis,\n },\n );\n } else {\n if (options.typecheck !== \"disable\") {\n logMessage(chalkStderr.gray(\"Running TypeScript typecheck\u2026\"));\n }\n\n await doCodegen(ctx, functionsDirectoryPath, options.typecheck, {\n dryRun: options.dryRun,\n debug: options.debug,\n generateCommonJSApi: options.commonjs,\n });\n }\n}\n\nexport async function runPush(ctx: Context, options: PushOptions) {\n const { configPath, projectConfig } = await readProjectConfig(ctx);\n await runComponentsPush(ctx, options, configPath, projectConfig);\n}\n\nasync function startComponentsPushAndCodegen(\n ctx: Context,\n parentSpan: Span,\n projectConfig: ProjectConfig,\n configPath: string,\n options: {\n typecheck: TypeCheckMode;\n typecheckComponents: boolean;\n adminKey: string;\n url: string;\n deploymentName: string | null;\n deploymentType?: DeploymentType;\n verbose: boolean;\n debugBundlePath?: string | undefined;\n dryRun: boolean;\n generateCommonJSApi?: boolean;\n debug: boolean;\n writePushRequest?: string | undefined;\n codegen: boolean;\n liveComponentSources?: boolean;\n debugNodeApis: boolean;\n largeIndexDeletionCheck: LargeIndexDeletionCheck;\n codegenOnlyThisComponent?: string | undefined;\n },\n): Promise<StartPushResponse | null> {\n const convexDir = await getFunctionsDirectoryPath(ctx);\n\n // '.' means use the process current working directory, it's the default behavior.\n // Spelling it out here to be explicit for a future where this code can run\n // from other directories.\n // In esbuild the working directory is used to print error messages and resolving\n // relatives paths passed to it. It generally doesn't matter for resolving imports,\n // imports are resolved from the file where they are written.\n const absWorkingDir = path.resolve(\".\");\n const isComponent = isComponentDirectory(ctx, convexDir, true);\n if (isComponent.kind === \"err\") {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Invalid component root directory (${isComponent.why}): ${convexDir}`,\n });\n }\n\n let rootComponent = isComponent.component;\n if (options.codegenOnlyThisComponent) {\n const absolutePath = path.resolve(options.codegenOnlyThisComponent);\n let componentConfigPath: string;\n\n // Must be a directory containing a convex.config.ts\n componentConfigPath = path.join(absolutePath, DEFINITION_FILENAME_TS);\n if (!ctx.fs.exists(componentConfigPath)) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Only directories with convex.config.ts files are supported, this directory does not: ${absolutePath}`,\n });\n }\n\n const syntheticConfigPath = path.join(\n rootComponent.path,\n DEFINITION_FILENAME_TS,\n );\n rootComponent = {\n isRoot: true,\n path: rootComponent.path,\n definitionPath: syntheticConfigPath,\n isRootWithoutConfig: false,\n syntheticComponentImport: componentConfigPath,\n };\n }\n\n changeSpinner(\"Finding component definitions...\");\n // Create a list of relevant component directories. These are just for knowing\n // while directories to bundle in bundleDefinitions and bundleImplementations.\n // This produces a bundle in memory as a side effect but it's thrown away.\n const { components, dependencyGraph } = await parentSpan.enterAsync(\n \"componentGraph\",\n () =>\n componentGraph(\n ctx,\n absWorkingDir,\n rootComponent,\n !!options.liveComponentSources,\n options.verbose,\n ),\n );\n\n // Initial codegen is everything we need to get code runnable:\n // root components and other components need a basic _generated/api.ts etc.\n // just to make the code bundleable and runnable so we can analyze.\n if (options.codegen) {\n changeSpinner(\"Generating server code...\");\n await parentSpan.enterAsync(\"doInitialComponentCodegen\", () =>\n withTmpDir(async (tmpDir) => {\n // Skip the root in component cases\n if (!rootComponent.syntheticComponentImport) {\n // Do root first so if a component fails, we'll at least have a working root.\n await doInitialComponentCodegen(ctx, tmpDir, rootComponent, options);\n }\n for (const directory of components.values()) {\n if (directory.isRoot) {\n continue;\n }\n // When --component-dir is used, only generate code for the target component\n if (\n rootComponent.syntheticComponentImport &&\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await doInitialComponentCodegen(ctx, tmpDir, directory, options);\n }\n }),\n );\n }\n\n changeSpinner(\"Bundling component definitions...\");\n // This bundles everything but the actual function definitions\n const {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n } = await parentSpan.enterAsync(\"bundleDefinitions\", () =>\n bundleDefinitions(\n ctx,\n absWorkingDir,\n dependencyGraph,\n rootComponent,\n // Note that this *includes* the root component.\n [...components.values()],\n !!options.liveComponentSources,\n options.verbose,\n ),\n );\n\n if (options.debugNodeApis) {\n await debugIsolateEndpointBundles(ctx, projectConfig, configPath);\n logFinishedStep(\n \"All non-'use node' entry points successfully bundled. Skipping rest of push.\",\n );\n return null;\n }\n\n changeSpinner(\"Bundling component schemas and implementations...\");\n const { appImplementation, componentImplementations } =\n await parentSpan.enterAsync(\"bundleImplementations\", () =>\n bundleImplementations({\n ctx,\n rootComponentDirectory: rootComponent,\n // When running codegen for a specific component, don't bundle the root.\n componentDirectories: [...components.values()].filter(\n (dir) => !dir.isRoot && !dir.syntheticComponentImport,\n ),\n nodeExternalPackages: projectConfig.node.externalPackages,\n extraConditions: options.liveComponentSources\n ? [\"@convex-dev/component-source\"]\n : [],\n verbose: options.verbose,\n includeSourcesContent:\n projectConfig.bundler?.includeSourcesContent ?? false,\n }),\n );\n if (options.debugBundlePath) {\n const { config: localConfig } = await configFromProjectConfig(\n ctx,\n projectConfig,\n configPath,\n options.verbose,\n );\n // TODO(ENG-6972): Actually write the bundles for components.\n await handleDebugBundlePath(ctx, options.debugBundlePath, localConfig);\n logMessage(\n `Wrote bundle and metadata for modules in the root to ${options.debugBundlePath}. Skipping rest of push.`,\n );\n return null;\n }\n\n // We're just using the version this CLI is running with for now.\n // This could be different than the version of `convex` the app runs with\n // if the CLI is installed globally.\n // TODO: This should be the version of the `convex` package used by each\n // component, and may be different for each component.\n const udfServerVersion = version;\n\n const appDefinition: AppDefinitionConfig = {\n ...appDefinitionSpecWithoutImpls,\n ...appImplementation,\n udfServerVersion,\n };\n\n const componentDefinitions: ComponentDefinitionConfig[] = [];\n for (const componentDefinition of componentDefinitionSpecsWithoutImpls) {\n const impl = componentImplementations.filter(\n (impl) => impl.definitionPath === componentDefinition.definitionPath,\n )[0];\n if (!impl) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `missing! couldn't find ${componentDefinition.definitionPath} in ${componentImplementations.map((impl) => impl.definitionPath).toString()}`,\n });\n }\n componentDefinitions.push({\n ...componentDefinition,\n ...impl,\n udfServerVersion,\n });\n }\n const startPushRequest = {\n adminKey: options.adminKey,\n dryRun: options.dryRun,\n functions: projectConfig.functions,\n appDefinition,\n componentDefinitions,\n nodeDependencies: appImplementation.externalNodeDependencies,\n nodeVersion: projectConfig.node.nodeVersion,\n };\n if (options.writePushRequest) {\n const pushRequestPath = path.resolve(options.writePushRequest);\n ctx.fs.writeUtf8File(\n `${pushRequestPath}.json`,\n JSON.stringify(startPushRequest),\n );\n return null;\n }\n logStartPushSizes(parentSpan, startPushRequest);\n\n if (options.largeIndexDeletionCheck !== \"no verification\") {\n await parentSpan.enterAsync(\"checkForLargeIndexDeletion\", (span) =>\n checkForLargeIndexDeletion({\n ctx,\n span,\n request: startPushRequest,\n options,\n askForConfirmation:\n options.largeIndexDeletionCheck === \"ask for confirmation\",\n }),\n );\n }\n\n changeSpinner(\"Uploading functions to Convex...\");\n const startPushResponse = await parentSpan.enterAsync(\"startPush\", (span) =>\n startPush(ctx, span, startPushRequest, options),\n );\n\n if (options.verbose) {\n logMessage(\"startPush: \" + JSON.stringify(startPushResponse, null, 2));\n }\n\n if (options.codegen) {\n changeSpinner(\"Generating TypeScript bindings...\");\n await parentSpan.enterAsync(\"doFinalComponentCodegen\", () =>\n withTmpDir(async (tmpDir) => {\n // TODO generating code for the root component last might be better DX\n // When running codegen for a specific component, don't generate types for the root\n if (!rootComponent.syntheticComponentImport) {\n // Do the root first\n await doFinalComponentCodegen(\n ctx,\n tmpDir,\n rootComponent,\n rootComponent,\n startPushResponse,\n components,\n options,\n );\n }\n for (const directory of components.values()) {\n if (directory.isRoot) {\n continue;\n }\n // When --component-dir is used, only generate code for the target component\n if (\n rootComponent.syntheticComponentImport &&\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await doFinalComponentCodegen(\n ctx,\n tmpDir,\n rootComponent,\n directory,\n startPushResponse,\n components,\n options,\n );\n }\n }),\n );\n }\n\n changeSpinner(\"Running TypeScript...\");\n await parentSpan.enterAsync(\"typeCheckFunctionsInMode\", async () => {\n // When running codegen for a specific component, don't typecheck the root\n if (!rootComponent.syntheticComponentImport) {\n await typeCheckFunctionsInMode(\n ctx,\n options.typecheck,\n rootComponent.path,\n );\n }\n if (options.typecheckComponents) {\n for (const directory of components.values()) {\n if (!directory.isRoot) {\n await typeCheckFunctionsInMode(\n ctx,\n options.typecheck,\n directory.path,\n );\n }\n }\n } else if (rootComponent.syntheticComponentImport) {\n // When running codegen for a specific component, only typecheck that component.\n for (const directory of components.values()) {\n if (\n directory.isRoot ||\n directory.definitionPath !== rootComponent.syntheticComponentImport\n ) {\n continue;\n }\n await typeCheckFunctionsInMode(ctx, options.typecheck, directory.path);\n }\n }\n });\n\n return startPushResponse;\n}\n\nfunction logStartPushSizes(span: Span, startPushRequest: StartPushRequest) {\n let v8Size = 0;\n let v8Count = 0;\n let nodeSize = 0;\n let nodeCount = 0;\n\n for (const componentDefinition of startPushRequest.componentDefinitions) {\n for (const module of componentDefinition.functions) {\n if (module.environment === \"isolate\") {\n v8Size += module.source.length + (module.sourceMap ?? \"\").length;\n v8Count += 1;\n } else if (module.environment === \"node\") {\n nodeSize += module.source.length + (module.sourceMap ?? \"\").length;\n nodeCount += 1;\n }\n }\n }\n span.setProperty(\"v8_size\", v8Size.toString());\n span.setProperty(\"v8_count\", v8Count.toString());\n span.setProperty(\"node_size\", nodeSize.toString());\n span.setProperty(\"node_count\", nodeCount.toString());\n}\n\nexport async function runComponentsPush(\n ctx: Context,\n options: PushOptions,\n configPath: string,\n projectConfig: ProjectConfig,\n) {\n const reporter = new Reporter();\n const pushSpan = Span.root(reporter, \"runComponentsPush\");\n pushSpan.setProperty(\"cli_version\", version);\n const verbose = options.verbose || options.dryRun;\n\n await ensureHasConvexDependency(ctx, \"push\");\n\n const startPushResponse = await pushSpan.enterAsync(\n \"startComponentsPushAndCodegen\",\n (span) =>\n startComponentsPushAndCodegen(\n ctx,\n span,\n projectConfig,\n configPath,\n options,\n ),\n );\n if (!startPushResponse) {\n return;\n }\n\n await pushSpan.enterAsync(\"waitForSchema\", (span) =>\n waitForSchema(ctx, span, startPushResponse, options),\n );\n\n if (verbose) {\n const remoteConfigWithModuleHashes = await pullConfig(\n ctx,\n undefined,\n undefined,\n options.url,\n options.adminKey,\n );\n\n const { config: localConfig } = await configFromProjectConfig(\n ctx,\n projectConfig,\n configPath,\n options.verbose,\n );\n\n changeSpinner(\"Diffing local code and deployment state...\");\n const { diffString } = diffConfig(\n remoteConfigWithModuleHashes,\n localConfig,\n );\n\n logFinishedStep(\n `Remote config ${\n options.dryRun ? \"would\" : \"will\"\n } be overwritten with the following changes:\\n ` +\n diffString.replace(/\\n/g, \"\\n \"),\n );\n }\n\n const finishPushResponse = await pushSpan.enterAsync(\"finishPush\", (span) =>\n finishPush(ctx, span, startPushResponse, options),\n );\n printDiff(startPushResponse, finishPushResponse, options);\n pushSpan.end();\n\n // Asynchronously report that the push completed.\n if (!options.dryRun) {\n void reportPushCompleted(ctx, options.adminKey, options.url, reporter);\n }\n}\n\nfunction printDiff(\n startPushResponse: StartPushResponse,\n finishPushResponse: FinishPushDiff,\n opts: { verbose: boolean; dryRun: boolean; deploymentName: string | null },\n) {\n if (opts.verbose) {\n const diffString = JSON.stringify(finishPushResponse, null, 2);\n logMessage(diffString);\n return;\n }\n const indexDiffs = startPushResponse.schemaChange.indexDiffs;\n const { componentDiffs } = finishPushResponse;\n\n // Print out index diffs for the root component.\n let rootDiff = indexDiffs?.[\"\"] || componentDiffs[\"\"]?.indexDiff;\n if (rootDiff) {\n if (rootDiff.removed_indexes.length > 0) {\n let msg = `${opts.dryRun ? \"Would delete\" : \"Deleted\"} table indexes:\\n`;\n for (const index of rootDiff.removed_indexes) {\n msg += ` [-] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n const addedEnabled = rootDiff.added_indexes.filter((i) => !i.staged);\n if (addedEnabled.length > 0) {\n let msg = `${opts.dryRun ? \"Would add\" : \"Added\"} table indexes:\\n`;\n for (const index of addedEnabled) {\n msg += ` [+] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n const addedStaged = rootDiff.added_indexes.filter((i) => i.staged);\n if (addedStaged.length > 0) {\n let msg = `${opts.dryRun ? \"Would add\" : \"Added\"} staged table indexes:\\n`;\n for (const index of addedStaged) {\n const table = index.name.split(\".\")[0];\n const progressLink = deploymentDashboardUrlPage(\n opts.deploymentName,\n `/data?table=${table}&showIndexes=true`,\n );\n msg += ` [+] ${formatIndex(index)}\\n`;\n msg += ` See progress: ${progressLink}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n if (rootDiff.enabled_indexes && rootDiff.enabled_indexes.length > 0) {\n let msg = opts.dryRun\n ? `These indexes would be enabled:\\n`\n : `These indexes are now enabled:\\n`;\n for (const index of rootDiff.enabled_indexes) {\n msg += ` [*] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n\n if (rootDiff.disabled_indexes && rootDiff.disabled_indexes.length > 0) {\n let msg = opts.dryRun\n ? `These indexes would be staged:\\n`\n : `These indexes are now staged:\\n`;\n for (const index of rootDiff.disabled_indexes) {\n msg += ` [*] ${formatIndex(index)}\\n`;\n }\n msg = msg.slice(0, -1); // strip last new line\n logFinishedStep(msg);\n }\n }\n\n // Only show component level diffs for other components.\n for (const [componentPath, componentDiff] of Object.entries(componentDiffs)) {\n if (componentPath === \"\") {\n continue;\n }\n if (componentDiff.diffType.type === \"create\") {\n logFinishedStep(`Installed component ${componentPath}.`);\n }\n if (componentDiff.diffType.type === \"unmount\") {\n logFinishedStep(`Unmounted component ${componentPath}.`);\n }\n if (componentDiff.diffType.type === \"remount\") {\n logFinishedStep(`Remounted component ${componentPath}.`);\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAIO;AACP,oBAQO;AACP,qBAKO;AACP,qBAAwB;AACxB,mBAAwD;AACxD,oBAIO;AACP,gCAAqC;AACrC,qBAMO;AAKP,uBAAwD;AACxD,gBAA2B;AAC3B,6BAAsC;AACtC,mBAA4B;AAE5B,iBAGO;AAEP,qBAA+B;AAC/B,uBAAuC;AAGvC,uBA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