wrangler 4.12.0 → 4.13.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.
@@ -166,6 +166,11 @@
166
166
  "type": "boolean",
167
167
  "description": "Minify the script before uploading."
168
168
  },
169
+ "keep_names": {
170
+ "type": "boolean",
171
+ "description": "Keep function names after javascript transpilations.",
172
+ "default": "{true}"
173
+ },
169
174
  "first_party_worker": {
170
175
  "type": "boolean",
171
176
  "description": "Designates this Worker as an internal-only \"first-party\" Worker."
@@ -586,6 +591,11 @@
586
591
  "entrypoint": {
587
592
  "type": "string",
588
593
  "description": "Optionally, the entrypoint (named export) of the service to bind to."
594
+ },
595
+ "props": {
596
+ "type": "object",
597
+ "additionalProperties": {},
598
+ "description": "Optional properties that will be made available to the service via ctx.props."
589
599
  }
590
600
  },
591
601
  "required": [
@@ -1093,6 +1103,11 @@
1093
1103
  "type": "boolean",
1094
1104
  "description": "Minify the script before uploading."
1095
1105
  },
1106
+ "keep_names": {
1107
+ "type": "boolean",
1108
+ "description": "Keep function names after javascript transpilations.",
1109
+ "default": "{true}"
1110
+ },
1096
1111
  "first_party_worker": {
1097
1112
  "type": "boolean",
1098
1113
  "description": "Designates this Worker as an internal-only \"first-party\" Worker."
@@ -1513,6 +1528,11 @@
1513
1528
  "entrypoint": {
1514
1529
  "type": "string",
1515
1530
  "description": "Optionally, the entrypoint (named export) of the service to bind to."
1531
+ },
1532
+ "props": {
1533
+ "type": "object",
1534
+ "additionalProperties": {},
1535
+ "description": "Optional properties that will be made available to the service via ctx.props."
1516
1536
  }
1517
1537
  },
1518
1538
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -55,14 +55,14 @@
55
55
  "esbuild": "0.25.2",
56
56
  "path-to-regexp": "6.3.0",
57
57
  "unenv": "2.0.0-rc.15",
58
- "workerd": "1.20250416.0",
58
+ "workerd": "1.20250422.0",
59
59
  "@cloudflare/kv-asset-handler": "0.4.0",
60
- "miniflare": "4.20250416.0"
60
+ "miniflare": "4.20250422.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aws-sdk/client-s3": "^3.721.0",
64
64
  "@cloudflare/types": "6.18.4",
65
- "@cloudflare/workers-types": "^4.20250415.0",
65
+ "@cloudflare/workers-types": "^4.20250422.0",
66
66
  "@cspotcode/source-map-support": "0.8.1",
67
67
  "@iarna/toml": "^3.0.0",
68
68
  "@microsoft/api-extractor": "^7.47.0",
@@ -137,12 +137,12 @@
137
137
  "yargs": "^17.7.2",
138
138
  "@cloudflare/cli": "1.1.1",
139
139
  "@cloudflare/eslint-config-worker": "1.1.0",
140
- "@cloudflare/pages-shared": "^0.13.29",
141
- "@cloudflare/workers-tsconfig": "0.0.0",
142
- "@cloudflare/workers-shared": "0.17.2"
140
+ "@cloudflare/pages-shared": "^0.13.31",
141
+ "@cloudflare/workers-shared": "0.17.2",
142
+ "@cloudflare/workers-tsconfig": "0.0.0"
143
143
  },
144
144
  "peerDependencies": {
145
- "@cloudflare/workers-types": "^4.20250415.0"
145
+ "@cloudflare/workers-types": "^4.20250422.0"
146
146
  },
