3589 Commits

Author SHA1 Message Date
Charles Lyding
c2a8bf13db refactor(@angular-devkit/build-angular): move Vite dev-server @angular/build imports into separate file
To reduce the complexity of the move of the Vite-based dev-server builder
into the `@angular/build` package. The soon to be self-referencing imports
are now located in a separate file. Self-referencing imports are not well
supported inside the repository currently so this move allows the imports
to be adjusted in one location.
2024-04-22 09:06:33 -04:00
Charles Lyding
2391c878ab refactor(@angular-devkit/build-angular): remove Webpack-specific index option helper from Vite-based dev-server
The index output option helper from within the Webpack-based build system has been removed
from the Vite-based development server code to support separation of the builder. This
information will eventually be passed via the build system results and the direct option
access can then be removed completely.
2024-04-22 09:06:33 -04:00
Charles Lyding
1cebc3a5e9 refactor(@angular-devkit/build-angular): use dev-server implementation neutral builder output result interface
The dev-server builder will now only provide an interface with typed fields
for the combined set of common elements for the Webpack and Vite development
server implementations. Any additional builder specific runtime fields will
still be present and accessible.
2024-04-22 09:06:33 -04:00
Charles Lyding
810d213e18 feat(@angular/build): introduce new official build system package
The `@angular/build` package has been introduced to house the esbuild/Vite-based
build system that was newly introduced as stable in v17. The existing
`@angular-devkit/build-angular` package will continue to contain the Webpack-based
build system and to ensure backwards compatibility it will also provide aliases
for the esbuild/Vite-based build system. The changes here are the first stage
of the builder transition and moves the `application` builder into the new package.
The application builder can now be accessed when this package is installed directly
via `@angular/build:application`.

No changes are required for existing projects.
2024-04-18 17:24:23 +02:00
Charles Lyding
2ef958a7ce refactor(@angular-devkit/build-angular): remove @ngtools/webpack deep imports from application builder
The application builder previously used several TypeScript compiler host augmentation helper functions
and the bootstrap replacement transformer from the `@ngtools/webpack` package. To remove reliance on
Webpack-specific functionality. The subset of helpers have been copied into the application builder
itself. Some of the helpers will eventually be removed completely pending future updates to the
Angular compiler itself.
2024-04-18 17:24:23 +02:00
Alan Agius
87ba0e5848 refactor: replace usage of deprecated mapTo with map 2024-04-18 16:40:36 +02:00
Alan Agius
a189f17a12 build: update ng-packagr to 18.0.0-next.3 2024-04-18 16:40:36 +02:00
Alan Agius
53c319aaa9 feat(@angular-devkit/build-angular): add support for the poll option in the library builder
This commit adds support for polling when using the ng-packagr builder

Closes #27420
2024-04-18 16:40:36 +02:00
Alan Agius
d1c632af9a feat(@angular-devkit/build-angular): support native async/await when app is zoneless
This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes #22191
2024-04-18 14:34:09 +02:00
Angular Robot
8843188080 build: update all non-major dependencies 2024-04-17 20:01:54 +02:00
Alan Agius
d51cb598a7 feat(@angular-devkit/build-angular): inject event-dispatch in SSR HTML page
This commit add support in the Angular CLI to inject the event-dispatcher script when using the application builder.
2024-04-17 19:29:36 +02:00
Alan Agius
1c3ff61db8 fix(@angular-devkit/build-angular): address Unable to deserialize cloned data issue with Yarn PnP
Occasionally, when using Yarn PnP, an error message `Unable to deserialize cloned data` arises during the optimization phase of JavaScript bundles. This update rectifies the problem.

See: http://b/335203823
2024-04-17 15:41:29 +02:00
Charles Lyding
631303664e test: move builder testing infrastructure to separate bazel target module
The builder testing infrastructure and harness has been moved out of the
`@angular-devkit/build-angular` package and into a separate bazel only
module.  This allows the testing code to be shared with other packages
within the repository. It also removes test only code from within
the package that is not specific any of the included builders.
2024-04-17 10:23:50 +02:00
Alan Agius
43816a5b2d fix(@angular-devkit/build-angular): remove type="text/css" from style tag
`type="text/css"` is deprecated, for more info see: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#deprecated_attributes

