wrangler 3.75.0 → 3.77.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/config-schema.json +125 -0
- package/package.json +8 -8
- package/templates/middleware/middleware-mock-analytics-engine.d.ts +3 -0
- package/templates/middleware/middleware-mock-analytics-engine.ts +30 -0
- package/templates/middleware/middleware-serve-static-assets.ts +2 -2
- package/wrangler-dist/cli.d.ts +67 -7
- package/wrangler-dist/cli.js +103217 -98504
- package/wrangler-dist/cli.js.map +7 -0
package/config-schema.json
CHANGED
@@ -567,10 +567,40 @@
|
|
567
567
|
"description": "Add polyfills for node builtin modules and globals",
|
568
568
|
"type": "boolean"
|
569
569
|
},
|
570
|
+
"observability": {
|
571
|
+
"$ref": "#/definitions/Observability",
|
572
|
+
"description": "Specify the observability behavior of the Worker."
|
573
|
+
},
|
574
|
+
"pipelines": {
|
575
|
+
"default": "`[]`",
|
576
|
+
"description": "Specifies list of Pipelines bound to this Worker environment\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
577
|
+
"items": {
|
578
|
+
"additionalProperties": false,
|
579
|
+
"properties": {
|
580
|
+
"binding": {
|
581
|
+
"description": "The binding name used to refer to the bound service.",
|
582
|
+
"type": "string"
|
583
|
+
},
|
584
|
+
"pipeline": {
|
585
|
+
"description": "Name of the Pipeline to bind",
|
586
|
+
"type": "string"
|
587
|
+
}
|
588
|
+
},
|
589
|
+
"required": [
|
590
|
+
"binding",
|
591
|
+
"pipeline"
|
592
|
+
],
|
593
|
+
"type": "object"
|
594
|
+
},
|
595
|
+
"type": "array"
|
596
|
+
},
|
570
597
|
"placement": {
|
571
598
|
"additionalProperties": false,
|
572
599
|
"description": "Specify how the Worker should be located to minimize round-trip time.\n\nMore details: https://developers.cloudflare.com/workers/platform/smart-placement/",
|
573
600
|
"properties": {
|
601
|
+
"hint": {
|
602
|
+
"type": "string"
|
603
|
+
},
|
574
604
|
"mode": {
|
575
605
|
"enum": [
|
576
606
|
"off",
|
@@ -970,6 +1000,7 @@
|
|
970
1000
|
"logfwdr",
|
971
1001
|
"migrations",
|
972
1002
|
"mtls_certificates",
|
1003
|
+
"pipelines",
|
973
1004
|
"queues",
|
974
1005
|
"r2_buckets",
|
975
1006
|
"rules",
|
@@ -990,6 +1021,23 @@
|
|
990
1021
|
"directory": {
|
991
1022
|
"description": "Absolute path to assets directory",
|
992
1023
|
"type": "string"
|
1024
|
+
},
|
1025
|
+
"html_handling": {
|
1026
|
+
"enum": [
|
1027
|
+
"auto-trailing-slash",
|
1028
|
+
"force-trailing-slash",
|
1029
|
+
"drop-trailing-slash",
|
1030
|
+
"none"
|
1031
|
+
],
|
1032
|
+
"type": "string"
|
1033
|
+
},
|
1034
|
+
"not_found_handling": {
|
1035
|
+
"enum": [
|
1036
|
+
"single-page-application",
|
1037
|
+
"404-page",
|
1038
|
+
"none"
|
1039
|
+
],
|
1040
|
+
"type": "string"
|
993
1041
|
}
|
994
1042
|
},
|
995
1043
|
"required": [
|
@@ -1019,6 +1067,23 @@
|
|
1019
1067
|
"Literal": {
|
1020
1068
|
"$ref": "#/definitions/TypeOf%3CZodUnion%3C%5Bdef-class-1315922706-6501-8772-1315922706-0-54395%2Cdef-class-1315922706-9299-10989-1315922706-0-54395%2Cdef-class-1315922706-12937-13365-1315922706-0-54395%2Cdef-class-1315922706-15083-15273-1315922706-0-54395%5D%3E%3E"
|
1021
1069
|
},
|
1070
|
+
"Observability": {
|
1071
|
+
"additionalProperties": false,
|
1072
|
+
"properties": {
|
1073
|
+
"enabled": {
|
1074
|
+
"description": "If observability is enabled for this Worker",
|
1075
|
+
"type": "boolean"
|
1076
|
+
},
|
1077
|
+
"head_sampling_rate": {
|
1078
|
+
"description": "The sampling rate",
|
1079
|
+
"type": "number"
|
1080
|
+
}
|
1081
|
+
},
|
1082
|
+
"required": [
|
1083
|
+
"enabled"
|
1084
|
+
],
|
1085
|
+
"type": "object"
|
1086
|
+
},
|
1022
1087
|
"RawConfig": {
|
1023
1088
|
"additionalProperties": false,
|
1024
1089
|
"properties": {
|
@@ -1609,14 +1674,44 @@
|
|
1609
1674
|
"description": "Add polyfills for node builtin modules and globals",
|
1610
1675
|
"type": "boolean"
|
1611
1676
|
},
|
1677
|
+
"observability": {
|
1678
|
+
"$ref": "#/definitions/Observability",
|
1679
|
+
"description": "Specify the observability behavior of the Worker."
|
1680
|
+
},
|
1612
1681
|
"pages_build_output_dir": {
|
1613
1682
|
"description": "The directory of static assets to serve.\n\nThe presence of this field in `wrangler.toml` indicates a Pages project, and will prompt the handling of the configuration file according to the Pages-specific validation rules.",
|
1614
1683
|
"type": "string"
|
1615
1684
|
},
|
1685
|
+
"pipelines": {
|
1686
|
+
"default": "`[]`",
|
1687
|
+
"description": "Specifies list of Pipelines bound to this Worker environment\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
1688
|
+
"items": {
|
1689
|
+
"additionalProperties": false,
|
1690
|
+
"properties": {
|
1691
|
+
"binding": {
|
1692
|
+
"description": "The binding name used to refer to the bound service.",
|
1693
|
+
"type": "string"
|
1694
|
+
},
|
1695
|
+
"pipeline": {
|
1696
|
+
"description": "Name of the Pipeline to bind",
|
1697
|
+
"type": "string"
|
1698
|
+
}
|
1699
|
+
},
|
1700
|
+
"required": [
|
1701
|
+
"binding",
|
1702
|
+
"pipeline"
|
1703
|
+
],
|
1704
|
+
"type": "object"
|
1705
|
+
},
|
1706
|
+
"type": "array"
|
1707
|
+
},
|
1616
1708
|
"placement": {
|
1617
1709
|
"additionalProperties": false,
|
1618
1710
|
"description": "Specify how the Worker should be located to minimize round-trip time.\n\nMore details: https://developers.cloudflare.com/workers/platform/smart-placement/",
|
1619
1711
|
"properties": {
|
1712
|
+
"hint": {
|
1713
|
+
"type": "string"
|
1714
|
+
},
|
1620
1715
|
"mode": {
|
1621
1716
|
"enum": [
|
1622
1717
|
"off",
|
@@ -2577,10 +2672,40 @@
|
|
2577
2672
|
"description": "Add polyfills for node builtin modules and globals",
|
2578
2673
|
"type": "boolean"
|
2579
2674
|
},
|
2675
|
+
"observability": {
|
2676
|
+
"$ref": "#/definitions/Observability",
|
2677
|
+
"description": "Specify the observability behavior of the Worker."
|
2678
|
+
},
|
2679
|
+
"pipelines": {
|
2680
|
+
"default": "`[]`",
|
2681
|
+
"description": "Specifies list of Pipelines bound to this Worker environment\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
2682
|
+
"items": {
|
2683
|
+
"additionalProperties": false,
|
2684
|
+
"properties": {
|
2685
|
+
"binding": {
|
2686
|
+
"description": "The binding name used to refer to the bound service.",
|
2687
|
+
"type": "string"
|
2688
|
+
},
|
2689
|
+
"pipeline": {
|
2690
|
+
"description": "Name of the Pipeline to bind",
|
2691
|
+
"type": "string"
|
2692
|
+
}
|
2693
|
+
},
|
2694
|
+
"required": [
|
2695
|
+
"binding",
|
2696
|
+
"pipeline"
|
2697
|
+
],
|
2698
|
+
"type": "object"
|
2699
|
+
},
|
2700
|
+
"type": "array"
|
2701
|
+
},
|
2580
2702
|
"placement": {
|
2581
2703
|
"additionalProperties": false,
|
2582
2704
|
"description": "Specify how the Worker should be located to minimize round-trip time.\n\nMore details: https://developers.cloudflare.com/workers/platform/smart-placement/",
|
2583
2705
|
"properties": {
|
2706
|
+
"hint": {
|
2707
|
+
"type": "string"
|
2708
|
+
},
|
2584
2709
|
"mode": {
|
2585
2710
|
"enum": [
|
2586
2711
|
"off",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrangler",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.77.0",
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
5
5
|
"keywords": [
|
6
6
|
"wrangler",
|
@@ -63,15 +63,15 @@
|
|
63
63
|
"selfsigned": "^2.0.1",
|
64
64
|
"source-map": "^0.6.1",
|
65
65
|
"unenv": "npm:unenv-nightly@2.0.0-1724863496.70db6f1",
|
66
|
-
"workerd": "1.
|
66
|
+
"workerd": "1.20240909.0",
|
67
67
|
"xxhash-wasm": "^1.0.1",
|
68
68
|
"@cloudflare/kv-asset-handler": "0.3.4",
|
69
|
-
"@cloudflare/workers-shared": "0.
|
70
|
-
"miniflare": "3.
|
69
|
+
"@cloudflare/workers-shared": "0.5.0",
|
70
|
+
"miniflare": "3.20240909.0"
|
71
71
|
},
|
72
72
|
"devDependencies": {
|
73
73
|
"@cloudflare/types": "^6.18.4",
|
74
|
-
"@cloudflare/workers-types": "^4.
|
74
|
+
"@cloudflare/workers-types": "^4.20240909.0",
|
75
75
|
"@cspotcode/source-map-support": "0.8.1",
|
76
76
|
"@iarna/toml": "^3.0.0",
|
77
77
|
"@microsoft/api-extractor": "^7.47.0",
|
@@ -154,11 +154,11 @@
|
|
154
154
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
155
155
|
"@cloudflare/cli": "1.1.1",
|
156
156
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
157
|
-
"@cloudflare/
|
158
|
-
"@cloudflare/
|
157
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
158
|
+
"@cloudflare/pages-shared": "^0.11.56"
|
159
159
|
},
|
160
160
|
"peerDependencies": {
|
161
|
-
"@cloudflare/workers-types": "^4.
|
161
|
+
"@cloudflare/workers-types": "^4.20240909.0"
|
162
162
|
},
|
163
163
|
"peerDependenciesMeta": {
|
164
164
|
"@cloudflare/workers-types": {
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/// <reference path="middleware-mock-analytics-engine.d.ts"/>
|
2
|
+
|
3
|
+
import { bindings } from "config:middleware/mock-analytics-engine";
|
4
|
+
import type { Middleware } from "./common";
|
5
|
+
|
6
|
+
const bindingsEnv = Object.fromEntries(
|
7
|
+
bindings.map((binding) => [
|
8
|
+
binding,
|
9
|
+
{
|
10
|
+
writeDataPoint() {
|
11
|
+
// no op in dev
|
12
|
+
},
|
13
|
+
},
|
14
|
+
])
|
15
|
+
) satisfies Record<string, AnalyticsEngineDataset>;
|
16
|
+
|
17
|
+
const analyticsEngine: Middleware = async (
|
18
|
+
request,
|
19
|
+
env,
|
20
|
+
_ctx,
|
21
|
+
middlewareCtx
|
22
|
+
) => {
|
23
|
+
// we're going to directly modify env so it maintains referential equality
|
24
|
+
for (const binding of bindings) {
|
25
|
+
env[binding] ??= bindingsEnv[binding];
|
26
|
+
}
|
27
|
+
return await middlewareCtx.next(request, env);
|
28
|
+
};
|
29
|
+
|
30
|
+
export default analyticsEngine;
|
@@ -14,7 +14,7 @@ import type * as kvAssetHandler from "@cloudflare/kv-asset-handler";
|
|
14
14
|
|
15
15
|
const ASSET_MANIFEST = JSON.parse(manifest);
|
16
16
|
|
17
|
-
const staticAssets: Middleware = async (request, env,
|
17
|
+
const staticAssets: Middleware = async (request, env, ctx, middlewareCtx) => {
|
18
18
|
let options: Partial<Options> = {
|
19
19
|
ASSET_MANIFEST,
|
20
20
|
ASSET_NAMESPACE: env.__STATIC_CONTENT,
|
@@ -27,7 +27,7 @@ const staticAssets: Middleware = async (request, env, _ctx, middlewareCtx) => {
|
|
27
27
|
{
|
28
28
|
request,
|
29
29
|
waitUntil(promise) {
|
30
|
-
return
|
30
|
+
return ctx.waitUntil(promise);
|
31
31
|
},
|
32
32
|
},
|
33
33
|
options
|
package/wrangler-dist/cli.d.ts
CHANGED
@@ -30,6 +30,7 @@ import { UrlObject } from 'url';
|
|
30
30
|
import { URLSearchParams as URLSearchParams_2 } from 'url';
|
31
31
|
import type { WorkerOptions } from 'miniflare';
|
32
32
|
import { Writable } from 'stream';
|
33
|
+
import { z } from 'zod';
|
33
34
|
|
34
35
|
declare type AbortSignal_2 = unknown;
|
35
36
|
|
@@ -72,6 +73,19 @@ declare type ApiCredentials = {
|
|
72
73
|
authEmail: string;
|
73
74
|
};
|
74
75
|
|
76
|
+
declare type AssetConfig = z.infer<typeof AssetConfigSchema>;
|
77
|
+
|
78
|
+
declare const AssetConfigSchema: z.ZodObject<{
|
79
|
+
html_handling: z.ZodOptional<z.ZodEnum<["auto-trailing-slash", "force-trailing-slash", "drop-trailing-slash", "none"]>>;
|
80
|
+
not_found_handling: z.ZodOptional<z.ZodEnum<["single-page-application", "404-page", "none"]>>;
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
82
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
83
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
84
|
+
}, {
|
85
|
+
html_handling?: "none" | "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash";
|
86
|
+
not_found_handling?: "none" | "single-page-application" | "404-page";
|
87
|
+
}>;
|
88
|
+
|
75
89
|
declare type AsyncHook<T extends HookValues, Args extends unknown[] = []> = Hook<T, Args> | Hook<Promise<T>, Args>;
|
76
90
|
|
77
91
|
declare class BalancedPool extends Dispatcher {
|
@@ -148,6 +162,8 @@ declare type Binding = {
|
|
148
162
|
} & Omit<CfDispatchNamespace, "binding">) | ({
|
149
163
|
type: "mtls_certificate";
|
150
164
|
} & Omit<CfMTlsCertificate, "binding">) | ({
|
165
|
+
type: "pipeline";
|
166
|
+
} & Omit<CfPipeline, "binding">) | ({
|
151
167
|
type: "logfwdr";
|
152
168
|
} & Omit<CfLogfwdrBinding, "name">) | {
|
153
169
|
type: `unsafe_${string}`;
|
@@ -519,6 +535,11 @@ declare interface CfMTlsCertificate {
|
|
519
535
|
certificate_id: string;
|
520
536
|
}
|
521
537
|
|
538
|
+
declare interface CfPipeline {
|
539
|
+
binding: string;
|
540
|
+
pipeline: string;
|
541
|
+
}
|
542
|
+
|
522
543
|
declare interface CfQueue {
|
523
544
|
binding: string;
|
524
545
|
queue_name: string;
|
@@ -975,7 +996,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
975
996
|
modified_on: string;
|
976
997
|
short_id: string;
|
977
998
|
build_image_major_version: number;
|
978
|
-
kv_namespaces?: any;
|
979
999
|
source?: {
|
980
1000
|
type: "github" | "gitlab";
|
981
1001
|
config: {
|
@@ -990,6 +1010,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
990
1010
|
preview_branch_excludes?: string[] | undefined;
|
991
1011
|
};
|
992
1012
|
} | undefined;
|
1013
|
+
kv_namespaces?: any;
|
993
1014
|
env_vars?: any;
|
994
1015
|
durable_object_namespaces?: any;
|
995
1016
|
is_skipped?: boolean | undefined;
|
@@ -1698,6 +1719,7 @@ declare interface EnvironmentInheritable {
|
|
1698
1719
|
*/
|
1699
1720
|
placement: {
|
1700
1721
|
mode: "off" | "smart";
|
1722
|
+
hint?: string;
|
1701
1723
|
} | undefined;
|
1702
1724
|
/**
|
1703
1725
|
* Specify the directory of static assets to deploy/serve
|
@@ -1705,6 +1727,12 @@ declare interface EnvironmentInheritable {
|
|
1705
1727
|
* @inheritable
|
1706
1728
|
*/
|
1707
1729
|
experimental_assets: ExperimentalAssets | undefined;
|
1730
|
+
/**
|
1731
|
+
* Specify the observability behavior of the Worker.
|
1732
|
+
*
|
1733
|
+
* @inheritable
|
1734
|
+
*/
|
1735
|
+
observability: Observability | undefined;
|
1708
1736
|
}
|
1709
1737
|
|
1710
1738
|
/**
|
@@ -2062,6 +2090,21 @@ declare interface EnvironmentNonInheritable {
|
|
2062
2090
|
/** Details about the outbound Worker which will handle outbound requests from your namespace */
|
2063
2091
|
outbound?: DispatchNamespaceOutbound;
|
2064
2092
|
}[];
|
2093
|
+
/**
|
2094
|
+
* Specifies list of Pipelines bound to this Worker environment
|
2095
|
+
*
|
2096
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
2097
|
+
* and so must be specified in every named environment.
|
2098
|
+
*
|
2099
|
+
* @default `[]`
|
2100
|
+
* @nonInheritable
|
2101
|
+
*/
|
2102
|
+
pipelines: {
|
2103
|
+
/** The binding name used to refer to the bound service. */
|
2104
|
+
binding: string;
|
2105
|
+
/** Name of the Pipeline to bind */
|
2106
|
+
pipeline: string;
|
2107
|
+
}[];
|
2065
2108
|
}
|
2066
2109
|
|
2067
2110
|
declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
|
@@ -2277,11 +2320,14 @@ declare type ExperimentalAssets = {
|
|
2277
2320
|
/** Absolute path to assets directory */
|
2278
2321
|
directory: string;
|
2279
2322
|
binding?: string;
|
2323
|
+
html_handling?: "auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none";
|
2324
|
+
not_found_handling?: "single-page-application" | "404-page" | "none";
|
2280
2325
|
};
|
2281
2326
|
|
2282
|
-
declare
|
2327
|
+
declare type ExperimentalAssetsOptions = Pick<ExperimentalAssets, "directory" | "binding"> & {
|
2283
2328
|
routingConfig: RoutingConfig;
|
2284
|
-
|
2329
|
+
assetConfig: AssetConfig;
|
2330
|
+
};
|
2285
2331
|
|
2286
2332
|
declare function fetch (
|
2287
2333
|
input: RequestInfo,
|
@@ -2831,11 +2877,19 @@ declare interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
2831
2877
|
/**
|
2832
2878
|
* Wrangler can provide Node.js compatibility in a number of different modes:
|
2833
2879
|
* - "legacy" - this mode adds compile-time polyfills that are not well maintained and cannot work with workerd runtime builtins.
|
2880
|
+
* - "als": this mode tells the workerd runtime to enable only the Async Local Storage builtin library (accessible via `node:async_hooks`).
|
2834
2881
|
* - "v1" - this mode tells the workerd runtime to enable some Node.js builtin libraries (accessible only via `node:...` imports) but no globals.
|
2835
2882
|
* - "v2" - this mode tells the workerd runtime to enable more Node.js builtin libraries (accessible both with and without the `node:` prefix)
|
2836
2883
|
* and also some Node.js globals such as `Buffer`; it also turns on additional compile-time polyfills for those that are not provided by the runtime.
|
2837
2884
|
*/
|
2838
|
-
declare type NodeJSCompatMode = "legacy" | "v1" | "v2" | null;
|
2885
|
+
declare type NodeJSCompatMode = "legacy" | "als" | "v1" | "v2" | null;
|
2886
|
+
|
2887
|
+
declare interface Observability {
|
2888
|
+
/** If observability is enabled for this Worker */
|
2889
|
+
enabled: boolean;
|
2890
|
+
/** The sampling rate */
|
2891
|
+
head_sampling_rate?: number;
|
2892
|
+
}
|
2839
2893
|
|
2840
2894
|
declare interface PagesConfigFields {
|
2841
2895
|
/**
|
@@ -25761,9 +25815,15 @@ declare namespace RetryHandler {
|
|
25761
25815
|
|
25762
25816
|
declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
25763
25817
|
|
25764
|
-
declare type RoutingConfig =
|
25765
|
-
|
25766
|
-
|
25818
|
+
declare type RoutingConfig = z.infer<typeof RoutingConfigSchema>;
|
25819
|
+
|
25820
|
+
declare const RoutingConfigSchema: z.ZodObject<{
|
25821
|
+
has_user_worker: z.ZodOptional<z.ZodBoolean>;
|
25822
|
+
}, "strip", z.ZodTypeAny, {
|
25823
|
+
has_user_worker?: boolean;
|
25824
|
+
}, {
|
25825
|
+
has_user_worker?: boolean;
|
25826
|
+
}>;
|
25767
25827
|
|
25768
25828
|
/**
|
25769
25829
|
* A bundling resolver rule, defining the modules type for paths that match the specified globs.
|