Commit Graph

29 Commits

Author SHA1 Message Date
Igor Minar 5d3ba8dec7 test: update ts-api-guardian's strip_export_pattern to exclude Ivy instructions (#38224)
Previously the instructions were included in the golden files to monitor the frequency and rate of
the instruction API changes for the purpose of understanding the stability of this API (as it was
considered for becoming a public API and deployed to npm via generated code).

This experiment has confirmed that the instruction API is not stable enough to be used as public
API. We've since also came up with an alternative plan to compile libraries with the Ivy compiler
for npm deployment and this plan does not rely on making Ivy instructions public.

For these reasons, I'm removing the instructions from the golden files as it's no longer important
to track them.

The are three instructions that are still being included: `ɵɵdefineInjectable`, `ɵɵinject`, and
`ɵɵInjectableDef`.

These instructions are already generated by the VE compiler to support tree-shakable providers, and
code depending on these instructions is already deployed to npm. For this reason we need to treat
them as public api.

This change also reduces the code review overhead, because changes to public api golden files now
require multiple approvals.

PR Close #38224
2020-07-27 14:37:41 -07:00
Alan Agius 2e493edf80 build: provide full paths to `ts_api_guardian_test_npm_package` and `ts_api_guardian_test` (#36034)
ts-api-guardian uses `require.resolve` to resolve the actual and golden files under bazel. In Windows for these files to be resolved correct the full path including the workspace name as per the MANIFEST entries is required.

This used to be the case until the recent changes done to use npm_integration tests

83c74ceacf/tools/public_api_guard/public_api_guard.bzl (L19)
83c74ceacf/tools/public_api_guard/public_api_guard.bzl (L28)

```
bazel test //packages/... --test_tag_filters=api_guard

//packages/animations:animations_api                            (cached) PASSED in 18.4s
//packages/common:common_api                                    (cached) PASSED in 25.5s
//packages/compiler-cli:compiler_options_api                    (cached) PASSED in 12.4s
//packages/compiler-cli:error_code_api                          (cached) PASSED in 11.6s
//packages/core:core_api                                        (cached) PASSED in 20.6s
//packages/core:ng_global_utils_api                             (cached) PASSED in 13.5s
//packages/elements:elements_api                                (cached) PASSED in 11.9s
//packages/forms:forms_api                                      (cached) PASSED in 13.9s
//packages/http:http_api                                        (cached) PASSED in 14.8s
//packages/localize:localize_api                                (cached) PASSED in 6.3s
//packages/platform-browser:platform-browser_api                (cached) PASSED in 18.1s
//packages/platform-browser-dynamic:platform-browser-dynamic_api (cached) PASSED in 14.0s
//packages/platform-server:platform-server_api                  (cached) PASSED in 13.9s
//packages/platform-webworker:platform-webworker_api            (cached) PASSED in 13.7s
//packages/platform-webworker-dynamic:platform-webworker-dynamic_api (cached) PASSED in 11.7s
//packages/router:router_api                                    (cached) PASSED in 19.9s
//packages/service-worker:service-worker_api                    (cached) PASSED in 18.1s
//packages/upgrade:upgrade_api                                  (cached) PASSED in 13.5s
```

Reference: DEV-71

PR Close #36034
2020-03-12 09:49:00 -07:00
Joey Perrott 15f8afa4bf ci: move public-api goldens to goldens directory (#35768)
Moves the public api .d.ts files from tools/public_api_guard to
goldens/public-api.

Additionally, provides a README in the goldens directory and a script
assist in testing the current state of the repo against the goldens as
well as a command for accepting all changes to the goldens in a single
command.

PR Close #35768
2020-03-10 20:58:39 -04:00
Joey Perrott b7519e5cfa build: allow auto-discover all typings files in npm package by ts-api-guardian (#35691)
Adds a new feature to ts-api-guardian allowing for automatically discovering all
entry point d.ts files from all package.json files in a provided directory.

PR Close #35691
2020-02-27 14:02:16 -08:00
Alex Rickabaugh bb290cefae fix(core): make QueryList implement Iterable in the type system (#33536)
Originally, QueryList implemented Iterable and provided a Symbol.iterator
on its prototype. This caused issues with tree-shaking, so QueryList was
refactored and the Symbol.iterator added in its constructor instead. As
part of this change, QueryList no longer implemented Iterable directly.

Unfortunately, this meant that QueryList was no longer assignable to
Iterable or, consequently, NgIterable. NgIterable is used for NgFor's input,
so this meant that QueryList was not usable (in a type sense) for NgFor
iteration. View Engine's template type checking would not catch this, but
Ivy's did.

As a fix, this commit adds the declaration (but not the implementation) of
the Symbol.iterator function back to QueryList. This has no runtime effect,
so it doesn't affect tree-shaking of QueryList, but it ensures that
QueryList is assignable to NgIterable and thus usable with NgFor.

Fixes #29842

PR Close #33536
2019-11-19 13:43:53 -08:00
Greg Magolan 4ee354da99 build: switch to @build_bazel_rules_nodejs//:index.bzl load point (#33433)
The defs.bzl load point will be removed for the rules_nodejs 1.0 release.

PR Close #33433
2019-10-28 10:10:48 -07:00
Paul Gschwendtner 16ac611a84 build: ts-api-guardian npm package contains invalid references (#31096)
Currently when building the `ts-api-guardian` npm package,
the labels are not properly replaced after recent changes to
the `entry_point` attribute. This means that the `ts-api-guardian`
package is currently not usable externally.

PR Close #31096
2019-06-18 09:50:41 -07:00
Alex Eagle ef0b2cc74d build: convert entry_point to label (#30627)
PR Close #30627
2019-06-11 00:03:11 +00:00
Ben Lesh d7eaae6f22 refactor(ivy): Move instructions back to ɵɵ (#30546)
There is an encoding issue with using delta `Δ`, where the browser will attempt to detect the file encoding if the character set is not explicitly declared on a `<script/>` tag, and Chrome will find the `Δ` character and decide it is window-1252 encoding, which misinterprets the `Δ` character to be some other character that is not a valid JS identifier character

So back to the frog eyes we go.

```
    __
   /ɵɵ\
  ( -- ) - I am ineffable. I am forever.
 _/    \_
/  \  /  \
==  ==  ==
```

PR Close #30546
2019-05-20 16:37:47 -07:00
Ben Lesh cf86ed7b29 refactor(ivy): migrate ɵɵ prefix back to Δ (#30362)
Now that issues are resolved with Closure compiler, we can move back to our desired prefix of `Δ`.

PR Close #30362
2019-05-14 16:52:15 -07:00
Alan Agius 5f95796b61 test: fix ts api guardian and public guard tests on windows (#30105)
This change addresses several issues with ts-api-guardian and public api guards related tests in Windows

The fixes contain 3 main changes:
1) In `stripExportPattern` - replace `^` with `^^^^`  in RegExp due to a double escaping requirment under Windows. Note that under Linux this the extra character has no effect because it's still a valid RegExp in Js.

2. Force `*.patch` files to always be with a LF line sequence instead of CRLF in windows

3. When adding JSDoc comments consider the presence of a carriage return in a line new feed

Partially addresses #29785

PR Close #30105
2019-04-26 16:32:22 -07:00
Alan Agius ee12c45473 build: bazel ts-api-guardian usage fails on workspaces which don't depend on `chalk` (#30138)
When using the npm package in a workspace which doesn't depend on chalk, ts-api-guardian fails with an error `Error: Cannot find module 'chalk'`

PR Close #30138
2019-04-26 11:08:05 -07:00
Alan Agius 04d13429f0 build: fix api guardian error form npm (#30063)
built-in, relative, absolute, nested node_modules - Error: Cannot find module '../lib/cli'

built-in, relative, absolute, nested node_modules - Error: Cannot find module '../lib/cli'

This is because the transpiled lib files need to be added to the data.

PR Close #30063
2019-04-23 14:49:20 -07:00
Alan Agius f7960c024c build: use fine grain dependencies for ts-api-guardian (#30051)
At the moment `ts_api_guardian_test` rule depends on the entire node_modules tree, this is causing an input file tree of over 71473 in the material repo which is failing RBE

With this change we add only the required dependencies to as data attribute instead of the `@npm//:node_modules`

With this change we should also reduce the `Too many open files in system` error that sometimes crops up

PR Close #30051
2019-04-23 08:29:06 -07:00
Alan Agius d7f7826363 build: publish ts-api-guardian rule in the npm package (#29977)
With this change downstream users will no longer need to build ts-api-guardian from source as now the bazel rule is available in the npm package.

This can be used by installing ts-api-guardian as a devDependency and changing the load syntax from:
```
load("@angular//tools/ts-api-guardian:index.bzl", "ts_api_guardian_test")
```

to:
```
load("@npm_ts_api_guardian//:index.bzl", "ts_api_guardian_test")
```

**Note**: downstream users should also clean their `WORKSPACE` and remove the dependencies of angular workspace.

PR Close #29977
2019-04-19 10:59:23 -07:00
Greg Magolan ce2713f5b1 build(bazel): remove @ts-api-guardian_deps yarn_install (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Alex Rickabaugh b0578061ce refactor(ivy): use ɵɵ instead of Δ for now (#29850)
The `Δ` caused issue with other infrastructure, and we are temporarily
changing it to `ɵɵ`.

This commit also patches ts_api_guardian_test and AIO to understand `ɵɵ`.

PR Close #29850
2019-04-11 16:27:56 -07:00
Paul Gschwendtner 0e1cceed50 build: add option to disable ts-api-guardian default angular tag rules (#26761)
Since the API guardian can be also used by other projects, we should not set up the default Angular project tag rules unless specified explicitly through a given command option (`useAngularTagRules`)

PR Close #26761
2018-10-30 13:45:58 -04:00
Greg Magolan 15c2467dbd build: review comments addressed (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alan Agius aac08e0438 build: pass `stripExportPattern` as an array of `RegExp` (#26012)
This is a workaround for https://github.com/bazelbuild/rules_nodejs/issues/317

PR Close #26012
2018-09-27 12:07:03 -07:00
Alan Agius 21e566d9bc build: use nodejs public api (#25940)
`nodejs_binary` and `nodejs_test` from `@build_bazel_rules_nodejs//:defs.bzl` and `@build_bazel_rules_nodejs//internal/node:node.bzl` are different as the first one uses a macro https://github.com/bazelbuild/rules_nodejs/blob/master/internal/node/node.bzl#L229 to wrap the `nodejs_binary` and `nodejs_test` as an `.exe` for Windows.

PR Close #25940
2018-09-17 12:52:39 -07:00
Alan Agius 2a21ca09d2 feat(bazel): add additional parameters to `ts_api_guardian_test` def (#25694)
Added `strip_export_pattern` and `allow_module_identifiers` so that these can be passed from downstream

PR Close #25694
2018-09-07 14:24:31 -07:00
Alan Agius ddc13352e9 fix(bazel): specify the package and lock files using the workspace (#25694)
PR Close #25694
2018-09-07 14:24:31 -07:00
Greg Magolan 9605456b66 build: refactor ambient node & jasmine types so they are only included where needed (#25491)
PR Close #25491
2018-08-16 13:46:43 -07:00
Alex Eagle a3f1e2cb42 style: format .bzl files with buildifier (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Greg Magolan 1e74ea9e60 build(bazel): update to rule_nodejs 0.10.0 (#24759)
PR Close #24759
2018-07-06 10:17:36 -07:00
Pete Bacon Darwin ac316be79b build: remove unnecessary stability check (#23176)
Previously, it was necessary to attach on of the three "stability"
jsdoc tags (`@stable`, `@deprecated` or `@experimental`) to each
public API export.

To ensure that the public API was correctly tagged, the `ts-api-guardian`
would check that one of these tags appeared on every public export.

Now the doc-gen is able to compute that a code item is stable if
it does not contain the `@experimental` nor `@deprecated` tags.

Therefore there is no need to provide the `@stable` tag any more; and
this tag has now been marked as deprecated - i.e. it should not be used.

The ts-api-guardian has been modified in this commit so that it no longer
warns/fails if the `@stable` is missing.

PR Close #23176
2018-04-05 10:03:39 -07:00
Alex Eagle 34981063ec build: ts-api-guardian reuses root node_modules (#22894)
This avoids the need to run bazel run :install instead of yarn install.
We merge the devDependencies of ts-api-guardian into the root package.json file.

PR Close #22894
2018-03-22 19:23:33 -04:00
Alex Eagle 4f60968704 test(bazel): Build and test ts-api-guardian locally (#22544)
Also use it to test the public API for core and common

Once we have an ng_package for every package, we can remove
the npm dependency on ts-api-guardian and the gulp-based
public api check.

PR Close #22544
2018-03-02 15:00:00 -08:00