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
This commit is contained in:
Igor Minar
2020-07-24 09:49:19 -07:00
committed by Michael Prentice
parent 134aa72467
commit f26f014ffc
4 changed files with 16 additions and 401 deletions

View File

@ -24,7 +24,7 @@ def ts_api_guardian_test(
golden,
actual,
data = [],
strip_export_pattern = ["^__", "^ɵ[^ɵ]"],
strip_export_pattern = [],
allow_module_identifiers = COMMON_MODULE_IDENTIFIERS,
use_angular_tag_rules = True,
**kwargs):
@ -49,8 +49,9 @@ def ts_api_guardian_test(
]
for i in strip_export_pattern:
# The below replacement is needed because under Windows '^' needs to be escaped twice
args += ["--stripExportPattern", i.replace("^", "^^^^")]
# Quote the regexp before passing it via the command line.
quoted_pattern = "\"%s\"" % i
args += ["--stripExportPattern", quoted_pattern]
for i in allow_module_identifiers:
args += ["--allowModuleIdentifiers", i]
@ -82,7 +83,7 @@ def ts_api_guardian_test_npm_package(
goldenDir,
actualDir,
data = [],
strip_export_pattern = ["^__", "^ɵ[^ɵ]"],
strip_export_pattern = ["^ɵ(?!ɵdefineInjectable|ɵinject|ɵInjectableDef)"],
allow_module_identifiers = COMMON_MODULE_IDENTIFIERS,
use_angular_tag_rules = True,
**kwargs):
@ -109,8 +110,9 @@ def ts_api_guardian_test_npm_package(
]
for i in strip_export_pattern:
# The below replacement is needed because under Windows '^' needs to be escaped twice
args += ["--stripExportPattern", i.replace("^", "^^^^")]
# Quote the regexp before passing it via the command line.
quoted_pattern = "\"%s\"" % i
args += ["--stripExportPattern", quoted_pattern]
for i in allow_module_identifiers:
args += ["--allowModuleIdentifiers", i]

View File

@ -47,7 +47,7 @@ export function startCli() {
options.exportTags = {
requireAtLeastOne: ['publicApi', 'codeGenApi'],
banned: ['experimental'],
toCopy: ['deprecated']
toCopy: ['deprecated', 'codeGenApi']
};
options.memberTags = {
requireAtLeastOne: [],