docs: update docs for release
diff --git a/docs/Built-ins.html b/docs/Built-ins.html index 97f099a..cd50d0a 100755 --- a/docs/Built-ins.html +++ b/docs/Built-ins.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Built-ins.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Built-ins.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -394,7 +401,7 @@ <pre> nodejs_binary(<a href="#nodejs_binary-name">name</a>, <a href="#nodejs_binary-configuration_env_vars">configuration_env_vars</a>, <a href="#nodejs_binary-data">data</a>, <a href="#nodejs_binary-default_env_vars">default_env_vars</a>, <a href="#nodejs_binary-entry_point">entry_point</a>, - <a href="#nodejs_binary-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_binary-node_modules">node_modules</a>, <a href="#nodejs_binary-templated_args">templated_args</a>) + <a href="#nodejs_binary-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_binary-templated_args">templated_args</a>) </pre> <p>Runs some JavaScript code in NodeJS.</p> @@ -498,71 +505,6 @@ <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> -<h4 id="nodejs_binary-node_modules">node_modules</h4> - -<p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): The npm packages which should be available to <code class="language-plaintext highlighter-rouge">require()</code> during - execution.</p> - -<p>This attribute is DEPRECATED. As of version 0.13.0 the recommended approach -to npm dependencies is to use fine grained npm dependencies which are setup -with the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rules. For example, in targets -that used a <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup,</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">nodejs_binary</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_binary"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">node_modules</span> <span class="o">=</span> <span class="s">"//:node_modules"</span><span class="p">,</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>which specifies all files within the <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup -to be inputs to the <code class="language-plaintext highlighter-rouge">my_binary</code>. Using fine grained npm dependencies, -<code class="language-plaintext highlighter-rouge">my_binary</code> is defined with only the npm dependencies that are -needed:</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">nodejs_binary</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_binary"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">data</span> <span class="o">=</span> <span class="p">[</span> - <span class="s">"@npm//foo"</span><span class="p">,</span> - <span class="s">"@npm//bar"</span><span class="p">,</span> - <span class="p">...</span> - <span class="p">],</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>In this case, only the <code class="language-plaintext highlighter-rouge">foo</code> and <code class="language-plaintext highlighter-rouge">bar</code> npm packages and their -transitive deps are includes as inputs to the <code class="language-plaintext highlighter-rouge">my_binary</code> target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153).</p> - -<p>The @npm external repository and the fine grained npm package -targets are setup using the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule -in your WORKSPACE file:</p> - -<p>yarn_install( - name = “npm”, - package_json = “//:package.json”, - yarn_lock = “//:yarn.lock”, -)</p> - -<p>For other rules such as <code class="language-plaintext highlighter-rouge">jasmine_node_test</code>, fine grained -npm dependencies are specified in the <code class="language-plaintext highlighter-rouge">deps</code> attribute:</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">jasmine_node_test</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_test"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span> - <span class="s">"@npm//jasmine"</span><span class="p">,</span> - <span class="s">"@npm//foo"</span><span class="p">,</span> - <span class="s">"@npm//bar"</span><span class="p">,</span> - <span class="p">...</span> - <span class="p">],</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>Defaults to <code class="language-plaintext highlighter-rouge">//:node_modules_none</code></p> - <h4 id="nodejs_binary-templated_args">templated_args</h4> <p>(<em>List of strings</em>): Arguments which are passed to every execution of the program. @@ -651,7 +593,7 @@ <pre> nodejs_test(<a href="#nodejs_test-name">name</a>, <a href="#nodejs_test-configuration_env_vars">configuration_env_vars</a>, <a href="#nodejs_test-data">data</a>, <a href="#nodejs_test-default_env_vars">default_env_vars</a>, <a href="#nodejs_test-entry_point">entry_point</a>, <a href="#nodejs_test-expected_exit_code">expected_exit_code</a>, - <a href="#nodejs_test-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_test-node_modules">node_modules</a>, <a href="#nodejs_test-templated_args">templated_args</a>) + <a href="#nodejs_test-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_test-templated_args">templated_args</a>) </pre> <p>Identical to <code class="language-plaintext highlighter-rouge">nodejs_binary</code>, except this can be used with <code class="language-plaintext highlighter-rouge">bazel test</code> as well. @@ -787,71 +729,6 @@ <p>Defaults to <code class="language-plaintext highlighter-rouge">False</code></p> -<h4 id="nodejs_test-node_modules">node_modules</h4> - -<p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): The npm packages which should be available to <code class="language-plaintext highlighter-rouge">require()</code> during - execution.</p> - -<p>This attribute is DEPRECATED. As of version 0.13.0 the recommended approach -to npm dependencies is to use fine grained npm dependencies which are setup -with the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rules. For example, in targets -that used a <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup,</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">nodejs_binary</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_binary"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">node_modules</span> <span class="o">=</span> <span class="s">"//:node_modules"</span><span class="p">,</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>which specifies all files within the <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup -to be inputs to the <code class="language-plaintext highlighter-rouge">my_binary</code>. Using fine grained npm dependencies, -<code class="language-plaintext highlighter-rouge">my_binary</code> is defined with only the npm dependencies that are -needed:</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">nodejs_binary</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_binary"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">data</span> <span class="o">=</span> <span class="p">[</span> - <span class="s">"@npm//foo"</span><span class="p">,</span> - <span class="s">"@npm//bar"</span><span class="p">,</span> - <span class="p">...</span> - <span class="p">],</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>In this case, only the <code class="language-plaintext highlighter-rouge">foo</code> and <code class="language-plaintext highlighter-rouge">bar</code> npm packages and their -transitive deps are includes as inputs to the <code class="language-plaintext highlighter-rouge">my_binary</code> target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153).</p> - -<p>The @npm external repository and the fine grained npm package -targets are setup using the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule -in your WORKSPACE file:</p> - -<p>yarn_install( - name = “npm”, - package_json = “//:package.json”, - yarn_lock = “//:yarn.lock”, -)</p> - -<p>For other rules such as <code class="language-plaintext highlighter-rouge">jasmine_node_test</code>, fine grained -npm dependencies are specified in the <code class="language-plaintext highlighter-rouge">deps</code> attribute:</p> - -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">jasmine_node_test</span><span class="p">(</span> - <span class="n">name</span> <span class="o">=</span> <span class="s">"my_test"</span><span class="p">,</span> - <span class="p">...</span> - <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span> - <span class="s">"@npm//jasmine"</span><span class="p">,</span> - <span class="s">"@npm//foo"</span><span class="p">,</span> - <span class="s">"@npm//bar"</span><span class="p">,</span> - <span class="p">...</span> - <span class="p">],</span> -<span class="p">)</span> -</code></pre></div></div> - -<p>Defaults to <code class="language-plaintext highlighter-rouge">//:node_modules_none</code></p> - <h4 id="nodejs_test-templated_args">templated_args</h4> <p>(<em>List of strings</em>): Arguments which are passed to every execution of the program. @@ -1571,7 +1448,7 @@ <h4 id="generated_file_test-kwargs">kwargs</h4> -<p>extra arguments passed to the underlying nodejs_test or nodejs_binary</p> +<p>extra arguments passed to the underlying nodejs_test</p> <h2 id="js_library">js_library</h2> @@ -1651,7 +1528,7 @@ <p>It also provides:</p> <ul> - <li><a href="#npmpackageinfo">NpmPackageInfo</a> to interop with rules that expect third-party npm packages.</li> + <li><a href="#externalnpmpackageinfo">ExternalNpmPackageInfo</a> to interop with rules that expect third-party npm packages.</li> <li><a href="#jsmoduleinfo">JsModuleInfo</a> so rules like bundlers can collect the transitive set of .js files</li> <li><a href="#jsnamedmoduleinfo">JsNamedModuleInfo</a> for rules that expect named AMD or <code class="language-plaintext highlighter-rouge">goog.module</code> format JS</li> </ul> @@ -1912,6 +1789,28 @@ <p>A depset of .d.ts files that we should not use to infer JSCompiler types (via tsickle)</p> +<h2 id="externalnpmpackageinfo">ExternalNpmPackageInfo</h2> + +<p><strong>USAGE</strong></p> + +<pre> +ExternalNpmPackageInfo(<a href="#ExternalNpmPackageInfo-direct_sources">direct_sources</a>, <a href="#ExternalNpmPackageInfo-sources">sources</a>, <a href="#ExternalNpmPackageInfo-workspace">workspace</a>) +</pre> + +<p>Provides information about one or more external npm packages</p> + +<p><strong>FIELDS</strong></p> + +<h4 id="ExternalNpmPackageInfo-direct_sources">direct_sources</h4> + +<p>Depset of direct source files in these external npm package(s)</p> +<h4 id="ExternalNpmPackageInfo-sources">sources</h4> + +<p>Depset of direct & transitive source files in these external npm package(s) and transitive dependencies</p> +<h4 id="ExternalNpmPackageInfo-workspace">workspace</h4> + +<p>The workspace name that these external npm package(s) are provided from</p> + <h2 id="jsecmascriptmoduleinfo">JSEcmaScriptModuleInfo</h2> <p><strong>USAGE</strong></p> @@ -2066,7 +1965,7 @@ <p>depset of runtime dependency labels</p> <h4 id="NodeRuntimeDepsInfo-pkgs">pkgs</h4> -<p>list of labels of packages that provide NpmPackageInfo</p> +<p>list of labels of packages that provide ExternalNpmPackageInfo</p> <h2 id="npmpackageinfo">NpmPackageInfo</h2> @@ -2076,19 +1975,19 @@ NpmPackageInfo(<a href="#NpmPackageInfo-direct_sources">direct_sources</a>, <a href="#NpmPackageInfo-sources">sources</a>, <a href="#NpmPackageInfo-workspace">workspace</a>) </pre> -<p>Provides information about npm dependencies</p> +<p>Provides information about one or more external npm packages</p> <p><strong>FIELDS</strong></p> <h4 id="NpmPackageInfo-direct_sources">direct_sources</h4> -<p>Depset of direct source files in this npm package</p> +<p>Depset of direct source files in these external npm package(s)</p> <h4 id="NpmPackageInfo-sources">sources</h4> -<p>Depset of direct & transitive source files in this npm package and in its dependencies</p> +<p>Depset of direct & transitive source files in these external npm package(s) and transitive dependencies</p> <h4 id="NpmPackageInfo-workspace">workspace</h4> -<p>The workspace name that this npm package is provided from</p> +<p>The workspace name that these external npm package(s) are provided from</p> <h2 id="declaration_info">declaration_info</h2> @@ -2269,6 +2168,7 @@ <li class="toc-entry toc-h2"><a href="#npm_package_bin">npm_package_bin</a></li> <li class="toc-entry toc-h2"><a href="#params_file">params_file</a></li> <li class="toc-entry toc-h2"><a href="#declarationinfo">DeclarationInfo</a></li> +<li class="toc-entry toc-h2"><a href="#externalnpmpackageinfo">ExternalNpmPackageInfo</a></li> <li class="toc-entry toc-h2"><a href="#jsecmascriptmoduleinfo">JSEcmaScriptModuleInfo</a></li> <li class="toc-entry toc-h2"><a href="#jsmoduleinfo">JSModuleInfo</a></li> <li class="toc-entry toc-h2"><a href="#jsnamedmoduleinfo">JSNamedModuleInfo</a></li>
diff --git a/docs/Built-ins.md b/docs/Built-ins.md index d2e7826..6a3dcd6 100755 --- a/docs/Built-ins.md +++ b/docs/Built-ins.md
@@ -257,7 +257,7 @@ <pre> nodejs_binary(<a href="#nodejs_binary-name">name</a>, <a href="#nodejs_binary-configuration_env_vars">configuration_env_vars</a>, <a href="#nodejs_binary-data">data</a>, <a href="#nodejs_binary-default_env_vars">default_env_vars</a>, <a href="#nodejs_binary-entry_point">entry_point</a>, - <a href="#nodejs_binary-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_binary-node_modules">node_modules</a>, <a href="#nodejs_binary-templated_args">templated_args</a>) + <a href="#nodejs_binary-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_binary-templated_args">templated_args</a>) </pre> Runs some JavaScript code in NodeJS. @@ -366,74 +366,6 @@ Defaults to `False` -<h4 id="nodejs_binary-node_modules">node_modules</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): The npm packages which should be available to `require()` during - execution. - -This attribute is DEPRECATED. As of version 0.13.0 the recommended approach -to npm dependencies is to use fine grained npm dependencies which are setup -with the `yarn_install` or `npm_install` rules. For example, in targets -that used a `//:node_modules` filegroup, - -```python -nodejs_binary( - name = "my_binary", - ... - node_modules = "//:node_modules", -) -``` - -which specifies all files within the `//:node_modules` filegroup -to be inputs to the `my_binary`. Using fine grained npm dependencies, -`my_binary` is defined with only the npm dependencies that are -needed: - -```python -nodejs_binary( - name = "my_binary", - ... - data = [ - "@npm//foo", - "@npm//bar", - ... - ], -) -``` - -In this case, only the `foo` and `bar` npm packages and their -transitive deps are includes as inputs to the `my_binary` target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153). - -The @npm external repository and the fine grained npm package -targets are setup using the `yarn_install` or `npm_install` rule -in your WORKSPACE file: - -yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) - -For other rules such as `jasmine_node_test`, fine grained -npm dependencies are specified in the `deps` attribute: - -```python -jasmine_node_test( - name = "my_test", - ... - deps = [ - "@npm//jasmine", - "@npm//foo", - "@npm//bar", - ... - ], -) -``` - -Defaults to `//:node_modules_none` - <h4 id="nodejs_binary-templated_args">templated_args</h4> (*List of strings*): Arguments which are passed to every execution of the program. @@ -523,7 +455,7 @@ <pre> nodejs_test(<a href="#nodejs_test-name">name</a>, <a href="#nodejs_test-configuration_env_vars">configuration_env_vars</a>, <a href="#nodejs_test-data">data</a>, <a href="#nodejs_test-default_env_vars">default_env_vars</a>, <a href="#nodejs_test-entry_point">entry_point</a>, <a href="#nodejs_test-expected_exit_code">expected_exit_code</a>, - <a href="#nodejs_test-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_test-node_modules">node_modules</a>, <a href="#nodejs_test-templated_args">templated_args</a>) + <a href="#nodejs_test-link_workspace_root">link_workspace_root</a>, <a href="#nodejs_test-templated_args">templated_args</a>) </pre> @@ -667,74 +599,6 @@ Defaults to `False` -<h4 id="nodejs_test-node_modules">node_modules</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): The npm packages which should be available to `require()` during - execution. - -This attribute is DEPRECATED. As of version 0.13.0 the recommended approach -to npm dependencies is to use fine grained npm dependencies which are setup -with the `yarn_install` or `npm_install` rules. For example, in targets -that used a `//:node_modules` filegroup, - -```python -nodejs_binary( - name = "my_binary", - ... - node_modules = "//:node_modules", -) -``` - -which specifies all files within the `//:node_modules` filegroup -to be inputs to the `my_binary`. Using fine grained npm dependencies, -`my_binary` is defined with only the npm dependencies that are -needed: - -```python -nodejs_binary( - name = "my_binary", - ... - data = [ - "@npm//foo", - "@npm//bar", - ... - ], -) -``` - -In this case, only the `foo` and `bar` npm packages and their -transitive deps are includes as inputs to the `my_binary` target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153). - -The @npm external repository and the fine grained npm package -targets are setup using the `yarn_install` or `npm_install` rule -in your WORKSPACE file: - -yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) - -For other rules such as `jasmine_node_test`, fine grained -npm dependencies are specified in the `deps` attribute: - -```python -jasmine_node_test( - name = "my_test", - ... - deps = [ - "@npm//jasmine", - "@npm//foo", - "@npm//bar", - ... - ], -) -``` - -Defaults to `//:node_modules_none` - <h4 id="nodejs_test-templated_args">templated_args</h4> (*List of strings*): Arguments which are passed to every execution of the program. @@ -1509,7 +1373,7 @@ <h4 id="generated_file_test-kwargs">kwargs</h4> -extra arguments passed to the underlying nodejs_test or nodejs_binary +extra arguments passed to the underlying nodejs_test @@ -1589,7 +1453,7 @@ [LinkablePackageInfo](#linkablepackageinfo) for use with our "linker" that makes this package importable. It also provides: -- [NpmPackageInfo](#npmpackageinfo) to interop with rules that expect third-party npm packages. +- [ExternalNpmPackageInfo](#externalnpmpackageinfo) to interop with rules that expect third-party npm packages. - [JsModuleInfo](#jsmoduleinfo) so rules like bundlers can collect the transitive set of .js files - [JsNamedModuleInfo](#jsnamedmoduleinfo) for rules that expect named AMD or `goog.module` format JS @@ -1873,6 +1737,30 @@ +## ExternalNpmPackageInfo + +**USAGE** + +<pre> +ExternalNpmPackageInfo(<a href="#ExternalNpmPackageInfo-direct_sources">direct_sources</a>, <a href="#ExternalNpmPackageInfo-sources">sources</a>, <a href="#ExternalNpmPackageInfo-workspace">workspace</a>) +</pre> + +Provides information about one or more external npm packages + +**FIELDS** + +<h4 id="ExternalNpmPackageInfo-direct_sources">direct_sources</h4> + + Depset of direct source files in these external npm package(s) +<h4 id="ExternalNpmPackageInfo-sources">sources</h4> + + Depset of direct & transitive source files in these external npm package(s) and transitive dependencies +<h4 id="ExternalNpmPackageInfo-workspace">workspace</h4> + + The workspace name that these external npm package(s) are provided from + + + ## JSEcmaScriptModuleInfo **USAGE** @@ -2039,7 +1927,7 @@ depset of runtime dependency labels <h4 id="NodeRuntimeDepsInfo-pkgs">pkgs</h4> - list of labels of packages that provide NpmPackageInfo + list of labels of packages that provide ExternalNpmPackageInfo @@ -2051,19 +1939,19 @@ NpmPackageInfo(<a href="#NpmPackageInfo-direct_sources">direct_sources</a>, <a href="#NpmPackageInfo-sources">sources</a>, <a href="#NpmPackageInfo-workspace">workspace</a>) </pre> -Provides information about npm dependencies +Provides information about one or more external npm packages **FIELDS** <h4 id="NpmPackageInfo-direct_sources">direct_sources</h4> - Depset of direct source files in this npm package + Depset of direct source files in these external npm package(s) <h4 id="NpmPackageInfo-sources">sources</h4> - Depset of direct & transitive source files in this npm package and in its dependencies + Depset of direct & transitive source files in these external npm package(s) and transitive dependencies <h4 id="NpmPackageInfo-workspace">workspace</h4> - The workspace name that this npm package is provided from + The workspace name that these external npm package(s) are provided from
diff --git a/docs/Concatjs.html b/docs/Concatjs.html index aa0f09c..4549898 100755 --- a/docs/Concatjs.html +++ b/docs/Concatjs.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Concatjs.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Concatjs.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -284,17 +291,17 @@ <span class="p">)</span> </code></pre></div></div> -<h2 id="installing-with-self-managed-dependencies">Installing with self-managed dependencies</h2> +<h2 id="installing-with-user-managed-dependencies">Installing with user-managed dependencies</h2> <p>If you didn’t use the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule to create an <code class="language-plaintext highlighter-rouge">npm</code> workspace, you’ll have to declare a rule in your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file to execute karma:</p> <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Create a karma rule to use in karma_web_test_suite karma -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies </span><span class="n">nodejs_binary</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"karma/karma"</span><span class="p">,</span> <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"//:node_modules/karma/bin/karma"</span><span class="p">,</span> <span class="c1"># Point bazel to your node_modules to find the entry point -</span> <span class="n">node_modules</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> +</span> <span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> <span class="p">)</span> </code></pre></div></div> @@ -567,7 +574,7 @@ <li class="toc-entry toc-h2"><a href="#compatibility">Compatibility</a></li> <li class="toc-entry toc-h2"><a href="#serving-js-in-development-mode-under-bazel">Serving JS in development mode under Bazel</a></li> <li class="toc-entry toc-h2"><a href="#testing-with-karma">Testing with Karma</a></li> -<li class="toc-entry toc-h2"><a href="#installing-with-self-managed-dependencies">Installing with self-managed dependencies</a></li> +<li class="toc-entry toc-h2"><a href="#installing-with-user-managed-dependencies">Installing with user-managed dependencies</a></li> <li class="toc-entry toc-h2"><a href="#concatjs_devserver">concatjs_devserver</a></li> <li class="toc-entry toc-h2"><a href="#karma_web_test">karma_web_test</a></li> <li class="toc-entry toc-h2"><a href="#karma_web_test_suite">karma_web_test_suite</a></li>
diff --git a/docs/Concatjs.md b/docs/Concatjs.md index f3842e1..3505b40 100755 --- a/docs/Concatjs.md +++ b/docs/Concatjs.md
@@ -134,23 +134,22 @@ ``` -## Installing with self-managed dependencies +## Installing with user-managed dependencies If you didn't use the `yarn_install` or `npm_install` rule to create an `npm` workspace, you'll have to declare a rule in your root `BUILD.bazel` file to execute karma: ```python # Create a karma rule to use in karma_web_test_suite karma -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies nodejs_binary( name = "karma/karma", entry_point = "//:node_modules/karma/bin/karma", # Point bazel to your node_modules to find the entry point - node_modules = ["//:node_modules"], + data = ["//:node_modules"], ) ``` - ## concatjs_devserver **USAGE**
diff --git a/docs/Cypress.html b/docs/Cypress.html index 1a5ef1b..236e46f 100755 --- a/docs/Cypress.html +++ b/docs/Cypress.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Cypress.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Cypress.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/Jasmine.html b/docs/Jasmine.html index 915a0c0..8e7cef9 100755 --- a/docs/Jasmine.html +++ b/docs/Jasmine.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Jasmine.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Jasmine.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/Labs.html b/docs/Labs.html index 5ef3707..a9ae2b8 100755 --- a/docs/Labs.html +++ b/docs/Labs.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Labs.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Labs.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/Protractor.html b/docs/Protractor.html index 0575fbb..8493337 100755 --- a/docs/Protractor.html +++ b/docs/Protractor.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Protractor.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Protractor.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/Rollup.html b/docs/Rollup.html index 32fee8e..f723663 100755 --- a/docs/Rollup.html +++ b/docs/Rollup.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Rollup.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Rollup.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -176,17 +183,17 @@ <p>Add the <code class="language-plaintext highlighter-rouge">@bazel/rollup</code> npm package to your <code class="language-plaintext highlighter-rouge">devDependencies</code> in <code class="language-plaintext highlighter-rouge">package.json</code>.</p> -<h3 id="installing-with-self-managed-dependencies">Installing with self-managed dependencies</h3> +<h3 id="installing-with-user-managed-dependencies">Installing with user-managed dependencies</h3> <p>If you didn’t use the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule, you’ll have to declare a rule in your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file to execute rollup:</p> <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Create a rollup rule to use in rollup_bundle#rollup_bin -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies </span><span class="n">nodejs_binary</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"rollup_bin"</span><span class="p">,</span> <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"//:node_modules/rollup/bin/rollup"</span><span class="p">,</span> <span class="c1"># Point bazel to your node_modules to find the entry point -</span> <span class="n">node_modules</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> +</span> <span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> <span class="p">)</span> </code></pre></div></div> @@ -535,7 +542,7 @@ <ul class="section-nav"> <li class="toc-entry toc-h2"><a href="#installation">Installation</a> <ul> -<li class="toc-entry toc-h3"><a href="#installing-with-self-managed-dependencies">Installing with self-managed dependencies</a></li> +<li class="toc-entry toc-h3"><a href="#installing-with-user-managed-dependencies">Installing with user-managed dependencies</a></li> </ul> </li> <li class="toc-entry toc-h2"><a href="#usage">Usage</a>
diff --git a/docs/Rollup.md b/docs/Rollup.md index 9e40a22..1b2efb8 100755 --- a/docs/Rollup.md +++ b/docs/Rollup.md
@@ -20,18 +20,18 @@ Add the `@bazel/rollup` npm package to your `devDependencies` in `package.json`. -### Installing with self-managed dependencies +### Installing with user-managed dependencies If you didn't use the `yarn_install` or `npm_install` rule, you'll have to declare a rule in your root `BUILD.bazel` file to execute rollup: ```python # Create a rollup rule to use in rollup_bundle#rollup_bin -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies nodejs_binary( name = "rollup_bin", entry_point = "//:node_modules/rollup/bin/rollup", # Point bazel to your node_modules to find the entry point - node_modules = ["//:node_modules"], + data = ["//:node_modules"], ) ```
diff --git a/docs/Terser.html b/docs/Terser.html index 0e8cca7..d68a4af 100755 --- a/docs/Terser.html +++ b/docs/Terser.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/Terser.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/Terser.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -178,17 +185,17 @@ <p>Add the <code class="language-plaintext highlighter-rouge">@bazel/terser</code> npm package to your <code class="language-plaintext highlighter-rouge">devDependencies</code> in <code class="language-plaintext highlighter-rouge">package.json</code>.</p> -<h2 id="installing-with-self-managed-dependencies">Installing with self-managed dependencies</h2> +<h2 id="installing-with-user-managed-dependencies">Installing with user-managed dependencies</h2> <p>If you didn’t use the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule, you’ll have to declare a rule in your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file to execute terser:</p> <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Create a terser rule to use in terser_minified#terser_bin -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies </span><span class="n">nodejs_binary</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"terser_bin"</span><span class="p">,</span> <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"//:node_modules/terser/bin/uglifyjs"</span><span class="p">,</span> <span class="c1"># Point bazel to your node_modules to find the entry point -</span> <span class="n">node_modules</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> +</span> <span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> <span class="p">)</span> </code></pre></div></div> @@ -309,7 +316,7 @@ </ul> <ul class="section-nav"> <li class="toc-entry toc-h2"><a href="#installation">Installation</a></li> -<li class="toc-entry toc-h2"><a href="#installing-with-self-managed-dependencies">Installing with self-managed dependencies</a></li> +<li class="toc-entry toc-h2"><a href="#installing-with-user-managed-dependencies">Installing with user-managed dependencies</a></li> <li class="toc-entry toc-h2"><a href="#terser_minified">terser_minified</a></li> </ul> </div>
diff --git a/docs/Terser.md b/docs/Terser.md index 0d9165a..c32e271 100755 --- a/docs/Terser.md +++ b/docs/Terser.md
@@ -22,18 +22,18 @@ Add the `@bazel/terser` npm package to your `devDependencies` in `package.json`. -## Installing with self-managed dependencies +## Installing with user-managed dependencies If you didn't use the `yarn_install` or `npm_install` rule, you'll have to declare a rule in your root `BUILD.bazel` file to execute terser: ```python # Create a terser rule to use in terser_minified#terser_bin -# attribute when using self-managed dependencies +# attribute when using user-managed dependencies nodejs_binary( name = "terser_bin", entry_point = "//:node_modules/terser/bin/uglifyjs", # Point bazel to your node_modules to find the entry point - node_modules = ["//:node_modules"], + data = ["//:node_modules"], ) ```
diff --git a/docs/TypeScript.html b/docs/TypeScript.html index 2e66869..05a2f87 100755 --- a/docs/TypeScript.html +++ b/docs/TypeScript.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/TypeScript.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/TypeScript.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -236,7 +243,7 @@ <p>Make sure to remove the <code class="language-plaintext highlighter-rouge">--noEmit</code> compiler option from your <code class="language-plaintext highlighter-rouge">tsconfig.json</code>. This is not compatible with the <code class="language-plaintext highlighter-rouge">ts_library</code> rule.</p> -<h2 id="self-managed-npm-dependencies">Self-managed npm dependencies</h2> +<h2 id="user-managed-npm-dependencies">User-managed npm dependencies</h2> <p>We recommend you use Bazel managed dependencies, but if you would like Bazel to also install a <code class="language-plaintext highlighter-rouge">node_modules</code> in your workspace you can also @@ -254,7 +261,7 @@ <p>To use your workspace <code class="language-plaintext highlighter-rouge">node_modules</code> folder as a dependency in <code class="language-plaintext highlighter-rouge">ts_library</code> and other rules, add the following to your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file:</p> -<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">filegroup</span><span class="p">(</span> +<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">js_library</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"node_modules"</span><span class="p">,</span> <span class="n">srcs</span> <span class="o">=</span> <span class="n">glob</span><span class="p">(</span> <span class="n">include</span> <span class="o">=</span> <span class="p">[</span> @@ -274,15 +281,18 @@ <span class="s">"node_modules/**/* *"</span><span class="p">,</span> <span class="p">],</span> <span class="p">),</span> + <span class="c1"># Provide ExternalNpmPackageInfo which is used by downstream rules +</span> <span class="c1"># that use these npm dependencies +</span> <span class="n">external_npm_package</span> <span class="o">=</span> <span class="bp">True</span><span class="p">,</span> <span class="p">)</span> <span class="c1"># Create a tsc_wrapped compiler rule to use in the ts_library -# compiler attribute when using self-managed dependencies +# compiler attribute when using user-managed dependencies </span><span class="n">nodejs_binary</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"@bazel/typescript/tsc_wrapped"</span><span class="p">,</span> <span class="n">entry_point</span> <span class="o">=</span> <span class="s">"@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js"</span><span class="p">,</span> <span class="c1"># Point bazel to your node_modules to find the entry point -</span> <span class="n">node_modules</span> <span class="o">=</span> <span class="s">"//:node_modules"</span><span class="p">,</span> +</span> <span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//:node_modules"</span><span class="p">],</span> <span class="p">)</span> </code></pre></div></div> @@ -356,18 +366,19 @@ <p>You can also use the <code class="language-plaintext highlighter-rouge">@npm//@types</code> target which will include all packages in the <code class="language-plaintext highlighter-rouge">@types</code> scope as dependencies.</p> -<p>If you are using self-managed npm dependencies, you can use the -<code class="language-plaintext highlighter-rouge">node_modules</code> attribute in <code class="language-plaintext highlighter-rouge">ts_library</code> and point it to the -<code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup defined in your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file. +<p>If you are using user-managed npm dependencies, you can pass your <code class="language-plaintext highlighter-rouge">//:node_modules</code> +target defined in your root <code class="language-plaintext highlighter-rouge">BUILD.bazel</code> file to the deps of <code class="language-plaintext highlighter-rouge">ts_library</code>. You’ll also need to override the <code class="language-plaintext highlighter-rouge">compiler</code> attribute if you do this -as the Bazel-managed deps and self-managed cannot be used together +as the Bazel-managed deps and user-managed cannot be used together in the same rule.</p> <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">ts_library</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"my_code"</span><span class="p">,</span> <span class="n">srcs</span> <span class="o">=</span> <span class="n">glob</span><span class="p">([</span><span class="s">"*.ts"</span><span class="p">]),</span> - <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span><span class="s">"//path/to/other:library"</span><span class="p">],</span> - <span class="n">node_modules</span> <span class="o">=</span> <span class="s">"//:node_modules"</span><span class="p">,</span> + <span class="n">deps</span> <span class="o">=</span> <span class="p">[</span> + <span class="s">"//path/to/other:library"</span><span class="p">,</span> + <span class="s">"//:node_modules"</span><span class="p">,</span> + <span class="p">],</span> <span class="n">compiler</span> <span class="o">=</span> <span class="s">"//:@bazel/typescript/tsc_wrapped"</span><span class="p">,</span> <span class="p">)</span> </code></pre></div></div> @@ -497,9 +508,8 @@ <pre> ts_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>, <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>, - <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>, - <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>, - <a href="#ts_library-use_angular_plugin">use_angular_plugin</a>) + <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-prodmode_module">prodmode_module</a>, <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>, <a href="#ts_library-use_angular_plugin">use_angular_plugin</a>) </pre> <p><code class="language-plaintext highlighter-rouge">ts_library</code> type-checks and compiles a set of TypeScript sources to JavaScript.</p> @@ -597,66 +607,6 @@ <p>Defaults to <code class="language-plaintext highlighter-rouge">""</code></p> -<h4 id="ts_library-node_modules">node_modules</h4> - -<p>(<em><a href="https://bazel.build/docs/build-ref.html#labels">Label</a></em>): The npm packages which should be available during the compile.</p> - -<p>The default value of <code class="language-plaintext highlighter-rouge">//typescript:typescript__typings</code> is setup -for projects that use bazel managed npm deps. This default is in place -since ts_library will always depend on at least the typescript -default libs which are provided by <code class="language-plaintext highlighter-rouge">//typescript:typescript__typings</code>.</p> - -<p>This attribute is DEPRECATED. As of version 0.18.0 the recommended -approach to npm dependencies is to use fine grained npm dependencies -which are setup with the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rules.</p> - -<p>For example, in targets that used a <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup,</p> - -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ts_library( - name = "my_lib", - ... - node_modules = "//:node_modules", -) -</code></pre></div></div> - -<p>which specifies all files within the <code class="language-plaintext highlighter-rouge">//:node_modules</code> filegroup -to be inputs to the <code class="language-plaintext highlighter-rouge">my_lib</code>. Using fine grained npm dependencies, -<code class="language-plaintext highlighter-rouge">my_lib</code> is defined with only the npm dependencies that are -needed:</p> - -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ts_library( - name = "my_lib", - ... - deps = [ - "@npm//@types/foo", - "@npm//@types/bar", - "@npm//foo", - "@npm//bar", - ... - ], -) -</code></pre></div></div> - -<p>In this case, only the listed npm packages and their -transitive deps are includes as inputs to the <code class="language-plaintext highlighter-rouge">my_lib</code> target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153). -The default typescript libs are also available via the node_modules -default in this case.</p> - -<p>The @npm external repository and the fine grained npm package -targets are setup using the <code class="language-plaintext highlighter-rouge">yarn_install</code> or <code class="language-plaintext highlighter-rouge">npm_install</code> rule -in your WORKSPACE file:</p> - -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) -</code></pre></div></div> - -<p>Defaults to <code class="language-plaintext highlighter-rouge">@npm//typescript:typescript__typings</code></p> - <h4 id="ts_library-prodmode_module">prodmode_module</h4> <p>(<em>String</em>): Set the typescript <code class="language-plaintext highlighter-rouge">module</code> compiler option for prodmode output.</p> @@ -1081,7 +1031,7 @@ <ul class="section-nav"> <li class="toc-entry toc-h2"><a href="#alternatives">Alternatives</a></li> <li class="toc-entry toc-h2"><a href="#installation">Installation</a></li> -<li class="toc-entry toc-h2"><a href="#self-managed-npm-dependencies">Self-managed npm dependencies</a></li> +<li class="toc-entry toc-h2"><a href="#user-managed-npm-dependencies">User-managed npm dependencies</a></li> <li class="toc-entry toc-h2"><a href="#customizing-the-typescript-compiler-binary">Customizing the TypeScript compiler binary</a></li> <li class="toc-entry toc-h2"><a href="#usage">Usage</a> <ul>
diff --git a/docs/TypeScript.md b/docs/TypeScript.md index da94b3d..5adc710 100755 --- a/docs/TypeScript.md +++ b/docs/TypeScript.md
@@ -82,7 +82,7 @@ Make sure to remove the `--noEmit` compiler option from your `tsconfig.json`. This is not compatible with the `ts_library` rule. -## Self-managed npm dependencies +## User-managed npm dependencies We recommend you use Bazel managed dependencies, but if you would like Bazel to also install a `node_modules` in your workspace you can also @@ -103,7 +103,7 @@ other rules, add the following to your root `BUILD.bazel` file: ```python -filegroup( +js_library( name = "node_modules", srcs = glob( include = [ @@ -123,15 +123,18 @@ "node_modules/**/* *", ], ), + # Provide ExternalNpmPackageInfo which is used by downstream rules + # that use these npm dependencies + external_npm_package = True, ) # Create a tsc_wrapped compiler rule to use in the ts_library -# compiler attribute when using self-managed dependencies +# compiler attribute when using user-managed dependencies nodejs_binary( name = "@bazel/typescript/tsc_wrapped", entry_point = "@npm//:node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js", # Point bazel to your node_modules to find the entry point - node_modules = "//:node_modules", + data = ["//:node_modules"], ) ``` @@ -211,19 +214,20 @@ You can also use the `@npm//@types` target which will include all packages in the `@types` scope as dependencies. -If you are using self-managed npm dependencies, you can use the -`node_modules` attribute in `ts_library` and point it to the -`//:node_modules` filegroup defined in your root `BUILD.bazel` file. +If you are using user-managed npm dependencies, you can pass your `//:node_modules` +target defined in your root `BUILD.bazel` file to the deps of `ts_library`. You'll also need to override the `compiler` attribute if you do this -as the Bazel-managed deps and self-managed cannot be used together +as the Bazel-managed deps and user-managed cannot be used together in the same rule. ```python ts_library( name = "my_code", srcs = glob(["*.ts"]), - deps = ["//path/to/other:library"], - node_modules = "//:node_modules", + deps = [ + "//path/to/other:library", + "//:node_modules", + ], compiler = "//:@bazel/typescript/tsc_wrapped", ) ``` @@ -371,9 +375,8 @@ <pre> ts_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>, <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>, - <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>, - <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>, - <a href="#ts_library-use_angular_plugin">use_angular_plugin</a>) + <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-prodmode_module">prodmode_module</a>, <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>, <a href="#ts_library-use_angular_plugin">use_angular_plugin</a>) </pre> `ts_library` type-checks and compiles a set of TypeScript sources to JavaScript. @@ -474,69 +477,6 @@ Defaults to `""` -<h4 id="ts_library-node_modules">node_modules</h4> - -(*<a href="https://bazel.build/docs/build-ref.html#labels">Label</a>*): The npm packages which should be available during the compile. - -The default value of `//typescript:typescript__typings` is setup -for projects that use bazel managed npm deps. This default is in place -since ts_library will always depend on at least the typescript -default libs which are provided by `//typescript:typescript__typings`. - -This attribute is DEPRECATED. As of version 0.18.0 the recommended -approach to npm dependencies is to use fine grained npm dependencies -which are setup with the `yarn_install` or `npm_install` rules. - -For example, in targets that used a `//:node_modules` filegroup, - -``` -ts_library( - name = "my_lib", - ... - node_modules = "//:node_modules", -) -``` - -which specifies all files within the `//:node_modules` filegroup -to be inputs to the `my_lib`. Using fine grained npm dependencies, -`my_lib` is defined with only the npm dependencies that are -needed: - -``` -ts_library( - name = "my_lib", - ... - deps = [ - "@npm//@types/foo", - "@npm//@types/bar", - "@npm//foo", - "@npm//bar", - ... - ], -) -``` - -In this case, only the listed npm packages and their -transitive deps are includes as inputs to the `my_lib` target -which reduces the time required to setup the runfiles for this -target (see https://github.com/bazelbuild/bazel/issues/5153). -The default typescript libs are also available via the node_modules -default in this case. - -The @npm external repository and the fine grained npm package -targets are setup using the `yarn_install` or `npm_install` rule -in your WORKSPACE file: - -``` -yarn_install( - name = "npm", - package_json = "//:package.json", - yarn_lock = "//:yarn.lock", -) -``` - -Defaults to `@npm//typescript:typescript__typings` - <h4 id="ts_library-prodmode_module">prodmode_module</h4> (*String*): Set the typescript `module` compiler option for prodmode output.
diff --git a/docs/_includes/sidenav.html b/docs/_includes/sidenav.html index 68647a4..3b651bf 100644 --- a/docs/_includes/sidenav.html +++ b/docs/_includes/sidenav.html
@@ -6,7 +6,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="{{ page.url | relative_url }}">3.0</option> + <option value="https://docs.aspect.dev{{ page.url | relative_url }}">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="{{ "/" | relative_url }}">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/changing-rules.html b/docs/changing-rules.html index 7e1b5fb..2312c39 100755 --- a/docs/changing-rules.html +++ b/docs/changing-rules.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/changing-rules.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/changing-rules.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/debugging.html b/docs/debugging.html index 8ab95d2..d721e00 100755 --- a/docs/debugging.html +++ b/docs/debugging.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/debugging.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/debugging.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/dependencies.html b/docs/dependencies.html index 1ae82bf..41f7059 100755 --- a/docs/dependencies.html +++ b/docs/dependencies.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/dependencies.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/dependencies.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/examples.html b/docs/examples.html index 9e3198d..5f542b7 100755 --- a/docs/examples.html +++ b/docs/examples.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/examples.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/examples.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/index.html b/docs/index.html index 2f92cc2..c4ee785 100755 --- a/docs/index.html +++ b/docs/index.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/install.html b/docs/install.html index f152d86..7d1f916 100755 --- a/docs/install.html +++ b/docs/install.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/install.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/install.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li> @@ -187,8 +194,8 @@ <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">load</span><span class="p">(</span><span class="s">"@bazel_tools//tools/build_defs/repo:http.bzl"</span><span class="p">,</span> <span class="s">"http_archive"</span><span class="p">)</span> <span class="n">http_archive</span><span class="p">(</span> <span class="n">name</span> <span class="o">=</span> <span class="s">"build_bazel_rules_nodejs"</span><span class="p">,</span> - <span class="n">sha256</span> <span class="o">=</span> <span class="s">"290b659e7a6323e442db922175a4838e4ac622509f9e9fa0dd16b7ca30377d68"</span><span class="p">,</span> - <span class="n">urls</span> <span class="o">=</span> <span class="p">[</span><span class="s">"https://github.com/bazelbuild/rules_nodejs/releases/download/3.0.0-rc.0/rules_nodejs-3.0.0-rc.0.tar.gz"</span><span class="p">],</span> + <span class="n">sha256</span> <span class="o">=</span> <span class="s">"84b1d11b1f3bda68c24d992dc6e830bca9db8fa12276f2ca7fcb7761c893976b"</span><span class="p">,</span> + <span class="n">urls</span> <span class="o">=</span> <span class="p">[</span><span class="s">"https://github.com/bazelbuild/rules_nodejs/releases/download/3.0.0-rc.1/rules_nodejs-3.0.0-rc.1.tar.gz"</span><span class="p">],</span> <span class="p">)</span> <span class="n">load</span><span class="p">(</span><span class="s">"@build_bazel_rules_nodejs//:index.bzl"</span><span class="p">,</span> <span class="s">"node_repositories"</span><span class="p">)</span>
diff --git a/docs/repositories.html b/docs/repositories.html index 0a05a6a..3b4f018 100755 --- a/docs/repositories.html +++ b/docs/repositories.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/repositories.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/repositories.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>
diff --git a/docs/stamping.html b/docs/stamping.html index 0059eea..d515e49 100755 --- a/docs/stamping.html +++ b/docs/stamping.html
@@ -77,7 +77,14 @@ </a> <nav class="sidebar collapse" id="sidebar-nav"> + <select onchange="location.href=this.value"> + <option selected disabled hidden>Version: 3.0</option> + <option value="/rules_nodejs/stamping.html">3.0</option> + <option value="https://docs.aspect.dev/rules_nodejs/stamping.html">2.3</option> + </select> + <h3>rules_nodejs</h3> + <ul class="sidebar-nav"> <li><a href="/rules_nodejs/">Introduction</a></li> <li><a href="install.html">Installation</a></li>