angular/packages/core/test/linker
Pete Bacon Darwin 2bf5606bbe feat(ivy): i18n - reorganize entry-points for better reuse (#32488)
This is a refactoring that moves the source code around to provide a better
platform for adding the compile-time inlining.

1. Move the global side-effect import from the primary entry-point to a
   secondary entry-point @angular/localize/init.

   This has two benefits: first it allows the top level entry-point to
   contain tree-shakable shareable code; second it gives the side-effect
   import more of an "action" oriented name, which indicates that importing
   it does something tangible

2. Move all the source code into the top src folder, and import the localize
   related functions into the localize/init/index.ts entry-point.

   This allows the different parts of the package to share code without
   a proliferation of secondary entry-points (i.e. localize/utils).

3. Avoid publicly exporting any utilities at this time - the only public
   API at this point are the global `$localize` function and the two runtime
   helpers `loadTranslations()` and `clearTranslations()`.
   This does not mean that we will not expose additional helpers for 3rd
   party tooling in the future, but it avoid us preemptively exposing
   something that we might want to change in the near future.

Notes:

It is not possible to have the `$localize` code in the same Bazel package
as the rest of the code. If we did this, then the bundled `@angular/localize/init`
entry-point code contains all of the helper code, even though most of it is not used.

Equally it is not possible to have the `$localize` types (i.e. `LocalizeFn`
and `TranslateFn`) defined in the `@angular/localize/init` entry-point because
these types are needed for the runtime code, which is inside the primary
entry-point. Importing them from `@angular/localize/init` would run the
side-effect.

The solution is to have a Bazel sub-package at `//packages/localize/src/localize`
which contains these types and the `$localize` function implementation.
The primary `//packages/localize` entry-point imports the types without
any side-effect.
The secondary `//packages/localize/init` entry-point imports the `$localize`
function and attaches it to the global scope as a side-effect, without
bringing with it all the other utility functions.

BREAKING CHANGES:

The entry-points have changed:

* To attach the `$localize` function to the global scope import from
`@angular/localize/init`. Previously it was `@angular/localize`.

* To access the `loadTranslations()` and `clearTranslations()` functions,
import from `@angular/localize`. Previously it was `@angular/localize/run_time`.

PR Close #32488
2019-09-12 15:35:34 -07:00
..
change_detection_integration_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
entry_components_integration_spec.ts test(ivy): ComponentFactoryResolver can resolve any component factory in Ivy (#28465) 2019-01-31 15:55:31 -05:00
inheritance_integration_spec.ts fix(ivy): proper component resolution in case of inheritance (#28439) 2019-02-05 23:29:04 -05:00
integration_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
jit_summaries_integration_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
ng_container_integration_spec.ts feat(ivy): i18n - reorganize entry-points for better reuse (#32488) 2019-09-12 15:35:34 -07:00
ng_module_integration_spec.ts fix(ivy): warn instead of throwing for unknown properties (#32463) 2019-09-06 13:15:03 -04:00
projection_integration_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
query_integration_spec.ts test(core): update query-specific tests in core (#30626) 2019-05-23 10:31:32 -07:00
query_list_spec.ts refactor: Move dom_adapter.ts to @angular/common (#32154) 2019-08-29 21:51:56 -07:00
regression_integration_spec.ts refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
security_integration_spec.ts fix(ivy): warn instead of throwing for unknown properties (#32463) 2019-09-06 13:15:03 -04:00
source_map_integration_node_only_spec.ts refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
system_ng_module_factory_loader_spec.ts fix(ivy): don't load factories when using Ivy (#28685) 2019-04-12 11:26:24 -07:00
view_injector_integration_spec.ts test(ivy): run view_injector_integration tests on node (#28593) 2019-02-08 09:25:50 -08:00