angular-docs-cn/tools
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
..
brotli-cli build: convert entry_point to label (#30627) 2019-06-11 00:03:11 +00:00
build
cjs-jasmine
gulp-tasks docs(zone.js): update release docs instructions (#32128) 2019-08-13 16:55:03 -07:00
material-ci ci: disable hammerjs tests of components repository (#32485) 2019-09-10 15:19:31 -04:00
ngcontainer
npm style: add file header (#28871) 2019-02-28 12:06:36 -08:00
public_api_guard feat(ivy): i18n - reorganize entry-points for better reuse (#32488) 2019-09-12 15:35:34 -07:00
rxjs build: update to rules_nodejs 0.32.2 (#31325) 2019-07-01 14:16:42 -07:00
size-tracking build: enforce proper compile mode for size-tracking test (#32613) 2019-09-11 20:22:28 -04:00
source-map-test
symbol-extractor build: convert entry_point to label (#30627) 2019-06-11 00:03:11 +00:00
testing build(bazel): update to nodejs rules 0.27.9 (#29647) 2019-04-02 10:27:14 -07:00
ts-api-guardian build: TypeScript 3.5 upgrade (#31615) 2019-07-25 17:05:23 -07:00
tslint build: remove unused rollup.config.js files (#28646) 2019-02-14 19:28:08 +00:00
validate-commit-message build: remove the deprecated `aio` commit message scope (#32341) 2019-08-27 09:06:35 -07:00
yarn
BUILD.bazel build: add tsconfig-test to dependency for tsconfig in core/test/strict_types (#31471) 2019-07-12 11:38:16 -04:00
bazel_stamp_vars.js build: add pre-release check that validates the version name (#29551) 2019-03-27 12:26:13 -07:00
check-environment.js
defaults.bzl build: fix build failures with worker mode cache and @types/events (#31325) 2019-07-01 14:16:43 -07:00
jasmine-seed-generator.js
jsconfig.json
postinstall-patches.js build(bazel): update to latest stable chromium 74 on osx and linux for karma under bazel (#30502) 2019-05-16 14:38:14 -07:00
rebase-pr.js ci: rebase PRs on target branch (#29215) 2019-03-12 11:34:58 -07:00
rollup_bundle_commonjs_ignoreGlobal.patch fix(zone.js): restore definition of global (#31453) 2019-07-09 09:34:50 -07:00
tsconfig-test.json
tsconfig.json build: ts-api-guardian tsconfig warning with bazel (#27583) 2018-12-13 11:01:48 -08:00
types.d.ts
utils.inc
verify-codeownership.js ci: check code-ownership on CI (#32577) 2019-09-10 17:30:55 -04:00