2017-12-06 09:56:49 -05:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2020-02-26 12:09:35 -05:00
|
|
|
load("//tools:defaults.bzl", "pkg_npm", "ts_api_guardian_test", "ts_library")
|
2019-02-20 12:54:42 -05:00
|
|
|
load("@npm_bazel_typescript//:index.bzl", "ts_config")
|
2017-09-25 15:40:22 -04:00
|
|
|
|
|
|
|
ts_config(
|
|
|
|
name = "tsconfig",
|
|
|
|
src = "tsconfig-build.json",
|
2017-12-06 09:56:49 -05:00
|
|
|
deps = ["//packages:tsconfig-build.json"],
|
2017-09-25 15:40:22 -04:00
|
|
|
)
|
2017-07-21 17:20:34 -04:00
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "compiler-cli",
|
2017-12-06 09:56:49 -05:00
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
"src/**/*.ts",
|
|
|
|
],
|
2017-12-18 00:36:21 -05:00
|
|
|
exclude = [
|
|
|
|
"src/integrationtest/**/*.ts",
|
|
|
|
],
|
2017-12-06 09:56:49 -05:00
|
|
|
),
|
|
|
|
tsconfig = ":tsconfig",
|
2017-07-21 17:20:34 -04:00
|
|
|
deps = [
|
2017-12-06 09:56:49 -05:00
|
|
|
"//packages/compiler",
|
2020-01-17 19:00:07 -05:00
|
|
|
"//packages/compiler-cli/src/ngtsc/core",
|
|
|
|
"//packages/compiler-cli/src/ngtsc/core:api",
|
2018-08-23 17:33:38 -04:00
|
|
|
"//packages/compiler-cli/src/ngtsc/diagnostics",
|
2019-06-06 15:22:32 -04:00
|
|
|
"//packages/compiler-cli/src/ngtsc/file_system",
|
2019-06-10 12:19:35 -04:00
|
|
|
"//packages/compiler-cli/src/ngtsc/indexer",
|
2019-03-18 14:16:38 -04:00
|
|
|
"//packages/compiler-cli/src/ngtsc/perf",
|
perf(compiler-cli): split Ivy template type-checking into multiple files (#36211)
As a performance optimization, this commit splits the single
__ngtypecheck__.ts file which was previously added to the user's program as
a container for all template type-checking code into multiple .ngtypecheck
shim files, one for each original file in the user's program.
In larger applications, the generation, parsing, and checking of this single
type-checking file was a huge performance bottleneck, with the file often
exceeding 1 MB in text content. Particularly in incremental builds,
regenerating this single file for the entire application proved especially
expensive.
This commit introduces a new strategy for template type-checking code which
makes use of a new interface, the `TypeCheckingProgramStrategy`. This
interface abstracts the process of creating a new `ts.Program` to type-check
a particular compilation, and allows the mechanism there to be kept separate
from the more complex logic around dealing with multiple .ngtypecheck files.
A new `TemplateTypeChecker` hosts that logic and interacts with the
`TypeCheckingProgramStrategy` to actually generate and return diagnostics.
The `TypeCheckContext` class, previously the workhorse of template type-
checking, is now solely focused on collecting and generating type-checking
file contents.
A side effect of implementing the new `TypeCheckingProgramStrategy` in this
way is that the API is designed to be suitable for use by the Angular
Language Service as well. The LS also needs to type-check components, but
has its own method for constructing a `ts.Program` with type-checking code.
Note that this commit does not make the actual checking of templates at all
_incremental_ just yet. That will happen in a future commit.
PR Close #36211
2020-03-04 18:50:12 -05:00
|
|
|
"//packages/compiler-cli/src/ngtsc/typecheck",
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//@bazel/typescript",
|
2019-06-22 00:52:00 -04:00
|
|
|
"@npm//@types/node",
|
2020-02-12 05:52:15 -05:00
|
|
|
"@npm//chokidar",
|
2020-01-31 16:07:59 -05:00
|
|
|
"@npm//fs-extra",
|
2019-11-13 02:17:06 -05:00
|
|
|
"@npm//minimist",
|
2019-05-09 17:51:51 -04:00
|
|
|
"@npm//reflect-metadata",
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//tsickle",
|
|
|
|
"@npm//typescript",
|
2017-07-21 17:20:34 -04:00
|
|
|
],
|
|
|
|
)
|
2018-03-13 14:00:53 -04:00
|
|
|
|
2019-12-28 19:37:59 -05:00
|
|
|
pkg_npm(
|
2018-03-13 14:00:53 -04:00
|
|
|
name = "npm_package",
|
|
|
|
srcs = [
|
|
|
|
"package.json",
|
|
|
|
],
|
2018-06-05 14:38:46 -04:00
|
|
|
tags = [
|
|
|
|
"release-with-framework",
|
|
|
|
],
|
2018-12-11 19:53:42 -05:00
|
|
|
# Do not add more to this list.
|
|
|
|
# Dependencies on the full npm_package cause long re-builds.
|
2019-01-22 12:46:51 -05:00
|
|
|
visibility = [
|
2020-02-04 14:45:40 -05:00
|
|
|
"//integration:__pkg__",
|
2019-01-22 12:46:51 -05:00
|
|
|
"//packages/compiler-cli/integrationtest:__pkg__",
|
|
|
|
],
|
2018-07-16 03:49:56 -04:00
|
|
|
deps = [
|
|
|
|
":compiler-cli",
|
2019-03-20 09:47:58 -04:00
|
|
|
"//packages/compiler-cli/ngcc",
|
2018-07-16 03:49:56 -04:00
|
|
|
],
|
2018-03-13 14:00:53 -04:00
|
|
|
)
|
2020-02-26 12:09:35 -05:00
|
|
|
|
|
|
|
ts_api_guardian_test(
|
|
|
|
name = "error_code_api",
|
2020-03-12 07:36:28 -04:00
|
|
|
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/diagnostics/src/error_code.d.ts",
|
2020-02-26 12:09:35 -05:00
|
|
|
data = [
|
|
|
|
":npm_package",
|
|
|
|
"//goldens:public-api",
|
|
|
|
],
|
2020-03-12 07:36:28 -04:00
|
|
|
golden = "angular/goldens/public-api/compiler-cli/error_code.d.ts",
|
2020-02-26 12:09:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
ts_api_guardian_test(
|
|
|
|
name = "compiler_options_api",
|
2020-03-12 07:36:28 -04:00
|
|
|
actual = "angular/packages/compiler-cli/npm_package/src/ngtsc/core/api/src/public_options.d.ts",
|
2020-02-26 12:09:35 -05:00
|
|
|
data = [
|
|
|
|
":npm_package",
|
|
|
|
"//goldens:public-api",
|
|
|
|
],
|
2020-03-12 07:36:28 -04:00
|
|
|
golden = "angular/goldens/public-api/compiler-cli/compiler_options.d.ts",
|
2020-02-26 12:09:35 -05:00
|
|
|
)
|