wrangler 0.0.0-aca9c3e7 → 0.0.0-ace48698

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 (143) hide show
  1. package/README.md +20 -2
  2. package/bin/wrangler.js +1 -1
  3. package/miniflare-dist/index.mjs +1286 -330
  4. package/package.json +23 -9
  5. package/src/__tests__/api-dev.test.ts +209 -0
  6. package/src/__tests__/api-devregistry.test.js +56 -0
  7. package/src/__tests__/api.test.ts +80 -0
  8. package/src/__tests__/configuration.test.ts +240 -382
  9. package/src/__tests__/dev.test.tsx +86 -26
  10. package/src/__tests__/dialogs.test.tsx +40 -0
  11. package/src/__tests__/generate.test.ts +235 -0
  12. package/src/__tests__/helpers/mock-cfetch.ts +86 -16
  13. package/src/__tests__/helpers/mock-console.ts +11 -2
  14. package/src/__tests__/helpers/mock-get-zone-from-host.ts +8 -0
  15. package/src/__tests__/helpers/mock-known-routes.ts +7 -0
  16. package/src/__tests__/helpers/mock-oauth-flow.ts +4 -2
  17. package/src/__tests__/helpers/msw/handlers/namespaces.ts +104 -0
  18. package/src/__tests__/helpers/msw/handlers/oauth.ts +36 -0
  19. package/src/__tests__/helpers/msw/handlers/r2.ts +80 -0
  20. package/src/__tests__/helpers/msw/handlers/user.ts +63 -0
  21. package/src/__tests__/helpers/msw/index.ts +14 -0
  22. package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +1 -0
  23. package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +5 -0
  24. package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +1 -0
  25. package/src/__tests__/helpers/worker-scripts/parent-worker.js +8 -0
  26. package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +5 -0
  27. package/src/__tests__/index.test.ts +41 -55
  28. package/src/__tests__/init.test.ts +1186 -362
  29. package/src/__tests__/jest.setup.ts +65 -0
  30. package/src/__tests__/metrics.test.ts +6 -1
  31. package/src/__tests__/middleware.scheduled.test.ts +135 -0
  32. package/src/__tests__/middleware.test.ts +726 -0
  33. package/src/__tests__/pages.test.ts +951 -101
  34. package/src/__tests__/paths.test.ts +39 -0
  35. package/src/__tests__/publish.test.ts +739 -443
  36. package/src/__tests__/r2.test.ts +236 -182
  37. package/src/__tests__/secret.test.ts +152 -0
  38. package/src/__tests__/tail.test.ts +172 -95
  39. package/src/__tests__/test-old-node-version.js +3 -3
  40. package/src/__tests__/user.test.ts +15 -4
  41. package/src/__tests__/whoami.test.tsx +80 -101
  42. package/src/__tests__/worker-namespace.test.ts +142 -148
  43. package/src/api/dev.ts +155 -34
  44. package/src/api/index.ts +1 -0
  45. package/src/bundle.ts +367 -14
  46. package/src/cfetch/internal.ts +102 -20
  47. package/src/cli.ts +3 -1
  48. package/src/config/config.ts +13 -1
  49. package/src/config/environment.ts +51 -1
  50. package/src/config/index.ts +63 -8
  51. package/src/config/validation-helpers.ts +19 -6
  52. package/src/config/validation.ts +131 -6
  53. package/src/config-cache.ts +3 -2
  54. package/src/create-worker-preview.ts +21 -3
  55. package/src/create-worker-upload-form.ts +59 -21
  56. package/src/d1/backups.tsx +212 -0
  57. package/src/d1/create.tsx +54 -0
  58. package/src/d1/delete.tsx +56 -0
  59. package/src/d1/execute.tsx +294 -0
  60. package/src/d1/formatTimeAgo.ts +14 -0
  61. package/src/d1/index.ts +75 -0
  62. package/src/d1/list.tsx +48 -0
  63. package/src/d1/options.ts +12 -0
  64. package/src/d1/types.tsx +14 -0
  65. package/src/d1/utils.ts +39 -0
  66. package/src/dev/dev.tsx +72 -23
  67. package/src/dev/get-local-persistence-path.tsx +31 -0
  68. package/src/dev/local.tsx +458 -157
  69. package/src/dev/remote.tsx +298 -112
  70. package/src/dev/start-server.ts +506 -0
  71. package/src/dev/use-esbuild.ts +31 -1
  72. package/src/dev-registry.tsx +33 -0
  73. package/src/dev.tsx +465 -200
  74. package/src/dialogs.tsx +23 -0
  75. package/src/{worker-namespace.ts → dispatch-namespace.ts} +18 -18
  76. package/src/entry.ts +2 -1
  77. package/src/environment-variables.ts +17 -2
  78. package/src/generate.ts +273 -14
  79. package/src/git-client.ts +85 -3
  80. package/src/index.tsx +245 -52
  81. package/src/init.ts +563 -142
  82. package/src/inspect.ts +116 -31
  83. package/src/{metrics/is-ci.ts → is-ci.ts} +0 -0
  84. package/src/logger.ts +11 -4
  85. package/src/metrics/index.ts +1 -0
  86. package/src/metrics/metrics-config.ts +1 -1
  87. package/src/metrics/metrics-dispatcher.ts +1 -0
  88. package/src/metrics/metrics-usage-headers.ts +24 -0
  89. package/src/metrics/send-event.ts +8 -7
  90. package/src/miniflare-cli/assets.ts +137 -465
  91. package/src/miniflare-cli/index.ts +141 -18
  92. package/src/module-collection.ts +12 -3
  93. package/src/pages/build.tsx +75 -41
  94. package/src/pages/constants.ts +9 -0
  95. package/src/pages/deployments.tsx +10 -10
  96. package/src/pages/dev.tsx +365 -87
  97. package/src/pages/errors.ts +66 -0
  98. package/src/pages/functions/buildPlugin.ts +6 -1
  99. package/src/pages/functions/buildWorker.ts +6 -1
  100. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  101. package/src/pages/functions/routes-consolidation.ts +73 -0
  102. package/src/pages/functions/routes-transformation.test.ts +282 -0
  103. package/src/pages/functions/routes-transformation.ts +115 -0
  104. package/src/pages/functions/routes-validation.test.ts +403 -0
  105. package/src/pages/functions/routes-validation.ts +202 -0
  106. package/src/pages/functions.tsx +82 -0
  107. package/src/pages/hash.tsx +13 -0
  108. package/src/pages/index.tsx +65 -55
  109. package/src/pages/projects.tsx +9 -3
  110. package/src/pages/publish.tsx +140 -42
  111. package/src/pages/types.ts +9 -0
  112. package/src/pages/upload.tsx +41 -39
  113. package/src/paths.ts +49 -4
  114. package/src/proxy.ts +336 -155
  115. package/src/publish.ts +92 -15
  116. package/src/r2.ts +17 -4
  117. package/src/tail/filters.ts +4 -6
  118. package/src/tail/index.ts +21 -5
  119. package/src/tail/printing.ts +43 -3
  120. package/src/user/user.tsx +7 -4
  121. package/src/whoami.tsx +5 -5
  122. package/src/worker.ts +52 -9
  123. package/src/zones.ts +91 -0
  124. package/templates/d1-beta-facade.js +174 -0
  125. package/templates/experimental-local-cache-stubs.js +27 -0
  126. package/templates/first-party-worker-module-facade.ts +18 -0
  127. package/templates/init-tests/test-jest-new-worker.js +25 -0
  128. package/templates/init-tests/test-vitest-new-worker.js +26 -0
  129. package/templates/middleware/common.ts +62 -0
  130. package/templates/middleware/loader-modules.ts +84 -0
  131. package/templates/middleware/loader-sw.ts +213 -0
  132. package/templates/middleware/middleware-pretty-error.ts +40 -0
  133. package/templates/middleware/middleware-scheduled.ts +15 -0
  134. package/templates/new-worker.js +1 -1
  135. package/templates/pages-dev-pipeline.ts +35 -0
  136. package/templates/pages-template-plugin.ts +16 -4
  137. package/templates/pages-template-worker.ts +16 -5
  138. package/templates/service-bindings-module-facade.js +15 -10
  139. package/templates/service-bindings-sw-facade.js +10 -7
  140. package/wrangler-dist/cli.d.ts +527 -12
  141. package/wrangler-dist/cli.js +95010 -78901
  142. package/src/faye-websocket.d.ts +0 -6
  143. package/src/miniflare-cli/enum-keys.ts +0 -17
