3634 Commits

Author SHA1 Message Date
Alan Agius
b0aa88f427 refactor(@angular-devkit/build-angular): remove unused dependencies
These dependencies are no longer utilized within the `@angular-devkit/build-angular` package.
2024-10-11 13:17:37 +02:00
Angular Robot
7b994e49ea build: update all non-major dependencies 2024-10-11 10:03:29 +02:00
Angular Robot
73b567a5f6 build: update all non-major dependencies 2024-10-10 10:21:38 -07:00
Alan Agius
292a4b7c2f feat(@schematics/angular): update app-shell and ssr schematics to adopt new Server Rendering API
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.
2024-10-09 18:07:33 +02:00
Angular Robot
2a1107d998 build: update all non-major dependencies 2024-10-09 11:28:56 +02:00
Angular Robot
4656c541d2 build: update all non-major dependencies 2024-10-08 10:10:55 -07:00
Jan Martin
ab6e19e1f9 fix(@angular-devkit/build-angular): handle main field 2024-10-07 09:43:57 -07:00
Alan Agius
4941725f9e refactor: remove unused methods and locals 2024-10-04 13:16:13 +02:00
Angular Robot
523c2c9e52 build: update all non-major dependencies 2024-10-03 09:21:55 +02:00
Charles Lyding
909cfacf8a refactor(@angular-devkit/build-angular): avoid for await...of with promise arrays
The upcoming version of typescript Eslint rules will fail the `await-thenable`
rule for cases of for await...of that use promise arrays. This change
removes the usage to avoid lint failures during the version update.
Ref: https://typescript-eslint.io/rules/await-thenable/#async-iteration-for-awaitof-loops
2024-10-02 16:06:35 -04:00
Jan Martin
dcbdca85c7 feat(@angular-devkit/build-angular): karma+esbuild+watch
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.
2024-09-30 14:43:25 -07:00
Angular Robot
a896b74ac1 build: update all non-major dependencies 2024-09-30 09:53:17 +02:00
Jan Martin
9d7613db9b fix(@angular-devkit/build-angular): zone.js/testing + karma + esbuild
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.
2024-09-27 15:29:14 -07:00
Jan Martin
0a4ef30263 feat(@angular-devkit/build-angular): karma-coverage w/ app builder 2024-09-27 12:06:52 -07:00
Alan Agius
422e847a39 build: update all non-major dependencies 2024-09-27 14:49:44 -04:00
Jan Martin
8f038de751 refactor(@angular-devkit/build-angular): remove implicit localize polyfill
In the v19 application builder, the localize polyfill should not be added
implicitly.

