diff --git a/WORKSPACE b/WORKSPACE index 0af1627d9c..94db91ed99 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Fetch rules_nodejs so we can install our npm dependencies http_archive( name = "build_bazel_rules_nodejs", - sha256 = "3887b948779431ac443e6a64f31b9e1e17b8d386a31eebc50ec1d9b0a6cabd2b", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.0.0/rules_nodejs-1.0.0.tar.gz"], + sha256 = "16fc00ab0d1e538e88f084272316c0693a2e9007d64f45529b82f6230aedb073", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.2/rules_nodejs-0.42.2.tar.gz"], ) # Check the bazel version and download npm dependencies @@ -29,7 +29,7 @@ Try running `yarn bazel` instead. minimum_bazel_version = "1.1.0", ) -check_rules_nodejs_version(minimum_version_string = "1.0.0") +check_rules_nodejs_version(minimum_version_string = "0.42.1") # Setup the Node.js toolchain node_repositories( diff --git a/package.json b/package.json index 06bfb0c910..ac09ab70ea 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "@angular-devkit/schematics": "^9.0.0-rc.3", "@angular/bazel": "file:./tools/npm/@angular_bazel", "@babel/core": "^7.6.4", - "@bazel/jasmine": "1.0.0", - "@bazel/karma": "1.0.0", - "@bazel/protractor": "1.0.0", - "@bazel/rollup": "1.0.0", - "@bazel/terser": "1.0.0", - "@bazel/typescript": "1.0.0", + "@bazel/jasmine": "0.42.2", + "@bazel/karma": "0.42.2", + "@bazel/protractor": "0.42.2", + "@bazel/rollup": "0.42.2", + "@bazel/terser": "0.42.2", + "@bazel/typescript": "0.42.2", "@microsoft/api-extractor": "^7.3.9", "@schematics/angular": "^9.0.0-rc.3", "@types/angular": "^1.6.47", diff --git a/packages/bazel/BUILD.bazel b/packages/bazel/BUILD.bazel index a9f6c52534..fa89f8aa0f 100644 --- a/packages/bazel/BUILD.bazel +++ b/packages/bazel/BUILD.bazel @@ -1,6 +1,6 @@ -load("//tools:defaults.bzl", "pkg_npm") +load("//tools:defaults.bzl", "npm_package") -pkg_npm( +npm_package( name = "npm_package", srcs = glob( ["*"], @@ -14,10 +14,10 @@ pkg_npm( "//packages/bazel/src/schematics:package_assets", "//packages/bazel/third_party/github.com/bazelbuild/bazel/src/main/protobuf:package_assets", ], - nested_packages = [ + packages = [ "//packages/bazel/docs", ], - substitutions = { + replacements = { "(#|\/\/)\\s+BEGIN-DEV-ONLY[\\w\W]+?(#|\/\/)\\s+END-DEV-ONLY": "", "//packages/bazel/": "//", "angular/packages/bazel/": "npm_angular_bazel/", diff --git a/packages/bazel/src/ng_package/ng_package.bzl b/packages/bazel/src/ng_package/ng_package.bzl index 48d7ec4f4e..88aaa759dc 100644 --- a/packages/bazel/src/ng_package/ng_package.bzl +++ b/packages/bazel/src/ng_package/ng_package.bzl @@ -15,9 +15,9 @@ specification of this format at https://goo.gl/jB3GVv load("@build_bazel_rules_nodejs//:providers.bzl", "JSEcmaScriptModuleInfo", "JSNamedModuleInfo", "NpmPackageInfo", "node_modules_aspect") load( - "@build_bazel_rules_nodejs//internal/pkg_npm:pkg_npm.bzl", - "PKG_NPM_ATTRS", - "PKG_NPM_OUTPUTS", + "@build_bazel_rules_nodejs//internal/npm_package:npm_package.bzl", + "NPM_PACKAGE_ATTRS", + "NPM_PACKAGE_OUTPUTS", "create_package", ) load("//packages/bazel/src:external.bzl", "FLAT_DTS_FILE_SUFFIX") @@ -623,7 +623,7 @@ def _ng_package_impl(ctx): package_dir = create_package( ctx, devfiles.to_list(), - [npm_package_directory] + ctx.files.nested_packages, + [npm_package_directory] + ctx.files.packages, ) return [DefaultInfo( files = depset([package_dir]), @@ -631,7 +631,7 @@ def _ng_package_impl(ctx): _NG_PACKAGE_DEPS_ASPECTS = [esm5_outputs_aspect, ng_package_module_mappings_aspect, node_modules_aspect] -_NG_PACKAGE_ATTRS = dict(PKG_NPM_ATTRS, **{ +_NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **{ "srcs": attr.label_list( doc = """JavaScript source files from the workspace. These can use ES2015 syntax and ES Modules (import/export)""", @@ -807,12 +807,12 @@ def _ng_package_outputs(name, entry_point, entry_point_name): "umd": "%s.umd.js" % basename, "umd_min": "%s.umd.min.js" % basename, } - for key in PKG_NPM_OUTPUTS: - # PKG_NPM_OUTPUTS is a "normal" dict-valued outputs so it looks like + for key in NPM_PACKAGE_OUTPUTS: + # NPM_PACKAGE_OUTPUTS is a "normal" dict-valued outputs so it looks like # "pack": "%{name}.pack", # But this is a function-valued outputs. # Bazel won't replace the %{name} token so we have to do it. - outputs[key] = PKG_NPM_OUTPUTS[key].replace("%{name}", name) + outputs[key] = NPM_PACKAGE_OUTPUTS[key].replace("%{name}", name) return outputs ng_package = rule( diff --git a/packages/bazel/test/ng_package/example/BUILD.bazel b/packages/bazel/test/ng_package/example/BUILD.bazel index eb52e7f3b5..67a55b7528 100644 --- a/packages/bazel/test/ng_package/example/BUILD.bazel +++ b/packages/bazel/test/ng_package/example/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "ng_module", "ng_package", "pkg_npm") +load("//tools:defaults.bzl", "ng_module", "ng_package", "npm_package") package(default_visibility = ["//packages/bazel/test:__subpackages__"]) @@ -26,7 +26,7 @@ ng_package( ], entry_point = ":index.ts", entry_point_name = "waffels", - nested_packages = [ + packages = [ ":arbitrary_npm_package", ], deps = [ @@ -52,7 +52,7 @@ genrule( output_to_bindir = True, ) -pkg_npm( +npm_package( name = "arbitrary_npm_package", srcs = [":arbitrary-npm-package-main.js"], ) diff --git a/packages/benchpress/BUILD.bazel b/packages/benchpress/BUILD.bazel index e2a2add5b1..3cb0cf4dfb 100644 --- a/packages/benchpress/BUILD.bazel +++ b/packages/benchpress/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "pkg_npm", "ts_library") +load("//tools:defaults.bzl", "npm_package", "ts_library") package(default_visibility = ["//visibility:public"]) @@ -18,7 +18,7 @@ ts_library( ], ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ "README.md", diff --git a/packages/common/BUILD.bazel b/packages/common/BUILD.bazel index e139b85ffb..d300f29f2d 100644 --- a/packages/common/BUILD.bazel +++ b/packages/common/BUILD.bazel @@ -26,7 +26,7 @@ ng_package( "//packages/common/upgrade:package.json", ], entry_point = ":index.ts", - nested_packages = ["//packages/common/locales:package"], + packages = ["//packages/common/locales:package"], tags = [ "release-with-framework", ], diff --git a/packages/common/locales/BUILD.bazel b/packages/common/locales/BUILD.bazel index c887cc32ae..391e9a0acb 100644 --- a/packages/common/locales/BUILD.bazel +++ b/packages/common/locales/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "pkg_npm", "ts_library") +load("//tools:defaults.bzl", "npm_package", "ts_library") package(default_visibility = ["//visibility:public"]) @@ -10,10 +10,11 @@ ts_library( ), ) -pkg_npm( +npm_package( name = "package", srcs = glob(["global/*.js"]) + ["package.json"], - substitutions = { + replacements = { + # Workaround for `.d.ts`` containing `/// ` # which are generated in TypeScript v2.9, but not before. "/// ": "", diff --git a/packages/compiler-cli/BUILD.bazel b/packages/compiler-cli/BUILD.bazel index 9b5a8f5e73..16b88b6f9c 100644 --- a/packages/compiler-cli/BUILD.bazel +++ b/packages/compiler-cli/BUILD.bazel @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//tools:defaults.bzl", "pkg_npm", "ts_library") +load("//tools:defaults.bzl", "npm_package", "ts_library") load("@npm_bazel_typescript//:index.bzl", "ts_config") ts_config( @@ -53,7 +53,7 @@ ts_library( ], ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ "package.json", diff --git a/packages/core/BUILD.bazel b/packages/core/BUILD.bazel index 54fe4f03db..c732e19f78 100644 --- a/packages/core/BUILD.bazel +++ b/packages/core/BUILD.bazel @@ -30,7 +30,7 @@ ng_package( "//packages/core/testing:package.json", ], entry_point = ":index.ts", - nested_packages = [ + packages = [ "//packages/core/schematics:npm_package", ], tags = [ diff --git a/packages/core/schematics/BUILD.bazel b/packages/core/schematics/BUILD.bazel index 3630353908..f393a73a34 100644 --- a/packages/core/schematics/BUILD.bazel +++ b/packages/core/schematics/BUILD.bazel @@ -1,11 +1,11 @@ -load("//tools:defaults.bzl", "pkg_npm") +load("//tools:defaults.bzl", "npm_package") exports_files([ "tsconfig.json", "migrations.json", ]) -pkg_npm( +npm_package( name = "npm_package", srcs = ["migrations.json"], visibility = ["//packages/core:__pkg__"], diff --git a/packages/elements/BUILD.bazel b/packages/elements/BUILD.bazel index 9915c87c87..e134ab4393 100644 --- a/packages/elements/BUILD.bazel +++ b/packages/elements/BUILD.bazel @@ -24,7 +24,7 @@ ng_package( "**/package.json", ]), entry_point = ":index.ts", - nested_packages = [ + packages = [ "//packages/elements/schematics:npm_package", ], tags = [ diff --git a/packages/elements/schematics/BUILD.bazel b/packages/elements/schematics/BUILD.bazel index 45b9fa8c11..f3d17d4571 100644 --- a/packages/elements/schematics/BUILD.bazel +++ b/packages/elements/schematics/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "pkg_npm") +load("//tools:defaults.bzl", "npm_package") package(default_visibility = ["//visibility:public"]) @@ -15,7 +15,7 @@ genrule( output_to_bindir = 1, ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ "collection.json", diff --git a/packages/language-service/BUILD.bazel b/packages/language-service/BUILD.bazel index 177cd98d52..db9d9e1229 100644 --- a/packages/language-service/BUILD.bazel +++ b/packages/language-service/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "pkg_npm", "ts_library") +load("//tools:defaults.bzl", "npm_package", "ts_library") package(default_visibility = ["//visibility:public"]) @@ -20,7 +20,7 @@ ts_library( ], ) -pkg_npm( +npm_package( name = "npm_package", srcs = ["package.json"], tags = [ diff --git a/packages/localize/BUILD.bazel b/packages/localize/BUILD.bazel index b81d1ad48d..d086fb082f 100644 --- a/packages/localize/BUILD.bazel +++ b/packages/localize/BUILD.bazel @@ -24,7 +24,7 @@ ng_package( "//packages/localize/init:package.json", ], entry_point = ":index.ts", - nested_packages = [ + packages = [ "//packages/localize/schematics:npm_package", "//packages/localize/src/tools:npm_package", ], diff --git a/packages/localize/schematics/BUILD.bazel b/packages/localize/schematics/BUILD.bazel index 30aed92bde..2f41c3f8a3 100644 --- a/packages/localize/schematics/BUILD.bazel +++ b/packages/localize/schematics/BUILD.bazel @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "pkg_npm") +load("//tools:defaults.bzl", "npm_package") package(default_visibility = ["//visibility:public"]) @@ -10,7 +10,7 @@ filegroup( visibility = ["//packages/localize:__subpackages__"], ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ "collection.json", diff --git a/packages/localize/src/tools/BUILD.bazel b/packages/localize/src/tools/BUILD.bazel index daf193f862..3fb61ab0ea 100644 --- a/packages/localize/src/tools/BUILD.bazel +++ b/packages/localize/src/tools/BUILD.bazel @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//tools:defaults.bzl", "pkg_npm", "ts_library") +load("//tools:defaults.bzl", "npm_package", "ts_library") load("@npm_bazel_typescript//:index.bzl", "ts_config") ts_config( @@ -30,7 +30,7 @@ ts_library( ], ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ ], diff --git a/packages/zone.js/BUILD.bazel b/packages/zone.js/BUILD.bazel index 379bab62ed..f683bc1480 100644 --- a/packages/zone.js/BUILD.bazel +++ b/packages/zone.js/BUILD.bazel @@ -1,4 +1,4 @@ -load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") +load("@build_bazel_rules_nodejs//:index.bzl", "npm_package") load("//packages/zone.js:bundles.bzl", "ES2015_BUNDLES", "ES5_BUNDLES", "ES5_GLOBAL_BUNDLES") exports_files([ @@ -21,7 +21,7 @@ genrule( cmd = "(echo '/**\n @license' && cat $< && echo '*/') > $@", ) -pkg_npm( +npm_package( name = "npm_package", srcs = [ "CHANGELOG.md", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index c761e3e78d..231c52c856 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -160,7 +160,7 @@ def ng_package(name, readme_md = None, license_banner = None, deps = [], **kwarg deps = deps, readme_md = readme_md, license_banner = license_banner, - substitutions = PKG_GROUP_REPLACEMENTS, + replacements = PKG_GROUP_REPLACEMENTS, ng_packager = _INTERNAL_NG_PACKAGE_PACKAGER, terser_config_file = _INTERNAL_NG_PACKAGE_DEFALUT_TERSER_CONFIG_FILE, rollup_config_tmpl = _INTERNAL_NG_PACKAGE_DEFAULT_ROLLUP_CONFIG_TMPL, @@ -168,11 +168,11 @@ def ng_package(name, readme_md = None, license_banner = None, deps = [], **kwarg **kwargs ) -def pkg_npm(name, substitutions = {}, **kwargs): +def npm_package(name, replacements = {}, **kwargs): """Default values for npm_package""" - _pkg_npm( + _npm_package( name = name, - substitutions = dict(substitutions, **PKG_GROUP_REPLACEMENTS), + replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS), **kwargs ) diff --git a/tools/ts-api-guardian/BUILD.bazel b/tools/ts-api-guardian/BUILD.bazel index 045b44d0ec..746712514b 100644 --- a/tools/ts-api-guardian/BUILD.bazel +++ b/tools/ts-api-guardian/BUILD.bazel @@ -1,5 +1,5 @@ # BEGIN-INTERNAL -load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") +load("@build_bazel_rules_nodejs//:index.bzl", "npm_package") load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") load("@npm_bazel_typescript//:index.bzl", "ts_library") @@ -29,7 +29,7 @@ genrule( cmd = "cp $< $@", ) -pkg_npm( +npm_package( name = "ts-api-guardian", srcs = [ "BUILD.bazel", @@ -38,7 +38,7 @@ pkg_npm( "index.bzl", "package.json", ], - substitutions = { + replacements = { "@angular//tools/ts-api-guardian:bin": "@npm_ts_api_guardian//:bin", "@angular//tools/ts-api-guardian:lib": "@npm//ts-api-guardian", "angular/tools/ts-api-guardian/": "npm_ts_api_guardian/", diff --git a/yarn.lock b/yarn.lock index 0d6230e9c7..b40a5c8f62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -981,41 +981,41 @@ resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.10.3.tgz#2e2b8a1d3e885946eac41db2b1aa6801fb319887" integrity sha512-v1nXbMTHVlMM4z4uWp6XiRoHAyUlYggF1SOboLLWRp0+D22kWixqArWqnozLw2mOtnxr97BdLjluWiho6A8Hjg== -"@bazel/jasmine@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.0.0.tgz#12aa82c0e4b7b5658e9e496b73c0cf660df2b0ae" - integrity sha512-cheQWMYs0PaS4kYwJC9tmAiyd0tLbPNcgoM+S8plNUp5k0gUVosCvQ0TOrxvRlKEY0ni1hdn9owPx2rUO1J+Wg== +"@bazel/jasmine@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-0.42.2.tgz#38e0d715e519e7ce4bce7d55b3e8accb2aad8217" + integrity sha512-OgxX84wPeWlHi4O2m0ezH9gTGx+wp3MR7QcC46PIIjWKL4W4L0Buss0R9AJeNTtxpjfv+8hfrDUI0bf2ZEIIjQ== dependencies: jasmine "~3.4.0" jasmine-core "~3.4.0" v8-coverage "1.0.9" -"@bazel/karma@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.0.0.tgz#6f1e31bc2cb698e50d76f43ec9f1ee095d8e72b8" - integrity sha512-esfsHRVWVcp6OyTk/QI1sBV7bcygFiXY6LUMPLPYqVZkQvJ0x+/L1weiwuRrqFf+FCwCajhYjwiR6S9kX2Z9LA== +"@bazel/karma@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-0.42.2.tgz#24e2cf150a5da1fbdeb9382822b0ba7e662455a1" + integrity sha512-fNrZ8fIHTFwr7DGKtZLFLZxV/7+txZfiHH6bDN73qOId91RY7rr82BHgZx/iDQqnaKCW0+o9i2gPqu7lutVc8g== dependencies: tmp "0.1.0" -"@bazel/protractor@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.0.0.tgz#b77fde3bb53a008c330c13a953a0bf93aa06b5f1" - integrity sha512-8kGuM3NkFfokjzKBlYxK9rUwJO/ICnYTHC567KJk6T4pjm4kfyh6iVI3Df3K+ONRCEYmiuZrQ37U06lzMMGN9g== +"@bazel/protractor@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-0.42.2.tgz#f20acd64e9456434cdc56903186fa31144a462a6" + integrity sha512-0LpRnaeL6/QHnNTK561aKFxAh4nECUNxrouC15XGWb57emj1q4a/IScAGwPrnb5dBQl1ZlgDXzyz/bqG928L1g== -"@bazel/rollup@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-1.0.0.tgz#85f38cf07ba8ea192e54c42cb53a44d1fd1f56ac" - integrity sha512-pOWwyeM/H+LWRpKm3xuSAXoZ1gl6o8kFh5ltf0tM+ZfqGnSNbakME6ZswfmVj7FHUgF40BXzSoFTUdqgn1xy/w== +"@bazel/rollup@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-0.42.2.tgz#b7a6495e1c506e3684448140395be80c45420271" + integrity sha512-SiXxuydxC3+jZIfS8oib3YyXBXeoA816bYdnIdVJX0WNgIMStdvGm7a/UU20KlbOWBx7qKB+mCSjSQa6C2FBnQ== -"@bazel/terser@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-1.0.0.tgz#f9ef724cd4a81776dae71ae904934994d5006960" - integrity sha512-L+Q7YH+OA0W7Qp30DrnTKdNA6gasip9CdzI0zSvFOk18B7XBR+WswkIY2RkwwhH+y4SROqkHbX16z02jDHsnng== +"@bazel/terser@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-0.42.2.tgz#392e150af530d1eaf56ba388161e6f7f107e6be3" + integrity sha512-DlsmZyTWQFKiQbCKK/CDcRism1xrV1f7fLU166cXUIokXfkCaVCbN2ViaB5fDFcRpBQaNKowdM37Y5O7282Low== -"@bazel/typescript@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.0.0.tgz#2c7318b9a3aaa730f282b094ddf41dd16fda7b5a" - integrity sha512-caNOKz7EjVMgbedjVTreao9++9Sb9oYlU2nqDOMIK8MyoOUQvgGQWhFwF65XXGSb79Tzv8kaFQskoaH/iAs4ng== +"@bazel/typescript@0.42.2": + version "0.42.2" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.42.2.tgz#6c8e2187e9f7f937650c8b4e2350dc7d46284cb1" + integrity sha512-9HS8W6Wv74zhjvyP2rwym05TwzB8/c3Pxxi4gfjwjwxaDAIZCQfC8UGSRxeCm5t0JNz485W1/0WScoACjcASCQ== dependencies: protobufjs "6.8.8" semver "5.6.0"