wrangler 3.114.5 → 3.114.6

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.114.5",
3
+ "version": "3.114.6",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "wrangler",
@@ -137,8 +137,8 @@
137
137
  "xdg-app-paths": "^8.3.0",
138
138
  "xxhash-wasm": "^1.0.1",
139
139
  "yargs": "^17.7.2",
140
- "@cloudflare/cli": "1.1.1",
141
140
  "@cloudflare/eslint-config-worker": "1.1.0",
141
+ "@cloudflare/cli": "1.1.1",
142
142
  "@cloudflare/workers-shared": "0.15.0",
143
143
  "@cloudflare/pages-shared": "0.13.16",
144
144
  "@cloudflare/workers-tsconfig": "0.0.0"
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
81450
81450
 
81451
81451
  // package.json
81452
81452
  var name = "wrangler";
81453
- var version = "3.114.5";
81453
+ var version = "3.114.6";
81454
81454
 
81455
81455
  // src/environment-variables/misc-variables.ts
81456
81456
  init_import_meta_url();
@@ -85217,52 +85217,74 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args)
85217
85217
  rawConfig,
85218
85218
  isDispatchNamespace
85219
85219
  );
85220
+ const isRedirectedConfig = configPath && configPath !== userConfigPath;
85221
+ const definedEnvironments = Object.keys(rawConfig.env ?? {});
85222
+ if (isRedirectedConfig && definedEnvironments.length > 0) {
85223
+ diagnostics.errors.push(
85224
+ dedent`
85225
+ Redirected configurations cannot include environments but the following have been found:\n${definedEnvironments.map((env6) => ` - ${env6}`).join("\n")}
85226
+
85227
+
85228
+ Such configurations are generated by tools, meaning that one of the tools
85229
+ your application is using is generating the incorrect configuration.
85230
+ Report this issue to the tool's author so that this can be fixed there.
85231
+ `
85232
+ );
85233
+ }
85220
85234
  const envName = args.env;
85221
85235
  (0, import_node_assert.default)(envName === void 0 || typeof envName === "string");
85222
85236
  let activeEnv = topLevelEnv;
85223
85237
  if (envName !== void 0) {
85224
- const envDiagnostics = new Diagnostics(
85225
- `"env.${envName}" environment configuration`
85226
- );
85227
- const rawEnv = rawConfig.env?.[envName];
85228
- if (rawEnv !== void 0) {
85229
- activeEnv = normalizeAndValidateEnvironment(
85230
- envDiagnostics,
85231
- configPath,
85232
- rawEnv,
85233
- isDispatchNamespace,
85234
- envName,
85235
- topLevelEnv,
85236
- isLegacyEnv2,
85237
- rawConfig
85238
- );
85239
- diagnostics.addChild(envDiagnostics);
85240
- } else if (!isPagesConfig(rawConfig)) {
85241
- activeEnv = normalizeAndValidateEnvironment(
85242
- envDiagnostics,
85243
- configPath,
85244
- topLevelEnv,
85245
- // in this case reuse the topLevelEnv to ensure that nonInherited fields are not removed
85246
- isDispatchNamespace,
85247
- envName,
85248
- topLevelEnv,
85249
- isLegacyEnv2,
85250
- rawConfig
85251
- );
85252
- const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(
85253
- Object.keys(rawConfig.env)
85254
- )}
85238
+ if (isRedirectedConfig) {
85239
+ diagnostics.errors.push(dedent`
85240
+ You have specified the environment "${envName}", but are using a redirected configuration, produced by a build tool such as Vite.
85241
+ You need to set the environment in your build tool, rather than via Wrangler.
85242
+ For example, if you are using Vite, refer to these docs: https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/
85243
+ `);
85244
+ } else {
85245
+ const envDiagnostics = new Diagnostics(
85246
+ `"env.${envName}" environment configuration`
85247
+ );
85248
+ const rawEnv = rawConfig.env?.[envName];
85249
+ if (rawEnv !== void 0) {
85250
+ activeEnv = normalizeAndValidateEnvironment(
85251
+ envDiagnostics,
85252
+ configPath,
85253
+ rawEnv,
85254
+ isDispatchNamespace,
85255
+ envName,
85256
+ topLevelEnv,
85257
+ isLegacyEnv2,
85258
+ rawConfig
85259
+ );
85260
+ diagnostics.addChild(envDiagnostics);
85261
+ } else if (!isPagesConfig(rawConfig)) {
85262
+ activeEnv = normalizeAndValidateEnvironment(
85263
+ envDiagnostics,
85264
+ configPath,
85265
+ topLevelEnv,
85266
+ // in this case reuse the topLevelEnv to ensure that nonInherited fields are not removed
85267
+ isDispatchNamespace,
85268
+ envName,
85269
+ topLevelEnv,
85270
+ isLegacyEnv2,
85271
+ rawConfig
85272
+ );
85273
+ const envNames = rawConfig.env ? `The available configured environment names are: ${JSON.stringify(
85274
+ Object.keys(rawConfig.env)
85275
+ )}
85255
85276
  ` : "";
85256
- const message = `No environment found in configuration with name "${envName}".
85277
+ const message = `No environment found in configuration with name "${envName}".
85257
85278
  Before using \`--env=${envName}\` there should be an equivalent environment section in the configuration.
85258
85279
  ${envNames}
85259
85280
  Consider adding an environment configuration section to the ${configFileName(configPath)} file:
85260
85281
  \`\`\`
85261
85282
  [env.` + envName + "]\n```\n";
85262
- if (envNames.length > 0) {
85263
- diagnostics.errors.push(message);
85264
- } else {
85265
- diagnostics.warnings.push(message);
85283
+ if (envNames.length > 0) {
85284
+ diagnostics.errors.push(message);
85285
+ } else {
85286
+ diagnostics.warnings.push(message);
85287
+ }
85266
85288
  }
85267
85289
  }
85268
85290
  }
@@ -147390,7 +147412,7 @@ async function printMembershipInfo(user, accountFilter) {
147390
147412
  } catch (e7) {
147391
147413
  if (isAuthenticationError(e7)) {
147392
147414
  logger.log(
147393
- `\u{1F3A2} Unable to get membership roles. Make sure you have permissions to read the account.`
147415
+ `\u{1F3A2} Unable to get membership roles. Make sure you have permissions to read the account. Are you missing the \`User->Memberships->Read\` permission?`
147394
147416
  );
147395
147417
  return;
147396
147418
  } else {