2908 Commits

Author SHA1 Message Date
Charles Lyding
480bd4e30e fix(@angular-devkit/build-angular): actually disable Vite prebundling file discovery
The `entries` option should be used instead of the `includes` option to disable the
file entry based discovery for Vite's prebundling. This discovery is unneeded due
to the built application files existing only in memory.
2023-06-16 10:13:52 -04:00
Angular Robot
56d27a4505 build: update dependency piscina to v4 2023-06-16 10:13:09 -04:00
Alan Agius
3d271132ae fix(@angular-devkit/build-angular): unpin and downgrade browserslist
This is in an effort to reduce errors like `"Unknown version 114 of edge (While processing: "base$0$0")"` which are caused by mismatching versions.

Closes #25377
2023-06-16 10:12:41 -04:00
Angular Robot
bb4c9c82e8 build: update all non-major dependencies 2023-06-15 09:59:43 -04:00
aanchal
a4e3f53083 refactor: remove unused constructor method 2023-06-14 11:25:05 +02:00
Doug Parker
d4a2849010 build: bump versions for minor release 2023-06-13 09:22:39 -07:00
Alan Agius
6bebc45776 refactor: move esbuild index generator, code bundle option and execution results
This commit extracts code in separate files.
2023-06-09 16:58:23 +02:00
Alan Agius
466d86dc8d refactor(@angular-devkit/build-angular): update code base structure to facilitate future builders
This commit updates the code base structure in preparation for future works.
2023-06-09 16:02:14 +02:00
Charles Lyding
779c969f31 fix(@angular-devkit/build-angular): support proxy configuration array-form in esbuild builder
When using the Webpack-based browser application builder with the development server, the
proxy configuration can be in an array form when using the `proxyConfig` option. This is unfortunately
not natively supported by the Vite development server used when building with the esbuild-based
browser application builder. However, the array form can be transformed into the object form.
This transformation allows for the array form of the proxy configuration to be used by both
development server implementations.
2023-06-09 15:03:06 +02:00
alkavats1
76a12277f7 refactor: removed unused import statements 2023-06-09 13:39:32 +02:00
alkavats1
ab9adea057 refactor: replaced the String wrapper object with primitive type string 2023-06-09 13:39:18 +02:00
Angular Robot
dac0f25dfb build: update all non-major dependencies 2023-06-09 13:20:53 +02:00
Charles Lyding
2a3fc68460 feat(@angular-devkit/build-angular): add preload hints based on transitive initial files
When using the esbuild-based browser application builder, the pre-existing initial file
analysis is now used to generate preload hints for any transitive initial files required
by the application. These hints are generated for both the initial JavaScript chunks and
any initial global stylesheets that may be present. These hints provide additional
information to the browser so that it can start and better prioritize fetching of files
needed to start the application.
2023-06-09 11:00:00 +02:00
Alan Agius
051998c908 build: update all non-major dependencies
(cherry picked from commit 310fef6e9028dbc95dc1456e37e294201fc247c3)
2023-06-08 17:27:38 +02:00
Alan Agius
cc09b701a9 fix(@angular-devkit/build-angular): correctly handle sass imports
Prior to this change nested imports in sass were processed as scss when using the esbuild builder due to an incorrect check.

