wrangler 2.0.27 → 2.1.0
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 +1141 -369
- package/package.json +6 -4
- package/src/__tests__/api-dev.test.ts +19 -0
- package/src/__tests__/configuration.test.ts +27 -27
- package/src/__tests__/dev.test.tsx +8 -6
- package/src/__tests__/helpers/hello-world-worker.js +5 -0
- package/src/__tests__/helpers/mock-cfetch.ts +4 -4
- package/src/__tests__/helpers/mock-console.ts +11 -2
- 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 +37 -37
- package/src/__tests__/init.test.ts +356 -5
- package/src/__tests__/jest.setup.ts +13 -0
- package/src/__tests__/middleware.test.ts +768 -0
- package/src/__tests__/pages.test.ts +829 -104
- package/src/__tests__/paths.test.ts +17 -0
- package/src/__tests__/publish.test.ts +512 -445
- package/src/__tests__/tail.test.ts +79 -72
- package/src/__tests__/test-old-node-version.js +3 -3
- package/src/__tests__/worker-namespace.test.ts +37 -35
- package/src/api/dev.ts +93 -28
- package/src/bundle.ts +239 -12
- package/src/cfetch/internal.ts +64 -3
- package/src/cli.ts +1 -1
- package/src/config/environment.ts +1 -1
- package/src/config/index.ts +4 -4
- package/src/config/validation.ts +3 -3
- package/src/create-worker-upload-form.ts +29 -26
- package/src/dev/dev.tsx +3 -1
- package/src/dev/local.tsx +319 -171
- package/src/dev/remote.tsx +16 -4
- package/src/dev/start-server.ts +416 -0
- package/src/dev/use-esbuild.ts +4 -0
- package/src/dev.tsx +340 -166
- package/src/dialogs.tsx +12 -0
- package/src/{worker-namespace.ts → dispatch-namespace.ts} +18 -18
- package/src/entry.ts +2 -1
- package/src/index.tsx +59 -12
- package/src/init.ts +291 -16
- package/src/metrics/send-event.ts +6 -5
- package/src/miniflare-cli/assets.ts +130 -476
- package/src/miniflare-cli/index.ts +39 -33
- package/src/pages/constants.ts +3 -0
- package/src/pages/dev.tsx +8 -3
- package/src/pages/functions/buildPlugin.ts +2 -1
- package/src/pages/functions/buildWorker.ts +2 -1
- package/src/pages/functions/routes-transformation.test.ts +12 -1
- package/src/pages/functions/routes-transformation.ts +7 -1
- package/src/pages/hash.tsx +13 -0
- package/src/pages/publish.tsx +82 -38
- package/src/pages/upload.tsx +3 -18
- package/src/paths.ts +20 -1
- package/src/publish.ts +49 -8
- package/src/tail/filters.ts +1 -5
- package/src/tail/index.ts +6 -3
- package/src/worker.ts +10 -9
- package/src/zones.ts +91 -0
- package/templates/middleware/common.ts +62 -0
- package/templates/middleware/loader-modules.ts +84 -0
- package/templates/middleware/loader-sw.ts +213 -0
- package/templates/middleware/middleware-pretty-error.ts +40 -0
- package/templates/middleware/middleware-scheduled.ts +14 -0
- package/wrangler-dist/cli.d.ts +22 -8
- package/wrangler-dist/cli.js +71020 -65212
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>
|
|
@@ -29,7 +33,13 @@ declare interface BodyMixin {
|
|
|
29
33
|
readonly text: () => Promise<string>
|
|
30
34
|
}
|
|
31
35
|
|
|
36
|
+
declare interface DevApiOptions {
|
|
37
|
+
testMode?: boolean;
|
|
38
|
+
disableExperimentalWarning?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
declare interface DevOptions {
|
|
42
|
+
config?: string;
|
|
33
43
|
env?: string;
|
|
34
44
|
ip?: string;
|
|
35
45
|
port?: number;
|
|
@@ -45,7 +55,7 @@ declare interface DevOptions {
|
|
|
45
55
|
experimentalEnableLocalPersistence?: boolean;
|
|
46
56
|
liveReload?: boolean;
|
|
47
57
|
watch?: boolean;
|
|
48
|
-
vars
|
|
58
|
+
vars?: {
|
|
49
59
|
[key: string]: unknown;
|
|
50
60
|
};
|
|
51
61
|
kv?: {
|
|
@@ -87,7 +97,7 @@ declare class File extends Blob_2 {
|
|
|
87
97
|
* @param fileName The name of the file.
|
|
88
98
|
* @param options An options object containing optional attributes for the file.
|
|
89
99
|
*/
|
|
90
|
-
constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?:
|
|
100
|
+
constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
|
|
91
101
|
|
|
92
102
|
/**
|
|
93
103
|
* Name of the file referenced by the File object.
|
|
@@ -102,7 +112,7 @@ declare class File extends Blob_2 {
|
|
|
102
112
|
readonly [Symbol.toStringTag]: string
|
|
103
113
|
}
|
|
104
114
|
|
|
105
|
-
declare interface
|
|
115
|
+
declare interface FilePropertyBag extends BlobPropertyBag {
|
|
106
116
|
/**
|
|
107
117
|
* 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.
|
|
108
118
|
*/
|
|
@@ -324,11 +334,15 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
324
334
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
325
335
|
* @param {string} script
|
|
326
336
|
* @param {DevOptions} options
|
|
337
|
+
* @param {DevApiOptions} apiOptions
|
|
338
|
+
* @returns {Promise<UnstableDev>}
|
|
327
339
|
*/
|
|
328
|
-
export declare function unstable_dev(script: string, options
|
|
329
|
-
|
|
330
|
-
|
|
340
|
+
export declare function unstable_dev(script: string, options?: DevOptions, apiOptions?: DevApiOptions): Promise<UnstableDev>;
|
|
341
|
+
|
|
342
|
+
declare interface UnstableDev {
|
|
343
|
+
stop: () => Promise<void>;
|
|
344
|
+
fetch: (init?: RequestInit) => Promise<Response | undefined>;
|
|
331
345
|
waitUntilExit: () => Promise<void>;
|
|
332
|
-
}
|
|
346
|
+
}
|
|
333
347
|
|
|
334
348
|
export { }
|