1174 Commits

Author SHA1 Message Date
Angular Robot
30f182c7ad build: update all non-major dependencies 2024-02-26 14:29:44 -05:00
Alan Agius
782c7185c5 fix(@angular/cli): prevent BOM errors in package.json during ng update
To prevent `JSON.parse` errors triggered by Byte Order Marks (BOMs) in package.json files, the `readJson` tree method is now utilized for more reliable BOM handling.

Closes #27052
2024-02-09 15:36:15 +01:00
Angular Robot
ccdaed4e49 build: update all non-major dependencies 2024-02-06 08:42:54 -05:00
Angular Robot
8515c6bb54 build: update all non-major dependencies 2024-01-29 15:27:28 -08:00
Alan Agius
600498f2cd feat(@angular/create): add support to bun package manager
This commit adds support to use `bun` as a package manager.

Closes #26837
2024-01-25 18:02:35 +01:00
Alan Agius
b3e206741c feat(@angular/cli): add support to bun package manager
This commit adds support to use `bun` as a package manager.

Closes #26837
2024-01-25 18:02:35 +01:00
Alan Agius
7717dba907 docs: remove ngx-deploy-npm from missing deploy targets
This package will no longer support Angular CLI workspaces in the next major version. Instead they will soley support NX.

See: https://dev.to/dianjuar/whats-coming-to-ngx-deploy-npm-v8-23gn and https://github.com/angular/angular/pull/53999
2024-01-25 13:51:54 +01:00
Alan Agius
6c65730b60 build: update angular to 17.2.0-next 2024-01-25 09:11:51 +01:00
Alan Agius
eef1aa8d79 fix(@angular/ssr): handle handle load event for multiple stylesheets and CSP nonces
The `load` event for each stylesheet may not always be triggered by Google Chrome's handling. Refer to: https://crbug.com/1521256

This results in the media attribute persistently being set to print, leading to distorted styles in the UI. To address this issue, we substitute the onload logic by replacing `link.addEventListener('load', ...` with `document.documentElement.addEventListener('load', ...` and filtering for link tags.

Closes #26932
2024-01-24 14:58:54 +01:00
Angular Robot
248b4c9a75 build: update all non-major dependencies 2024-01-23 10:52:36 +01:00
harshlakhara
efa1a19a78 fix(@angular/cli): update regex to validate the project-name 2024-01-23 10:52:24 +01:00
Angular Robot
8eab5aa912 build: update all non-major dependencies 2024-01-18 09:58:07 -05:00
Alan Agius
640a76aa74 fix(@angular/cli): retain existing EOL when updating JSON files
This commit updates the JSON utility to retain the existing EOF when updating files.
2024-01-05 16:30:06 +01:00
Alan Agius
68dae539ad feat(@angular-devkit/build-angular): initial experimental implementation of @web/test-runner builder
This is a new `@angular-devkit/build-angular:web-test-runner` builder which invokes Web Test Runner to execute unit tests in a real browser.

The implementation calls `application` builder under the hood with some option overrides build the application to a temporary directory and then runs Web Test Runner on the output. This set up is still minimal, but sufficient to run and pass tests in the generated `ng new` application.

The `schema.json` file is directly copied from the `karma` builder, since this is intended to serve as a migration target for users coming from Karma. Most of the options don't actually work yet, which is logged when they are used.

The most interesting part of this change is configuring Jasmine to execute in Web Test Runner. This is done through the `testRunnerHtml` option which allows us to control the HTML page tests are executed on. We use `test_page.html` which very carefully controls the loading process. I opted to make a single `<script type="module">` which dynamic imports all the relevant pieces so the ordering can be directly controlled more easily. This is better than trying to manage multiple `<script>` tags and pass data between them. Ideally everything would be bundled into a single entry point, however this is not feasible due to the way that ordering requirements do not align with typical `import` structure. Jasmine must come before polyfills which must come before the runner which invokes user code. In an ideal world, this ordering relationship would be represented in `import` statements, but this is not practically feasible because Angular CLI doesn't own all the files (`./polyfills.js` is user-defined) and Jasmine's loading must be split into two places so Zone.js can properly patch it.