See: d6a34034d7
2024-09-26 13:30:24 -07:00
Jan Martin
54594b5abf feat(@angular-devkit/build-angular): support karma with esbuild
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.
2024-09-26 09:35:18 -07:00
Jan Martin
25c4584210 test(@angular-devkit/build-angular): mark server tests as large
These tests appear to be timing out after 300s somewhat often.
2024-09-26 09:35:18 -07:00
Jan Martin
3020571b68 test: allow Chrome sandbox opt-out (--no-sandbox)
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
```
2024-09-26 09:35:18 -07:00
Jan Martin
66c55df468 test(@angular-devkit/build-angular): add application/browser test runs
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.
2024-09-25 09:16:53 -07:00
Angular Robot
df46657df7 build: update all non-major dependencies 2024-09-25 09:13:04 -04:00
Angular Robot
1434d621f9 build: update all non-major dependencies 2024-09-23 08:57:37 -04:00
Angular Robot
b65ef44cbe build: update all non-major dependencies 2024-09-20 15:05:14 -07:00
Angular Robot
bd782dbe36 build: update all non-major dependencies 2024-09-18 11:16:50 -07:00
Angular Robot
c9324e7ee8 build: update all non-major dependencies 2024-09-16 08:19:09 +02:00
Alan Agius
d66aaa3ca4 feat(@angular/ssr): add server routing configuration API
This commit introduces a new server routing configuration API, as discussed in RFC https://github.com/angular/angular/discussions/56785. The new API provides several enhancements:

```ts
const serverRoutes: ServerRoute[] = [
  {
    path: '/error',
    renderMode: RenderMode.Server,
    status: 404,
    headers: {
      'Cache-Control': 'no-cache'
    }
  }
];
```

```ts
const serverRoutes: ServerRoute[] = [
  {
    path: '/product/:id',
    renderMode: RenderMode.Prerender,
    async getPrerenderPaths() {
      const dataService = inject(ProductService);
      const ids = await dataService.getIds(); // Assuming this returns ['1', '2', '3']
      return ids.map(id => ({ id })); // Generates paths like: [{ id: '1' }, { id: '2' }, { id: '3' }]
    }
  }
];
```

```ts
const serverRoutes: ServerRoute[] = [
  {
    path: '/product/:id',
    renderMode: RenderMode.Prerender,
    fallback: PrerenderFallback.Server, // Can be Server, Client, or None
    async getPrerenderPaths() {
    }
  }
];
```

```ts
const serverRoutes: ServerRoute[] = [
  {
    path: '/product/:id',
    renderMode: RenderMode.Server,
  },
  {
    path: '/error',
    renderMode: RenderMode.Client,
  },
  {
    path: '/**',
    renderMode: RenderMode.Prerender,
  },
];
```

These additions aim to provide greater flexibility and control over server-side rendering configurations and prerendering behaviors.
2024-09-12 19:59:05 +02:00
Angular Robot
5bba61db24 build: update all non-major dependencies 2024-09-12 12:07:56 +02:00
Alan Agius
743188ba62 refactor: Add lines-around-comment rule
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
2024-09-11 12:10:54 +02:00
Angular Robot
27c1c77896 build: update all non-major dependencies 2024-09-09 19:36:13 +02:00
Angular Robot
e70aa6b5a6 build: update all non-major dependencies 2024-09-04 13:35:39 -04:00
Angular Robot
83918eee6c build: update all non-major dependencies 2024-09-03 07:44:10 -04:00
Angular Robot
e40c09fb93 build: update all non-major dependencies 2024-08-30 09:46:16 -07:00
Doug Parker
3ee21631f4 fix(@angular-devkit/build-angular): clear context in Karma by default for single run executions
This works around https://github.com/angular/angular-cli/issues/28271.
2024-08-29 12:00:31 -07:00
Kristiyan Kostadinov
7f570c5685 build: update to TypeScript 5.6 RC
Updates the repo to the TypeScript 5.6 RC and narrows down the version to drop support for 5.4, in line with the compiler.
2024-08-29 10:40:28 +02:00
Alan Agius
4b09887a9c feat(@angular/ssr): move CommonEngine API to /node entry-point
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';
```
2024-08-27 08:57:37 +02:00
Alan Agius
1ac220d9bc Revert "build: mark server tests as flaky"
This reverts commit 60d24b24c5e5993bc93fd4646c76056ec0c15244.
2024-08-25 06:12:09 +02:00
Alan Agius
3fd7b68c38 test: disable buildOptimizer for server tests
Attempting to reduce flaky tests.
2024-08-25 06:12:09 +02:00
Angular Robot
617c2d9a33 build: update all non-major dependencies 2024-08-24 09:11:23 +02:00
Alan Agius
358f85e4d2 build: update dependency webpack to v5.94.0 2024-08-23 13:55:59 +02:00
Charles Lyding
276ce442a5 refactor(@angular-devkit/build-angular): use Angular compiler CLI private tooling export
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.
2024-08-22 17:48:04 +02:00
Angular Robot
1c30de2121 build: update all non-major dependencies 2024-08-22 13:05:22 +02:00
Alan Agius
e40384e637 refactor(@angular-devkit/build-angular): remove deprecated browserTarget
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.
2024-08-21 19:53:04 +02:00
Alan Agius
60d24b24c5 build: mark server tests as flaky
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.
2024-08-21 15:42:02 +02:00
Angular Robot
4df3cef1f5 build: update all non-major dependencies 2024-08-21 07:44:07 +02:00
Charles Lyding
0b161bc761 fix(@angular-devkit/build-angular): remove outdated browser-esbuild option warning
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.
2024-08-20 17:05:39 +02:00
Charles Lyding
6b544f70e7 fix(@angular/build): support reading on-disk files during i18n extraction
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.
2024-08-20 17:05:27 +02:00
Angular Robot
4d19d7c1ea build: update all non-major dependencies 2024-08-20 14:11:36 +02:00
Angular Robot
212034bab3 build: update all non-major dependencies 2024-08-19 13:24:50 +02:00
Alan Agius
71c06c69f6 fix(@angular/build): improve error message when an unhandled exception occurs during prerendering
This change enhances the error messaging when an unhandled exception occurs during the prerendering process. The updated error message provides more context and clarity.

**Previous Behavior**

```
ng b
An unhandled exception occurred: Some error!!!
See "/tmp/ng-S2ABKF/angular-errors.log" for further details.
```

**Updated Behavior:**
```
ng b
Browser bundles
Initial chunk files     | Names               |  Raw size | Estimated transfer size
main-AFPIPGGK.js        | main                | 218.00 kB |                59.48 kB
polyfills-Z2GOM3BN.js   | polyfills           |  35.82 kB |                11.80 kB
styles-5INURTSO.css     | styles              |   0 bytes |                 0 bytes

                        | Initial total       | 253.82 kB |                71.28 kB

Server bundles
Initial chunk files     | Names               |  Raw size
server.mjs              | server              |   1.11 MB |
chunk-HZL5H5M5.mjs      | -                   | 526.77 kB |
polyfills.server.mjs    | polyfills.server    | 269.91 kB |
chunk-GFWAPST7.mjs      | -                   |  19.16 kB |
chunk-5XUXGTUW.mjs      | -                   |   2.55 kB |
render-utils.server.mjs | render-utils.server |   1.46 kB |
main.server.mjs         | main.server         | 149 bytes |

Lazy chunk files        | Names               |  Raw size
chunk-7YC4RJ5P.mjs      | xhr2                |  12.08 kB |

Prerendered 1 static route.
Application bundle generation failed. [4.923 seconds]

✘ [ERROR] An error occurred while prerendering route '/'.

Error: Some error!!!
    at render (node_modules/@angular/build/src/utils/server-rendering/render-worker.js:20:20)
    at /angular-cli/abc/node_modules/piscina/dist/worker.js:146:32
```

Closes #28212
2024-08-15 15:52:31 +02:00
Charles Lyding
618fdea00b build: update Angular versions to 19.0.0-next.0 2024-08-14 16:15:35 -04:00