Skip to content

Releases: bazel-contrib/rules_nodejs

0.37.0

06 Sep 21:28
Compare
Choose a tag to compare

Upgrade:

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "0d9660cf0894f1fe1e9840818553e0080fbce0851169812d77a70bdb9981c946",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.37.0/rules_nodejs-0.37.0.tar.gz"],
)

Bug Fixes

  • builtin: --nolegacy_external_runfiles on build (38814aa)
  • builtin: fix localWorkspacePath logic (0a7fb01), closes #1087
  • npm_install: dynamic_deps attribute not working for scoped packages (bf68577)
  • node executables not running on windows if bash toolchain path (#1104) (c82b43d)
  • node_loader windows fix for RUNFILES_MANIFEST_FILE slashes (d3886ce)

chore

Features

  • add default DEBUG and VERBOSE_LOGS configuration_env_vars to nodejs_binary (#1080) (df37fca)
  • builtin: add Kotlin example (0912014)
  • builtin: introduce a linker (62037c9)

BREAKING CHANGES

  • A year-old compatibility layer for TypeScript was removed. See discussion in #1086
  • nodejs_binary and nodejs_test are no longer macros.

Targets like my_binary.bin are now gone.

If you are using the common pattern

const isProdserver = config.server.endsWith('prodserver');

in your protractor on_prepare .js code you will need to change that pattern to

const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver';

as config.server may now end in .sh or .bat

0.36.2

30 Aug 17:43
Compare
Choose a tag to compare

Upgrade:

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "da72ea53fa1cb8ab5ef7781ba06b97259b7d579a431ce480476266bc81bdf21d",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.2/rules_nodejs-0.36.2.tar.gz"],
)

Bug Fixes

Features

  • builtin: add a DeclarationInfo provider (3d7eb13)
  • add templated_args_file to allow long agrs to be written to a file (b34d7bb)
  • builtin: support yarn --frozen_lockfile (426861f)

Note: a new terser_minified rule is checked into master, but not included in this release, as we are not ready to commit to its public API yet. Should come in the next release.

0.36.1

20 Aug 18:00
Compare
Choose a tag to compare

Upgrade:

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "3356c6b767403392bab018ce91625f6d15ff8f11c6d772dc84bc9cada01c669a",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.1/rules_nodejs-0.36.1.tar.gz"],
)

Features

  • builtin: add browser to rollup mainFields (e488cb6)
  • builtin: introduce dynamic dependencies concept (a47410e)
  • less: add less link to the docs's drawer (ec6e0d1)
  • less: new less package (462f6e9)
  • less: updated default compiler to @bazel/less as mentioned in code review (fd71f26)
  • less: updated package.json in e2e/less to pull latest (6027aa3)

0.36.0

15 Aug 01:44
Compare
Choose a tag to compare

This release includes a new package @bazel/worker which is handy for wrapping nodejs programs as a persistent daemon process pool under Bazel. This makes tools faster, especially those with a long startup time like TypeScript that has to parse and JIT the typescript.js script on each execution. Check out the README.md

Breaking changes

The rules_nodejs_dependencies repository rule did nothing, and has been removed. Just delete any references to it.

Bug Fixes

  • jasmine: correct comment about behavior of config_file attr (59a7239)
  • fix yarn_install yarn cache mutex bug (31aa1a6)
  • get rules_go dependency from build_bazel_rules_typescript (ea6ee0b)
  • npm_package issue with external files on windows (8679b9e)
  • sconfig deps sandbox bug (161693c)

Features

  • jasmine: introduce config_file attribute (b0b2648)
  • jasmine_node_test: add attr jasmine_config (715ffc6)
  • worker: new worker package (9e26856)
  • add browser module main priority to generated umd bundles (17cfac9)

0.35.0

02 Aug 16:54
Compare
Choose a tag to compare

The documentation site at
https://bazelbuild.github.io/rules_nodejs/
is totally revamped and now includes documentation for all the rule sets!

There is a new @bazel/stylus package for running the Stylus CSS preprocessor.
See https://github.com/bazelbuild/rules_nodejs/blob/0.35.0/docs/Stylus.md

To upgrade, change the version in your /WORKSPACE

http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "6625259f9f77ef90d795d20df1d0385d9b3ce63b6619325f702b6358abb4ab33",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.35.0/rules_nodejs-0.35.0.tar.gz"],
)

