15963 Commits

Author SHA1 Message Date
Alan Agius
e4ff5c9d4a ci: sync package locks information for aspect with renovate
This is needed as otherwise the `npm_translate_lock` file will be out of sync
2024-12-16 18:35:21 +01:00
Joey Perrott
b1500d3e83 build: update npm_translate_lock and update to to typescript 5.7.2 2024-12-16 12:17:17 -05:00
Joey Perrott
04213c86de build: update rules_rs_dependencies to 5.7.2 2024-12-16 12:17:17 -05:00
Paul Gschwendtner
c701acb25d build: use worker for ts_project to enable fast DX and avoid no-sandbox issues
For the `rules_js` migration we are introducing a new ruleset for
Angular rules. These rules are not used here by the CLI as we don't use
`ng_module`, but we are building the rules in a way where we expose a
worker binary that can also work with vanilla TS.

The worker significantly speeds up compilations, bringing them to
equivalent speeds of `ts_library`, and **importantly** fixes/avoids
issues when actions are executing outside sandbox. E.g. on Windows where
the tsc compilation currently can see many other files that aren't
action inputs; and accidentally picks them up.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
ad450e3e86 build: add missing path mapping for build-webpack import causing lint error
I suspect there were some versioning changes with the e.g. `hoist =
false` setting in npmrc; so eslint now starts failing about an import
from `webpack-server.ts` resulting in unnecessary type cast lint errors.

The existing mapping didn't work due to the underscore conversion, so
this makes sense, and fixing the path mappings works.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
417ef7a1fb refactor: remove unnecessary type conversion failing lint
I suspect there were some versioning changes with the e.g. `hoist =
false` setting in npmrc; so eslint now starts failing about this
unnessary type cast. Seems reasonable so this is committed without
deep investigation.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
410040289a build: rename //:node_modules to root modules
In our dev-infra sync we decided that we want to have less
ambiguous naming for node modules from the workspace root vs. node
modules that are local to the package.

Consider the confusion between: `//:node_modules` and `:node_modules`.
This commit fixes this by naming the workspace `node_modules` as
`:root_modules`. This does not have an effect on runtime of NodeJS
output because `rules_js` continues to lay out the root modules as
`/node_modules` folder; as it should.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
6006f591e8 build: workaround aspect bazel lib tar.gz windows issue
Workaround until `rules_js` imports the latest version of
`aspect_bazel_lib`: https://github.com/bazel-contrib/bazel-lib/issues/968
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
8d54c090c4 ci: remove extraneous imports lint rule as it doesnt work in monorepo setup
- it seems to be disabled by default for actual production .ts files;
  but the rule is in "error" mode for spec files.
- The rule doesn't seem to properly support mono-repos when configured properly.
i.e. it only considers the top-level package.json — hence doesn't deal with cross-workspace deps.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
dcd81725c9 build: remove cpp toolchain as it's no longer needed in Bazel 6
https://bazel.build/concepts/platforms
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
3af88fef8b test: update chunk file name to reflect new name
It seems that the chunk deterministic name has changed after
recent node module /lock file changes. It's unclear what specifically is
involved in Webpack's chunk name generation, but the output and all
other tests still look good; which makes this is a rather safe update to
the new chunk name. Consulting with CLI team members explained that this
can happen quite often.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
a19a72d8fc build: migrate angular-devkit/architect to ts_project
This commit updates the architect devkit package code to use
`ts_project`. We specificially don't migrate the jasmine node test yet
as we want to experiment further with the incremental migration.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
620671dc18 build: update to more improved copy_to_bin rule.
This is necessary as the current rule is not clever enough to detect
when a given file is already "generated" and inside `bin`.

