wrangler 3.80.0 → 3.80.1

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": "3.80.0",
3
+ "version": "3.80.1",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -66,7 +66,7 @@
66
66
  "xxhash-wasm": "^1.0.1",
67
67
  "@cloudflare/kv-asset-handler": "0.3.4",
68
68
  "@cloudflare/workers-shared": "0.5.4",
69
- "miniflare": "3.20240925.0"
69
+ "miniflare": "3.20240925.1"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@cloudflare/types": "^6.18.4",
@@ -151,10 +151,10 @@
151
151
  "xdg-app-paths": "^8.3.0",
152
152
  "yargs": "^17.7.2",
153
153
  "yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
154
- "@cloudflare/eslint-config-worker": "1.1.0",
155
154
  "@cloudflare/cli": "1.1.1",
156
- "@cloudflare/pages-shared": "^0.11.62",
157
- "@cloudflare/workers-tsconfig": "0.0.0"
155
+ "@cloudflare/eslint-config-worker": "1.1.0",
156
+ "@cloudflare/workers-tsconfig": "0.0.0",
157
+ "@cloudflare/pages-shared": "^0.11.63"
158
158
  },
159
159
  "peerDependencies": {
160
160
  "@cloudflare/workers-types": "^4.20240925.0"
@@ -156596,7 +156596,10 @@ ${message}
156596
156596
  logger.debug(`\u{1FAB5} Writing logs to "${debugLogFilepath}"`);
156597
156597
  (0, import_signal_exit.default)(() => {
156598
156598
  if (hasSeenErrorMessage) {
156599
- console.warn(`\u{1FAB5} Logs were written to "${debugLogFilepath}"`);
156599
+ logger.console(
156600
+ "warn",
156601
+ `\u{1FAB5} Logs were written to "${debugLogFilepath}"`
156602
+ );
156600
156603
  }
156601
156604
  });
156602
156605
  }
@@ -156754,14 +156757,14 @@ var logger = new Logger();
156754
156757
  function logBuildWarnings(warnings) {
156755
156758
  const logs = (0, import_esbuild.formatMessagesSync)(warnings, { kind: "warning", color: true });
156756
156759
  for (const log2 of logs) {
156757
- console.warn(log2);
156760
+ logger.console("warn", log2);
156758
156761
  }
156759
156762
  }
156760
156763
  __name(logBuildWarnings, "logBuildWarnings");
156761
156764
  function logBuildFailure(errors, warnings) {
156762
156765
  const logs = (0, import_esbuild.formatMessagesSync)(errors, { kind: "error", color: true });
156763
156766
  for (const log2 of logs) {
156764
- console.error(log2);
156767
+ logger.console("error", log2);
156765
156768
  }
156766
156769
  logBuildWarnings(warnings);
156767
156770
  }
@@ -157959,7 +157962,7 @@ var import_undici3 = __toESM(require_undici());
157959
157962
 
157960
157963
  // package.json
157961
157964
  var name = "wrangler";
157962
- var version = "3.80.0";
157965
+ var version = "3.80.1";
157963
157966
 
157964
157967
  // src/user/index.ts
157965
157968
  init_import_meta_url();
@@ -159550,7 +159553,7 @@ async function fetchWorker(resource, bodyInit = {}) {
159550
159553
  headers
159551
159554
  });
