3434 Commits

Author SHA1 Message Date
Alan Agius
2fb4b243c4 refactor(@angular-devkit/build-angular): remove unused imported symbol
This commit removes an unused imported symbol.
2024-03-14 15:20:36 +01:00
Alan Agius
0a4943556f perf(@angular-devkit/build-angular): reduce build times for apps with a large number of components when utilizing esbuild-based builders
In this commit, we've optimized the build performance for applications containing a large number of components when using the esbuild-based builder. This optimization entails replacing the spread operator with `Object.assign` when appending to the result metadata in the Angular compiler plugin to avoid creating multiple copies of the object.

See: https://bugs.chromium.org/p/v8/issues/detail?id=11536

**Previous Performance**:
- Initial compilation: 37 seconds
- First incremental build: 20 seconds
- Second incremental build: 16 seconds

**Updated Performance**:
- Initial compilation: 24 seconds
- First incremental build: 6 seconds
- Second incremental build: 2 seconds

Closes #27280
2024-03-14 15:20:36 +01:00
Angular Robot
8374dc6df1 build: update all non-major dependencies 2024-03-14 10:53:31 +01:00
Alan Agius
c7b208555e 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.
2024-03-12 16:51:03 +01:00
Alan Agius
51debcdb78 refactor(@angular-devkit/build-angular): properly display errors originating in ESM loader hooks
Currently, errors occurring in ESM loader hooks while using `--import` are not correctly displayed, as they cannot be transferred from the worker to the main thread. Although the error is an instance of Error, it contains non-transferable properties and cannot be transmitted from a worker when --import is used. Consequently, when read outside of the worker, the error object displays as `[Object object]`. To address this issue, we reconstruct the error message.

See: https://github.com/angular/angular-cli/issues/27251
2024-03-12 15:28:19 +01:00
Charles Lyding
01fa0472e9 refactor(@angular-devkit/build-angular): use direct type assertions for cache option normalization 2024-03-12 09:46:20 -04:00
Charles Lyding
096aaba85f refactor(@angular-devkit/build-angular): remove unneeded option type casting from several builders
Multiple cases where builder options were being cast to the `JsonObject` type
have been removed. These casts are no longer needed and unnecessarily added
complexity to the code.
2024-03-12 09:46:20 -04:00
Alan Agius
1034bb155b fix(@angular-devkit/build-angular): provide better error message when server option is required but missing
This improves the error message when the server entry-point is required but missing

Closes #27251
2024-03-12 10:06:27 +01:00
Charles Lyding
db4b5f3d08 build: update less-loader to v12.2.0
Also removes `less-loader` from the renovate update ignore list.
The transitive dependency licensing issue has been resolved upstream.
2024-03-11 17:46:11 -04:00
Alan Agius
e729f6ea10 build: update dependency webpack-dev-server to v5 2024-03-11 19:00:54 +01:00
Charles Lyding
560ec400c0 refactor(@angular-devkit/build-angular): reduce usage of @angular-devkit/core types
Logging types are now based on the BuilderContext's type instead of the
`@angular-devkit/core` type. This reduces the need to directly depend
on this package while also allowing the builder logging type to diverge
if needed. The two usages of the BaseException type which is a small
wrapper around Error have also been removed.
2024-03-11 10:06:36 -04:00
Charles Lyding
93e918e4dd refactor(@angular-devkit/build-angular): improve i18n project option validation
The `i18n` project field is used to configure i18n behavior for a project.
The validation code has been reorganized to use two helper functions to
centralize the type validation and exception throwing. This reduces the complexity
of the analysis code as well as removing the need to rely on `@angular-devkit/core`.
2024-03-11 10:06:23 -04:00
Alan Agius
f112a0af16 refactor(@angular-devkit/build-angular): add warnings for unsupported vite options
This commit adds warnings when using unsupported dev-server options with vite.
2024-03-11 08:08:47 +01:00
Miles Malerba
034639b9d3 build: update dependencies for version 18.0.0 2024-03-08 18:40:58 +01:00
Alan Agius
518afd80cc fix(@angular-devkit/build-angular): ensure proper display of build logs in the presence of warnings or errors
Previously, a race condition could occur due to the spinner, resulting in the deletion of the last printed log when warnings or errors were present. With this update, we ensure that logs are printed after the spinner has stopped.

