wrangler 2.0.16 → 2.0.17
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 +6 -3
- package/miniflare-dist/index.mjs +1 -0
- package/package.json +64 -62
- package/src/__tests__/helpers/run-in-tmp.ts +11 -4
- package/src/__tests__/https-options.test.ts +1 -1
- package/src/__tests__/index.test.ts +13 -13
- package/src/__tests__/kv.test.ts +33 -2
- package/src/__tests__/publish.test.ts +12 -22
- package/src/__tests__/secret.test.ts +84 -78
- package/src/__tests__/tail.test.ts +8 -0
- package/src/__tests__/user.test.ts +2 -5
- package/src/__tests__/whoami.test.tsx +11 -1
- package/src/api/dev.ts +4 -1
- package/src/cli.ts +1 -1
- package/src/dev/local.tsx +26 -22
- package/src/dev/remote.tsx +2 -2
- package/src/entry.ts +1 -1
- package/src/{__tests__/helpers/faye-websocket.d.ts → faye-websocket.d.ts} +0 -0
- package/src/https-options.ts +7 -4
- package/src/index.tsx +47 -22
- package/src/kv.ts +23 -1
- package/src/miniflare-cli/index.ts +1 -0
- package/src/package-manager.ts +45 -0
- package/src/user/user.tsx +21 -18
- package/templates/static-asset-facade.js +11 -5
- package/templates/tsconfig.json +2 -2
- package/wrangler-dist/cli.d.ts +298 -0
- package/wrangler-dist/cli.js +539 -463
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { Blob as Blob_2 } from 'buffer';
|
|
4
|
+
import { BlobOptions } from 'buffer';
|
|
5
|
+
import Dispatcher = require('./dispatcher');
|
|
6
|
+
import { ReadableStream } from 'stream/web';
|
|
7
|
+
import { URL as URL_2 } from 'url';
|
|
8
|
+
import { URLSearchParams as URLSearchParams_2 } from 'url';
|
|
9
|
+
|
|
10
|
+
declare type BodyInit =
|
|
11
|
+
| ArrayBuffer
|
|
12
|
+
| AsyncIterable<Uint8Array>
|
|
13
|
+
| Blob_2
|
|
14
|
+
| FormData
|
|
15
|
+
| Iterable<Uint8Array>
|
|
16
|
+
| NodeJS.ArrayBufferView
|
|
17
|
+
| URLSearchParams_2
|
|
18
|
+
| null
|
|
19
|
+
| string
|
|
20
|
+
|
|
21
|
+
declare interface BodyMixin {
|
|
22
|
+
readonly body: ReadableStream | null
|
|
23
|
+
readonly bodyUsed: boolean
|
|
24
|
+
|
|
25
|
+
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
26
|
+
readonly blob: () => Promise<Blob_2>
|
|
27
|
+
readonly formData: () => Promise<FormData>
|
|
28
|
+
readonly json: () => Promise<unknown>
|
|
29
|
+
readonly text: () => Promise<string>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare interface DevOptions {
|
|
33
|
+
env?: string;
|
|
34
|
+
ip?: string;
|
|
35
|
+
port?: number;
|
|
36
|
+
localProtocol?: "http" | "https";
|
|
37
|
+
assets?: string;
|
|
38
|
+
site?: string;
|
|
39
|
+
siteInclude?: string[];
|
|
40
|
+
siteExclude?: string[];
|
|
41
|
+
nodeCompat?: boolean;
|
|
42
|
+
experimentalEnableLocalPersistence?: boolean;
|
|
43
|
+
_: (string | number)[];
|
|
44
|
+
$0: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class File extends Blob_2 {
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new File instance.
|
|
50
|
+
*
|
|
51
|
+
* @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
|
|
52
|
+
* @param fileName The name of the file.
|
|
53
|
+
* @param options An options object containing optional attributes for the file.
|
|
54
|
+
*/
|
|
55
|
+
constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FileOptions)
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Name of the file referenced by the File object.
|
|
59
|
+
*/
|
|
60
|
+
readonly name: string
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 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.
|
|
64
|
+
*/
|
|
65
|
+
readonly lastModified: number
|
|
66
|
+
|
|
67
|
+
readonly [Symbol.toStringTag]: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare interface FileOptions extends BlobOptions {
|
|
71
|
+
/**
|
|
72
|
+
* 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.
|
|
73
|
+
*/
|
|
74
|
+
lastModified?: number
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
79
|
+
*/
|
|
80
|
+
declare class FormData {
|
|
81
|
+
/**
|
|
82
|
+
* Appends a new value onto an existing key inside a FormData object,
|
|
83
|
+
* or adds the key if it does not already exist.
|
|
84
|
+
*
|
|
85
|
+
* The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
|
|
86
|
+
*
|
|
87
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
88
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
89
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
90
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
91
|
+
*/
|
|
92
|
+
append(name: string, value: unknown, fileName?: string): void
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Set a new value for an existing key inside FormData,
|
|
96
|
+
* or add the new field if it does not already exist.
|
|
97
|
+
*
|
|
98
|
+
* @param name The name of the field whose data is contained in `value`.
|
|
99
|
+
* @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
100
|
+
or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
|
|
101
|
+
* @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
set(name: string, value: unknown, fileName?: string): void
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns the first value associated with a given key from within a `FormData` object.
|
|
108
|
+
* If you expect multiple values and want all of them, use the `getAll()` method instead.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
111
|
+
*
|
|
112
|
+
* @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
|
|
113
|
+
*/
|
|
114
|
+
get(name: string): FormDataEntryValue | null
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Returns all the values associated with a given key from within a `FormData` object.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} name A name of the value you want to retrieve.
|
|
120
|
+
*
|
|
121
|
+
* @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
|
|
122
|
+
*/
|
|
123
|
+
getAll(name: string): FormDataEntryValue[]
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Returns a boolean stating whether a `FormData` object contains a certain key.
|
|
127
|
+
*
|
|
128
|
+
* @param name A string representing the name of the key you want to test for.
|
|
129
|
+
*
|
|
130
|
+
* @return A boolean value.
|
|
131
|
+
*/
|
|
132
|
+
has(name: string): boolean
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Deletes a key and its value(s) from a `FormData` object.
|
|
136
|
+
*
|
|
137
|
+
* @param name The name of the key you want to delete.
|
|
138
|
+
*/
|
|
139
|
+
delete(name: string): void
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Executes given callback function for each field of the FormData instance
|
|
143
|
+
*/
|
|
144
|
+
forEach: (
|
|
145
|
+
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
|
|
146
|
+
thisArg?: unknown
|
|
147
|
+
) => void
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
|
|
151
|
+
* Each key is a `string`.
|
|
152
|
+
*/
|
|
153
|
+
keys: () => SpecIterableIterator<string>
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
|
|
157
|
+
* Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
158
|
+
*/
|
|
159
|
+
values: () => SpecIterableIterator<FormDataEntryValue>
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
|
|
163
|
+
* The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
|
|
164
|
+
*/
|
|
165
|
+
entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* An alias for FormData#entries()
|
|
169
|
+
*/
|
|
170
|
+
[Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
|
|
171
|
+
|
|
172
|
+
readonly [Symbol.toStringTag]: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
177
|
+
*/
|
|
178
|
+
declare type FormDataEntryValue = string | File
|
|
179
|
+
|
|
180
|
+
declare class Headers implements SpecIterable<[string, string]> {
|
|
181
|
+
constructor (init?: HeadersInit)
|
|
182
|
+
readonly append: (name: string, value: string) => void
|
|
183
|
+
readonly delete: (name: string) => void
|
|
184
|
+
readonly get: (name: string) => string | null
|
|
185
|
+
readonly has: (name: string) => boolean
|
|
186
|
+
readonly set: (name: string, value: string) => void
|
|
187
|
+
readonly forEach: (
|
|
188
|
+
callbackfn: (value: string, key: string, iterable: Headers) => void,
|
|
189
|
+
thisArg?: unknown
|
|
190
|
+
) => void
|
|
191
|
+
|
|
192
|
+
readonly keys: () => SpecIterableIterator<string>
|
|
193
|
+
readonly values: () => SpecIterableIterator<string>
|
|
194
|
+
readonly entries: () => SpecIterableIterator<[string, string]>
|
|
195
|
+
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
|
|
199
|
+
|
|
200
|
+
declare type ReferrerPolicy =
|
|
201
|
+
| ''
|
|
202
|
+
| 'no-referrer'
|
|
203
|
+
| 'no-referrer-when-downgrade'
|
|
204
|
+
| 'origin'
|
|
205
|
+
| 'origin-when-cross-origin'
|
|
206
|
+
| 'same-origin'
|
|
207
|
+
| 'strict-origin'
|
|
208
|
+
| 'strict-origin-when-cross-origin'
|
|
209
|
+
| 'unsafe-url';
|
|
210
|
+
|
|
211
|
+
declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
|
|
212
|
+
|
|
213
|
+
declare interface RequestInit {
|
|
214
|
+
method?: string
|
|
215
|
+
keepalive?: boolean
|
|
216
|
+
headers?: HeadersInit
|
|
217
|
+
body?: BodyInit
|
|
218
|
+
redirect?: RequestRedirect
|
|
219
|
+
integrity?: string
|
|
220
|
+
signal?: AbortSignal
|
|
221
|
+
credentials?: RequestCredentials
|
|
222
|
+
mode?: RequestMode
|
|
223
|
+
referrer?: string
|
|
224
|
+
referrerPolicy?: ReferrerPolicy
|
|
225
|
+
window?: null
|
|
226
|
+
dispatcher?: Dispatcher
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
230
|
+
|
|
231
|
+
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
232
|
+
|
|
233
|
+
declare class Response implements BodyMixin {
|
|
234
|
+
constructor (body?: BodyInit, init?: ResponseInit)
|
|
235
|
+
|
|
236
|
+
readonly headers: Headers
|
|
237
|
+
readonly ok: boolean
|
|
238
|
+
readonly status: number
|
|
239
|
+
readonly statusText: string
|
|
240
|
+
readonly type: ResponseType
|
|
241
|
+
readonly url: string
|
|
242
|
+
readonly redirected: boolean
|
|
243
|
+
|
|
244
|
+
readonly body: ReadableStream | null
|
|
245
|
+
readonly bodyUsed: boolean
|
|
246
|
+
|
|
247
|
+
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
248
|
+
readonly blob: () => Promise<Blob_2>
|
|
249
|
+
readonly formData: () => Promise<FormData>
|
|
250
|
+
readonly json: () => Promise<unknown>
|
|
251
|
+
readonly text: () => Promise<string>
|
|
252
|
+
|
|
253
|
+
readonly clone: () => Response
|
|
254
|
+
|
|
255
|
+
static error (): Response
|
|
256
|
+
static json(data: any, init?: ResponseInit): Response
|
|
257
|
+
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare interface ResponseInit {
|
|
261
|
+
readonly status?: number
|
|
262
|
+
readonly statusText?: string
|
|
263
|
+
readonly headers?: HeadersInit
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
267
|
+
|
|
268
|
+
declare type ResponseType =
|
|
269
|
+
| 'basic'
|
|
270
|
+
| 'cors'
|
|
271
|
+
| 'default'
|
|
272
|
+
| 'error'
|
|
273
|
+
| 'opaque'
|
|
274
|
+
| 'opaqueredirect'
|
|
275
|
+
|
|
276
|
+
declare interface SpecIterable<T> {
|
|
277
|
+
[Symbol.iterator](): SpecIterator<T>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare interface SpecIterableIterator<T> extends SpecIterator<T> {
|
|
281
|
+
[Symbol.iterator](): SpecIterableIterator<T>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
285
|
+
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
290
|
+
* @param {string} script
|
|
291
|
+
* @param {DevOptions} options
|
|
292
|
+
*/
|
|
293
|
+
export declare function unstable_dev(script: string, options: DevOptions): Promise<{
|
|
294
|
+
stop: () => void;
|
|
295
|
+
fetch: (init?: RequestInit | undefined) => Promise<Response | undefined>;
|
|
296
|
+
}>;
|
|
297
|
+
|
|
298
|
+
export { }
|