Releases: bazel-contrib/rules_nodejs
3.8.0
Upgrade with
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "e79c08a488cc5ac40981987d862c7320cee8741122a2649e9b08e850b6f20442",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.8.0/rules_nodejs-3.8.0.tar.gz"],
)
and update @bazel
-scoped npm packages
Features
@bazel/worker
package no longer checks whether the major version of rules_nodejs matches what it was built against.
Needed for our 4.0.0 release so that dependencies like the worker mode of rules_sass doesn't throw.
Bug Fixes
- remove current directory prefix when running from execroot (6be5186)
- builtin: correctly calculate pkg._directDependency when a mapped node_module is used (9e23f8a)
- labs: fix ts_proto_library handling of external proto_library (57c6576)
- runfiles: don't use false as a no-error value (#2837) (be8b27c)
- typescript: do not re-declare .json output files in srcs if they are already generated files (6508c6a)
- typescript: document tsc_test for typecheck-only (bc4d34a)
- typescript: fix bug in ts_project (write_tsconfig_rule) when extending from a generated tsconfig in same folder (10cca5c)
4.0.0-beta.1
Use 4.0.0-rc.0 instead
4.0.0-beta.0
chore(release): 4.0.0-beta.0
3.7.0
📣 This is likely the last 3.x release of rules_nodejs. We are entering the beta and RC period for 4.0
Upgrade with this WORKSPACE
snippet
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "8f5f192ba02319254aaf2cdcca00ec12eaafeb979a80a1e946773c520ae0a2c9",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.7.0/rules_nodejs-3.7.0.tar.gz"],
)
and upgrade your @bazel
-scoped npm packages as well.
Features
- builtin: add validate attribute on pkg_npm (5d30c5b), closes #2782
- typescript: support typescript 4.3 (847ef5d)
Bug Fixes
3.6.0
Upgrade with
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "0fa2d443571c9e02fcb7363a74ae591bdcce2dd76af8677a95965edf329d778a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.6.0/rules_nodejs-3.6.0.tar.gz"],
)
and update @bazel
-scoped npm packages as well.
Features
major performance improvement: node_modules can now be directories
In every prior release of rules_nodejs, third-party libraries from npm (node_modules) were given generated BUILD files that used a filegroup
to expose all the files in the package. Since npm typically has a very high library re-use, it's easy for a project using something like create-react-scripts (or any high-level workflow/build tool) to have tens of thousands of these files. This doesn't work well under Bazel's sandbox or runfiles features, because these do some filesystem operation for every file.
This release adds an add opt-in exports_directories_only mode to yarn_install and npm_install. It defaults to False, but we intend to flip the default to True in our next major release (4.0)
To opt-in, in your WORKSPACE:
npm_install(
name = "npm",
...
# export only top-level package directory artifacts from node_modules
exports_directories_only = True,
)
Then, to avoid warnings from Bazel about directories as sources, add this to your .bazelrc
:
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
Turning this on will decrease the time it takes for Bazel to setup runfiles and sandboxing when
there are a large number of npm dependencies as inputs to an action. One user observed an improvement from ~48m to ~30m on their build.
This breaks compatibilty for labels that reference files within npm packages such as @npm//:node_modules/prettier/bin-prettier.js
.
To reference files within npm packages, you can use the directory_file_path
rule and/or DirectoryFilePathInfo
provider.
Note, some rules still need upgrading to support consuming DirectoryFilePathInfo
where needed.
NB: This feature requires runfiles be enabled due to an issue in Bazel which we are still investigating.
On Windows runfiles are off by default and must be enabled with the --enable_runfiles
flag when
using this feature.
NB: ts_library
does not support directory artifact npm deps due to internal design choice of having all input sources files explicitly specified
NB: karma_web_test
and karma_web_test_suite
do not yet support directory artifact npm deps as they require node_modules/requirejs/require.js
& node_modules/karma-requirejs/lib/adapter.js
explicit source files in deps
For the nodejs_binary
& nodejs_test
entry_point
attribute (which often needs to reference a file within
an npm package) you can set the entry_point to a dict with a single entry, where the key corresponds to the directory artifact
label and the value corresponds to the path within that directory to the entry point.
For example,
nodejs_binary(
name = "prettier",
data = ["@npm//prettier"],
entry_point = "@npm//:node_modules/prettier/bin-prettier.js",
)
becomes,
nodejs_binary(
name = "prettier",
data = ["@npm//prettier"],
entry_point = { "@npm//:node_modules/prettier": "bin-prettier.js" },
)
For other labels that are passed to $(rootpath)
, $(execpath)
, or $(location)
you can simply break these apart into
the directory artifact label that gets passed to the expander & path part to follows it.
For example,
$(rootpath @npm//:node_modules/prettier/bin-prettier.js")
becomes,
$(rootpath @npm//:node_modules/prettier)/bin-prettier.js
Other features
- support dict style directory_file_path entry_point in nodejs_binary, nodejs_test & jasmine_node_test (737674f)
- support directory_file_path entry_point in npm_umd_bundle (4e44178)
Bug Fixes
- allow for only stderr to be set on npm_package_bin (fa8f5b1)
- builtin: add two missing locations where Mac M1 support needs to be declared (2ad950f), closes #2733
- builtin: propogate tags to both generated targets in generated_file_test (c4403fc)
- builtin: support directory_file_path entry_point in nodejs_binary & nodejs_test when --bazel_patch_module_resolver is set (51676ef)
- jasmine: don't assume entry_point is a label as it may now be a dict (3683466)
- jasmine: unhanded promise rejection causes tests suit to pass (3c4ef58), closes 3.7.0/lib/jasmine.js#L267 #2688
- terser: make terser resolve more robust by not assuming a single /terser/ segment in the path (4709ffb)
- typescript: fixed "output was not created" error for ts_project with supports_workers (807b07b)
- typescript: repair error reporting when a ts_project is missing declaration=True (cd08efe)
3.5.1
Upgrade with:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4a5d654a4ccd4a4c24eca5d319d85a88a650edf119601550c95bf400c8cc897e",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.5.1/rules_nodejs-3.5.1.tar.gz"],
)
and update your @bazel
-scoped npm packages.
Bug Fixes
- builtin: support for Apple Silicon (
darwin_arm64
) nodejs toolchain (Node 16 only) - builtin: document how nodejs_binary#entry_point can use a direc… (#2579) (ceddd1d)
- builtin: generated nodejs repository for windows references non-existent file (c1663c5)
- builtin: write stdout/stderr to correct path under chdir (#2681) (36311bb), closes #2680
- esbuild: prefer finding entry_point files in deps rather than srcs (#2692) (dd4c4f3)
- esbuild: provide JSModuleInfo of output bundle (#2685) (233254d)
- esbuild: update update script file paths after removal of _README.md (#2695) (25a5ac4)
- make generated_file_test
.update
's visibility same as test rule (#2677) (30bc86c)
3.5.0
To upgrade, paste into your WORKSPACE
:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "10f534e1c80f795cffe1f2822becd4897754d18564612510c59b3c73544ae7c6",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.5.0/rules_nodejs-3.5.0.tar.gz"],
)
and update your @bazel
-scoped npm packages.
Features
- builtin: add js_library JSEcmaScriptModuleInfo support (#2658) (5ad1596)
- builtin: allow bundling ESM output with the pkg_npm rule (#2648) (911529f)
- concatjs: enable junit report for karma_web_test (#2630) (28e8d23)
- esbuild: add support for multiple entry points (#2663) (b4f322a)
- esbuild: default log-level flag to warning, unless overridden (#2664) (8ffea3e)
Bug Fixes
- builtin: account for racy deletion of symlink in linker (#2662) (e9a683d)
- builtin: include optionalDependencies in strictly visible packages (#2657) (2a1ed31)
- builtin: linker incorrectly resolves workspace
node_modules
for windows (#2659) (7cf7d73) - concatjs: devserver not passing through tags to all targets (#2646) (8abc8e0)
- docs: correct title of stamping docs (4bea5b2)
- protractor: unable to specify
server
as configurable attribute (#2643) (4965db6)
3.4.2
Upgrade with
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "65067dcad93a61deb593be7d3d9a32a4577d09665536d8da536d731da5cd15e2",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.2/rules_nodejs-3.4.2.tar.gz"],
)
and update @bazel
-scoped npm packages.
Mostly a bunch of version bumps and refactoring in this release. Notably our docsite generation changed quite a bit, so please report any new rendering issues you spot in the docs.
Bug Fixes
Features
3.4.1
To update,
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"],
)
and update @bazel
-scoped npm packages.
Bug Fixes
- builtin: don't restart npm_install rule just to look up a label (#2621) (16d3a25), closes #2620
- builtin: gracefully handle the case of empty yarn_urls (#2619) (fea3db3)
- builtin: properly parse status file value containing spaces (#2615) (406dcb5)
- builtin: resolve vendored node/yarn from external repo (#2614) (3564940), closes #2019
- concatjs: update karma to 6.3.2 and fix #2093 (#2603) (c80479d)
- esbuild: correct rule argument documentation stating default target (#2608) (e710a6b)
- examples: transpile Angular es5 bundle to SystemJS (#2562) (b0175cd)
- typescript: handle .tsx inputs to angular (#2613) (901df38), closes #2542
- add support for terser 5 under node 12 and higher (#2558) (bd53eb5)
3.4.0
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "1134ec9b7baee008f1d54f0483049a97e53a57cd3913ec9d6db625549c98395a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz"],
)
and update your @bazel
-scoped packages.
Features
- add pre and post install patches to yarn_install and npm_install (#2607) (d805f33)
- support for multi-linked first party dependencies (e90b4ae)
- esbuild: add output_css flag to esbuild() (#2545) (c5ed4f8)
- esbuild: allow ts / tsx files in esbuilds srcs (#2594) (9e91872)