package/README.md CHANGED
@@ -39,11 +39,25 @@ npm run deploy
39
39
  $ npm install wrangler --save-dev
40
40
  ```
41
41
 
42
+ ## Configuration:
43
+
44
+ Wrangler is configured via a `wrangler.toml` file in the project root. When utilizing the `wrangler init` command, a `wrangler.toml` file will be created for you.
45
+
46
+ example:
47
+
48
+ ```toml
49
+ main = "./src/index.ts" # init w/ TypeScript
50
+ name = "my-worker"
51
+ compatibility_date = "YYY-MM-DD"
52
+ ```
53
+
54
+ for more detailed information about configuration, see the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration)
55
+
42
56
  ## Commands
43
57
 
44
58
  ### `wrangler init [name]`
45
59
 
46
- Creates a Worker project. For details on configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration).
60
+ Creates a Worker project. For details on configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/#init).
47
61
 
48
62
  ### `wrangler dev`
49
63
 
@@ -67,4 +81,8 @@ For more commands and options, refer to the [documentation](https://developers.c
67
81
 
68
82
  ## Documentation
69
83
 
70
- For the latest Wrangler documentation, [click here](https://6b05b6e1.cloudflare-docs-7ou.pages.dev/workers/wrangler/).
84
+ For the latest Wrangler documentation, [click here](https://developers.cloudflare.com/workers/wrangler/).
85
+
86
+ ```
87
+
88
+ ```
package/bin/wrangler.js CHANGED
@@ -4,7 +4,7 @@ const path = require("path");
4
4
  const fs = require("fs");
5
5
  const os = require("os");
6
6
 
7
- const MIN_NODE_VERSION = "16.7.0";
7
+ const MIN_NODE_VERSION = "16.13.0";
8
8
  const debug =
9
9
  process.env["WRANGLER_LOG"] === "debug"
10
10
  ? (...args) => console.log(...args)