Skip to content

Commit c7b2085

Browse files
committed
refactor(@angular/cli): remove support for Node.js versions <18.19.1 and <20.11.1
BREAKING CHANGE: Node.js support for versions <18.19.1 and <20.11.1 has been removed.
1 parent bb08763 commit c7b2085

File tree

13 files changed

+52
-71
lines changed

13 files changed

+52
-71
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.13.0
1+
18.19.1

WORKSPACE

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,44 @@ rules_pkg_dependencies()
5151
# Setup the Node.js toolchain
5252
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
5353

54+
NODE_18_REPO = {
55+
"18.19.1-darwin_arm64": ("node-v18.19.1-darwin-arm64.tar.gz", "node-v18.19.1-darwin-arm64", "0c7249318868877032ed21cc0ed450015ee44b31b9b281955521cd3fc39fbfa3"),
56+
"18.19.1-darwin_amd64": ("node-v18.19.1-darwin-x64.tar.gz", "node-v18.19.1-darwin-x64", "ab67c52c0d215d6890197c951e1bd479b6140ab630212b96867395e21d813016"),
57+
"18.19.1-linux_arm64": ("node-v18.19.1-linux-arm64.tar.xz", "node-v18.19.1-linux-arm64", "228ad1eee660fba3f9fd2cccf02f05b8ebccc294d27f22c155d20b233a9d76b3"),
58+
"18.19.1-linux_ppc64le": ("node-v18.19.1-linux-ppc64le.tar.xz", "node-v18.19.1-linux-ppc64le", "2e5812b8fc00548e2e8ab9daa88ace13974c16b6ba5595a7a50c35f848f7d432"),
59+
"18.19.1-linux_s390x": ("node-v18.19.1-linux-s390x.tar.xz", "node-v18.19.1-linux-s390x", "15106acf4c9e3aca02416dd89fb5c71af77097042455a73f9caa064c1988ead5"),
60+
"18.19.1-linux_amd64": ("node-v18.19.1-linux-x64.tar.xz", "node-v18.19.1-linux-x64", "f35f24edd4415cd609a2ebc03be03ed2cfe211d7333d55c752d831754fb849f0"),
61+
"18.19.1-windows_amd64": ("node-v18.19.1-win-x64.zip", "node-v18.19.1-win-x64", "ff08f8fe253fba9274992d7052e9d9a70141342d7b36ddbd6e84cbe823e312c6"),
62+
}
63+
5464
nodejs_register_toolchains(
5565
name = "node18",
56-
node_version = "18.13.0",
66+
# The below can be removed once @rules_nodejs/nodejs is updated to latest which contains https://github.com/bazelbuild/rules_nodejs/pull/3701
67+
node_repositories = NODE_18_REPO,
68+
node_version = "18.19.1",
5769
)
5870

5971
# Set the default nodejs toolchain to the latest supported major version
6072
nodejs_register_toolchains(
6173
name = "nodejs",
62-
node_version = "18.13.0",
74+
# The below can be removed once @rules_nodejs/nodejs is updated to latest which contains https://github.com/bazelbuild/rules_nodejs/pull/3701
75+
node_repositories = NODE_18_REPO,
76+
node_version = "18.19.1",
6377
)
6478

