Commit graph

749 commits

Author SHA1 Message Date
Angular Robot
e3fbeab3bd build: update dependency @rollup/plugin-commonjs to v23 (#47711)
See associated pull request for more information.

PR Close #47711
2022-10-11 23:09:06 +00:00
Alan Agius
1b9fd46d14 feat(core): add support for Node.js version 18 (#47730)
This change aligns with the supported Node.js versions of the Angular CLI.
See: https://github.com/angular/angular-cli/pull/24026

BREAKING CHANGE: Angular no longer supports Node.js versions `14.[15-19].x` and `16.[10-12].x`. Current supported versions of Node.js are `14.20.x`, `16.13.x` and `18.10.x`.

PR Close #47730
2022-10-11 17:21:19 +00:00
Kristiyan Kostadinov
ed11a13c3c feat(core): drop support for TypeScript 4.6 and 4.7 (#47690)
Updates the version range in the compiler to require at least TypeScript 4.8. Note that I'm keeping the backwards-compatibility layer for 4.7 around for now until internal projects have been migrated to 4.8.

BREAKING CHANGE:
TypeScript versions older than 4.8 are no longer supported.

PR Close #47690
2022-10-10 16:18:56 +00:00
Alan Agius
16f96eeabf refactor(compiler-cli): remove enableIvy options (#47346)
This option has no longer any effect as Ivy is the only rendering engine.

BREAKING CHANGE: Angular compiler option `enableIvy` has been removed as Ivy is the only rendering engine.

PR Close #47346
2022-09-06 11:33:48 -07:00
Kristiyan Kostadinov
31429eaccc feat(core): support TypeScript 4.8 (#47038)
Adds support for TypeScript 4.8 and resolves some issues that came up as a result of the update.

Most of the issues came from some changes in TypeScript where the `decorators` and `modifiers` properties were removed from most node types, and were combined into a single `modifiers` array. Since we need to continue supporting TS 4.6 and 4.7 until v15, I ended up creating a new `ngtsc/ts_compatibility` directory to make it easier to reuse the new backwards-compatible code.

PR Close #47038
2022-08-16 16:02:47 +00:00
Paul Gschwendtner
ea89677c12 feat(compiler-cli): support more recent version of tsickle (#47018)
Updates the tsickle version in the repository and accounts for its changes in
the `compiler-cli` package. Tsickle made a breaking change in the minor version
segment bump that would break the use with `@angular/compiler-cli`

Additionally the tsickle version for `@angular/bazel` is updated since
we updated `@bazel/typescript` to also account for the breaking changes.

See: 78a0528107

PR Close #47018
2022-08-03 17:36:18 -07:00
Kristiyan Kostadinov
ac6e7fa97e fix(bazel): allow extendedDiagnostics option to be passed in through tsconfig (#46953)
Adds the `extendedDiagnostics` field to the list of allowed options so that it is picked up from the user's tsconfig.

PR Close #46953
2022-08-01 09:49:14 -07:00
Doug Parker
4e328c47be refactor(bazel): remove experimental_extended_template_diagnostics flag (#46898)
Extended diagnostics are enabled by default now and this flag doesn't do anything anymore but I missed it in a previous cleanup.

PR Close #46898
2022-07-20 08:50:43 -07:00
renovate[bot]
2758a30a34 build: update dependency @rollup/plugin-commonjs to v22 (#46556)
PR Close #46556
2022-06-29 10:08:29 -07:00
Alan Agius
e8a33e75f4 docs: remove old bazel schematics doc (#46436)
This doc was intended for users migrating to version 10.

PR Close #46436
2022-06-21 11:47:35 -07:00
Kristiyan Kostadinov
ceb9abd9fd fix(bazel): update API extractor version (#46259)
`@angular/bazel` currently uses an older version of `@microsoft/api-extractor` which is causing downstream issues in Components. These changes bump up to a version that has a fix.

Context: https://github.com/angular/components/pull/25027

PR Close #46259
2022-06-06 10:16:04 -07:00
Paul Gschwendtner
f74bd1b0f5 perf(bazel): reduce input files for ng_package rollup and type bundle actions (#46187)
We currently use all the ESM2020 and type sources as inputs for rollup
and type bundle actions, respectively. This is a source of slowness in
Bazel sandboxed builds because many unused files will be linked/made
available for many concurrently-running actions.

We should limit the inputs only to what is assumed to be used. We cannot
know exactly and need to include transitive types from `node_modules`,
but that is an inevitable construct with the current Bazel rules.

Note that the external node modules could still bring in a lot of files,
like in Material where the `.d.ts` files for all locales are brought
into the sandbox (from `@angular/common`). We likely would need to
remove these files in a postinstall for now, to speed up actions,
similar to how we did it for RxJS in all repositories. These are known
to be not used in the components repo.

PR Close #46187
2022-06-02 13:43:22 -07:00
Jan Kuehle
7efa09b401 perf(bazel): use allowedInputs to avoid fs.stat (#46069)
Call tsc_wrapped's fileExists function instead of TypeScript's.

tsc_wrapped (used internally by ngc-wrapped) has an optimization under
bazel to avoid file system calls where possible. It takes advantage
bazelOpts.allowedInputs, which contains a list of all files available
for compilation.

File system calls can be quite slow depending on the file system. In
google3 I saw a 38 seconds compilation, which spent 6 seconds just doing
fs.stat calls during module resolution. Those fs.stat calls are entirely
gone after with this change.

PR Close #46069
2022-05-24 10:39:17 -07:00
Paul Gschwendtner
bd91572986 build: lock file maintenance to avoid node module differences for babel types (#45967)
We recently updated Babel and the Bazel types but this actually
resulted in duplicates, causing differences between what people
seen in their IDE vs. what Bazel builds.

This commit removes the lock file and generates it fully fresh,
deduping dependencies and also fixing the differences between
local IDE and Bazel.

As part of this we also need to update/fixup one assertion on the
Babel node path types, because the node start/end can now also
be `undefined`.

PR Close #45967
2022-05-20 14:18:09 -07:00
Renovate Bot
d869ede818 build: update all non-major dependencies (#45967)
PR Close #45967
2022-05-20 14:18:09 -07:00
Roy Dorombozi
6375fa7987 refactor(bazel): add support for starlark's unused_inputs_list (#45946)
This change adds the capability of ngc_wrapped to emit an
unused_inputs_list file that could be used by starlark.

We are making this change because in situations where angular modules
depend on angular modules, it becomes very easy for a single change to
trigger a long cascading set of angular builds since each angular rule
depends on the transitive closure of input files.

With this change in place, and once it is properly configured, bazel
will update the set of inputs to a build rule after it is built once
removing any of the inputs specified in this list, making incremental
builds quicker by skipping any rebuilds that only had changes to unused
inputs.

This logic should be, and is likely duplicated in tsc_wrapped to solve
the same problem in pure TypeScript situations, ideally we could use the
same implementation one day.

In addition, its possible that tree artifacts are not as supported as
we'd like, and where this change should mark entire directories as
unused, we may get better performance gains by enumerating the directory
and being more explicit about specific inputs which are unused.

PR Close #45946
2022-05-11 11:21:56 -07:00
Paul Gschwendtner
a6b6590339 fix(bazel): speed up d.ts bundling by configuring worker (#45900)
Speeds up the `d.ts` bundling by configuring it as a Bazel
persistent worker. Also improve logging for the ng packager
rule to make it easier to spot which actions/bundles take
up significant time.

Type bundling will occur for every entry-point so for machines
with rather limited cores/threads, this will be useful to save
NodeJS boot and resolution time.

PR Close #45900
2022-05-05 15:35:14 -07:00
Paul Gschwendtner
68a6a075f4 build: clean up references to old master branch (#45856)
Cleans up all references to the `master` branch we renamed to
`main` across Angular.

PR Close #45856
2022-05-04 16:23:33 -07:00
Paul Gschwendtner
95555658cf build: disable bazel nodejs linker to improve stability on windows (#45872)
The NodeJS Bazel linker does not work well on Windows because there
is no sandboxing and linker processes from different tests will attempt
to modify the same `node_modules`, causing concurrency race conditions
and resulting in flakiness.

PR Close #45872
2022-05-04 16:20:57 -07:00
Ryan Day
f0b5e830a5 build(bazel): change ngc-wrapped to use new bazelOpts.devmode (#45804)
bazelOpts.es5Mode is being removed and replaced with devmode. Adding a
check for either will allow a smooth migration.

PR Close #45804
2022-05-02 13:10:06 -07:00
JoostK
a88bf2090e refactor(compiler-cli): increase minimum version of partial declarations (#45782)
In v14, the partial compilation output of components have changed in a way
that prevents older versions of Angular to compile the partial declarations
correctly.

In particular, we used to emit used directives/components in separate arrays called
`components` and `directives`, and used pipes in a property called `pipes`:

```js
TestComponent.ɵcmp = i0.ɵɵngDeclareComponent({
  minVersion: "12.0.0",
  version: "13.3.0",
  type: TestComponent,
  selector: "ng-component",
  ngImport: i0,
  template: ``,
  isInline: true,
  directives: [{ type: i1.SomeDir, selector: "[some-dir]" }],
  components: [{ type: i1.SomeCmp, selector: "some-cmp" }],
  pipes: { 'async': i2.AsyncPipe },
});
```

In the above example, the `version` property indicates which exact compiler
version was used to compile the component, but the `minVersion` allows older
versions of the compiler/Angular linker to "link" the partial declaration to
its final AOT compilation output.

In v14, the used directives, components and pipes are now emitted together
into a single array under the `dependencies` property:

```js
TestComponent.ɵcmp = i0.ɵɵngDeclareComponent({
  minVersion: "12.0.0",
  version: "13.3.0",
  type: TestComponent,
  selector: "ng-component",
  ngImport: i0,
  template: ``,
  isInline: true,
  dependencies: [
    { kind: "directive", type: i1.SomeDir, selector: "[some-dir]" },
    { kind: "component", type: i1.SomeCmp, selector: "some-cmp" },
    { kind: "pipe", type: i2.AsyncPipe },
  ],
});
```

This change has been made in support of standalone components, but it does mean
that older compiler versions can no longer link these partial declarations
as desirable as none of the components, directives and pipes would be included
in the AOT-compiled code.

By increasing the `minVersion` property, we hint to older compiler versions that
they are not capable of processing the partial declaration. This allows reporting
an error at compile time instead of resulting in runtime failures due to missing
components, directives and pipes.

PR Close #45782
2022-04-29 17:19:16 -04:00
Kristiyan Kostadinov
29039fcdbc feat(core): support TypeScript 4.7 (#45749)
Adds support for TypeScript 4.7. Changes include:
* Bumping the TS version as well as some Bazel dependencies to include https://github.com/bazelbuild/rules_nodejs/pull/3420.
* Adding a backwards-compatibility layer for calls to `updateTypeParameterDeclaration`.
* Making `LView` generic in order to make it easier to type the context based on the usage. Currently the context can be 4 different types which coupled with stricter type checking would required a lot of extra casting all over `core`.
* Fixing a bunch of miscellaneous type errors.
* Removing assertions of `ReferenceEntry.isDefinition` in a few of the language service tests. The field isn't returned by TS anymore and we weren't using it for anything.
* Resolving in error in the language service that was caused by TS attempting to parse HTML files when we try to open them. Previous TS was silently setting them as `ScriptKind.Unknown` and ignoring the errors, but now it throws. I've worked around it by setting them as `ScriptKind.JSX`.

PR Close #45749
2022-04-29 12:19:45 -04:00
Joey Perrott
970a3b5c70 fix(bazel): add this_is_bazel marker (#45728)
Add marker for noting that this check confirms we are running in a bazel environment.

PR Close #45728
2022-04-22 12:46:23 -07:00
Paul Gschwendtner
dd0fc0f237 test: add test for new types_bundle rule from Angular bazel package (#45405)
Adds a little golden test for the new `types_bundle` rule that ensures
the rule works at a general level. This rule will be useful for non-APF
ESM packages like the Angular compiler-cli (for which we also want to
bundle types to make them compatible with TypeScripts ESM type
resolution)

PR Close #45405
2022-04-21 11:09:39 -07:00
Paul Gschwendtner
68597bb0ca feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405)
Speeds up the dev-turnaround by only bundling types when packaging. Currently
bundling occurs for all the `ng_module` targets in devmode.

This has various positive benefits:

* Avoidance of this rather slower operation in development
* Makes APF-built packages also handle types for `ts_library` targets consistently.
* Allows us to ensure APF entry-points have `d.ts` _always_ bundled (working with ESM
module resolution in TypeScript -- currently experimental)
* Allows us to remove the secondary `package.json` files from APF (maybe APF v14? - seems
low-impact). This would clean-up the APF even more and fix resolution issues (like in Vite)

PR Close #45405
2022-04-21 11:09:39 -07:00
Renovate Bot
770ea926bf build: update dependency @microsoft/api-extractor to v7.22.2 (#45641)
PR Close #45641
2022-04-15 09:27:39 -07:00
Renovate Bot
7d2a619812 build: update all non-major dependencies (#45632)
PR Close #45632
2022-04-14 15:02:45 -07:00
Paul Gschwendtner
f8a1ea0c11 fix(bazel): do not error if files part of srcs are outside of package (#45622)
We recently refactored how the ng package rule deals with static files.
As part of this refactoring, transitive files outside of the current
Bazel package were flagged as errors, while previously this was just
ignored. We need to revert back this behavior (even though code remains
much simpler and predicable now) since sass library targets for example
reference all transtive files in the default info and break packages then

PR Close #45622
2022-04-14 14:58:27 -07:00
Renovate Bot
7bf1cf4bf5 build: update all non-major dependencies (#45493)
PR Close #45493
2022-04-13 15:33:33 +00:00
Paul Gschwendtner
1219c5a374 refactor(bazel): fix dts bundling by accounting for api-extractor change (#45470)
Fixes the dts bundling by accounting for recent API extractor changes
which made API-extractor support path mappings. This causes
cross-package and cross-entry-point imports to no longer be considered
external, resulting in the imports to be dropped.

PR Close #45470
2022-04-11 21:01:09 +00:00
Paul Gschwendtner
4b2e98d55d fix(bazel): remove unnecessary file extractions from ng_package (#45470)
Looks like there is some old legacy code for extracting files
from NPM packages. This is already captured by the unscoped
ESM2020 output extraction.

PR Close #45470
2022-04-11 21:01:09 +00:00
Paul Gschwendtner
28e835b4bb feat(bazel): report error when dependency does not provide JS sources in ng_package (#45470)
Non-JavaScript source-providing targets in the `ng_package` rule can throw-off
the entry-point detection and therefore should be flagged. Currently e.g.
a genrule-generated static file might unnecessarily cause additional
actions to be generated (non-breaking but just unnecessary)

PR Close #45470
2022-04-11 21:01:09 +00:00
Paul Gschwendtner
636909fba7 feat(bazel): allow for generated package.json files in ng_package (#45470)
Currently the `ng_package` rule does not support generated
`package.json` files. Generated `package.json` files are sometimes
useful when e.g. dependencies are automatically inserted (e.g.
many dependencies in the components repo for the MDC deps)

Currently the `package.json` files would be copied as part of
the `data` attribute, but they would not be processed. i.e. missing
out on the `exports` field and more.

We can simplify the rule attributes and make this more ergonomic.

PR Close #45470
2022-04-11 21:01:09 +00:00
Renovate Bot
48b8a1fcf0 build: update all non-major dependencies (#45470)
Updates all non-major dependencies, including Bazel

PR Close #45470
2022-04-11 21:01:09 +00:00
Kristiyan Kostadinov
41223a81f2 build: update to jasmine 4.0 (#45558)
Updates us to version 4.0 of Jasmine and fixes some errors that were the result of us depending upon deprecated APIs. We need to do this both to stay up to date and because it was going to break eventually, because one of the Bazel packages was logging a deprecation warning that version 4.0 was required.

There were also some cases where the state of `ngDevMode` had started leaking out between tests.

PR Close #45558
2022-04-11 16:25:28 +00:00
Jessica Janiuk
7a37fe9f28 Revert "build: update to jasmine 4.0 (#45558)" (#45566)
This reverts commit a248df0682.

PR Close #45566
2022-04-08 19:07:29 +00:00
Kristiyan Kostadinov
a248df0682 build: update to jasmine 4.0 (#45558)
Updates us to version 4.0 of Jasmine and fixes some errors that were the result of us depending upon deprecated APIs. We need to do this both to stay up to date and because it was going to break eventually, because one of the Bazel packages was logging a deprecation warning that version 4.0 was required.

There were also some cases where the state of `ngDevMode` had started leaking out between tests.

PR Close #45558
2022-04-08 15:55:58 +00:00
Renovate Bot
e55e98dce5 build: update all non-major dependencies (#45374)
PR Close #45374
2022-03-29 13:22:26 -07:00
Paul Gschwendtner
af303d98db refactor: remove unused variables in starlark code to satisfy buildifier (#45431)
We updated buildifier and a few warnings became errors now. This commit
cleans up the failing unused variable instances, making the linter happy.

Additionally for the API extractor BUILD file, the package defaults
need to move to satisfy buildifier.

PR Close #45431
2022-03-25 12:18:34 -07:00
Paul Gschwendtner
a24293ae80 build: migrate more usages from @bazel/typescript to @bazel/concatjs (#45431)
As mentioned in previous commits (check them for more details), `@bazel/typescript`
no longer contains `ts_library`-specific code, so we no longer need that dependency.

PR Close #45431
2022-03-25 12:18:34 -07:00
Paul Gschwendtner
ffa331b130 refactor(bazel): update api-extractor to account for @bazel/typescript change (#45431)
`@bazel/typescript` code moved to `@bazel/concatjs` for the tsc-wrapped code.

Note that this code is likely going to be removed anyway soon when we
move dts bundling from `ng_module` to `ng_package`.

PR Close #45431
2022-03-25 12:18:34 -07:00
Paul Gschwendtner
7f6859e11f refactor(bazel): update ngc-wrapped to account for tsc-wrapped move to @bazel/concatjs (#45431)
Previously `tsc-wrapped` which is the foundation for `ngc-wrapped`, resided
in `@bazel/typescript`. It has been moved to `@bazel/concatjs` in rules_nodejs
so we need to account for that as part of our rules_nodejs v5 update.

PR Close #45431
2022-03-25 12:18:33 -07:00
Renovate Bot
010a39f856 build: update bazel (#45431)
Update `@bazel` packages to the latest 5.x version.

Some of the changes here are modeled after
angular/dev-infra@40c0ac8559.

Co-Authored-By: George Kalpakas <kalpakas.g@gmail.com>

PR Close #45431
2022-03-25 12:18:33 -07:00
Tobias Speicher
4ddcf81e61 refactor: replace deprecated String.prototype.substr() (#45397)
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

PR Close #45397
2022-03-24 11:48:09 -07:00
Paul Gschwendtner
dc72f3007a fix(bazel): ng module compilation workers are subject to linker race-conditions (#45393)
The Bazel NodeJS rules provide two ways of accessing node modules:

* A linker which creates a `node_modules` directory in the execroot/or in the runfiles.
* A patched module resolution where no node modules directory necessarily needs to exist.

The first is the default in `rules_nodejs` and the second is technically the most idiomatic
resolution mechanism in Bazel (as it matches with a runfile resolution library).

The linker is prone to race conditions in persistent workers, or non-sandbox environments (like
windows). This is because the linker for all workers will operate on a shared `execroot` directory
and the same `node_modules` directory is modified all the time / potentially conflicting with other
linker processes from other concurrently-running workers.

We rely on the patched module resolution anyway, but just need to disable the unused linker to avoid
issues like the following:

```
---8<---8<--- Start of log, file at /private/var/tmp/_bazel_splaktar/280f06d55552a0d01f89f0955b5acd78/bazel-workers/worker-8-TypeScriptCompile.log ---8<---8<---
[link_node_modules.js] An error has been reported: [Error: ENOENT: no such file or directory, unlink 'node_modules'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: 'node_modules'
} Error: ENOENT: no such file or directory, unlink 'node_modules'
---8<---8<--- End of log ---8<---8<---
INFO: Elapsed time: 12.796s, Critical Path: 5.39s
INFO: 645 processes: 477 internal, 12 darwin-sandbox, 156 worker.
```

PR Close #45393
2022-03-24 10:52:12 -07:00
Kristiyan Kostadinov
c9d566ce4b feat(core): drop support for TypeScript 4.4 and 4.5 (#45394)
Drops support for TypeScript older than 4.6 and removes some workarounds in the compiler.

BREAKING CHANGE:
TypeScript versions older than 4.6 are no longer supported.

PR Close #45394
2022-03-24 10:51:47 -07:00
Alan Agius
6eaaefd22e feat(core): drop support for Node.js 12 (#45286)
Node.js v12 will become EOL on 2022-04-30. As a result, Angular CLI v14 will no longer support Node.js v12.

BREAKING CHANGE:

Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.

PR Close #45286
2022-03-08 12:05:03 -08:00
Kristiyan Kostadinov
94bba76a4a feat(core): support TypeScript 4.6 (#45190)
Adds support for TypeScript 4.6.

PR Close #45190
2022-03-07 11:31:39 -08:00
Doug Parker
e0a340ea5b refactor(compiler-cli): remove leftover _extendedTemplateDiagnostics flag (#44920)
This flag is currently a no-op because extended diagnostics are enabled in production.

PR Close #44920
2022-02-01 18:24:10 +00:00
Martin Probst
4e180cb43b refactor(compiler): pass rootDir to tsickle (#44768)
tsickle's underlying API has changed to require passing a rootDir to getGeneratedExterns.
PR Close #44768
2022-01-20 11:16:35 -08:00