wrangler 0.0.0-d72722f0 → 0.0.0-d74c35fc

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "0.0.0-d72722f0",
3
+ "version": "0.0.0-d74c35fc",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -89,7 +89,7 @@
89
89
  "blake3-wasm": "^2.1.5",
90
90
  "chokidar": "^3.5.3",
91
91
  "esbuild": "0.17.19",
92
- "miniflare": "3.20230918.0",
92
+ "miniflare": "3.20231016.0",
93
93
  "nanoid": "^3.3.3",
94
94
  "path-to-regexp": "^6.2.0",
95
95
  "selfsigned": "^2.0.1",
@@ -100,7 +100,7 @@
100
100
  "devDependencies": {
101
101
  "@cloudflare/eslint-config-worker": "*",
102
102
  "@cloudflare/types": "^6.18.4",
103
- "@cloudflare/workers-types": "^4.20230724.0",
103
+ "@cloudflare/workers-types": "^4.20230914.0",
104
104
  "@iarna/toml": "^3.0.0",
105
105
  "@microsoft/api-extractor": "^7.28.3",
106
106
  "@types/body-parser": "^1.19.2",
@@ -110,20 +110,19 @@
110
110
  "@types/glob-to-regexp": "0.4.1",
111
111
  "@types/is-ci": "^3.0.0",
112
112
  "@types/javascript-time-ago": "^2.0.3",
113
+ "@types/jest": "^29.5.5",
113
114
  "@types/mime": "^2.0.3",
114
115
  "@types/minimatch": "^5.1.2",
115
116
  "@types/prompts": "^2.0.14",
116
117
  "@types/react": "^17.0.37",
117
118
  "@types/serve-static": "^1.13.10",
119
+ "@types/shell-quote": "^1.7.2",
118
120
  "@types/signal-exit": "^3.0.1",
119
121
  "@types/source-map-support": "^0.5.7",
120
122
  "@types/supports-color": "^8.1.1",
121
123
  "@types/ws": "^8.5.3",
122
124
  "@types/yargs": "^17.0.10",
123
125
  "@webcontainer/env": "^1.1.0",
124
- "@types/jest": "^29.5.5",
125
- "esbuild-jest": "0.5.0",
126
- "jest": "^29.7.0",
127
126
  "body-parser": "^1.20.0",
128
127
  "chalk": "^2.4.2",
129
128
  "cli-table3": "^0.6.3",
@@ -133,6 +132,7 @@
133
132
  "concurrently": "^7.2.2",
134
133
  "devtools-protocol": "^0.0.955664",
135
134
  "dotenv": "^16.0.0",
135
+ "esbuild-jest": "0.5.0",
136
136
  "execa": "^6.1.0",
137
137
  "express": "^4.18.1",
138
138
  "finalhandler": "^1.2.0",
@@ -149,6 +149,7 @@
149
149
  "ink-text-input": "^4.0.3",
150
150
  "is-ci": "^3.0.1",
151
151
  "javascript-time-ago": "^2.5.4",
152
+ "jest": "^29.7.0",
152
153
  "jest-fetch-mock": "^3.0.3",
153
154
  "jest-websocket-mock": "^2.5.0",
154
155
  "mime": "^3.0.0",
@@ -165,6 +166,7 @@
165
166
  "remove-accents-esm": "^0.0.1",
166
167
  "semiver": "^1.1.0",
167
168
  "serve-static": "^1.15.0",
169
+ "shell-quote": "^1.8.1",
168
170
  "shellac": "^0.8.0",
169
171
  "signal-exit": "^3.0.7",
170
172
  "strip-ansi": "^7.0.1",
@@ -176,10 +178,10 @@
176
178
  "update-check": "^1.5.4",
177
179
  "vitest": "^0.34.4",
178
180
  "ws": "^8.5.0",
179
- "xdg-app-paths": "^7.3.0",
180
- "yargs": "^17.4.1",
181
+ "xdg-app-paths": "^8.3.0",
182
+ "yargs": "^17.7.2",
181
183
  "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
182
- "@cloudflare/pages-shared": "^0.9.0",
184
+ "@cloudflare/pages-shared": "^0.10.1",
183
185
  "@cloudflare/workers-tsconfig": "0.0.0"
184
186
  },
185
187
  "optionalDependencies": {
@@ -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
@@ -996,6 +1011,21 @@ declare interface EnvironmentNonInheritable {
996
1011
  /** Internal use only. */
997
1012
  database_internal_env?: string;
998
1013
  }[];
1014
+ /**
1015
+ * Specifies Vectorize indexes that are bound to this Worker environment.
1016
+ *
1017
+ * NOTE: This field is not automatically inherited from the top level environment,
1018
+ * and so must be specified in every named environment.
1019
+ *
1020
+ * @default `[]`
1021
+ * @nonInheritable
1022
+ */
1023
+ vectorize: {
1024
+ /** The binding name used to refer to the Vectorize index in the worker. */
1025
+ binding: string;
1026
+ /** The name of the index. */
1027
+ index_name: string;
1028
+ }[];
999
1029
  /**
1000
1030
  * Specifies Constellation projects that are bound to this Worker environment.
1001
1031
  *
@@ -1011,6 +1041,21 @@ declare interface EnvironmentNonInheritable {
1011
1041
  /** The id of the project. */
1012
1042
  project_id: string;
1013
1043
  }[];
