angular-docs-cn/dev-infra/bazel
Paul Gschwendtner 9af5abba86 feat(dev-infra): add bazel rule for extracting JavaScript module flavors from targets (#42809)
Introduces a rule that collects declared JavaScript module output files
from a list of dependencies based on a configurable JavaScript module
provider. The extracted outputs are exposed within the `DefaultInfo` provider.

Targets defined using this rule can be used as input for rules that
require JavaScript sources, or if there are multiple JavaScript output
variants defined for a target while for example only the `JSModuleInfo`
outputs are of interest.

As an example: This rule is helpful in combination with `ts_library` and
`ng_module` as those rule expose multiple output flavors (which are
distinguishable by the JavaScript module providers as imported from `providers.bzl`).
i.e. these rules expose flavors for named AMD modules and ECMAScript module output.
If we want to ship a NPM package only using ECMAScript modules for
example, we could extract all `JSEcmaScriptModuleInfo`-denoted output
and feed that into the `pkg_npm` rule, compared to bringing in all
output flavors.

For reference:
https://github.com/bazelbuild/rules_nodejs/blob/stable/packages/typescript/internal/build_defs.bzl#L334-L337

PR Close #42809
2021-07-12 09:42:01 -07:00
..
api-golden fix(dev-infra): api-golden tool does not specify a tsconfig and breaks for consumers (#42737) 2021-07-02 10:08:03 -07:00
browsers refactor(dev-infra): move shared browser bazel setup into dedicated bazel folder (#42268) 2021-06-03 10:37:41 -07:00
remote-execution refactor(dev-infra): switch away from deprecated platform execution properties (#41941) 2021-05-04 21:09:30 -07:00
BUILD.bazel feat(dev-infra): add bazel rule for extracting JavaScript module flavors from targets (#42809) 2021-07-12 09:42:01 -07:00
expand_template.bzl refactor(dev-infra): ng_rollup_bundle rule should leverage `@bazel/rollup` (#37623) 2020-06-22 10:55:28 -07:00
extract_js_module_output.bzl feat(dev-infra): add bazel rule for extracting JavaScript module flavors from targets (#42809) 2021-07-12 09:42:01 -07:00