Closes: #27471
2024-04-16 17:18:43 +02:00
Alan Agius
28906b8577 refactor: replace vite server.ws.send usages
The above mentioned API is deprecated.
2024-04-16 17:18:22 +02:00
Angular Robot
51d956bb87 build: update all non-major dependencies 2024-04-16 11:53:19 +02:00
Charles Lyding
4d27c38cd4 refactor(@angular-devkit/build-angular): reduce Webpack specific overlap in bundle budget calculator
Webpack-specific types and imports have been reduced within the logic and test code for the bundle
budget calculator. This reduces the amount of unused code that needs to be loaded when not using
a Webpack-based bundler. The Webpack component style budget plugin was also updated to use only
the `checkBudgets` function instead of the previous two function setup which limits the needed
amount of runtime exports for the plugin.
2024-04-15 09:49:22 -04:00
Angular Robot
b250831598 build: update all non-major dependencies 2024-04-15 12:34:09 +02:00
Charles Lyding
e6582e6931 refactor(@angular-devkit/build-angular): reduce Webpack specific overlap in stats table generation
Webpack-specific types and imports have been reduced within the logic for the build stats table generation.
This reduces the amount of unused code that needs to be loaded when not using a Webpack-based bundler.
2024-04-15 12:33:50 +02:00
Angular Robot
4fe345adb6 build: update all non-major dependencies 2024-04-12 09:27:02 -04:00
Alan Agius
83d1d233a2 feat(@angular-devkit/build-angular): enhance Sass rebasing importer for resources URL defined in variables and handling of external paths
This commit introduces enhancements to the Sass rebasing importer, enabling it to resolve resources whose paths are stored in variables or namespaced variables. Also this addresses an issue where URL paths in Sass and SCSS files, flagged as external, were incorrectly rebased, leading to resolution errors.

Closes #27445 and closes #27007
2024-04-12 09:26:01 -04:00
Charles Lyding
dcee94b282 refactor(@angular-devkit/build-angular): split Webpack-specific functionality from i18n option creation
The i18n option creation for a project, which is a combination of the `i18n` project field and the `localize`
build option, is now in a separate file from the Webpack specific i18n configuration setup.
This allows the i18n option creation to be used without loading anything Webpack specific.
2024-04-11 13:40:18 -04:00
Charles Lyding
75a01d6296 refactor(@angular-devkit/build-angular): directly resolve asset files in application builder
Instead of previously attempting to reuse the Webpack-based copy assets helper function,
the application builder will now only resolve all potential configured assets. This
avoids depending on non-obvious parameter behavior to prevent the actual copying of
the asset files.
2024-04-11 07:44:11 -04:00
Alan Agius
2acf95a949 fix(@angular-devkit/build-angular): do not generate an index.html file in the browser directory when using SSR.
BREAKING CHANGE: By default, the index.html file is no longer emitted in the browser directory when using the application builder with SSR. Instead, an index.csr.html file is emitted. This change is implemented because in many cases server and cloud providers incorrectly treat the index.html file as a statically generated page. If you still require the old behavior, you can use the `index` option to specify the `output` file name.

```json
"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
      "outputPath": "dist/my-app",
      "index": {
        "input": "src/index.html",
        "output": "index.html"
      }
    }
  }
}
```
2024-04-10 17:00:50 +02:00
Alan Agius
733fba2e29 build: update dependency http-proxy-middleware to v3 2024-04-10 15:58:17 +02:00
Angular Robot
aea9ea6a98 build: update all non-major dependencies 2024-04-10 10:52:06 +02:00
Alan Agius
203c0eeb35 build: update all non-major dependencies 2024-04-08 10:10:09 -04:00
Alan Agius
afa76bb361 fix(@angular-devkit/build-angular): ensure esbuild-based builders exclusively produce ESM output
Previously, there were instances where the ESbuilder might incorrectly generate CJS code, leading to runtime errors.

