2628 Commits

Author SHA1 Message Date
Angular Robot
ab589543b8 build: update all non-major dependencies 2022-11-01 12:28:58 -07:00
Angular Robot
430186706e build: update dependency tslib to v2.4.1 2022-11-01 10:38:32 -07:00
Charles Lyding
942d555cf5 fix(@angular-devkit/build-angular): provide workaround for V8 object spread performance defect
V8 currently has a performance defect involving object spread operations that can cause degradation
in runtime performance. By specifically not supporting the object spread language feature when using
the esbuild-based browser application builder, a downlevel form will be used instead which provides a
workaround for the performance issue. The downlevel form can cause up to a 600 byte increase in file
size if an object spread operation would otherwise be present in an output file.
For more details: https://bugs.chromium.org/p/v8/issues/detail?id=11536
2022-11-01 10:38:01 -07:00
Angular Robot
469ad87499 build: update all non-major dependencies 2022-10-31 10:11:58 -07:00
Charles Lyding
e1ca87890a perf(@angular-devkit/build-angular): use Sass worker pool for Sass support in esbuild builder
When using the experimental esbuild-based browser application builder, Sass stylesheets will
now be processed using a worker pool that is currently also used by the default Webpack-based
builder. This allows up to four stylesheets to be processed in parallel and keeps the main thread
available for other build tasks. On projects with a large amount of Sass stylesheets, this change
provided up to a 25% improvement in build times based on initial testing.
2022-10-31 10:10:32 -07:00
Charles Lyding
7c2b846199 fix(@angular-devkit/build-angular): wait during file watching to improve multi-save rebuilds for esbuild builder
When using the experimental esbuild-based browser application builder in watch mode, the file watcher will now
wait 250ms from a reported file event before triggering a rebuild. The change allows the rebuild to better
capture groups of file changes. This can happen when using an IDE while editing multiple files and would otherwise
result in multiple rebuilds where a single rebuild would be ideal.
2022-10-31 10:10:06 -07:00
Angular Robot
7d5a816087 build: update dependency babel-loader to v9 2022-10-28 09:31:48 -07:00
Charles Lyding
2a6b585d18 fix(@angular-devkit/build-angular): correct escaping of target warning text in esbuild builder
The warning text note for the TypeScript target was incorrectly escaped within a template literal
which resulted in a badly formatted error message.
2022-10-28 09:31:27 -07:00
Angular Robot
503682766f build: update all non-major dependencies 2022-10-27 12:25:33 -07:00
Charles Lyding
e21ee326e0 fix(@angular-devkit/build-angular): ignore cache path when watching with esbuild builder
When using the experimental esbuild-based browser application builder in watch mode,
the base cache path defined within the `angular.json` file will now be ignored when
detecting file changes. While the builder currently does not persist cache to disk, it
may in the future and other builders may currently be run in parallel.
2022-10-26 08:57:48 -07:00
Charles Lyding
0fcc603ae7 fix(@angular-devkit/build-angular): issue dev-server support warning when using esbuild builder
The dev-server builder currently does not support the experimental esbuild-based browser application
builder and will use the Webpack-based builder instead. To better inform users of this behavior, a
warning is now issued upon executing the dev-server.
2022-10-26 08:57:18 -07:00
Charles Lyding
60086dbd01 perf(@angular-devkit/build-angular): avoid template diagnostics for declaration files in esbuild builder
The experimental esbuild-based browser application builder will now avoid trying to query the Angular
Compiler for template diagnostics when a TypeScript source file is a declaration file (`.d.ts`). This
avoids the overhead of the in-memory diagnostics caching logic as well as any Angular Compiler logic
to determine if the file has any template diagnostics.
2022-10-25 10:51:01 -07:00
Alan Agius
de8d846b98 docs: replace browserslist with AIO link
https://angular.io/guide/build#configuring-browser-compatibility will be updated to include additional information.
2022-10-24 15:12:42 -07:00
Charles Lyding
2b27679d9c refactor(@angular-devkit/build-angular): show more cumulative metrics for esbuild perf debug output
When the `NG_BUILD_DEBUG_PERF` environment variable is used to debug performance of the experimental
esbuild-based browser application builder, additional information will be logged for cumulative
profiling actions. This includes the count, minimum, maximum, and average.
2022-10-24 08:00:16 -04:00
Charles Lyding
1c87de6d8b perf(@angular-devkit/build-angular): avoid extra TypeScript emits with esbuild rebuilds
To further improve incremental rebuild performance of the experimental esbuild-based browser
application builder, the output of the TypeScript file loader within the Angular compiler plugin
are now cached in memory by the input file name and invalidated via the file watching events.
This allows an additional TypeScript emit including the associated transformations per input file
to be avoided if the file has not changed or has not been affected by other files within the
TypeScript program.
2022-10-24 08:00:16 -04:00
Alan Agius
b29ae2feda fix(@schematics/angular): add @angular/localize as type when localize package is installed
The `@angular/localize` entrypoint now exposes the global `$localize` method type.

