wrangler 0.0.0-e33bea9b → 0.0.0-e351afcf

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 (105) hide show
  1. package/miniflare-dist/index.mjs +167 -93
  2. package/package.json +14 -9
  3. package/src/__tests__/api-devregistry.test.ts +121 -0
  4. package/src/__tests__/api.test.ts +27 -5
  5. package/src/__tests__/configuration.test.ts +59 -12
  6. package/src/__tests__/constellation.test.ts +371 -0
  7. package/src/__tests__/d1/execute.test.ts +2 -0
  8. package/src/__tests__/d1/migrate.test.ts +102 -0
  9. package/src/__tests__/delete.test.ts +6 -0
  10. package/src/__tests__/deployments.test.ts +335 -95
  11. package/src/__tests__/dev.test.tsx +71 -56
  12. package/src/__tests__/generate.test.ts +3 -4
  13. package/src/__tests__/helpers/mock-console.ts +6 -0
  14. package/src/__tests__/helpers/msw/handlers/deployments.ts +70 -3
  15. package/src/__tests__/helpers/msw/index.ts +4 -2
  16. package/src/__tests__/helpers/worker-scripts/parent-worker.js +4 -1
  17. package/src/__tests__/index.test.ts +14 -6
  18. package/src/__tests__/init.test.ts +127 -96
  19. package/src/__tests__/jest.setup.ts +4 -0
  20. package/src/__tests__/kv.test.ts +9 -9
  21. package/src/__tests__/logger.test.ts +68 -2
  22. package/src/__tests__/middleware.scheduled.test.ts +2 -2
  23. package/src/__tests__/middleware.test.ts +2 -2
  24. package/src/__tests__/mtls-certificates.test.ts +7 -3
  25. package/src/__tests__/pages/deployment-list.test.ts +2 -0
  26. package/src/__tests__/pages/functions-build.test.ts +70 -0
  27. package/src/__tests__/pages/project-list.test.ts +2 -0
  28. package/src/__tests__/pages/project-upload.test.ts +43 -24
  29. package/src/__tests__/pages/publish.test.ts +136 -92
  30. package/src/__tests__/publish.test.ts +878 -332
  31. package/src/__tests__/pubsub.test.ts +3 -0
  32. package/src/__tests__/queues.test.ts +5 -2
  33. package/src/__tests__/traverse-module-graph.test.ts +220 -0
  34. package/src/__tests__/tsconfig.tsbuildinfo +1 -1
  35. package/src/__tests__/user.test.ts +1 -1
  36. package/src/__tests__/worker-namespace.test.ts +1 -0
  37. package/src/api/dev.ts +12 -18
  38. package/src/api/pages/create-worker-bundle-contents.ts +1 -0
  39. package/src/api/pages/publish.tsx +28 -12
  40. package/src/bundle.ts +26 -9
  41. package/src/config/environment.ts +27 -0
  42. package/src/config/index.ts +18 -0
  43. package/src/config/validation.ts +91 -1
  44. package/src/constellation/createProject.tsx +51 -0
  45. package/src/constellation/deleteProject.ts +51 -0
  46. package/src/constellation/deleteProjectModel.ts +68 -0
  47. package/src/constellation/index.ts +75 -0
  48. package/src/constellation/listCatalog.tsx +35 -0
  49. package/src/constellation/listModel.tsx +41 -0
  50. package/src/constellation/listProject.tsx +28 -0
  51. package/src/constellation/listRuntime.tsx +28 -0
  52. package/src/constellation/options.ts +17 -0
  53. package/src/constellation/types.ts +17 -0
  54. package/src/constellation/uploadModel.tsx +64 -0
  55. package/src/constellation/utils.ts +90 -0
  56. package/src/create-worker-upload-form.ts +18 -1
  57. package/src/d1/backups.tsx +19 -15
  58. package/src/d1/create.tsx +45 -39
  59. package/src/d1/delete.ts +1 -1
  60. package/src/d1/execute.tsx +23 -20
  61. package/src/d1/list.tsx +14 -12
  62. package/src/d1/migrations/apply.tsx +36 -30
  63. package/src/d1/migrations/create.tsx +15 -12
  64. package/src/d1/migrations/helpers.ts +5 -8
  65. package/src/d1/migrations/list.tsx +10 -7
  66. package/src/deployments.ts +260 -8
  67. package/src/dev/dev.tsx +2 -0
  68. package/src/dev/local.tsx +48 -20
  69. package/src/dev/start-server.ts +49 -46
  70. package/src/dev/use-esbuild.ts +52 -49
  71. package/src/dev-registry.ts +2 -1
  72. package/src/dev.tsx +11 -5
  73. package/src/docs/helpers.ts +50 -0
  74. package/src/docs/index.ts +25 -68
  75. package/src/entry.ts +19 -8
  76. package/src/environment-variables/factory.ts +2 -1
  77. package/src/generate/index.ts +2 -2
  78. package/src/index.ts +86 -23
  79. package/src/init.ts +144 -135
  80. package/src/kv/helpers.ts +7 -4
  81. package/src/logger.ts +23 -4
  82. package/src/metrics/send-event.ts +2 -1
  83. package/src/miniflare-cli/index.ts +2 -2
  84. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
  85. package/src/module-collection.ts +92 -26
  86. package/src/pages/build.ts +29 -17
  87. package/src/pages/deployments.tsx +3 -5
  88. package/src/pages/dev.ts +24 -6
  89. package/src/pages/functions/buildPlugin.ts +1 -0
  90. package/src/pages/functions/buildWorker.ts +59 -8
  91. package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
  92. package/src/pages/projects.tsx +2 -5
  93. package/src/pages/upload.tsx +24 -4
  94. package/src/publish/publish.ts +10 -26
  95. package/src/queues/cli/commands/consumer/add.ts +6 -0
  96. package/src/queues/client.ts +1 -0
  97. package/src/secret/index.ts +1 -0
  98. package/src/sites.ts +164 -52
  99. package/src/traverse-module-graph.ts +53 -0
  100. package/src/user/user.ts +1 -0
  101. package/src/utils/render.ts +93 -0
  102. package/src/worker.ts +10 -0
  103. package/wrangler-dist/cli.d.ts +29 -2
  104. package/wrangler-dist/cli.js +23270 -22110
  105. package/src/__tests__/api-devregistry.test.js +0 -64
