3747 Commits

Author SHA1 Message Date
Paul Gschwendtner
9dd3f0344f
Further clean-up rules_nodejs npm workspace and remove yarn.lock (#29779)
* build: disconnect `@npm` workspace from main project

This will speed up significantly as we don't need to fetch all
dependencies again just for the `@npm` repository that is at this point
only leveraged by the `ng_package` rule for some of its dependencies.

This commit allows us to drop the `yarn.lock` and Aspect lock files, and
allows us to independently migrate `ng_package` to `rules_js`.

It also allows us to drop the `_rjs` TS interop layer in follow-up commits.

* build: drop `_rjs` suffix from `ts_project` targets

We don't need the `ts_project` interop in principle
at this point. We only have one remaining instance left for the SSR
`ng_package` integration. This commit cleans up all usages.

* build: remove yarn

* build: avoid duplicated dependencies at top-level

`rules_js` seems to be sensitive if there are similar versions of the same
package installed, but with differently matched peer dependencies. This
is fine because we can (and should long-term) move those dependencies to
their package-local `package.json` files. This commit unblocks the
migration and highlights how we can move deps to the individual packages
in the future.

* build: update checkout github action

This will allow us to use pnpm.

* build: update node to avoid strict-engines error caused by `npm`

Avoids:

```
Lockfile is up to date, resolution step is skipped
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "npm@11.2.0".

Expected version: ^20.17.0 || >=22.9.0
Got: v20.11.1
```

Note that we won't update the WORKSPACE test version as that would mean
we need to update the Node engines for shipped packages; and we can't do
this right now without introducing a breaking change.

* build: fix missing dependency for spec bundling

The beasties JS sources weren't available for bundling in the
`bazel-bin`, and this surfaced in RBE. This commit fixes this.
2025-03-11 10:05:52 +01:00
Angular Robot
65a5ff49f1 build: update all non-major dependencies 2025-03-10 08:48:23 +01:00
Angular Robot
29243fb363 build: update angular 2025-03-06 17:20:40 +01:00
Alan Agius
31c81e9c68 feat(@angular/build): drop support for TypeScript older than 5.8
Narrow down the versions of TypeScript to support.

BREAKING CHANGE: TypeScript versions less than 5.8 are no longer supported.
2025-03-06 10:03:49 +01:00
Angular Robot
39ec21f0ca build: update dependency @vitejs/plugin-basic-ssl to v2 2025-03-04 09:53:02 +01:00
Paul Gschwendtner
5fd1cb56ab build: update dev-infra and rework windows native testing
As part of go/ng:windows-dev-future, we are changing how our
infrastructure supports Windows build & testing. Clearly:

- we will still support contributors on Windows, and we believe we will
  be improving and streamlining the experience here
- we will continue testing the Angular CLI for our Windows users. We are
  aware of the many Windows users using the `ng` CLI.

What is changing? We are no longer actively working towards a Bazel infrastructure
that supports native Windows building and testing. There are currently
two ways to contribute to Angular on Windows. That is via WSL, or via
e.g. native Windows cmd.exe, with Git Bash on top. We acknowledge that
the latter worked sometimes, but we also realize it very often breaks as
nobody on our team uses, verifies it, and it introduces extra complexity
because Bazel on Windows is quite disconnected from Linux/Mac (e.g. no
sandboxing). Going forward, to improve our team's effectiveness, and
improve our stability guarantees for Windows (and Windows contributors),
we are actively discouraging the use of Git Bash for contributing to
Angular; but instead ask for WSL to be used. I can speak as one of the
few long-term team members that have worked on Windows (without WSL) most
of my time, that WSL is great and the contributing experience is much
smoother and also easier to "guide". It's a positive change because we
won't be suggesting "two ways to contribute on Windows", where in
reality one is very brittle and can break at any time!

---

For testing of the Angular CLI: We will continue to maintain the
capability to cross-compile via Bazel with Windows as the target
platform. This allows us to build the e2e tests for Windows, and run
them natively outside WSL to ensure native Windows `ng` CLI testing!
This is what this change mostly does.

Notably, two things are missing here and will be followed up:

- caching of the e2e tests on Windows is not properly functioning yet.
- caching of the WSL node modules + nvm is not working properly yet.

Other than that, we are seeing very similar timing and results of the
Windows tests, so this change unblocks our `rules_js` migration.
2025-03-03 21:44:50 +01:00
Angular Robot
38ef5d7c56 build: update all non-major dependencies 2025-03-03 13:32:31 +01:00
Angular Robot
3f2ab3a43d build: update dependency copy-webpack-plugin to v13 2025-02-28 13:56:05 -08:00
Angular Robot
9ceca0c4de build: update dependency babel-loader to v10 2025-02-28 08:29:13 -08:00
Younes Jaaidi
9c1c43bd54 test(@angular-devkit/build-angular): add test to make sure aot is disabled by default 2025-02-25 09:27:38 -08:00
Angular Robot
aa634f9a3a build: update all non-major dependencies 2025-02-25 08:18:52 -08:00
Charles Lyding
5130afe3ce build: update postcss to v8.5.3
A test for the browser builder needed to be updated to reflect a different
order in the sources array within the generated source map.
2025-02-24 18:34:44 -05:00
Angular Robot
4b4b25bdfc build: update dependency rxjs to v7.8.2 2025-02-23 09:40:53 -05:00
Joey Perrott
e13d7cfbc0 refactor(@angular-devkit/build-angular): fix dependencies and import paths for strict deps requirements 2025-02-20 14:18:10 -05:00
Joey Perrott
ca1e86b684 build: disable failing strict_deps targets
Disable all failing strict_deps targets with TODOs to fix them moving forward.
2025-02-19 15:22:58 -05:00
Jan Martin
a00a49a65a feat(@angular-devkit/build-angular): add aot to WTR schema 2025-02-19 10:05:30 -08:00
Angular Robot
9f870b4051 build: update all non-major dependencies 2025-02-18 07:46:41 -05:00
Charles Lyding
11fab9c7dd feat(@angular/build): add application builder karma testing to package
An `application` only variant of the `karma` builder found within the
`@angular-devkit/build-angular` package is now available within the
`@angular/build` package as `@angular/build:karma`. This builder will
only use the `application` builder found within `@angular/build` and
does not provide the `builderMode` option as `application` would be the
only valid value. Testing behavior is effectively equivalent to using the
`@angular-devkit/build-angular:karma` builder with the `builderMode`
option set to `application`. However, several options have been adjusted:
* `builderMode` was removed
* `fileReplacements` legacy structure (`src`/`replaceWith`) removed
* `polyfills` only accepts an array of strings
* `loader` has been added
* `define` has been added
* `externalDependencies` has been added
2025-02-18 06:28:08 -05:00
Joey Perrott
33ed6e875e refactor: move builtin module imports to use node: prefix imports 2025-02-14 11:09:23 -08:00
Alan Agius
c0c1670a64 fix(@angular-devkit/build-angular): pass missing options to Karma esbuild builder
Ensure that several previously omitted options are correctly passed to the Karma esbuild builder, improving consistency and expected behavior.
2025-02-14 16:34:02 +01:00
Angular Robot
65c99b8139 build: update all non-major dependencies to v7.26.9 2025-02-14 14:35:24 +01:00
Alan Agius
04f331a534 build: update all non-major dependencies
Update packages
2025-02-14 13:11:21 +01:00
Kristiyan Kostadinov
0a77fe09eb build: update to TypeScript 5.8
Updates the repo to TypeScript 5.8 and expands the peer dependency ranges.
2025-02-14 11:39:20 +01:00
cexbrayat
2bae1a9c0c fix(@angular-devkit/build-angular): support aot option for karma browser builder 2025-02-13 10:05:15 +01:00
Alan Agius
a2747391aa build: update to esbuild 0.25.0
This commit updates esbuild to 0.25.0
2025-02-12 20:31:56 +01:00
Angular Robot
1355d086fe build: update all non-major dependencies 2025-02-12 08:49:47 -08:00
Younes Jaaidi
523d539c66 feat(@angular-devkit/build-angular): add aot option to karma 2025-02-11 08:47:37 -08:00
Alan Agius
8faaf51d61 refactor(@angular/build): remove outdated allowedHosts warning
The warning is no longer accurate, as `allowedHosts` is now used in Vite.
2025-02-11 17:08:32 +01:00
Alan Agius
dca408b926 build: update all non-major dependencies 2025-02-10 16:29:51 +01:00
Angular Robot
cf2d54b222 build: update all non-major dependencies 2025-02-06 15:19:51 -08:00
Angular Robot
dc11340113 build: update all non-major dependencies 2025-02-05 06:52:05 -08:00
Younes Jaaidi
ef7ea536fe feat(@angular-devkit/build-angular): add aot option to jest 2025-02-04 07:46:16 -08:00
Angular Robot
7a8ff1f099 build: update all non-major dependencies 2025-02-03 14:35:08 -08:00
Angular Robot
02d87bcf33 build: update all non-major dependencies 2025-01-31 08:28:30 +01:00
Paul Gschwendtner
3194f5675b build: remove leftover unused rules_nodejs npm dependency
This dependency does not provide any value for the `ts_project`
compilation, nor does it seem to be necessary; so we are cleaning up
this dependency.
2025-01-30 11:16:46 +01:00
Paul Gschwendtner
01ea33e372 build: migrate CLI schema generation to rules_js
Migrates the CLI schema generation to `rules_js`, also significantly
simplifying the rule boilerplate.
2025-01-30 11:16:46 +01:00
Paul Gschwendtner
832bfffc43 build: migrate @angular-devkit/build-angular tests to rules_js
Migrates the `@angular-devkit/build-angular` tests to `rules_js`. This
was a rather larger undertaking as the tests were very reliant on e.g.
the directory structure or specific node module layout; so some changes
were needed.

- the Sass files include a much larger file header now. That is because
  the npm Sass files have much larger paths, given being inside a
  symlinked pnpm store directory. E.g.

  ```

/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ../../../../../node_modules/.aspect_rules_js/css-loader@7.1.2_webpack_5.97.1/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[1]!../../../../../node_modules/.aspect_rules_js/postcss-loader@8.1.1_1462687623/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[2]!./src/test-style-a.css?ngGlobalStyle ***!
  \**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
.test-a {color: red}
  ```

- Similarly to above, hashed chunk files can change given different
  paths of e.g. Webpack, or external sources.

- Tests for verifying the lazy module chunks may enable
  `preserveSymlinks` just to make the chunk names shorter and easier to
  verify, avoiding truncatd super long paths to the e.g. pnpm stores
  again.

- the ngsw-worker.js file cannot be copied using `copyFile` as that
  results in permissions being copied as well. In Bazel, now that
  the npm files are properly captured, are readonly, so subsequent
  builds (e.g. the watch tests) will fail to copy/override the file
  again! Reading and writing the file consistently seems appropriate.

- Tests relying on puppeteer and webdriver-manager worked in the past,
  by accident, because postinstall scripts (from e.g. puppeteer) were
  able to modify content of other packages (e.g. the puppeteer-core
  cache of browsers then). This does not work with `rules_js` anymore,
  so we need to keep the cache local to the puppeteer postinstall
  script. This requires a little trickery right now to ensure resolution
  of the browsers at runtime works..

- server tests did miss the `node` types to be explicitly listed (as
  they would be in a fresh project), and this caused failures. Likely
  because we no longer patch resolution.

- avoid npm-module style imports from tests within the same package.
  This is not allowed with `rules_js` and also is inconsistent.
2025-01-29 09:02:41 +01:00
Charles Lyding
694ef8e6e4 fix(@angular/build): allow tailwindcss 4.x as a peer dependency
To support usage of the newly released Tailwind CSS 4.0.0, the peer dependency
range has been update to include `^4.0.0`. This prevents potential installation
warnings/error when using various package managers.
Use of Tailwind CSS 4+ requires either the `application` (new project default) or
`browser-esbuild` builder. Both of which support custom postcss configuration
via a `.postcssrc.json` file.

For instructions on the setup of Tailwind CSS with Angular, please see the
Tailwind CSS documentation here: https://tailwindcss.com/docs/installation/framework-guides/angular
2025-01-27 12:30:33 -05:00
Angular Robot
d47971c9e4 build: update all non-major dependencies to v7.26.7 2025-01-27 14:16:22 +01:00
Angular Robot
e00ea8e1fb build: update all non-major dependencies 2025-01-24 07:23:41 -05:00
Alan Agius
1a3ef3b60b fix(@angular/build): disable TypeScript removeComments option
Disables TypeScript's `removeComments` option to ensure important annotations like `/* @__PURE__ */`
and `/* vite-ignore */` are preserved. TypeScript's comment removal can be too aggressive,
potentially stripping out critical information needed by bundlers for dead code elimination.
Non-essential comments will be handled by the bundler, so removing them in TypeScript isn't necessary
and could lead to an increase in the final bundle size.

Closes #29470
2025-01-24 13:20:56 +01:00
Charles Lyding
f836be9e67 fix(@angular/build): support Vite allowedHosts option for development server
Vite version 6.0.9+, which is now used by the Angular CLI, contains a potentially
breaking change for some development setups. Examples of such setups include those
that use reverse proxies or custom host names during development. The change within
a patch release was made by Vite to address a security vulnerability. For
projects that directly access the development server via `localhost`, no changes should
be needed. However, some development setups may now need to adjust the newly
introduced `allowedHosts` development server option. This option can include an array
of host names that are allowed to communicate with the development server. The option
sets the corresponding Vite option within the Angular CLI.
For more information on the option and its specific behavior, please see the Vite
documentation located here:
https://vite.dev/config/server-options.html#server-allowedhosts

The following is an example of the configuration option allowing `example.com`:
```
"serve": {
      "builder": "@angular/build:dev-server",
      "options": {
        "allowedHosts": ["example.com"]
      },
```

Additional details on the vulnerability can be found here:
https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6
2025-01-23 18:48:47 -05:00
Paul Gschwendtner
0c264261fe build: migrate modules/testing/builders to rules_js runtime
Fully migrates `modules/testing/builders` to `rules_js`, so that it can
resolve modules at runtime using RJS, or executes tests via RJS.
2025-01-23 15:27:55 +01:00
Alan Agius
e7413d3ae1 refactor: reduce dependencies on @angular-devkit/core
By converting schemas from TypeScript `interfaces` to `types`, we can minimize the reliance on `json.JsonObject`. This approach avoids the error "Type 'Schema' does not satisfy the constraint 'JsonObject'" caused by the missing index signature for type 'string' in 'Schema'.
2025-01-21 16:36:23 +01:00
Angular Robot
0186e8061f build: update all non-major dependencies 2025-01-20 10:52:33 +01:00
Alan Agius
31cbf5f9ad build: replace hardcoded Angular and ng-packagr peer dependencies with Bazel stamping
Refactor the build configuration to use Bazel stamping for Angular and ng-packagr dependencies, eliminating the need for hardcoded peer dependencies.
2025-01-16 19:06:30 +01:00
Angular Robot
2046ce4717 build: update all non-major dependencies 2025-01-16 09:07:20 -08:00
Paul Gschwendtner
4fee94a96c build: rename //:root_modules to //:node_modules.
This is necessary as `rules_js` requires this "common name" when dealing
with Yarn workspaces, linking first party dependencies automatically.

In the future, we may be able to send a PR to `rules_js` to support a
custom name somehow.
2025-01-15 19:20:40 +01:00
Angular Robot
23ebfd9440 build: update all non-major dependencies 2025-01-15 10:56:18 +01:00
Paul Gschwendtner
0ae4e13c3d build: migrate @angular-devkit/build-angular to npm_package
Updates to the `rules_js` npm archive rule, as part of the overall
migration effort.
2025-01-14 16:06:07 +01:00