See: https://github.com/angular/angular/pull/47763
2022-10-21 10:32:24 -04:00
Alan Agius
708011ea8e build: update all non-major dependencies 2022-10-21 10:24:39 -04:00
Angular Robot
30ce7435d6 build: update all non-major dependencies to v0.15.11 2022-10-17 10:33:42 +02:00
Alan Agius
c49f1eea62 fix(@angular-devkit/build-angular): resolve transitive dependencies in Sass when using Yarn PNP
Enhanced resolver is unable to resolve transitive dependencies in Sass when using Yarn PNP. The main reason for this is that Sass doesn't provide context on which file is requesting the module. See: sass/sass#3247.

As a workaround for this we store previously resolved paths and when a new request comes in we try to resolve this from the previously resolved files if we are unable to resolve the request from the workspace root.
2022-10-14 16:05:53 +02:00
Alan Agius
96551365e2 fix(@angular-devkit/build-angular): add @angular/platform-server as an optional peer dependency
`@angular/platform-server` is now an optional peer dep due to the recent changes in 1cd53d6be1/packages/angular_devkit/build_angular/src/builders/server/index.ts (L182)
2022-10-14 15:47:02 +02:00
Angular Robot
ef5b40f7e4 build: update all non-major dependencies 2022-10-14 10:01:11 +02:00
Angular Robot
c95bab80d0 build: update dependency cacache to v17 2022-10-14 10:00:42 +02:00
Charles Lyding
717bd03de6 fix(@angular-devkit/build-angular): account for package.json exports fields with CSS import statements
The `postcss-imports` package was previously used to support `@import` within CSS files. Unfortunately,
the package does not account for `package.json` exports fields. This prevents imports defined within that
field from working when used within a build.  The `css-loader` package does provide this functionality and
is now used to provide support for CSS `@import` instead of `postcss-imports`. This change does not affect
preprocessors that provide their own import behavior.
2022-10-14 09:36:08 +02:00
Alan Agius
5954d240fa fix(@angular-devkit/build-angular): only import karma when running karma builder
Karma is an optional peer dependency, but with the recent changes we broke this as we imported karma outside of the execution method, which made this package to be always imported even when the Karma builder was not invoked.
2022-10-13 15:25:20 +02:00
Charles Lyding
2adeb6fbf2 perf(@angular-devkit/build-angular): use Uint8Arrays for incremental caching with esbuild-based builder
When using the experimental esbuild-based browser application builder in watch mode, the in-memory
incremental caching will now use Uint8Arrays where possible to limit the amount of encoding needed
when passing data to esbuild. When passing a string to esbuild, it must encode the string prior to
sending it. By providing the pre-encoded data from the in-memory cache, this step can be skipped
for rebuilds of input files that have not changed.
2022-10-13 12:02:53 +02:00
Angular Robot
e7189f6e88 build: update dependency postcss to v8.4.18 2022-10-13 12:02:20 +02:00
Alan Agius
e34bfe5eb1 fix(@angular-devkit/build-angular): ignore specs in node_modules when finding specs
Some libraries ship spec in node_modules which might result errors such

