3519 Commits

Author SHA1 Message Date
Alan Agius
759ae92aaa fix(@angular-devkit/build-angular): update peer dependencies to support version 16
This commit fixes the peer deps to support version 16.
2023-02-23 10:26:07 +00:00
Angular Robot
b564b9afb8 build: update all non-major dependencies 2023-02-22 13:06:18 +00:00
Alan Agius
0ad81cdbc7 refactor(@angular-devkit/core): remove deprecated exceptions
With commits removes the several deprecated exceptions.

BREAKING CHANGE:

- `ContentHasMutatedException`, `InvalidUpdateRecordException`, `UnimplementedException` and `MergeConflictException` API from `@angular-devkit/core` have been removed in favor of the API from `@angular-devkit/schematics`.
- `UnsupportedPlatformException` - A custom error exception should be created instead.
2023-02-21 16:56:43 +00:00
Charles Lyding
4c53c8f274 test(@angular-devkit/build-angular): additional unit tests for esbuild builder
The following unit tests have been ported over to test the experimental esbuild-based
browser application builder:
* `baseHref` option
* `crossOrigin` option
* TypeScript path mapping behavior
2023-02-21 10:02:52 +00:00
Angular Robot
54cc8d4e7d build: update all non-major dependencies 2023-02-21 10:01:33 +00:00
Alan Agius
d58428d3db feat(@angular/cli): remove deprecated defaultProject from workspace configuration
The deprecated 'defaultProject' workspace option has been removed

BREAKING CHANGE: The deprecated `defaultProject` workspace option has been removed. The project to use will be determined from the current working directory.
2023-02-17 16:10:21 +00:00
Angular Robot
15fdb2a20c build: update all non-major dependencies 2023-02-17 15:11:36 +00:00
Charles Lyding
2435b46560 fix(@angular-devkit/build-angular): allow empty scripts to be optimized
When using the internal JavaScript optimizer plugin for Webpack with an
empty script file provided via the `scripts` option, the build would fail.
This was because of a safety check that was checking whether the terser
result was falsy. Since an empty string is considered falsy, the build
considered the result to be an error. The safety check now will only trigger
if the terser result is not a string value to avoid this case.
2023-02-16 19:11:34 +00:00
Alan Agius
8095268fa4 build: update to rxjs 7
G3 is now using RXJS version 7 which makes it possible for the CLI to also be updated to RXJS 7.

NB: this change does not remove all usages of the deprecated APIs.

Closes #24371
2023-02-16 14:59:40 +00:00
Lukas Spirig
d2ef386f46 refactor(@angular-devkit/schematics): remove UpdateBuffer and rename UpdateBuffer2 to UpdateBuffer
This PR removes the internally built `UpdateBuffer` and renames
`UpdateBuffer2` (based on magic-string) to `UpdateBuffer`. This
should have little to no impact for consumers.

BREAKING CHANGE:
The depracated `UpdateBuffer` has been removed and `UpdateBuffer2`
is renamed to `UpdateBuffer`. With this change the related and
deprecated symbols `ContentCannotBeRemovedException` and `Chunk`
have also been removed.
2023-02-15 21:04:06 +00:00
Alan Agius
f6624b974f feat(@angular-devkit/core): update SchemaRegistry compile to return Promise
Use promise based methods to reduce RXJS usage and boiler-platting.

BREAKING CHANGE: Several changes to the `SchemaRegistry`.
- `compile` method now returns a `Promise`.
- Deprecated `flatten` has been removed without replacement.
2023-02-15 21:03:30 +00:00
Angular Robot
70fcd37b58 build: update all non-major dependencies 2023-02-15 15:28:49 +00:00
Alan Agius
d9fed6a517 build: update parse5-html-rewriting-stream to version 7
This fixes an issue were the HTML is truncated if it's 128Kb or greater.

Closes #24707
2023-02-14 15:23:09 +00:00
Charles Lyding
f91696063c test(@angular-devkit/build-angular): port additional unit tests to esbuild builder
The following unit tests have been ported over to test the experimental esbuild-based
browser application builder:
* `extractLicenses` option
* `main` option
* `optimization.styles.inlineCritical` option
* `styles` option
* `subresourceIntegrity` option

