wrangler 3.88.0 → 3.89.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "3.88.0",
3
+ "version": "3.89.0",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -66,9 +66,9 @@
66
66
  "unenv": "npm:unenv-nightly@2.0.0-20241111-080453-894aa31",
67
67
  "workerd": "1.20241106.1",
68
68
  "xxhash-wasm": "^1.0.1",
69
+ "@cloudflare/kv-asset-handler": "0.3.4",
69
70
  "@cloudflare/workers-shared": "0.7.1",
70
- "miniflare": "3.20241106.0",
71
- "@cloudflare/kv-asset-handler": "0.3.4"
71
+ "miniflare": "3.20241106.1"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@cloudflare/types": "6.18.4",
@@ -139,9 +139,9 @@
139
139
  "ws": "^8.18.0",
140
140
  "xdg-app-paths": "^8.3.0",
141
141
  "yargs": "^17.7.2",
142
- "@cloudflare/eslint-config-worker": "1.1.0",
143
142
  "@cloudflare/cli": "1.1.1",
144
- "@cloudflare/pages-shared": "^0.11.68",
143
+ "@cloudflare/pages-shared": "^0.11.69",
144
+ "@cloudflare/eslint-config-worker": "1.1.0",
145
145
  "@cloudflare/workers-tsconfig": "0.0.0"
146
146
  },
