wrangler 2.0.25 → 2.0.28
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 +1 -1
- package/miniflare-dist/index.mjs +15 -3
- package/package.json +8 -6
- package/src/__tests__/configuration.test.ts +33 -29
- package/src/__tests__/dev.test.tsx +8 -6
- package/src/__tests__/generate.test.ts +2 -4
- package/src/__tests__/helpers/mock-cfetch.ts +33 -0
- package/src/__tests__/helpers/mock-get-zone-from-host.ts +8 -0
- package/src/__tests__/helpers/mock-known-routes.ts +7 -0
- package/src/__tests__/index.test.ts +30 -30
- package/src/__tests__/init.test.ts +537 -359
- package/src/__tests__/jest.setup.ts +7 -0
- package/src/__tests__/metrics.test.ts +1 -1
- package/src/__tests__/pages.test.ts +14 -0
- package/src/__tests__/publish.test.ts +59 -18
- package/src/__tests__/r2.test.ts +4 -3
- package/src/__tests__/tail.test.ts +53 -3
- package/src/__tests__/test-old-node-version.js +3 -3
- package/src/__tests__/user.test.ts +11 -0
- package/src/__tests__/worker-namespace.test.ts +37 -35
- package/src/api/dev.ts +1 -0
- package/src/bundle.ts +1 -1
- package/src/cfetch/internal.ts +118 -1
- package/src/config/environment.ts +1 -1
- package/src/config/index.ts +4 -4
- package/src/config/validation-helpers.ts +19 -6
- package/src/config/validation.ts +11 -5
- package/src/config-cache.ts +2 -1
- package/src/create-worker-upload-form.ts +29 -26
- package/src/dev/dev.tsx +4 -0
- package/src/dev/remote.tsx +10 -1
- package/src/dev.tsx +36 -8
- package/src/{worker-namespace.ts → dispatch-namespace.ts} +18 -18
- package/src/generate.ts +1 -1
- package/src/index.tsx +54 -8
- package/src/init.ts +111 -38
- package/src/{metrics/is-ci.ts → is-ci.ts} +0 -0
- package/src/metrics/metrics-config.ts +1 -1
- package/src/metrics/send-event.ts +5 -5
- package/src/miniflare-cli/assets.ts +8 -0
- package/src/miniflare-cli/index.ts +6 -3
- package/src/pages/build.tsx +41 -15
- package/src/pages/constants.ts +1 -0
- package/src/pages/dev.tsx +93 -37
- package/src/pages/errors.ts +22 -0
- package/src/pages/functions/routes-consolidation.test.ts +185 -1
- package/src/pages/functions/routes-consolidation.ts +46 -2
- package/src/pages/functions/routes-transformation.ts +0 -3
- package/src/pages/functions.tsx +96 -0
- package/src/pages/index.tsx +65 -55
- package/src/pages/publish.tsx +27 -16
- package/src/proxy.ts +10 -0
- package/src/publish.ts +19 -4
- package/src/r2.ts +4 -4
- package/src/tail/filters.ts +3 -1
- package/src/tail/printing.ts +2 -0
- package/src/user/user.tsx +6 -4
- package/src/whoami.tsx +5 -5
- package/src/worker.ts +3 -2
- package/src/zones.ts +91 -0
- package/templates/pages-template-plugin.ts +16 -4
- package/templates/pages-template-worker.ts +16 -5
- package/templates/service-bindings-module-facade.js +10 -7
- package/templates/service-bindings-sw-facade.js +10 -7
- package/wrangler-dist/cli.d.ts +8 -3
- package/wrangler-dist/cli.js +6757 -1639
|
@@ -7,20 +7,23 @@ for (const [name, details] of Object.entries(Workers)) {
|
|
|
7
7
|
if (details) {
|
|
8
8
|
globalThis[name] = {
|
|
9
9
|
async fetch(...reqArgs) {
|
|
10
|
+
const reqFromArgs = new Request(...reqArgs);
|
|
10
11
|
if (details.headers) {
|
|
11
|
-
const req = new Request(...reqArgs);
|
|
12
12
|
for (const [key, value] of Object.entries(details.headers)) {
|
|
13
13
|
// In remote mode, you need to add a couple of headers
|
|
14
14
|
// to make sure it's talking to the 'dev' preview session
|
|
15
15
|
// (much like wrangler dev already does via proxy.ts)
|
|
16
|
-
|
|
16
|
+
reqFromArgs.headers.set(key, value);
|
|
17
17
|
}
|
|
18
|
-
return env[name].fetch(
|
|
18
|
+
return env[name].fetch(reqFromArgs);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
|
|
21
|
+
const url = new URL(reqFromArgs.url);
|
|
22
|
+
url.protocol = details.protocol;
|
|
23
|
+
url.host = details.host;
|
|
24
|
+
if (details.port !== undefined) url.port = details.port;
|
|
25
|
+
|
|
26
|
+
const request = new Request(url.toString(), reqFromArgs);
|
|
24
27
|
return fetch(request);
|
|
25
28
|
},
|
|
26
29
|
};
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import { Blob as Blob_2 } from 'buffer';
|
|
4
|
-
import { BlobOptions } from 'buffer';
|
|
5
4
|
import Dispatcher = require('./dispatcher');
|
|
6
5
|
import { ReadableStream } from 'stream/web';
|
|
7
6
|
import { URL as URL_2 } from 'url';
|
|
8
7
|
import { URLSearchParams as URLSearchParams_2 } from 'url';
|
|
9
8
|
|
|
9
|
+
declare interface BlobPropertyBag {
|
|
10
|
+
type?: string
|
|
11
|
+
endings?: 'native' | 'transparent'
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
declare type BodyInit =
|
|
11
15
|
| ArrayBuffer
|
|
12
16
|
| AsyncIterable<Uint8Array>
|
|
@@ -41,6 +45,7 @@ declare interface DevOptions {
|
|
|
41
45
|
siteExclude?: string[];
|
|
42
46
|
nodeCompat?: boolean;
|
|
43
47
|
compatibilityDate?: string;
|
|
48
|
+
compatibilityFlags?: string[];
|
|
44
49
|
experimentalEnableLocalPersistence?: boolean;
|
|
45
50
|
liveReload?: boolean;
|
|
46
51
|
watch?: boolean;
|
|
@@ -86,7 +91,7 @@ declare class File extends Blob_2 {
|
|
|
86
91
|
* @param fileName The name of the file.
|
|
87
92
|
* @param options An options object containing optional attributes for the file.
|
|
88
93
|
*/
|
|
89
|
-
constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?:
|
|
94
|
+
constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
|
|
90
95
|
|
|
91
96
|
/**
|
|
92
97
|
* Name of the file referenced by the File object.
|
|
@@ -101,7 +106,7 @@ declare class File extends Blob_2 {
|
|
|
101
106
|
readonly [Symbol.toStringTag]: string
|
|
102
107
|
}
|
|
103
108
|
|
|
104
|
-
declare interface
|
|
109
|
+
declare interface FilePropertyBag extends BlobPropertyBag {
|
|
105
110
|
/**
|
|
106
111
|
* The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
|
|
107
112
|
*/
|