Fixes #27233
2024-03-08 16:26:23 +01:00
Angular Robot
dddcb2e8f4 build: update all non-major dependencies 2024-03-08 11:55:34 +01:00
Alan Agius
97973059ec refactor(@angular-devkit/build-angular): remove Sass legacy implementation
This commit removes the legacy Sass implementation previously used with Webpack.

BREAKING CHANGE: The support for the legacy Sass build pipeline, previously accessible via `NG_BUILD_LEGACY_SASS` when utilizing webpack-based builders, has been removed.
2024-03-06 18:15:32 +01:00
Angular Robot
9af9dc5cb1 build: update dependency terser to v5.29.1 2024-03-06 17:31:46 +01:00
Alan Agius
73e7c2b2c5 build: update dependencies for version 17.3.0
The prerelease checks are failing due to incorrect dependencies

```
Discovered errors when validating dependency ranges.
  - @angular/pwa: Unexpected peer dependency range for "@angular/cli". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular/ssr: Unexpected peer dependency range for "@angular/common". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular/ssr: Unexpected peer dependency range for "@angular/core". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular-devkit/build-angular: Unexpected peer dependency range for "@angular/compiler-cli". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular-devkit/build-angular: Unexpected peer dependency range for "@angular/localize". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular-devkit/build-angular: Unexpected peer dependency range for "@angular/platform-server". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular-devkit/build-angular: Unexpected peer dependency range for "@angular/service-worker". Expected: ^17.0.0 || ^17.3.0-next.0
  - @angular-devkit/build-angular: Unexpected peer dependency range for "ng-packagr". Expected: ^17.0.0 || ^17.3.0-next.0
  - @ngtools/webpack: Unexpected peer dependency range for "@angular/compiler-cli". Expected: ^17.0.0 || ^17.3.0-next.0
  - latest-versions: Invalid dependency range for "ng-packagr". Expected: ^17.3.0-next.0
  - latest-versions: Invalid dependency range for "Angular". Expected: ^17.3.0-next.0
```
2024-03-06 13:04:30 +01:00
Angular Robot
ab4f98596c build: update all non-major dependencies 2024-03-06 11:37:15 +01:00
Charles Lyding
0b7a101062 refactor(@angular-devkit/build-angular): remove unneeded relative URL modification for public path
Only the injected index HTML file references and component stylesheets require
the modification of relative URLs with a public path when specified. Other
usages are already resolved relative to their containing file location with
the `application` builder.
2024-03-06 09:15:16 +01:00
Charles Lyding
fc5a2af97b refactor(@angular-devkit/build-angular): remove Webpack helpers from application builder option normalization
The usage of several Webpack-centric option helper functions has now been
removed from the `application` builder. This allows for more efficient
processing of incoming options but also removes additional imports across
builder code.
2024-03-06 09:14:36 +01:00
Alan Agius
b20dcae76b fix(@angular-devkit/build-angular): disable deployUrl when using vite dev-server
Prior to this commit, the deployUrl was incorrectly being set when using vite dev-server.
2024-03-05 16:28:04 +01:00
Alan Agius
2f70f9554b build: lock file maintenance 2024-03-05 15:59:07 +01:00
Alan Agius
b8054cb41e refactor(@angular-devkit/build-angular): remove vite deprecation warning
`optimizeDeps.disabled` has been deprecated in favor of `optimizeDeps.noDiscovery` to `true` and `optimizeDeps.include` to `undefined`

