wrangler 0.0.0-ded19b1 → 0.0.0-dee034b

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 (179) hide show
  1. package/README.md +8 -2
  2. package/bin/wrangler.js +118 -49
  3. package/kv-asset-handler.js +1 -0
  4. package/miniflare-dist/index.mjs +9 -2
  5. package/package.json +156 -150
  6. package/src/__tests__/config-cache.test.ts +24 -24
  7. package/src/__tests__/configuration.test.ts +3818 -3114
  8. package/src/__tests__/dev.test.tsx +1131 -801
  9. package/src/__tests__/guess-worker-format.test.ts +68 -68
  10. package/src/__tests__/helpers/cmd-shim.d.ts +6 -6
  11. package/src/__tests__/helpers/faye-websocket.d.ts +4 -4
  12. package/src/__tests__/helpers/mock-account-id.ts +24 -24
  13. package/src/__tests__/helpers/mock-bin.ts +20 -20
  14. package/src/__tests__/helpers/mock-cfetch.ts +92 -92
  15. package/src/__tests__/helpers/mock-console.ts +49 -39
  16. package/src/__tests__/helpers/mock-dialogs.ts +114 -51
  17. package/src/__tests__/helpers/mock-http-server.ts +30 -30
  18. package/src/__tests__/helpers/mock-istty.ts +65 -18
  19. package/src/__tests__/helpers/mock-kv.ts +26 -26
  20. package/src/__tests__/helpers/mock-oauth-flow.ts +223 -228
  21. package/src/__tests__/helpers/mock-process.ts +39 -0
  22. package/src/__tests__/helpers/mock-stdin.ts +82 -77
  23. package/src/__tests__/helpers/mock-web-socket.ts +21 -21
  24. package/src/__tests__/helpers/run-in-tmp.ts +27 -27
  25. package/src/__tests__/helpers/run-wrangler.ts +8 -8
  26. package/src/__tests__/helpers/write-worker-source.ts +16 -16
  27. package/src/__tests__/helpers/write-wrangler-toml.ts +9 -9
  28. package/src/__tests__/https-options.test.ts +104 -104
  29. package/src/__tests__/index.test.ts +112 -94
  30. package/src/__tests__/init.test.ts +1658 -1182
  31. package/src/__tests__/jest.setup.ts +63 -33
  32. package/src/__tests__/kv.test.ts +1194 -1050
  33. package/src/__tests__/logger.test.ts +100 -74
  34. package/src/__tests__/package-manager.test.ts +312 -165
  35. package/src/__tests__/pages.test.ts +1199 -272
  36. package/src/__tests__/parse.test.ts +252 -248
  37. package/src/__tests__/publish.test.ts +6356 -4842
  38. package/src/__tests__/pubsub.test.ts +276 -0
  39. package/src/__tests__/r2.test.ts +168 -145
  40. package/src/__tests__/route.test.ts +18 -18
  41. package/src/__tests__/secret.test.ts +399 -359
  42. package/src/__tests__/tail.test.ts +530 -530
  43. package/src/__tests__/user.test.ts +123 -111
  44. package/src/__tests__/whoami.test.tsx +198 -83
  45. package/src/abort.d.ts +3 -0
  46. package/src/api/dev.ts +39 -0
  47. package/src/api/index.ts +1 -0
  48. package/src/bundle-reporter.tsx +29 -0
  49. package/src/bundle.ts +168 -125
  50. package/src/cfetch/index.ts +83 -66
  51. package/src/cfetch/internal.ts +99 -87
  52. package/src/cli.ts +21 -7
  53. package/src/config/config.ts +204 -195
  54. package/src/config/diagnostics.ts +61 -61
  55. package/src/config/environment.ts +375 -339
  56. package/src/config/index.ts +200 -38
  57. package/src/config/validation-helpers.ts +366 -357
  58. package/src/config/validation.ts +1532 -1263
  59. package/src/config-cache.ts +24 -25
  60. package/src/create-worker-preview.ts +143 -119
  61. package/src/create-worker-upload-form.ts +238 -224
  62. package/src/dev/dev-vars.ts +13 -13
  63. package/src/dev/dev.tsx +335 -339
  64. package/src/dev/local.tsx +304 -266
  65. package/src/dev/remote.tsx +275 -194
  66. package/src/dev/use-esbuild.ts +126 -94
  67. package/src/dev.tsx +526 -0
  68. package/src/dialogs.tsx +111 -63
  69. package/src/durable.ts +102 -0
  70. package/src/entry.ts +234 -228
  71. package/src/environment-variables.ts +23 -23
  72. package/src/errors.ts +6 -6
  73. package/src/generate.ts +33 -0
  74. package/src/git-client.ts +42 -0
  75. package/src/https-options.ts +79 -79
  76. package/src/index.tsx +1780 -2620
  77. package/src/init.ts +549 -0
  78. package/src/inspect.ts +601 -562
  79. package/src/intl-polyfill.d.ts +123 -123
  80. package/src/kv.ts +331 -244
  81. package/src/logger.ts +46 -39
  82. package/src/miniflare-cli/enum-keys.ts +8 -8
  83. package/src/miniflare-cli/index.ts +42 -31
  84. package/src/miniflare-cli/request-context.ts +18 -18
  85. package/src/module-collection.ts +212 -212
  86. package/src/open-in-browser.ts +5 -14
  87. package/src/package-manager.ts +133 -86
  88. package/src/pages/build.tsx +202 -0
  89. package/src/pages/constants.ts +7 -0
  90. package/src/pages/deployments.tsx +101 -0
  91. package/src/pages/dev.tsx +964 -0
  92. package/src/pages/functions/buildPlugin.ts +105 -0
  93. package/src/pages/functions/buildWorker.ts +151 -0
  94. package/{pages → src/pages}/functions/filepath-routing.test.ts +113 -113
  95. package/src/pages/functions/filepath-routing.ts +189 -0
  96. package/src/pages/functions/identifiers.ts +78 -0
  97. package/src/pages/functions/routes.ts +151 -0
  98. package/src/pages/index.tsx +84 -0
  99. package/src/pages/projects.tsx +157 -0
  100. package/src/pages/publish.tsx +335 -0
  101. package/src/pages/types.ts +40 -0
  102. package/src/pages/upload.tsx +384 -0
  103. package/src/pages/utils.ts +12 -0
  104. package/src/parse.ts +223 -122
  105. package/src/paths.ts +6 -6
  106. package/src/preview.ts +31 -0
  107. package/src/proxy.ts +405 -378
  108. package/src/publish.ts +738 -441
  109. package/src/pubsub/index.ts +286 -0
  110. package/src/pubsub/pubsub-commands.tsx +604 -0
  111. package/src/r2.ts +19 -19
  112. package/src/selfsigned.d.ts +23 -23
  113. package/src/sites.tsx +279 -200
  114. package/src/tail/filters.ts +108 -108
  115. package/src/tail/index.ts +217 -217
  116. package/src/tail/printing.ts +45 -45
  117. package/src/update-check.ts +11 -11
  118. package/src/user/choose-account.tsx +60 -0
  119. package/src/user/env-vars.ts +46 -0
  120. package/src/user/generate-auth-url.ts +33 -0
  121. package/src/user/generate-random-state.ts +16 -0
  122. package/src/user/index.ts +3 -0
  123. package/src/user/user.tsx +1130 -0
  124. package/src/whoami.tsx +61 -41
  125. package/src/worker.ts +107 -94
  126. package/src/zones.ts +76 -0
  127. package/templates/checked-fetch.js +17 -0
  128. package/templates/new-worker-scheduled.js +17 -0
  129. package/templates/new-worker-scheduled.ts +32 -0
  130. package/templates/new-worker.js +3 -3
  131. package/templates/new-worker.ts +18 -3
  132. package/templates/no-op-worker.js +10 -0
  133. package/templates/pages-template-plugin.ts +155 -0
  134. package/templates/pages-template-worker.ts +161 -0
  135. package/templates/static-asset-facade.js +32 -36
  136. package/templates/tsconfig.json +95 -95
  137. package/wrangler-dist/cli.js +59393 -45043
  138. package/pages/functions/buildPlugin.ts +0 -92
  139. package/pages/functions/buildWorker.ts +0 -138
  140. package/pages/functions/filepath-routing.ts +0 -189
  141. package/pages/functions/identifiers.ts +0 -78
  142. package/pages/functions/routes.ts +0 -156
  143. package/pages/functions/template-plugin.ts +0 -147
  144. package/pages/functions/template-worker.ts +0 -143
  145. package/src/pages.tsx +0 -1882
  146. package/src/user.tsx +0 -1203
  147. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  148. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  149. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  150. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  151. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  152. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  153. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  154. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  155. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  156. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  157. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  158. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  159. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  160. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  161. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  162. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  163. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  164. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  165. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  166. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  167. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  168. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  169. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  170. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  171. package/vendor/wrangler-mime/LICENSE +0 -21
  172. package/vendor/wrangler-mime/Mime.js +0 -97
  173. package/vendor/wrangler-mime/README.md +0 -187
  174. package/vendor/wrangler-mime/cli.js +0 -46
  175. package/vendor/wrangler-mime/index.js +0 -4
  176. package/vendor/wrangler-mime/lite.js +0 -4
  177. package/vendor/wrangler-mime/package.json +0 -52
  178. package/vendor/wrangler-mime/types/other.js +0 -1
  179. package/vendor/wrangler-mime/types/standard.js +0 -1