147
147
  "peerDependenciesMeta": {
148
148
  "@cloudflare/workers-types": {
@@ -724,6 +724,7 @@ declare interface CfService {
724
724
  service: string;
725
725
  environment?: string;
726
726
  entrypoint?: string;
727
+ props?: Record<string, unknown>;
727
728
  }
728
729
 
729
730
  declare interface CfUnsafe {
@@ -1797,6 +1798,13 @@ declare interface EnvironmentInheritable {
1797
1798
  * @inheritable
1798
1799
  */
1799
1800
  minify: boolean | undefined;
1801
+ /**
1802
+ * Keep function names after javascript transpilations.
1803
+ *
1804
+ * @default {true}
1805
+ * @inheritable
1806
+ */
1807
+ keep_names: boolean | undefined;
1800
1808
  /**
1801
1809
  * Designates this Worker as an internal-only "first-party" Worker.
1802
1810
  *
@@ -2121,6 +2129,8 @@ declare interface EnvironmentNonInheritable {
2121
2129
  environment?: string;
2122
2130
  /** Optionally, the entrypoint (named export) of the service to bind to. */
2123
2131
  entrypoint?: string;
2132
+ /** Optional properties that will be made available to the service via ctx.props. */
2133
+ props?: Record<string, unknown>;
2124
2134
  }[] | undefined;
2125
2135
  /**
2126
2136
  * Specifies analytics engine datasets that are bound to this Worker environment.
@@ -26141,6 +26151,8 @@ declare interface StartDevWorkerInput {
26141
26151
  alias?: Record<string, string>;
26142
26152
  /** Whether the bundled worker is minified. Only takes effect if bundle: true. */
26143
26153
  minify?: boolean;
26154
+ /** Whether to keep function names after JavaScript transpilations. */
26155
+ keepNames?: boolean;
26144
26156
  /** Options controlling a custom build step. */
26145
26157
  custom?: {
26146
26158
  /** Custom shell command to run before bundling. Runs even if bundle. */
@@ -81185,7 +81185,7 @@ var import_undici3 = __toESM(require_undici());
81185
81185
 
81186
81186
  // package.json
81187
81187
  var name = "wrangler";
81188
- var version = "4.12.0";
81188
+ var version = "4.13.0";
81189
81189
 
81190
81190
  // src/environment-variables/misc-variables.ts
81191
81191
  init_import_meta_url();
@@ -85778,6 +85778,14 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
85778
85778
  isBoolean,
85779
85779
  void 0
85780
85780
  ),
85781
+ keep_names: inheritable(
85782
+ diagnostics,
85783
+ topLevelEnv,
85784
+ rawEnv,
85785
+ "keep_names",
85786
+ isBoolean,
85787
+ void 0
85788
+ ),
85781
85789
  first_party_worker: inheritable(
85782
85790
  diagnostics,
85783
85791
  topLevelEnv,
@@ -87489,6 +87497,7 @@ var defaultWranglerConfig = {
87489
87497
  build: { command: void 0, watch_dir: "./src", cwd: void 0 },
87490
87498
  no_bundle: void 0,
87491
87499
  minify: void 0,
87500
+ keep_names: void 0,
87492
87501
  dispatch_namespaces: [],
87493
87502
  first_party_worker: void 0,
87494
87503
  logfwdr: { bindings: [] },
@@ -92749,7 +92758,8 @@ function buildMiniflareBindingOptions(config) {
92749
92758
  if (service.service === config.name || config.workerDefinitions === null) {
92750
92759
  serviceBindings[service.binding] = {
92751
92760
  name: service.service,
92752
- entrypoint: service.entrypoint
92761
+ entrypoint: service.entrypoint,
92762
+ props: service.props
92753
92763
  };
92754
92764
  continue;
92755
92765
  }
@@ -92951,6 +92961,12 @@ function buildMiniflareBindingOptions(config) {
92951
92961
  hyperdrives: Object.fromEntries(
92952
92962
  bindings.hyperdrive?.map(hyperdriveEntry) ?? []
92953
92963
  ),
92964
+ analyticsEngineDatasets: Object.fromEntries(
92965
+ bindings.analytics_engine_datasets?.map((binding) => [
92966
+ binding.binding,
92967
+ { dataset: binding.dataset ?? "dataset" }
92968
+ ]) ?? []
92969
+ ),
92954
92970
  workflows: Object.fromEntries(bindings.workflows?.map(workflowEntry) ?? []),
92955
92971
  secretsStoreSecrets: Object.fromEntries(
92956
92972
  bindings.secrets_store_secrets?.map((binding) => [
@@ -93020,7 +93036,8 @@ function buildPersistOptions(localPersistencePath) {
93020
93036
  r2Persist: import_node_path15.default.join(v3Path, "r2"),
93021
93037
  d1Persist: import_node_path15.default.join(v3Path, "d1"),
93022
93038
  workflowsPersist: import_node_path15.default.join(v3Path, "workflows"),
93023
- secretsStorePersist: import_node_path15.default.join(v3Path, "secrets-store")
93039
+ secretsStorePersist: import_node_path15.default.join(v3Path, "secrets-store"),
93040
+ analyticsEngineDatasetsPersist: import_node_path15.default.join(v3Path, "analytics-engine")
93024
93041
  };
93025
93042
  }
93026
93043
  }
@@ -103492,11 +103509,11 @@ async function bundleWorker(entry, destination, {
103492
103509
  watch: watch2,
103493
103510
  tsconfig,
103494
103511
  minify,
103512
+ keepNames,
103495
103513
  nodejsCompatMode,
103496
103514
  alias,
103497
103515
  define,
103498
103516
  checkFetch,
103499
- mockAnalyticsEngineDatasets,
103500
103517
  targetConsumer,
103501
103518
  testScheduled,
103502
103519
  inject: injectOption,
@@ -103511,16 +103528,6 @@ async function bundleWorker(entry, destination, {
103511
103528
  const tmpDir = getWranglerTmpDir(projectRoot, "bundle");
103512
103529
  const entryFile = entry.file;
103513
103530
  const middlewareToLoad = [];
103514
- if (targetConsumer === "dev" && mockAnalyticsEngineDatasets && mockAnalyticsEngineDatasets.length > 0) {
103515
- middlewareToLoad.push({
103516
- name: "mock-analytics-engine",
103517
- path: "templates/middleware/middleware-mock-analytics-engine.ts",
103518
- config: {
103519
- bindings: mockAnalyticsEngineDatasets.map(({ binding }) => binding)
103520
- },
103521
- supports: ["modules", "service-worker"]
103522
- });
103523
- }
103524
103531
  if (targetConsumer === "dev" && !process.env.WRANGLER_DISABLE_REQUEST_BODY_DRAINING) {
103525
103532
  middlewareToLoad.push({
103526
103533
  name: "ensure-req-body-drained",
@@ -103625,7 +103632,7 @@ async function bundleWorker(entry, destination, {
103625
103632
  bundle,
103626
103633
  absWorkingDir: entry.projectRoot,
103627
103634
  outdir: destination,
103628
- keepNames: true,
103635
+ keepNames,
103629
103636
  entryNames: entryName || path28.parse(entryFile).name,
103630
103637
  ...isOutfile ? {
103631
103638
  outdir: void 0,
@@ -104066,13 +104073,14 @@ function createWorkerUploadForm(worker) {
104066
104073
  }
104067
104074
  );
104068
104075
  bindings.services?.forEach(
104069
- ({ binding, service, environment, entrypoint }) => {
104076
+ ({ binding, service, environment, entrypoint, props }) => {
104070
104077
  metadataBindings.push({
104071
104078
  name: binding,
104072
104079
  type: "service",
104073
104080
  service,
104074
104081
  ...environment && { environment },
104075
- ...entrypoint && { entrypoint }
104082
+ ...entrypoint && { entrypoint },
104083
+ ...props && { props }
104076
104084
  });
104077
104085
  }
104078
104086
  );
@@ -114148,6 +114156,12 @@ async function listCommandHandle2(_args, _config) {
114148
114156
  );
114149
114157
  return;
114150
114158
  }
114159
+ if (applications === void 0 || applications === null || applications.length === 0) {
114160
+ logRaw(
114161
+ "No containers found. See https://dash.cloudflare.com/?to=/:account/workers/containers to learn more."
114162
+ );
114163
+ return;
114164
+ }
114151
114165
  const applicationDetails = /* @__PURE__ */ __name((a5) => {
114152
114166
  const details = flatDetails(a5);
114153
114167
  return {
@@ -120029,6 +120043,7 @@ function buildWorkerFromFunctions({
120029
120043
  outfile = (0, import_node_path38.join)(getPagesTmpDir(), `./functionsWorker-${Math.random()}.js`),
120030
120044
  outdir,
120031
120045
  minify = false,
120046
+ keepNames = true,
120032
120047
  sourcemap = false,
120033
120048
  fallbackService = "ASSETS",
120034
120049
  watch: watch2 = false,
@@ -120060,11 +120075,10 @@ function buildWorkerFromFunctions({
120060
120075
  inject: [routesModule],
120061
120076
  ...outdir ? { entryName: "index" } : { entryName: void 0 },
120062
120077
  minify,
120078
+ keepNames,
120063
120079
  sourcemap,
120064
120080
  watch: watch2,
120065
120081
  nodejsCompatMode,
120066
- // TODO: mock AE datasets in Pages functions for dev
120067
- mockAnalyticsEngineDatasets: [],
120068
120082
  define: {
120069
120083
  __FALLBACK_SERVICE__: JSON.stringify(fallbackService)
120070
120084
  },
@@ -120096,6 +120110,7 @@ function buildRawWorker({
120096
120110
  bundle = true,
120097
120111
  externalModules,
120098
120112
  minify = false,
120113
+ keepNames = true,
120099
120114
  sourcemap = false,
120100
120115
  watch: watch2 = false,
120101
120116
  plugins = [],
@@ -120121,11 +120136,10 @@ function buildRawWorker({
120121
120136
  moduleCollector,
120122
120137
  additionalModules,
120123
120138
  minify,
120139
+ keepNames,
120124
120140
  sourcemap,
120125
120141
  watch: watch2,
120126
120142
  nodejsCompatMode,
120127
- // TODO: mock AE datasets in Pages functions for dev
120128
- mockAnalyticsEngineDatasets: [],
120129
120143
  define: {},
120130
120144
  alias: {},
120131
120145
  doBindings: [],
@@ -120363,6 +120377,7 @@ function buildPluginFromFunctions({
120363
120377
  routesModule,
120364
120378
  outdir,
120365
120379
  minify = false,
120380
+ keepNames = true,
120366
120381
  sourcemap = false,
120367
120382
  watch: watch2 = false,
120368
120383
  onEnd = /* @__PURE__ */ __name(() => {
@@ -120392,6 +120407,7 @@ function buildPluginFromFunctions({
120392
120407
  inject: [routesModule],
120393
120408
  entryName: "index",
120394
120409
  minify,
120410
+ keepNames,
120395
120411
  sourcemap,
120396
120412
  watch: watch2,
120397
120413
  // We don't currently have a mechanism for Plugins 'requiring' a specific compat date/flag,
@@ -120449,8 +120465,6 @@ function buildPluginFromFunctions({
120449
120465
  }
120450
120466
  ],
120451
120467
  checkFetch: local && checkFetch,
120452
- // TODO: mock AE datasets in Pages functions for dev
120453
- mockAnalyticsEngineDatasets: [],
120454
120468
  targetConsumer: local ? "dev" : "deploy",
120455
120469
  local,
120456
120470
  projectRoot: getPagesProjectRoot(),
@@ -148104,12 +148118,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
148104
148118
  jsxFragment,
148105
148119
  tsconfig: props.tsconfig ?? config.tsconfig,
148106
148120
  minify,
148121
+ keepNames: config.keep_names ?? true,
148107
148122
  sourcemap: uploadSourceMaps,
148108
148123
  nodejsCompatMode,
148109
148124
  define: { ...config.define, ...props.defines },
148110
148125
  alias: { ...config.alias, ...props.alias },
148111
148126
  checkFetch: false,
148112
- mockAnalyticsEngineDatasets: [],
148113
148127
  // We want to know if the build is for development or publishing
148114
148128
  // This could potentially cause issues as we no longer have identical behaviour between dev and deploy?
148115
148129
  targetConsumer: "deploy",
@@ -151411,13 +151425,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
151411
151425
  jsxFragment,
151412
151426
  tsconfig: props.tsconfig ?? config.tsconfig,
151413
151427
  minify,
151428
+ keepNames: config.keep_names ?? true,
151414
151429
  sourcemap: uploadSourceMaps,
151415
151430
  nodejsCompatMode,
151416
151431
  define: { ...config.define, ...props.defines },
151417
151432
  checkFetch: false,
151418
151433
  alias: config.alias,
151419
- // We do not mock AE datasets when deploying
151420
- mockAnalyticsEngineDatasets: [],
151421
151434
  // We want to know if the build is for development or publishing
151422
151435
  // This could potentially cause issues as we no longer have identical behaviour between dev and deploy?
151423
151436
  targetConsumer: "deploy",
@@ -153671,12 +153684,12 @@ function runBuild({
153671
153684
  rules,
153672
153685
  tsconfig,
153673
153686
  minify,
153687
+ keepNames,
153674
153688
  nodejsCompatMode,
153675
153689
  define,
153676
153690
  alias,
153677
153691
  noBundle,
153678
153692
  findAdditionalModules: findAdditionalModules2,
153679
- mockAnalyticsEngineDatasets,
153680
153693
  durableObjects,
153681
153694
  workflows,
153682
153695
  local,
@@ -153738,12 +153751,12 @@ function runBuild({
153738
153751
  watch: true,
153739
153752
  tsconfig,
153740
153753
  minify,
153754
+ keepNames,
153741
153755
  nodejsCompatMode,
153742
153756
  doBindings: durableObjects.bindings,
153743
153757
  workflowBindings: workflows,
153744
153758
  alias,
153745
153759
  define,
153746
- mockAnalyticsEngineDatasets,
153747
153760
  targetConsumer,
153748
153761
  testScheduled,
153749
153762
  plugins: [logBuildOutput(nodejsCompatMode, onStart, updateBundle)],
@@ -153868,13 +153881,13 @@ var BundlerController = class extends Controller {
153868
153881
  jsxFragment: config.build.jsxFactory,
153869
153882
  tsconfig: config.build.tsconfig,
153870
153883
  minify: config.build.minify,
153884
+ keepNames: config.build.keepNames ?? true,
153871
153885
  nodejsCompatMode: config.build.nodejsCompatMode,
153872
153886
  define: config.build.define,
153873
153887
  checkFetch: shouldCheckFetch(
153874
153888
  config.compatibilityDate,
153875
153889
  config.compatibilityFlags
153876
153890
  ),
153877
- mockAnalyticsEngineDatasets: bindings.analytics_engine_datasets ?? [],
153878
153891
  alias: config.build.alias,
153879
153892
  // We want to know if the build is for development or publishing
153880
153893
  // This could potentially cause issues as we no longer have identical behaviour between dev and deploy?
@@ -153979,6 +153992,7 @@ var BundlerController = class extends Controller {
153979
153992
  rules: config.build.moduleRules,
153980
153993
  tsconfig: config.build?.tsconfig,
153981
153994
  minify: config.build?.minify,
153995
+ keepNames: config.build?.keepNames ?? true,
153982
153996
  nodejsCompatMode: config.build.nodejsCompatMode,
153983
153997
  define: config.build.define,
153984
153998
  alias: config.build.alias,
@@ -153986,7 +154000,6 @@ var BundlerController = class extends Controller {
153986
154000
  findAdditionalModules: config.build?.findAdditionalModules,
153987
154001
  durableObjects: bindings?.durable_objects ?? { bindings: [] },
153988
154002
  workflows: bindings?.workflows ?? [],
153989
- mockAnalyticsEngineDatasets: bindings.analytics_engine_datasets ?? [],
153990
154003
  local: !config.dev?.remote,
153991
154004
  // startDevWorker only applies to "dev"
153992
154005
  targetConsumer: "dev",
@@ -154484,6 +154497,7 @@ If you are trying to develop Pages and Workers together, please use \`wrangler p
154484
154497
  moduleRoot: entry.moduleRoot,
154485
154498
  moduleRules: input.build?.moduleRules ?? getRules(config),
154486
154499
  minify: input.build?.minify ?? config.minify,
154500
+ keepNames: input.build?.keepNames ?? config.keep_names,
154487
154501
  define: { ...config.define, ...input.build?.define },
154488
154502
  custom: {
154489
154503
  command: input.build?.custom?.command ?? config.build?.command,
@@ -1,3 +0,0 @@
1
- declare module "config:middleware/mock-analytics-engine" {
2
- export const bindings: string[];
3
- }
@@ -1,30 +0,0 @@
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;