diff --git a/defs.bzl b/defs.bzl index fab3e8c72b..b076c394ee 100644 --- a/defs.bzl +++ b/defs.bzl @@ -21,7 +21,7 @@ load("//internal/common:check_bazel_version.bzl", _check_bazel_version = "check_ load("//internal/node:node.bzl", _nodejs_binary = "nodejs_binary_macro", _nodejs_test = "nodejs_test_macro", - _sources_info = "SourcesInfo") + _sources_info = "NodeJSSourcesInfo") load("//internal/node:node_repositories.bzl",_node_repositories = "node_repositories") load("//internal/jasmine_node_test:jasmine_node_test.bzl", _jasmine_node_test = "jasmine_node_test") load("//internal/npm_install:npm_install.bzl", _npm_install = "npm_install", _yarn_install = "yarn_install") @@ -40,9 +40,9 @@ npm_install = _npm_install yarn_install = _yarn_install rollup_bundle = _rollup_bundle npm_package = _npm_package +NodeJSSourcesInfo = _sources_info history_server = _history_server http_server = _http_server -SourcesInfo = _sources_info # ANY RULES ADDED HERE SHOULD BE DOCUMENTED, run yarn skydoc to verify check_rules_nodejs_version = _check_rules_nodejs_version diff --git a/internal/node/node.bzl b/internal/node/node.bzl index 4adc05c63d..4026cb04e0 100644 --- a/internal/node/node.bzl +++ b/internal/node/node.bzl @@ -35,9 +35,10 @@ def _trim_package_node_modules(package_name): segments += [n] return "/".join(segments) -SourcesInfo = provider(fields = [ - "data", -]) +NodeJSSourcesInfo = provider( + doc = """Minimal files needed to run a NodeJS program, without npm packages""", + fields = {"data": "A list of File objects"}, +) def _write_loader_script(ctx): # Generates the JavaScript snippet of module roots mappings, with each entry @@ -159,7 +160,7 @@ def _nodejs_binary_impl(ctx): transitive_files = runfiles, ), ), - SourcesInfo( + NodeJSSourcesInfo( data = non_module_sources + [ctx.outputs.loader, ctx.outputs.script] ) ] @@ -273,7 +274,7 @@ _NODEJS_EXECUTABLE_ATTRS = { allow_files = True, single_file = True), "_node_runfiles": attr.label( - default = Label("@nodejs//:minimal_node_runfiles"), + default = Label("@nodejs//:node_runfiles"), allow_files = True), "_repository_args": attr.label( default = Label("@nodejs//:bin/node_args.sh"), diff --git a/internal/node/node_repositories.bzl b/internal/node/node_repositories.bzl index c88e565a48..5cbb048567 100644 --- a/internal/node/node_repositories.bzl +++ b/internal/node/node_repositories.bzl @@ -239,35 +239,10 @@ alias(name = "npm", actual = "{npm}") alias(name = "yarn", actual = "{yarn}") filegroup( name = "node_runfiles", - srcs = glob( - [ - "bin/node.js", - "{node_dir}/**", - "{yarn_dir}/**", - ], - exclude = [ - "**/*.md", - "**/*.html", - # These files are generated during node-gyp compilation and include - # absolute paths, making them non-hermetic. - # See https://github.com/bazelbuild/rules_nodejs/issues/347 - "**/*.pyc", - ], - ), -) - -filegroup( - name = "minimal_node_runfiles", - srcs = glob( - [ + srcs = [ "bin/node.js", "{node_dir}/bin/node", - ], - exclude = [ - "**/*.md", - "**/*.html", - ], - ), + ], ) """.format( node = node_entry,