wrangler 0.0.0-cb4309f9 → 0.0.0-cb8ec90e
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 +5 -0
- package/package.json +12 -8
- package/templates/middleware/middleware-multiworker-dev.ts +37 -28
- package/templates/modules-watch-stub.js +4 -0
- package/wrangler-dist/cli.d.ts +34 -69
- package/wrangler-dist/cli.js +9710 -10841
package/bin/wrangler.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-cb8ec90e",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -89,17 +89,19 @@
|
|
|
89
89
|
"blake3-wasm": "^2.1.5",
|
|
90
90
|
"chokidar": "^3.5.3",
|
|
91
91
|
"esbuild": "0.17.19",
|
|
92
|
-
"miniflare": "3.20230922.0",
|
|
93
92
|
"nanoid": "^3.3.3",
|
|
94
93
|
"path-to-regexp": "^6.2.0",
|
|
94
|
+
"resolve.exports": "^2.0.2",
|
|
95
95
|
"selfsigned": "^2.0.1",
|
|
96
96
|
"source-map": "0.6.1",
|
|
97
97
|
"source-map-support": "0.5.21",
|
|
98
|
-
"xxhash-wasm": "^1.0.1"
|
|
98
|
+
"xxhash-wasm": "^1.0.1",
|
|
99
|
+
"miniflare": "3.20231025.1"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@cloudflare/eslint-config-worker": "*",
|
|
102
103
|
"@cloudflare/types": "^6.18.4",
|
|
104
|
+
"https-proxy-agent": "7.0.2",
|
|
103
105
|
"@cloudflare/workers-types": "^4.20230914.0",
|
|
104
106
|
"@iarna/toml": "^3.0.0",
|
|
105
107
|
"@microsoft/api-extractor": "^7.28.3",
|
|
@@ -116,6 +118,7 @@
|
|
|
116
118
|
"@types/prompts": "^2.0.14",
|
|
117
119
|
"@types/react": "^17.0.37",
|
|
118
120
|
"@types/serve-static": "^1.13.10",
|
|
121
|
+
"@types/shell-quote": "^1.7.2",
|
|
119
122
|
"@types/signal-exit": "^3.0.1",
|
|
120
123
|
"@types/source-map-support": "^0.5.7",
|
|
121
124
|
"@types/supports-color": "^8.1.1",
|
|
@@ -165,28 +168,29 @@
|
|
|
165
168
|
"remove-accents-esm": "^0.0.1",
|
|
166
169
|
"semiver": "^1.1.0",
|
|
167
170
|
"serve-static": "^1.15.0",
|
|
171
|
+
"shell-quote": "^1.8.1",
|
|
168
172
|
"shellac": "^0.8.0",
|
|
169
173
|
"signal-exit": "^3.0.7",
|
|
170
174
|
"strip-ansi": "^7.0.1",
|
|
171
175
|
"supports-color": "^9.2.2",
|
|
172
176
|
"timeago.js": "^4.0.2",
|
|
173
|
-
"tmp-promise": "^3.0.3",
|
|
174
177
|
"ts-dedent": "^2.2.0",
|
|
175
178
|
"undici": "5.20.0",
|
|
176
179
|
"update-check": "^1.5.4",
|
|
177
180
|
"vitest": "^0.34.4",
|
|
178
181
|
"ws": "^8.5.0",
|
|
179
182
|
"xdg-app-paths": "^8.3.0",
|
|
180
|
-
"yargs": "^17.
|
|
183
|
+
"yargs": "^17.7.2",
|
|
181
184
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
|
182
|
-
"@cloudflare/
|
|
185
|
+
"@cloudflare/cli": "1.0.0",
|
|
186
|
+
"@cloudflare/pages-shared": "^0.10.1",
|
|
183
187
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
184
188
|
},
|
|
185
189
|
"optionalDependencies": {
|
|
186
190
|
"fsevents": "~2.3.2"
|
|
187
191
|
},
|
|
188
192
|
"engines": {
|
|
189
|
-
"node": ">=16.
|
|
193
|
+
"node": ">=16.17.0"
|
|
190
194
|
},
|
|
191
195
|
"scripts": {
|
|
192
196
|
"assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts",
|
|
@@ -195,7 +199,7 @@
|
|
|
195
199
|
"check:lint": "eslint .",
|
|
196
200
|
"check:type": "tsc",
|
|
197
201
|
"clean": "rimraf wrangler-dist miniflare-dist emitted-types",
|
|
198
|
-
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false
|
|
202
|
+
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
|
|
199
203
|
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
|
|
200
204
|
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
|
|
201
205
|
"test": "pnpm run assert-git-version && jest",
|
|
@@ -4,6 +4,42 @@
|
|
|
4
4
|
import { workers } from "config:middleware/multiworker-dev";
|
|
5
5
|
import type { WorkerRegistry } from "../../src/dev-registry";
|
|
6
6
|
|
|
7
|
+
class Fetcher {
|
|
8
|
+
#name: string;
|
|
9
|
+
#details: WorkerRegistry[string];
|
|
10
|
+
constructor(name: string, details: WorkerRegistry[string]) {
|
|
11
|
+
this.#name = name;
|
|
12
|
+
this.#details = details;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async fetch(...reqArgs: Parameters<Fetcher["fetch"]>) {
|
|
16
|
+
const reqFromArgs = new Request(...reqArgs);
|
|
17
|
+
if (this.#details.headers) {
|
|
18
|
+
for (const [key, value] of Object.entries(this.#details.headers)) {
|
|
19
|
+
// In remote mode, you need to add a couple of headers
|
|
20
|
+
// to make sure it's talking to the 'dev' preview session
|
|
21
|
+
// (much like wrangler dev already does via proxy.ts)
|
|
22
|
+
reqFromArgs.headers.set(key, value);
|
|
23
|
+
}
|
|
24
|
+
return (env[this.#name] as Fetcher).fetch(reqFromArgs);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const url = new URL(reqFromArgs.url);
|
|
28
|
+
if (this.#details.protocol !== undefined) {
|
|
29
|
+
url.protocol = this.#details.protocol;
|
|
30
|
+
}
|
|
31
|
+
if (this.#details.host !== undefined) {
|
|
32
|
+
url.host = this.#details.host;
|
|
33
|
+
}
|
|
34
|
+
if (this.#details.port !== undefined) {
|
|
35
|
+
url.port = this.#details.port.toString();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const request = new Request(url.toString(), reqFromArgs);
|
|
39
|
+
return fetch(request);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
7
43
|
export function wrap(env: Record<string, unknown>) {
|
|
8
44
|
const facadeEnv = { ...env };
|
|
9
45
|
// For every Worker definition that's available,
|
|
@@ -14,34 +50,7 @@ export function wrap(env: Record<string, unknown>) {
|
|
|
14
50
|
|
|
15
51
|
for (const [name, details] of Object.entries(workers as WorkerRegistry)) {
|
|
16
52
|
if (details) {
|
|
17
|
-
facadeEnv[name] =
|
|
18
|
-
async fetch(...reqArgs: Parameters<Fetcher["fetch"]>) {
|
|
19
|
-
const reqFromArgs = new Request(...reqArgs);
|
|
20
|
-
if (details.headers) {
|
|
21
|
-
for (const [key, value] of Object.entries(details.headers)) {
|
|
22
|
-
// In remote mode, you need to add a couple of headers
|
|
23
|
-
// to make sure it's talking to the 'dev' preview session
|
|
24
|
-
// (much like wrangler dev already does via proxy.ts)
|
|
25
|
-
reqFromArgs.headers.set(key, value);
|
|
26
|
-
}
|
|
27
|
-
return (env[name] as Fetcher).fetch(reqFromArgs);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const url = new URL(reqFromArgs.url);
|
|
31
|
-
if (details.protocol !== undefined) {
|
|
32
|
-
url.protocol = details.protocol;
|
|
33
|
-
}
|
|
34
|
-
if (details.host !== undefined) {
|
|
35
|
-
url.host = details.host;
|
|
36
|
-
}
|
|
37
|
-
if (details.port !== undefined) {
|
|
38
|
-
url.port = details.port.toString();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const request = new Request(url.toString(), reqFromArgs);
|
|
42
|
-
return fetch(request);
|
|
43
|
-
},
|
|
44
|
-
};
|
|
53
|
+
facadeEnv[name] = new Fetcher(name, details);
|
|
45
54
|
} else {
|
|
46
55
|
// This means there's no dev binding available.
|
|
47
56
|
// Let's use whatever's available, or put a shim with a message.
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -251,8 +251,6 @@ declare type CustomDomainRoute = {
|
|
|
251
251
|
custom_domain: boolean;
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
export declare function deleteMTlsCertificate(accountId: string, certificateId: string): Promise<unknown>;
|
|
255
|
-
|
|
256
254
|
/**
|
|
257
255
|
* Publish a directory to an account/project.
|
|
258
256
|
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
@@ -655,8 +653,18 @@ declare interface EnvironmentInheritable {
|
|
|
655
653
|
*/
|
|
656
654
|
main: string | undefined;
|
|
657
655
|
/**
|
|
658
|
-
*
|
|
659
|
-
*
|
|
656
|
+
* If true then Wrangler will traverse the file tree below `base_dir`;
|
|
657
|
+
* Any files that match `rules` will be included in the deployed worker.
|
|
658
|
+
* Defaults to true if `no_bundle` is true, otherwise false.
|
|
659
|
+
*
|
|
660
|
+
* @inheritable
|
|
661
|
+
*/
|
|
662
|
+
find_additional_modules: boolean | undefined;
|
|
663
|
+
/**
|
|
664
|
+
* The directory in which module rules should be evaluated when including additional files into a worker deployment.
|
|
665
|
+
* This defaults to the directory containing the `main` entry point of the worker if not specified.
|
|
666
|
+
*
|
|
667
|
+
* @inheritable
|
|
660
668
|
*/
|
|
661
669
|
base_dir: string | undefined;
|
|
662
670
|
/**
|
|
@@ -730,6 +738,13 @@ declare interface EnvironmentInheritable {
|
|
|
730
738
|
* @inheritable
|
|
731
739
|
*/
|
|
732
740
|
usage_model: "bundled" | "unbound" | undefined;
|
|
741
|
+
/**
|
|
742
|
+
* Specify limits for runtime behavior.
|
|
743
|
+
* Only supported for the "standard" Usage Model
|
|
744
|
+
*
|
|
745
|
+
* @inheritable
|
|
746
|
+
*/
|
|
747
|
+
limits: UserLimits | undefined;
|
|
733
748
|
/**
|
|
734
749
|
* An ordered list of rules that define which modules to import,
|
|
735
750
|
* and what type to import them as. You will need to specify rules
|
|
@@ -1040,6 +1055,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
1040
1055
|
binding: string;
|
|
1041
1056
|
/** The id of the database. */
|
|
1042
1057
|
id: string;
|
|
1058
|
+
/** The local database connection string for `wrangler dev` */
|
|
1059
|
+
localConnectionString?: string;
|
|
1043
1060
|
}[];
|
|
1044
1061
|
/**
|
|
1045
1062
|
* Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
|
|
@@ -1381,16 +1398,6 @@ declare class FormData_2 {
|
|
|
1381
1398
|
*/
|
|
1382
1399
|
declare type FormDataEntryValue = string | File_2
|
|
1383
1400
|
|
|
1384
|
-
/**
|
|
1385
|
-
* fetches an mTLS certificate from the account mTLS certificate store by ID
|
|
1386
|
-
*/
|
|
1387
|
-
export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
|
|
1388
|
-
|
|
1389
|
-
/**
|
|
1390
|
-
* fetches an mTLS certificate from the account mTLS certificate store by name. will throw an error if no certificates are found, or multiple are found with that name
|
|
1391
|
-
*/
|
|
1392
|
-
export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
|
|
1393
|
-
|
|
1394
1401
|
declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
1395
1402
|
constructor (init?: HeadersInit_2)
|
|
1396
1403
|
readonly append: (name: string, value: string) => void
|
|
@@ -1417,51 +1424,6 @@ declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<
|
|
|
1417
1424
|
*/
|
|
1418
1425
|
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
1419
1426
|
|
|
1420
|
-
/**
|
|
1421
|
-
* lists mTLS certificates for an account. filtering by name is supported
|
|
1422
|
-
*/
|
|
1423
|
-
export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
|
|
1424
|
-
|
|
1425
|
-
/**
|
|
1426
|
-
* details for uploading an mTLS certificate via the ssl api
|
|
1427
|
-
*/
|
|
1428
|
-
declare interface MTlsCertificateBody {
|
|
1429
|
-
certificateChain: string;
|
|
1430
|
-
privateKey: string;
|
|
1431
|
-
name?: string;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
/**
|
|
1435
|
-
* supported filters for listing mTLS certificates via the ssl api
|
|
1436
|
-
*/
|
|
1437
|
-
declare interface MTlsCertificateListFilter {
|
|
1438
|
-
name?: string;
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* the representation of an mTLS certificate in the account certificate store
|
|
1443
|
-
*/
|
|
1444
|
-
declare interface MTlsCertificateResponse {
|
|
1445
|
-
id: string;
|
|
1446
|
-
name?: string;
|
|
1447
|
-
ca: boolean;
|
|
1448
|
-
certificates: string;
|
|
1449
|
-
expires_on: string;
|
|
1450
|
-
issuer: string;
|
|
1451
|
-
serial_number: string;
|
|
1452
|
-
signature: string;
|
|
1453
|
-
uploaded_on: string;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
/**
|
|
1457
|
-
* details for uploading an mTLS certificate from disk
|
|
1458
|
-
*/
|
|
1459
|
-
declare interface MTlsCertificateUploadDetails {
|
|
1460
|
-
certificateChainFilename: string;
|
|
1461
|
-
privateKeyFilename: string;
|
|
1462
|
-
name?: string;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
1427
|
declare interface PagesDeployOptions {
|
|
1466
1428
|
/**
|
|
1467
1429
|
* Path to static assets to deploy to Pages
|
|
@@ -1677,8 +1639,10 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
1677
1639
|
declare type TailConsumer = {
|
|
1678
1640
|
/** The name of the service tail events will be forwarded to. */
|
|
1679
1641
|
service: string;
|
|
1680
|
-
/** (Optional) The
|
|
1642
|
+
/** (Optional) The environment of the service. */
|
|
1681
1643
|
environment?: string;
|
|
1644
|
+
/** (Optional) The dispatch namespace the Tail Worker script belongs to (if any). */
|
|
1645
|
+
namespace?: string;
|
|
1682
1646
|
};
|
|
1683
1647
|
|
|
1684
1648
|
/**
|
|
@@ -1719,6 +1683,11 @@ export declare interface UnstableDevOptions {
|
|
|
1719
1683
|
script_name?: string | undefined;
|
|
1720
1684
|
environment?: string | undefined;
|
|
1721
1685
|
}[];
|
|
1686
|
+
services?: {
|
|
1687
|
+
binding: string;
|
|
1688
|
+
service: string;
|
|
1689
|
+
environment?: string | undefined;
|
|
1690
|
+
}[];
|
|
1722
1691
|
r2?: {
|
|
1723
1692
|
binding: string;
|
|
1724
1693
|
bucket_name: string;
|
|
@@ -1730,6 +1699,7 @@ export declare interface UnstableDevOptions {
|
|
|
1730
1699
|
inspect?: boolean;
|
|
1731
1700
|
local?: boolean;
|
|
1732
1701
|
accountId?: string;
|
|
1702
|
+
updateCheck?: boolean;
|
|
1733
1703
|
experimental?: {
|
|
1734
1704
|
processEntrypoint?: boolean;
|
|
1735
1705
|
additionalModules?: CfModule[];
|
|
@@ -1754,15 +1724,10 @@ export declare interface UnstableDevWorker {
|
|
|
1754
1724
|
waitUntilExit: () => Promise<void>;
|
|
1755
1725
|
}
|
|
1756
1726
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
/**
|
|
1763
|
-
* reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
|
|
1764
|
-
*/
|
|
1765
|
-
export declare function uploadMTlsCertificateFromFs(accountId: string, details: MTlsCertificateUploadDetails): Promise<MTlsCertificateResponse>;
|
|
1727
|
+
declare interface UserLimits {
|
|
1728
|
+
/** Maximum allowed CPU time for a worker's invocation in milliseconds */
|
|
1729
|
+
cpu_ms: number;
|
|
1730
|
+
}
|
|
1766
1731
|
|
|
1767
1732
|
declare type ZoneIdRoute = {
|
|
1768
1733
|
pattern: string;
|