```
(!) Experimental ssr.optimizeDeps.disabled and deps pre-bundling during build were removed in Vite 5.1.
    To disable the deps optimizer, set ssr.optimizeDeps.noDiscovery to true and ssr.optimizeDeps.include as undefined or empty.
    Please remove ssr.optimizeDeps.disabled from your config.
```
2024-03-05 15:58:06 +01:00
Andrey "Zed" Zaikin
ce45522df6 docs: fix typo in json schema 2024-03-05 11:08:14 +01:00
Charles Lyding
8a29b61d41 refactor(@angular-devkit/build-angular): remove extra exist check when purging stale build caches
When purging stale build cache entries, the `readdir` call will fail if
the cache base path does not exist. This allows for a single check and
the removal of the previous separate `existSync` call. Additionally,
a repeat join call has also been removed during the stale directory check.
2024-03-05 08:52:52 +01:00
Charles Lyding
a0ed46bbd8 refactor(@angular-devkit/build-angular): use Node.js builtin instead of custom removeColor helper
The Node.js `node:util` builtin contains a helper (`stripVTControlCharacters`) that
can be used to remove ANSI color characters from a string. Usage removes the need
for a custom helper within the package.
2024-03-04 13:46:49 -05:00
Charles Lyding
b55bbde9c3 refactor(@angular-devkit/build-angular): use async pipeline helper in HTML rewriting stream
The Node.js async `pipeline` helper function reduces the amount of infrastructure code
needed to pipe HTML content through the parse5 transform stream.
2024-03-04 18:22:20 +01:00
Charles Lyding
ffeb3eb74e refactor(@angular-devkit/build-angular): use TextDecoder for index reading during index HTML generation
The globally available TextDecoder class will automatically handle the presence of a BOM in
text files when decoding. This allows the removal of the utility function present in the
package to do the same.
2024-03-04 16:25:57 +01:00
Alan Agius
9ca3a54503 feat(@angular-devkit/build-angular): add deployUrl to application builder
This commit adds the deployUrl option ot the application builder.

Closes #26411
2024-03-04 16:24:30 +01:00
Charles Lyding
14189b27c5 refactor(@angular-devkit/build-angular): remove direct require usage from Angular version check
To support future package building as ESM, the direct usage of require has now been
removed from the Angular compatibility check code used by various builders.
Additionally, the limited use of `@angular-devkit/core` has also been removed from
the check code as it was only used to adjust string values for error messages which
can be done directly instead.
2024-03-04 09:35:59 +01:00
Charles Lyding
7a1a44305c fix(@angular-devkit/build-angular): avoid marking component styles as media with no output media directory
The logic to detect media output files was previously predicated on the presence of a media subdirectory
being defined. Prior to the ability to customize output path subcomponents there was a guaranteed media
subdirectory. However, now that customization is possible, there is the potential for media files to
not have a distinct subdirectory in the output. To facilitate output media detection in this scenario
a file extension based method is now employed. This avoids a dependence on output directory structure.
2024-03-04 09:35:51 +01:00
Charles Lyding
ccb60abd25 refactor(@angular-devkit/build-angular): disable Piscina timing information recording
The latest version of the worker pool package used by the build system (`Piscina`) now
has an option to disable performance timing information. Since the build system does
not currently use that information, disabling it avoids the extra overhead of histogram
creation and usage. This information collection could potentially be enabled conditionally
in the future if needed.
2024-03-04 09:35:48 +01:00
Charles Lyding
8d1a7c3f1a fix(@angular-devkit/build-angular): avoid implicit CSS file extensions when resolving
Unlike the non-ESM Node.js resolution for JS files, CSS does not have the concept
of implicit file extensions. To avoid incorrectly resolving a file as CSS,
stylesheet bundling no longer attempts to resolve implicit extensions. Preprocessors,
such as Sass, contain logic internally that handles any specific resolution cases
for their respective preprocessor and such behavior is unaffected.
2024-03-04 09:35:15 +01:00
Angular Robot
6acd091d0f build: update all non-major dependencies 2024-02-28 15:29:35 -05:00
Kristiyan Kostadinov
f06f4422c6 build: update to TypeScript 5.4
Updates the repo to TypeScript 5.4.
2024-02-28 12:59:28 -05:00
Angular Robot
30f182c7ad build: update all non-major dependencies 2024-02-26 14:29:44 -05:00
Charles Lyding
422a9eaa70 build: update webpack to v5.90.3 2024-02-26 13:18:37 -05:00
Charles Lyding
ce2c3ef0e9 fix(@angular-devkit/build-angular): ensure all related stylesheets are rebuilt when an import changes
This fixes a logic error wherein some stylesheets could potentially not be
rebuilt if a shared import was edited and triggered an application rebuild.
2024-02-23 07:11:09 -05:00
Charles Lyding
e98dde62de fix(@angular-devkit/build-angular): provide Vite client code source map when loading
The sourcemap for the Vite client code was previously not being loaded along with the
actual code. This could lead to browser 404 console messages when debugging applications.
2024-02-22 10:03:42 -08:00
Charles Lyding
9a6a77e2f1 build: update dart-sass to v1.71.1 2024-02-22 08:29:08 -05:00
Charles "Demurgos" Samborski
fa146b8e86 fix(@angular-devkit/build-angular): allow mts and cts file replacement
Updates the `fileReplacement` pattern to allow `.mts` and `.cts` files.
This enables support for TypeScript files with explicit ESM support.

