wrangler 0.0.0-d873c41 → 0.0.0-d8fe95d2

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 (122) hide show
  1. package/README.md +20 -2
  2. package/bin/wrangler.js +2 -2
  3. package/miniflare-dist/index.mjs +1273 -313
  4. package/package.json +18 -10
  5. package/src/__tests__/api-dev.test.ts +189 -0
  6. package/src/__tests__/api.test.ts +80 -0
  7. package/src/__tests__/configuration.test.ts +122 -46
  8. package/src/__tests__/dev.test.tsx +132 -15
  9. package/src/__tests__/dialogs.test.tsx +40 -0
  10. package/src/__tests__/generate.test.ts +91 -0
  11. package/src/__tests__/helpers/hello-world-worker.js +5 -0
  12. package/src/__tests__/helpers/mock-cfetch.ts +112 -7
  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/msw/handlers/index.ts +13 -0
  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 +4 -0
  22. package/src/__tests__/index.test.ts +49 -64
  23. package/src/__tests__/init.test.ts +1015 -362
  24. package/src/__tests__/jest.setup.ts +67 -1
  25. package/src/__tests__/kv.test.ts +2 -2
  26. package/src/__tests__/metrics.test.ts +6 -1
  27. package/src/__tests__/middleware.scheduled.test.ts +135 -0
  28. package/src/__tests__/middleware.test.ts +726 -0
  29. package/src/__tests__/pages.test.ts +840 -101
  30. package/src/__tests__/paths.test.ts +17 -0
  31. package/src/__tests__/publish.test.ts +1016 -654
  32. package/src/__tests__/r2.test.ts +265 -127
  33. package/src/__tests__/secret.test.ts +152 -0
  34. package/src/__tests__/tail.test.ts +172 -95
  35. package/src/__tests__/test-old-node-version.js +3 -3
  36. package/src/__tests__/user.test.ts +12 -0
  37. package/src/__tests__/validate-dev-props.test.ts +56 -0
  38. package/src/__tests__/version.test.ts +35 -0
  39. package/src/__tests__/whoami.test.tsx +109 -65
  40. package/src/__tests__/worker-namespace.test.ts +37 -35
  41. package/src/api/dev.ts +149 -30
  42. package/src/api/index.ts +1 -0
  43. package/src/bundle.ts +505 -43
  44. package/src/cfetch/internal.ts +152 -3
  45. package/src/cli.ts +3 -1
  46. package/src/config/config.ts +15 -3
  47. package/src/config/environment.ts +41 -9
  48. package/src/config/index.ts +17 -4
  49. package/src/config/validation-helpers.ts +19 -6
  50. package/src/config/validation.ts +122 -14
  51. package/src/config-cache.ts +2 -1
  52. package/src/create-worker-preview.ts +24 -4
  53. package/src/create-worker-upload-form.ts +49 -21
  54. package/src/dev/dev.tsx +128 -31
  55. package/src/dev/local.tsx +375 -160
  56. package/src/dev/remote.tsx +55 -16
  57. package/src/dev/start-server.ts +409 -0
  58. package/src/dev/use-esbuild.ts +36 -0
  59. package/src/dev/validate-dev-props.ts +31 -0
  60. package/src/dev-registry.tsx +160 -0
  61. package/src/dev.tsx +483 -236
  62. package/src/dialogs.tsx +19 -0
  63. package/src/{worker-namespace.ts → dispatch-namespace.ts} +18 -18
  64. package/src/entry.ts +2 -1
  65. package/src/generate.ts +112 -14
  66. package/src/index.tsx +408 -19
  67. package/src/init.ts +556 -140
  68. package/src/inspect.ts +90 -5
  69. package/src/{metrics/is-ci.ts → is-ci.ts} +0 -0
  70. package/src/metrics/index.ts +1 -0
  71. package/src/metrics/metrics-config.ts +1 -1
  72. package/src/metrics/metrics-dispatcher.ts +1 -0
  73. package/src/metrics/metrics-usage-headers.ts +24 -0
  74. package/src/metrics/send-event.ts +8 -7
  75. package/src/miniflare-cli/assets.ts +130 -465
  76. package/src/miniflare-cli/index.ts +131 -3
  77. package/src/module-collection.ts +3 -3
  78. package/src/pages/build.tsx +75 -41
  79. package/src/pages/constants.ts +8 -0
  80. package/src/pages/deployments.tsx +10 -10
  81. package/src/pages/dev.tsx +223 -67
  82. package/src/pages/errors.ts +22 -0
  83. package/src/pages/functions/buildPlugin.ts +6 -1
  84. package/src/pages/functions/buildWorker.ts +6 -1
  85. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  86. package/src/pages/functions/routes-consolidation.ts +73 -0
  87. package/src/pages/functions/routes-transformation.test.ts +282 -0
  88. package/src/pages/functions/routes-transformation.ts +128 -0
  89. package/src/pages/functions.tsx +96 -0
  90. package/src/pages/hash.tsx +13 -0
  91. package/src/pages/index.tsx +65 -55
  92. package/src/pages/projects.tsx +9 -3
  93. package/src/pages/publish.tsx +120 -23
  94. package/src/pages/types.ts +9 -0
  95. package/src/pages/upload.tsx +41 -39
  96. package/src/paths.ts +20 -1
  97. package/src/proxy.ts +10 -0
  98. package/src/publish.ts +183 -120
  99. package/src/r2.ts +85 -4
  100. package/src/tail/filters.ts +4 -6
  101. package/src/tail/index.ts +21 -5
  102. package/src/tail/printing.ts +43 -3
  103. package/src/user/user.tsx +26 -6
  104. package/src/whoami.tsx +80 -2
  105. package/src/worker.ts +22 -9
  106. package/src/zones.ts +91 -0
  107. package/templates/first-party-worker-module-facade.ts +18 -0
  108. package/templates/format-dev-errors.ts +32 -0
  109. package/templates/init-tests/test-jest-new-worker.js +25 -0
  110. package/templates/init-tests/test-vitest-new-worker.js +26 -0
  111. package/templates/middleware/common.ts +62 -0
  112. package/templates/middleware/loader-modules.ts +84 -0
  113. package/templates/middleware/loader-sw.ts +213 -0
  114. package/templates/middleware/middleware-pretty-error.ts +40 -0
  115. package/templates/middleware/middleware-scheduled.ts +15 -0
  116. package/templates/pages-template-plugin.ts +16 -4
  117. package/templates/pages-template-worker.ts +16 -5
  118. package/templates/{static-asset-facade.js → serve-static-assets.ts} +21 -7
  119. package/templates/service-bindings-module-facade.js +54 -0
  120. package/templates/service-bindings-sw-facade.js +42 -0
  121. package/wrangler-dist/cli.d.ts +91 -9
  122. package/wrangler-dist/cli.js +119953 -88321
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)
@@ -35,7 +35,7 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
35
35
  // - maybe we can generate a certificate that concatenates with ours?
36
36
  //
37
37
  // I do think it'll be rare that someone wants to add a cert AND
38
- // use cloudflare WARP, but let's wait till the situation actually
38
+ // use Cloudflare WARP, but let's wait till the situation actually
39
39
  // arises before we do anything about it
40
40
  } else {
41
41
  const osTempDir = os.tmpdir();