Closes #25338
2023-06-08 17:27:14 +02:00
Alan Agius
bc48a0db31 build: update all non-major dependencies 2023-06-07 15:26:36 +02:00
Charles Lyding
bc5b7d515b refactor(@angular-devkit/build-angular): improve initial file analysis for esbuild builder
When using the esbuild-based browser application builder, the set of initially loaded files
for the application is now calculated by analyzing potential transitively loading JavaScript
and/or CSS files. This ensures that the full set of bundled files is available for bundle
size calculations as well as further analysis in areas such as link-based hint generation in
the application's index HTML.
This also fixes a bug where non-injected `scripts` where incorrectly shown as initial files.
2023-06-07 10:43:56 +02:00
Romeo Mihalovics
7155cbe5b2 fix(@angular-devkit/build-angular): ignore folders starting with a dot in browser-esbuild watcher
When running the builder in watch mode, and fetching the git repo that the project is contained in, any changes in the .git folder trigger a rebuild. This is especially annoying when the IDE that you use periodically fetches the repository, and the FETCH_HEAD file triggers the rebuild every time. With this change the folders starting with a dot will be ignored in the watcher to avoid similar issues
2023-06-06 15:48:16 +02:00
Romeo Mihalovics
772fe84ed3 fix(@angular-devkit/build-angular): ignore .git folder in browser-esbuild watcher
When running the builder in watch mode, and fetching the git repo that the project is contained in, any changes in the .git folder trigger a rebuild. This is especially annoying when the IDE that you use periodically fetches the repository, and the FETCH_HEAD file triggers the rebuild every time. With this change the .git folder will be ignored in the watcher
2023-06-06 15:48:16 +02:00
Charles Lyding
aaf9ee96bd refactor(@angular-devkit/build-angular): add internal support for index HTML link hints
The index HTML generation functionality for both the Webpack-based and esbuild-based
browser application builder now supports adding link hint elements to the generated output.
This includes `prefetch`, `preload`, `modulepreload`, `preconnect`, and `dns-prefetch` hint
modes. This functionality is not yet used by builds and will be integrated within future
changes.
2023-06-06 12:38:41 +02:00
Angular Robot
52e5cd912d build: update dependency tslib to v2.5.3 2023-06-06 12:37:39 +02:00
Alan Agius
b83dc4463b refactor: create a common plugin to generate virtual modules
This commit adds a new plugin to enable us to create virtual modules more easily.
2023-06-02 09:45:23 -04:00
Charles Lyding
3d1c09b235 feat(@angular-devkit/build-angular): support dev-server package prebundling with esbuild builder
When using the development server with the esbuild-based browser application builder, the underlying
Vite server will now prebundle packages present in an application. During the prebundling process,
the Angular linker will also be invoked to ensure that APF packages are processed for AOT usage.
The Vite prebundling also provides automatic persistent caching of processed packages. This allows
reuse of processed packages across `ng serve` invocations. To support the use of prebundling at the
development server level, all packages are considered external from the build level. The first time
a package is used within an application there may be a short delay upon accessing the page as the
package is processed. Due to the persistent nature of the prebundling, the `ng cache` command is used
to control the use of the feature. Please note, however, disabling the cache will also disable TypeScript
incremental compilation if not otherwise specifically disabled.
2023-06-01 09:36:17 -04:00
Charles Lyding
ee5763dcac refactor(@angular-devkit/build-angular): use fast-glob for file searching support
The file searching within the build system (both Webpack and esbuild) now use the
`fast-glob` package for globbing which provides a small performance improvement.
Since the assets option in particular is within the critical path of the buil pipeline,
the performance benefit from the switch will be most prevalent in asset heavy projects.
As an example, the Angular Material documentation site saw the asset discovery time
reduced by over half with the switch. `fast-glob` is also the package used by Vite
which provides additional benefit by ensuring that the Angular CLI behavior matches
that of the newly integrated Vite development server.
2023-05-31 14:54:13 -04:00
Alan Agius
fc60d22276 fix(@angular-devkit/build-angular): correctly set overridden compiler option
Previously, we set the options of an incorrect variable.
2023-05-31 11:35:58 -04:00
Alan Agius
1225ce4dc4 build: update all non-major dependencies 2023-05-31 10:22:08 -04:00
Charles Lyding
c462d9cb90 fix(@angular-devkit/build-angular): preemptively remove AOT metadata in esbuild builder
The Angular compiler generates two types of metadata calls when it generates AOT code.
This metadata is not used in fully AOT compiled applications and can contain direct references
to components, services, etc. that may affect the output chunk layout of the application.
While this currently has not lead to any problems, it could in the future and the Webpack
bundler already performs a transform that preemptively removes these calls. To remain
consistent, the esbuild-based build system will now also perform this transform.