Several individual tests involving file output logging have been temporarily disabled
until build and file output logging has been implemented for the builder.
2023-02-14 15:05:11 +00:00
Alan Agius
1e52863262 perf(@angular-devkit/build-angular): reduce rebuilt times when using the scripts option
In some cases, using the `scripts` option caused a lot of `DescriptionFileUtils.loadDescriptionFile` calls which caused a bottleneck during build times.

The why to this is still unknown, but a workaround is to use the resolver from the Webpack compilation instead of the compiler.

Closes #24634
2023-02-14 14:59:37 +00:00
Angular Robot
d439cb9727 build: update all non-major dependencies 2023-02-13 14:16:12 +00:00
Charles Lyding
421417a36b fix(@angular-devkit/build-angular): avoid CommonJS warning for zone.js in esbuild
The `zone.js` package is currently built into a module structure form that resembles
UMD-like output. This causes the CommonJS checker within the experimental esbuild-based
browser application builder to issue a warning for `zone.js` usage. Until the packaging
of `zone.js` is updated to become fully ESM, the `zone.js` package is automatically allowed
when performing the CommonJS module check.
2023-02-13 14:14:41 +00:00
Angular Robot
2a42f24ced build: update all non-major dependencies to v0.17.7 2023-02-10 20:39:11 +00:00
Alan Agius
d3f255087f fix(@angular-devkit/build-angular): correctly copy safety-worker.js contents
Previously, `safety-worker.js` and `worker-basic.min.js` contained incorrect data due to an incorrect path.

Closes #24678
2023-02-10 20:18:17 +00:00
Charles Lyding
8356240dda fix(@angular-devkit/build-angular): use babel default export helper in build optimizer
Within the build optimizer's static member optimization pass, a class that is directly
default exported must be split into two statements: the class declaration and the
default export. This is because the pass can wrap classes in a pure annotated IIFE which
results in a variable declaration replacement and variable declarations can not be directly
default exported. Previously, the pass did this splitting manually but this was causing
later babel plugins to fail. In addition to updating the AST in this case, scoping information
also needed to be updated. To support this, a babel helper package is now used that handles
the details of the statement split operation.
2023-02-10 20:16:20 +00:00
Alan Agius
c65b026e2f fix(@angular-devkit/build-angular): update the ECMA output warning message to be more actionable
Update the `TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022"` warning message to be more actionable.

Closes: #24697
2023-02-10 20:13:35 +00:00
Angular Robot
4c69b27816 build: update all non-major dependencies 2023-02-08 19:11:07 +00:00
Charles Lyding
a658464f71 test(@angular-devkit/build-angular): enable inlineStyleLanguage unit tests for esbuild
With the additional of JIT mode and initial Less stylesheet support, the unit tests for the
`inlineStyleLanguage` build option can now be enabled for the experimental esbuild-based
browser application builder.
2023-02-08 19:10:30 +00:00
Charles Lyding
01b3bcf898 feat(@angular-devkit/build-angular): add Less stylesheet support to experimental esbuild-based builder
When using the experimental esbuild-based browser application builder, stylesheets written in the Less
stylesheet language can now be used throughout an application. The support allows Less stylesheets to
be used in all locations where CSS and/or Sass can be used. This includes global stylesheets and both
inline and external component styles. When using inline component styles, the `inlineLanguageStyle`
build option must be set to `less`.
Currently, import resolution within a Less stylesheet is limited to default Less behavior which does not
include full node package resolution. Full resolution behavior will be added in a future change.
2023-02-08 19:10:30 +00:00
Angular Robot
56423f0a37 build: update all non-major dependencies 2023-02-07 19:30:22 +00:00
Charles Lyding
bfc0facedd fix(@angular-devkit/build-angular): build optimizer support for spec-compliant downlevel class properties
The build optimizer's static class field pass will now additionally wrap
classes that contain side effect free class properties. This allows optimizers and
bundlers further along in the build pipeline to downlevel that class properties while
still retaining the ability to tree-shake the class if unused. The class properties
may need to be downleveled for a variety of reasons such as lack of browser support,
browser bugs with certain code structures, or to ensure spec-compliant runtime behavior.
2023-02-07 19:29:43 +00:00
Charles Lyding
6cc7459289 test(@angular-devkit/build-angular): port several unit tests to esbuild builder
The following unit tests have been ported over to test the experimental esbuild-based
browser application builder:

