angular-docs-cn/packages/core/test
Alex Rickabaugh d4cee514f6 refactor(ivy): obviate the Bazel component of the ivy_switch (#26550)
Originally, the ivy_switch mechanism used Bazel genrules to conditionally
compile one TS file or another depending on whether ngc or ngtsc was the
selected compiler. This was done because we wanted to avoid importing
certain modules (and thus pulling them into the build) if Ivy was on or
off. This mechanism had a major drawback: ivy_switch became a bottleneck
in the import graph, as it both imports from many places in the codebase
and is imported by many modules in the codebase. This frequently resulted
in cyclic imports which caused issues both with TS and Closure compilation.

It turns out ngcc needs both code paths in the bundle to perform the switch
during its operation anyway, so import switching was later abandoned. This
means that there's no real reason why the ivy_switch mechanism needed to
operate at the Bazel level, and for the ivy_switch file to be a bottleneck.

This commit removes the Bazel-level ivy_switch mechanism, and introduces
an additional TypeScript transform in ngtsc (and the pass-through tsc
compiler used for testing JIT) to perform the same operation that ngcc
does, and flip the switch during ngtsc compilation. This allows the
ivy_switch file to be removed, and the individual switches to be located
directly next to their consumers in the codebase, greatly mitigating the
circular import issues and making the mechanism much easier to use.

As part of this commit, the tag for marking switched variables was changed
from __PRE_NGCC__ to __PRE_R3__, since it's no longer just ngcc which
flips these tags. Most variables were renamed from R3_* to SWITCH_* as well,
since they're referenced mostly in render2 code.

Test strategy: existing test coverage is more than sufficient - if this
didn't work correctly it would break the hello world and todo apps.

PR Close #26550
2018-10-19 09:23:05 -07:00
..
animation build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
bundling refactor(ivy): obviate the Bazel component of the ivy_switch (#26550) 2018-10-19 09:23:05 -07:00
change_detection refactor: ensure all 'TODO's are consistent (#23252) 2018-04-13 13:11:01 -07:00
debug build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
di fix(ivy): ignore imports without ngInjectorDef in r3_injector (#24862) 2018-07-20 11:48:36 -07:00
dom fix(platform-server): add styles to elements correctly (#22527) 2018-03-14 14:12:31 -07:00
linker fix(core): fix tests for uninitialized @Output error (#19116) 2018-08-02 09:37:21 -07:00
metadata Revert "feat(core): add support for using async/await with Jasmine" (#25096) 2018-07-25 11:44:56 -07:00
reflection build: upgrade jasmine (and related typings) to latest version (#19904) 2018-07-06 13:48:02 -07:00
render3 refactor(ivy): obviate the Bazel component of the ivy_switch (#26550) 2018-10-19 09:23:05 -07:00
sanitization feat(ivy): bridge compile instructions to include sanitization helpers (#24938) 2018-07-23 08:49:52 -07:00
testability fix(core): In Testability.whenStable update callback, pass more complete (#25010) 2018-08-06 13:49:19 -07:00
util feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573) 2018-03-19 21:51:51 -07:00
view fix(core): mark NgModule as not the root if APP_ROOT is set to false (#24814) 2018-07-10 11:09:36 -07:00
zone build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
BUILD.bazel build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920) 2018-09-18 13:05:38 -07:00
application_init_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
application_module_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
application_ref_integration_spec.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
application_ref_spec.ts build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
component_fixture_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
dev_mode_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
directive_lifecycle_integration_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
error_handler_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
event_emitter_spec.ts fix(core): fix proper propagation of subscriptions in EventEmitter (#22016) 2018-02-06 07:56:33 -08:00
fake_async_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
forward_ref_integration_spec.ts build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
ivy_local_empty_spec.ts ci(ivy): configure CI environments for Ivy JIT and AOT (#24309) 2018-06-08 13:34:27 -07:00
spies.ts build: fix file paths after moving modules/@angular/* to packages/* 2017-03-08 16:29:28 -08:00
test_bed_async_spec.ts fix(ivy): stub TestBed.compileComponents implementation (#26506) 2018-10-17 13:08:14 -07:00
test_bed_spec.ts refactor(ivy): use context discovery in TestBed implementation (#26211) 2018-10-11 13:01:28 -07:00
testing_internal_spec.ts fix(core): use addCustomEqualityTester instead of overriding toEqual (#22983) 2018-07-03 08:35:15 -07:00
util_spec.ts build(core): remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00