package/README.md CHANGED
@@ -1,4 +1,10 @@
1
- ## ⛅️ wrangler
1
+ <h1 align="center"> ⛅️ wrangler </h1>
2
+ <section align="center" id="shieldio-badges">
3
+ <a href="https://www.npmjs.com/package/wrangler"><img alt="npm" src="https://img.shields.io/npm/dw/wrangler?style=flat-square"></a>
4
+ <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/cloudflare/wrangler2?style=flat-square">
5
+ <img alt="GitHub commit activity (branch)" src="https://img.shields.io/github/commit-activity/w/cloudflare/wrangler2/main?style=flat-square">
6
+ <a href="https://discord.gg/CloudflareDev"><img alt="Discord" src="https://img.shields.io/discord/595317990191398933?color=%23F48120&style=flat-square"></a>
7
+ </section>
2
8
 
3
9
  > 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
10
 
@@ -24,7 +30,7 @@ npx wrangler init my-worker
24
30
  # try it out
25
31
  cd my-worker && npm run start
26
32
  # and then publish it
27
- npm run publish
33
+ npm run deploy
28
34
  ```
29
35
 
30
36
  ## Installation:
package/bin/wrangler.js CHANGED
@@ -1,68 +1,137 @@
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";
7
9
 
8
10
  let wranglerProcess;
9
11
 
10
- async function main() {
11
- if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
12
- // Note Volta and nvm are also recommended in the official docs:
13
- // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
14
- console.error(
15
- `Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}.
12
+ /**
13
+ * Executes ../wrangler-dist/cli.js
14
+ */
15
+ function runWrangler() {
16
+ if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
17
+ // Note Volta and nvm are also recommended in the official docs:
18
+ // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
19
+ console.error(
20
+ `Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}.
16
21
  You should use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8.
17
22
  Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
18
- );
19
- process.exitCode = 1;
20
- return;
21
- }
23
+ );
24
+ process.exitCode = 1;
25
+ return;
26
+ }
27
+
28
+ let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
29
+ if (pathToCACerts) {
30
+ // TODO:
31
+ // - should we log a warning here?
32
+ // - maybe we can generate a certificate that concatenates with ours?
33
+ //
34
+ // I do think it'll be rare that someone wants to add a cert AND
35
+ // use cloudflare WARP, but let's wait till the situation actually
36
+ // arises before we do anything about it
37
+ } else {
38
+ const osTempDir = os.tmpdir();
39
+ const certDir = path.join(osTempDir, "wrangler-cert");
40
+ const certPath = path.join(certDir, "Cloudflare_CA.pem");
41
+ // copy cert to the system temp dir if needed
42
+ if (!fs.existsSync(certPath)) {
43
+ fs.mkdirSync(certDir, { recursive: true });
44
+ fs.writeFileSync(
45
+ certPath,
46
+ fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8")
47
+ );
48
+ }
49
+ pathToCACerts = certPath;
50
+ }
22
51
 
23
- let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
24
- if (pathToCACerts) {
25
- // TODO:
26
- // - should we log a warning here?
27
- // - maybe we can generate a certificate that concatenates with ours?
28
- // - is there a security concern/should we cleanup after we exit?
29
- //
30
- // I do think it'll be rare that someone wants to add a cert AND
31
- // use cloudflare WARP, but let's wait till the situation actually
32
- // arises before we do anything about it
33
- } else {
34
- pathToCACerts = join(__dirname, "../Cloudflare_CA.pem");
35
- }
52
+ return spawn(
53
+ process.execPath,
54
+ [
55
+ ...(semiver(process.versions.node, "18.0.0") >= 0
56
+ ? ["--no-experimental-fetch"] // TODO: remove this when https://github.com/cloudflare/wrangler2/issues/834 is properly fixed
57
+ : []),
58
+ "--no-warnings",
59
+ "--experimental-vm-modules",
60
+ ...process.execArgv,
61
+ path.join(__dirname, "../wrangler-dist/cli.js"),
62
+ ...process.argv.slice(2),
63
+ ],
64
+ {
65
+ stdio: "inherit",
66
+ env: {
67
+ ...process.env,
68
+ NODE_EXTRA_CA_CERTS: pathToCACerts,
69
+ },
70
+ }
71
+ ).on("exit", (code) =>
72
+ process.exit(code === undefined || code === null ? 0 : code)
73
+ );
74
+ }
36
75
 
37
- wranglerProcess = spawn(
38
- process.execPath,
39
- [
40
- ...(semiver(process.versions.node, "18.0.0") >= 0
41
- ? ["--no-experimental-fetch"] // TODO: remove this when https://github.com/cloudflare/wrangler2/issues/834 is properly fixed
42
- : []),
43
- "--no-warnings",
44
- "--experimental-vm-modules",
45
- ...process.execArgv,
46
- join(__dirname, "../wrangler-dist/cli.js"),
47
- ...process.argv.slice(2),
48
- ],
49
- {
50
- stdio: "inherit",
51
- env: {
52
- ...process.env,
53
- NODE_EXTRA_CA_CERTS: pathToCACerts,
54
- },
55
- }
56
- ).on("exit", (code) =>
57
- process.exit(code === undefined || code === null ? 0 : code)
58
- );
76
+ /**
77
+ * Runs a locally-installed version of wrangler, delegating from this version.
78
+ * @throws {MODULE_NOT_FOUND} if there isn't a locally installed version of wrangler.
79
+ */
80
+ function runDelegatedWrangler() {
81
+ const packageJsonPath = require.resolve("wrangler/package.json", {
82
+ paths: [process.cwd()],
83
+ });
84
+ const {
85
+ bin: { wrangler: binaryPath },
86
+ version,
87
+ } = JSON.parse(fs.readFileSync(packageJsonPath));
88
+ const resolvedBinaryPath = path.resolve(packageJsonPath, "..", binaryPath);
89
+
90
+ console.log(
91
+ `Delegating to locally-installed version of wrangler @ v${version}`
92
+ );
93
+ // this call to `spawn` is simpler because the delegated version will do all
94
+ // of the other work.
95
+ return spawn(
96
+ process.execPath,
97
+ [resolvedBinaryPath, ...process.argv.slice(2)],
98
+ {
99
+ stdio: "inherit",
100
+ }
101
+ ).on("exit", (code) =>
102
+ process.exit(code === undefined || code === null ? 0 : code)
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Indicates if this invocation of `wrangler` should delegate
108
+ * to a locally-installed version.
109
+ */
110
+ function shouldDelegate() {
111
+ try {
112
+ // `require.resolve` will throw if it can't find
113
+ // a locally-installed version of `wrangler`
114
+ const delegatedPackageJson = require.resolve("wrangler/package.json", {
115
+ paths: [process.cwd()],
116
+ });
117
+ const thisPackageJson = path.resolve(__dirname, "..", "package.json");
118
+ // if it's the same path, then we're already a local install -- no need to delegate
119
+ return thisPackageJson !== delegatedPackageJson;
120
+ } catch (e) {
121
+ // there's no local version to delegate to -- `require.resolve` threw
122
+ return false;
123
+ }
124
+ }
125
+
126
+ async function main() {
127
+ wranglerProcess = shouldDelegate() ? runDelegatedWrangler() : runWrangler();
59
128
  }
60
129
 
61
130
  process.on("SIGINT", () => {
62
- wranglerProcess.kill();
131
+ wranglerProcess?.kill();
63
132
  });
64
133
  process.on("SIGTERM", () => {
65
- wranglerProcess.kill();
134
+ wranglerProcess?.kill();
66
135
  });
67
136
 
68
137
  void main();
@@ -0,0 +1 @@
1
+ export * from "@cloudflare/kv-asset-handler";
@@ -4846,6 +4846,13 @@ var getRequestContextCheckOptions = async () => {
4846
4846
  };
4847
4847
 
4848
4848
  // src/miniflare-cli/index.ts
4849
+ var NoOpLog = class extends Log {
4850
+ log() {
4851
+ }
4852
+ error(message) {
4853
+ throw message;
4854
+ }
4855
+ };
4849
4856
  async function main() {
4850
4857
  const args = await yargs_default(hideBin(process.argv)).help(false).version(false).option("log", {
4851
4858
  choices: enumKeys(LogLevel)
@@ -4854,9 +4861,9 @@ async function main() {
4854
4861
  const requestContextCheckOptions = await getRequestContextCheckOptions();
4855
4862
  const config = {
4856
4863
  ...JSON.parse(args._[0] ?? "{}"),
4857
- ...requestContextCheckOptions,
4858
- log: new Log(logLevel)
4864
+ ...requestContextCheckOptions
4859
4865
  };
4866
+ config.log = config.disableLogs ? new NoOpLog() : new Log(logLevel);
4860
4867
  if (logLevel > LogLevel.INFO) {
4861
4868
  console.log("OPTIONS:\n", JSON.stringify(config, null, 2));
4862
4869
  }
package/package.json CHANGED
@@ -1,152 +1,158 @@
1
1
  {
2
- "name": "wrangler",
3
- "version": "0.0.0-ded19b1",
4
- "author": "wrangler@cloudflare.com",
5
- "description": "Command-line interface for all things Cloudflare Workers",
6
- "bin": {
7
- "wrangler": "./bin/wrangler.js",
8
- "wrangler2": "./bin/wrangler.js"
9
- },
10
- "license": "MIT OR Apache-2.0",
11
- "bugs": {
12
- "url": "https://github.com/cloudflare/wrangler2/issues"
13
- },
14
- "homepage": "https://github.com/cloudflare/wrangler2#readme",
15
- "keywords": [
16
- "wrangler",
17
- "cloudflare",
18
- "workers",
19
- "cloudflare workers",
20
- "edge",
21
- "compute",
22
- "serverless",
23
- "serverless application",
24
- "serverless module",
25
- "wasm",
26
- "web",
27
- "assembly",
28
- "webassembly",
29
- "rust",
30
- "emscripten",
31
- "rust",
32
- "typescript",
33
- "graphql",
34
- "router",
35
- "http",
36
- "cli"
37
- ],
38
- "dependencies": {
39
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
40
- "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
41
- "blake3-wasm": "^2.1.5",
42
- "esbuild": "0.14.34",
43
- "miniflare": "2.4.0",
44
- "nanoid": "^3.3.3",
45
- "path-to-regexp": "^6.2.0",
46
- "selfsigned": "^2.0.1",
47
- "semiver": "^1.1.0",
48
- "xxhash-wasm": "^1.0.1"
49
- },
50
- "optionalDependencies": {
51
- "fsevents": "~2.3.2"
52
- },
53
- "devDependencies": {
54
- "@iarna/toml": "^3.0.0",
55
- "@types/command-exists": "^1.2.0",
56
- "@types/glob-to-regexp": "0.4.1",
57
- "@types/mime": "^2.0.3",
58
- "@types/prompts": "^2.0.14",
59
- "@types/react": "^17.0.37",
60
- "@types/serve-static": "^1.13.10",
61
- "@types/signal-exit": "^3.0.1",
62
- "@types/supports-color": "^8.1.1",
63
- "@types/ws": "^8.5.3",
64
- "@types/yargs": "^17.0.10",
65
- "@webcontainer/env": "^1.0.1",
66
- "chokidar": "^3.5.3",
67
- "clipboardy": "^3.0.0",
68
- "cmd-shim": "^4.1.0",
69
- "command-exists": "^1.2.9",
70
- "devtools-protocol": "^0.0.955664",
71
- "dotenv": "^16.0.0",
72
- "execa": "^6.1.0",
73
- "faye-websocket": "^0.11.4",
74
- "finalhandler": "^1.2.0",
75
- "find-up": "^6.3.0",
76
- "get-port": "^6.1.2",
77
- "glob-to-regexp": "0.4.1",
78
- "ignore": "^5.2.0",
79
- "ink": "^3.2.0",
80
- "ink-select-input": "^4.2.1",
81
- "ink-spinner": "^4.0.3",
82
- "ink-table": "^3.0.0",
83
- "ink-testing-library": "^2.1.0",
84
- "ink-text-input": "^4.0.3",
85
- "jest-fetch-mock": "^3.0.3",
86
- "jest-websocket-mock": "^2.3.0",
87
- "mime": "^3.0.0",
88
- "open": "^8.4.0",
89
- "pretty-bytes": "^6.0.0",
90
- "prompts": "^2.4.2",
91
- "react": "^17.0.2",
92
- "react-error-boundary": "^3.1.4",
93
- "serve-static": "^1.15.0",
94
- "signal-exit": "^3.0.7",
95
- "supports-color": "^9.2.2",
96
- "timeago.js": "^4.0.2",
97
- "tmp-promise": "^3.0.3",
98
- "ts-dedent": "^2.2.0",
99
- "undici": "^4.15.1",
100
- "update-check": "^1.5.4",
101
- "ws": "^8.5.0",
102
- "yargs": "^17.4.1"
103
- },
104
- "files": [
105
- "src",
106
- "bin",
107
- "pages",
108
- "miniflare-config-stubs",
109
- "miniflare-dist",
110
- "wrangler-dist",
111
- "templates",
112
- "vendor",
113
- "import_meta_url.js",
114
- "Cloudflare_CA.pem"
115
- ],
116
- "scripts": {
117
- "clean": "rm -rf wrangler-dist miniflare-dist",
118
- "check:type": "tsc",
119
- "bundle": "node -r esbuild-register scripts/bundle.ts",
120
- "build": "npm run clean && npm run bundle",
121
- "prepublishOnly": "SOURCEMAPS=false npm run build",
122
- "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
123
- "test": "jest --silent=false --verbose=true",
124
- "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
125
- },
126
- "engines": {
127
- "node": ">=16.7.0"
128
- },
129
- "jest": {
130
- "restoreMocks": true,
131
- "testTimeout": 30000,
132
- "testRegex": ".*.(test|spec)\\.[jt]sx?$",
133
- "transformIgnorePatterns": [
134
- "node_modules/(?!find-up|locate-path|p-locate|p-limit|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes)"
135
- ],
136
- "moduleNameMapper": {
137
- "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
138
- "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
139
- },
140
- "transform": {
141
- "^.+\\.c?(t|j)sx?$": [
142
- "esbuild-jest",
143
- {
144
- "sourcemap": true
145
- }
146
- ]
147
- },
148
- "setupFilesAfterEnv": [
149
- "<rootDir>/src/__tests__/jest.setup.ts"
150
- ]
151
- }
2
+ "name": "wrangler",
3
+ "version": "0.0.0-dee034b",
4
+ "author": "wrangler@cloudflare.com",
5
+ "description": "Command-line interface for all things Cloudflare Workers",
6
+ "bin": {
7
+ "wrangler": "./bin/wrangler.js",
8
+ "wrangler2": "./bin/wrangler.js"
9
+ },
10
+ "main": "wrangler-dist/cli.js",
11
+ "license": "MIT OR Apache-2.0",
12
+ "bugs": {
13
+ "url": "https://github.com/cloudflare/wrangler2/issues"
14
+ },
15
+ "homepage": "https://github.com/cloudflare/wrangler2#readme",
16
+ "keywords": [
17
+ "wrangler",
18
+ "cloudflare",
19
+ "workers",
20
+ "cloudflare workers",
21
+ "edge",
22
+ "compute",
23
+ "serverless",
24
+ "serverless application",
25
+ "serverless module",
26
+ "wasm",
27
+ "web",
28
+ "assembly",
29
+ "webassembly",
30
+ "rust",
31
+ "emscripten",
32
+ "rust",
33
+ "typescript",
34
+ "graphql",
35
+ "router",
36
+ "http",
37
+ "cli"
38
+ ],
39
+ "dependencies": {
40
+ "@cloudflare/kv-asset-handler": "^0.2.0",
41
+ "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
42
+ "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
43
+ "blake3-wasm": "^2.1.5",
44
+ "esbuild": "0.14.47",
45
+ "miniflare": "^2.5.1",
46
+ "nanoid": "^3.3.3",
47
+ "path-to-regexp": "^6.2.0",
48
+ "selfsigned": "^2.0.1",
49
+ "semiver": "^1.1.0",
50
+ "xxhash-wasm": "^1.0.1"
51
+ },
52
+ "optionalDependencies": {
53
+ "fsevents": "~2.3.2"
54
+ },
55
+ "devDependencies": {
56
+ "@iarna/toml": "^3.0.0",
57
+ "@types/command-exists": "^1.2.0",
58
+ "@types/glob-to-regexp": "0.4.1",
59
+ "@types/mime": "^2.0.3",
60
+ "@types/prompts": "^2.0.14",
61
+ "@types/react": "^17.0.37",
62
+ "@types/serve-static": "^1.13.10",
63
+ "@types/signal-exit": "^3.0.1",
64
+ "@types/supports-color": "^8.1.1",
65
+ "@types/ws": "^8.5.3",
66
+ "@types/yargs": "^17.0.10",
67
+ "@webcontainer/env": "^1.0.1",
68
+ "chokidar": "^3.5.3",
69
+ "clipboardy": "^3.0.0",
70
+ "cmd-shim": "^4.1.0",
71
+ "command-exists": "^1.2.9",
72
+ "concurrently": "^7.2.2",
73
+ "devtools-protocol": "^0.0.955664",
74
+ "dotenv": "^16.0.0",
75
+ "execa": "^6.1.0",
76
+ "faye-websocket": "^0.11.4",
77
+ "finalhandler": "^1.2.0",
78
+ "find-up": "^6.3.0",
79
+ "get-port": "^6.1.2",
80
+ "glob-to-regexp": "0.4.1",
81
+ "http-terminator": "^3.2.0",
82
+ "ignore": "^5.2.0",
83
+ "ink": "^3.2.0",
84
+ "ink-select-input": "^4.2.1",
85
+ "ink-spinner": "^4.0.3",
86
+ "ink-table": "^3.0.0",
87
+ "ink-testing-library": "^2.1.0",
88
+ "ink-text-input": "^4.0.3",
89
+ "jest-fetch-mock": "^3.0.3",
90
+ "jest-websocket-mock": "^2.3.0",
91
+ "mime": "^3.0.0",
92
+ "open": "^8.4.0",
93
+ "p-queue": "^7.2.0",
94
+ "pretty-bytes": "^6.0.0",
95
+ "prompts": "^2.4.2",
96
+ "react": "^17.0.2",
97
+ "react-error-boundary": "^3.1.4",
98
+ "serve-static": "^1.15.0",
99
+ "signal-exit": "^3.0.7",
100
+ "supports-color": "^9.2.2",
101
+ "timeago.js": "^4.0.2",
102
+ "tmp-promise": "^3.0.3",
103
+ "ts-dedent": "^2.2.0",
104
+ "undici": "^5.5.1",
105
+ "update-check": "^1.5.4",
106
+ "ws": "^8.5.0",
107
+ "yargs": "^17.4.1"
108
+ },
109
+ "files": [
110
+ "src",
111
+ "bin",
112
+ "miniflare-config-stubs",
113
+ "miniflare-dist",
114
+ "wrangler-dist",
115
+ "templates",
116
+ "vendor",
117
+ "import_meta_url.js",
118
+ "kv-asset-handler.js",
119
+ "Cloudflare_CA.pem"
120
+ ],
121
+ "scripts": {
122
+ "clean": "rm -rf wrangler-dist miniflare-dist",
123
+ "check:type": "tsc",
124
+ "bundle": "node -r esbuild-register scripts/bundle.ts",
125
+ "build": "npm run clean && npm run bundle",
126
+ "dev": "npm run clean && concurrently -c black,blue 'npm run bundle -- --watch' 'npm run check:type -- --watch --preserveWatchOutput'",
127
+ "prepublishOnly": "SOURCEMAPS=false npm run build",
128
+ "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
129
+ "test": "jest --silent=false --verbose=true",
130
+ "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
131
+ },
132
+ "engines": {
133
+ "node": ">=16.7.0"
134
+ },
135
+ "jest": {
136
+ "restoreMocks": true,
137
+ "testTimeout": 30000,
138
+ "testRegex": ".*.(test|spec)\\.[jt]sx?$",
139
+ "transformIgnorePatterns": [
140
+ "node_modules/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes)"
141
+ ],
142
+ "moduleNameMapper": {
143
+ "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
144
+ "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
145
+ },
146
+ "transform": {
147
+ "^.+\\.c?(t|j)sx?$": [
148
+ "esbuild-jest",
149
+ {
150
+ "sourcemap": true
151
+ }
152
+ ]
153
+ },
154
+ "setupFilesAfterEnv": [
155
+ "<rootDir>/src/__tests__/jest.setup.ts"
156
+ ]
157
+ }
152
158
  }
@@ -2,35 +2,35 @@ import { getConfigCache, saveToConfigCache } from "../config-cache";
2
2
  import { runInTempDir } from "./helpers/run-in-tmp";
3
3
 
4
4
  interface PagesConfigCache {
5
- account_id: string;
6
- pages_project_name: string;
5
+ account_id: string;
6
+ pages_project_name: string;
7
7
  }
8
8
 
9
9
  describe("config cache", () => {
10
- runInTempDir();
10
+ runInTempDir();
11
11
 
12
- const pagesConfigCacheFilename = "pages-config-cache.json";
12
+ const pagesConfigCacheFilename = "pages-config-cache.json";
13
13
 
14
- it("should return an empty config if no file exists", () => {
15
- expect(
16
- getConfigCache<PagesConfigCache>(pagesConfigCacheFilename)
17
- ).toMatchInlineSnapshot(`Object {}`);
18
- });
14
+ it("should return an empty config if no file exists", () => {
15
+ expect(
16
+ getConfigCache<PagesConfigCache>(pagesConfigCacheFilename)
17
+ ).toMatchInlineSnapshot(`Object {}`);
18
+ });
19
19
 
20
- it("should read and write values without overriding old ones", () => {
21
- saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, {
22
- account_id: "some-account-id",
23
- pages_project_name: "foo",
24
- });
25
- expect(
26
- getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id
27
- ).toEqual("some-account-id");
20
+ it("should read and write values without overriding old ones", () => {
21
+ saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, {
22
+ account_id: "some-account-id",
23
+ pages_project_name: "foo",
24
+ });
25
+ expect(
26
+ getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id
27
+ ).toEqual("some-account-id");
28
28
 
29
- saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, {
30
- pages_project_name: "bar",
31
- });
32
- expect(
33
- getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id
34
- ).toEqual("some-account-id");
35
- });
29
+ saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, {
30
+ pages_project_name: "bar",
31
+ });
32
+ expect(
33
+ getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id
34
+ ).toEqual("some-account-id");
35
+ });
36
36
  });