Run Angular's AOT template compiler
Bazel

Run Angular's AOT template compiler


is_ivy_enabled

is_ivy_enabled(ctx)

Determine if the ivy compiler should be used to by the ng_module.

Returns: Boolean, Whether the ivy compiler should be used.

Attributes

ctx

Unknown; Required

skylark rule execution context


ngc_compile_action

ngc_compile_action(ctx, label, inputs, outputs, messages_out, tsconfig_file, node_opts, locale, i18n_args, dts_bundles_out, compile_mode)

Helper function to create the ngc action.

This is exposed for google3 to wire up i18n replay rules, and is not intended as part of the public API.

Returns: the parameters of the compilation which will be used to replay the ngc action for i18N.

Attributes

ctx

Unknown; Required

skylark context

label

Unknown; Required

the label of the ng_module being compiled

inputs

Unknown; Required

passed to the ngc action's inputs

outputs

Unknown; Required

passed to the ngc action's outputs

messages_out

Unknown; Required

produced xmb files

tsconfig_file

Unknown; Required

tsconfig file with settings used for the compilation

node_opts

Unknown; Required

list of strings, extra nodejs options.

locale

Unknown; Optional

i18n locale, or None

i18n_args

List of strings; Optional

additional command-line arguments to ngc

dts_bundles_out

Unknown; Optional

produced flattened dts file

compile_mode

String; Optional


ng_module_impl

ng_module_impl(ctx, ts_compile_actions)

Implementation function for the ng_module rule.

This is exposed so that google3 can have its own entry point that re-uses this and is not meant as a public API.

Returns: the result of the ng_module rule as a dict, suitable for conversion by ts_providers_dict_to_struct

Attributes

ctx

Unknown; Required

the skylark rule context

ts_compile_actions

Unknown; Required

generates all the actions to run an ngc compilation


ng_module_macro

ng_module_macro(tsconfig, **kwargs)

Wraps ng_module to set the default for the tsconfig attribute.

This must be a macro so that the string is converted to a label in the context of the workspace that declares the ng_module target, rather than the workspace that defines ng_module, or the workspace where the build is taking place.

This macro is re-exported as ng_module in the public API.

Attributes

tsconfig

Unknown; Optional

the label pointing to a tsconfig.json file

**kwargs

Unknown; Optional

remaining args to pass to the ng_module rule


ng_module

ng_module(name, deps, srcs, api_extractor, assets, bundle_dts, compiler, entry_point, factories, filter_summaries, flat_module_out_file, generate_ve_shims, inline_resources, ng_xi18n, no_i18n, node_modules, tsconfig, type_check)

Run the Angular AOT template compiler.

This rule extends the ts_library rule.

Attributes

name

Name; Required

A unique name for this rule.

deps

List of labels; Optional; Default is []

Targets that are imported by this target

srcs

List of labels; Optional; Default is []

api_extractor

Label; Optional; Default is

assets

List of labels; Optional; Default is []

.html and .css files needed by the Angular compiler

bundle_dts

Boolean; Optional; Default is False

compiler

Label; Optional; Default is

Sets a different ngc compiler binary to use for this library.

    The default ngc compiler depends on the `@npm//@angular/bazel`
    target which is setup for projects that use bazel managed npm deps that
    fetch the @angular/bazel npm package. It is recommended that you use
    the workspace name `@npm` for bazel managed deps so the default
    compiler works out of the box. Otherwise, you'll have to override
    the compiler attribute manually.
entry_point

Label; Optional

factories

List of labels; Optional; Default is []

filter_summaries

Boolean; Optional; Default is False

flat_module_out_file

String; Optional; Default is ''

generate_ve_shims

Boolean; Optional; Default is False

inline_resources

Boolean; Optional; Default is True

ng_xi18n

Label; Optional; Default is

no_i18n

Boolean; Optional; Default is False

node_modules

Label; Optional; Default is @npm//typescript:typescript__typings

The npm packages which should be available during the compile.

    The default value of `@npm//typescript:typescript__typings` is
    for projects that use bazel managed npm deps. It is recommended
    that you use the workspace name `@npm` for bazel managed deps so the
    default value works out of the box. Otherwise, you'll have to
    override the node_modules attribute manually. This default is in place
    since code compiled by ng_module will always depend on at least the
    typescript default libs which are provided by
    `@npm//typescript:typescript__typings`.

    This attribute is DEPRECATED. As of version 0.18.0 the recommended
    approach to npm dependencies is to use fine grained npm dependencies
    which are setup with the `yarn_install` or `npm_install` rules.

    For example, in targets that used a `//:node_modules` filegroup,

    ```
    ng_module(
      name = "my_lib",
      ...
      node_modules = "//:node_modules",
    )
    ```

    which specifies all files within the `//:node_modules` filegroup
    to be inputs to the `my_lib`. Using fine grained npm dependencies,
    `my_lib` is defined with only the npm dependencies that are
    needed:

    ```
    ng_module(
      name = "my_lib",
      ...
      deps = [
          "@npm//@types/foo",
          "@npm//@types/bar",
          "@npm//foo",
          "@npm//bar",
          ...
      ],
    )
    ```

    In this case, only the listed npm packages and their
    transitive deps are includes as inputs to the `my_lib` target
    which reduces the time required to setup the runfiles for this
    target (see https://github.com/bazelbuild/bazel/issues/5153).
    The default typescript libs are also available via the node_modules
    default in this case.

    The @npm external repository and the fine grained npm package
    targets are setup using the `yarn_install` or `npm_install` rule
    in your WORKSPACE file:

    yarn_install(
      name = "npm",
      package_json = "//:package.json",
      yarn_lock = "//:yarn.lock",
    )
tsconfig

Label; Optional

type_check

Boolean; Optional; Default is True