Skip to content

Commit

Permalink
Updated wasm_bindgen rules to only require core rules_nodejs rules (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed May 6, 2022
1 parent 1590670 commit fb4d554
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ bzl_library(
name = "docs_deps",
srcs = [
"@bazel_tools//tools:bzl_srcs",
"@build_bazel_rules_nodejs//:bzl",
"@com_google_protobuf//:bzl_srcs",
"@rules_nodejs//nodejs:bzl",
],
deps = [
"@bazel_skylib//lib:paths",
Expand Down
4 changes: 0 additions & 4 deletions docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_repositori

rust_wasm_bindgen_repositories()

load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")

node_repositories()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
Expand Down
6 changes: 6 additions & 0 deletions examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ rust_repository_set(
# Examples dependencies
###############################################################################

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

load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")

node_repositories()
Expand Down
6 changes: 1 addition & 5 deletions wasm_bindgen/providers.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
"""A module for re-exporting the providers used by the rust_wasm_bindgen rule"""

load(
"@build_bazel_rules_nodejs//:providers.bzl",
"@rules_nodejs//nodejs:providers.bzl",
_DeclarationInfo = "DeclarationInfo",
_JSEcmaScriptModuleInfo = "JSEcmaScriptModuleInfo",
_JSModuleInfo = "JSModuleInfo",
_JSNamedModuleInfo = "JSNamedModuleInfo",
)

DeclarationInfo = _DeclarationInfo
JSEcmaScriptModuleInfo = _JSEcmaScriptModuleInfo
JSModuleInfo = _JSModuleInfo
JSNamedModuleInfo = _JSNamedModuleInfo
6 changes: 3 additions & 3 deletions wasm_bindgen/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def rust_wasm_bindgen_repositories(register_default_toolchain = True):

maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "ddb78717b802f8dd5d4c01c340ecdc007c8ced5c1df7db421d0df3d642ea0580",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.6.0/rules_nodejs-4.6.0.tar.gz"],
name = "rules_nodejs",
sha256 = "26766278d815a6e2c43d2f6c9c72fde3fec8729e84138ffa4dabee47edc7702a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.2/rules_nodejs-core-5.4.2.tar.gz"],
)

# Load dependencies of the default toolchain and register it.
Expand Down
11 changes: 0 additions & 11 deletions wasm_bindgen/wasm_bindgen.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ load("//rust/private:transitions.bzl", "wasm_bindgen_transition")
load(
"//wasm_bindgen:providers.bzl",
"DeclarationInfo",
"JSEcmaScriptModuleInfo",
"JSModuleInfo",
"JSNamedModuleInfo",
)

_WASM_BINDGEN_DOC = """\
Expand Down Expand Up @@ -131,7 +129,6 @@ def _rust_wasm_bindgen_impl(ctx):
# Return a structure that is compatible with the deps[] of a ts_library.
declarations = depset(ts_out)
es5_sources = depset(js_out)
es6_sources = depset(js_out)

return [
DefaultInfo(
Expand All @@ -146,14 +143,6 @@ def _rust_wasm_bindgen_impl(ctx):
direct_sources = es5_sources,
sources = es5_sources,
),
JSNamedModuleInfo(
direct_sources = es5_sources,
sources = es5_sources,
),
JSEcmaScriptModuleInfo(
direct_sources = es6_sources,
sources = es6_sources,
),
]

rust_wasm_bindgen = rule(
Expand Down

0 comments on commit fb4d554

Please sign in to comment.