wrangler 0.0.0-eb22835 → 0.0.0-ecfbb0c

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 (147) hide show
  1. package/README.md +7 -1
  2. package/bin/wrangler.js +111 -57
  3. package/miniflare-dist/index.mjs +9 -2
  4. package/package.json +156 -154
  5. package/src/__tests__/config-cache.test.ts +24 -24
  6. package/src/__tests__/configuration.test.ts +3818 -3476
  7. package/src/__tests__/dev.test.tsx +1128 -979
  8. package/src/__tests__/guess-worker-format.test.ts +68 -68
  9. package/src/__tests__/helpers/cmd-shim.d.ts +6 -6
  10. package/src/__tests__/helpers/faye-websocket.d.ts +4 -4
  11. package/src/__tests__/helpers/mock-account-id.ts +24 -24
  12. package/src/__tests__/helpers/mock-bin.ts +20 -20
  13. package/src/__tests__/helpers/mock-cfetch.ts +92 -92
  14. package/src/__tests__/helpers/mock-console.ts +49 -39
  15. package/src/__tests__/helpers/mock-dialogs.ts +94 -71
  16. package/src/__tests__/helpers/mock-http-server.ts +30 -30
  17. package/src/__tests__/helpers/mock-istty.ts +65 -18
  18. package/src/__tests__/helpers/mock-kv.ts +26 -26
  19. package/src/__tests__/helpers/mock-oauth-flow.ts +223 -228
  20. package/src/__tests__/helpers/mock-process.ts +39 -0
  21. package/src/__tests__/helpers/mock-stdin.ts +82 -77
  22. package/src/__tests__/helpers/mock-web-socket.ts +21 -21
  23. package/src/__tests__/helpers/run-in-tmp.ts +27 -27
  24. package/src/__tests__/helpers/run-wrangler.ts +8 -8
  25. package/src/__tests__/helpers/write-worker-source.ts +16 -16
  26. package/src/__tests__/helpers/write-wrangler-toml.ts +9 -9
  27. package/src/__tests__/https-options.test.ts +104 -104
  28. package/src/__tests__/index.test.ts +93 -90
  29. package/src/__tests__/init.test.ts +1605 -1250
  30. package/src/__tests__/jest.setup.ts +58 -58
  31. package/src/__tests__/kv.test.ts +1128 -990
  32. package/src/__tests__/logger.test.ts +100 -74
  33. package/src/__tests__/package-manager.test.ts +303 -303
  34. package/src/__tests__/pages.test.ts +1152 -652
  35. package/src/__tests__/parse.test.ts +252 -252
  36. package/src/__tests__/publish.test.ts +6315 -5623
  37. package/src/__tests__/pubsub.test.ts +276 -0
  38. package/src/__tests__/r2.test.ts +133 -133
  39. package/src/__tests__/route.test.ts +18 -18
  40. package/src/__tests__/secret.test.ts +382 -377
  41. package/src/__tests__/tail.test.ts +530 -530
  42. package/src/__tests__/user.test.ts +122 -111
  43. package/src/__tests__/whoami.test.tsx +198 -117
  44. package/src/abort.d.ts +1 -1
  45. package/src/api/dev.ts +39 -0
  46. package/src/api/index.ts +1 -0
  47. package/src/bundle-reporter.tsx +29 -0
  48. package/src/bundle.ts +157 -149
  49. package/src/cfetch/index.ts +80 -80
  50. package/src/cfetch/internal.ts +90 -83
  51. package/src/cli.ts +21 -7
  52. package/src/config/config.ts +204 -195
  53. package/src/config/diagnostics.ts +61 -61
  54. package/src/config/environment.ts +367 -357
  55. package/src/config/index.ts +193 -193
  56. package/src/config/validation-helpers.ts +366 -366
  57. package/src/config/validation.ts +1521 -1376
  58. package/src/config-cache.ts +24 -25
  59. package/src/create-worker-preview.ts +143 -129
  60. package/src/create-worker-upload-form.ts +238 -238
  61. package/src/dev/dev-vars.ts +13 -13
  62. package/src/dev/dev.tsx +329 -307
  63. package/src/dev/local.tsx +304 -275
  64. package/src/dev/remote.tsx +275 -221
  65. package/src/dev/use-esbuild.ts +126 -91
  66. package/src/dev.tsx +526 -0
  67. package/src/dialogs.tsx +97 -97
  68. package/src/durable.ts +87 -87
  69. package/src/entry.ts +234 -228
  70. package/src/environment-variables.ts +23 -23
  71. package/src/errors.ts +6 -6
  72. package/src/generate.ts +33 -0
  73. package/src/git-client.ts +42 -0
  74. package/src/https-options.ts +79 -79
  75. package/src/index.tsx +1766 -2762
  76. package/src/init.ts +549 -0
  77. package/src/inspect.ts +593 -593
  78. package/src/intl-polyfill.d.ts +123 -123
  79. package/src/kv.ts +277 -277
  80. package/src/logger.ts +46 -39
  81. package/src/miniflare-cli/enum-keys.ts +8 -8
  82. package/src/miniflare-cli/index.ts +42 -31
  83. package/src/miniflare-cli/request-context.ts +18 -18
  84. package/src/module-collection.ts +212 -212
  85. package/src/open-in-browser.ts +4 -4
  86. package/src/package-manager.ts +123 -123
  87. package/src/pages/build.tsx +202 -0
  88. package/src/pages/constants.ts +7 -0
  89. package/src/pages/deployments.tsx +101 -0
  90. package/src/pages/dev.tsx +964 -0
  91. package/src/pages/functions/buildPlugin.ts +105 -0
  92. package/src/pages/functions/buildWorker.ts +151 -0
  93. package/{pages → src/pages}/functions/filepath-routing.test.ts +113 -113
  94. package/src/pages/functions/filepath-routing.ts +189 -0
  95. package/src/pages/functions/identifiers.ts +78 -0
  96. package/src/pages/functions/routes.ts +151 -0
  97. package/src/pages/index.tsx +84 -0
  98. package/src/pages/projects.tsx +157 -0
  99. package/src/pages/publish.tsx +335 -0
  100. package/src/pages/types.ts +40 -0
  101. package/src/pages/upload.tsx +384 -0
  102. package/src/pages/utils.ts +12 -0
  103. package/src/parse.ts +208 -125
  104. package/src/paths.ts +6 -6
  105. package/src/preview.ts +31 -0
  106. package/src/proxy.ts +400 -402
  107. package/src/publish.ts +666 -621
  108. package/src/pubsub/index.ts +286 -0
  109. package/src/pubsub/pubsub-commands.tsx +594 -0
  110. package/src/r2.ts +19 -19
  111. package/src/selfsigned.d.ts +23 -23
  112. package/src/sites.tsx +271 -225
  113. package/src/tail/filters.ts +108 -108
  114. package/src/tail/index.ts +217 -217
  115. package/src/tail/printing.ts +45 -45
  116. package/src/update-check.ts +11 -11
  117. package/src/user/choose-account.tsx +60 -0
  118. package/src/user/env-vars.ts +46 -0
  119. package/src/user/generate-auth-url.ts +33 -0
  120. package/src/user/generate-random-state.ts +16 -0
  121. package/src/user/index.ts +3 -0
  122. package/src/user/user.tsx +1130 -0
  123. package/src/whoami.tsx +61 -42
  124. package/src/worker.ts +104 -100
  125. package/src/zones.ts +39 -36
  126. package/templates/checked-fetch.js +17 -0
  127. package/templates/new-worker-scheduled.js +3 -3
  128. package/templates/new-worker-scheduled.ts +15 -15
  129. package/templates/new-worker.js +3 -3
  130. package/templates/new-worker.ts +15 -15
  131. package/templates/no-op-worker.js +10 -0
  132. package/templates/pages-template-plugin.ts +155 -0
  133. package/templates/pages-template-worker.ts +161 -0
  134. package/templates/static-asset-facade.js +31 -31
  135. package/templates/tsconfig.json +95 -95
  136. package/wrangler-dist/cli.js +73521 -72554
  137. package/pages/functions/buildPlugin.ts +0 -105
  138. package/pages/functions/buildWorker.ts +0 -151
  139. package/pages/functions/filepath-routing.ts +0 -189
  140. package/pages/functions/identifiers.ts +0 -78
  141. package/pages/functions/routes.ts +0 -156
  142. package/pages/functions/template-plugin.ts +0 -147
  143. package/pages/functions/template-worker.ts +0 -143
  144. package/src/generate-auth-url.ts +0 -33
  145. package/src/generate-random-state.ts +0 -16
  146. package/src/pages.tsx +0 -2093
  147. package/src/user.tsx +0 -1202
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
@@ -9,72 +9,126 @@ const MIN_NODE_VERSION = "16.7.0";
9
9
 