`jasmine_runner.js` serves the purpose of executing Jasmine tests and reporting their results to Web Test Runner. I tried to write `jasmine_runner.js` in TypeScript and compile it with a `ts_library`. Unfortunately I don't think this is feasible because it needs to import `@web/test-runner-core` at runtime. This dependency has some code generated at runtime in Web Test Runner, meaning we cannot bundle this dependency and must mark it as external and dynamic `import()` the package at runtime. This works fine in native ESM, but compiling with TypeScript outputs CommonJS code by default (and I don't believe our `@build_bazel_rules_nodejs` setup can easily change that), so any `import('@web/test-runner-core')` becomes `require('@web/test-runner-core')` which fails because that package is ESM-only. The `loadEsmModule` trick does work here either because Web Test Runner is applying Node module resolution at serve time, meaning it looks for `import('@web/test-runner-core')` and rewrites it to something like `import('/node_modules/@web/test-runner-core')`. In short, there is no easy syntax which circumvents the TypeScript compiler while also being statically analyzable to Web Test Runner.
2024-01-03 18:52:58 +01:00
Alan Agius
602d0166c4 fix(@angular/cli): add prerender and ssr-dev-server schemas in angular.json schema
Add missing schemas to improve IDE DX
2024-01-03 16:18:08 +01:00
Alan Agius
fc7aa22462 refactor(@angular/cli): use process.versions.pnp to determine if PNP is used in warnOnMissingNodeModules
Instead of checking for existence of PNP config files we now use `process.versions.pnp`. See https://yarnpkg.com/advanced/pnpapi#processversionspnp
2023-12-21 16:37:55 +01:00
Alan Agius
a391b5f0c2 fix(@angular/cli): ng e2e and ng lint prompt requires to hit Enter twice to proceed on Windows
This fixes an issue where prompts in nested child processes on Windows require multiple keystrokes to proceed.

Closes #26724
2023-12-21 16:37:25 +01:00
Charles Lyding
72cf799388 refactor(@angular/pwa): use stream pipeline operator with HTML rewriter
The index HTML augmentation within the PWA schematic now uses the Node.js
promise-based pipeline helper to reduce the complexity of the code when
using the parse5 streaming rewriter. This removes a noticeable amount of
code as well as removing the need to manually wrap the result in a Promise.
2023-12-18 07:35:14 -05:00
Alan Agius
f7d538903a fix(@angular/cli): re-add -d alias for --dry-run
This got accidentally deleted during the transition to yargs.

Closes #26496
2023-12-15 16:34:08 +01:00
Alan Agius
30efb76c46 refactor(@angular/cli): remove no longer relevant regexps from ng version checks
Bazel and NgUniversal packages information is not needed in version 17.
2023-12-15 16:30:07 +01:00
Angular Robot
60b40cb3e3 build: update all non-major dependencies 2023-12-04 09:35:46 +01:00
Doug Parker
5ad8d15177 refactor: bump @angular/pwa peer dep for 17.0.0-next 2023-11-29 13:52:02 -08:00
Charles Lyding
9e356754ce build: update Angular version to v17.1 prerelease
Angular package dependency versions and the version used to generate a new project have been updated to use 17.1.0-next.0.
2023-11-17 12:34:39 -05:00
Alan Agius
bec9458b6e fix(@angular/cli): handle packages with no version
In some cases pacote will return undefined as `version` which resulted in `Cannot convert undefined or null to object`.

Closes #26337
2023-11-15 16:47:42 +01:00
Angular Robot
cb0c22ee9b build: update all non-major dependencies 2023-11-08 15:04:56 +01:00
Alan Agius
0ccb4c7d0b build: update Angular packages to version 17 stable
Update all versions to stable
2023-11-08 13:56:40 +01:00
Alan Agius
f9a798be05 fix(@angular/pwa): replace Angular logos
This commit replaces the Angular old logo with the new one.
2023-11-07 19:14:34 +01:00
水上 皓登
fac706047a docs: the node.js's link fix. 2023-11-04 11:35:21 +01:00
Alan Agius
0f5fb09852 refactor(@angular/ssr): guard against potential path traversals
This change updates to code to guard against a potential path traversal.

More context about the reasoning behind this change can be found in https://buganizer.corp.google.com/issues/299878755#comment26
2023-11-03 14:50:43 +01:00
Charles Lyding
6d8d948ad0 refactor(@angular-devkit/build-angular): cache compiled load ESM file helper
The dynamically compiled ESM import helper is now cached to prevent the need
to recompile the helper function everytime a load ESM helper call is made.
This helper is currently used to workaround dynamic import limitations with
the TypeScript compilation output. Once the build process is updated, it will
no longer be required.
2023-11-03 10:36:27 +01:00
cexbrayat
de1ec9da3b fix(@angular/ssr): enable performance profiler option name 2023-11-03 10:35:19 +01:00
Alan Agius
11420667f9 build: use single Node.js toolchain to run unit tests
E2E tests are used to run tests on multiple platforms and node.js versions.
2023-10-30 17:50:47 +01:00
Alan Agius
91dcae16d1 fix(@angular/cli): add Node.js 20 as supported version
Prior to this Node.js 20 was incorrectly being listed as unsupported.