* `assets` option
* `outputHashing` option
* browser support behavior (`browserslist`)

Several small modifications were necessary to accommodate output file differences such
as no runtime chunk. Additionally, two tests are temporarily disabled for the `outputHashing`
tests pending implementation in the builder. These tests are the same stylesheet resource handling
file name test and no hashing of non-injected styles test.
2023-02-07 19:29:25 +00:00
Charles Lyding
64d8c473be test(@angular-devkit/build-angular): reduce harness usage of deprecated TestProjectHost
The Builder test harness previously used the deprecated `TestProjectHost` to perform a
variety of file operations during builder unit tests. However, the `TestProjectHost` is
deprecated and uses several layers of rxjs to perform the file operations. The test harness
now uses the Node.js `fs` builtin to directly perform the file operations. This removes several
layers of indirection between the harness and the actual underlying file operations. The removal
of the rxjs operation chaining also reduces stack traces and makes debugging test issues less
complicated.
2023-02-07 19:29:25 +00:00
Alan Agius
d9c697b2bc fix(@angular-devkit/build-angular): do not fail compilation when spec pattern does not match
Previously, we failed the compilation when the specified patterns did not match any spec file. This breaks the case were users configure Karma to not fail on empty test suit.

Closes #24644
2023-02-07 01:01:07 +00:00
Alan Agius
bf3be56db8 fix(@angular-devkit/build-angular): load polyfills and runtime as scripts instead of modules
This commit updates changes the way polyfills and runtime are loaded from modules to scripts. This is required as otherwise Jasmine will be loaded prior to Zone.js which causes clock patching not to work.

