wrangler 0.0.0-bae5ba4 → 0.0.0-bafa5ac

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 (71) hide show
  1. package/Cloudflare_CA.pem +18 -0
  2. package/README.md +3 -1
  3. package/bin/wrangler.js +36 -4
  4. package/miniflare-dist/index.mjs +4828 -21
  5. package/package.json +15 -11
  6. package/pages/functions/buildPlugin.ts +51 -1
  7. package/pages/functions/buildWorker.ts +93 -4
  8. package/pages/functions/template-plugin.ts +3 -2
  9. package/src/__tests__/configuration.test.ts +352 -103
  10. package/src/__tests__/dev.test.tsx +380 -31
  11. package/src/__tests__/helpers/mock-console.ts +2 -0
  12. package/src/__tests__/helpers/mock-dialogs.ts +67 -2
  13. package/src/__tests__/helpers/mock-istty.ts +7 -3
  14. package/src/__tests__/helpers/mock-oauth-flow.ts +26 -2
  15. package/src/__tests__/https-options.test.ts +3 -2
  16. package/src/__tests__/index.test.ts +89 -72
  17. package/src/__tests__/init.test.ts +893 -92
  18. package/src/__tests__/jest.setup.ts +8 -4
  19. package/src/__tests__/kv.test.ts +200 -137
  20. package/src/__tests__/package-manager.test.ts +154 -7
  21. package/src/__tests__/pages.test.ts +382 -54
  22. package/src/__tests__/parse.test.ts +8 -0
  23. package/src/__tests__/publish.test.ts +994 -210
  24. package/src/__tests__/r2.test.ts +63 -32
  25. package/src/__tests__/secret.test.ts +72 -28
  26. package/src/__tests__/tail.test.ts +44 -14
  27. package/src/__tests__/user.test.ts +7 -2
  28. package/src/__tests__/whoami.test.tsx +11 -3
  29. package/src/abort.d.ts +3 -0
  30. package/src/bundle.ts +33 -2
  31. package/src/cfetch/index.ts +21 -4
  32. package/src/cfetch/internal.ts +17 -11
  33. package/src/cli.ts +1 -9
  34. package/src/config/config.ts +1 -1
  35. package/src/config/environment.ts +40 -14
  36. package/src/config/index.ts +162 -0
  37. package/src/config/validation-helpers.ts +3 -1
  38. package/src/config/validation.ts +188 -71
  39. package/src/create-worker-preview.ts +26 -14
  40. package/src/create-worker-upload-form.ts +22 -8
  41. package/src/dev/dev-vars.ts +36 -0
  42. package/src/dev/dev.tsx +7 -8
  43. package/src/dev/local.tsx +6 -0
  44. package/src/dev/remote.tsx +15 -1
  45. package/src/dialogs.tsx +48 -0
  46. package/src/durable.ts +102 -0
  47. package/src/entry.ts +64 -9
  48. package/src/index.tsx +598 -189
  49. package/src/inspect.ts +39 -0
  50. package/src/kv.ts +114 -25
  51. package/src/logger.ts +14 -4
  52. package/src/open-in-browser.ts +5 -12
  53. package/src/package-manager.ts +50 -3
  54. package/src/pages.tsx +305 -142
  55. package/src/parse.ts +23 -4
  56. package/src/proxy.ts +42 -33
  57. package/src/publish.ts +227 -113
  58. package/src/sites.tsx +19 -17
  59. package/src/tail/index.ts +1 -1
  60. package/src/tail/printing.ts +9 -5
  61. package/src/user.tsx +34 -6
  62. package/src/worker.ts +8 -0
  63. package/templates/gitignore +171 -0
  64. package/templates/new-worker-scheduled.js +17 -0
  65. package/templates/new-worker-scheduled.ts +32 -0
  66. package/templates/new-worker.ts +16 -1
  67. package/wrangler-dist/cli.js +53595 -73411
  68. package/miniflare-dist/index.mjs.map +0 -7
  69. package/src/__tests__/sentry.test.ts +0 -146
  70. package/src/reporting.ts +0 -147
  71. package/wrangler-dist/cli.js.map +0 -7
