4453 Commits

Author SHA1 Message Date
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
Kristiyan Kostadinov
a3bbe0e585 refactor(@angular-devkit/core): fix up internal typings
Resolves some type errors that showed up internally.
2024-09-18 11:16:11 -07:00
Angular Robot
93542bfc6d build: update dependency @inquirer/prompts to v6 2024-09-16 08:19:49 +02:00
Angular Robot
c9324e7ee8 build: update all non-major dependencies 2024-09-16 08:19:09 +02:00
Angular Robot
ac71ce121e build: update dependency chokidar to v4 2024-09-13 07:48:51 +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
Jan Martin
78f76485fe feat(@angular-devkit/architect): merge object options from CLI
We recently introduced the ability to pass object values from the
command line (#28362). @clydin noticed that the initial behavior
didn't work well for `--define`: It completely replaced all values
even if just one of multiple defines is specified.

This updates the architect to support merging of object options.
If both the base option (e.g. from `angular.json`) and the override
(e.g. from a CLI `--flag`) are objects, the objects are merged.

See: https://github.com/angular/angular-cli/pull/28362
2024-09-12 09:50:05 +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
Kristiyan Kostadinov
8f051a49e6 build: update all remaining places to TypeScript 5.6
Updates a few leftover places to the TypeScript 5.6 final version.
2024-09-10 09:25:11 +02:00
Angular Robot
27c1c77896 build: update all non-major dependencies 2024-09-09 19:36:13 +02:00
Angular Robot
eb97c4354f build: update schematics dependencies to ~5.3.0 2024-09-09 16:44:12 +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
Alan Agius
0d8a1006d4 refactor(@angular-devkit/core): remove deprecated fileBuffer function in favor of stringToFileBuffer
BREAKING CHANGE: The deprecated `fileBuffer` function is no longer available. Update your code to use `stringToFileBuffer` instead to maintain compatibility.

**Note:** that this change does not affect application developers.
2024-08-21 14:26:00 +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
Alan Agius
474571f087 build: remove Bazel typings workaround
The workaround is no longer necessary since the bug has been resolved upstream.
2024-08-14 19:12:27 +02:00
Angular Robot
91b561d652 build: update dependency watchpack to v2.4.2 2024-08-14 17:04:47 +02:00
Alan Agius
e9b057b39d refactor(@angular/build): remove route extractor and use version from @angular/ssr
Removed the route extractor from `@angular/build` and replaced it with the one from `@angular/ssr` for consistency and improved maintenance.
2024-08-14 16:42:24 +02:00
sidhanshamil
37693c40e3 feat(@angular-devkit/schematics-cli): add package manager option to blank schematic 2024-08-13 09:29:55 -04:00
Charles Lyding
7af63b4aba refactor(@angular-devkit/build-angular): reduce custom code in browser-esbuild implementation
The implementation of the `browser-esbuild` builder is now a small wrapper around the
`application` builder. The custom file writing code is no longer required with the availability
of the additional output path options for `application` builder. This also allows the internal
`browser-esbuild` programmatic interface to retain its architect-based signature.
2024-08-13 07:54:24 -04:00
Angular Robot
8d650d308e build: update all non-major dependencies 2024-08-13 11:36:04 +02:00
Angular Robot
289ea4cad2 build: update all non-major dependencies 2024-08-12 13:53:07 -04:00
Alan Agius
73c2437965 fix(@angular-devkit/schematics-cli): prevent bypassing select/checkbox prompts on validation failure
Previously, when a select or checkbox prompt failed validation, it was bypassed, preventing users from correcting their input. This commit ensures that when validation fails, the prompts are re-displayed, allowing users to make the necessary corrections. This improves the user experience and helps avoid unintended selections.

Closes #28189
2024-08-12 15:42:17 +02:00