10
10
  let wranglerProcess;
11
11
 
12
- async function main() {
13
- if (semiver(process.versions.node, MIN_NODE_VERSION) < 0) {
14
- // Note Volta and nvm are also recommended in the official docs:
15
- // https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
16
- console.error(
17
- `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}.
18
21
  You should use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8.
19
22
  Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
20
- );
21
- process.exitCode = 1;
22
- return;
23
- }
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
+ }
24
51
 
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
- }
52
+ return spawn(
53
+ process.execPath,
54
+ [
55
+ "--no-warnings",
56
+ "--experimental-vm-modules",
57
+ ...process.execArgv,
58
+ path.join(__dirname, "../wrangler-dist/cli.js"),
59
+ ...process.argv.slice(2),
60
+ ],
61
+ {
62
+ stdio: "inherit",
63
+ env: {
64
+ ...process.env,
65
+ NODE_EXTRA_CA_CERTS: pathToCACerts,
66
+ },
67
+ }
68
+ ).on("exit", (code) =>
69
+ process.exit(code === undefined || code === null ? 0 : code)
70
+ );
71
+ }
48
72
 
49
- wranglerProcess = spawn(
50
- process.execPath,
51
- [
52
- ...(semiver(process.versions.node, "18.0.0") >= 0
53
- ? ["--no-experimental-fetch"] // TODO: remove this when https://github.com/cloudflare/wrangler2/issues/834 is properly fixed
54
- : []),
55
- "--no-warnings",
56
- "--experimental-vm-modules",
57
- ...process.execArgv,
58
- path.join(__dirname, "../wrangler-dist/cli.js"),
59
- ...process.argv.slice(2),
60
- ],
61
- {
62
- stdio: "inherit",
63
- env: {
64
- ...process.env,
65
- NODE_EXTRA_CA_CERTS: pathToCACerts,
66
- },
67
- }
68
- ).on("exit", (code) =>
69
- process.exit(code === undefined || code === null ? 0 : code)
70
- );
73
+ /**
74
+ * Runs a locally-installed version of wrangler, delegating from this version.
75
+ * @throws {MODULE_NOT_FOUND} if there isn't a locally installed version of wrangler.
76
+ */
77
+ function runDelegatedWrangler() {
78
+ const packageJsonPath = require.resolve("wrangler/package.json", {
79
+ paths: [process.cwd()],
80
+ });
81
+ const {
82
+ bin: { wrangler: binaryPath },
83
+ version,
84
+ } = JSON.parse(fs.readFileSync(packageJsonPath));
85
+ const resolvedBinaryPath = path.resolve(packageJsonPath, "..", binaryPath);
86
+
87
+ console.log(
88
+ `Delegating to locally-installed version of wrangler @ v${version}`
89
+ );
90
+ // this call to `spawn` is simpler because the delegated version will do all
91
+ // of the other work.
92
+ return spawn(
93
+ process.execPath,
94
+ [resolvedBinaryPath, ...process.argv.slice(2)],
95
+ {
96
+ stdio: "inherit",
97
+ }
98
+ ).on("exit", (code) =>
99
+ process.exit(code === undefined || code === null ? 0 : code)
100
+ );
101
+ }
102
+
103
+ /**
104
+ * Indicates if this invocation of `wrangler` should delegate
105
+ * to a locally-installed version.
106
+ */
107
+ function shouldDelegate() {
108
+ try {
109
+ // `require.resolve` will throw if it can't find
110
+ // a locally-installed version of `wrangler`
111
+ const delegatedPackageJson = require.resolve("wrangler/package.json", {
112
+ paths: [process.cwd()],
113
+ });
114
+ const thisPackageJson = path.resolve(__dirname, "..", "package.json");
115
+ // if it's the same path, then we're already a local install -- no need to delegate
116
+ return thisPackageJson !== delegatedPackageJson;
117
+ } catch (e) {
118
+ // there's no local version to delegate to -- `require.resolve` threw
119
+ return false;
120
+ }
121
+ }
122
+
123
+ async function main() {
124
+ wranglerProcess = shouldDelegate() ? runDelegatedWrangler() : runWrangler();
71
125
  }
72
126
 
73
127
  process.on("SIGINT", () => {
74
- wranglerProcess.kill();
128
+ wranglerProcess?.kill();
75
129
  });
76
130
  process.on("SIGTERM", () => {
77
- wranglerProcess.kill();
131
+ wranglerProcess?.kill();
78
132
  });
79
133
 
80
134
  void main();
@@ -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,156 +1,158 @@
1
1
  {
2
- "name": "wrangler",
3
- "version": "0.0.0-eb22835",
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.0",
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
- "devtools-protocol": "^0.0.955664",
72
- "dotenv": "^16.0.0",
73
- "execa": "^6.1.0",
74
- "faye-websocket": "^0.11.4",
75
- "finalhandler": "^1.2.0",
76
- "find-up": "^6.3.0",
77
- "get-port": "^6.1.2",
78
- "glob-to-regexp": "0.4.1",
79
- "http-terminator": "^3.2.0",
80
- "ignore": "^5.2.0",
81
- "ink": "^3.2.0",
82
- "ink-select-input": "^4.2.1",
83
- "ink-spinner": "^4.0.3",
84
- "ink-table": "^3.0.0",
85
- "ink-testing-library": "^2.1.0",
86
- "ink-text-input": "^4.0.3",
87
- "jest-fetch-mock": "^3.0.3",
88
- "jest-websocket-mock": "^2.3.0",
89
- "mime": "^3.0.0",
90
- "open": "^8.4.0",
91
- "p-queue": "^7.2.0",
92
- "pretty-bytes": "^6.0.0",
93
- "prompts": "^2.4.2",
94
- "react": "^17.0.2",
95
- "react-error-boundary": "^3.1.4",
96
- "serve-static": "^1.15.0",
97
- "signal-exit": "^3.0.7",
98
- "supports-color": "^9.2.2",
99
- "timeago.js": "^4.0.2",
100
- "tmp-promise": "^3.0.3",
101
- "ts-dedent": "^2.2.0",
102
- "undici": "^5.5.1",
103
- "update-check": "^1.5.4",
104
- "ws": "^8.5.0",
105
- "yargs": "^17.4.1"
106
- },
107
- "files": [
108
- "src",
109
- "bin",
110
- "pages",
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
- "prepublishOnly": "SOURCEMAPS=false npm run build",
126
- "start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
127
- "test": "jest --silent=false --verbose=true",
128
- "test-watch": "npm run test -- --runInBand --testTimeout=50000 --watch"
129
- },
130
- "engines": {
131
- "node": ">=16.7.0"
132
- },
133
- "jest": {
134
- "restoreMocks": true,
135
- "testTimeout": 30000,
136
- "testRegex": ".*.(test|spec)\\.[jt]sx?$",
137
- "transformIgnorePatterns": [
138
- "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)"
139
- ],
140
- "moduleNameMapper": {
141
- "clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
142
- "miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
143
- },
144
- "transform": {
145
- "^.+\\.c?(t|j)sx?$": [
146
- "esbuild-jest",
147
- {
148
- "sourcemap": true
149
- }
150
- ]
151
- },
152
- "setupFilesAfterEnv": [
153
- "<rootDir>/src/__tests__/jest.setup.ts"
154
- ]
155
- }
2
+ "name": "wrangler",
3
+ "version": "0.0.0-ecfbb0c",
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
+ }
156
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
  });