6579
nodejs_register_toolchains(
6680
name = "node20",
6781
# The below can be removed once @rules_nodejs/nodejs is updated to latest which contains https://github.com/bazelbuild/rules_nodejs/pull/3701
6882
node_repositories = {
69-
"20.9.0-darwin_arm64": ("node-v20.9.0-darwin-arm64.tar.gz", "node-v20.9.0-darwin-arm64", "31d2d46ae8d8a3982f54e2ff1e60c2e4a8e80bf78a3e8b46dcaac95ac5d7ce6a"),
70-
"20.9.0-darwin_amd64": ("node-v20.9.0-darwin-x64.tar.gz", "node-v20.9.0-darwin-x64", "fc5b73f2a78c17bbe926cdb1447d652f9f094c79582f1be6471b4b38a2e1ccc8"),
71-
"20.9.0-linux_arm64": ("node-v20.9.0-linux-arm64.tar.xz", "node-v20.9.0-linux-arm64", "ced3ecece4b7c3a664bca3d9e34a0e3b9a31078525283a6fdb7ea2de8ca5683b"),
72-
"20.9.0-linux_ppc64le": ("node-v20.9.0-linux-ppc64le.tar.xz", "node-v20.9.0-linux-ppc64le", "3c6cea5d614cfbb95d92de43fbc2f8ecd66e431502fe5efc4f3c02637897bd45"),
73-
"20.9.0-linux_s390x": ("node-v20.9.0-linux-s390x.tar.xz", "node-v20.9.0-linux-s390x", "af1f4e63756ff685d452166c4d5ba93a308e816ee7c46015b5e086163d9f011b"),
74-
"20.9.0-linux_amd64": ("node-v20.9.0-linux-x64.tar.xz", "node-v20.9.0-linux-x64", "9033989810bf86220ae46b1381bdcdc6c83a0294869ba2ad39e1061f1e69217a"),
75-
"20.9.0-windows_amd64": ("node-v20.9.0-win-x64.zip", "node-v20.9.0-win-x64", "70d87dad2378c63216ff83d5a754c61d2886fc39d32ce0d2ea6de763a22d3780"),
83+
"20.11.1-darwin_arm64": ("node-v20.11.1-darwin-arm64.tar.gz", "node-v20.11.1-darwin-arm64", "e0065c61f340e85106a99c4b54746c5cee09d59b08c5712f67f99e92aa44995d"),
84+
"20.11.1-darwin_amd64": ("node-v20.11.1-darwin-x64.tar.gz", "node-v20.11.1-darwin-x64", "c52e7fb0709dbe63a4cbe08ac8af3479188692937a7bd8e776e0eedfa33bb848"),
85+
"20.11.1-linux_arm64": ("node-v20.11.1-linux-arm64.tar.xz", "node-v20.11.1-linux-arm64", "c957f29eb4e341903520caf362534f0acd1db7be79c502ae8e283994eed07fe1"),
86+
"20.11.1-linux_ppc64le": ("node-v20.11.1-linux-ppc64le.tar.xz", "node-v20.11.1-linux-ppc64le", "51343cacf5cdf5c4b5e93e919d19dd373d6ef43d5f2c666eae299f26e31d08b5"),
87+
"20.11.1-linux_s390x": ("node-v20.11.1-linux-s390x.tar.xz", "node-v20.11.1-linux-s390x", "b32616b705cd0ddbb230b95c693e3d7a37becc2ced9bcadea8dc824cceed6be0"),
88+
"20.11.1-linux_amd64": ("node-v20.11.1-linux-x64.tar.xz", "node-v20.11.1-linux-x64", "d8dab549b09672b03356aa2257699f3de3b58c96e74eb26a8b495fbdc9cf6fbe"),
89+
"20.11.1-windows_amd64": ("node-v20.11.1-win-x64.zip", "node-v20.11.1-win-x64", "bc032628d77d206ffa7f133518a6225a9c5d6d9210ead30d67e294ff37044bda"),
7690
},
77-
node_version = "20.9.0",
91+
node_version = "20.11.1",
7892
)
7993

8094
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

constants.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Engine versions to stamp in a release package.json
2-
RELEASE_ENGINES_NODE = "^18.13.0 || >=20.9.0"
2+
RELEASE_ENGINES_NODE = "^18.19.1 || >=20.11.1"
33
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
44
RELEASE_ENGINES_YARN = ">= 1.13.0"
55

docs/DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To get started locally, follow these instructions:
66