Closes #27124
2024-02-21 14:20:43 -08:00
Angular Robot
749cc744da build: update all non-major dependencies 2024-02-15 15:43:35 +01:00
Angular Robot
a83fbf6dfb build: update all non-major dependencies 2024-02-15 08:46:22 +01:00
Alan Agius
6e8d32638b fix(@angular-devkit/build-angular): support string as plugin option in custom postcss plugin config
In certain cases, the plugin option may be a string value, as shown in the example below:

```json
{
 "plugins": {
  "tailwindcss/nesting": "postcss-nesting"
  }
}
```

In certain cases, the plugin option may be a string value, as shown in the example below:

```json
{
 "plugins": {
  "tailwindcss/nesting": "postcss-nesting"
  }
}
```

See: https://tailwindcss.com/docs/using-with-preprocessors#nesting
2024-02-14 16:56:48 +01:00
Angular Robot
9f088c5ae9 build: update all non-major dependencies 2024-02-13 13:16:02 +01:00
Charles Lyding
e75aa9b581 fix(@angular-devkit/build-angular): downgrade copy-webpack-plugin to workaround Node.js support issue
The `copy-webpack-plugin@12` package has a dependency on the `globby@14` package. The recently released
`globby@14.0.1` uses the `merge-streams@2.1.0` package which requires a minimum Node.js version higher
than the officially supported 18.13 for the Angular CLI. Due to both `globby` and `merge-streams` being
transitive dependencies in end-user projects, the Angular CLI cannot directly control the package versions.
However, `copy-webpack-plugin@11` uses `globby@13` which is not affected by the Node.js version problem.
To workaround the Node.js compatibility problem, `copy-webpack-plugin` has been downgraded to version 11.0.0
which is the latest version in the 11 major for the package. The `copy-webpack-plugin` is only used with the
Webpack-based builders when in watch mode. From a review of the commit history between 11.0.0 and 12.0.2 (latest
at the time of this commit), it appears the only notable changes are several performance improvements and the
major version update of `globby`.
2024-02-13 13:14:21 +01:00
Charles Lyding
5a2a963043 fix(@angular-devkit/build-angular): bypass Vite prebundling for absolute URL imports
To avoid the Vite-based development server's prebundling system from attempting to
prebundle import statements containing absolute URLs, the set of external specifiers
will now be pre-filtered before being passed onto Vite. Currently, the check for
an absolute URL is any specifier starting with `http://`, `https://`, or '//'.
2024-02-12 08:39:20 +01:00
Angular Robot
848eff7b4c build: update dependency vite to v5.1.1 2024-02-09 10:54:41 -05:00