2992 Commits

Author SHA1 Message Date
Alan Agius
c30e3692b3 refactor(@angular/ssr): remove express engine
This removes the util function for express, instead the "CommonEngine" is called directly infuture before this package is final we might rename the "CommonEngine" to something else.
2023-08-30 09:53:57 +02:00
Angular Robot
683f84dc13 build: update all non-major dependencies 2023-08-30 09:08:28 +02:00
Angular Robot
d90f2f6047 build: update all non-major dependencies 2023-08-29 05:10:59 -07:00
Alan Agius
dfc80adb58 build: update ng-packagr version to v17 prerelease
Update package to support version 17.
2023-08-29 03:53:23 -07:00
Angular Robot
e36cbd020f build: update dependency tslib to v2.6.2 2023-08-29 00:40:09 -07:00
Olivier Combe
7970c3f25e fix(@angular-devkit/build-angular): use correct type for extraEntryPoints 2023-08-29 00:39:30 -07:00
Charles Lyding
7d006cb3a7 build: update Angular version to v17 prerelease
Package dependency versions and the version used to generate a new project have been updated to use `17.0.0-next.1`.
2023-08-29 00:38:37 -07:00
Alan Agius
3fe432c71b refactor: update code to integrate universal repo
This commit updates the moved universal code into the cli pipeline
2023-08-22 20:44:53 +00:00
Alan Agius
8fe8cdf05a refactor: move universal code into CLI repo
Merge remote-tracking branch 'universal/move-to-cli' into universal-merge
2023-08-16 11:34:47 +00:00
Alan Agius
e6ce7f8414 refactor: prepare code for CLI move 2023-08-16 09:55:58 +00:00
Charles Lyding
3c0719bde2 feat(@angular-devkit/build-angular): initial i18n extraction support for application builder
The `ng extract-i18n` command now supports using either the developer preview esbuild-based browser
or application builders. Support for the existing Webpack-based build system has been maintained.
The extraction process will now build the application based on the build target defined builder in
the case of either `@angular-devkit/build-angular:browser-esbuild` and `@angular-devkit/build-angular:application`.
In the case of the application builder, SSR output code generation is disabled to prevent duplicate messages
for the same underlying source code.
2023-08-14 18:16:08 +02:00
Angular Robot
a60749f3c2 build: update all non-major dependencies 2023-08-14 10:58:07 +02:00
Charles Lyding
5bf7022c47 fix(@angular-devkit/build-angular): remove support for Node.js v16
BREAKING CHANGE: Node.js v16 support has been removed