This is important because `package.json` files are always copied to bin
for `npm_package`, but the `package.json` may already be copied from
e.g. `ts_project#data`. This shouldn't cause a Bazel action conflict.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
369a5fa57a build: create ts_project interop allowing for incremental migration
This commit introduces a new interop Starlark macro/rule for using
`ts_project` throughout the repository without having to migrate
any dependant or dependencies; allowing for incremental migration
to `ts_project`.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
afc75ce5a4 build: setup rules_ts for compiling TypeScript sources
This commit sets up `rules_ts`, providing the `ts_library` equivalent
for the `rules_js` migration.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
f22d4ee8e4 build: setup rules_js and link dependencies
This also requires us to move patches from `patch:` protocol to
`patch-package` temporarily. This is because we need to temporarily use
pnpm and yarn berry in hybrid, and both don't have any overlap in how
patching works; and pnpm would fail if it sees the `patch` protocol.
2024-12-16 12:17:17 -05:00
Paul Gschwendtner
183f77201e build: update to bazel 6
This is necessary for an incremental migration to `rules_js` which
requires Bazel v6. Bazel v6 removed the managed directories feature,
which means we no longer can rely on symlinked node modules as the Bazel
repository; but rather need to duplicate dependencies. This is
okay/acceptable to enable the incremental migration.
2024-12-16 12:17:17 -05:00
Alan Agius
1bf9381c8c fix(@angular/ssr): correctly resolve pre-transform resources in Vite SSR without AppEngine
Ensure proper resolution of pre-transform resources when using SSR in Vite without relying on AppEngine.

Closes #29132
2024-12-16 15:02:58 +01:00
Alan Agius
78c41f67ec refactor(@angular/ssr): add timeout to prevent 'adev' hanging during route extraction
A timeout was added during route extraction to resolve an issue where 'adev' would hang in production builds.
The root cause is currently unclear, but this change ensures the build completes successfully.
2024-12-16 14:58:48 +01:00
Angular Robot
1d6d264960 build: update angular 2024-12-14 09:01:18 -08:00
Jan Krems
a9a3470147 fix(@angular-devkit/build-angular): jasmine.clock with app builder 2024-12-13 12:12:07 -08:00
Angular Robot
8d35b9bd38 build: update angular 2024-12-13 11:30:46 -08:00
Angular Robot
7069c3bac8 build: update dependency sass to v1.83.0 2024-12-13 11:22:39 -08:00
Angular Robot
5295d4dd24 build: update github/codeql-action action to v3.27.9 2024-12-13 11:22:19 -08:00
Aaron Shim
f6b8c5eabd test: e2e tests for autoCsp 2024-12-12 13:44:17 -08:00
Charles Lyding
c66782b19c refactor(@angular/build): only load chunk optimizer if enabled
The experimental chunk optimizer is now only imported if it is enabled
via its environment variable (`NG_BUILD_OPTIMIZE_CHUNKS=1`). This prevents
the loading of the rollup package as well as any transitive dependencies
when these packages will not be used by the build.
2024-12-12 10:15:15 -08:00
Jan Krems
7fda6b5d20 release: cut the v19.1.0-next.1 release 19.1.0-next.1 2024-12-12 10:08:52 -08:00
Charles Lyding
d5ea0f1530 docs: release notes for the v19.0.5 release 2024-12-12 12:35:12 -05:00
dai1ooleet0aesei
2b8a02bac0 feat(@angular-devkit/architect): require build schemas from modules 2024-12-12 08:18:56 -08:00
Angular Robot
615428b4d8 build: update angular 2024-12-12 08:18:04 -08:00
Charles Lyding
64f32c769f fix(@angular/build): provide component HMR update modules to dev-server SSR
When using component HMR and SSR with the development server, the component
update modules will now be available to the Vite server rendering.  This
prevents console errors due to missing component update paths. Additionally,
it allows the server rendering to use the latest component templates if those
have been changed before a new rebuild has occurred.
2024-12-11 15:04:57 -05:00
Alan Agius
10a5b8b6b8 fix(@angular/ssr): disable component bootstrapping during route extraction
This commit disables component bootstrapping during route extraction to prevent invoking the AppComponent and its lifecycle hooks.

