{"//":"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":"8f238a6d395140cdc6ed6900f0861efb744ca91b","tarball":"https://registry.npmjs.org/@bazel/typescript/-/typescript-2.3.3.tgz","fileCount":104,"integrity":"sha512-tkkrV1wrpMKj7gDlgloo/24lGmW5btHxzg9xqBZsXVvEfhr3HP9dU296bBxtdS1zZuORCxdIhh7D3iPonQDibg==","signatures":[{"sig":"MEUCIQC8F0WoxsO8meMnuUF5WGdGCprkbj22krFEYzvjl56nMQIgBT68VeHepivoo9Fpq/4ZihdDFcrpF1C8X7LUfLCs3cg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19548204,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgEEDTCRA9TVsSAnZWagAAZHEP/jfYKpQdBTgD9awkNTg9\n9bygvSANemycsqG/rczN2UQlZ10/9784oVX0xg8psA9jbswGnUmCTgcarpyG\nLrlIDWfXbGPa26FBxiQ/GMCbkJcUxjhgC7SzaqHjh2a1qXK4NNrrLPD0+atE\nb+N4iBv7Zypx4BWI2Uc+UP2TLxPhUgCeUEKULWYMPjKqA0HHSwmbxAHbhmYH\nkCPw4mNCfFdKD4eGIeyDw0kXYqIGjk5K99LmvwipIZP5U6h0eeNFpmvTnnt9\n4PYSWZ601GZKlGnQOCNio7/if0qDQUNtRg5gI7hQ/Io2c8BdPkrSh8r6PAFX\nxQKKW9NoHbXsGjSJ/QhzDTr6I/N8BdqfT3ge8tfAVXdtU7nR2HbdZNTJEJIB\npZFsokp4PpCgG/VxEUkt8RV0w7lqZGhgGsnFW3tzz1YqgyYqaOg0hN5nMYdM\nfL6iDhYcddeE4dsz3ZNvSqnbTNbdyLH7DANhibBazicF6AIowdgyKJER8gFc\nBaHWqC6rcFg1q4d5m5TSEUuZCjuHpnP8XgEuNptPYcVYd+enjqTPwsAAWRvo\nDP37PFzIVsMBVyTU/PsnwrxozY7GDn2EyPlWIrfeTKEjpmv34OfJp6fZR9Sd\nLhwk+Cu4FiIv9/z/T3Jhy0/8vkl2XYxRviTl2SXrmiUzax8hfuya6sxozi4q\nlmqn\r\n=M0Um\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 two alternatives provided: `ts_project` and `ts_library`.\nThis section describes the trade-offs between these rules.\n\n`ts_project` is recommended for all new uses, and we hope to migrate all users to it in the future.\nIt simply runs `tsc --project`.\n\nThe rule ensures that Bazel knows which outputs to expect based on the TypeScript compiler options, and provides interoperability with other TypeScript rules via a Bazel Provider ([DeclarationInfo](Built-ins#declarationinfo)) that transmits the type information.\n\nAdvantages of `ts_project` include:\n- it's an easy on-boarding for existing TypeScript code and for developers already familiar with using the TypeScript compiler.\n- any behavior of `ts_project` should be reproducible outside of Bazel, with a couple of caveats noted in the rule documentation below.\n- It's a compact implementation that we can afford to maintain.\n\n> We used to recommend using the `tsc` rule directly from the `typescript` project, like\n> `load(\"@npm//typescript:index.bzl\", \"tsc\")`\n> However `ts_project` is strictly better and should be used instead.\n\n**`ts_library` will be deprecated as soon as `ts_project` has performance parity. Thus we do not recommend any new usages**\n\n`ts_library` is an open-sourced version of the rule we use to compile TS code at Google, however it is very complex, involving code generation of the `tsconfig.json` file, a custom compiler binary, and a lot of extra features.\n\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- You cannot use `--noEmit` compiler option to use TypeScript as a linter. We always expect to produce .js outputs.\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\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\nBUILD files from your source code.\n\n[gazelle]: https://github.com/bazelbuild/bazel-gazelle\n[ibazel]: https://github.com/bazelbuild/bazel-watcher\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_devserver\n\n**USAGE**\n\n<pre>\nts_devserver(<a href=\"#ts_devserver-name\">name</a>, <a href=\"#ts_devserver-additional_root_paths\">additional_root_paths</a>, <a href=\"#ts_devserver-bootstrap\">bootstrap</a>, <a href=\"#ts_devserver-deps\">deps</a>, <a href=\"#ts_devserver-devserver\">devserver</a>, <a href=\"#ts_devserver-devserver_host\">devserver_host</a>, <a href=\"#ts_devserver-entry_module\">entry_module</a>,\n             <a href=\"#ts_devserver-port\">port</a>, <a href=\"#ts_devserver-scripts\">scripts</a>, <a href=\"#ts_devserver-serving_path\">serving_path</a>, <a href=\"#ts_devserver-static_files\">static_files</a>)\n</pre>\n\nts_devserver is a simple development server intended for a quick \"getting started\" experience.\n\nAdditional documentation [here](https://github.com/alexeagle/angular-bazel-example/wiki/Running-a-devserver-under-Bazel)\n\n\n**ATTRIBUTES**\n\n\n<h4 id=\"ts_devserver-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_devserver-additional_root_paths\">additional_root_paths</h4>\n\n(*List of strings*): Additional root paths to serve `static_files` from.\n            Paths should include the workspace name such as `[\"__main__/resources\"]`\n\nDefaults to `[]`\n\n<h4 id=\"ts_devserver-bootstrap\">bootstrap</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Scripts to include in the JS bundle before the module loader (require.js)\n\nDefaults to `[]`\n\n<h4 id=\"ts_devserver-deps\">deps</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Targets that produce JavaScript, such as `ts_library`\n\nDefaults to `[]`\n\n<h4 id=\"ts_devserver-devserver\">devserver</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>*): Go based devserver executable.\n\n            With cross-platform RBE for OSX & Windows ctx.executable.devserver will be linux as --cpu and\n            --host_cpu must be overridden to k8. However, we still want to be able to run the devserver on the host\n            machine so we need to include the host devserver binary, which is ctx.executable.devserver_host, in the\n            runfiles. For non-RBE and for RBE with a linux host, ctx.executable.devserver & ctx.executable.devserver_host\n            will be the same binary.\n\n            Defaults to precompiled go binary setup by @bazel/typescript npm package\n\nDefaults to `//@bazel/typescript/devserver:devserver`\n\n<h4 id=\"ts_devserver-devserver_host\">devserver_host</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">Label</a>*): Go based devserver executable for the host platform.\n            Defaults to precompiled go binary setup by @bazel/typescript npm package\n\nDefaults to `//@bazel/typescript/devserver:devserver_darwin_amd64`\n\n<h4 id=\"ts_devserver-entry_module\">entry_module</h4>\n\n(*String*): The `entry_module` should be the AMD module name of the entry module such as `\"__main__/src/index\".`\n            `ts_devserver` concats the following snippet after the bundle to load the application:\n            `require([\"entry_module\"]);`\n\nDefaults to `\"\"`\n\n<h4 id=\"ts_devserver-port\">port</h4>\n\n(*Integer*): The port that the devserver will listen on.\n\nDefaults to `5432`\n\n<h4 id=\"ts_devserver-scripts\">scripts</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): User scripts to include in the JS bundle before the application sources\n\nDefaults to `[]`\n\n<h4 id=\"ts_devserver-serving_path\">serving_path</h4>\n\n(*String*): The path you can request from the client HTML which serves the JavaScript bundle.\n            If you don't specify one, the JavaScript can be loaded at /_/ts_scripts.js\n\nDefaults to `\"/_/ts_scripts.js\"`\n\n<h4 id=\"ts_devserver-static_files\">static_files</h4>\n\n(*<a href=\"https://bazel.build/docs/build-ref.html#labels\">List of labels</a>*): Arbitrary files which to be served, such as index.html.\n            They are served relative to the package where this rule is declared.\n\nDefaults to `[]`\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\nFirst read the [Alternatives](#alternatives) section above.\n`ts_project` is recommended for new uses.\n\nThe `ts_library` rule invokes the TypeScript compiler on one compilation unit,\nor \"library\" (generally one directory of source files).\nIt produces declarations files (`.d.ts`) which are used for compiling downstream\nTypeScript targets and JavaScript for the browser and Closure compiler.\n\nTo start, create 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### 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,\nthen 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### 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\nThere are two choices for development mode:\n\n1. Use the `ts_devserver` rule to bring up our simple, fast development server.\n   This is intentionally very simple, to help you get started quickly. However,\n   since there are many development servers available, we do not want to mirror\n   their features in yet another server we maintain.\n1. Teach your real frontend server to serve files from Bazel's output directory.\n   This is not yet documented. Choose this option if you have an existing server\n   used in development mode, or if your requirements exceed what the\n   `ts_devserver` supports. Be careful that your development round-trip stays\n   fast (should be under two seconds).\n\nTo use `ts_devserver`, you simply `load` the rule, and call it with `deps` that\npoint to your `ts_library` target(s):\n\n```python\nload(\"//@bazel/typescript:index.bzl\", \"ts_devserver\", \"ts_library\")\n\nts_library(\n    name = \"app\",\n    srcs = [\"app.ts\"],\n)\n\nts_devserver(\n    name = \"devserver\",\n    # We'll collect all the devmode JS sources from these TypeScript libraries\n    deps = [\":app\"],\n    # This is the path we'll request from the browser, see index.html\n    serving_path = \"/bundle.js\",\n    # The devserver can serve our static files too\n    static_files = [\"index.html\"],\n)\n```\n\nThe `index.html` should be the same one you use for production, and it should\nload the JavaScript bundle from the path indicated in `serving_path`.\n\nIf you don't have an index.html file, a simple one will be generated by the\n`ts_devserver`.\n\nSee `examples/app` in this repository for a working example. To run the\ndevserver, we recommend you use [ibazel]:\n\n```sh\n$ ibazel run examples/app:devserver\n```\n\n`ibazel` will keep the devserver program running, and provides a LiveReload\nserver so the browser refreshes the application automatically when each build\nfinishes.\n\n[ibazel]: https://github.com/bazelbuild/bazel-watcher\n\n\n### Writing TypeScript code for `ts_library`\n\nThe custom TypeScript compiler `tsc_wrapped` 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[path mapping]: https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping\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.\nTo use the default, create a `BUILD.bazel` file in your workspace root.\nIf 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\nOr, instead of the default you can 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\n_DEPRECATED, to be removed in 3.0_:\nFor backwards compatibility, this accepts a list of Labels of the \"chained\"\ntsconfig files. You should instead use a single Label of a `ts_config` target.\nFollow this deprecation: https://github.com/bazelbuild/rules_nodejs/issues/2140\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":"angular","email":"devops+npm@angular.io"},{"name":"angularcore","email":"angular-core+npm@google.com"},{"name":"achew22","email":"npmjs.com@achew22.com"},{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},{"name":"gregmagolan","email":"gmagolan@gmail.com"},{"name":"alexeagle","email":"aeagle22206@gmail.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_2.3.3_1611677907189_0.9807598647756768","host":"s3://npm-registry-packages"},"_id":"@bazel/typescript@2.3.3","version":"2.3.3"}