wrangler 0.0.0-bde9d64a → 0.0.0-be0c6283

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 CHANGED
@@ -76,6 +76,11 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
76
76
  if (process.send) {
77
77
  process.send(message);
78
78
  }
79
+ })
80
+ .on("disconnect", () => {
81
+ if (process.disconnect) {
82
+ process.disconnect();
83
+ }
79
84
  });
80
85
  }
81
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "0.0.0-bde9d64a",
3
+ "version": "0.0.0-be0c6283",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -89,9 +89,10 @@
89
89
  "blake3-wasm": "^2.1.5",
90
90
  "chokidar": "^3.5.3",
91
91
  "esbuild": "0.17.19",
92
- "miniflare": "3.20230922.0",
92
+ "miniflare": "3.20231025.0",
93
93
  "nanoid": "^3.3.3",
94
94
  "path-to-regexp": "^6.2.0",
95
+ "resolve.exports": "^2.0.2",
95
96
  "selfsigned": "^2.0.1",
96
97
  "source-map": "0.6.1",
97
98
  "source-map-support": "0.5.21",
@@ -116,6 +117,7 @@
116
117
  "@types/prompts": "^2.0.14",
117
118
  "@types/react": "^17.0.37",
118
119
  "@types/serve-static": "^1.13.10",
120
+ "@types/shell-quote": "^1.7.2",
119
121
  "@types/signal-exit": "^3.0.1",
120
122
  "@types/source-map-support": "^0.5.7",
121
123
  "@types/supports-color": "^8.1.1",
@@ -165,6 +167,7 @@
165
167
  "remove-accents-esm": "^0.0.1",
166
168
  "semiver": "^1.1.0",
167
169
  "serve-static": "^1.15.0",
170
+ "shell-quote": "^1.8.1",
168
171
  "shellac": "^0.8.0",
169
172
  "signal-exit": "^3.0.7",
170
173
  "strip-ansi": "^7.0.1",
@@ -177,16 +180,17 @@
177
180
  "vitest": "^0.34.4",
178
181
  "ws": "^8.5.0",
179
182
  "xdg-app-paths": "^8.3.0",
180
- "yargs": "^17.4.1",
183
+ "yargs": "^17.7.2",
181
184
  "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
182
- "@cloudflare/pages-shared": "^0.9.0",
185
+ "@cloudflare/cli": "0.1.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.13.0"
193
+ "node": ">=16.17.0"
190
194
  },
191
195
  "scripts": {
192
196
  "assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts",
@@ -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.
@@ -0,0 +1,4 @@
1
+ // `esbuild` doesn't support returning `watch*` options from `onStart()`
2
+ // plugin callbacks. Instead, we define an empty virtual module that is
3
+ // imported by this injected file. Importing the module registers watchers.
4
+ import "wrangler:modules-watch";
@@ -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
- * The directory in which module rules should be evaluated in a `--no-bundle` worker
659
- * This defaults to dirname(main) when left undefined
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
@@ -1381,16 +1396,6 @@ declare class FormData_2 {
1381
1396
  */
1382
1397
  declare type FormDataEntryValue = string | File_2
1383
1398
 
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
1399
  declare class Headers_2 implements SpecIterable<[string, string]> {
1395
1400
  constructor (init?: HeadersInit_2)
1396
1401
  readonly append: (name: string, value: string) => void
@@ -1417,51 +1422,6 @@ declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<
1417
1422
  */
1418
1423
  declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
1419
1424
 
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
1425
  declare interface PagesDeployOptions {
1466
1426
  /**
1467
1427
  * Path to static assets to deploy to Pages
@@ -1719,6 +1679,11 @@ export declare interface UnstableDevOptions {
1719
1679
  script_name?: string | undefined;
1720
1680
  environment?: string | undefined;
1721
1681
  }[];
1682
+ services?: {
1683
+ binding: string;
1684
+ service: string;
1685
+ environment?: string | undefined;
1686
+ }[];
1722
1687
  r2?: {
1723
1688
  binding: string;
1724
1689
  bucket_name: string;
@@ -1754,15 +1719,10 @@ export declare interface UnstableDevWorker {
1754
1719
  waitUntilExit: () => Promise<void>;
1755
1720
  }
1756
1721
 
1757
- /**
1758
- * uploads an mTLS certificate and private key pair to the account mTLS certificate store
1759
- */
1760
- export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
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>;
1722
+ declare interface UserLimits {
1723
+ /** Maximum allowed CPU time for a worker's invocation in milliseconds */
1724
+ cpu_ms: number;
1725
+ }
1766
1726
 
1767
1727
  declare type ZoneIdRoute = {
1768
1728
  pattern: string;