Closes #29085
2024-12-11 18:16:46 +01:00
Charles Lyding
8875998224 fix(@angular/build): use consistent path separators for template HMR identifiers
To ensure that component HMR identifiers match correctly during an update,
the path element of the identifier generated by the build system will now
convert all windows path separators into POSIX separators. This provides
matching behavior to the AOT compiler's identifier generation process.
2024-12-11 12:02:53 -05:00
Angular Robot
12f2026581 build: update all non-major dependencies 2024-12-11 07:56:48 -08:00
Angular Robot
3e7ec63b27 build: update github/codeql-action action to v3.27.7 2024-12-11 07:53:35 -08:00
Angular Robot
f35a510680 build: update angular 2024-12-11 07:26:52 -08:00
Alan Agius
6eed4609f4 refactor(@angular/ssr): move ignored messages as a global
Refactored the ignored log messages into a global constant.
2024-12-11 14:52:26 +01:00
Aaron Shim
210bf4e2b4 fix(@angular/build): Fixing auto-csp edge cases where
- <script> is the last tag before </head> close
- .appendChild is called before </head> (because document.body is undefined then)
- <script> tags with a src attribute and no specified type attribute should not write <script type="undefined" ...>
2024-12-10 18:23:41 -08:00
Angular Robot
0d2c648ad1 build: update angular 2024-12-10 07:34:53 -08:00
Alan Agius
43127ddfb6 refactor(@angular/build): add globalThis['ngServerMode'] only when externalDependencies are present
This code is unnecessary when no external dependencies are involved.
2024-12-10 16:21:14 +01:00
Alan Agius
41ece633b3 feat(@angular/ssr): redirect to preferred locale when accessing root route without a specified locale
When users access the root route `/` without providing a locale, the application now redirects them to their preferred locale based on the `Accept-Language` header.

This enhancement leverages the user's browser preferences to determine the most appropriate locale, providing a seamless and personalized experience without requiring manual locale selection.
2024-12-10 13:11:06 +01:00
Alan Agius
8d7a51dfc9 feat(@angular/ssr): add modulepreload for lazy-loaded routes
Enhance performance when using SSR by adding `modulepreload` links to lazy-loaded routes. This ensures that the required modules are preloaded in the background, improving the user experience and reducing the time to interactive.

Closes #26484
2024-12-10 12:39:47 +01:00
Angular Robot
faa710e32d build: lock file maintenance 2024-12-09 10:20:25 -08:00
Angular Robot
bd90271050 build: update angular 2024-12-09 10:20:02 -08:00
Alan Agius
d811a7ffb0
fix(@angular/build): handle external @angular/ packages during SSR (#29094)
This commit introduces `ngServerMode` to ensure proper handling of external `@angular/` packages when they are used as externals during server-side rendering (SSR).

Closes: #29092
2024-12-09 18:26:12 +01:00
Alan Agius
28bdbeb62c revert: fix(@angular/build): show error when Node.js built-ins are used during ng serve
This commit reverts 06f478bc18d3e0daa8902d0fef94e55a5d052348

Closes: #29077
2024-12-09 17:11:03 +01:00
Angular Robot
e126bf9018 build: update all non-major dependencies 2024-12-08 15:32:03 +01:00
Alan Agius
0a570c0c2e feat(@angular/build): add support for customizing URL segments with i18n
Previously, the `baseHref` option under each locale allowed for generating a unique base href for specific locales. However, users were still required to handle file organization manually, and `baseHref` appeared to be primarily designed for this purpose.

This commit introduces a new `subPath` option, which simplifies the i18n process, particularly in static site generation (SSG) and server-side rendering (SSR). When the `subPath` option is used, the `baseHref` is ignored. Instead, the `subPath` serves as both the base href and the name of the directory containing the localized version of the app.

Below is an example configuration showcasing the use of `subPath`:

```json
"i18n": {
  "sourceLocale": {
    "code": "en-US",
    "subPath": ""
  },
  "locales": {
    "fr-BE": {
      "subPath": "fr",
      "translation": "src/i18n/messages.fr-BE.xlf"
    },
    "de-BE": {
      "subPath": "de",
      "translation": "src/i18n/messages.de-BE.xlf"
    }
  }
}
```

The following tree structure demonstrates how the `subPath` organizes localized build output:
```
dist/
├── app/
│   └── browser/  # Default locale, accessible at `/`
│       ├── fr/  # Locale for `fr-BE`, accessible at `/fr`
│       └── de/  # Locale for `de-BE`, accessible at `/de`
```

DEPRECATED: The `baseHref` option under `i18n.locales` and `i18n.sourceLocale` in `angular.json` is deprecated in favor of `subPath`.

The `subPath` defines the URL segment for the locale, serving as both the HTML base HREF and the directory name for output. By default, if not specified, `subPath` will use the locale code.

Closes #16997 and closes #28967
2024-12-07 19:00:32 +01:00
Alan Agius
d7214e9610 fix(@angular/ssr): include Content-Language header when locale is set
The server now includes the `Content-Language` HTTP header in responses whenever a locale is explicitly set.
2024-12-07 18:46:14 +01:00
Angular Robot
120f088778 build: update angular 2024-12-06 14:49:30 +01:00