Fixes #27421
2024-04-08 15:56:29 +02:00
Angular Robot
84e4a81b48 build: update dependency css-loader to v7 2024-04-06 15:47:24 +02:00
Angular Robot
c0e68e86d4 build: update all non-major dependencies 2024-04-03 13:31:18 -07:00
Angular Robot
fe19259aac build: update all non-major dependencies 2024-04-02 15:26:58 -07:00
Alan Agius
a673baf5ce Revert "fix(@schematics/angular): rename SSR port env variable"
This reverts commit 950a44521fdfb82000f6564ccc4c87d4a2b94680.
2024-04-02 11:51:45 -07:00
Angular Robot
3860fb3e42 build: update all non-major dependencies
(cherry picked from commit 7da0965ce3856cfc99158db8510ae339d3dc8fad)
2024-04-02 10:07:07 -07:00
Charles Lyding
83b943a74b refactor(@angular-devkit/build-angular): use single search directory list for postcss/tailwind configuration setup
Both the postcss and tailwind configuration file searching during the `application` builder setup look
in the project and workspace root for one of the related configuration files. To avoid unneeded
repeat file access, both searches now reuse directory contents information.
2024-04-02 09:17:34 -07:00
Charles Lyding
b87b843a1e refactor(@angular-devkit/build-angular): remove unneeded package version from inline font cache key
Since the calculated cache path already contains the `@angular-devkit/build-angular` package version,
the version is not needed within the cache key for each font URL. This removes the need to import the
loaded version from the `package.json` in the font inline logic.
2024-03-28 13:17:11 -07:00
Charles Lyding
e308008df0 refactor(@angular-devkit/build-angular): use build version stamping for build cache path creation
The build process will automatically perform package version placeholder replacement within
source files. This allows for the package version to be injected into the build cache path
creation process as a constant. As the version is now a constant, there is no need to
attempt runtime loading of the package metadata to retrieve the package version.
2024-03-28 13:16:12 -07:00
Kristiyan Kostadinov
8442216005 build: narrow down supported TypeScript versions
In https://github.com/angular/angular/pull/54961 the Angular compiler stopped supporting TypeScript versions older than 5.4. These changes narrow down the range for Tooling.
2024-03-27 12:48:24 +01:00
Charles Lyding
b454690622 refactor(@angular-devkit/build-angular): update babel application preset with new plugin import location
The babel application preset that is used with the Webpack-based build system now also uses the
updated location for the build optimizer plugins. This also reduces the amount of require statements
in the setup function for the preset.
2024-03-26 12:14:21 -04:00
Alan Agius
6530aa11be feat(@schematics/angular): replace assets with public directory
The `assets` directory is confusing for the users and commonly users place "assets" which are not meant to be copied but instead processed by the build system. This causes some files both bundled and copied.

With this change we rename the `assets` directory to `public` and also move the `favicon.ico` inside this newly created directory.
2024-03-25 17:10:29 +01:00
Alan Agius
e22d6771da fix(@angular-devkit/build-angular): ensure proper resolution of linked SCSS files
This commit addresses a bug where SCSS files within linked directories were not being resolved correctly by the Angular CLI. By implementing the necessary adjustments, linked SCSS files are now properly resolved.

Closes #27353
2024-03-25 13:36:15 +01:00
Alan Agius
c71e954a25 fix(@angular-devkit/build-angular): service-worker references non-existent named index output
This commit addresses an issue where the service worker incorrectly referenced a non-existent `index.html` when utilizing the output index option. Additionally, it ensures proper resolution of the service worker configuration when the option value is set to `true`.
2024-03-25 13:34:50 +01:00
Angular Robot
c27440e607 build: update all non-major dependencies 2024-03-25 10:38:53 +01:00
Charles Lyding
2fc8076a4b refactor(@angular-devkit/build-angular): directly configure internal babel plugins for application builder
The linker and build optimizer related babel plugins are now directly imported when needed
within the JavaScript transformer worker code. This lowers the number of transitive
modules that must be loaded for each worker instance. It also removes the use of `require`
from the initialization code which provides support for full ESM output in the future.
2024-03-22 15:21:33 -04:00
Paweł Kubiak
950a44521f fix(@schematics/angular): rename SSR port env variable
Rename the SSR port env variable to SSR_PORT.
It could help to resolve this firebase issue: https://github.com/firebase/firebase-tools/issues/6651#issuecomment-1881647322, cause PORT is reserved environment variable: https://firebase.google.com/docs/functions/config-env?gen=2nd#reserved-names.
2024-03-22 13:23:31 -04:00
Angular Robot
55d38e29a6 build: update all non-major dependencies 2024-03-21 11:35:22 -04:00
Alan Agius
ee9ec2301f fix(@angular-devkit/build-angular): Internal server error: Invalid URL when using a non localhost IP
When using a non-localhost IP, Vite will correctly populate the `network` property of the `server.resolvedUrls` instead of `local`.

Example:
```
ng server --host=127.0.0.2
{ local: [], network: [ 'http://127.0.0.2:4200/' ] }
```

Closes #27327
2024-03-21 10:30:42 -04:00
Alan Agius
d1367a021d refactor(@angular-devkit/build-angular): update vite client code update script
In the latest version of vite the script changed.
2024-03-21 09:30:08 -04:00
Alan Agius
0b8f53bc5f build: update all non-major dependencies 2024-03-21 09:30:08 -04:00
Alan Agius
8a54875cbb fix(@angular-devkit/build-angular): handle wrapping of class expressions emitted by esbuild
This update modifies the 'adjust-static-class-members' Babel plugin to accommodate the wrapping of class expressions produced by esbuild. This adjustment becomes necessary as ng-packagr currently utilizes esbuild for bundling FESM.
2024-03-20 14:51:36 +01:00
Alan Agius
6d0ebdb018 fix(@angular-devkit/build-angular): only generate server directory when SSR is enabled
Previously, the `server` directory was erroneously generated even in instances where SSG was enabled but SSR remained inactive.
2024-03-19 10:09:01 -04:00