```
./node_modules/comment-parser/tests/unit/spacer-description-joiner.spec.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: /Users/kkostadinov/Projects/material.angular.io/node_modules/comment-parser/tests/unit/spacer-description-joiner.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
```
2022-10-12 16:06:19 +02:00
Alan Agius
3d253e3b4a test: remove node16-broken from app-shell unit test
This is no longer the case and thus this test can be enabled.
2022-10-12 15:32:13 +02:00
Alan Agius
979bce45e6 feat(@angular-devkit/build-angular): auto include @angular/platform-server/init during server builds
This changes removes the need to import `@angular/platform-server/init` in the `main.server.ts` instead we now include this as an entry-point when we are bundling as server bundle.
2022-10-12 08:57:29 +02:00
Alan Agius
a95d130ef4 feat(@angular-devkit/build-angular): auto include @angular/localize/init when found in types
With this change we remove the need to include the `@angular/localize/init` package as polyfills in `polyfills.ts`, `angular.json` and `main.server.ts`.

Instead when `@angular/localize/init` is included in the TypeScript `types` we add this as entry-point. The `@angular/localize/init` will be added as a parts of the `types` array in a seperate PR to address https://github.com/angular/angular/issues/47677 which is caused by the fact that `@angular/localize/init` types are no longer imported when `@angular/localize/init` is added as a polyfill in `angular.json`.
2022-10-12 08:57:29 +02:00
Charles Lyding
52db3c0007 perf(@angular-devkit/build-angular): minimize Angular diagnostics incremental analysis in esbuild-based builder
When using the experimental esbuild-based browser application builder, the Angular diagnostic analysis performed
per rebuild is now reduced to only the affected files for that rebuild. A rebuild will now query the TypeScript
compiler and the Angular compiler to determine the list of potentially affected files. The Angular compiler will
then only be queried for diagnostics for this set of affected files instead of the entirety of the program.
2022-10-12 08:27:54 +02:00
Charles Lyding
1518133db3 fix(@angular-devkit/build-angular): use relative sourcemap source paths for Sass in esbuild builder
The Sass preprocessor's modern API will generate absolute file URLs for the `sources` field of generated
sourcemaps. These URLs will not be properly processed by esbuild and will not be correctly adjusted to be
relative to the workspace root directory for the built application. To correct this behavior, the Sass
generated sourcemaps are now adjusted to remove the `file:` protocol prefix and to make each path relative
to its input file. This allows esbuild to properly resolve and process the paths.
2022-10-11 22:09:50 +02:00
Alan Agius
4fcb0a82b5 fix(@angular-devkit/build-angular): correctly resolve Sass partial files in node packages
Prior to this change non relative partial files were not resolved properly. Example we did not try to resolve `@material/button/button` as `@material/button/_button` which caused the compilation to fail.
2022-10-11 20:15:02 +02:00
Alan Agius
124be1cc9c refactor: add build and rebuild related statistics and analytics
The new build and rebuild statistics are used by the CLI to submit build related information to GA.
2022-10-11 18:52:30 +02:00
Alan Agius
c969152de6 refactor: remove analytics API from core and architect
All analytics is now in the @angular/cli package

BREAKING CHANGE: analytics APIs have been removed without replacement from `@angular-devkit/core` and `@angular-devkit/architect`.
2022-10-11 18:52:30 +02:00
Alan Agius
639a3071c3 refactor: migrate analytics collector to use GA4
This change updates the analytics collector collector to use GA4 instead of UA. The motivation behind this change is that UA will stop collecting data in 2023.

BREAKING CHANGE:

`analyticsSharing` option in the global angular configuration has been
removed without replacement. This option was used to configure the Angular CLI to  access to your own users' CLI usage data.

