{"//":"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":"1fe868d403bd303a6d9a2340ba6b95ecf8fdec2d","tarball":"https://registry.npmjs.org/@bazel/typescript/-/typescript-2.0.0-rc.1.tgz","fileCount":101,"integrity":"sha512-BbD3540jpOsflSiCmxuN2whs4+UndjAHtB/6BiA0r5adls0Prqw+JZaACZccvi00FTMTQEJz9P4PeD2Codv3Tw==","signatures":[{"sig":"MEUCIQDrtFL1pzINhAtcS0k7mKuTePgW+tlYYQL21s+6bccA1AIgamkW5n0599o/9tJikoi3S59436fcxMX1QL1iHbI3PZ8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19498135,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfA69mCRA9TVsSAnZWagAAH9wQAIvRQTRQP9R89VtQ4Um7\nre0eQSisaORwbE7sqKQysde7b/m2NozfZ9PT8Nt4W/MrFXUeuORxGiPr5Wo4\nAGlslhYHOZ9jJsJPL4BW3P+TNaJYi2GshXfhlM09ZJsl7mf1l82EgSWwJlfY\nJhjkALbMWG/mEXaLVrxJdZGuNXQMkKztzn+JtlU2niviR6kt+1rxfhL1A9A3\nrxrGiwH2CKxOciBIyT4MSLIwNG4slymTSQVBtbrCY5W69vser23aRPmCnmD6\nwCNMP8TpCikqGMDKh56mVaEQrOZsIWqotaPGAHGT8Z6rVuzAsib9t5edYSQA\nCa2YnsunSZ5eWzaQl8fEAi9RjRV3+lElytVK9DAKxW7i/u36ShsIlPHURmq3\nRBUPiimBme+My9jB4S8DasHcIW7D9i5R4qgbT82p9BdT1x3Bb93myG2/b26J\ngiZAU0WCDmr8xhuZfHSkQA5STdVKwdLS2YzxvXrNIxC7Q/ULQQcrGb9/bvAT\nKC0BxEbOyBJFIHk0FT9nmasUq5y7Hv/pPh9Y64W5W8yDa2MDyoyTo/0XFG67\nzAGaNm2GeW70yQ7oWaTcZUtlxPiBUYhfoPwOltirskrwff1ezqRMBl1vGW4R\nBLtH1GLo0Ot7/oXTQwKqx4Wp+WxZL4aIBxt83haR0i0+oveecDqxWQMKkXbi\nd75b\r\n=6593\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` 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> 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` is an open-sourced version of the rule we use 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\nSome rules require you to add this to your `WORKSPACE` file:\n\n```python\n# Set up TypeScript toolchain\nload(\"@npm//@bazel/typescript:index.bzl\", \"ts_setup_workspace\")\nts_setup_workspace()\n```\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# 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\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 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\nBUILD files from your source code.\n\n[gazelle]: https://github.com/bazelbuild/rules_go/tree/master/go/tools/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# API documentation\n[name]: https://bazel.build/docs/build-ref.html#name\n[label]: https://bazel.build/docs/build-ref.html#labels\n[labels]: https://bazel.build/docs/build-ref.html#labels\n\n\n## ts_config\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` 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\n### Usage\n\n```\nts_config(name, deps, src)\n```\n\n\n\n#### `name`\n(*[name], mandatory*): A unique name for this target.\n\n#### `deps`\n(*[labels], mandatory*): Additional tsconfig.json files referenced via extends\n\n#### `src`\n(*[label], mandatory*): The tsconfig.json file passed to the TypeScript compiler\n\n\n## ts_devserver\n\nts_devserver is a simple development server intended for a quick \"getting started\" experience.\n\nAdditional documentation at https://github.com/alexeagle/angular-bazel-example/wiki/Running-a-devserver-under-Bazel\n\n\n\n### Usage\n\n```\nts_devserver(name, additional_root_paths, bootstrap, deps, devserver, devserver_host, entry_module, port, scripts, serving_path, static_files)\n```\n\n\n\n#### `name`\n(*[name], mandatory*): A unique name for this target.\n\n#### `additional_root_paths`\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#### `bootstrap`\n(*[labels]*): Scripts to include in the JS bundle before the module loader (require.js)\n\nDefaults to `[]`\n\n#### `deps`\n(*[labels]*): Targets that produce JavaScript, such as `ts_library`\n\nDefaults to `[]`\n\n#### `devserver`\n(*[label]*): 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#### `devserver_host`\n(*[label]*): 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#### `entry_module`\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#### `port`\n(*Integer*): The port that the devserver will listen on.\n\nDefaults to `5432`\n\n#### `scripts`\n(*[labels]*): User scripts to include in the JS bundle before the application sources\n\nDefaults to `[]`\n\n#### `serving_path`\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#### `static_files`\n(*[labels]*): 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## ts_library\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\n### Usage\n\n```\nts_library(name, angular_assets, compiler, data, deps, devmode_module, devmode_target, expected_diagnostics, generate_externs, internal_testing_type_check_dependencies, module_name, module_root, node_modules, prodmode_module, prodmode_target, runtime, runtime_deps, srcs, supports_workers, tsconfig, tsickle_typed, use_angular_plugin)\n```\n\n\n\n#### `name`\n(*[name], mandatory*): A unique name for this target.\n\n#### `angular_assets`\n(*[labels]*): Additional files the Angular compiler will need to read as inputs.\n            Includes .css and .html files\n\nDefaults to `[]`\n\n#### `compiler`\n(*[label]*): 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#### `data`\n(*[labels]*)\n\nDefaults to `[]`\n\n#### `deps`\n(*[labels]*): Compile-time dependencies, typically other ts_library targets\n\nDefaults to `[]`\n\n#### `devmode_module`\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#### `devmode_target`\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#### `expected_diagnostics`\n(*List of strings*)\n\nDefaults to `[]`\n\n#### `generate_externs`\n(*Boolean*)\n\nDefaults to `True`\n\n#### `internal_testing_type_check_dependencies`\n(*Boolean*): Testing only, whether to type check inputs that aren't srcs.\n\nDefaults to `False`\n\n#### `module_name`\n(*String*)\n\nDefaults to `\"\"`\n\n#### `module_root`\n(*String*)\n\nDefaults to `\"\"`\n\n#### `node_modules`\n(*[label]*): 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#### `prodmode_module`\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#### `prodmode_target`\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#### `runtime`\n(*String*)\n\nDefaults to `\"browser\"`\n\n#### `runtime_deps`\n(*[labels]*)\n\nDefaults to `[]`\n\n#### `srcs`\n(*[labels], mandatory*): The TypeScript source files to compile.\n\n#### `supports_workers`\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#### `tsconfig`\n(*[label]*): 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#### `tsickle_typed`\n(*Boolean*): If using tsickle, instruct it to translate types to ClosureJS format\n\nDefaults to `True`\n\n#### `use_angular_plugin`\n(*Boolean*): Run the Angular ngtsc compiler under ts_library\n\nDefaults to `False`\n\n\n## ts_project\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\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/master/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\n### Usage\n\n```\nts_project(name, tsconfig, srcs, args, deps, extends, declaration, source_map, declaration_map, composite, incremental, emit_declaration_only, tsc, validate, outdir, kwargs)\n```\n\n\n\n#### `name`\n      \nA name for the target.\n\n    We recommend you use the basename (no `.json` extension) of the tsconfig file that should be compiled.\n\nDefaults to `\"tsconfig\"`\n\n\n\n#### `tsconfig`\n      \nLabel of the tsconfig.json file to use for the compilation.\n\n    By default, we add `.json` to the `name` attribute.\n\nDefaults to `None`\n\n\n\n#### `srcs`\n      \nList of labels of TypeScript source files to be provided to the compiler.\n\n    If absent, defaults to `**/*.ts[x]` (all TypeScript files in the package).\n\nDefaults to `None`\n\n\n\n#### `args`\n      \nList of strings of additional command-line arguments to pass to tsc.\n\nDefaults to `[]`\n\n\n\n#### `deps`\n      \nList of labels of other rules that produce TypeScript typings (.d.ts files)\n\nDefaults to `[]`\n\n\n\n#### `extends`\n      \nList of labels of tsconfig file(s) referenced in `extends` section of tsconfig.\n\n    Must include any tsconfig files \"chained\" by extends clauses.\n\nDefaults to `None`\n\n\n\n#### `declaration`\n      \nif the `declaration` bit is set in the tsconfig.\n    Instructs Bazel to expect a `.d.ts` output for each `.ts` source.\n\nDefaults to `False`\n\n\n\n#### `source_map`\n      \nif the `sourceMap` bit is set in the tsconfig.\n    Instructs Bazel to expect a `.js.map` output for each `.ts` source.\n\nDefaults to `False`\n\n\n\n#### `declaration_map`\n      \nif the `declarationMap` bit is set in the tsconfig.\n    Instructs Bazel to expect a `.d.ts.map` output for each `.ts` source.\n\nDefaults to `False`\n\n\n\n#### `composite`\n      \nif the `composite` bit is set in the tsconfig.\n    Instructs Bazel to expect a `.tsbuildinfo` output and a `.d.ts` output for each `.ts` source.\n\nDefaults to `False`\n\n\n\n#### `incremental`\n      \nif the `incremental` bit is set in the tsconfig.\n    Instructs Bazel to expect a `.tsbuildinfo` output.\n\nDefaults to `False`\n\n\n\n#### `emit_declaration_only`\n      \nif the `emitDeclarationOnly` bit is set in the tsconfig.\n    Instructs Bazel *not* to expect `.js` or `.js.map` outputs for `.ts` sources.\n\nDefaults to `False`\n\n\n\n#### `tsc`\n      \nLabel of the TypeScript compiler binary to run.\n\n    For example, `tsc = \"@my_deps//typescript/bin:tsc\"`\n    Or you can pass a custom compiler binary instead.\n\nDefaults to `None`\n\n\n\n#### `validate`\n      \nboolean; whether to check that the tsconfig settings match the attributes.\n\nDefaults to `True`\n\n\n\n#### `outdir`\n      \na string specifying a subdirectory under the bazel-out folder where outputs are written.\n    Note that Bazel always requires outputs be written under a subdirectory matching the input package,\n    so if your rule appears in path/to/my/package/BUILD.bazel and outdir = \"foo\" then the .js files\n    will appear in bazel-out/[arch]/bin/path/to/my/package/foo/*.js\n\nDefaults to `None`\n\n\n\n#### `kwargs`\n      \n\n\n\n\n\n\n## ts_setup_workspace\n\nThis repository rule should be called from your WORKSPACE file.\n\nIt creates some additional Bazel external repositories that are used internally\nby the TypeScript rules.\n\n\n### Usage\n\n```\nts_setup_workspace()\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":"gregmagolan","email":"gmagolan@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":"achew22","email":"npmjs.com@achew22.com"},{"name":"angular","email":"devops+npm@angular.io"},{"name":"angularcore","email":"angular-core+npm@google.com"},{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},{"name":"gregmagolan","email":"gmagolan@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.0.0-rc.1_1594077029935_0.991661768508149","host":"s3://npm-registry-packages"},"_id":"@bazel/typescript@2.0.0-rc.1","version":"2.0.0-rc.1"}