and update the @bazel/* packages to 0.35.0 via npm or yarn:

$ npm outdated
# or 
$ yarn outdated

Bug Fixes

  • jasmine: enforce that jasmine_node_test is loaded from new location (7708858), closes #838
  • fencing for npm packages (#946) (780dfb4)

Features

  • builtin: do code splitting even if only one entry point (f51c129)
  • stylus: add initial stylus rule (804a788)
  • stylus: output sourcemap (dac014a)
  • stylus: support import by allowing files in deps (3987070)

BREAKING CHANGES

jasmine: You can no longer get jasmine_node_test from @build_bazel_rules_nodejs.

  • Use load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
    instead
  • You need to remove @npm//jasmine from the deps of the
    jasmine_node_test
  • If you use user-managed dependencies, see the commit for examples of
    the change needed

rollup_bundle now automatically does code-splitting when there are dynamic import() statements in your app.

You no longer need to specify additional_entry_points unless you really need to load them as a top-level script, not via an import from the main entry point.
This changes the outputs of the rollup_bundle. To go back to the previous behavior, add enable_code_splitting=False to your rollup_bundle rule.
Thanks to @Jesse-Good for contributing this!

0.34.0

23 Jul 23:58
Compare
Choose a tag to compare

Bug Fixes

  • builtin: process/browser should resolve from browserify (a98eda7)
  • fix for node windows cross-compile (001d945), closes #909
  • node runfiles resolution from external workspaces (82500de)

Features

  • protractor: add protractor rule (35a344c)

0.33.1

12 Jul 22:11
Compare
Choose a tag to compare
chore(release): 0.33.1

0.33.0

12 Jul 03:56
Compare
Choose a tag to compare

Toolchain support

The Node.js binary is now referenced as a Bazel toolchain, which means it's not tied to the architecture of the host where Bazel is running. This means on a Mac or Windows you can now

  • build a docker image on a mac
  • use remote build execution

Thanks to @Globegitter for contributing this!

See CHANGELOG.md for detailed release notes

0.32.2

21 Jun 22:29
Compare
Choose a tag to compare

This release fixes interactions with the new managed_directories Bazel feature. It also resolves a long standing worker mode issue with ts_library (rules_typescript#381).

ts_library @types

We improved how ts_library consumes @types npm packages. If you are using bazel managed deps, which is the default for ts_library unless you override the node_modules attribute with a filegroup, bazel will now only include the @types packages that are included in fine grained deps such as @npm//@types/typescript in the a compilation unit. This will also work if you use the medium grained dep @npm//@types or coarse grained deps such as node_modules = "@npm//:node_modules" which both include all @types packages. You can still put whatever values you like in your tsconfig coompileOptions.types array for editor support but ts_library will now ignore this value if you are using bazel managed deps.

Note: this change resolves rules_typescript#381, however, if you opt out of bazel managed deps you may still run into this issue.

npm packages that publish BUILD.bazel or WORKSPACE files

npm packages should contain JavaScript, not TypeScript. For this reason, we expect that package maintainers who use Bazel should not publish the build configuration files, as downstream users are not expected to build the package from sources. However, some packages do contain these files (rxjs does prior to 6.5.0 for example).

If these files appear in the node_modules tree, they change how files in the packages are referenced during the build. Bazel enforces that references are scoped to the "package" containing the file, and a "package" is defined by the presence of a BUILD.bazel file.

When installing dependencies using the yarn_install or npm_install repository rules, we can automatically move these files out of the way by prefixing their filename with underscore (_). See https://bazelbuild.github.io/rules_nodejs/npm_install/npm_install.html for documentation.
However, due to a bug (bazelbuild/bazel#8487) in Bazel, when the node_modules is recreated outside of Bazel, these BUILD.bazel files are reintroduced, and Bazel does not know to re-run the code that moves the files.

We publish a new package @bazel/hide-bazel-files as a workaround. If added as a dependency or transitive dependency in your project, this runs a postinstall step to rename any BUILD.bazel files in the node_modules to _BUILD.bazel.

Breaking Changes

  • Now depends on Bazel 0.27 or greater in order to get partial fix for bazelbuild/bazel#8487. Typical usage is to update the @bazel/bazel dependency in your package.json
  • BUILD.bazel files are no longer generated inside of the node_modules directory.
    If these files are found in node_modules you will get an error like npm package 'ansi-regex' from @npm yarn_install rule has a Bazel BUILD file 'BUILD.bazel'. Use the @bazel/hide-bazel-files utility to hide these files.
    This means that previously-generated files need to be removed.
    Run rm -rf node_modules and bazel clean --expunge to remove generated BUILD.bazel files in your node_modules.
  • Because BUILD.bazel files are no longer generated under node_modules, the node_modules folder is now a single Bazel package so any labels that point to files within bazel managed deps in previous versions, such as @npm//node_modules/zone.js:dist/zone.js, must now be changed to @npm//:node_modules/zone.js/dist/zone.js. The colon position has changed now that node_modules is a single Bazel package.

See CHANGELOG.md for a list of bugs fixed and features added.

0.32.1

27 Jun 18:30
Compare
Choose a tag to compare
chore(release): 0.32.1