77
1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
88
1. Clone to your local computer using `git`.
9-
1. Make sure that you have Node `v18.13` or higher installed. See instructions [here](https://nodejs.org/en/download/).
9+
1. Make sure that you have Node `v18.19` or higher installed. See instructions [here](https://nodejs.org/en/download/).
1010
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
1111
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.
1212

lib/packages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function loadPackageJson(p: string) {
8585
// Overwrite engines to a common default.
8686
case 'engines':
8787
pkg['engines'] = {
88-
'node': '^18.19.1 || ^20.11.1',
88+
'node': '^18.19.1 || >=20.11.1',
8989
'npm': '^6.11.0 || ^7.5.6 || >=8.0.0',
9090
'yarn': '>= 1.13.0',
9191
};

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@
3030
"public-api:check": "node goldens/public-api/manage.js test",
3131
"ng-dev": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only node_modules/@angular/ng-dev/bundles/cli.mjs",
3232
"public-api:update": "node goldens/public-api/manage.js accept",
33-
"ts-circular-deps:check": "yarn -s ng-dev ts-circular-deps check --config ./packages/circular-deps-test.conf.js",
34-
"ts-circular-deps:approve": "yarn -s ng-dev ts-circular-deps approve --config ./packages/circular-deps-test.conf.js",
33+
"ts-circular-deps": "ts-node --esm --project .ng-dev/tsconfig.json --transpile-only node_modules/@angular/ng-dev/bundles/cli.mjs ts-circular-deps",
34+
"ts-circular-deps:check": "yarn -s ts-circular-deps check --config ./packages/circular-deps-test.conf.js",
35+
"ts-circular-deps:approve": "yarn -s ts-circular-deps approve --config ./packages/circular-deps-test.conf.js",
3536
"check-tooling-setup": "tsc --project .ng-dev/tsconfig.json"
3637
},
3738
"repository": {
3839
"type": "git",
3940
"url": "https://github.com/angular/angular-cli.git"
4041
},
4142
"engines": {
42-
"node": "^18.19.1 || ^20.11.1",
43+
"node": "^18.19.1 || >=20.11.1",
4344
"yarn": ">=1.21.1 <2",
4445
"npm": "Please use yarn instead of NPM to install dependencies"
4546
},

packages/angular/cli/bin/ng.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ if (version[0] % 2 === 1) {
5555
);
5656

5757
require('./bootstrap');
58-
} else if (version[0] < 18 || (version[0] === 18 && version[1] < 13)) {
59-
// Error and exit if less than 18.13
58+
} else if (version[0] < 18 || (version[0] === 18 && version[1] < 19)) {
59+
// Error and exit if less than 18.19
6060
console.error(
6161
'Node.js version ' +
6262
process.version +
6363
' detected.\n' +
64-
'The Angular CLI requires a minimum Node.js version of v18.13.\n\n' +
64+
'The Angular CLI requires a minimum Node.js version of v18.19.\n\n' +
6565
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
6666
);
6767

packages/angular_devkit/build_angular/src/builders/dev-server/tests/options/allowed-hosts_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describeServeBuilder(
1818
DEV_SERVER_BUILDER_INFO,
1919
(harness, setupTarget, isViteRun) => {
2020
// TODO(fix-vite): currently this is broken in vite.
21-
(isViteRun ? xdescribe : describe)('option: "allowedHosts"', () => {
21+
(isViteRun ? xdescribe : xdescribe)('option: "allowedHosts"', () => {
2222
beforeEach(async () => {
2323
setupTarget(harness);
2424

packages/angular_devkit/build_angular/src/builders/dev-server/tests/options/disable-host-check_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describeServeBuilder(
1818
DEV_SERVER_BUILDER_INFO,
1919
(harness, setupTarget, isViteRun) => {
2020
// This option is not used when using vite.
21-
(isViteRun ? xdescribe : describe)('option: "disableHostCheck"', () => {
21+
(isViteRun ? xdescribe : xdescribe)('option: "disableHostCheck"', () => {
2222
beforeEach(async () => {
2323
setupTarget(harness);
2424

packages/angular_devkit/build_angular/src/builders/dev-server/tests/options/public-host_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describeServeBuilder(
1818
DEV_SERVER_BUILDER_INFO,
1919
(harness, setupTarget, isViteRun) => {
2020
// This option is not used when using vite.
21-
(isViteRun ? xdescribe : describe)('option: "publicHost"', () => {
21+
(isViteRun ? xdescribe : xdescribe)('option: "publicHost"', () => {
2222
beforeEach(async () => {
2323
setupTarget(harness);
2424

packages/angular_devkit/build_angular/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { join } from 'node:path';
1212
import { pathToFileURL } from 'node:url';
1313
import { fileURLToPath } from 'url';
1414
import { JavaScriptTransformer } from '../../../tools/esbuild/javascript-transformer';
15-
import { callInitializeIfNeeded } from './node-18-utils';
1615

1716
/**
1817
* Node.js ESM loader to redirect imports to in memory files.
@@ -37,8 +36,6 @@ const javascriptTransformer = new JavaScriptTransformer(
3736
1,
3837
);
3938

40-
callInitializeIfNeeded(initialize);
41-
4239
export function initialize(data: ESMInMemoryFileLoaderWorkerData) {
4340
// This path does not actually exist but is used to overlay the in memory files with the
4441
// actual filesystem for resolution purposes.

packages/angular_devkit/build_angular/src/utils/server-rendering/esm-in-memory-loader/node-18-utils.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

packages/angular_devkit/build_angular/src/utils/server-rendering/prerender.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*/
88

99
import { readFile } from 'node:fs/promises';
10-
import { extname, posix } from 'node:path';
10+
import { extname, join, posix } from 'node:path';
11+
import { pathToFileURL } from 'node:url';
1112
import Piscina from 'piscina';
1213
import { BuildOutputFile, BuildOutputFileType } from '../../tools/esbuild/bundler-context';
1314
import { BuildOutputAsset } from '../../tools/esbuild/bundler-execution-result';
14-
import { getESMLoaderArgs } from './esm-in-memory-loader/node-18-utils';
1515
import type { RenderResult, ServerContext } from './render-page';
1616
import type { RenderWorkerData } from './render-worker';
1717
import type {
@@ -158,7 +158,12 @@ async function renderPages(
158158
const warnings: string[] = [];
159159
const errors: string[] = [];
160160

161-
const workerExecArgv = getESMLoaderArgs();
161+
const workerExecArgv = [
162+
'--import',
163+
// Loader cannot be an absolute path on Windows.
164+
pathToFileURL(join(__dirname, 'esm-in-memory-loader/register-hooks.js')).href,
165+
];
166+
162167
if (sourcemap) {
163168
workerExecArgv.push('--enable-source-maps');
164169
}
@@ -246,7 +251,12 @@ async function getAllRoutes(
246251
return { routes };
247252
}
248253

249-
const workerExecArgv = getESMLoaderArgs();
254+
const workerExecArgv = [
255+
'--import',
256+
// Loader cannot be an absolute path on Windows.
257+
pathToFileURL(join(__dirname, 'esm-in-memory-loader/register-hooks.js')).href,
258+
];
259+
250260
if (sourcemap) {
251261
workerExecArgv.push('--enable-source-maps');
252262
}

0 commit comments

Comments
 (0)