Releases: bazel-contrib/rules_nodejs
0.42.3
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.3/rules_nodejs-0.42.3.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
-scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Bug Fixes
- builtin: handle scoped packages in generated npm_umd_bundle targets (#1425) (e9e2e8e), closes #1095
- builtin: only stamp artifacts when --stamp is passed to bazel (#1441) (cbaab60)
- docs default values are now documented for rule attributes
Features
0.42.2
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "16fc00ab0d1e538e88f084272316c0693a2e9007d64f45529b82f6230aedb073",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.2/rules_nodejs-0.42.2.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
-scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Bug Fixes
0.42.1
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "c612d6b76eaa17540e8b8c806e02701ed38891460f9ba3303f4424615437887a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.1/rules_nodejs-0.42.1.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
-scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
New stuff
In 0.41.0 we noted that a feature for inserting <script>
and <link>
tags was dropped from ts_devserver
and pkg_web
but the replacement wasn't available. Now it is thanks to @jbedard who published a standalone npm package html-insert-assets
. You can see how it's wired in the examples.
If you waited to upgrade before, now you should.
Bug Fixes
- @npm//foobar:foobar__files target no longer includes nested node_modules (#1390) (a13f2b6)
- allow files in protractor data attribute (3feb13c)
- builtin: $(RULEDIR) npm_package_bin expansion should always be the root output directory (b494974)
- builtin: locations arg of npm_package_bin should result in separate argv (242379f)
- builtin: use correct genrule-style make vars (77039b1)
- examples: kotlin example server working (adf6934)
BREAKING CHANGES
- builtin: We fixed
npm_package_bin
and all rules generated by it, to match genrule behavior as documented at https://docs.bazel.build/versions/master/be/make-variables.html#predefined_genrule_variables
This means that usage of the$@
shortcut to refer to the output directory should now be$(@D)
whenoutput_dir=True
and you can now use$@
to refer to the location of a single output
0.42.0
This release had a bug, see 0.42.1 instead
https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.1
0.41.0
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "8dc1466f8563f3aa4ac7ab7aa3c96651eb7764108219f40b2d1c918e1a81c601",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.41.0/rules_nodejs-0.41.0.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
-scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
BREAKING CHANGES
As mentioned before, we are close to a 1.0 release, so we are making all our breaking changes now to prepare for a period of stability. Sorry for the long list this time!
web_package
rule has been renamed topkg_web
and is now a public API
Update your load statements from
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
to
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
ts_devserver
andpkg_web
(previouslyweb_package
) no longer have anindex_html
attribute.
They expect an index.html file to be among the assets, and to already have the script and link tags needed for the app to work.
The feature where those tags were injected into the html dynamically has been moved to its own rule, inject_html.
We are in a transition state where the
inject_html
rule is not published, because we want this to be a plain npm package and not Bazel-specific. We will publish this functionality soon. If you depend on it, you may want to delay this upgrade
If you do choose to upgrade, this PR that updates angular to this release may be a helpful example: angular/angular#33996.
-
pkg_web
(previouslyweb_package
) no longer hasdata
orassets
attributes. To be consistent with otherpkg_*
rules these two attributes have been combined and renamed tosrcs
. To migrate, move yourdata
&assets
targets tosrcs
. -
ts_devserver
no longer has adata
attribute. This attribute has been removed and as it now does the same thing as thestatic_files
attribute. To migrate, move yourdata
targets tostatic_files
. -
internal/rollup_bundle rule is removed. see https://github.com/bazelbuild/rules_nodejs/wiki for migration instructions
-
Removed the expand_location_into_runfiles helper from //internal:node.bzl
Load it from //internal/common:expand_into_runfiles instead -
npm karma deps for karma_web_test and karma_web_suite are now peer deps so that the versions used can be chosen by the user.
-
Removed the built-in
@io_bazel_rules_webtesting//browsers/sauce:chrome-win10
saucelabs support in karma_web_test. It is not very useful as it only tests a single browser and it difficult to use. In the angular repo, saucelabs support was implemented with a custom karma config using karma_web_test. This is the recommended approach. -
--define=DEBUG=1
is no longer functional to request debugging outputs. Use-c dbg
instead (this matches Bazel's behavior for C++). -
We renamed some of the generated targets in the
@nodejs//
workspace:
bazel run @nodejs//:npm
is replaced withbazel run @nodejs//:npm_node_repositories
andbazel run @nodejs//:yarn
is replaced withbazel run @nodejs//:yarn_node_repositories
.@nodejs//:yarn
and@nodejs//:npm
now run yarn & npm in the current working directory instead of on all of thepackage.json
files innode_repositories()
.
@nodejs//:bin/node
&@nodejs//:bin/node.cmd
(on Windows) are no longer valid targets. Use@nodejs//:node
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/node
.
@nodejs//:bin/yarn
&@nodejs//:bin/yarn.cmd
(on Windows) are no longer valid targets. Use@nodejs//:yarn
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/yarn
.
@nodejs//:bin/npm
&@nodejs//:bin/npm.cmd
(on Windows) are no longer valid targets. Use@nodejs//:npm
instead on all platforms. You can still call the old targets in their platform specific node repositories such as@nodejs_darwin_amd64//:bin/npm
.
Bug Fixes
- builtin: allow .tsx entry_point in node binary/test (313d484), closes #1351
- terser: call terser binary instead of uglifyjs (#1360) (a100420)
- terser: remove ngDevMode & ngI18nClosureMode global_defs from default terser config (98c8dbc)
chore
Code Refactoring
- move injector feature to own rule (be06d23)
Features
- node-patches\filesystem patcher. (#1332) (0b2f675)
- support --compilation_mode flag (9fa4343)
- builtin: rename @nodejs//:npm and @nodejs//:yarn to @nodejs//:[yarn/npm]_node_repositories (#1369) (01079a3)
- karma: npm peer deps & remove @rules_webtesting//browsers/sauce:chrome-win10 support (318bbf3)
- protractor: protractor npm package is now a peer deps (#1352) (5db7c8e)
0.40.0
To upgrade:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "9901bc17138a79135048fb0c107ee7a56e91815ec6594c08cb9a17b80276d62b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.40.0/rules_nodejs-0.40.0.tar.gz"],
)
Breaking Changes
The ts_web_test
and ts_web_test_suite
rules were duplicates of karma_web_test
and karma_web_test_suite
rules minus the config_file
attribute. The karma_web_test
and karma_web_test_suite
, which have identical APIs, should now be used instead.
They can be loaded from load("@npm_bazel_karma//:index.bzl", "karma_web_test")
and load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
.
Bug Fixes
- fix nodejs_binary cross-platform RBE issue #1305 (38d0b3d)
- prevent duplicate entries in owners files for global owners (afea290)
Features
0.39.1
Update:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "3d7296d834208792fa3b2ded8ec04e75068e3de172fae79db217615bd75a6ff7",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.39.1/rules_nodejs-0.39.1.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Bug Fixes
Features
- examples: demonstrate using Webpack to build and serve a React app (c5d0909)
0.39.0
Update:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "26c39450ce2d825abee5583a43733863098ed29d3cbaebf084ebaca59a21a1c8",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.39.0/rules_nodejs-0.39.0.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Cool stuff
Programs which dynamically require packages such as plugins now run correctly under npm_package_bin
. For example, we can now run Jest under Bazel and it can resolve the jest-babel plugin.
We are getting closer to a state where nearly all npm packages run under Bazel. The remaining issues are some handling of symlinks, where the program doesn't have a --preserveSymlinks
option or doesn't adhere to it in all places.
Bug Fixes
- bundle names in angular examples (b4f01e2)
- builtin: allow more than 2 segments in linker module names (7e98089)
- webpack should be a peerDep of @bazel/labs (312aa4d)
Code Refactoring
Features
- builtin: turn off a strict requirement for peer dependencies (#1163) (bd2f108)
- examples: add Jest example (#1274) (f864462), closes /github.com/ecosia/bazel_rules_nodejs_contrib/issues/4#issuecomment-475291612
BREAKING CHANGES
-
The
dynamic_deps
attribute of yarn_install and npm_install is removed,
in favor of declaring needed packages in the deps/data of the rule that
invokes the tool. The common consequence of this is you'll need to add dependencies like@npm//rollup-plugin-json
to thedeps
of arollup_bundle
rule. -
The old
rollup_bundle
rule is now deprecated. Instructions for migrating are printed when the rule is invoked. To continue using the old rule, add--define=enable_legacy_rollup_rule=1
to your bazel command or your.bazelrc
file, but be aware this code will be deleted before 1.0.
0.38.3
Update:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "ad4be2c6f40f5af70c7edf294955f9d9a0222c8e2756109731b25f79ea2ccea0",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.3/rules_nodejs-0.38.3.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Note: the npm packages @bazel/jasmine
, @bazel/karma
, @bazel/labs
, @bazel/protractor
, @bazel/rollup
, @bazel/terser
& @bazel/typescript
should be updated to version 0.38.3 to match the version of build_bazel_rules_nodejs
in your WORKSPACE file.
Bug Fixes
Features
0.38.2
Update:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "1447312c8570e8916da0f5f415186e7098cdd4ce48e04b8e864f793c766959c3",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.2/rules_nodejs-0.38.2.tar.gz"],
)
and run yarn upgrade --scope @bazel
to update all your @bazel
scoped npm packages to the latest versions.
(or manually do the npm equivalent - they don't have a way to update a scope)
Note: the npm packages @bazel/jasmine
, @bazel/karma
, @bazel/labs
, @bazel/protractor
, @bazel/rollup
, @bazel/terser
& @bazel/typescript
should be updated to version 0.38.2 to match the version of build_bazel_rules_nodejs
in your WORKSPACE file.
Cool stuff
You can now run any arbitrary test framework without a rule, here is a mocha_test
https://github.com/bazelbuild/rules_nodejs/blob/0.38.2/examples/webapp/BUILD.bazel#L34-L51
You can also refer to the output directory from an arbitrary tool that uses an outdir argument, here is tsc
https://github.com/bazelbuild/rules_nodejs/blob/0.38.2/examples/app/BUILD.bazel#L51-L74
Breaking Changes
The following breaking changes are from internal details so they should not affect most users. Some some downstream projects, however, such as Angular rely on these internal details and will need to be updated accordingly when updating to the next release.
- sources_aspect from /internal/node/node.bzl and /internal/common/sources_aspect.bzl is removed; its functionality was duplicate to what JSNamedModuleInfo providers
- NodeModuleSources is removed and its sources field is moved to NpmPackageInfo; sources in the removed scripts field are provided by the JSNamedModuleInfo provider which node_module_library now provides
- collect_node_modules_aspect renamed to just node_modules_aspect
Helper functiontransitive_js_ecma_script_module_info
in//:providers.bzl
renamed tojs_ecma_script_module_info
. It now returns a JSEcmaScriptModule info with bothsources
anddirect_sources
fields populated.
Note to Angular users, you'll need to patch Angular to account for the breaking changes, see https://github.com/bazelbuild/rules_nodejs/blob/0.38.2/examples/angular/package.json#L64 which uses the patch-package
npm helper to apply https://github.com/bazelbuild/rules_nodejs/tree/0.38.2/examples/angular/patches
Bug Fixes
- clean_nested_workspaces.sh (acaa5fb)
- rollup: handle transitive npm deps in rollup_bundle (77289e0)
- dont generate build files in symlinked node_modules (#1111) (2e7de34), closes #871
- linker can't assume that transitive module_mappings are in the sandbox (a67a844)
Features
- examples: add closure compiler example (79b0927)
- document the escape hatch from ts_library (#1247) (baa9aa8)
- examples: illustrate how to run a mocha test (#1216) (5485a8a)
- examples: update examples/angular to new rollup_bundle (#1238) (54f5d8c)
- terser: add source map links (32eb7ca)
- typescript: add a transitive_js_ecma_script_module_info alias to js_ecma_script_module_info (#1243) (77e2d4a)
- typescript: add direct_sources field to JSEcmaScriptModuleInfo (1ee00e6)
- typescript: add JSNamedModuleInfo provider to ts_library outputs (#1215) (bb1f9b4)