Skip to content

Latest commit

 

History

History
345 lines (238 loc) · 19 KB

File metadata and controls

345 lines (238 loc) · 19 KB

Contents

//typescript:providers.bzl

TypeScript helpers

TsCompilerInfo

TsCompilerInfo(bin, transpile_bin, runtime_cjs, runtime_js)

TypeScript compiler

FIELDS

Name Description
bin Compile executable.
transpile_bin JS transpile executable.
runtime_cjs List of runtime CjsInfo.
runtime_js Runtime files.

TsInfo

TsInfo(transitive_files)

TypeScript

FIELDS

Name Description
transitive_files Depset of files (descriptors, declarations)

create_ts_info

create_ts_info(cjs_root, files, deps)

PARAMETERS

Name Description Default Value
cjs_root

-

none
files

-

[]
deps

-

[]

declaration_path

declaration_path(path)

PARAMETERS

Name Description Default Value
path

-

none

is_declaration

is_declaration(path)

PARAMETERS

Name Description Default Value
path

-

none

is_json

is_json(path)

PARAMETERS

Name Description Default Value
path

-

none

js_path

js_path(path, jsx)

PARAMETERS

Name Description Default Value
path

-

none
jsx

-

"react"

map_path

map_path(path)

PARAMETERS

Name Description Default Value
path

-

none

module

module(module)

PARAMETERS

Name Description Default Value
module

-

none

target

target(language)

PARAMETERS

Name Description Default Value
language

-

none

//typescript:rules.bzl

TypeScript rules

js_import_ts

js_import_ts(name, dep)

Use TS as JS.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
dep - Label required

ts_compiler

ts_compiler(name, bin, runtime, transpile_bin)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
bin Declaration compiler executable. Label required
runtime Runtime library. Label optional None
transpile_bin JS compiler executable. Label required

ts_export

ts_export(name, dep, deps, extra_deps, global_deps, package_name)

Add dependencies, or use alias.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
dep JavaScript library. Label required
deps Dependencies to add. List of labels optional []
extra_deps Extra dependencies to add. List of labels optional []
global_deps Global dependencies to add. List of labels optional []
package_name Dependency name. Defaults to root's name. String optional ""

ts_import

ts_import(name, compile_deps, declarations, deps, js, js_prefix, root)

TypeScript library with pre-existing declaration files.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
compile_deps Compile-only dependencies. List of labels optional []
declarations Typescript declarations List of labels optional []
deps Dependencies List of labels optional []
js JavaScript List of labels optional []
js_prefix Prefix to add to JavaScript files. String optional ""
root CommonJS root Label optional None

ts_library

ts_library(name, compile_deps, compiler, config, config_dep, data, declaration_prefix, deps,
           js_prefix, jsx, module, root, srcs, strip_prefix, target)

TypeScript library.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
compile_deps Compile-only dependencies. List of labels optional []
compiler Compiler. Label optional :tsc
config Tsconfig path. String optional ""
config_dep Tsconfig dependency. Label optional None
data Runfile files. These are added to normal runfiles tree, not CommonJS packages. List of labels optional []
declaration_prefix Declaration output directory. String optional ""
deps JS and TS dependencies List of labels optional []
js_prefix JavaScript output directory. String optional ""
jsx How JSX is emitted: react (default) or preserve String optional "react"
module Module type. By default, uses //javascript:module. String optional ""
root CommonJS package root. Label optional None
srcs TypeScript sources. If providing directories, the *_prefix attributes must be used to separate the outputs. List of labels optional []
strip_prefix Source root. String optional ""
target Target language. By default, uses //javascript:language. String optional ""

configure_ts_compiler

configure_ts_compiler(name, ts, tslib, visibility)

Configure TypeScript compiler.

PARAMETERS

Name Description Default Value
name Name to use for targets. none
ts Typescript library. none
tslib Tslib library. None
visibility Visibility. None

//typescript:workspace.bzl

TypeScript repositories

ts_directory_npm_plugin

ts_directory_npm_plugin()

ts_npm_plugin

ts_npm_plugin(exclude_suffixes)

PARAMETERS

Name Description Default Value
exclude_suffixes

-

[]