wrangler 0.0.0-eab9542 → 0.0.0-ebc1aa57

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 (72) hide show
  1. package/bin/wrangler.js +37 -6
  2. package/miniflare-dist/index.mjs +464 -4
  3. package/package.json +77 -64
  4. package/src/__tests__/configuration.test.ts +74 -14
  5. package/src/__tests__/dev.test.tsx +139 -4
  6. package/src/__tests__/helpers/mock-cfetch.ts +54 -2
  7. package/src/__tests__/helpers/run-in-tmp.ts +22 -23
  8. package/src/__tests__/https-options.test.ts +51 -18
  9. package/src/__tests__/index.test.ts +23 -22
  10. package/src/__tests__/jest.setup.ts +20 -1
  11. package/src/__tests__/kv.test.ts +115 -63
  12. package/src/__tests__/metrics.test.ts +445 -0
  13. package/src/__tests__/pages.test.ts +15 -8
  14. package/src/__tests__/publish.test.ts +498 -273
  15. package/src/__tests__/r2.test.ts +155 -71
  16. package/src/__tests__/secret.test.ts +84 -78
  17. package/src/__tests__/tail.test.ts +8 -0
  18. package/src/__tests__/test-old-node-version.js +31 -0
  19. package/src/__tests__/user.test.ts +7 -7
  20. package/src/__tests__/version.test.ts +35 -0
  21. package/src/__tests__/whoami.test.tsx +11 -1
  22. package/src/api/dev.ts +43 -9
  23. package/src/bundle.ts +229 -38
  24. package/src/cfetch/internal.ts +34 -2
  25. package/src/cli.ts +1 -1
  26. package/src/config/config.ts +22 -2
  27. package/src/config/environment.ts +10 -8
  28. package/src/config/validation.ts +68 -8
  29. package/src/config-cache.ts +2 -1
  30. package/src/create-worker-preview.ts +3 -1
  31. package/src/dev/dev.tsx +155 -21
  32. package/src/dev/local.tsx +56 -23
  33. package/src/dev/remote.tsx +35 -13
  34. package/src/dev/use-esbuild.ts +17 -0
  35. package/src/dev-registry.tsx +157 -0
  36. package/src/dev.tsx +90 -29
  37. package/src/entry.ts +1 -1
  38. package/src/{__tests__/helpers/faye-websocket.d.ts → faye-websocket.d.ts} +0 -0
  39. package/src/global-wrangler-config-path.ts +26 -0
  40. package/src/https-options.ts +8 -4
  41. package/src/index.tsx +332 -26
  42. package/src/kv.ts +23 -1
  43. package/src/metrics/index.ts +4 -0
  44. package/src/metrics/is-ci.ts +14 -0
  45. package/src/metrics/metrics-config.ts +239 -0
  46. package/src/metrics/metrics-dispatcher.ts +95 -0
  47. package/src/metrics/send-event.ts +92 -0
  48. package/src/miniflare-cli/assets.ts +543 -0
  49. package/src/miniflare-cli/index.ts +36 -4
  50. package/src/package-manager.ts +45 -0
  51. package/src/pages/build.tsx +2 -0
  52. package/src/pages/deployments.tsx +6 -1
  53. package/src/pages/dev.tsx +82 -637
  54. package/src/pages/projects.tsx +7 -1
  55. package/src/pages/publish.tsx +3 -0
  56. package/src/pages/upload.tsx +26 -14
  57. package/src/publish.ts +154 -120
  58. package/src/pubsub/pubsub-commands.tsx +46 -0
  59. package/src/r2.ts +68 -0
  60. package/src/user/choose-account.tsx +20 -11
  61. package/src/user/user.tsx +31 -21
  62. package/src/whoami.tsx +2 -1
  63. package/src/worker-namespace.ts +16 -0
  64. package/templates/format-dev-errors.ts +32 -0
  65. package/templates/pages-shim.ts +9 -0
  66. package/templates/serve-static-assets.ts +63 -0
  67. package/templates/service-bindings-module-facade.js +49 -0
  68. package/templates/service-bindings-sw-facade.js +39 -0
  69. package/templates/tsconfig.json +2 -2
  70. package/wrangler-dist/cli.d.ts +327 -0
  71. package/wrangler-dist/cli.js +39568 -22348
  72. package/templates/static-asset-facade.js +0 -43
package/bin/wrangler.js CHANGED
@@ -3,7 +3,6 @@ const { spawn } = require("child_process");
3
3
  const path = require("path");
4
4
  const fs = require("fs");
5
5
  const os = require("os");
6
- const semiver = require("semiver");
7
6
 
8
7
  const MIN_NODE_VERSION = "16.7.0";
9
8
  const debug =
@@ -21,8 +20,8 @@ function runWrangler() {
21
20
  // Note Volta and nvm are also recommended in the official docs:
22
21
  // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
23
22
  console.error(
24
- `Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}.
25
- You should use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8.
23
+ `Wrangler requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.
24
+
26
25
  Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
27
26
  );
28
27
  process.exitCode = 1;
@@ -36,7 +35,7 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
36
35
  // - maybe we can generate a certificate that concatenates with ours?
37
36
  //
38
37
  // I do think it'll be rare that someone wants to add a cert AND
39
- // use cloudflare WARP, but let's wait till the situation actually
38
+ // use Cloudflare WARP, but let's wait till the situation actually
40
39
  // arises before we do anything about it
41
40
  } else {
42
41
  const osTempDir = os.tmpdir();
@@ -128,10 +127,42 @@ async function main() {
128
127
  }
129
128
 
130
129
  process.on("SIGINT", () => {
131
- wranglerProcess?.kill();
130
+ wranglerProcess && wranglerProcess.kill();
132
131
  });
133
132
  process.on("SIGTERM", () => {
134
- wranglerProcess?.kill();
133
+ wranglerProcess && wranglerProcess.kill();
135
134
  });
136
135
 
136
+ // semiver implementation via https://github.com/lukeed/semiver/blob/ae7eebe6053c96be63032b14fb0b68e2553fcac4/src/index.js
137
+
138
+ /**
139
+ MIT License
140
+
141
+ Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
142
+
143
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
144
+
145
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
146
+
147
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
148
+
149
+ */
150
+
151
+ var fn = new Intl.Collator(0, { numeric: 1 }).compare;
152
+
153
+ function semiver(a, b, bool) {
154
+ a = a.split(".");
155
+ b = b.split(".");
156
+
157
+ return (
158
+ fn(a[0], b[0]) ||
159
+ fn(a[1], b[1]) ||
160
+ ((b[2] = b.slice(2).join(".")),
161
+ (bool = /[.-]/.test((a[2] = a.slice(2).join(".")))),
162
+ bool == /[.-]/.test(b[2]) ? fn(a[2], b[2]) : bool ? -1 : 1)
163
+ );
164
+ }
165
+
166
+ // end semiver implementation
167
+
137
168
  void main();