1044
+ /**
1045
+ * Specifies Hyperdrive configs that are bound to this Worker environment.
1046
+ *
1047
+ * NOTE: This field is not automatically inherited from the top level environment,
1048
+ * and so must be specified in every named environment.
1049
+ *
1050
+ * @default `[]`
1051
+ * @nonInheritable
1052
+ */
1053
+ hyperdrive: {
1054
+ /** The binding name used to refer to the project in the worker. */
1055
+ binding: string;
1056
+ /** The id of the database. */
1057
+ id: string;
1058
+ }[];
1014
1059
  /**
1015
1060
  * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
1016
1061
  *
@@ -1049,6 +1094,12 @@ declare interface EnvironmentNonInheritable {
1049
1094
  browser: {
1050
1095
  binding: string;
1051
1096
  } | undefined;
1097
+ /**
1098
+ * Binding to the AI project.
1099
+ */
1100
+ ai: {
1101
+ binding: string;
1102
+ } | undefined;
1052
1103
  /**
1053
1104
  * "Unsafe" tables for features that aren't directly supported by wrangler.
1054
1105
  *
@@ -1345,16 +1396,6 @@ declare class FormData_2 {
1345
1396
  */
1346
1397
  declare type FormDataEntryValue = string | File_2
1347
1398
 
1348
- /**
1349
- * fetches an mTLS certificate from the account mTLS certificate store by ID
1350
- */
1351
- export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
1352
-
1353
- /**
1354
- * 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
1355
- */
1356
- export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
1357
-
1358
1399
  declare class Headers_2 implements SpecIterable<[string, string]> {
1359
1400
  constructor (init?: HeadersInit_2)
1360
1401
  readonly append: (name: string, value: string) => void
@@ -1381,51 +1422,6 @@ declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<
1381
1422
  */
1382
1423
  declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
1383
1424
 
1384
- /**
1385
- * lists mTLS certificates for an account. filtering by name is supported
1386
- */
1387
- export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
1388
-
1389
- /**
1390
- * details for uploading an mTLS certificate via the ssl api
1391
- */
1392
- declare interface MTlsCertificateBody {
1393
- certificateChain: string;
1394
- privateKey: string;
1395
- name?: string;
1396
- }
1397
-
1398
- /**
1399
- * supported filters for listing mTLS certificates via the ssl api
1400
- */
1401
- declare interface MTlsCertificateListFilter {
1402
- name?: string;
1403
- }
1404
-
1405
- /**
1406
- * the representation of an mTLS certificate in the account certificate store
1407
- */
1408
- declare interface MTlsCertificateResponse {
1409
- id: string;
1410
- name?: string;
1411
- ca: boolean;
1412
- certificates: string;
1413
- expires_on: string;
1414
- issuer: string;
1415
- serial_number: string;
1416
- signature: string;
1417
- uploaded_on: string;
1418
- }
1419
-
1420
- /**
1421
- * details for uploading an mTLS certificate from disk
1422
- */
1423
- declare interface MTlsCertificateUploadDetails {
1424
- certificateChainFilename: string;
1425
- privateKeyFilename: string;
1426
- name?: string;
1427
- }
1428
-
1429
1425
  declare interface PagesDeployOptions {
1430
1426
  /**
1431
1427
  * Path to static assets to deploy to Pages
@@ -1683,6 +1679,11 @@ export declare interface UnstableDevOptions {
1683
1679
  script_name?: string | undefined;
1684
1680
  environment?: string | undefined;
1685
1681
  }[];
1682
+ services?: {
1683
+ binding: string;
1684
+ service: string;
1685
+ environment?: string | undefined;
1686
+ }[];
1686
1687
  r2?: {
1687
1688
  binding: string;
1688
1689
  bucket_name: string;
@@ -1718,15 +1719,10 @@ export declare interface UnstableDevWorker {
1718
1719
  waitUntilExit: () => Promise<void>;
1719
1720
  }
1720
1721
 
1721
- /**
1722
- * uploads an mTLS certificate and private key pair to the account mTLS certificate store
1723
- */
1724
- export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
1725
-
1726
- /**
1727
- * reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
1728
- */
1729
- 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
+ }
1730
1726
 
1731
1727
  declare type ZoneIdRoute = {
1732
1728
  pattern: string;