@@ -0,0 +1,18 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIC6zCCAkygAwIBAgIUI7b68p0pPrCBoW4ptlyvVcPItscwCgYIKoZIzj0EAwQw
3
+ gY0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
4
+ YW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9DbG91ZGZsYXJlLCBJbmMxNzA1BgNVBAMT
5
+ LkNsb3VkZmxhcmUgZm9yIFRlYW1zIEVDQyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw
6
+ HhcNMjAwMjA0MTYwNTAwWhcNMjUwMjAyMTYwNTAwWjCBjTELMAkGA1UEBhMCVVMx
7
+ EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGDAW
8
+ BgNVBAoTD0Nsb3VkZmxhcmUsIEluYzE3MDUGA1UEAxMuQ2xvdWRmbGFyZSBmb3Ig
9
+ VGVhbXMgRUNDIENlcnRpZmljYXRlIEF1dGhvcml0eTCBmzAQBgcqhkjOPQIBBgUr
10
+ gQQAIwOBhgAEAVdXsX8tpA9NAQeEQalvUIcVaFNDvGsR69ysZxOraRWNGHLfq1mi
11
+ P6o3wtmtx/C2OXG01Cw7UFJbKl5MEDxnT2KoAdFSynSJOF2NDoe5LoZHbUW+yR3X
12
+ FDl+MF6JzZ590VLGo6dPBf06UsXbH7PvHH2XKtFt8bBXVNMa5a21RdmpD0Pho0Uw
13
+ QzAOBgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBAjAdBgNVHQ4EFgQU
14
+ YBcQng1AEMMNteuRDAMG0/vgFe0wCgYIKoZIzj0EAwQDgYwAMIGIAkIBQU5OTA2h
15
+ YqmFk8paan5ezHVLcmcucsfYw4L/wmeEjCkczRmCVNm6L86LjhWU0v0wER0e+lHO
16
+ 3efvjbsu8gIGSagCQgEBnyYMP9gwg8l96QnQ1khFA1ljFlnqc2XgJHDSaAJC0gdz
17
+ +NV3JMeWaD2Rb32jc9r6/a7xY0u0ByqxBQ1OQ0dt7A==
18
+ -----END CERTIFICATE-----
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## ⛅️ wrangler
2
2
 
3
+ > This package is for wrangler v2.x, released first in May 2022. If you're looking for v1.x of the `@cloudflare/wrangler` package, visit https://www.npmjs.com/package/@cloudflare/wrangler / https://github.com/cloudflare/wrangler.
4
+
3
5
  `wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
4
6
 
5
7
  ## Quick Start
@@ -22,7 +24,7 @@ npx wrangler init my-worker
22
24
  # try it out
23
25
  cd my-worker && npm run start
24
26
  # and then publish it
25
- npx wrangler publish
27
+ npm run deploy
26
28
  ```
27
29
 
28
30
  ## Installation:
package/bin/wrangler.js CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
- const { spawn } = require("node:child_process");
3
- const { join } = require("node:path");
2
+ const { spawn } = require("child_process");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const os = require("os");
4
6
  const semiver = require("semiver");
5
7
 
6
8
  const MIN_NODE_VERSION = "16.7.0";
@@ -20,6 +22,30 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
20
22
  return;
21
23
  }
22
24
 
25
+ let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
26
+ if (pathToCACerts) {
27
+ // TODO:
28
+ // - should we log a warning here?
29
+ // - maybe we can generate a certificate that concatenates with ours?
30
+ //
31
+ // I do think it'll be rare that someone wants to add a cert AND
32
+ // use cloudflare WARP, but let's wait till the situation actually
33
+ // arises before we do anything about it
34
+ } else {
35
+ const osTempDir = os.tmpdir();
36
+ const certDir = path.join(osTempDir, "wrangler-cert");
37
+ const certPath = path.join(certDir, "Cloudflare_CA.pem");
38
+ // copy cert to the system temp dir if needed
39
+ if (!fs.existsSync(certPath)) {
40
+ fs.mkdirSync(certDir, { recursive: true });
41
+ fs.writeFileSync(
42
+ certPath,
43
+ fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8")
44
+ );
45
+ }
46
+ pathToCACerts = certPath;
47
+ }
48
+
23
49
  wranglerProcess = spawn(
24
50
  process.execPath,
25
51
  [
@@ -29,10 +55,16 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
29
55
  "--no-warnings",
30
56
  "--experimental-vm-modules",
31
57
  ...process.execArgv,
32
- join(__dirname, "../wrangler-dist/cli.js"),
58
+ path.join(__dirname, "../wrangler-dist/cli.js"),
33
59
  ...process.argv.slice(2),
34
60
  ],
35
- { stdio: "inherit" }
61
+ {
62
+ stdio: "inherit",
63
+ env: {
64
+ ...process.env,
65
+ NODE_EXTRA_CA_CERTS: pathToCACerts,
66
+ },
67
+ }
36
68
  ).on("exit", (code) =>
37
69
  process.exit(code === undefined || code === null ? 0 : code)
38
70
  );