@backstage/cli-common 0.2.1-next.1 → 0.2.2-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @backstage/cli-common
2
2
 
3
+ ## 0.2.2-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/errors@1.3.1-next.0
9
+
10
+ ## 0.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - 482ceed: Migrated from `assertError` to `toError` for error handling.
15
+ - e928e73: chore(deps): bump `undici` from 7.22.0 to 7.24.0
16
+ - 46ff470: Deprecated `bootstrapEnvProxyAgents()` in favor of Node.js built-in proxy support. Set `NODE_USE_ENV_PROXY=1` alongside your `HTTP_PROXY`/`HTTPS_PROXY` environment variables instead. See the [corporate proxy guide](https://backstage.io/docs/tutorials/corporate-proxy/) for details. This function will be removed in a future release.
17
+ - Updated dependencies
18
+ - @backstage/errors@1.3.0
19
+
3
20
  ## 0.2.1-next.1
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -113,6 +113,10 @@ declare function isChildPath(base: string, path: string): boolean;
113
113
  * Make sure to call this function before any other imports.
114
114
  *
115
115
  * @public
116
+ * @deprecated Use Node.js built-in proxy support by setting `NODE_USE_ENV_PROXY=1`
117
+ * alongside your `HTTP_PROXY` / `HTTPS_PROXY` environment variables instead.
118
+ * This function will be removed in a future release.
119
+ * See {@link https://backstage.io/docs/tutorials/corporate-proxy/ | the corporate proxy guide} for details.
116
120
  */
117
121
  declare function bootstrapEnvProxyAgents(): void;
118
122
 
@@ -2,11 +2,22 @@
2
2
 
3
3
  function bootstrapEnvProxyAgents() {
4
4
  const globalAgentNamespace = process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? "GLOBAL_AGENT_";
5
- if (process.env[`${globalAgentNamespace}HTTP_PROXY`] || process.env[`${globalAgentNamespace}HTTPS_PROXY`]) {
5
+ const hasGlobalAgentProxy = process.env[`${globalAgentNamespace}HTTP_PROXY`] || process.env[`${globalAgentNamespace}HTTPS_PROXY`];
6
+ const hasStandardProxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
7
+ const hasNodeEnvProxy = process.env.NODE_USE_ENV_PROXY === "1" || process.execArgv.includes("--use-env-proxy") || (process.env.NODE_OPTIONS?.split(/\s+/) ?? []).includes("--use-env-proxy");
8
+ if (hasGlobalAgentProxy) {
9
+ process.emitWarning(
10
+ `Configuration of proxy agents through ${globalAgentNamespace}* environment variables is deprecated and will be removed in a future release. Switch to the standard HTTP_PROXY/HTTPS_PROXY environment variables and set NODE_USE_ENV_PROXY=1 instead. See https://backstage.io/docs/tutorials/corporate-proxy/ for details.`,
11
+ { type: "DeprecationWarning", code: "BACKSTAGE_CLI_GLOBAL_AGENT_PROXY" }
12
+ );
6
13
  const globalAgent = require("global-agent");
7
14
  globalAgent.bootstrap();
8
15
  }
9
- if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
16
+ if (hasStandardProxy && !hasNodeEnvProxy) {
17
+ process.emitWarning(
18
+ "bootstrapEnvProxyAgents() is deprecated and will be removed in a future release. Set NODE_USE_ENV_PROXY=1 to use Node.js built-in proxy support instead. See https://backstage.io/docs/tutorials/corporate-proxy/ for details.",
19
+ { type: "DeprecationWarning", code: "BACKSTAGE_CLI_PROXY_BOOTSTRAP" }
20
+ );
10
21
  const { setGlobalDispatcher, EnvHttpProxyAgent } = require("undici");
11
22
  setGlobalDispatcher(new EnvHttpProxyAgent());
12
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"proxyBootstrap.cjs.js","sources":["../src/proxyBootstrap.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This function can be called to setup undici and node-fetch Proxy agents.\n *\n * You can set GLOBAL_AGENT_HTTP(S)_PROXY to configure a proxy to be used in the\n * CLIs.\n *\n * You can also configure a custom namespace by setting\n * GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE which will replace the default\n * \"GLOBAL_AGENT_\" env-var prefix.\n *\n * Make sure to call this function before any other imports.\n *\n * @public\n */\nexport function bootstrapEnvProxyAgents() {\n // see https://www.npmjs.com/package/global-agent\n const globalAgentNamespace =\n process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';\n if (\n process.env[`${globalAgentNamespace}HTTP_PROXY`] ||\n process.env[`${globalAgentNamespace}HTTPS_PROXY`]\n ) {\n const globalAgent =\n require('global-agent') as typeof import('global-agent');\n globalAgent.bootstrap();\n }\n\n if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {\n const { setGlobalDispatcher, EnvHttpProxyAgent } =\n require('undici') as typeof import('undici');\n setGlobalDispatcher(new EnvHttpProxyAgent());\n }\n}\n"],"names":[],"mappings":";;AA8BO,SAAS,uBAAA,GAA0B;AAExC,EAAA,MAAM,oBAAA,GACJ,OAAA,CAAQ,GAAA,CAAI,2CAAA,IAA+C,eAAA;AAC7D,EAAA,IACE,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,UAAA,CAAY,CAAA,IAC/C,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,WAAA,CAAa,CAAA,EAChD;AACA,IAAA,MAAM,WAAA,GACJ,QAAQ,cAAc,CAAA;AACxB,IAAA,WAAA,CAAY,SAAA,EAAU;AAAA,EACxB;AAEA,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,UAAA,IAAc,OAAA,CAAQ,IAAI,WAAA,EAAa;AACrD,IAAA,MAAM,EAAE,mBAAA,EAAqB,iBAAA,EAAkB,GAC7C,QAAQ,QAAQ,CAAA;AAClB,IAAA,mBAAA,CAAoB,IAAI,mBAAmB,CAAA;AAAA,EAC7C;AACF;;;;"}
1
+ {"version":3,"file":"proxyBootstrap.cjs.js","sources":["../src/proxyBootstrap.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This function can be called to setup undici and node-fetch Proxy agents.\n *\n * You can set GLOBAL_AGENT_HTTP(S)_PROXY to configure a proxy to be used in the\n * CLIs.\n *\n * You can also configure a custom namespace by setting\n * GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE which will replace the default\n * \"GLOBAL_AGENT_\" env-var prefix.\n *\n * Make sure to call this function before any other imports.\n *\n * @public\n * @deprecated Use Node.js built-in proxy support by setting `NODE_USE_ENV_PROXY=1`\n * alongside your `HTTP_PROXY` / `HTTPS_PROXY` environment variables instead.\n * This function will be removed in a future release.\n * See {@link https://backstage.io/docs/tutorials/corporate-proxy/ | the corporate proxy guide} for details.\n */\nexport function bootstrapEnvProxyAgents() {\n const globalAgentNamespace =\n process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE ?? 'GLOBAL_AGENT_';\n\n const hasGlobalAgentProxy =\n process.env[`${globalAgentNamespace}HTTP_PROXY`] ||\n process.env[`${globalAgentNamespace}HTTPS_PROXY`];\n const hasStandardProxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;\n\n // Mimics the internal getOptionValue('--use-env-proxy') check in Node.js, which\n // normalizes the --use-env-proxy CLI flag and NODE_USE_ENV_PROXY=1 env var.\n // https://github.com/nodejs/node/blob/v22.x/src/node_options.cc\n const hasNodeEnvProxy =\n process.env.NODE_USE_ENV_PROXY === '1' ||\n process.execArgv.includes('--use-env-proxy') ||\n (process.env.NODE_OPTIONS?.split(/\\s+/) ?? []).includes('--use-env-proxy');\n\n // Node.js never reads GLOBAL_AGENT_* vars, so global-agent must always\n // handle those to preserve behavior during the deprecation period.\n if (hasGlobalAgentProxy) {\n process.emitWarning(\n `Configuration of proxy agents through ${globalAgentNamespace}* environment variables is deprecated and will be removed in a future release. Switch to the standard HTTP_PROXY/HTTPS_PROXY environment variables and set NODE_USE_ENV_PROXY=1 instead. See https://backstage.io/docs/tutorials/corporate-proxy/ for details.`,\n { type: 'DeprecationWarning', code: 'BACKSTAGE_CLI_GLOBAL_AGENT_PROXY' },\n );\n\n const globalAgent =\n require('global-agent') as typeof import('global-agent');\n globalAgent.bootstrap();\n }\n\n // Skip undici dispatcher setup when Node.js built-in proxy support is active,\n // as it already configures the global dispatcher during startup.\n if (hasStandardProxy && !hasNodeEnvProxy) {\n process.emitWarning(\n 'bootstrapEnvProxyAgents() is deprecated and will be removed in a future release. Set NODE_USE_ENV_PROXY=1 to use Node.js built-in proxy support instead. See https://backstage.io/docs/tutorials/corporate-proxy/ for details.',\n { type: 'DeprecationWarning', code: 'BACKSTAGE_CLI_PROXY_BOOTSTRAP' },\n );\n\n const { setGlobalDispatcher, EnvHttpProxyAgent } =\n require('undici') as typeof import('undici');\n setGlobalDispatcher(new EnvHttpProxyAgent());\n }\n}\n"],"names":[],"mappings":";;AAkCO,SAAS,uBAAA,GAA0B;AACxC,EAAA,MAAM,oBAAA,GACJ,OAAA,CAAQ,GAAA,CAAI,2CAAA,IAA+C,eAAA;AAE7D,EAAA,MAAM,mBAAA,GACJ,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,UAAA,CAAY,CAAA,IAC/C,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,oBAAoB,CAAA,WAAA,CAAa,CAAA;AAClD,EAAA,MAAM,gBAAA,GAAmB,OAAA,CAAQ,GAAA,CAAI,UAAA,IAAc,QAAQ,GAAA,CAAI,WAAA;AAK/D,EAAA,MAAM,kBACJ,OAAA,CAAQ,GAAA,CAAI,uBAAuB,GAAA,IACnC,OAAA,CAAQ,SAAS,QAAA,CAAS,iBAAiB,MAC1C,OAAA,CAAQ,GAAA,CAAI,cAAc,KAAA,CAAM,KAAK,KAAK,EAAC,EAAG,SAAS,iBAAiB,CAAA;AAI3E,EAAA,IAAI,mBAAA,EAAqB;AACvB,IAAA,OAAA,CAAQ,WAAA;AAAA,MACN,yCAAyC,oBAAoB,CAAA,8PAAA,CAAA;AAAA,MAC7D,EAAE,IAAA,EAAM,oBAAA,EAAsB,IAAA,EAAM,kCAAA;AAAmC,KACzE;AAEA,IAAA,MAAM,WAAA,GACJ,QAAQ,cAAc,CAAA;AACxB,IAAA,WAAA,CAAY,SAAA,EAAU;AAAA,EACxB;AAIA,EAAA,IAAI,gBAAA,IAAoB,CAAC,eAAA,EAAiB;AACxC,IAAA,OAAA,CAAQ,WAAA;AAAA,MACN,gOAAA;AAAA,MACA,EAAE,IAAA,EAAM,oBAAA,EAAsB,IAAA,EAAM,+BAAA;AAAgC,KACtE;AAEA,IAAA,MAAM,EAAE,mBAAA,EAAqB,iBAAA,EAAkB,GAC7C,QAAQ,QAAQ,CAAA;AAClB,IAAA,mBAAA,CAAoB,IAAI,mBAAmB,CAAA;AAAA,EAC7C;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli-common",
3
- "version": "0.2.1-next.1",
3
+ "version": "0.2.2-next.0",
4
4
  "description": "Common functionality used by cli, backend, and create-app",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -56,13 +56,13 @@
56
56
  "test": "backstage-cli package test"
57
57
  },
58
58
  "dependencies": {
59
- "@backstage/errors": "1.3.0-next.0",
59
+ "@backstage/errors": "1.3.1-next.0",
60
60
  "cross-spawn": "^7.0.3",
61
61
  "global-agent": "^3.0.0",
62
62
  "undici": "^7.24.5"
63
63
  },
64
64
  "devDependencies": {
65
- "@backstage/cli": "0.36.1-next.2",
65
+ "@backstage/cli": "0.36.2-next.0",
66
66
  "@types/cross-spawn": "^6.0.2",
67
67
  "@types/node": "^22.13.14"
68
68
  }