This also updates the autoprefixer behavior tests to check the actual runtime style text
instead of the style text within the metadata calls.
2023-05-31 07:51:39 -04:00
Charles Lyding
9aa9b5264e feat(@angular-devkit/build-angular): support autoprefixer/tailwind CSS with Less/Sass in esbuild builder
When using the esbuild-based browser application builder, Sass and Less stylesheets will now be post-processed
with autoprefixer and/or Tailwind CSS when applicable. CSS stylesheets were already processed by these tools.
Autoprefixer is queried based on the configured browserslist to determine if any processing is required and
is not added to the build pipeline if no transformations are required. Likewise for Tailwind, if no Tailwind
configuration file is present, Tailwind CSS will also not be added to the build pipeline. If both autoprefixer
and Tailwind are not required, `postcss` (the tool used to post-process the stylesheets) itself is not added
to the build pipeline. This removes the potential for unneeded build time overhead for projects that do not
require these post-processing steps.
The default browserslist currently does require the use of autoprefixer based on autoprefixer's prefix analysis.
2023-05-30 09:54:47 -04:00
Kristiyan Kostadinov
b076a6f4ef build: update to TypeScript 5.1
Bumps up the dev depdencies to TypeScript 5.1-beta and expands the allowed version ranges to prepare for the final release.
2023-05-26 10:34:32 -04:00
Charles Lyding
5cacd34a22 fix(@angular-devkit/build-angular): watch all TypeScript referenced files in esbuild builder
When using the esbuild-based browser application builder in watch mode, all files referenced
by the TypeScript program are now watched in additional to files within the project root.
This allows for more extensive monorepo setups to take advantage of watch mode as TypeScript
files may exist in other library projects within the repository.
2023-05-25 11:26:38 -04:00
Angular Robot
b674bd2c3c build: update all non-major dependencies 2023-05-23 17:42:56 -04:00
Angular Robot
77336f7bcc build: update all non-major dependencies 2023-05-22 09:38:14 -04:00
Alan Agius
6a4ce53857 refactor: disable Webpack topLevelAwait
Webpack enabled top level await by default in version 5.83.0. (See: https://github.com/webpack/webpack/releases/tag/v5.83.0)

This commit restores the previous behaviour, as top level await is not supported due to Zone.js issues.
2023-05-22 09:37:09 -04:00
Alan Agius
b628cff77b build: update all non-major dependencies
(cherry picked from commit 1afbec1e36708737b6ae75277e0649d0e334d1b2)
2023-05-19 17:14:01 +02:00
Charles Lyding
8336ad80da perf(@angular-devkit/build-angular): enable in-memory load result caching for stylesheets in esbuild builder
The stylesheet related plugins for the esbuild-based browser application builder will now cache intermediate
load results when in watch mode. This reduces the potential amount of processing needed during a rebuild for
both `ng build --watch` and `ng serve`.
2023-05-19 12:18:03 +02:00
Charles Lyding
ffea33fc45 refactor(@angular-devkit/build-angular): use helper to setup esbuild plugin load caching
Within the esbuild-based browser application builder, a helper function has been introduced
to streamline the use of the load result cache within the internal plugins. This removes
repeat code that would otherwise be needed. The ability to use a load result cache with the
global script processing has also been added but has not yet been enabled.
2023-05-19 12:18:03 +02:00
Charles Lyding
4c82bb8e81 fix(@angular-devkit/build-angular): percent encode asset URLs in development server for esbuild
When using the esbuild-based browser application builder with the development server, configured
application assets are served directly from disk. The URLs passed to Vite are now percent encoded
to properly handle asset paths that may contain unsupported URL characters.
2023-05-19 10:29:40 +02:00
Angular Robot
541b291cfb build: update dependency tslib to v2.5.2 2023-05-19 10:28:15 +02:00
Angular Robot
cbadb8080f build: update all non-major dependencies 2023-05-17 12:06:49 +00:00
Angular Robot
63f7199a5d build: update all non-major dependencies 2023-05-16 12:33:12 +00:00
Charles Lyding
2d141fe3bc feat(@angular-devkit/build-angular): show estimated transfer size with esbuild builder
When using the esbuild-based browser application builder, the console build stats output
will now show the estimated transfer size of JavaScript and CSS files when optimizations
are enabled. This provides similar behavior to the default Webpack-based builder.
2023-05-16 12:32:56 +00:00
Angular Robot
c2bc6ffc88 build: update all non-major dependencies to v0.17.19 2023-05-15 12:51:20 +00:00
Charles Lyding
141d74d190 fix(@angular-devkit/build-angular): attempt relative global script read first in esbuild builder
When using a global script (`scripts` option) with the esbuild-based browser application builder,
an attempt to read the script as a relative path from the workspace root will be performed first.
This avoids the need to perform a potentially expensive module resolution attempt for files that
are directly available and also ensures the relative paths are given priority over any potential
modules with the same name. This matches prior behavior that also preferred relative paths.
2023-05-15 12:50:59 +00:00
Charles Lyding
ac95732df6 perf(@angular-devkit/build-angular): minor sourcemap ignorelist improvements for esbuild builder
This provides a minor performance benefit for the generation of the Chrome sourcemap ignorelist
generation. Memory is shared were possible and string searching is reduced in certain cases.
2023-05-15 12:50:36 +00:00
Charles Lyding
a9c6b449f6 fix(@angular-devkit/build-angular): normalize Vite dev-server Windows asset paths
When using the esbuild-based browser application builder with the Vite-based development
server on Windows, source asset paths were previously not normalized prior to being included
in request URLs. This could result in invalid asset request URLs due to invalid path
segment separators.
2023-05-15 12:49:28 +00:00
Angular Robot
419cc8282e build: update all non-major dependencies 2023-05-12 15:56:22 -04:00
Charles Lyding
d1f075e732 fix(@angular-devkit/build-angular): correctly generate serviceworker hashes for binary assets
When using the esbuild-based build system with the service worker enabled, binary assets were
unintentionally being hashed with the assumption of UTF-8 encoding. The assets are now hashed
directly to ensure correct output hashes.
2023-05-12 15:41:21 -04:00
Charles Lyding
d8930facc0 feat(@angular-devkit/build-angular): support incremental TypeScript semantic diagnostics in esbuild builder
When using the esbuild-based browser application builder with CLI caching enabled, TypeScript's `incremental`
option will also be enabled by default. A TypeScript build information file will be written after each build and
an attempt to load and use the file will be made during compilation setup. Caching is enabled by default within
the CLI and can be controlled via the `ng cache` command. This is the first use of persistent caching for the
esbuild-based builder. If the TypeScript `incremental` option is manually set to `false`, the build system will
not alter the value. This can be used to disable the behavior, if preferred, by setting the option to `false` in
the application's configured `tsconfig` file.
NOTE: The build information only contains information regarding the TypeScript compilation itself and does not
contain information about the Angular AOT compilation. TypeScript does not have knowledge of the AOT compiler
and it therefore cannot include that information in its build information file. Angular AOT analysis is still
performed for each build.
2023-05-12 11:33:51 -04:00
Charles Lyding
3ede1a2cac feat(@angular-devkit/build-angular): allow forcing esbuild builder with dev-server
To allow lower overhead trial of the developer preview of the esbuild-based builder system,
the development server now has an option to force the usage of the esbuild-based
build system while still retaining the default Webpack-based build system for the
`build` command. The `forceEsbuild`/`--force-esbuild` option can be added to the
`angular.json` options for the `serve` target or used on the command line, respectively.
The `browser-esbuild` builder will be used to build the application using the options
specified by the server configuration's `browserTarget` option. Unsupported build options
will be ignored. If using a third-party builder, a warning will be issued but the build
will still be attempted. Third-party builder usage in this context is considered
unsupported and may result in unexpected behavior or build failures.
2023-05-11 15:43:29 -04:00
Angular Robot
f6c1f088c9 build: update all non-major dependencies 2023-05-10 15:33:55 +00:00