Closes #26114
2023-10-30 12:28:00 +01:00
Charles Lyding
6161e3e031 fix(@angular/cli): ignore peer mismatch when updating @nguniversal/builders
When updating to v17, the `@nguniversal/builders` is now ignored when checking peer
dependency ranges. The `@nguniversal/builders` is no longer used and will be removed
in a migration during the update process.
2023-10-30 09:00:31 +01:00
Alan Agius
a0f8fac4b3 refactor: update inquirer to version 9.0.6
Update the mentioned package.
2023-10-26 16:11:36 +02:00
Alan Agius
842c2045d1 fix(@angular/cli): remove Node.js 16 from supported checks
Node.js support was removed, but it appears that this got through the cracks.
2023-10-24 16:12:09 +02:00
Alan Agius
f6a088bc18 fix(@angular/ssr): correctly set config URL
When calling `renderApplication` or `renderModule` the URL would be overridden to undefined as the `url` option was not provided as an option.
2023-10-24 16:11:45 +02:00
Alan Agius
2c1c676245 fix(@angular/cli): remove the need to specify --migrate-only when --name is used during ng update
This commit updates the behaviour of `ng update --migrate-only` to remove the need for `--migrate-only` option to be specified. `--migrate-only` will be set internally.

Before
```
ng update @angular/cli --migrate-only --name=migration-name
```

Now
```
ng update @angular/cli --name=migration-name
```
2023-10-20 23:11:50 +02:00
Alan Agius
70099af5be docs(@angular/cli): update build description
Replace webpack with esbuild.
2023-10-19 18:15:23 +02:00
Angular Robot
bcdfe534bd build: update dependency resolve to v1.22.8 2023-10-11 09:37:37 +02:00
Alan Agius
dcf3fddff2 feat(@angular/ssr): add performance profiler to CommonEngine
This commit adds an option to the `CommonEngine` to enable performance profiling. When enabled, timings of a number of steps will be outputted in the server console.

Example:
```
********** Performance results **********
Retrieve SSG Page:       0.3ms
Render Page:             25.4ms
Inline Critical CSS:     2.3ms
*****************************************
```

To enable profiling set `enablePeformanceProfiler: true` in the `CommonEngine` options.

```ts
const commonEngine = new CommonEngine({
  enablePeformanceProfiler: true
});
```
2023-09-28 17:32:29 +02:00
Alan Agius
6b5c469a42 build: update all non-major dependencies 2023-09-27 14:08:41 +02:00
Alan Agius
741cca73c1 feat(@schematics/angular): add ng new --ssr
This commit enabled users to opt-in adding SSR and SSG to their application during the `ng new` experience. This can be done either by using the `--ssr` option or answer `Yes` when prompted.
2023-09-25 20:17:01 +02:00
Alan Agius
6a85b13b1f refactor(@angular/ssr): move ng-add schematic to @schematics/angular
This move is in preparation to enable `ng new --ssr`.
2023-09-25 20:17:01 +02:00
Alan Agius
f4e7fa8735 fix(@angular/cli): add @angular/ssr as part of the ng update packageGroup
This ensures that when the CLI is updates so is `@angular/ssr`
2023-09-22 19:56:32 +02:00
Alan Agius
8d033841d1 fix(@angular/ssr): enable prerender and ssr for all build configuration
This commit configures both `ssr` and `prerender` both both development and production configurations. This is needed to improve DX and allow for a better debugging.
2023-09-22 17:34:45 +02:00
Alan Agius
fc68dcaa0d refactor(@angular/ssr): remove code that sets initialNavigation: enabledBlocking
This removes that code that was used to set `initialNavigation: enabledBlocking` as this is no longer needed to reduce flickering. This is because `initialNavigation: enabledBlocking` is not needed when enabling hydration via `provideClientHydration` which is done in the internal server schematic.
2023-09-22 17:34:20 +02:00
Alan Agius
8f9a0d70cd feat(@angular-devkit/build-angular): support standalone apps route discovery during prerendering
This fixes an issue were routes could not be discovered automatically in a standalone application.

This is a total overhaul of the route extraction process as instead of using `guess-parser` NPM package, we now use the Angular Router. This enables a number of exciting possibilities for the future which were not possible before.

# How it works?
The application is bootstrapped and through DI injection we get the injector and router config instance and recursively build the routes tree.
2023-09-18 22:26:06 +02:00
Alan Agius
5a204b81c7 refactor(@angular-devkit/build-angular): accept boolean and string in ssr option
This is to align with the `serviceWorker` option.
2023-09-15 22:12:34 +02:00
Alan Agius
3f8aa9d8c7 feat(@schematics/angular): update ng new to use the esbuild application builder based builder
This commit updates the `ng generate application` to use the esbuild `application` builder. This also updates the schematics to support both `browser` and `application` builders.

BREAKING CHANGE: `rootModuleClassName`, `rootModuleFileName` and `main` options have been removed from the public `pwa` and `app-shell` schematics.
2023-09-13 17:40:50 +02:00