wrangler 0.0.0-ee57d77 → 0.0.0-ee6b413

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 (131) hide show
  1. package/README.md +7 -1
  2. package/bin/wrangler.js +92 -92
  3. package/package.json +155 -155
  4. package/src/__tests__/config-cache.test.ts +24 -24
  5. package/src/__tests__/configuration.test.ts +2894 -2655
  6. package/src/__tests__/dev.test.tsx +915 -833
  7. package/src/__tests__/guess-worker-format.test.ts +68 -68
  8. package/src/__tests__/helpers/cmd-shim.d.ts +6 -6
  9. package/src/__tests__/helpers/faye-websocket.d.ts +4 -4
  10. package/src/__tests__/helpers/mock-account-id.ts +24 -24
  11. package/src/__tests__/helpers/mock-bin.ts +20 -20
  12. package/src/__tests__/helpers/mock-cfetch.ts +91 -91
  13. package/src/__tests__/helpers/mock-console.ts +42 -42
  14. package/src/__tests__/helpers/mock-dialogs.ts +94 -94
  15. package/src/__tests__/helpers/mock-http-server.ts +30 -30
  16. package/src/__tests__/helpers/mock-istty.ts +65 -23
  17. package/src/__tests__/helpers/mock-kv.ts +26 -26
  18. package/src/__tests__/helpers/mock-oauth-flow.ts +214 -214
  19. package/src/__tests__/helpers/mock-process.ts +27 -27
  20. package/src/__tests__/helpers/mock-stdin.ts +81 -81
  21. package/src/__tests__/helpers/mock-web-socket.ts +21 -21
  22. package/src/__tests__/helpers/run-in-tmp.ts +27 -27
  23. package/src/__tests__/helpers/run-wrangler.ts +8 -8
  24. package/src/__tests__/helpers/write-worker-source.ts +16 -16
  25. package/src/__tests__/helpers/write-wrangler-toml.ts +9 -9
  26. package/src/__tests__/https-options.test.ts +104 -104
  27. package/src/__tests__/index.test.ts +91 -89
  28. package/src/__tests__/init.test.ts +1558 -1558
  29. package/src/__tests__/jest.setup.ts +56 -56
  30. package/src/__tests__/kv.test.ts +1094 -1094
  31. package/src/__tests__/logger.test.ts +96 -96
  32. package/src/__tests__/package-manager.test.ts +303 -303
  33. package/src/__tests__/pages.test.ts +1116 -1104
  34. package/src/__tests__/parse.test.ts +252 -252
  35. package/src/__tests__/publish.test.ts +4814 -4506
  36. package/src/__tests__/pubsub.test.ts +276 -0
  37. package/src/__tests__/r2.test.ts +133 -133
  38. package/src/__tests__/route.test.ts +18 -18
  39. package/src/__tests__/secret.test.ts +377 -377
  40. package/src/__tests__/tail.test.ts +530 -530
  41. package/src/__tests__/user.test.ts +122 -111
  42. package/src/__tests__/whoami.test.tsx +177 -116
  43. package/src/abort.d.ts +1 -1
  44. package/src/bundle-reporter.tsx +15 -15
  45. package/src/bundle.ts +157 -149
  46. package/src/cfetch/index.ts +80 -80
  47. package/src/cfetch/internal.ts +89 -82
  48. package/src/cli.ts +5 -5
  49. package/src/config/config.ts +204 -204
  50. package/src/config/diagnostics.ts +61 -61
  51. package/src/config/environment.ts +367 -357
  52. package/src/config/index.ts +193 -193
  53. package/src/config/validation-helpers.ts +366 -366
  54. package/src/config/validation.ts +1493 -1401
  55. package/src/config-cache.ts +24 -24
  56. package/src/create-worker-preview.ts +129 -129
  57. package/src/create-worker-upload-form.ts +238 -238
  58. package/src/dev/dev-vars.ts +13 -13
  59. package/src/dev/dev.tsx +315 -311
  60. package/src/dev/local.tsx +289 -275
  61. package/src/dev/remote.tsx +243 -243
  62. package/src/dev/use-esbuild.ts +93 -88
  63. package/src/dev.tsx +470 -0
  64. package/src/dialogs.tsx +97 -97
  65. package/src/durable.ts +87 -87
  66. package/src/entry.ts +234 -234
  67. package/src/environment-variables.ts +23 -23
  68. package/src/errors.ts +6 -6
  69. package/src/generate.ts +33 -0
  70. package/src/git-client.ts +18 -18
  71. package/src/https-options.ts +79 -79
  72. package/src/index.tsx +1745 -2809
  73. package/src/init.ts +549 -0
  74. package/src/inspect.ts +593 -593
  75. package/src/intl-polyfill.d.ts +123 -123
  76. package/src/kv.ts +276 -276
  77. package/src/logger.ts +42 -42
  78. package/src/miniflare-cli/enum-keys.ts +8 -8
  79. package/src/miniflare-cli/index.ts +27 -27
  80. package/src/miniflare-cli/request-context.ts +18 -18
  81. package/src/module-collection.ts +212 -212
  82. package/src/open-in-browser.ts +4 -4
  83. package/src/package-manager.ts +123 -123
  84. package/src/pages/build.tsx +166 -166
  85. package/src/pages/deployments.tsx +67 -67
  86. package/src/pages/dev.tsx +878 -862
  87. package/src/pages/functions/buildPlugin.ts +87 -87
  88. package/src/pages/functions/buildWorker.ts +124 -124
  89. package/src/pages/functions/filepath-routing.test.ts +110 -110
  90. package/src/pages/functions/filepath-routing.ts +162 -162
  91. package/src/pages/functions/identifiers.ts +60 -60
  92. package/src/pages/functions/routes.ts +105 -105
  93. package/src/pages/index.tsx +66 -66
  94. package/src/pages/projects.tsx +113 -113
  95. package/src/pages/publish.tsx +303 -293
  96. package/src/pages/types.ts +31 -31
  97. package/src/pages/upload.tsx +346 -325
  98. package/src/pages/utils.ts +3 -3
  99. package/src/parse.ts +202 -138
  100. package/src/paths.ts +6 -6
  101. package/src/preview.tsx +150 -0
  102. package/src/proxy.ts +400 -400
  103. package/src/publish.ts +634 -631
  104. package/src/pubsub/index.ts +286 -0
  105. package/src/pubsub/pubsub-commands.tsx +604 -0
  106. package/src/r2.ts +19 -19
  107. package/src/selfsigned.d.ts +23 -23
  108. package/src/sites.tsx +256 -256
  109. package/src/tail/filters.ts +108 -108
  110. package/src/tail/index.ts +217 -217
  111. package/src/tail/printing.ts +45 -45
  112. package/src/update-check.ts +11 -11
  113. package/src/user/choose-account.tsx +38 -38
  114. package/src/user/env-vars.ts +36 -7
  115. package/src/user/generate-auth-url.ts +23 -23
  116. package/src/user/generate-random-state.ts +6 -6
  117. package/src/user/user.tsx +627 -630
  118. package/src/whoami.tsx +45 -40
  119. package/src/worker.ts +102 -100
  120. package/src/zones.ts +39 -36
  121. package/templates/checked-fetch.js +17 -0
  122. package/templates/new-worker-scheduled.js +3 -3
  123. package/templates/new-worker-scheduled.ts +15 -15
  124. package/templates/new-worker.js +3 -3
  125. package/templates/new-worker.ts +15 -15
  126. package/templates/no-op-worker.js +8 -8
  127. package/templates/pages-template-plugin.ts +123 -123
  128. package/templates/pages-template-worker.ts +124 -124
  129. package/templates/static-asset-facade.js +31 -31
  130. package/templates/tsconfig.json +95 -95
  131. package/wrangler-dist/cli.js +74721 -74088
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
 