If this option is used, it can be removed using `ng config --global cli.analyticsSharing undefined`.
2022-10-11 18:52:30 +02:00
Alan Agius
6c3f281d92 fix(@angular-devkit/build-angular): show warning when using TypeScript target older then ES2022 in esbuild builder
This commits adds a warning similar to that in the Webpack builder.
2022-10-11 16:46:56 +02:00
Charles Lyding
0d97c05115 refactor(@angular-devkit/build-angular): add debug profiling support to esbuild angular compiler plugin
When using the experimental esbuild-based browser application builder, initial debug performance profiling
information can now be output to the console by using the `NG_BUILD_DEBUG_PERF` environment variable. When
enabled, duration information for elements of the Angular build pipeline will be shown on the console.
Certain elements marked with an asterisk postfix represent the total parallel execution time and will
not correlate directly to the total build time. This information is useful for both experimentation with
build process improvements as well as diagnosing slow builds.
2022-10-11 12:30:37 +02:00
Angular Robot
8ccf87308e build: update all non-major dependencies 2022-10-11 10:55:54 +02:00
Charles Lyding
484cda5f9e fix(@angular-devkit/build-angular): isolate zone.js usage when rendering server bundles
When generating an app-shell via the app-shell builder, the server application rendering
will now take place within a Node.js Worker. Since the rendering requires the presence of
Zone.js, this change allows for the Zone.js patching to be isolated from the remainder
of the builder and Angular CLI code. This prevents Zone.js from persisting past the needed
render operation. This also allows for a workaround to a Zone.js/Node.js v18 problem where
the TypeScript dynamic import workaround involving the Function constructor to ensure a native
dynamic import expression will cause a failure when running on Node.js v18.10.
2022-10-10 17:18:16 +02:00
Angular Robot
cdf78d4641 build: update all non-major dependencies 2022-10-10 12:22:40 +02:00
Alan Agius
fd41753579 feat(@angular-devkit/build-angular): drop support for TypeScript 4.6 and 4.7
This commit drops support for TypeScript 4.6 and 4.7

BREAKING CHANGE: TypeScript versions older than 4.8.2 are no longer supported.
2022-10-07 10:37:21 -04:00
Angular Robot
cd1ae437e3 build: update all non-major dependencies 2022-10-07 10:36:46 -04:00
Charles Lyding
212609e81e refactor(@angular-devkit/build-angular): use high resolution time for esbuild builder completion time
Update the build time calculation for the experimental esbuild-based browser application builder to
use the `process.hrtime` time source.  The high resolution time provides a more accurate time source
and allows for nanosecond level timings if needed.  Currently the console output is rounded to the
nearest millisecond. Future performance monitoring capabilities may leverage the more fine-grained
values.
2022-10-07 10:35:11 -04:00
Alan Agius
f79f8b1d71 test: update colors in inlineStyleLanguage test
`color: green` is not part of the compiler code https://github.com/angular/angular/compare/15.0.0-next.4...15.0.0-next.5#diff-6051c2c8a3dc4a133880a8344097be738955132464028402155390c38e0ad18aR197 which causes our tests to fail. This replaces color `green` with another color `indianred`.
2022-10-06 13:43:33 -04:00
Charles Lyding
8c915d4149 perf(@angular-devkit/build-angular): avoid extra babel file reads in esbuild builder rebuilds
To further improve incremental rebuild performance of the experimental esbuild-based browser
application builder, the output of JS file babel transformations are now cached in memory by
the input file name and invalidated via the file watching events. This allows an additional
file read per JS input file to be avoided if the file has not changed. Previously the content
of the JS input file was used as the basis of the cache key for the transformation output which
necessitated reading the file. With the file change information available, the content based method
is no longer necessary.
2022-10-06 09:10:59 -04:00
Angular Robot
24bcfaaca1 build: update all non-major dependencies 2022-10-05 09:55:07 -04:00
Charles Lyding
67324b3e58 feat(@angular-devkit/build-angular): add initial incremental code rebuilding to esbuild builder
The experimental esbuild-based browser application builder will now support incremental JavaScript
bundling when run in watch mode via the `watch` option. This initial implementation integrates the
esbuild incremental rebuild functionality. TypeScript source file caching has also been added to
improve the rebuild initialization time for the TypeScript and Angular compilation steps.
This initial support is not yet fully optimized and additional work is planned to further improve
the rebuild performance.
2022-10-05 07:47:13 -04:00
Charles Lyding
e02d718170 refactor(@angular-devkit/build-angular): use single normalized options object in esbuild builder
A single options object is now used within the experimental esbuild-based browser application builder.
This removes the need to pass around two different options objects with potentially overlapping properties
throughout the build process.
2022-10-04 09:15:52 -04:00
Charles Lyding
fc1164b5fd refactor(@angular-devkit/build-angular): move more esbuild option setup into normalize option helper
The initial global stylesheet, file replacement, index HTML, and service worker option analysis and cleanup has
now been moved into the `normalizeOptions` helper for the esbuild-based browser application builder. This better
organizes the option related setup steps as well as reduces the amount of code in the main builder source file.
2022-10-04 09:15:52 -04:00