2020-05-06 16:54:44 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								load("@npm//@babel/cli:index.bzl", "babel")
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-11 18:11:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-16 10:19:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								package(default_visibility = ["//visibility:public"])
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ts_library(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    name = "test_lib",
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-15 23:24:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    testonly = True,
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    srcs = glob(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ["**/*.ts"],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        exclude = ["integration/**/*.ts"],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ),
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps = [
							 | 
						
					
						
							
								
									
										
										
										
											2019-11-04 19:29:01 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler",
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-04 08:43:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli",
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/ngcc",
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-06 15:35:13 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/ngcc/test/helpers",
							 | 
						
					
						
							
								
									
										
										
										
											2019-07-18 21:05:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/diagnostics",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/file_system",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/file_system/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-18 09:48:15 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/imports",
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-03 09:52:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/incremental/semantic_graph",
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-14 20:06:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/logging/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-18 09:48:15 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/partial_evaluator",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/reflection",
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-03 09:52:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/sourcemaps",
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:55:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/transform",
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-28 20:48:33 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/translator",
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//@types/convert-source-map",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//convert-source-map",
							 | 
						
					
						
							
								
									
										
										
										
											2019-08-28 15:01:39 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//dependency-graph",
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//magic-string",
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-16 21:07:30 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//sourcemap-codec",
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//typescript",
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-15 16:35:09 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//yargs",
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								jasmine_node_test(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    name = "test",
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-07 23:56:49 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    bootstrap = ["//tools/testing:node_no_angular_es5"],
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    data = [
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-04 12:27:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-16 08:49:56 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ":test_lib",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ts_library(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    name = "integration_lib",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    testonly = True,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    srcs = glob(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ["integration/**/*.ts"],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    deps = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/ngcc",
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-06 15:35:13 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/ngcc/test/helpers",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/file_system",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/file_system/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-14 20:06:12 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/logging/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/compiler-cli/src/ngtsc/testing",
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//rxjs",
							 | 
						
					
						
							
								
									
										
											 
										 
										
											
												feat(ngcc): add a migration for undecorated child classes (#33362)
In Angular View Engine, there are two kinds of decorator inheritance:
1) both the parent and child classes have decorators
This case is supported by InheritDefinitionFeature, which merges some fields
of the definitions (such as the inputs or queries).
2) only the parent class has a decorator
If the child class is missing a decorator, the compiler effectively behaves
as if the parent class' decorator is applied to the child class as well.
This is the "undecorated child" scenario, and this commit adds a migration
to ngcc to support this pattern in Ivy.
This migration has 2 phases. First, the NgModules of the application are
scanned for classes in 'declarations' which are missing decorators, but
whose base classes do have decorators. These classes are the undecorated
children. This scan is performed recursively, so even if a declared class
has a base class that itself inherits a decorator, this case is handled.
Next, a synthetic decorator (either @Component or @Directive) is created
on the child class. This decorator copies some critical information such
as 'selector' and 'exportAs', as well as supports any decorated fields
(@Input, etc). A flag is passed to the decorator compiler which causes a
special feature `CopyDefinitionFeature` to be included on the compiled
definition. This feature copies at runtime the remaining aspects of the
parent definition which `InheritDefinitionFeature` does not handle,
completing the "full" inheritance of the child class' decorator from its
parent class.
PR Close #33362
											
										 
										
											2019-10-23 12:00:49 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "@npm//typescript",
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-08 22:04:20 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# As of version 10, the release packages do not contain esm5 output anymore. The ngcc integration
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# tests intend to test ES5 features though, so we downlevel the flat esm2015 file to ES5 using
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Babel. We can then link that into the mock file system as if the Angular core package is still
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# built with previous APF versions where esm5 output was shipped. This allows us to ensure that ngcc
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# properly processes libraries with esm5 output.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# **Note**: We are using Babel instead of `tsc` as TypeScript does not allow us to downlevel the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# file without setting the module resolution to either `amd` or `system`. We want to preserve ES
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# modules.
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-06 16:54:44 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								babel(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    name = "fesm5_angular_core",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    outs = ["fesm5_angular_core.js"],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    args = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "$(execpath //packages/core:npm_package)/fesm2015/core.js",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "--presets @babel/preset-env",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "--out-file $(execpath fesm5_angular_core.js)",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    data = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/core:npm_package",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "@npm//@babel/preset-env",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								jasmine_node_test(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    name = "integration",
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    timeout = "long",
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-07 23:56:49 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    bootstrap = ["//tools/testing:node_no_angular_es5"],
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    data = [
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-06 16:54:44 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ":fesm5_angular_core",
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        "//packages/common:npm_package",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "//packages/core:npm_package",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "@npm//rxjs",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-06 20:22:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shard_count = 4,
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    tags = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # Disabled in AOT mode because we want ngcc to compile non-AOT Angular packages.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "no-ivy-aot",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-03 09:52:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    templated_args = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "--bazel_patch_module_resolver",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-20 13:47:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    deps = [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ":integration_lib",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "@npm//canonical-path",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        "@npm//convert-source-map",
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 |