Closes #24651
2023-02-03 14:29:13 +00:00
Charles Lyding
8cf0d17fb1 feat(@angular-devkit/build-angular): support JIT compilation with esbuild
When using the experimental esbuild-based browser application builder, the `aot` build option
can now be set to `false` to enable JIT compilation mode. The JIT mode compilation operates
in a similar fashion to the Webpack-based builder in JIT mode. All external Component stylesheet
and template references are converted to static import statements and then the content is bundled
as text. All inline styles are also processed in this way as well to support inline style languages
such as Sass. This approach also has the advantage of minimizing the processing necessary during rebuilds.
In JIT watch mode, TypeScript code does not need to be reprocessed if only an external stylesheet
or template is changed.
2023-02-03 10:41:27 +00:00
Jason Bedard
fac1e58b73
run e2e tests under bazel (#24338)
* test: run legacy-cli e2e tests via bazel

* fixup! test: run legacy-cli e2e tests via bazel

* fixup! test: run legacy-cli e2e tests via bazel

* fixup! test: run legacy-cli e2e tests via bazel
2023-02-03 07:52:28 +00:00
Angular Robot
a4102d96c9 build: update all non-major dependencies 2023-02-02 08:23:29 +00:00
Ricardo
df7c7f430c fix(@angular-devkit/build-angular): fix support of Safari TP versions
Fix issue-related to the support of Safari TP versions. This issue was accidentally introduced in angular/angular-cli@a0f9db8

Fixes #24639
2023-02-02 08:23:00 +00:00
Angular Robot
7922bec35e build: update all non-major dependencies 2023-01-30 14:59:06 +00:00
Alan Agius
3512a03621 fix(@angular-devkit/build-angular): load JavaScript bundles as modules in karma
With this change we load bundles as modules when using the Karma builder.
2023-01-27 21:43:37 +00:00
Alan Agius
f35e9908c0 fix(@angular-devkit/build-angular): print server builder errors and warnings
Previously server builder errors and warnings were not being printed in the console correctly.

Closes #24612
2023-01-26 14:37:38 +00:00
Angular Robot
4164a09b28 build: update all non-major dependencies 2023-01-25 14:52:53 +00:00
Marvin
ecf43090d1
feat(@angular-devkit/schematics-cli): auto detect package manager (#24305)
* feat(@angular-devkit/schematics-cli): auto detect package manager

* refactor(@angular-devkit/schematics-cli): code formatting

* refactor(@angular-devkit/schematics-cli): linting
2023-01-25 14:50:07 +00:00
Alan Agius
97907addfc fix(@angular-devkit/build-angular): update browserslist config to include last 2 Chrome versions
https://github.com/angular/angular/pull/48669 added support for the last 2 Chrome versions
2023-01-20 18:37:22 +00:00
Angular Robot
a9aa004db6 build: update all non-major dependencies 2023-01-19 22:14:08 +00:00
Alan Agius
f6f5d79199 fix(@angular-devkit/core): handle number like strings in workspace writer
The workspace writer previously transformed number like strings to numbers which causes failures when a project is named using a number like name.

Closes #24541
2023-01-19 22:13:34 +00:00
Charles Lyding
d19f260baa fix(@angular-devkit/build-angular): avoid undefined module path for Sass imports in esbuild
When using Sass with the experimental esbuild-based browser application builder, bare imports
without a path segment that were available via included paths but also happen to be a node module
could cause an exception. An example of such an import would be `@import "globals";`. The deep
import node module logic would previously attempt to join an undefined path segment to the resolved
path for the `globals` package which would raise a argument type exception. This case has now been
fixed by only joining if there is actually a path segment present such as `@import "globals/x"`.
With this fix in place, the node module case can then continue and if no stylesheet is found, the
include paths will then be searched.
2023-01-19 22:13:01 +00:00
Charles Lyding
7b9d99cb37 refactor(@angular-devkit/build-angular): use esbuild 0.17 incremental API in esbuild builder
Due to the update of the experimental esbuild-based browser application builder to use esbuild 0.17,
the watch mode has been changed to use the new incremental API. The previous API has been removed
from esbuild. The new API involves creating a build context object that can then be used to perform
rebuilds of the configured application bundler as needed. All watch mode usage has been updated to
use this new approach. An effort was made to minimize the amount of changes made to support this API
update and limit the changeset. However, further refactoring will be possible as additional capabilities
are added in the future.
esbuild API reference: https://esbuild.github.io/api/#rebuild
2023-01-18 17:13:09 +00:00
Charles Lyding
c3447e3640 fix(@angular-devkit/build-angular): prevent hanging initial build during exception with esbuild
When using the experimental esbuild-based browser application builder and an exception is thrown
during the initial build, the process may hang indefinitely due to the Sass worker pool not
shutting down fully. This does not happen for rebuilds after the initial.  To remedy this
situation, The initial build is now wrapped in a try block to ensure that a full shutdown
of the Sass worker pool occurs.
2023-01-17 17:30:10 +00:00
Charles Lyding
bbc1a4f0dc feat(@angular-devkit/build-angular): support CommonJS dependency checking in esbuild
When using the experimental esbuild-based browser application builder, input files
for the build will now be checked to determine if they are non-ESM modules. This
behavior is comparable to the existing behavior within the default Webpack-based browser.
Warnings will now be issued for any non-ESM modules (for example, CommonJS or UMD) when
script optimizations are enabled (typically production builds). ESM files can be tree-
shaken and otherwise optimized in ways that CommonJS files cannot which allows for
more optimized and smaller output bundle files.
If any allowed dependencies are provided via the `allowedCommonJsDependencies`
option, both the direct import and any deep imports of the dependency will be ignored
during the checks and no diagnostic will be generated for the dependency.
2023-01-13 12:48:08 +00:00
Charles Lyding
d05eb00161 refactor(@angular-devkit/build-angular): remove direct import of i18n worker code
The i18n inlining worker code was previously imported in several locations to allow
reuse of the options object used to configure the worker. To prevent the worker
code from being used outside of an actual worker, the options object definition is
now located in a separate file and imported in both the worker and any other files
that need to use the inlining options.
2023-01-13 08:29:12 +00:00
Alan Agius
871e687ac4 build: update eslint-plugin-import to 2.27.4 2023-01-12 12:25:12 +00:00
Alan Agius
b68467f8d0 fix(@angular-devkit/build-angular): update esbuild to 0.16.17
This release contains a fix for `SyntaxError: Unexpected token: punc (()`

Closes #24526
2023-01-12 12:24:28 +00:00
Alan Agius
ef39987e59 build: update Angular peer deps to support ^15.2.0-next.0 2023-01-12 12:24:11 +00:00