{"//":"note that typescript doesn't follow semver, so technically anything 3.6 or higher might break us","bin":{"tsc_wrapped":"./internal/tsc_wrapped/tsc_wrapped.js","ts_project_options_validator":"./internal/ts_project_options_validator.js"},"bugs":{"url":"https://github.com/bazelbuild/rules_nodejs/issues"},"dist":{"shasum":"4a1a21534e1bb0888638166653e3b0523a47c6b5","tarball":"https://registry.npmjs.org/@bazel/typescript/-/typescript-3.0.0-rc.0.tgz","fileCount":102,"integrity":"sha512-qb6zX99eR+uUA+WWGUZGtkDM4A0AJEEUA2pPcDuOW/zkpoVostI71gHQVp2EyAf6lKsPMCCJ28q/UsaNBVnLcw==","signatures":[{"sig":"MEUCIQDWm74WU+HFwzUzkAYUr5+pYIkAq9FJjtzivnOhemL+2AIgf9apnO/TGyzcM9gVHkXDZR/3Ggc9rdE/0b7a6Vdwuj0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19440000,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf08qmCRA9TVsSAnZWagAAOXEP+wcy7EJIMo67iwkK9xU/\nd90ygy4CeTzc8u4BO40ufoYdpH+LHVAocN90PkXpLu4gG6gdsk1k6PKKaiFW\nVra5pMTzcdTApWMDMbg88oc2IT34B2VbbBrarWwclqqnTjPbey5zWB6zLwsS\nAZCoR5pB6PSULKIAqKu/b9HOh17mtnhWgaPU8aLoAmFB7n37SM9Yk0sh0H2L\nizNCE+n4Yhn3Lcamn016yBCS9bWiI2LbZ/axQJEFj2rYw4uVU1tv37tMDJu6\nYWB6CvdL73GFj6csifG1U6IlhISgOMtlfpow0VQjKeqhTxGCtp3f4b3By8+6\nOIRmIqOY9/iezzXDXbvyxVtmfZvN84KEn/UxHiYtF63RAS0YMSoeo3fCD/S4\nJ759E7Nrgt5gQq3OhLvG17wDFqBwU8mGAA9IkAnEgkfrZgN+1ktew77MRH7R\nRxXdpXcRtTQzUJlXrm4A9id5VmOpSJa9m4syzRJLPzU1mDIbZurQJnFD7lGY\neC4NVybY3E41mi+CEj0fOgobqLH8TEgw+iG2Zz+/zjUCAfHL5Mg1GGWFI9/s\nXm9hGt7qr7O+efOcxPg5UUl+1ggPlGNlxF5w7lgVOd6xCgK0YjKJYSulCzFI\nfnZYPIczpqdZtoOryeUK7www2wt6EWhnjRvhQpHW2IhUOm5Y1BfEs4drsAY8\n7Slx\r\n=jrLL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./internal/tsc_wrapped/index.js","name":"@bazel/typescript","readme":"# TypeScript rules for Bazel\n\nThe TypeScript rules integrate the TypeScript compiler with Bazel.\n\n\n## Alternatives\n\nThis package provides Bazel wrappers around the TypeScript compiler.\n\nAt a high level, there are three alternatives provided: `tsc`, `ts_project`, `ts_library`.\nThis section describes the trade-offs between these rules.\n\n`tsc` is the raw TypeScript compiler published by the team at Microsoft.\nLike any npm package that exposes a binary, rules_nodejs will generate an `index.bzl` file allowing\nyou to run `tsc`.\n\nTo use it, add the load statement `load(\"@npm//typescript:index.bzl\", \"tsc\")` to your BUILD file.\nThen call it, using the [`npm_package_bin`](Built-ins#npm_package_bin) documentation.\n\nThe only reason to use raw `tsc` is if you want to compile an opaque directory of `.ts` files and cannot enumerate them to Bazel.\n(For example if the `.ts` files are generated by some tool).\nThis will produce an opaque directory of `.js` file outputs, which you won't be able to individually reference.\nAny other use case for `tsc` is better served by using `ts_project`.\n\n`ts_project` simply runs `tsc --project`, with Bazel knowing which outputs to expect based on the TypeScript compiler options, and with interoperability with other TypeScript rules via a Bazel Provider (DeclarationInfo) that transmits the type information.\nIt is intended as an easy on-boarding for existing TypeScript code and should be familiar if your background is in frontend ecosystem idioms.\nAny behavior of `ts_project` should be reproducible outside of Bazel, with a couple of caveats noted in the rule documentation below.\n\n`ts_library` is an open-sourced version of the rule used to compile TS code at Google.\nIt should be familiar if your background is in Bazel idioms.\nIt is very complex, involving code generation of the `tsconfig.json` file, a custom compiler binary, and a lot of extra features.\nIt is also opinionated, and may not work with existing TypeScript code. For example:\n\n- Your TS code must compile under the `--declaration` flag so that downstream libraries depend only on types, not implementation. This makes Bazel faster by avoiding cascading rebuilds in cases where the types aren't changed.\n- We control the output format and module syntax so that downstream rules can rely on them.\n\nOn the other hand, `ts_library` is also fast and optimized.\nWe keep a running TypeScript compile running as a daemon, using Bazel workers.\nThis process avoids re-parse and re-JIT of the >1MB `typescript.js` and keeps cached bound ASTs for input files which saves time.\nWe also produce JS code which can be loaded faster (using named AMD module format) and which can be consumed by the Closure Compiler (via integration with [tsickle](https://github.com/angular/tsickle)).\n\n\n## Installation\n\nAdd a `devDependency` on `@bazel/typescript`\n\n```sh\n$ yarn add -D @bazel/typescript\n# or\n$ npm install --save-dev @bazel/typescript\n```\n\nWatch for any `peerDependency` warnings - we assume you have already installed the `typescript` package from npm.\n\nCreate a `BUILD.bazel` file in your workspace root. If your `tsconfig.json` file is in the root, use\n\n```python\nexports_files([\"tsconfig.json\"], visibility = [\"//visibility:public\"])\n```\n\notherwise create an alias:\n\n```python\nalias(\n    name = \"tsconfig.json\",\n    actual = \"//path/to/my:tsconfig.json\",\n)\n```\n\nMake sure to remove the `--noEmit` compiler option from your `tsconfig.json`. This is not compatible with the `ts_library` rule.\n\n\n## Self-managed npm dependencies\n\nWe recommend you use Bazel managed dependencies, but if you would like\nBazel to also install a `node_modules` in your workspace you can also\npoint the `node_repositories` repository rule in your `WORKSPACE` file to\nyour `package.json`.\n\n```python\nnode_repositories(package_json = [\"//:package.json\"])\n```\n\nYou can then run `yarn` in your workspace with:\n\n```sh\n$ bazel run @nodejs//:yarn_node_repositories\n```\n\nTo use your workspace `node_modules` folder as a dependency in `ts_library` and\nother rules, add the following to your root `BUILD.bazel` file:\n\n```python\nfilegroup(\n    name = \"node_modules\",\n    srcs = glob(\n        include = [\n          \"node_modules/**/*.js\",\n          \"node_modules/**/*.d.ts\",\n          \"node_modules/**/*.json\",\n          \"node_modules/.bin/*\",\n        ],\n        exclude = [\n          # Files under test & docs may contain file names that\n          # are not legal Bazel labels (e.g.,\n          # node_modules/ecstatic/test/public/中文/檔案.html)\n          \"node_modules/**/test/**\",\n          \"node_modules/**/docs/**\",\n          # Files with spaces in the name are not legal Bazel labels\n          \"node_modules/**/* */**\",\n          \"node_modules/**/* *\",\n        ],\n    ),\n)\n\n# Create a tsc_wrapped compiler rule to use in the ts_library\n# compiler attribute when using self-managed dependencies\nnodejs_binary(\n    name = \"@bazel/typescript/tsc_wrapped\",\n    entry_point = \"@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js\",\n    # Point bazel to your node_modules to find the entry point\n    node_modules = \"//:node_modules\",\n)\n```\n\nSee <https://github.com/bazelbuild/rules_nodejs#dependencies> for more information on\nmanaging npm dependencies with Bazel.\n\n\n## Customizing the TypeScript compiler binary\n\nAn example use case is needing to increase the NodeJS heap size used for compilations.\n\nSimilar to above, you declare your own binary for running `tsc_wrapped`, e.g.:\n\n```python\nnodejs_binary(\n    name = \"tsc_wrapped_bin\",\n    entry_point = \"@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js\",\n    templated_args = [\n        \"--node_options=--max-old-space-size=2048\",\n    ],\n    data = [\n        \"@npm//protobufjs\",\n        \"@npm//source-map-support\",\n        \"@npm//tsutils\",\n        \"@npm//typescript\",\n        \"@npm//@bazel/typescript\",\n    ],\n)\n```\n\nthen refer to that target in the `compiler` attribute of your `ts_library` rule.\n\nNote that `nodejs_binary` targets generated by `npm_install`/`yarn_install` can include data dependencies\non packages which aren't declared as dependencies. For example, if you use [tsickle] to generate Closure Compiler-compatible JS, then it needs to be a data dependency of `tsc_wrapped` so that it can be loaded at runtime.\n\n[tsickle](https://github.com/angular/tsickle)\n\n\n## Usage\n\n\n### Compiling TypeScript: `ts_library`\n\nThe `ts_library` rule invokes the TypeScript compiler on one compilation unit,\nor \"library\" (generally one directory of source files).\n\nCreate a `BUILD` file next to your sources:\n\n```python\npackage(default_visibility=[\"//visibility:public\"])\nload(\"//@bazel/typescript:index.bzl\", \"ts_library\")\n\nts_library(\n    name = \"my_code\",\n    srcs = glob([\"*.ts\"]),\n    deps = [\"//path/to/other:library\"],\n)\n```\n\nIf your ts_library target has npm dependencies you can specify these\nwith fine grained npm dependency targets created by the `yarn_install` or\n`npm_install` rules:\n\n```python\nts_library(\n    name = \"my_code\",\n    srcs = glob([\"*.ts\"]),\n    deps = [\n      \"@npm//@types/node\",\n      \"@npm//@types/foo\",\n      \"@npm//foo\",\n      \"//path/to/other:library\",\n    ],\n)\n```\n\nYou can also use the `@npm//@types` target which will include all\npackages in the `@types` scope as dependencies.\n\nIf you are using self-managed npm dependencies, you can use the\n`node_modules` attribute in `ts_library` and point it to the\n`//:node_modules` filegroup defined in your root `BUILD.bazel` file.\nYou'll also need to override the `compiler` attribute if you do this\nas the Bazel-managed deps and self-managed cannot be used together\nin the same rule.\n\n```python\nts_library(\n    name = \"my_code\",\n    srcs = glob([\"*.ts\"]),\n    deps = [\"//path/to/other:library\"],\n    node_modules = \"//:node_modules\",\n    compiler = \"//:@bazel/typescript/tsc_wrapped\",\n)\n```\n\nTo build a `ts_library` target run:\n\n`bazel build //path/to/package:target`\n\nThe resulting `.d.ts` file paths will be printed. Additionally, the `.js`\noutputs from TypeScript will be written to disk, next to the `.d.ts` files <sup>1</sup>.\n\nNote that the `tsconfig.json` file used for compilation should be the same one\nyour editor references, to keep consistent settings for the TypeScript compiler.\nBy default, `ts_library` uses the `tsconfig.json` file in the workspace root\ndirectory. See the notes about the `tsconfig` attribute in the [ts_library API docs].\n\n> <sup>1</sup> The\n> [declarationDir](https://www.typescriptlang.org/docs/handbook/compiler-options.html)\n> compiler option will be silently overwritten if present.\n\n[ts_library API docs]: http://tsetse.info/api/build_defs.html#ts_library\n\n\n## Accessing JavaScript outputs\n\nThe default output of the `ts_library` rule is the `.d.ts` files.\nThis is for a couple reasons:\n\n- help ensure that downstream rules which access default outputs will not require\n  a cascading re-build when only the implementation changes but not the types\n- make you think about whether you want the `devmode` (named `UMD`) or `prodmode` outputs\n\nYou can access the JS output by adding a `filegroup` rule after the `ts_library`,\nfor example\n\n```python\nts_library(\n    name = \"compile\",\n    srcs = [\"thing.ts\"],\n)\n\nfilegroup(\n    name = \"thing.js\",\n    srcs = [\"compile\"],\n    # Change to es6_sources to get the 'prodmode' JS\n    output_group = \"es5_sources\",\n)\n\nmy_rule(\n    name = \"uses_js\",\n    deps = [\"thing.js\"],\n)\n```\n\n\n## Serving TypeScript for development\n\nThis is now documented in the `@bazel/concatjs` package.\n\n\n## Writing TypeScript code for Bazel\n\nBazel's TypeScript compiler has your workspace path mapped, so you can import\nfrom an absolute path starting from your workspace.\n\n`/WORKSPACE`:\n```python\nworkspace(name = \"myworkspace\")\n```\n\n`/some/long/path/to/deeply/nested/subdirectory.ts`:\n```javascript\nimport {thing} from 'myworkspace/place';\n```\n\nwill import from `/place.ts`.\n\n\nSince this is an extension to the vanilla TypeScript compiler, editors which use the TypeScript language services to provide code completion and inline type checking will not be able to resolve the modules. In the above example, adding\n```json\n\"paths\": {\n    \"myworkspace/*\": [\"*\"]\n}\n```\nto `tsconfig.json` will fix the imports for the common case of using absolute paths.\nSee [path mapping] for more details on the paths syntax.\n\nSimilarly, you can use path mapping to teach the editor how to resolve imports\nfrom `ts_library` rules which set the `module_name` attribute.\n\n\n### Notes\n\nIf you'd like a \"watch mode\", try [ibazel].\n\nAt some point, we plan to release a tool similar to [gazelle] to generate the\n`BUILD` files from your source code.\n\n[gazelle]: https://github.com/bazelbuild/bazel-gazelle\n[ibazel]: https://github.com/bazelbuild/bazel-watcher\n[path mapping]: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping\n\n\n## ts_config\n\n**USAGE**\n\n<pre>\nts_config(<a href=\"#ts_config-name\">name</a>, <a href=\"#ts_config-deps\">deps</a>, <a href=\"#ts_config-src\">src</a>)\n</pre>\n\nAllows a tsconfig.json file to extend another file.\n\nNormally, you just give a single `tsconfig.json` file as the tsconfig attribute\nof a `ts_library` or `ts_project` rule. However, if your `tsconfig.json` uses the `extends`\nfeature from TypeScript, then the Bazel implementation needs to know about that\nextended configuration file as well, to pass them both to the TypeScript compiler.\n\n\n**ATTRIBUTES**\n\n\n<h4 id=\"ts_config-name\">name</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#name\">Name</a>, mandatory*): A unique name for this target.\n\n\n<h4 id=\"ts_config-deps\">deps</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Additional tsconfig.json files referenced via extends\n\nDefaults to `[]`\n\n<h4 id=\"ts_config-src\">src</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>, mandatory*): The tsconfig.json file passed to the TypeScript compiler\n\n\n\n\n## ts_library\n\n**USAGE**\n\n<pre>\nts_library(<a href=\"#ts_library-name\">name</a>, <a href=\"#ts_library-angular_assets\">angular_assets</a>, <a href=\"#ts_library-compiler\">compiler</a>, <a href=\"#ts_library-data\">data</a>, <a href=\"#ts_library-deps\">deps</a>, <a href=\"#ts_library-devmode_module\">devmode_module</a>, <a href=\"#ts_library-devmode_target\">devmode_target</a>,\n           <a href=\"#ts_library-expected_diagnostics\">expected_diagnostics</a>, <a href=\"#ts_library-generate_externs\">generate_externs</a>, <a href=\"#ts_library-internal_testing_type_check_dependencies\">internal_testing_type_check_dependencies</a>,\n           <a href=\"#ts_library-link_workspace_root\">link_workspace_root</a>, <a href=\"#ts_library-module_name\">module_name</a>, <a href=\"#ts_library-module_root\">module_root</a>, <a href=\"#ts_library-node_modules\">node_modules</a>, <a href=\"#ts_library-prodmode_module\">prodmode_module</a>,\n           <a href=\"#ts_library-prodmode_target\">prodmode_target</a>, <a href=\"#ts_library-runtime\">runtime</a>, <a href=\"#ts_library-runtime_deps\">runtime_deps</a>, <a href=\"#ts_library-srcs\">srcs</a>, <a href=\"#ts_library-supports_workers\">supports_workers</a>, <a href=\"#ts_library-tsconfig\">tsconfig</a>, <a href=\"#ts_library-tsickle_typed\">tsickle_typed</a>,\n           <a href=\"#ts_library-use_angular_plugin\">use_angular_plugin</a>)\n</pre>\n\n`ts_library` type-checks and compiles a set of TypeScript sources to JavaScript.\n\nIt produces declarations files (`.d.ts`) which are used for compiling downstream\nTypeScript targets and JavaScript for the browser and Closure compiler.\n\n\n**ATTRIBUTES**\n\n\n<h4 id=\"ts_library-name\">name</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#name\">Name</a>, mandatory*): A unique name for this target.\n\n\n<h4 id=\"ts_library-angular_assets\">angular_assets</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Additional files the Angular compiler will need to read as inputs.\n            Includes .css and .html files\n\nDefaults to `[]`\n\n<h4 id=\"ts_library-compiler\">compiler</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>*): Sets a different TypeScript compiler binary to use for this library.\nFor example, we use the vanilla TypeScript tsc.js for bootstrapping,\nand Angular compilations can replace this with `ngc`.\n\nThe default ts_library compiler depends on the `//@bazel/typescript`\ntarget which is setup for projects that use bazel managed npm deps and\ninstall the @bazel/typescript npm package.\n\nDefaults to `//@bazel/typescript/bin:tsc_wrapped`\n\n<h4 id=\"ts_library-data\">data</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*)\n\nDefaults to `[]`\n\n<h4 id=\"ts_library-deps\">deps</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Compile-time dependencies, typically other ts_library targets\n\nDefaults to `[]`\n\n<h4 id=\"ts_library-devmode_module\">devmode_module</h4>\n\n(*String*): Set the typescript `module` compiler option for devmode output.\n\nThis value will override the `module` option in the user supplied tsconfig.\n\nDefaults to `\"umd\"`\n\n<h4 id=\"ts_library-devmode_target\">devmode_target</h4>\n\n(*String*): Set the typescript `target` compiler option for devmode output.\n\nThis value will override the `target` option in the user supplied tsconfig.\n\nDefaults to `\"es2015\"`\n\n<h4 id=\"ts_library-expected_diagnostics\">expected_diagnostics</h4>\n\n(*List of strings*)\n\nDefaults to `[]`\n\n<h4 id=\"ts_library-generate_externs\">generate_externs</h4>\n\n(*Boolean*)\n\nDefaults to `True`\n\n<h4 id=\"ts_library-internal_testing_type_check_dependencies\">internal_testing_type_check_dependencies</h4>\n\n(*Boolean*): Testing only, whether to type check inputs that aren't srcs.\n\nDefaults to `False`\n\n<h4 id=\"ts_library-link_workspace_root\">link_workspace_root</h4>\n\n(*Boolean*): Link the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'.\n    If source files need to be required then they can be copied to the bin_dir with copy_to_bin.\n\nDefaults to `False`\n\n<h4 id=\"ts_library-module_name\">module_name</h4>\n\n(*String*)\n\nDefaults to `\"\"`\n\n<h4 id=\"ts_library-module_root\">module_root</h4>\n\n(*String*)\n\nDefaults to `\"\"`\n\n<h4 id=\"ts_library-node_modules\">node_modules</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>*): The npm packages which should be available during the compile.\n\nThe default value of `//typescript:typescript__typings` is setup\nfor projects that use bazel managed npm deps. This default is in place\nsince ts_library will always depend on at least the typescript\ndefault libs which are provided by `//typescript:typescript__typings`.\n\nThis attribute is DEPRECATED. As of version 0.18.0 the recommended\napproach to npm dependencies is to use fine grained npm dependencies\nwhich are setup with the `yarn_install` or `npm_install` rules.\n\nFor example, in targets that used a `//:node_modules` filegroup,\n\n```\nts_library(\n    name = \"my_lib\",\n    ...\n    node_modules = \"//:node_modules\",\n)\n```\n\nwhich specifies all files within the `//:node_modules` filegroup\nto be inputs to the `my_lib`. Using fine grained npm dependencies,\n`my_lib` is defined with only the npm dependencies that are\nneeded:\n\n```\nts_library(\n    name = \"my_lib\",\n    ...\n    deps = [\n        \"@npm//@types/foo\",\n        \"@npm//@types/bar\",\n        \"@npm//foo\",\n        \"@npm//bar\",\n        ...\n    ],\n)\n```\n\nIn this case, only the listed npm packages and their\ntransitive deps are includes as inputs to the `my_lib` target\nwhich reduces the time required to setup the runfiles for this\ntarget (see https://github.com/bazelbuild/bazel/issues/5153).\nThe default typescript libs are also available via the node_modules\ndefault in this case.\n\nThe @npm external repository and the fine grained npm package\ntargets are setup using the `yarn_install` or `npm_install` rule\nin your WORKSPACE file:\n\n```\nyarn_install(\n    name = \"npm\",\n    package_json = \"//:package.json\",\n    yarn_lock = \"//:yarn.lock\",\n)\n```\n\nDefaults to `@npm//typescript:typescript__typings`\n\n<h4 id=\"ts_library-prodmode_module\">prodmode_module</h4>\n\n(*String*): Set the typescript `module` compiler option for prodmode output.\n\nThis value will override the `module` option in the user supplied tsconfig.\n\nDefaults to `\"esnext\"`\n\n<h4 id=\"ts_library-prodmode_target\">prodmode_target</h4>\n\n(*String*): Set the typescript `target` compiler option for prodmode output.\n\nThis value will override the `target` option in the user supplied tsconfig.\n\nDefaults to `\"es2015\"`\n\n<h4 id=\"ts_library-runtime\">runtime</h4>\n\n(*String*)\n\nDefaults to `\"browser\"`\n\n<h4 id=\"ts_library-runtime_deps\">runtime_deps</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*)  The dependencies of this attribute must provide: JsInfo\n\n\nDefaults to `[]`\n\n<h4 id=\"ts_library-srcs\">srcs</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>, mandatory*): The TypeScript source files to compile.\n\n\n<h4 id=\"ts_library-supports_workers\">supports_workers</h4>\n\n(*Boolean*): Intended for internal use only.\n\nAllows you to disable the Bazel Worker strategy for this library.\nTypically used together with the \"compiler\" setting when using a\nnon-worker aware compiler binary.\n\nDefaults to `True`\n\n<h4 id=\"ts_library-tsconfig\">tsconfig</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>*): A tsconfig.json file containing settings for TypeScript compilation.\nNote that some properties in the tsconfig are governed by Bazel and will be\noverridden, such as `target` and `module`.\n\nThe default value is set to `//:tsconfig.json` by a macro. This means you must\neither:\n\n- Have your `tsconfig.json` file in the workspace root directory\n- Use an alias in the root BUILD.bazel file to point to the location of tsconfig:\n    `alias(name=\"tsconfig.json\", actual=\"//path/to:tsconfig-something.json\")`\n- Give an explicit `tsconfig` attribute to all `ts_library` targets\n\nDefaults to `None`\n\n<h4 id=\"ts_library-tsickle_typed\">tsickle_typed</h4>\n\n(*Boolean*): If using tsickle, instruct it to translate types to ClosureJS format\n\nDefaults to `True`\n\n<h4 id=\"ts_library-use_angular_plugin\">use_angular_plugin</h4>\n\n(*Boolean*): Run the Angular ngtsc compiler under ts_library\n\nDefaults to `False`\n\n\n\n## ts_project\n\n**USAGE**\n\n<pre>\nts_project(<a href=\"#ts_project-name\">name</a>, <a href=\"#ts_project-tsconfig\">tsconfig</a>, <a href=\"#ts_project-srcs\">srcs</a>, <a href=\"#ts_project-args\">args</a>, <a href=\"#ts_project-deps\">deps</a>, <a href=\"#ts_project-extends\">extends</a>, <a href=\"#ts_project-allow_js\">allow_js</a>, <a href=\"#ts_project-declaration\">declaration</a>, <a href=\"#ts_project-source_map\">source_map</a>,\n           <a href=\"#ts_project-declaration_map\">declaration_map</a>, <a href=\"#ts_project-composite\">composite</a>, <a href=\"#ts_project-incremental\">incremental</a>, <a href=\"#ts_project-emit_declaration_only\">emit_declaration_only</a>, <a href=\"#ts_project-ts_build_info_file\">ts_build_info_file</a>, <a href=\"#ts_project-tsc\">tsc</a>,\n           <a href=\"#ts_project-worker_tsc_bin\">worker_tsc_bin</a>, <a href=\"#ts_project-worker_typescript_module\">worker_typescript_module</a>, <a href=\"#ts_project-validate\">validate</a>, <a href=\"#ts_project-supports_workers\">supports_workers</a>, <a href=\"#ts_project-declaration_dir\">declaration_dir</a>,\n           <a href=\"#ts_project-out_dir\">out_dir</a>, <a href=\"#ts_project-root_dir\">root_dir</a>, <a href=\"#ts_project-link_workspace_root\">link_workspace_root</a>, <a href=\"#ts_project-kwargs\">kwargs</a>)\n</pre>\n\nCompiles one TypeScript project using `tsc --project`\n\nThis is a drop-in replacement for the `tsc` rule automatically generated for the \"typescript\"\npackage, typically loaded from `@npm//typescript:index.bzl`. Unlike bare `tsc`, this rule understands\nthe Bazel interop mechanism (Providers) so that this rule works with others that produce or consume\nTypeScript typings (`.d.ts` files).\n\nUnlike `ts_library`, this rule is the thinnest possible layer of Bazel interoperability on top\nof the TypeScript compiler. It shifts the burden of configuring TypeScript into the tsconfig.json file.\nSee https://github.com/bazelbuild/rules_nodejs/blob/master/docs/TypeScript.md#alternatives\nfor more details about the trade-offs between the two rules.\n\nSome TypeScript options affect which files are emitted, and Bazel wants to know these ahead-of-time.\nSo several options from the tsconfig file must be mirrored as attributes to ts_project.\nSee https://www.typescriptlang.org/v2/en/tsconfig for a listing of the TypeScript options.\n\nAny code that works with `tsc` should work with `ts_project` with a few caveats:\n\n- Bazel requires that the `outDir` (and `declarationDir`) be set to\n  `bazel-out/[target architecture]/bin/path/to/package`\n  so we override whatever settings appear in your tsconfig.\n- Bazel expects that each output is produced by a single rule.\n  Thus if you have two `ts_project` rules with overlapping sources (the same `.ts` file\n  appears in more than one) then you get an error about conflicting `.js` output\n  files if you try to build both together.\n  Worse, if you build them separately then the output directory will contain whichever\n  one you happened to build most recently. This is highly discouraged.\n\n> Note: in order for TypeScript to resolve relative references to the bazel-out folder,\n> we recommend that the base tsconfig contain a rootDirs section that includes all\n> possible locations they may appear.\n>\n> We hope this will not be needed in some future release of TypeScript.\n> Follow https://github.com/microsoft/TypeScript/issues/37257 for more info.\n>\n> For example, if the base tsconfig file relative to the workspace root is\n> `path/to/tsconfig.json` then you should configure like:\n>\n> ```\n> \"compilerOptions\": {\n>     \"rootDirs\": [\n>         \".\",\n>         \"../../bazel-out/darwin-fastbuild/bin/path/to\",\n>         \"../../bazel-out/k8-fastbuild/bin/path/to\",\n>         \"../../bazel-out/x64_windows-fastbuild/bin/path/to\",\n>         \"../../bazel-out/darwin-dbg/bin/path/to\",\n>         \"../../bazel-out/k8-dbg/bin/path/to\",\n>         \"../../bazel-out/x64_windows-dbg/bin/path/to\",\n>     ]\n> }\n> ```\n>\n> See some related discussion including both \"rootDirs\" and \"paths\" for a monorepo setup\n> using custom import paths:\n> https://github.com/bazelbuild/rules_nodejs/issues/2298\n\n\n### Issues when running non-sandboxed\n\nWhen using a non-sandboxed spawn strategy (which is the default on Windows), you may\nobserve these problems which require workarounds:\n\n1) Bazel deletes outputs from the previous execution before running `tsc`.\n   This causes a problem with TypeScript's incremental mode: if the `.tsbuildinfo` file\n   is not known to be an output of the rule, then Bazel will leave it in the output\n   directory, and when `tsc` runs, it may see that the outputs written by the prior\n   invocation are up-to-date and skip the emit of these files. This will cause Bazel\n   to intermittently fail with an error that some outputs were not written.\n   This is why we depend on `composite` and/or `incremental` attributes to be provided,\n   so we can tell Bazel to expect a `.tsbuildinfo` output to ensure it is deleted before a\n   subsequent compilation.\n   At present, we don't do anything useful with the `.tsbuildinfo` output, and this rule\n   does not actually have incremental behavior. Deleting the file is actually\n   counter-productive in terms of TypeScript compile performance.\n   Follow https://github.com/bazelbuild/rules_nodejs/issues/1726\n\n2) When using Project References, TypeScript will expect to verify that the outputs of referenced\n   projects are up-to-date with respect to their inputs.\n   (This is true even without using the `--build` option).\n   When using a non-sandboxed spawn strategy, `tsc` can read the sources from other `ts_project`\n   rules in your project, and will expect that the `tsconfig.json` file for those references will\n   indicate where the outputs were written. However the `outDir` is determined by this Bazel rule so\n   it cannot be known from reading the `tsconfig.json` file.\n   This problem is manifested as a TypeScript diagnostic like\n   `error TS6305: Output file '/path/to/execroot/a.d.ts' has not been built from source file '/path/to/execroot/a.ts'.`\n   As a workaround, you can give the Windows \"fastbuild\" output directory as the `outDir` in your tsconfig file.\n   On other platforms, the value isn't read so it does no harm.\n   See https://github.com/bazelbuild/rules_nodejs/tree/stable/packages/typescript/test/ts_project as an example.\n   We hope this will be fixed in a future release of TypeScript;\n   follow https://github.com/microsoft/TypeScript/issues/37378\n\n3) When TypeScript encounters an import statement, it adds the source file resolved by that reference\n   to the program. However you may have included that source file in a different project, so this causes\n   the problem mentioned above where a source file is in multiple programs.\n   (Note, if you use Project References this is not the case, TS will know the referenced\n   file is part of the other program.)\n   This will result in duplicate emit for the same file, which produces an error\n   since the files written to the output tree are read-only.\n   Workarounds include using using Project References, or simply grouping the whole compilation\n   into one program (if this doesn't exceed your time budget).\n\n\n**PARAMETERS**\n\n\n<h4 id=\"ts_project-name\">name</h4>\n\nA name for the target.\n\nWe recommend you use the basename (no `.json` extension) of the tsconfig file that should be compiled.\n\nDefaults to `\"tsconfig\"`\n\n<h4 id=\"ts_project-tsconfig\">tsconfig</h4>\n\nLabel of the tsconfig.json file to use for the compilation\n\nTo support \"chaining\" of more than one extended config, this label could be a target that\nprovdes `TsConfigInfo` such as `ts_config`.\n\nBy default, we assume the tsconfig file is named by adding `.json` to the `name` attribute.\n\nEXPERIMENTAL: generated tsconfig\n\nInstead of a label, you can pass a dictionary of tsconfig keys.\n\nIn this case, a tsconfig.json file will be generated for this compilation, in the following way:\n- all top-level keys will be copied by converting the dict to json.\n  So `tsconfig = {\"compilerOptions\": {\"declaration\": True}}`\n  will result in a generated `tsconfig.json` with `{\"compilerOptions\": {\"declaration\": true}}`\n- each file in srcs will be converted to a relative path in the `files` section.\n- the `extends` attribute will be converted to a relative path\n\nNote that you can mix and match attributes and compilerOptions properties, so these are equivalent:\n\n```\nts_project(\n    tsconfig = {\n        \"compilerOptions\": {\n            \"declaration\": True,\n        },\n    },\n)\n```\nand\n```\nts_project(\n    declaration = True,\n)\n```\n\nDefaults to `None`\n\n<h4 id=\"ts_project-srcs\">srcs</h4>\n\nList of labels of TypeScript source files to be provided to the compiler.\n\nIf absent, defaults to `**/*.ts[x]` (all TypeScript files in the package).\n\nDefaults to `None`\n\n<h4 id=\"ts_project-args\">args</h4>\n\nList of strings of additional command-line arguments to pass to tsc.\n\nDefaults to `[]`\n\n<h4 id=\"ts_project-deps\">deps</h4>\n\nList of labels of other rules that produce TypeScript typings (.d.ts files)\n\nDefaults to `[]`\n\n<h4 id=\"ts_project-extends\">extends</h4>\n\nLabel of the tsconfig file referenced in the `extends` section of tsconfig\n\nTo support \"chaining\" of more than one extended config, this label could be a target that\nprovdes `TsConfigInfo` such as `ts_config`.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-allow_js\">allow_js</h4>\n\nboolean; Specifies whether TypeScript will read .js and .jsx files. When used with declaration,\nTypeScript will generate .d.ts files from .js files.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-declaration\">declaration</h4>\n\nif the `declaration` bit is set in the tsconfig.\nInstructs Bazel to expect a `.d.ts` output for each `.ts` source.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-source_map\">source_map</h4>\n\nif the `sourceMap` bit is set in the tsconfig.\nInstructs Bazel to expect a `.js.map` output for each `.ts` source.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-declaration_map\">declaration_map</h4>\n\nif the `declarationMap` bit is set in the tsconfig.\nInstructs Bazel to expect a `.d.ts.map` output for each `.ts` source.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-composite\">composite</h4>\n\nif the `composite` bit is set in the tsconfig.\nInstructs Bazel to expect a `.tsbuildinfo` output and a `.d.ts` output for each `.ts` source.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-incremental\">incremental</h4>\n\nif the `incremental` bit is set in the tsconfig.\nInstructs Bazel to expect a `.tsbuildinfo` output.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-emit_declaration_only\">emit_declaration_only</h4>\n\nif the `emitDeclarationOnly` bit is set in the tsconfig.\nInstructs Bazel *not* to expect `.js` or `.js.map` outputs for `.ts` sources.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-ts_build_info_file\">ts_build_info_file</h4>\n\nthe user-specified value of `tsBuildInfoFile` from the tsconfig.\nHelps Bazel to predict the path where the .tsbuildinfo output is written.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-tsc\">tsc</h4>\n\nLabel of the TypeScript compiler binary to run.\n\nFor example, `tsc = \"@my_deps//typescript/bin:tsc\"`\nOr you can pass a custom compiler binary instead.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-worker_tsc_bin\">worker_tsc_bin</h4>\n\nLabel of the TypeScript compiler binary to run when running in worker mode.\n\nFor example, `tsc = \"@my_deps//node_modules/typescript/bin/tsc\"`\nOr you can pass a custom compiler binary instead.\n\nDefaults to `\"@npm//:node_modules/typescript/bin/tsc\"`\n\n<h4 id=\"ts_project-worker_typescript_module\">worker_typescript_module</h4>\n\nLabel of the package containing all data deps of worker_tsc_bin.\n\nFor example, `tsc = \"@my_deps//typescript\"`\n\nDefaults to `\"@npm//typescript\"`\n\n<h4 id=\"ts_project-validate\">validate</h4>\n\nboolean; whether to check that the tsconfig settings match the attributes.\n\nDefaults to `True`\n\n<h4 id=\"ts_project-supports_workers\">supports_workers</h4>\n\nExperimental! Use only with caution.\n\nAllows you to enable the Bazel Persistent Workers strategy for this project.\nSee https://docs.bazel.build/versions/master/persistent-workers.html\n\nThis requires that the tsc binary support a `--watch` option.\n\nNOTE: this does not work on Windows yet.\nWe will silently fallback to non-worker mode on Windows regardless of the value of this attribute.\nFollow https://github.com/bazelbuild/rules_nodejs/issues/2277 for progress on this feature.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-declaration_dir\">declaration_dir</h4>\n\na string specifying a subdirectory under the bazel-out folder where generated declaration\noutputs are written. Equivalent to the TypeScript --declarationDir option.\nBy default declarations are written to the out_dir.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-out_dir\">out_dir</h4>\n\na string specifying a subdirectory under the bazel-out folder where outputs are written.\nEquivalent to the TypeScript --outDir option.\nNote that Bazel always requires outputs be written under a subdirectory matching the input package,\nso if your rule appears in path/to/my/package/BUILD.bazel and out_dir = \"foo\" then the .js files\nwill appear in bazel-out/[arch]/bin/path/to/my/package/foo/*.js.\nBy default the out_dir is '.', meaning the packages folder in bazel-out.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-root_dir\">root_dir</h4>\n\na string specifying a subdirectory under the input package which should be consider the\nroot directory of all the input files.\nEquivalent to the TypeScript --rootDir option.\nBy default it is '.', meaning the source directory where the BUILD file lives.\n\nDefaults to `None`\n\n<h4 id=\"ts_project-link_workspace_root\">link_workspace_root</h4>\n\nLink the workspace root to the bin_dir to support absolute requires like 'my_wksp/path/to/file'.\nIf source files need to be required then they can be copied to the bin_dir with copy_to_bin.\n\nDefaults to `False`\n\n<h4 id=\"ts_project-kwargs\">kwargs</h4>\n\npassed through to underlying rule, allows eg. visibility, tags\n\n\n\n\n","license":"Apache-2.0","scripts":{"postinstall":"node npm_version_check.js"},"typings":"./internal/tsc_wrapped/index.d.ts","_npmUser":{"name":"alexeagle","email":"aeagle22206@gmail.com"},"homepage":"https://github.com/bazelbuild/rules_nodejs#readme","keywords":["typescript","bazel"],"deprecated":"No longer maintained, https://github.com/aspect-build/rules_ts is the recommended replacement","repository":{"url":"git+https://github.com/bazelbuild/rules_nodejs.git","type":"git","directory":"packages/typescript"},"_npmVersion":"6.12.0","description":"TypeScript rules for Bazel","directories":{},"maintainers":[{"name":"alexeagle","email":"aeagle22206@gmail.com"},{"name":"gregmagolan","email":"gmagolan@gmail.com"},{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},{"name":"angular","email":"devops+npm@angular.io"},{"name":"angularcore","email":"angular-core+npm@google.com"},{"name":"achew22","email":"npmjs.com@achew22.com"}],"_nodeVersion":"12.13.0","dependencies":{"semver":"5.6.0","tsutils":"2.27.2","protobufjs":"6.8.8","source-map-support":"0.5.9"},"_hasShrinkwrap":false,"readmeFilename":"README.md","peerDependencies":{"typescript":">=3.0.0 <4.0"},"_npmOperationalInternal":{"tmp":"tmp/typescript_3.0.0-rc.0_1607715493581_0.6278208846952913","host":"s3://npm-registry-packages"},"_id":"@bazel/typescript@3.0.0-rc.0","version":"3.0.0-rc.0"}