147
147
  "peerDependencies": {
@@ -1469,7 +1469,7 @@ declare type Entry = {
1469
1469
  /** A worker's entrypoint */
1470
1470
  file: string;
1471
1471
  /** A worker's directory. Usually where the wrangler.toml file is located */
1472
- directory: string;
1472
+ projectRoot: string;
1473
1473
  /** Is this a module worker or a service worker? */
1474
1474
  format: CfScriptFormat;
1475
1475
  /** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
@@ -26059,7 +26059,7 @@ declare interface StartDevWorkerInput {
26059
26059
 
26060
26060
  declare type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets"> & {
26061
26061
  /** A worker's directory. Usually where the wrangler.toml file is located */
26062
- directory: string;
26062
+ projectRoot: string;
26063
26063
  build: StartDevWorkerInput["build"] & {
26064
26064
  nodejsCompatMode: NodeJSCompatMode;
26065
26065
  format: CfScriptFormat;
@@ -111718,7 +111718,7 @@ init_import_meta_url();
111718
111718
 
111719
111719
  // package.json
111720
111720
  var name = "wrangler";
111721
- var version = "3.88.0";
111721
+ var version = "3.89.0";
111722
111722
 
111723
111723
  // src/pages/constants.ts
111724
111724
  var isWindows = process.platform === "win32";
@@ -116089,7 +116089,7 @@ var validateObservability = /* @__PURE__ */ __name((diagnostics, field, value) =
116089
116089
  "logs"
116090
116090
  ]) && isValid2;
116091
116091
  if (typeof val.logs === "object") {
116092
- isValid2 = validateRequiredProperty(
116092
+ isValid2 = validateOptionalProperty(
116093
116093
  diagnostics,
116094
116094
  field,
116095
116095
  "logs.enabled",
@@ -126647,7 +126647,7 @@ async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
126647
126647
  let pythonRequirements = "";
126648
126648
  try {
126649
126649
  pythonRequirements = await (0, import_promises8.readFile)(
126650
- import_node_path17.default.resolve(entry.directory, "requirements.txt"),
126650
+ import_node_path17.default.resolve(entry.projectRoot, "requirements.txt"),
126651
126651
  "utf-8"
126652
126652
  );
126653
126653
  } catch (e4) {
@@ -126940,7 +126940,7 @@ async function bundleWorker(entry, destination, {
126940
126940
  path: require.resolve(aliasPath, {
126941
126941
  // From the esbuild alias docs: "Note that when an import path is substituted using an alias, the resulting import path is resolved in the working directory instead of in the directory containing the source file with the import path."
126942
126942
  // https://esbuild.github.io/api/#alias:~:text=Note%20that%20when%20an%20import%20path%20is%20substituted%20using%20an%20alias%2C%20the%20resulting%20import%20path%20is%20resolved%20in%20the%20working%20directory%20instead%20of%20in%20the%20directory%20containing%20the%20source%20file%20with%20the%20import%20path.
126943
- paths: [entry.directory]
126943
+ paths: [entry.projectRoot]
126944
126944
  })
126945
126945
  };
126946
126946
  }
@@ -126951,7 +126951,7 @@ async function bundleWorker(entry, destination, {
126951
126951
  // Don't use entryFile here as the file may have been changed when applying the middleware
126952
126952
  entryPoints: [entry.file],
126953
126953
  bundle,
126954
- absWorkingDir: entry.directory,
126954
+ absWorkingDir: entry.projectRoot,
126955
126955
  outdir: destination,
126956
126956
  keepNames: true,
126957
126957
  entryNames: entryName || path16.parse(entryFile).name,
@@ -127069,7 +127069,7 @@ You should export these objects from your entrypoint, ${relativePath}.`
127069
127069
  (_path) => _path.includes(".map")
127070
127070
  )[0];
127071
127071
  const resolvedEntryPointPath = path16.resolve(
127072
- entry.directory,
127072
+ entry.projectRoot,
127073
127073
  entryPoint.relativePath
127074
127074
  );
127075
127075
  const modules = dedupeModulesByName([
@@ -127086,7 +127086,7 @@ You should export these objects from your entrypoint, ${relativePath}.`
127086
127086
  sourceMapPath,
127087
127087
  sourceMapMetadata: {
127088
127088
  tmpDir: tmpDir.path,
127089
- entryDirectory: entry.directory
127089
+ entryDirectory: entry.projectRoot
127090
127090
  }
127091
127091
  };
127092
127092
  }
@@ -134075,7 +134075,7 @@ function buildWorkerFromFunctions({
134075
134075
  }) {
134076
134076
  const entry = {
134077
134077
  file: (0, import_node_path34.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
134078
- directory: functionsDirectory,
134078
+ projectRoot: functionsDirectory,
134079
134079
  format: "modules",
134080
134080
  moduleRoot: functionsDirectory,
134081
134081
  exports: []
@@ -134144,7 +134144,7 @@ function buildRawWorker({
134144
134144
  }) {
134145
134145
  const entry = {
134146
134146
  file: workerScriptPath,
134147
- directory: (0, import_node_path34.resolve)(directory),
134147
+ projectRoot: (0, import_node_path34.resolve)(directory),
134148
134148
  format: "modules",
134149
134149
  moduleRoot: (0, import_node_path34.resolve)(directory),
134150
134150
  exports: []
@@ -134218,7 +134218,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
134218
134218
  const additionalModules = await findAdditionalModules(
134219
134219
  {
134220
134220
  file: entrypoint,
134221
- directory: (0, import_node_path34.resolve)(workerJSDirectory),
134221
+ projectRoot: (0, import_node_path34.resolve)(workerJSDirectory),
134222
134222
  format: "modules",
134223
134223
  moduleRoot: (0, import_node_path34.resolve)(workerJSDirectory),
134224
134224
  exports: []
@@ -134413,7 +134413,7 @@ function buildPluginFromFunctions({
134413
134413
  }) {
134414
134414
  const entry = {
134415
134415
  file: (0, import_node_path35.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
134416
- directory: functionsDirectory,
134416
+ projectRoot: functionsDirectory,
134417
134417
  format: "modules",
134418
134418
  moduleRoot: functionsDirectory,
134419
134419
  exports: []
@@ -135709,7 +135709,7 @@ function runBuild({
135709
135709
  stopWatching = bundleResult?.stop;
135710
135710
  if (noBundle) {
135711
135711
  const watching = [import_node_path43.default.resolve(entry.moduleRoot)];
135712
- const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ? import_node_path43.default.resolve(entry.directory, "requirements.txt") : void 0;
135712
+ const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ? import_node_path43.default.resolve(entry.projectRoot, "requirements.txt") : void 0;
135713
135713
  if (watchPythonRequirements) {
135714
135714
  watching.push(watchPythonRequirements);
135715
135715
  }
@@ -135785,7 +135785,7 @@ var BundlerController = class extends Controller {
135785
135785
  this.#customBuildAborter.abort();
135786
135786
  this.#customBuildAborter = new AbortController();
135787
135787
  const buildAborter = this.#customBuildAborter;
135788
- const relativeFile = import_path9.default.relative(config.directory, config.entrypoint) || ".";
135788
+ const relativeFile = import_path9.default.relative(config.projectRoot, config.entrypoint) || ".";
135789
135789
  logger.log(`The file ${filePath} changed, restarting build...`);
135790
135790
  this.emitBundleStartEvent(config);
135791
135791
  try {
@@ -135806,7 +135806,7 @@ var BundlerController = class extends Controller {
135806
135806
  }
135807
135807
  const entry = {
135808
135808
  file: config.entrypoint,
135809
- directory: config.directory,
135809
+ projectRoot: config.projectRoot,
135810
135810
  format: config.build.format,
135811
135811
  moduleRoot: config.build.moduleRoot,
135812
135812
  exports: config.build.exports
@@ -135856,7 +135856,7 @@ var BundlerController = class extends Controller {
135856
135856
  // This could potentially cause issues as we no longer have identical behaviour between dev and deploy?
135857
135857
  targetConsumer: "dev",
135858
135858
  local: !config.dev?.remote,
135859
- projectRoot: config.directory,
135859
+ projectRoot: config.projectRoot,
135860
135860
  defineNavigatorUserAgent: isNavigatorDefined(
135861
135861
  config.compatibilityDate,
135862
135862
  config.compatibilityFlags
@@ -135935,7 +135935,7 @@ var BundlerController = class extends Controller {
135935
135935
  (0, import_assert3.default)(this.#tmpDir);
135936
135936
  const entry = {
135937
135937
  file: config.entrypoint,
135938
- directory: config.directory,
135938
+ projectRoot: config.projectRoot,
135939
135939
  format: config.build.format,
135940
135940
  moduleRoot: config.build.moduleRoot,
135941
135941
  exports: config.build.exports
@@ -135970,7 +135970,7 @@ var BundlerController = class extends Controller {
135970
135970
  // startDevWorker only applies to "dev"
135971
135971
  targetConsumer: "dev",
135972
135972
  testScheduled: Boolean(config.dev?.testScheduled),
135973
- projectRoot: config.directory,
135973
+ projectRoot: config.projectRoot,
135974
135974
  onStart: () => {
135975
135975
  this.emitBundleStartEvent(config);
135976
135976
  },
@@ -136026,7 +136026,7 @@ var BundlerController = class extends Controller {
136026
136026
  onConfigUpdate(event) {
136027
136027
  this.#tmpDir?.remove();
136028
136028
  try {
136029
- this.#tmpDir = getWranglerTmpDir(event.config.directory, "dev");
136029
+ this.#tmpDir = getWranglerTmpDir(event.config.projectRoot, "dev");
136030
136030
  } catch (e4) {
136031
136031
  logger.error(
136032
136032
  "Failed to create temporary directory to store built files."
@@ -148458,17 +148458,17 @@ function resolveEntryWithScript(script) {
148458
148458
  }
148459
148459
  __name(resolveEntryWithScript, "resolveEntryWithScript");
148460
148460
  function resolveEntryWithMain(main2, configPath) {
148461
- const directory = import_path16.default.resolve(import_path16.default.dirname(configPath ?? "."));
148462
- const file = import_path16.default.resolve(directory, main2);
148463
- const relativePath = import_path16.default.relative(directory, file) || ".";
148464
- return { absolutePath: file, relativePath };
148461
+ const projectRoot = import_path16.default.resolve(import_path16.default.dirname(configPath ?? "."));
148462
+ const file = import_path16.default.resolve(projectRoot, main2);
148463
+ const relativePath = import_path16.default.relative(projectRoot, file) || ".";
148464
+ return { absolutePath: file, relativePath, projectRoot };
148465
148465
  }
148466
148466
  __name(resolveEntryWithMain, "resolveEntryWithMain");
148467
148467
  function resolveEntryWithEntryPoint(entryPoint, configPath) {
148468
- const directory = import_path16.default.resolve(import_path16.default.dirname(configPath ?? "."));
148468
+ const projectRoot = import_path16.default.resolve(import_path16.default.dirname(configPath ?? "."));
148469
148469
  const file = import_path16.default.extname(entryPoint) ? import_path16.default.resolve(entryPoint) : import_path16.default.resolve(entryPoint, "index.js");
148470
- const relativePath = import_path16.default.relative(directory, file) || ".";
148471
- return { absolutePath: file, relativePath };
148470
+ const relativePath = import_path16.default.relative(projectRoot, file) || ".";
148471
+ return { absolutePath: file, relativePath, projectRoot };
148472
148472
  }
148473
148473
  __name(resolveEntryWithEntryPoint, "resolveEntryWithEntryPoint");
148474
148474
  function resolveEntryWithAssets() {
@@ -148480,7 +148480,6 @@ __name(resolveEntryWithAssets, "resolveEntryWithAssets");
148480
148480
 
148481
148481
  // src/deployment-bundle/entry.ts
148482
148482
  async function getEntry(args, config, command4) {
148483
- const directory = process.cwd();
148484
148483
  const entryPoint = config.site?.["entry-point"];
148485
148484
  let paths;
148486
148485
  if (args.script) {
@@ -148502,9 +148501,10 @@ async function getEntry(args, config, command4) {
148502
148501
  );
148503
148502
  }
148504
148503
  await runCustomBuild(paths.absolutePath, paths.relativePath, config.build);
148504
+ const projectRoot = paths.projectRoot ?? process.cwd();
148505
148505
  const { format: format10, exports: exports2 } = await guessWorkerFormat(
148506
148506
  paths.absolutePath,
148507
- directory,
148507
+ projectRoot,
148508
148508
  args.format ?? config.build?.upload?.format,
148509
148509
  config.tsconfig
148510
148510
  );
@@ -148530,7 +148530,7 @@ ${migrateUrl}`
148530
148530
  }
148531
148531
  return {
148532
148532
  file: paths.absolutePath,
148533
- directory,
148533
+ projectRoot,
148534
148534
  format: format10,
148535
148535
  moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path47.default.dirname(paths.absolutePath),
148536
148536
  name: config.name ?? "worker",
@@ -148847,7 +148847,7 @@ To learn more about Workers with assets, visit our documentation at https://deve
148847
148847
  await verifyWorkerMatchesCITag(
148848
148848
  accountId,
148849
148849
  name2,
148850
- import_node_path48.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
148850
+ import_node_path48.default.relative(entry.projectRoot, config.configPath ?? "wrangler.toml")
148851
148851
  );
148852
148852
  }
148853
148853
  const { sourceMapSize, versionId, workerTag, targets } = await deploy({
@@ -155016,7 +155016,13 @@ ${failureMessage}`,
155016
155016
  deployment_id: deploymentResponse.id,
155017
155017
  url: deploymentResponse.url,
155018
155018
  alias,
155019
- environment: deploymentResponse.environment
155019
+ environment: deploymentResponse.environment,
155020
+ production_branch: deploymentResponse.production_branch,
155021
+ deployment_trigger: {
155022
+ metadata: {
155023
+ commit_hash: deploymentResponse.deployment_trigger?.metadata?.commit_hash ?? ""
155024
+ }
155025
+ }
155020
155026
  });
155021
155027
  await sendMetricsEvent("create pages deployment");
155022
155028
  }, "Handler");
@@ -155458,7 +155464,9 @@ async function Handler13({
155458
155464
  throw new FatalError("Must specify a project name or deployment.", 1);
155459
155465
  }
155460
155466
  const deployments2 = await fetchResult(
155461
- `/accounts/${accountId}/pages/projects/${projectName}/deployments`
155467
+ `/accounts/${accountId}/pages/projects/${projectName}/deployments`,
155468
+ {},
155469
+ new URLSearchParams({ env: environment })
155462
155470
  );
155463
155471
  const envDeployments = deployments2.filter(
155464
155472
  (d2) => d2.environment === environment
@@ -155563,11 +155571,16 @@ function ListOptions4(yargs) {
155563
155571
  "project-name": {
155564
155572
  type: "string",
155565
155573
  description: "The name of the project you would like to list deployments for"
155574
+ },
155575
+ environment: {
155576
+ type: "string",
155577
+ choices: ["production", "preview"],
155578
+ description: "Environment type to list deployments for"
155566
155579
  }
155567
155580
  });
155568
155581
  }
155569
155582
  __name(ListOptions4, "ListOptions");
155570
- async function ListHandler4({ projectName }) {
155583
+ async function ListHandler4({ projectName, environment }) {
155571
155584
  const config = getConfigCache(PAGES_CONFIG_CACHE_FILENAME);
155572
155585
  const accountId = await requireAuth(config);
155573
155586
  projectName ??= config.project_name;
@@ -155579,7 +155592,9 @@ async function ListHandler4({ projectName }) {
155579
155592
  throw new FatalError("Must specify a project name.", 1);
155580
155593
  }
155581
155594
  const deployments2 = await fetchResult(
155582
- `/accounts/${accountId}/pages/projects/${projectName}/deployments`
155595
+ `/accounts/${accountId}/pages/projects/${projectName}/deployments`,
155596
+ {},
155597
+ environment ? new URLSearchParams({ env: environment }) : new URLSearchParams({})
155583
155598
  );
155584
155599
  const titleCase = /* @__PURE__ */ __name((word) => word.charAt(0).toUpperCase() + word.slice(1), "titleCase");
155585
155600
  const shortSha = /* @__PURE__ */ __name((sha) => sha.slice(0, 7), "shortSha");
@@ -173848,7 +173863,7 @@ async function versionsUploadHandler(args) {
173848
173863
  await verifyWorkerMatchesCITag(
173849
173864
  accountId,
173850
173865
  name2,
173851
- import_node_path62.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
173866
+ import_node_path62.default.relative(entry.projectRoot, config.configPath ?? "wrangler.toml")
173852
173867
  );
173853
173868
  }
173854
173869
  if (!args.dryRun) {
@@ -175094,7 +175109,7 @@ async function resolveConfig(config, input) {
175094
175109
  compatibilityDate: getDevCompatibilityDate(config, input.compatibilityDate),
175095
175110
  compatibilityFlags: input.compatibilityFlags ?? config.compatibility_flags,
175096
175111
  entrypoint: entry.file,
175097
- directory: entry.directory,
175112
+ projectRoot: entry.projectRoot,
175098
175113
  bindings,
175099
175114
  migrations: input.migrations ?? config.migrations,
175100
175115
  sendMetrics: input.sendMetrics ?? config.send_metrics,