Node.js v16 is planned to be End-of-Life on 2023-09-11. Angular will stop supporting Node.js v16 in Angular v17.
For Node.js release schedule details, please see: https://github.com/nodejs/release#release-schedule
2023-08-14 10:57:54 +02:00
Charles Lyding
c7d12910a9 refactor(@angular-devkit/build-angular): remove unneeded esbuild external packages workaround
Version 0.19 of esbuild added the ability to consider tsconfig path mappings when using the
external packages build option. This addition allows the Angular build system to remove a
resolve plugin that previously was used to workaround this limitation. Removal of the plugin
may also provide improved rebuild performance when used with the development server as many
of the JavaScript resolution attempts will no longer need to be handled by the now removed
plugin.
2023-08-14 10:57:41 +02:00
Alan Agius
f3229c44ad fix(@angular-devkit/build-angular): update vite to be able to serve app-shell and SSG pages
This commits, update the application builder and vite dev-server to be able to serve the app-shell and prerendered pages.
2023-08-14 10:57:13 +02:00
Charles Lyding
8b74a50e7b fix(@angular-devkit/build-angular): encode Sass package resolve directories in importer URLs
When using the new developer preview application build system, Sass import/use usage that specifies
a package is adjusted to contain the resolve directory to workaround Sass import plugin limitations.
This resolve directory is now encoded to prevent the new specifier from looking like a URL with a
scheme to the Sass compiler. This can occur on Windows when a drive letter is present (`C:\`).
2023-08-11 11:07:33 -07:00
Charles Lyding
a4dcfa98c1 refactor(@angular-devkit/build-angular): move TypeScript diagnostic conversion into compilation base
When using the esbuild-based browser application builder, TypeScript diagnostics are now converted
into esbuild messages within the compilation base class instead of the plugin. This helps further
isolate the TypeScript details within the compilation classes. Additionally, this provides diagnostic
objects that can be more easily serialized earlier in the build process.
2023-08-10 11:29:59 -07:00
Alan Agius
89e644b245 build: update all non-major dependencies
(cherry picked from commit 90f0b818a459ec288342364d364b3d24694b639f)
2023-08-10 11:06:45 -07:00
Alan Agius
4935172a10 fix(@angular-devkit/build-angular): display warning when using resourcesOutputPath with esbuild builder
`resourcesOutputPath` option is not supported when using the esbuild based builder.

Closes #25658
2023-08-10 10:49:13 -07:00
JoostK
54d2b02d26 refactor(@angular-devkit/build-angular): reduce source map resolution to word boundary
magic-string 0.30.2 introduced [the `boundary` strategy][1] for its high-resolution
source map mode, reducing the number of source map segments to align with word
boundaries instead of having a segment per character.

[1]: https://github.com/Rich-Harris/magic-string/pull/255
2023-08-09 09:11:18 -07:00
Ben McCann
e4b7c02a69 refactor(@angular-devkit/build-angular): prepare for Vite 5 2023-08-04 16:06:53 -04:00
aanchal
efeae1e1f1 docs: remove duplicate words 2023-08-04 14:49:14 -04:00
Charles Lyding
3a576574ae refactor(@angular-devkit/build-angular): restructure i18n extraction builder to allow for application builder support
The `extract-i18n` builder code has been restructured in a similar fashion to the `dev-server` builder.
This refactor provides the groundwork to add support for the `application` and `browser-esbuild` builders
during message extraction.
The webpack related logic has been split into a separate file and is dynamically imported when needed.
Additionally the options processing has been moved to a separate file and the `index.ts` now only exports
instead of previously containing most of the builder logic.
2023-08-04 14:48:37 -04:00
Joey Perrott
80b2c92750 build: update critters
Update to latest version of critters.
2023-08-04 09:36:18 -04:00
aanchal
b2a51d8db7 docs: omit repetitions 2023-08-03 14:07:59 -04:00
Angular Robot
6c5c71103f build: update all non-major dependencies 2023-08-03 12:36:35 -04:00
Bram Gotink
df4d358f33 fix(@angular-devkit/build-angular): prevent race condition in setting up sass worker pool 2023-08-03 12:09:00 -04:00
Charles Lyding
96ff17b4d1 ci: reduce bazel test shards for browser builder test
Reduce the number of test shards for the browser builder from 50 to 10.
50 is more than needed and can cause excessive resource usage.
2023-08-03 10:13:24 -04:00
JounQin
6539bb5200 fix(@angular-devkit/build-angular): hot update filename suffix with .mjs 2023-07-28 11:18:16 -04:00
Angular Robot
258e82b16f build: update all non-major dependencies 2023-07-26 14:40:39 -04:00
Angular Robot
373402f68e build: update dependency tslib to v2.6.1 2023-07-26 09:49:41 -04:00
Kristiyan Kostadinov
d6ae2c7b7a fix(@angular-devkit/build-angular): error during critical CSS inlining for external stylesheets
These changes revert the performance improvement from e88aea65bd and add a test. The problem with the previous approach is that it assumes that a `link` tag processed by Critters will be preceded by a `style` tag that was inserted by Critters. This assumption might not necessarily be true if Critters is unable to resolve the content of the linked styles. Furthermore, I'm not sure if we need to optimize this code path to begin with, because it only does a shallow traversal of the `head` tag which is generally fast and is unlikely to have many direct descendants.

Fixes #25419.
2023-07-26 09:47:22 -04:00
Charles Lyding
449e21b3a6 fix(@angular-devkit/build-angular): correctly load dev server assets with vite 4.4.0+
The underlying development server (Vite) for the application build system updated
its static file serving dependencies which resulted in the `@fs` special file URLs
supported by Vite to have a different format.  Previously, the paths were encoded
using `encodeURIComponent` but are now use `encodeURI`. The development server
integration with Vite will now use the matching encoding to allow build defined
assets to be correctly served.
2023-07-24 20:41:22 -04:00
Angular Robot
0c302365a5 build: update all non-major dependencies 2023-07-24 13:24:55 -04:00
Angular Robot
a0bf9462f5 build: update all non-major dependencies 2023-07-18 15:30:12 -07:00
Charles Lyding
6bfd1800ef perf(@angular-devkit/build-angular): use in-memory Sass module resolution cache
When using Sass files with module import references in the esbuild-based browser application
builder, the module resolution attempts will now be cached in memory. This caching is only
local to each entry Sass file currently. However, this may be expanded to encompass all Sass
entries within a build in the future. In addition to caching the entire resolution attempt,
individual package root resolution is also cached for deep import attempts. This is useful
for packages (such as `@material/*`) which deep import to multiple different files in the
same package.
With this change combined with the previous lexer change, package managers (pnpm & Yarn PnP)
that require workarounds for functioning resolution will now perform at an equivalent level
to other package managers.
2023-07-18 15:29:39 -07:00
Angular Robot
881b60c1a8 build: update all non-major dependencies 2023-07-17 10:14:43 -07:00
Charles Lyding
61a652d912 perf(@angular-devkit/build-angular): inject Sass import/use directive importer information when resolving
To correctly resolve a package based import reference in a Sass file with pnpm or Yarn PnP, the importer
file path must be known. Unfortunately, the Sass compiler does not provided the importer file to import plugins.
Previously to workaround this issue, all previously resolved stylesheets were tried as the importer path. This
allowed the stylesheets to be resolved but it also could cause a potentially large increase in build time due
to the amount of previous stylesheets that would need to be tried. To avoid the performance impact and to also
provide more accurate information regarding the importer file, a lexer is now used to extract import information
for a stylesheet and inject the importer file path into the specifier. This information is then extracted from the
import specifier during the Sass resolution process and allows the underlying package resolution access to a viable
location to resolve the package for all package managers. This information is currently limited to specifiers
referencing the `@angular` and `@material` package scopes but a comprehensive pre-resolution process may be added
in the future.
2023-07-14 19:03:06 -04:00
Sergey Gultyayev
5048f6e82e fix(@angular-devkit/build-angular): Set chunk names explicitly
Explicitly set chunk name pattern to exclude them from Jest run
2023-07-14 17:50:31 -04:00
Charles Lyding
5908ede3d6 fix(@angular-devkit/build-angular): correctly wrap CommonJS exported enums when optimizing
When optimizing a CommonJS exported enum, the build optimizer enum wrapping pass was previously
dropping the `exports` object assignment from the enum wrapper function call expression. This
would not occur with application code but is possible with library code that was built with
TypeScript and shipped as CommonJS.

Assuming the following TypeScript enum:
```
 export enum ChangeDetectionStrategy {
   OnPush = 0,
   Default = 1,
 }
```

TypeScript 5.1 will emit an exported enum for CommonJS as follows:
```
exports.ChangeDetectionStrategy = void 0;
var ChangeDetectionStrategy;
(function (ChangeDetectionStrategy) {
    ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
    ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
})(ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = ChangeDetectionStrategy = {}));
```

The build optimizer would previously transform this into:
```
exports.ChangeDetectionStrategy = void 0;
var ChangeDetectionStrategy = /*#__PURE__*/ (() => {
  ChangeDetectionStrategy = ChangeDetectionStrategy || {};
  ChangeDetectionStrategy[(ChangeDetectionStrategy["OnPush"] = 5)] = "OnPush";
  ChangeDetectionStrategy[(ChangeDetectionStrategy["Default"] = 8)] = "Default";
  return ChangeDetectionStrategy;
})();
```
But this has a defect wherein the `exports` assignment is dropped. To rectify this situation, the build optimizer will now transform the code into:
```
exports.ChangeDetectionStrategy = void 0;
var ChangeDetectionStrategy = /*#__PURE__*/ (function (ChangeDetectionStrategy) {
  ChangeDetectionStrategy[(ChangeDetectionStrategy["OnPush"] = 0)] = "OnPush";
  ChangeDetectionStrategy[(ChangeDetectionStrategy["Default"] = 1)] = "Default";
  return ChangeDetectionStrategy;
})(ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = ChangeDetectionStrategy = {}))
```
This retains the `exports` assignment.
2023-07-13 19:36:57 -04:00
Charles Lyding
953104ee17 refactor(@angular-devkit/build-angular): configure AOT compiler to skip NgModule scope metadata emit in esbuild
The esbuild plugin used within the esbuild-based browser application builder will now use the newly
introduced internal `supportJitMode` AOT compiler option to disable the emit of NgModule scope metadata
functions within the output code. This removes the need to perform an additional transformation of the
AOT compiler generated code to immediately remove the metadata. The Angular CLI neither previously nor currently
supports hybrid AOT/JIT mode. In the future if this support situation changes, additional behavior may
be added control the internal `supportJitMode` option.
2023-07-13 18:36:57 -04:00
Angular Robot
11ea13a9b8 build: update all non-major dependencies 2023-07-13 17:07:43 -04:00
Angular Robot
8a2a3703e8 build: update all non-major dependencies 2023-07-12 15:14:34 -04:00
Alan Agius
7defb3635c fix(@angular-devkit/build-angular): ensure that server dependencies are loaded also in ssr entrypoint
This commit ensure that server "polyfills" like `zone.js` and `@angular/compiler` are loaded as well when using the `ssr` option
2023-07-12 10:11:49 -04:00
Angular Robot
7e5da6ec81 build: update all non-major dependencies 2023-07-12 11:25:33 +02:00
Alan Agius
099cec758a feat(@angular-devkit/build-angular): add support for serving SSR with dev-server when using the application builder
This commit introduces experimental support for serving the application in SSR mode with the Vite based dev-server when using the application builder.
2023-07-11 08:05:55 -04:00
Alan Agius
bdee1ac556 refactor(@angular-devkit/build-angular): refactor prerendering code to aid code reusability
This commit refactors the prerending code and makes it more reusable. This is needed to implement SSR support in the dev-server.
2023-07-11 08:05:55 -04:00
Charles Lyding
304ec64892 refactor(@angular-devkit/build-angular): ensure TS resolution cache with file replacements
When overriding module resolution on a TypeScript Host object, TypeScript will not
automatically create a resolution cache for the Host. Within the application build system
the TypeScript resolution is only overrided if file replacements are used. A resolution
cache is now manually created and added to the TypeScript Host when file replacements are
present.
2023-07-11 08:05:08 -04:00
Alan Agius
e6b377436a feat(@angular-devkit/build-angular): add ssr option in application builder
This commit adds an `ssr` option to the application builder, this can be either a `boolean` or an `object` with an `entryPoint` property.

In the future, server bundles will only be emitted when the ssr option is truthy, as unlike SSR, SSG and AppShell do not require the server bundles to be written to disk.
2023-07-10 12:37:30 -04:00
Charles Lyding
a0a2c7aef6 perf(@angular-devkit/build-angular): only load browserslist in babel preset if needed
The `browserslist` package is only needed in the custom Babel application preset if
the `supportedBrowsers` option is specified. This option is not used within the esbuild-
based browser application builder. The `browserslist` is now lazily imported only when
needed and avoids the overhead of loading browser support data when not needed by the build.
2023-07-10 12:27:15 -04:00