wrangler 0.0.0-eab9542 → 0.0.0-ebc1aa57
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 +37 -6
- package/miniflare-dist/index.mjs +464 -4
- package/package.json +77 -64
- package/src/__tests__/configuration.test.ts +74 -14
- package/src/__tests__/dev.test.tsx +139 -4
- package/src/__tests__/helpers/mock-cfetch.ts +54 -2
- 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 +23 -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 +498 -273
- 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 +7 -7
- package/src/__tests__/version.test.ts +35 -0
- package/src/__tests__/whoami.test.tsx +11 -1
- package/src/api/dev.ts +43 -9
- package/src/bundle.ts +229 -38
- package/src/cfetch/internal.ts +34 -2
- package/src/cli.ts +1 -1
- package/src/config/config.ts +22 -2
- package/src/config/environment.ts +10 -8
- package/src/config/validation.ts +68 -8
- package/src/config-cache.ts +2 -1
- package/src/create-worker-preview.ts +3 -1
- package/src/dev/dev.tsx +155 -21
- package/src/dev/local.tsx +56 -23
- package/src/dev/remote.tsx +35 -13
- package/src/dev/use-esbuild.ts +17 -0
- package/src/dev-registry.tsx +157 -0
- package/src/dev.tsx +90 -29
- package/src/entry.ts +1 -1
- package/src/{__tests__/helpers/faye-websocket.d.ts → faye-websocket.d.ts} +0 -0
- package/src/global-wrangler-config-path.ts +26 -0
- package/src/https-options.ts +8 -4
- package/src/index.tsx +332 -26
- 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 +36 -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 +82 -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 +154 -120
- package/src/pubsub/pubsub-commands.tsx +46 -0
- package/src/r2.ts +68 -0
- package/src/user/choose-account.tsx +20 -11
- package/src/user/user.tsx +31 -21
- package/src/whoami.tsx +2 -1
- package/src/worker-namespace.ts +16 -0
- package/templates/format-dev-errors.ts +32 -0
- package/templates/pages-shim.ts +9 -0
- package/templates/serve-static-assets.ts +63 -0
- package/templates/service-bindings-module-facade.js +49 -0
- package/templates/service-bindings-sw-facade.js +39 -0
- package/templates/tsconfig.json +2 -2
- package/wrangler-dist/cli.d.ts +327 -0
- package/wrangler-dist/cli.js +39568 -22348
- package/templates/static-asset-facade.js +0 -43
package/bin/wrangler.js
CHANGED
|
@@ -3,7 +3,6 @@ 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";
|
|
9
8
|
const debug =
|
|
@@ -21,8 +20,8 @@ function runWrangler() {
|
|
|
21
20
|
// Note Volta and nvm are also recommended in the official docs:
|
|
22
21
|
// https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
|
|
23
22
|
console.error(
|
|
24
|
-
`Wrangler requires at least
|
|
25
|
-
|
|
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
|
+
|
|
26
25
|
Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
|
|
27
26
|
);
|
|
28
27
|
process.exitCode = 1;
|
|
@@ -36,7 +35,7 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
36
35
|
// - maybe we can generate a certificate that concatenates with ours?
|
|
37
36
|
//
|
|
38
37
|
// I do think it'll be rare that someone wants to add a cert AND
|
|
39
|
-
// use
|
|
38
|
+
// use Cloudflare WARP, but let's wait till the situation actually
|
|
40
39
|
// arises before we do anything about it
|
|
41
40
|
} else {
|
|
42
41
|
const osTempDir = os.tmpdir();
|
|
@@ -128,10 +127,42 @@ async function main() {
|
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
process.on("SIGINT", () => {
|
|
131
|
-
wranglerProcess
|
|
130
|
+
wranglerProcess && wranglerProcess.kill();
|
|
132
131
|
});
|
|
133
132
|
process.on("SIGTERM", () => {
|
|
134
|
-
wranglerProcess
|
|
133
|
+
wranglerProcess && wranglerProcess.kill();
|
|
135
134
|
});
|
|
136
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
|
+
|
|
137
168
|
void main();
|