package/bin/wrangler.js CHANGED
@@ -13,64 +13,64 @@ let wranglerProcess;
13
13
  * Executes ../wrangler-dist/cli.js
14
14
  */
15
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
+ 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}.
21
21
  You should use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8.
22
22
  Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
23
- );
24
- process.exitCode = 1;
25
- return;
26
- }
23
+ );
24
+ process.exitCode = 1;
25
+ return;
26
+ }
27
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
- }
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
+ }
51
51
 
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
- );
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
74
  }
75
75
 
76
76
  /**
@@ -78,29 +78,29 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
78
78
  * @throws {MODULE_NOT_FOUND} if there isn't a locally installed version of wrangler.
79
79
  */
80
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);
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
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
- );
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
104
  }
105
105
 
106
106
  /**
@@ -108,30 +108,30 @@ function runDelegatedWrangler() {
108
108
  * to a locally-installed version.
109
109
  */
110
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
- }
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
124
  }
125
125
 
126
126
  async function main() {
127
- wranglerProcess = shouldDelegate() ? runDelegatedWrangler() : runWrangler();
127
+ wranglerProcess = shouldDelegate() ? runDelegatedWrangler() : runWrangler();
128
128
  }
129
129
 
130
130
  process.on("SIGINT", () => {
131
- wranglerProcess?.kill();
131
+ wranglerProcess?.kill();
132
132
  });