package/src/worker.ts CHANGED
@@ -79,6 +79,15 @@ export interface CfKvNamespace {
79
79
  id: string;
80
80
  }
81
81
 
82
+ /**
83
+ * A binding to send email.
84
+ */
85
+ export interface CfSendEmailBindings {
86
+ name: string;
87
+ destination_address?: string;
88
+ allowed_destination_addresses?: string[];
89
+ }
90
+
82
91
  /**
83
92
  * A binding to a wasm module (in service-worker format)
84
93
  */
@@ -216,6 +225,7 @@ export interface CfWorkerInit {
216
225
  bindings: {
217
226
  vars: CfVars | undefined;
218
227
  kv_namespaces: CfKvNamespace[] | undefined;
228
+ send_email: CfSendEmailBindings[] | undefined;
219
229
  wasm_modules: CfWasmModuleBindings | undefined;
220
230
  text_blobs: CfTextBlobBindings | undefined;
221
231
  data_blobs: CfDataBlobBindings | undefined;
@@ -532,6 +532,11 @@ declare interface EnvironmentInheritable {
532
532
  * The entrypoint/path to the JavaScript file that will be executed.
533
533
  */
534
534
  main: string | undefined;
535
+ /**
536
+ * The directory in which module rules should be evaluated in a `--no-bundle` worker
537
+ * This defaults to dirname(main) when left undefined
538
+ */
539
+ base_dir: string | undefined;
535
540
  /**
536
541
  * Whether we use <name>.<subdomain>.workers.dev to
537
542
  * test and deploy your worker.
@@ -770,6 +775,23 @@ declare interface EnvironmentNonInheritable {
770
775
  /** The ID of the KV namespace used during `wrangler dev` */
771
776
  preview_id?: string;
772
777
  }[];
778
+ /**
779
+ * These specify bindings to send email from inside your Worker.
780
+ *
781
+ * NOTE: This field is not automatically inherited from the top level environment,
782
+ * and so must be specified in every named environment.
783
+ *
784
+ * @default `[]`
785
+ * @nonInheritable
786
+ */
787
+ send_email: {
788
+ /** The binding name used to refer to the this binding */
789
+ name: string;
790
+ /** If this binding should be restricted to a specific verified address */
791
+ destination_address?: string;
792
+ /** If this binding should be restricted to a set of verified addresses */
793
+ allowed_destination_addresses?: string[];
794
+ }[];
773
795
  /**
774
796
  * Specifies Queues that are bound to this Worker environment.
775
797
  *
@@ -799,6 +821,8 @@ declare interface EnvironmentNonInheritable {
799
821
  max_retries?: number;
800
822
  /** The queue to send messages that failed to be consumed. */
801
823
  dead_letter_queue?: string;
824
+ /** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
825
+ max_concurrency?: number | null;
802
826
  }[];
803
827
  };
804
828
  /**
@@ -1282,7 +1306,7 @@ declare interface PagesPublishOptions {
1282
1306
  functionsDirectory?: string;
1283
1307
  /**
1284
1308
  * Whether to run bundling on `_worker.js` before deploying.
1285
- * Default: false
1309
+ * Default: true
1286
1310
  */
1287
1311
  bundle?: boolean;
1288
1312
  }
@@ -1296,6 +1320,7 @@ declare function publish({ directory, accountId, projectName, branch, skipCachin
1296
1320
  environment: "production" | "preview";
1297
1321
  id: string;
1298
1322
  url: string;
1323
+ project_id: string;
1299
1324
  project_name: string;
1300
1325
  build_config: {
1301
1326
  build_command: string;
@@ -1307,7 +1332,6 @@ declare function publish({ directory, accountId, projectName, branch, skipCachin
1307
1332
  };
1308
1333
  created_on: string;
1309
1334
  production_branch: string;
1310
- project_id: string;
1311
1335
  deployment_trigger: {
1312
1336
  type: string;
1313
1337
  metadata: {
@@ -1564,6 +1588,9 @@ export declare interface UnstableDevOptions {
1564
1588
  bucket_name: string;
1565
1589
  preview_bucket_name?: string;
1566
1590
  }[];
1591
+ processEntrypoint?: boolean;
1592
+ moduleRoot?: string;
1593
+ rules?: Rule[];
1567
1594
  logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
1568
1595
  inspect?: boolean;
1569
1596
  local?: boolean;