diff --git a/README.md b/README.md index 0a89b79d93..41d41023b6 100644 --- a/README.md +++ b/README.md @@ -381,19 +381,8 @@ For example, the `protractor` package has two bin entries in its `package.json`: These will result in two generated `nodejs_binary` targets in the `@npm//protractor/bin` package (if your npm deps workspace is `@npm`): -```python -nodejs_binary( - name = "protractor", - entry_point = "protractor/bin/protractor", - data = ["//protractor"], -) - -nodejs_binary( - name = "webdriver-manager", - entry_point = "protractor/bin/webdriver-manager", - data = ["//protractor"], -) -``` +* `@npm//protractor/bin:protractor` +* `@npm//protractor/bin:webdriver-manager` These targets can be used as executables for actions in custom rules or can be run by Bazel directly. For example, you can run protractor with the @@ -513,7 +502,7 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary") nodejs_binary( name = "rollup", - entry_point = "rollup/bin/rollup", + entry_point = "//:node_modules/rollup/bin/rollup", ) ``` @@ -541,7 +530,7 @@ nodejs_binary( "@//:node_modules", "main.js", ], - entry_point = "workspace_name/main.js", + entry_point = ":main.js", args = ["--node_options=--expose-gc"], ) ``` diff --git a/e2e/ts_library/googmodule/BUILD.bazel b/e2e/ts_library/googmodule/BUILD.bazel index cc9dd44f2d..3e7d409194 100644 --- a/e2e/ts_library/googmodule/BUILD.bazel +++ b/e2e/ts_library/googmodule/BUILD.bazel @@ -13,7 +13,7 @@ nodejs_binary( "@npm//@bazel/typescript", "@npm//tsickle", ], - entry_point = "@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js", + entry_point = "@npm//node_modules/@bazel/typescript:internal/tsc_wrapped/tsc_wrapped.js", install_source_map_support = False, ) diff --git a/e2e/ts_library/some_module/BUILD.bazel b/e2e/ts_library/some_module/BUILD.bazel index d3266aaab5..98e10c3163 100644 --- a/e2e/ts_library/some_module/BUILD.bazel +++ b/e2e/ts_library/some_module/BUILD.bazel @@ -25,7 +25,7 @@ nodejs_binary( ":main", ":some_module", ], - entry_point = "e2e_ts_library/some_module/main.js", + entry_point = ":main.js", ) sh_test( diff --git a/examples/program/BUILD.bazel b/examples/program/BUILD.bazel index 4ad335fafe..d7980f1a07 100644 --- a/examples/program/BUILD.bazel +++ b/examples/program/BUILD.bazel @@ -38,7 +38,7 @@ nodejs_binary( "index.js", ":node_modules", ], - entry_point = "examples_program/index.js", + entry_point = ":index.js", ) jasmine_node_test( diff --git a/internal/e2e/fine_grained_no_bin/BUILD.bazel b/internal/e2e/fine_grained_no_bin/BUILD.bazel index cedd46cbf6..3a756df102 100644 --- a/internal/e2e/fine_grained_no_bin/BUILD.bazel +++ b/internal/e2e/fine_grained_no_bin/BUILD.bazel @@ -11,5 +11,5 @@ nodejs_binary( "index.js", "@fine_grained_no_bin//fs.realpath", ], - entry_point = "build_bazel_rules_nodejs/internal/e2e/fine_grained_no_bin/index.js", + entry_point = ":index.js", ) diff --git a/internal/e2e/rollup/BUILD.bazel b/internal/e2e/rollup/BUILD.bazel index 68737aab8e..f075ec0eef 100644 --- a/internal/e2e/rollup/BUILD.bazel +++ b/internal/e2e/rollup/BUILD.bazel @@ -7,7 +7,7 @@ rollup_bundle( "bar.js", "foo.js", ], - entry_point = "foo.js", + entry_point = "internal/e2e/rollup/foo.js", globals = {"some_global_var": "runtime_name_of_global_var"}, license_banner = ":license.txt", deps = [ diff --git a/internal/e2e/rollup_code_splitting/BUILD.bazel b/internal/e2e/rollup_code_splitting/BUILD.bazel index db8e87401c..a960b49645 100644 --- a/internal/e2e/rollup_code_splitting/BUILD.bazel +++ b/internal/e2e/rollup_code_splitting/BUILD.bazel @@ -7,7 +7,7 @@ rollup_bundle( exclude = ["*.spec.js"], ), additional_entry_points = ["internal/e2e/rollup_code_splitting/additional_entry.js"], - entry_point = "//internal/e2e/rollup_code_splitting/main1.js", + entry_point = "internal/e2e/rollup_code_splitting/main1.js", license_banner = ":license.txt", ) diff --git a/internal/e2e/rollup_fine_grained_deps/BUILD.bazel b/internal/e2e/rollup_fine_grained_deps/BUILD.bazel index 23199a17c4..48c878ec8f 100644 --- a/internal/e2e/rollup_fine_grained_deps/BUILD.bazel +++ b/internal/e2e/rollup_fine_grained_deps/BUILD.bazel @@ -5,7 +5,7 @@ load("//:defs.bzl", "jasmine_node_test", "nodejs_binary", "rollup_bundle") rollup_bundle( name = "bundle_no_deps", srcs = ["no-deps.js"], - entry_point = "@build_bazel_rules_nodejs//internal/e2e/rollup_fine_grained_deps:no-deps.js", + entry_point = "internal/e2e/rollup_fine_grained_deps/no-deps.js", ) # You can have a rollup_bundle with no node_modules attribute @@ -13,7 +13,7 @@ rollup_bundle( rollup_bundle( name = "bundle", srcs = ["has-deps.js"], - entry_point = "@build_bazel_rules_nodejs//internal/e2e/rollup_fine_grained_deps:has-deps.js", + entry_point = "internal/e2e/rollup_fine_grained_deps/has-deps.js", deps = [ "@fine_grained_deps_yarn//@gregmagolan/test-a", "@fine_grained_deps_yarn//@gregmagolan/test-b", @@ -25,7 +25,7 @@ rollup_bundle( rollup_bundle( name = "bundle_legacy", srcs = ["has-deps.js"], - entry_point = "@build_bazel_rules_nodejs//internal/e2e/rollup_fine_grained_deps:has-deps.js", + entry_point = "internal/e2e/rollup_fine_grained_deps/has-deps.js", node_modules = "@fine_grained_deps_yarn//:node_modules", ) @@ -34,7 +34,7 @@ rollup_bundle( rollup_bundle( name = "bundle_hybrid", srcs = ["has-deps.js"], - entry_point = "@build_bazel_rules_nodejs//internal/e2e/rollup_fine_grained_deps:has-deps.js", + entry_point = "internal/e2e/rollup_fine_grained_deps/has-deps.js", node_modules = "@fine_grained_deps_yarn//:node_modules", deps = [ "@fine_grained_deps_yarn//@gregmagolan/test-a", @@ -93,6 +93,6 @@ nodejs_binary( "@npm//jasmine", "@npm//unidiff", ], - entry_point = "build_bazel_rules_nodejs/internal/e2e/rollup_fine_grained_deps/update_golden.js", + entry_point = ":update_golden.js", install_source_map_support = False, ) diff --git a/internal/history-server/history_server.bzl b/internal/history-server/history_server.bzl index 944cf1eb03..9bf74723c3 100644 --- a/internal/history-server/history_server.bzl +++ b/internal/history-server/history_server.bzl @@ -26,7 +26,7 @@ def history_server(templated_args = [], **kwargs): nodejs_binary_macro( node_modules = "@history-server_runtime_deps//:node_modules", - entry_point = "history-server/modules/cli.js", + entry_point = "@history-server_runtime_deps//node_modules/history-server:modules/cli.js", install_source_map_support = False, templated_args = templated_args, **kwargs diff --git a/internal/http-server/http_server.bzl b/internal/http-server/http_server.bzl index 79aa1f93c9..42eb4f76f9 100644 --- a/internal/http-server/http_server.bzl +++ b/internal/http-server/http_server.bzl @@ -29,7 +29,7 @@ def http_server(templated_args = [], **kwargs): nodejs_binary_macro( node_modules = "@http-server_runtime_deps//:node_modules", - entry_point = "http-server/bin/http-server", + entry_point = "@http-server_runtime_deps//node_modules/http-server:bin/http-server", install_source_map_support = False, templated_args = templated_args, **kwargs diff --git a/internal/jasmine_node_test/test/BUILD.bazel b/internal/jasmine_node_test/test/BUILD.bazel index 15374b51d5..78c184ebfa 100644 --- a/internal/jasmine_node_test/test/BUILD.bazel +++ b/internal/jasmine_node_test/test/BUILD.bazel @@ -30,5 +30,5 @@ nodejs_test( "no_jasmine_test.js", "//internal/jasmine_node_test:jasmine_runner.js", ], - entry_point = "build_bazel_rules_nodejs/internal/jasmine_node_test/test/no_jasmine_test.js", + entry_point = ":no_jasmine_test.js", ) diff --git a/internal/node/node.bzl b/internal/node/node.bzl index 5ed6d031d8..877b9394bc 100644 --- a/internal/node/node.bzl +++ b/internal/node/node.bzl @@ -20,7 +20,7 @@ They support module mapping: any targets in the transitive dependencies with a `module_name` attribute can be `require`d by that name. """ -load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfiles") +load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfiles", "expand_path_into_runfiles") load("//internal/common:module_mappings.bzl", "module_mappings_runtime_aspect") load("//internal/common:node_module_info.bzl", "NodeModuleInfo", "collect_node_modules_aspect") load("//internal/common:sources_aspect.bzl", "sources_aspect") @@ -77,22 +77,6 @@ def _write_loader_script(ctx): if len(ctx.attr.entry_point.files) != 1: fail("labels in entry_point must contain exactly one file") - entry_point = ctx.file.entry_point - - print(">>>>>") - print("basename=(%s)" % entry_point.basename) - print("dirname=(%s)" % entry_point.dirname) - print("extension=(%s)" % entry_point.extension) - print("is_source=(%s)" % entry_point.is_source) - print("owner=(%s)" % entry_point.owner) - print("path=(%s)" % entry_point.path) - print("root=(%s)" % entry_point.root) - print("root.path=(%s)" % entry_point.root.path) - print("short_path=(%s)" % entry_point.short_path) - print("attr.entry_point=(%s)" % ctx.attr.entry_point.label) - print("ctx.label=(%s)" % str(ctx.label)) - print("<<<<<") - ctx.actions.expand_template( template = ctx.file._loader_template, output = ctx.outputs.loader, @@ -101,7 +85,7 @@ def _write_loader_script(ctx): "TEMPLATED_bootstrap": "\n " + ",\n ".join( ["\"" + d + "\"" for d in ctx.attr.bootstrap], ), - "TEMPLATED_entry_point": entry_point.short_path, + "TEMPLATED_entry_point": expand_path_into_runfiles(ctx, ctx.file.entry_point.short_path), "TEMPLATED_gen_dir": ctx.genfiles_dir.path, "TEMPLATED_install_source_map_support": str(ctx.attr.install_source_map_support).lower(), "TEMPLATED_module_roots": "\n " + ",\n ".join(module_mappings), @@ -170,7 +154,7 @@ def _nodejs_binary_impl(ctx): is_executable = True, ) - runfiles = depset([node, ctx.outputs.loader, ctx.file._repository_args] + node_modules + ctx.files._node_runfiles, transitive = [sources]) + runfiles = depset([node, ctx.outputs.loader, ctx.file._repository_args, ctx.file.entry_point] + node_modules + ctx.files._node_runfiles, transitive = [sources]) return [DefaultInfo( executable = ctx.outputs.script, @@ -240,6 +224,7 @@ _NODEJS_EXECUTABLE_ATTRS = { ``` """, + mandatory = True, allow_single_file = True, ), "install_source_map_support": attr.bool( diff --git a/internal/node/node_loader.js b/internal/node/node_loader.js index acdf7060b4..049ae4469f 100644 --- a/internal/node/node_loader.js +++ b/internal/node/node_loader.js @@ -25,7 +25,7 @@ var path = require('path'); var fs = require('fs'); -const DEBUG = true; +const DEBUG = false; /** * The module roots as pairs of a RegExp to match the require path, and a @@ -45,16 +45,26 @@ var BOOTSTRAP = [TEMPLATED_bootstrap]; const USER_WORKSPACE_NAME = 'TEMPLATED_user_workspace_name'; const NODE_MODULES_ROOT = 'TEMPLATED_node_modules_root'; const BIN_DIR = 'TEMPLATED_bin_dir'; +const ENTRY_POINT = 'TEMPLATED_entry_point'; const GEN_DIR = 'TEMPLATED_gen_dir'; +const INSTALL_SOURCE_MAP_SUPPORT = TEMPLATED_install_source_map_support; +const TARGET = 'TEMPLATED_target'; if (DEBUG) console.error(` -node_loader: running TEMPLATED_target with - MODULE_ROOTS: ${JSON.stringify(MODULE_ROOTS, undefined, 2)} - BOOTSTRAP: ${JSON.stringify(BOOTSTRAP, undefined, 2)} - NODE_MODULES_ROOT: ${NODE_MODULES_ROOT} +node_loader: running ${TARGET} with + cwd: ${process.cwd()} + runfiles: ${process.env.RUNFILES} + BIN_DIR: ${BIN_DIR} + BOOTSTRAP: ${JSON.stringify(BOOTSTRAP, undefined, 2)} + ENTRY_POINT: ${ENTRY_POINT} GEN_DIR: ${GEN_DIR} + INSTALL_SOURCE_MAP_SUPPORT: ${INSTALL_SOURCE_MAP_SUPPORT} + MODULE_ROOTS: ${JSON.stringify(MODULE_ROOTS, undefined, 2)} + NODE_MODULES_ROOT: ${NODE_MODULES_ROOT} + TARGET: ${TARGET} + USER_WORKSPACE_NAME: ${USER_WORKSPACE_NAME} `); function resolveToModuleRoot(path) { @@ -326,7 +336,8 @@ function resolveRunfiles(parent, ...pathSegments) { } var originalResolveFilename = module.constructor._resolveFilename; -module.constructor._resolveFilename = function(request, parent) { +module.constructor._resolveFilename = + function(request, parent) { const parentFilename = (parent && parent.filename) ? parent.filename : undefined; if (DEBUG) console.error(`node_loader: resolve ${request} from ${parentFilename}`); @@ -446,7 +457,7 @@ module.constructor._resolveFilename = function(request, parent) { } const error = new Error( - `TEMPLATED_target cannot find module '${request}' required by '${parentFilename}'\n looked in:\n` + + `${TARGET} cannot find module '${request}' required by '${parentFilename}'\n looked in:\n` + failedResolutions.map(r => ` ${r}`).join('\n') + '\n'); error.code = 'MODULE_NOT_FOUND'; throw error; @@ -454,7 +465,7 @@ module.constructor._resolveFilename = function(request, parent) { // Before loading anything that might print a stack, install the // source-map-support. -if (TEMPLATED_install_source_map_support) { +if (INSTALL_SOURCE_MAP_SUPPORT) { try { const sourcemap_support_package = path.resolve(process.cwd(), '../build_bazel_rules_nodejs/third_party/github.com/source-map-support'); @@ -463,7 +474,7 @@ if (TEMPLATED_install_source_map_support) { if (DEBUG) { console.error(`WARNING: source-map-support module not installed. Stack traces from languages like TypeScript will point to generated .js files. - Set install_source_map_support = False in TEMPLATED_target to turn off this warning. + Set install_source_map_support = False in ${TARGET} to turn off this warning. `); } } @@ -482,7 +493,7 @@ if (require.main === module) { // Set the actual entry point in the arguments list. // argv[0] == node, argv[1] == entry point. // NB: entry_point below is replaced during the build process. - var mainScript = process.argv[1] = 'TEMPLATED_entry_point'; + var mainScript = process.argv[1] = ENTRY_POINT; try { module.constructor._load(mainScript, this, /*isMain=*/true); } catch (e) { @@ -494,7 +505,7 @@ if (require.main === module) { // (which is an empty filegroup). // See https://github.com/bazelbuild/rules_nodejs/wiki#migrating-to-rules_nodejs-013 console.error( - `\nWARNING: Due to a breaking change in rules_nodejs 0.13.0, target TEMPLATED_target\n` + + `\nWARNING: Due to a breaking change in rules_nodejs 0.13.0, target ${TARGET}\n` + `must now declare either an explicit node_modules attribute, or\n` + `list explicit deps[] or data[] fine grained dependencies on npm labels\n` + `if it has any node_modules dependencies.\n` + diff --git a/internal/node/test/BUILD.bazel b/internal/node/test/BUILD.bazel index d6d8964619..dce4d938bf 100644 --- a/internal/node/test/BUILD.bazel +++ b/internal/node/test/BUILD.bazel @@ -13,7 +13,7 @@ nodejs_binary( nodejs_binary( name = "has_deps_legacy", data = ["has-deps.js"], - entry_point = ":has-deps", + entry_point = ":has-deps.js", node_modules = "@fine_grained_deps_yarn//:node_modules", ) @@ -25,7 +25,7 @@ nodejs_binary( "has-deps.js", "@fine_grained_deps_yarn//typescript", ], - entry_point = ":has-deps", + entry_point = ":has-deps.js", ) # You can have a nodejs_binary with both a node_modules attribute @@ -36,6 +36,6 @@ nodejs_binary( "has-deps.js", "@fine_grained_deps_yarn//typescript", ], - entry_point = ":has-deps", + entry_point = ":has-deps.js", node_modules = "@fine_grained_deps_yarn//:node_modules", ) diff --git a/internal/npm_install/generate_build_file.js b/internal/npm_install/generate_build_file.js index 5610671775..45dcb2f727 100644 --- a/internal/npm_install/generate_build_file.js +++ b/internal/npm_install/generate_build_file.js @@ -714,7 +714,7 @@ filegroup( result += `# Wire up the \`bin\` entry \`${name}\` nodejs_binary( name = "${name}__bin", - entry_point = "//node_modules/${pkg._dir}:${name}", + entry_point = ":${path}", install_source_map_support = False, data = [":${pkg._name}__pkg"], ) diff --git a/internal/npm_install/test/BUILD.bazel b/internal/npm_install/test/BUILD.bazel index 92ba86e560..e63a5bf8d6 100644 --- a/internal/npm_install/test/BUILD.bazel +++ b/internal/npm_install/test/BUILD.bazel @@ -34,6 +34,6 @@ nodejs_binary( "@npm//jasmine", "@npm//unidiff", ], - entry_point = "//internal/npm_install/test:update_golden.js", + entry_point = ":update_golden.js", install_source_map_support = False, ) diff --git a/internal/npm_install/test/golden/node_modules/@gregmagolan/test-a/BUILD.bazel.golden b/internal/npm_install/test/golden/node_modules/@gregmagolan/test-a/BUILD.bazel.golden index e3b120871e..b81339135d 100644 --- a/internal/npm_install/test/golden/node_modules/@gregmagolan/test-a/BUILD.bazel.golden +++ b/internal/npm_install/test/golden/node_modules/@gregmagolan/test-a/BUILD.bazel.golden @@ -27,7 +27,7 @@ filegroup( ) nodejs_binary( name = "test__bin", - entry_point = "//node_modules/@gregmagolan/test-a:test", + entry_point = "@bin/test.js", install_source_map_support = False, data = [":test-a__pkg"], ) diff --git a/internal/npm_install/test/golden/node_modules/jasmine/BUILD.bazel.golden b/internal/npm_install/test/golden/node_modules/jasmine/BUILD.bazel.golden index c0dc7983d2..e9663144ed 100644 --- a/internal/npm_install/test/golden/node_modules/jasmine/BUILD.bazel.golden +++ b/internal/npm_install/test/golden/node_modules/jasmine/BUILD.bazel.golden @@ -49,7 +49,7 @@ filegroup( ) nodejs_binary( name = "jasmine__bin", - entry_point = "//node_modules/jasmine:jasmine", + entry_point = ":bin/jasmine.js", install_source_map_support = False, data = [":jasmine__pkg"], ) diff --git a/internal/npm_package/BUILD.bazel b/internal/npm_package/BUILD.bazel index 4dc0a730f8..fb4c8e2d96 100644 --- a/internal/npm_package/BUILD.bazel +++ b/internal/npm_package/BUILD.bazel @@ -19,7 +19,7 @@ nodejs_binary( "//third_party/github.com/gjtorikian/isBinaryFile", "@nodejs//:run_npm.sh.template", ], - entry_point = "@build_bazel_rules_nodejs//internal/npm_package:packager.js", + entry_point = ":packager.js", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_npm_install_deps//:node_modules", visibility = ["//visibility:public"], diff --git a/internal/rollup/BUILD.bazel b/internal/rollup/BUILD.bazel index befce3f250..da72283970 100644 --- a/internal/rollup/BUILD.bazel +++ b/internal/rollup/BUILD.bazel @@ -38,7 +38,7 @@ nodejs_binary( # Allow --define=ROLLUP_BUNDLE_FIXED_CHUNK_NAMES=1 to be passed as # process.env so we can give predictable chunk names in CI configuration_env_vars = ["ROLLUP_BUNDLE_FIXED_CHUNK_NAMES"], - entry_point = "@build_bazel_rules_nodejs_rollup_deps//rollup/bin:rollup", + entry_point = "@build_bazel_rules_nodejs_rollup_deps//node_modules/rollup:bin/rollup", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], @@ -46,7 +46,7 @@ nodejs_binary( nodejs_binary( name = "tsc", - entry_point = " build_bazel_rules_nodejs_rollup_deps/node_modules/typescript/bin/tsc", + entry_point = "@build_bazel_rules_nodejs_rollup_deps//node_modules/typescript:bin/tsc", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], @@ -54,7 +54,7 @@ nodejs_binary( nodejs_binary( name = "terser", - entry_point = ":node_modules/terser/bin/uglifyjs", + entry_point = "@build_bazel_rules_nodejs_rollup_deps//node_modules/terser:bin/uglifyjs", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], @@ -63,7 +63,7 @@ nodejs_binary( nodejs_binary( name = "terser-wrapped", data = [":terser-wrapped.js"], - entry_point = "build_bazel_rules_nodejs/internal/rollup/terser-wrapped.js", + entry_point = ":terser-wrapped.js", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], @@ -72,7 +72,7 @@ nodejs_binary( nodejs_binary( name = "tsc-directory", data = [":tsc-directory.js"], - entry_point = "build_bazel_rules_nodejs/internal/rollup/tsc-directory.js", + entry_point = ":tsc-directory.js", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], @@ -80,7 +80,7 @@ nodejs_binary( nodejs_binary( name = "source-map-explorer", - entry_point = ":node_modules/source-map-explorer", + entry_point = "@build_bazel_rules_nodejs_rollup_deps//node_modules/source-map-explorer:index.js", install_source_map_support = False, node_modules = "@build_bazel_rules_nodejs_rollup_deps//:node_modules", visibility = ["//visibility:public"], diff --git a/internal/web_package/BUILD.bazel b/internal/web_package/BUILD.bazel index 611e9b6c5b..423342a91c 100644 --- a/internal/web_package/BUILD.bazel +++ b/internal/web_package/BUILD.bazel @@ -21,7 +21,7 @@ filegroup( nodejs_binary( name = "assembler", data = ["assembler.js"], - entry_point = "//internal/web_package:assembler.js", + entry_point = ":assembler.js", install_source_map_support = False, node_modules = ":node_modules_none", ) diff --git a/package.bzl b/package.bzl index 8e16652c1d..d29fbd4266 100644 --- a/package.bzl +++ b/package.bzl @@ -35,11 +35,11 @@ def rules_nodejs_dev_dependencies(): """ # Dependencies for generating documentation + # TODO(manekinekko): switch to https://github.com/bazelbuild/rules_sass/ when the changes have been released http_archive( name = "io_bazel_rules_sass", - url = "https://github.com/bazelbuild/rules_sass/archive/8ccf4f1c351928b55d5dddf3672e3667f6978d60.zip", # 2018-11-23 - strip_prefix = "rules_sass-8ccf4f1c351928b55d5dddf3672e3667f6978d60", - sha256 = "894d7928df8da85e263d743c8434d4c10ab0a3f0708fed0d53394e688e3faf70", + url = "https://github.com/manekinekko/rules_sass/archive/e6ea171ae9b6cd4b26ff8a928e1d8acc5c736123.zip", + strip_prefix = "rules_sass-e6ea171ae9b6cd4b26ff8a928e1d8acc5c736123", ) # Needed for stardoc diff --git a/packages/jasmine/src/jasmine_node_test.bzl b/packages/jasmine/src/jasmine_node_test.bzl index dc4352a239..c03f7fb4f9 100644 --- a/packages/jasmine/src/jasmine_node_test.bzl +++ b/packages/jasmine/src/jasmine_node_test.bzl @@ -41,7 +41,7 @@ def jasmine_node_test( deps: Other targets which produce JavaScript, such as ts_library expected_exit_code: The expected exit code for the test. Defaults to 0. tags: bazel tags applied to test - jasmine: a label providing the jasmine dependency + jasmine: a label providing the @bazel/jasmine npm dependency **kwargs: remaining arguments are passed to the test rule """ devmode_js_sources( @@ -54,7 +54,7 @@ def jasmine_node_test( all_data = data + srcs + deps + [jasmine] all_data += [":%s_devmode_srcs.MF" % name] all_data += [Label("@bazel_tools//tools/bash/runfiles")] - entry_point = "@bazel/jasmine/src/jasmine_runner.js" + entry_point = jasmine.relative(":src/jasmine_runner.js") nodejs_test( name = name, diff --git a/packages/karma/BUILD.bazel b/packages/karma/BUILD.bazel index f0eba80ab7..2efc7606f1 100644 --- a/packages/karma/BUILD.bazel +++ b/packages/karma/BUILD.bazel @@ -55,7 +55,7 @@ nodejs_binary( "@npm//requirejs", "@npm//tmp", ], - entry_point = "karma/bin/karma", + entry_point = "@npm//node_modules/karma:bin/karma", install_source_map_support = False, ) diff --git a/packages/karma/docs/install.md b/packages/karma/docs/install.md index 2d50e94dc4..4f390c83a7 100644 --- a/packages/karma/docs/install.md +++ b/packages/karma/docs/install.md @@ -45,7 +45,7 @@ If you didn't use the `yarn_install` or `npm_install` rule to create an `npm` wo # attribute when using self-managed dependencies nodejs_binary( name = "karma/karma", - entry_point = "karma/bin/karma", + entry_point = "//:node_modules/karma/bin/karma", # Point bazel to your node_modules to find the entry point node_modules = ["//:node_modules"], ) diff --git a/packages/typescript/WORKSPACE b/packages/typescript/WORKSPACE index bca2499b2e..27130ec2a3 100644 --- a/packages/typescript/WORKSPACE +++ b/packages/typescript/WORKSPACE @@ -14,17 +14,19 @@ load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dev_dependencies") rules_nodejs_dev_dependencies() # Uncomment for local development -local_repository( - name = "build_bazel_rules_typescript", - path = "../../../rules_typescript", -) +# local_repository( +# name = "build_bazel_rules_typescript", +# path = "../../../rules_typescript", +# ) # We use git_repository since Renovate knows how to update it. # With http_archive it only sees releases/download/*.tar.gz urls + +# TODO(manekinekko): switch to https://github.com/bazelbuild/rules_typescript/ when the changes have been released git_repository( name = "build_bazel_rules_typescript", - commit = "3a85a90c259e9c49f652142ce439044baad0f24e", - remote = "http://github.com/bazelbuild/rules_typescript.git", + commit = "fc05380a02bb9e4f5fe82d2d3b6e015b6cc18a40", + remote = "https://github.com/sfeir-open-source/rules_typescript.git", ) # We have a source dependency on build_bazel_rules_typescript diff --git a/packages/typescript/docs/BUILD.bazel b/packages/typescript/docs/BUILD.bazel index 6358bde82c..8f5640af6b 100644 --- a/packages/typescript/docs/BUILD.bazel +++ b/packages/typescript/docs/BUILD.bazel @@ -17,5 +17,5 @@ nodejs_test( "docs_test.js", ":index.md", ], - entry_point = "npm_bazel_typescript/docs/docs_test.js", + entry_point = ":docs_test.js", ) diff --git a/packages/typescript/internal/protobufjs/BUILD.bazel b/packages/typescript/internal/protobufjs/BUILD.bazel index 7b66045d0c..7d7b74cd2a 100644 --- a/packages/typescript/internal/protobufjs/BUILD.bazel +++ b/packages/typescript/internal/protobufjs/BUILD.bazel @@ -44,7 +44,7 @@ nodejs_binary( "@build_bazel_rules_typescript_protobufs_compiletime_deps//escodegen", "@build_bazel_rules_typescript_protobufs_compiletime_deps//estraverse", ], - entry_point = "protobufjs/bin/pbjs", + entry_point = "@build_bazel_rules_typescript_protobufs_compiletime_deps//node_modules/protobufjs:bin/pbjs.js", install_source_map_support = False, ) @@ -67,7 +67,7 @@ nodejs_binary( "@build_bazel_rules_typescript_protobufs_compiletime_deps//escodegen", "@build_bazel_rules_typescript_protobufs_compiletime_deps//estraverse", ], - entry_point = "protobufjs/bin/pbts", + entry_point = "@build_bazel_rules_typescript_protobufs_compiletime_deps//node_modules/protobufjs:bin/pbts.js", install_source_map_support = False, )