133
133
  process.on("SIGTERM", () => {
134
- wranglerProcess?.kill();
134
+ wranglerProcess?.kill();
135
135
  });
136
136
 
137
137
  void main();
package/package.json CHANGED
@@ -1,157 +1,157 @@
1
1
  {
2
- "name": "wrangler",
3
- "version": "0.0.0-ee57d77",
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
- "@cloudflare/kv-asset-handler": "^0.2.0",
40
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
41
- "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
42
- "blake3-wasm": "^2.1.5",
43
- "esbuild": "0.14.34",
44
- "miniflare": "^2.5.1",
45
- "nanoid": "^3.3.3",
46
- "path-to-regexp": "^6.2.0",
47
- "selfsigned": "^2.0.1",
48
- "semiver": "^1.1.0",
49
- "xxhash-wasm": "^1.0.1"
50
- },
51
- "optionalDependencies": {
52
- "fsevents": "~2.3.2"
53
- },
54
- "devDependencies": {
55
- "@iarna/toml": "^3.0.0",
56
- "@types/command-exists": "^1.2.0",
57
- "@types/glob-to-regexp": "0.4.1",
58
- "@types/mime": "^2.0.3",
59
- "@types/prompts": "^2.0.14",
60
- "@types/react": "^17.0.37",
61
- "@types/serve-static": "^1.13.10",
62
- "@types/signal-exit": "^3.0.1",
63
- "@types/supports-color": "^8.1.1",
64
- "@types/ws": "^8.5.3",
65
- "@types/yargs": "^17.0.10",
66
- "@webcontainer/env": "^1.0.1",
67
- "chokidar": "^3.5.3",
68
- "clipboardy": "^3.0.0",
69
- "cmd-shim": "^4.1.0",
70
- "command-exists": "^1.2.9",
71
- "concurrently": "^7.2.2",
72
- "devtools-protocol": "^0.0.955664",
73
- "dotenv": "^16.0.0",
74
- "execa": "^6.1.0",
75
- "faye-websocket": "^0.11.4",
76
- "finalhandler": "^1.2.0",
77
- "find-up": "^6.3.0",
78
- "get-port": "^6.1.2",
79
- "glob-to-regexp": "0.4.1",
80
- "http-terminator": "^3.2.0",
81
- "ignore": "^5.2.0",
82
- "ink": "^3.2.0",
83
- "ink-select-input": "^4.2.1",
84
- "ink-spinner": "^4.0.3",
85
- "ink-table": "^3.0.0",
86
- "ink-testing-library": "^2.1.0",
87
- "ink-text-input": "^4.0.3",
88
- "jest-fetch-mock": "^3.0.3",
89
- "jest-websocket-mock": "^2.3.0",
90
- "mime": "^3.0.0",
91
- "open": "^8.4.0",
92
- "p-queue": "^7.2.0",
93
- "pretty-bytes": "^6.0.0",
94
- "prompts": "^2.4.2",
95
- "react": "^17.0.2",
96
- "react-error-boundary": "^3.1.4",
97
- "serve-static": "^1.15.0",
98
- "signal-exit": "^3.0.7",
99
- "supports-color": "^9.2.2",
100
- "timeago.js": "^4.0.2",
101
- "tmp-promise": "^3.0.3",
102
- "ts-dedent": "^2.2.0",
103
- "undici": "^5.5.1",
104
- "update-check": "^1.5.4",
105
- "ws": "^8.5.0",
106
- "yargs": "^17.4.1"
107
- },
108
- "files": [
109
- "src",
110
- "bin",
111
- "miniflare-config-stubs",
112
- "miniflare-dist",
113
- "wrangler-dist",
114
- "templates",
115
- "vendor",
116
- "import_meta_url.js",
117
- "kv-asset-handler.js",
118
- "Cloudflare_CA.pem"
119
- ],
120
- "scripts": {
121
- "clean": "rm -rf wrangler-dist miniflare-dist",
122
- "check:type": "tsc",
123
- "bundle": "node -r esbuild-register scripts/bundle.ts",
124
- "build": "npm run clean && npm run bundle",
125
- "dev": "npm run clean && concurrently -c black,blue 'npm run bundle -- --watch' 'npm run check:type -- --watch --preserveWatchOutput'",
126
- "prepublishOnly": "SOURCEMAPS=false npm run build",
127
- "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
128
- "test": "jest --silent=false --verbose=true",
129
- "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
130
- },
131
- "engines": {
132
- "node": ">=16.7.0"
133
- },
134
- "jest": {
135
- "restoreMocks": true,
136
- "testTimeout": 30000,
137
- "testRegex": ".*.(test|spec)\\.[jt]sx?$",
138
- "transformIgnorePatterns": [
139
- "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)"
140
- ],
141
- "moduleNameMapper": {
142
- "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
143
- "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
144
- },
145
- "transform": {
146
- "^.+\\.c?(t|j)sx?$": [
147
- "esbuild-jest",
148
- {
149
- "sourcemap": true
150
- }
151
- ]
152
- },
153
- "setupFilesAfterEnv": [
154
- "<rootDir>/src/__tests__/jest.setup.ts"
155
- ]
156
- }
2
+ "name": "wrangler",
3
+ "version": "0.0.0-ee6b413",
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
+ "@cloudflare/kv-asset-handler": "^0.2.0",
40
+ "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
41
+ "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
42
+ "blake3-wasm": "^2.1.5",
43
+ "esbuild": "0.14.34",
44
+ "miniflare": "^2.5.1",
45
+ "nanoid": "^3.3.3",
46
+ "path-to-regexp": "^6.2.0",
47
+ "selfsigned": "^2.0.1",
48
+ "semiver": "^1.1.0",
49
+ "xxhash-wasm": "^1.0.1"
50
+ },
51
+ "optionalDependencies": {
52
+ "fsevents": "~2.3.2"
53
+ },
54
+ "devDependencies": {
55
+ "@iarna/toml": "^3.0.0",
56
+ "@types/command-exists": "^1.2.0",
57
+ "@types/glob-to-regexp": "0.4.1",
58
+ "@types/mime": "^2.0.3",
59
+ "@types/prompts": "^2.0.14",
60
+ "@types/react": "^17.0.37",
61
+ "@types/serve-static": "^1.13.10",
62
+ "@types/signal-exit": "^3.0.1",
63
+ "@types/supports-color": "^8.1.1",
64
+ "@types/ws": "^8.5.3",
65
+ "@types/yargs": "^17.0.10",
66
+ "@webcontainer/env": "^1.0.1",
67
+ "chokidar": "^3.5.3",
68
+ "clipboardy": "^3.0.0",
69
+ "cmd-shim": "^4.1.0",
70
+ "command-exists": "^1.2.9",
71
+ "concurrently": "^7.2.2",
72
+ "devtools-protocol": "^0.0.955664",
73
+ "dotenv": "^16.0.0",
74
+ "execa": "^6.1.0",
75
+ "faye-websocket": "^0.11.4",
76
+ "finalhandler": "^1.2.0",
77
+ "find-up": "^6.3.0",
78
+ "get-port": "^6.1.2",
79
+ "glob-to-regexp": "0.4.1",
80
+ "http-terminator": "^3.2.0",
81
+ "ignore": "^5.2.0",
82
+ "ink": "^3.2.0",
83
+ "ink-select-input": "^4.2.1",
84
+ "ink-spinner": "^4.0.3",
85
+ "ink-table": "^3.0.0",
86
+ "ink-testing-library": "^2.1.0",
87
+ "ink-text-input": "^4.0.3",
88
+ "jest-fetch-mock": "^3.0.3",
89
+ "jest-websocket-mock": "^2.3.0",
90
+ "mime": "^3.0.0",
91
+ "open": "^8.4.0",
92
+ "p-queue": "^7.2.0",
93
+ "pretty-bytes": "^6.0.0",
94
+ "prompts": "^2.4.2",
95
+ "react": "^17.0.2",
96
+ "react-error-boundary": "^3.1.4",
97
+ "serve-static": "^1.15.0",
98
+ "signal-exit": "^3.0.7",
99
+ "supports-color": "^9.2.2",
100
+ "timeago.js": "^4.0.2",
101
+ "tmp-promise": "^3.0.3",
102
+ "ts-dedent": "^2.2.0",
103
+ "undici": "^5.5.1",
104
+ "update-check": "^1.5.4",
105
+ "ws": "^8.5.0",
106
+ "yargs": "^17.4.1"
107
+ },
108
+ "files": [
109
+ "src",
110
+ "bin",
111
+ "miniflare-config-stubs",
112
+ "miniflare-dist",
113
+ "wrangler-dist",
114
+ "templates",
115
+ "vendor",
116
+ "import_meta_url.js",
117
+ "kv-asset-handler.js",
118
+ "Cloudflare_CA.pem"
119
+ ],
120
+ "scripts": {
121
+ "clean": "rm -rf wrangler-dist miniflare-dist",
122
+ "check:type": "tsc",
123
+ "bundle": "node -r esbuild-register scripts/bundle.ts",
124
+ "build": "npm run clean && npm run bundle",
125
+ "dev": "npm run clean && concurrently -c black,blue 'npm run bundle -- --watch' 'npm run check:type -- --watch --preserveWatchOutput'",
126
+ "prepublishOnly": "SOURCEMAPS=false npm run build",
127
+ "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
128
+ "test": "jest --silent=false --verbose=true",
129
+ "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
130
+ },
131
+ "engines": {
132
+ "node": ">=16.7.0"
133
+ },
134
+ "jest": {
135
+ "restoreMocks": true,
136
+ "testTimeout": 30000,
137
+ "testRegex": ".*.(test|spec)\\.[jt]sx?$",
138
+ "transformIgnorePatterns": [
139
+ "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)"
140
+ ],
141
+ "moduleNameMapper": {
142
+ "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
143
+ "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
144
+ },
145
+ "transform": {
146
+ "^.+\\.c?(t|j)sx?$": [
147
+ "esbuild-jest",
148
+ {
149
+ "sourcemap": true
150
+ }
151
+ ]
152
+ },
153
+ "setupFilesAfterEnv": [
154
+ "<rootDir>/src/__tests__/jest.setup.ts"
155
+ ]
156
+ }
157
157
  }
@@ -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
  });