159552
159555
  if (!response.ok || !response.body) {
159553
- console.error(response.ok, response.body);
159556
+ logger.error(response.ok, response.body);
159554
159557
  throw new Error(
159555
159558
  `Failed to fetch ${resource} - ${response.status}: ${response.statusText});`
159556
159559
  );
@@ -165305,6 +165308,7 @@ async function bundleWorker(entry, destination, {
165305
165308
  bundle,
165306
165309
  absWorkingDir: entry.directory,
165307
165310
  outdir: destination,
165311
+ keepNames: true,
165308
165312
  entryNames: entryName || path14.parse(entryFile).name,
165309
165313
  ...isOutfile ? {
165310
165314
  outdir: void 0,
@@ -167587,9 +167591,8 @@ function buildAssetOptions(config) {
167587
167591
  if (config.assets) {
167588
167592
  return {
167589
167593
  assets: {
167590
- workerName: config.name,
167591
- path: config.assets.directory,
167592
- bindingName: config.assets.binding,
167594
+ directory: config.assets.directory,
167595
+ binding: config.assets.binding,
167593
167596
  routingConfig: config.assets.routingConfig,
167594
167597
  assetConfig: config.assets.assetConfig
167595
167598
  }
@@ -172764,7 +172767,8 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfi
172764
172767
  metafile: true,
172765
172768
  bundle: false,
172766
172769
  write: false,
172767
- ...tsconfig && { tsconfig }
172770
+ ...tsconfig && { tsconfig },
172771
+ logLevel: "silent"
172768
172772
  });
172769
172773
  const metafile = result.metafile;
172770
172774
  const { exports: exports2 } = getEntryPointFromMetafile(entryFile, metafile);
@@ -176364,7 +176368,6 @@ function registerDevHotKeys(devEnv, args) {
176364
176368
  keys: ["x", "q", "ctrl+c"],
176365
176369
  label: "to exit",
176366
176370
  handler: async () => {
176367
- unregisterHotKeys();
176368
176371
  await devEnv.teardown();
176369
176372
  }
176370
176373
  }
@@ -214195,10 +214198,15 @@ To learn more about Workers with assets, visit our documentation at https://deve
214195
214198
  () => startDev(args)
214196
214199
  );
214197
214200
  if (args.experimentalDevEnv) {
214198
- (0, import_node_assert24.default)(devInstance instanceof DevEnv);
214199
- await import_node_events3.default.once(devInstance, "teardown");
214201
+ (0, import_node_assert24.default)(devInstance.devEnv !== void 0);
214202
+ await import_node_events3.default.once(devInstance.devEnv, "teardown");
214203
+ if (devInstance.teardownRegistryPromise) {
214204
+ const teardownRegistry = await devInstance.teardownRegistryPromise;
214205
+ await teardownRegistry(devInstance.devEnv.config.latestConfig?.name);
214206
+ }
214207
+ devInstance.unregisterHotKeys?.();
214200
214208
  } else {
214201
- (0, import_node_assert24.default)(!(devInstance instanceof DevEnv));
214209
+ (0, import_node_assert24.default)(devInstance.devEnv === void 0);
214202
214210
  configFileWatcher = devInstance.configFileWatcher;
214203
214211
  assetsWatcher = devInstance.assetsWatcher;
214204
214212
  const { waitUntilExit } = devInstance.devReactElement;
@@ -214268,6 +214276,9 @@ async function startDev(args) {
214268
214276
  let configFileWatcher;
214269
214277
  let assetsWatcher;
214270
214278
  let rerender;
214279
+ const devEnv = new DevEnv();
214280
+ let teardownRegistryPromise;
214281
+ let unregisterHotKeys;
214271
214282
  try {
214272
214283
  if (args.logLevel) {
214273
214284
  logger.loggerLevel = args.logLevel;
@@ -214300,7 +214311,6 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214300
214311
  );
214301
214312
  }
214302
214313
  const configPath = args.config || args.script && findWranglerToml(import_node_path64.default.dirname(args.script));
214303
- const devEnv = new DevEnv();
214304
214314
  if (args.experimentalDevEnv) {
214305
214315
  void devEnv.proxy.ready.promise.then(({ url: url4 }) => {
214306
214316
  if (process.send && typeof vitest === "undefined") {
@@ -214314,13 +214324,9 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214314
214324
  }
214315
214325
  });
214316
214326
  if (!args.disableDevRegistry) {
214317
- const teardownRegistryPromise = devRegistry(
214327
+ teardownRegistryPromise = devRegistry(
214318
214328
  (registry) => updateDevEnvRegistry(devEnv, registry)
214319
214329
  );
214320
- devEnv.once("teardown", async () => {
214321
- const teardownRegistry = await teardownRegistryPromise;
214322
- await teardownRegistry(devEnv.config.latestConfig?.name);
214323
- });
214324
214330
  devEnv.runtimes.forEach((runtime) => {
214325
214331
  runtime.on(
214326
214332
  "reloadComplete",
@@ -214338,7 +214344,6 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214338
214344
  );
214339
214345
  });
214340
214346
  }
214341
- let unregisterHotKeys;
214342
214347
  if (isInteractive() && args.showInteractiveDevSession !== false) {
214343
214348
  unregisterHotKeys = registerDevHotKeys(devEnv, args);
214344
214349
  }
@@ -214476,7 +214481,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214476
214481
  offline: !args.remote
214477
214482
  }
214478
214483
  );
214479
- return devEnv;
214484
+ return { devEnv, unregisterHotKeys, teardownRegistryPromise };
214480
214485
  } else {
214481
214486
  const projectRoot = configPath && import_node_path64.default.dirname(configPath);
214482
214487
  let config = readConfig(configPath, args);
@@ -214674,7 +214679,15 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
214674
214679
  } catch (e3) {
214675
214680
  await Promise.allSettled([
214676
214681
  configFileWatcher?.close(),
214677
- assetsWatcher?.close()
214682
+ assetsWatcher?.close(),
214683
+ devEnv.teardown(),
214684
+ (async () => {
214685
+ if (teardownRegistryPromise) {
214686
+ const teardownRegistry = await teardownRegistryPromise;
214687
+ await teardownRegistry(devEnv.config.latestConfig?.name);
214688
+ }
214689
+ unregisterHotKeys?.();
214690
+ })()
214678
214691
  ]);
214679
214692
  throw e3;
214680
214693
  }
@@ -215565,6 +215578,11 @@ var BundlerController = class extends Controller {
215565
215578
  #assetsWatcher;
215566
215579
  async #ensureWatchingAssets(config) {
215567
215580
  await this.#assetsWatcher?.close();
215581
+ const debouncedRefreshBundle = debounce(() => {
215582
+ if (this.#currentBundle) {
215583
+ this.emitBundleCompleteEvent(config, this.#currentBundle);
215584
+ }
215585
+ });
215568
215586
  if (config.assets?.directory) {
215569
215587
  this.#assetsWatcher = (0, import_chokidar7.watch)(config.assets.directory, {
215570
215588
  persistent: true,
@@ -215572,9 +215590,7 @@ var BundlerController = class extends Controller {
215572
215590
  }).on("all", async (eventName, filePath) => {
215573
215591
  const message = getAssetChangeMessage(eventName, filePath);
215574
215592
  logger.debug(`\u{1F300} ${message}...`);
215575
- if (this.#currentBundle) {
215576
- this.emitBundleCompleteEvent(config, this.#currentBundle);
215577
- }
215593
+ debouncedRefreshBundle();
215578
215594
  });
215579
215595
  }
215580
215596
  }
@@ -215782,6 +215798,7 @@ async function resolveConfig(config, input) {
215782
215798
  triggers: await resolveTriggers(config, input),
215783
215799
  env: input.env,
215784
215800
  build: {
215801
+ alias: input.build?.alias ?? config.alias,
215785
215802
  additionalModules: input.build?.additionalModules ?? [],
215786
215803
  processEntrypoint: Boolean(input.build?.processEntrypoint),
215787
215804
  bundle: input.build?.bundle ?? !config.no_bundle,
@@ -217244,8 +217261,9 @@ function deepFreeze(obj) {
217244
217261
  }
217245
217262
  __name(deepFreeze, "deepFreeze");
217246
217263
  function unstable_getMiniflareWorkerOptions(configPath, env7) {
217264
+ const isJsonConfigFile = configPath.endsWith(".json") || configPath.endsWith(".jsonc");
217247
217265
  const config = readConfig(configPath, {
217248
- experimentalJsonConfig: true,
217266
+ experimentalJsonConfig: isJsonConfigFile,
217249
217267
  env: env7
217250
217268
  });
217251
217269
  const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
@@ -217289,12 +217307,15 @@ function unstable_getMiniflareWorkerOptions(configPath, env7) {
217289
217307
  }
217290
217308
  const legacyAssetPaths = config.legacy_assets ? getLegacyAssetPaths(config, void 0) : getSiteAssetPaths(config);
217291
217309
  const sitesOptions = buildSitesOptions({ legacyAssetPaths });
217310
+ const processedAssetOptions = processAssetsArg({ assets: void 0 }, config);
217311
+ const assetOptions = processedAssetOptions ? buildAssetOptions({ assets: processedAssetOptions }) : {};
217292
217312
  const workerOptions = {
217293
217313
  compatibilityDate: config.compatibility_date,
217294
217314
  compatibilityFlags: config.compatibility_flags,
217295
217315
  modulesRules,
217296
217316
  ...bindingOptions,
217297
- ...sitesOptions
217317
+ ...sitesOptions,
217318
+ ...assetOptions
217298
217319
  };
217299
217320
  return { workerOptions, define: config.define, main: config.main };
217300
217321
  }