This commit revises the app-shell and ssr schematics to incorporate the new Server Rendering API, along with the integration of server-side routes.
BREAKING CHANGE: The app-shell schematic is no longer compatible with Webpack-based builders.
This introduces support for `--watch` when using the application
builder. It's tested as far as the relevant test case is concerned.
But I wouldn't be surprised if there's still some rough corners.
Previously, the testing module was split into its own entrypoint but
then never loaded. Now it's just left in the overall polyfill bundle.
The bug wasn't caught by the existing test coverage, so this adds a
new test that ensures that fakeAsync works.
Cleaning up the Karma `files` list also removes the noisy "no file
matched the pattern worker-*.js" warnings that were previously generated
for test suites that don't include web worker sources.
Adds a new "builderMode" setting for Karma that can be used to switch
between webpack ("browser") and esbuild ("application"). It supports a
third value "detect" that will use the same bundler that's also used for
development builds.
The detect mode is modelled after the logic used for the dev-server builder.
This initial implementation doesn't properly support `--watch` mode or code
coverage.
In some environments, e.g. containers or in some cases macOS,
headless Chrome may not work with the sandbox enabled. This exposes
an escape hatch to run tests in those environments.
Example use:
```sh
yarn bazel test \
//packages/angular_devkit/build_angular:build_angular_karma_test \
--test_env=PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--test_env=CHROME_NO_SANDBOX=1
```
Runs all existing karma tests twice: Once in an environment that uses the
application builder and once in one that uses the browser builder. The
general approach is taken from the dev server tests.
This is in preparation for supporting the application builder for karma tests.
I often struggle with spacing around block comments, so I've decided to add the `lines-around-comment` lint rule to help manage this.
For more details, see the https://eslint.style/rules/js/lines-around-comment
Refactored the `CommonEngine` API import path to remove Node.js dependencies from the `@angular/ssr` main entry-point.
BREAKING CHANGE:
The `CommonEngine` API now needs to be imported from `@angular/ssr/node`.
**Before**
```ts
import { CommonEngine } from '@angular/ssr';
```
**After**
```ts
import { CommonEngine } from '@angular/ssr/node';
```
The `@angular/compiler-cli/private/tooling` package export is now used instead
of the main package export to allow cleanup of the compiler-cli package. This
secondary export has existed for several major versions.
The `browserTarget` option has been removed as part of the refactoring process. This option was part of a private API and is no longer used. Projects relying on this option should migrate to using the `buildTarget` option.
BREAKING CHANGE: The `browserTarget` option has been removed from the DevServer and ExtractI18n builders. `buildTarget` is to be used instead.
These server tests frequently fail due to timeouts. Despite efforts, the root cause has not yet been identified, so they are being marked as flaky to prevent blocking the pipeline while further investigation continues.
The `resourcesOutputPath` option from the browser builder is supported as of 18.2.
The unsupported warning is now removed. The warning logic has also been consolidated
now that there are only several warnings left.
If an application has JavaScript files that are sourced directly from disk,
the extraction would previously fail due to the i18n extractor only able
to access the in-memory generated JavaScript files. The extractor can now
access both memory and disk-based JavaScript files.