wrangler 0.0.0-ea7ee45 → 0.0.0-ea968c81
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.
- package/bin/wrangler.js +42 -8
- package/miniflare-dist/index.mjs +465 -4
- package/package.json +80 -64
- package/src/__tests__/config-cache-without-cache-dir.test.ts +38 -0
- package/src/__tests__/config-cache.test.ts +6 -0
- package/src/__tests__/configuration.test.ts +151 -29
- package/src/__tests__/dev.test.tsx +137 -7
- package/src/__tests__/helpers/mock-cfetch.ts +54 -2
- package/src/__tests__/helpers/mock-istty.ts +1 -1
- package/src/__tests__/helpers/run-in-tmp.ts +22 -23
- package/src/__tests__/https-options.test.ts +51 -18
- package/src/__tests__/index.test.ts +25 -22
- package/src/__tests__/jest.setup.ts +20 -1
- package/src/__tests__/kv.test.ts +115 -63
- package/src/__tests__/metrics.test.ts +445 -0
- package/src/__tests__/pages.test.ts +15 -8
- package/src/__tests__/publish.test.ts +483 -207
- package/src/__tests__/pubsub.test.ts +91 -0
- package/src/__tests__/r2.test.ts +155 -71
- package/src/__tests__/secret.test.ts +84 -78
- package/src/__tests__/tail.test.ts +8 -0
- package/src/__tests__/test-old-node-version.js +31 -0
- package/src/__tests__/user.test.ts +11 -11
- package/src/__tests__/version.test.ts +35 -0
- package/src/__tests__/whoami.test.tsx +11 -3
- package/src/api/dev.ts +60 -12
- package/src/bundle.ts +195 -37
- package/src/cfetch/internal.ts +67 -21
- package/src/cli.ts +2 -2
- package/src/config/config.ts +15 -0
- package/src/config/environment.ts +43 -0
- package/src/config/index.ts +29 -0
- package/src/config/validation.ts +123 -1
- package/src/config-cache.ts +71 -31
- package/src/create-worker-preview.ts +3 -1
- package/src/create-worker-upload-form.ts +18 -0
- package/src/d1/backups.tsx +196 -0
- package/src/d1/create.tsx +49 -0
- package/src/d1/delete.tsx +49 -0
- package/src/d1/execute.tsx +134 -0
- package/src/d1/index.ts +72 -0
- package/src/d1/list.tsx +57 -0
- package/src/d1/types.tsx +14 -0
- package/src/dev/dev.tsx +81 -23
- package/src/dev/local.tsx +53 -25
- package/src/dev/remote.tsx +25 -10
- package/src/dev/use-esbuild.ts +14 -7
- package/src/dev.tsx +115 -41
- package/src/entry.ts +1 -1
- package/src/{__tests__/helpers/faye-websocket.d.ts → faye-websocket.d.ts} +0 -0
- package/src/formatTimeAgo.ts +14 -0
- package/src/global-wrangler-config-path.ts +26 -0
- package/src/https-options.ts +8 -4
- package/src/index.tsx +357 -49
- package/src/is-interactive.ts +12 -0
- package/src/kv.ts +23 -1
- package/src/metrics/index.ts +4 -0
- package/src/metrics/is-ci.ts +14 -0
- package/src/metrics/metrics-config.ts +239 -0
- package/src/metrics/metrics-dispatcher.ts +95 -0
- package/src/metrics/send-event.ts +92 -0
- package/src/miniflare-cli/assets.ts +543 -0
- package/src/miniflare-cli/index.ts +37 -4
- package/src/package-manager.ts +45 -0
- package/src/pages/build.tsx +2 -0
- package/src/pages/deployments.tsx +6 -1
- package/src/pages/dev.tsx +90 -637
- package/src/pages/projects.tsx +7 -1
- package/src/pages/publish.tsx +3 -0
- package/src/pages/upload.tsx +26 -14
- package/src/publish.ts +153 -123
- package/src/pubsub/pubsub-commands.tsx +434 -405
- package/src/r2.ts +68 -0
- package/src/user/choose-account.tsx +22 -13
- package/src/user/user.tsx +85 -43
- package/src/whoami.tsx +2 -1
- package/src/worker-namespace.ts +16 -0
- package/src/worker.ts +29 -0
- package/templates/d1-beta-facade.js +170 -0
- package/templates/format-dev-errors.ts +32 -0
- package/templates/pages-shim.ts +9 -0
- package/templates/serve-static-assets.ts +61 -0
- package/templates/tsconfig.json +2 -2
- package/wrangler-dist/cli.d.ts +328 -0
- package/wrangler-dist/cli.js +30103 -30814
- package/templates/static-asset-facade.js +0 -43
package/bin/wrangler.js
CHANGED
|
@@ -3,9 +3,12 @@ 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";
|
|
8
|
+
const debug =
|
|
9
|
+
process.env["WRANGLER_LOG"] === "debug"
|
|
10
|
+
? (...args) => console.log(...args)
|
|
11
|
+
: () => {};
|
|
9
12
|
|
|
10
13
|
let wranglerProcess;
|
|
11
14
|
|
|
@@ -17,8 +20,8 @@ function runWrangler() {
|
|
|
17
20
|
// Note Volta and nvm are also recommended in the official docs:
|
|
18
21
|
// https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
|
|
19
22
|
console.error(
|
|
20
|
-
`Wrangler requires at least
|
|
21
|
-
|
|
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
|
+
|
|
22
25
|
Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
|
|
23
26
|
);
|
|
24
27
|
process.exitCode = 1;
|
|
@@ -84,9 +87,8 @@ function runDelegatedWrangler() {
|
|
|
84
87
|
} = JSON.parse(fs.readFileSync(packageJsonPath));
|
|
85
88
|
const resolvedBinaryPath = path.resolve(packageJsonPath, "..", binaryPath);
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
);
|
|
90
|
+
debug(`Delegating to locally-installed version of wrangler @ v${version}`);
|
|
91
|
+
|
|
90
92
|
// this call to `spawn` is simpler because the delegated version will do all
|
|
91
93
|
// of the other work.
|
|
92
94
|
return spawn(
|
|
@@ -125,10 +127,42 @@ async function main() {
|
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
process.on("SIGINT", () => {
|
|
128
|
-
wranglerProcess
|
|
130
|
+
wranglerProcess && wranglerProcess.kill();
|
|
129
131
|
});
|
|
130
132
|
process.on("SIGTERM", () => {
|
|
131
|
-
wranglerProcess
|
|
133
|
+
wranglerProcess && wranglerProcess.kill();
|
|
132
134
|
});
|
|
133
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
|
+
|
|
134
168
|
void main();
|