diff --git a/WORKSPACE b/WORKSPACE index 917a32ff3c64..ffa0854172d5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Add NodeJS rules http_archive( name = "build_bazel_rules_nodejs", - sha256 = "d0c4bb8b902c1658f42eb5563809c70a06e46015d64057d25560b0eb4bdc9007", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.5.0/rules_nodejs-1.5.0.tar.gz"], + sha256 = "f9e7b9f42ae202cc2d2ce6d698ccb49a9f7f7ea572a78fd451696d03ef2ee116", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.6.0/rules_nodejs-1.6.0.tar.gz"], ) # Add sass rules diff --git a/package.json b/package.json index 6aff4f3b2b55..43b48949ea33 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "@bazel/bazelisk": "^1.4.0", "@bazel/buildifier": "^2.2.1", "@bazel/ibazel": "^0.12.3", - "@bazel/jasmine": "^1.5.0", - "@bazel/karma": "^1.5.0", - "@bazel/protractor": "^1.5.0", - "@bazel/typescript": "^1.5.0", + "@bazel/jasmine": "^1.6.0", + "@bazel/karma": "^1.6.0", + "@bazel/protractor": "^1.6.0", + "@bazel/typescript": "^1.6.0", "@firebase/app-types": "^0.3.2", "@octokit/rest": "16.28.7", "@schematics/angular": "^9.0.7", diff --git a/src/dev-app/BUILD.bazel b/src/dev-app/BUILD.bazel index 4cfe4e3f849b..0a649235e08b 100644 --- a/src/dev-app/BUILD.bazel +++ b/src/dev-app/BUILD.bazel @@ -1,7 +1,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web") -load("@build_bazel_rules_nodejs//internal/common:devmode_js_sources.bzl", "devmode_js_sources") load("//tools:create-system-config.bzl", "create_system_config") load("//tools:defaults.bzl", "ng_module", "sass_binary") +load("//tools:es5-named-output.bzl", "es5_named_output") load("//tools/dev-server:index.bzl", "dev_server") package(default_visibility = ["//visibility:public"]) @@ -176,7 +176,7 @@ dev_server( # Collects all ES5 JavaScript files which are required to serve the dev-app. By default, # ts_library and ng_module targets only expose the type definition files as outputs. -devmode_js_sources( +es5_named_output( name = "dev_app_js_sources", tags = ["manual"], deps = [":dev-app"], diff --git a/tools/es5-named-output.bzl b/tools/es5-named-output.bzl new file mode 100644 index 000000000000..62674fa3cc64 --- /dev/null +++ b/tools/es5-named-output.bzl @@ -0,0 +1,33 @@ +load("@build_bazel_rules_nodejs//:providers.bzl", "JSNamedModuleInfo") + +"""Implementation of the es5_named_output rule. +Direct and transitive JavaScript files and sourcemaps are collected via ts_library +JSNamedModuleInfo provider. +https://github.com/bazelbuild/rules_nodejs/blob/a167311c025be2a77ba0d84e6a2ddcafe1c0564d/packages/typescript/src/internal/build_defs.bzl#L312 +""" + +def _es5_named_output_impl(ctx): + depsets = [] + for dep in ctx.attr.deps: + if JSNamedModuleInfo in dep: + depsets.append(dep[JSNamedModuleInfo].sources) + if hasattr(dep, "files"): + depsets.append(dep.files) + sources = depset(transitive = depsets) + + return [DefaultInfo(files = sources)] + +"""Rule that collects all ES5 named outputs from a list of deps. +It can be used as input for all those rules that require named JavaScript sources (such as +pkg_web). +We need this because ts_library and ng_module targets output only expose the type definition files +as outputs. +""" +es5_named_output = rule( + implementation = _es5_named_output_impl, + attrs = { + "deps": attr.label_list( + allow_files = True, + ), + }, +) diff --git a/tools/postinstall/apply-patches.js b/tools/postinstall/apply-patches.js index 226ca0af6623..9904f2100d64 100644 --- a/tools/postinstall/apply-patches.js +++ b/tools/postinstall/apply-patches.js @@ -12,7 +12,7 @@ const fs = require('fs'); * Version of the post install patch. Needs to be incremented when * existing patches or edits have been modified. */ -const PATCH_VERSION = 4; +const PATCH_VERSION = 5; /** Path to the project directory. */ const projectDir = path.join(__dirname, '../..'); diff --git a/tools/postinstall/manifest_externs_hermeticity.patch b/tools/postinstall/manifest_externs_hermeticity.patch index 01e85678eb17..7a3c350c757b 100644 --- a/tools/postinstall/manifest_externs_hermeticity.patch +++ b/tools/postinstall/manifest_externs_hermeticity.patch @@ -1,11 +1,11 @@ diff --git node_modules/@bazel/typescript/internal/build_defs.bzl node_modules/@bazel/typescript/internal/build_defs.bzl -index 7fef44c..4e25ed7 100644 +index 03cb68fdf..2f604234c 100755 --- node_modules/@bazel/typescript/internal/build_defs.bzl +++ node_modules/@bazel/typescript/internal/build_defs.bzl -@@ -93,25 +93,23 @@ def _filter_ts_inputs(all_inputs): - if f.path.endswith(".js") or f.path.endswith(".ts") or f.path.endswith(".json") +@@ -102,17 +102,17 @@ def _filter_ts_inputs(all_inputs): + if f.extension in ["js", "jsx", "ts", "tsx", "json"] ] - + +def _filter_compile_outputs(all_outputs): + return [ + f @@ -24,31 +24,40 @@ index 7fef44c..4e25ed7 100644 - ctx.actions.write(output, content = "") - else: - action_outputs.append(output) -- -- # TODO(plf): For now we mock creation of files other than {name}.js. -- for externs_file in externs_files: -- ctx.actions.write(output = externs_file, content = "") + compile_outputs = _filter_compile_outputs(outputs) - + + # TODO(plf): For now we mock creation of files other than {name}.js. + for externs_file in externs_files: +@@ -120,7 +120,9 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description + # A ts_library that has only .d.ts inputs will have no outputs, # therefore there are no actions to execute - if not action_outputs: + if not compile_outputs: + for file in [f for f in outputs if not f in compile_outputs]: -+ ctx.actions.write(output = file, content = "") ++ ctx.actions.write(output = file, content = "") return None - + action_inputs.extend(_filter_ts_inputs(ctx.files.node_modules)) -@@ -146,7 +142,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description - progress_message = "Compiling TypeScript (%s) %s" % (description, ctx.label), - mnemonic = mnemonic, - inputs = action_inputs, -- outputs = action_outputs, -+ outputs = outputs, - # Use the built-in shell environment - # Allow for users who set a custom shell that can locate standard binaries like tr and uname - # See https://github.com/NixOS/nixpkgs/issues/43955#issuecomment-407546331 -@@ -163,7 +159,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description +@@ -156,7 +158,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description + progress_message = "Compiling TypeScript (%s) %s" % (description, ctx.label), + mnemonic = "TypeScriptCompile", + inputs = action_inputs, +- outputs = action_outputs, ++ outputs = outputs, + # Use the built-in shell environment + # Allow for users who set a custom shell that can locate standard binaries like tr and uname + # See https://github.com/NixOS/nixpkgs/issues/43955#issuecomment-407546331 +@@ -179,7 +181,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description + progress_message = "Compiling TypeScript (%s) %s" % (description, ctx.label), + mnemonic = "tsc", + inputs = action_inputs, +- outputs = action_outputs, ++ outputs = compile_outputs, + # Use the built-in shell environment + # Allow for users who set a custom shell that can locate standard binaries like tr and uname + # See https://github.com/NixOS/nixpkgs/issues/43955#issuecomment-407546331 +@@ -194,7 +196,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description label = ctx.label, tsconfig = tsconfig_file, inputs = action_inputs, @@ -56,9 +65,10 @@ index 7fef44c..4e25ed7 100644 + outputs = compile_outputs, compiler = ctx.executable.compiler, ) + diff --git node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js -index 0346123..3d9bc64 100644 +index ec813f654..738342a8f 100755 --- node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js +++ node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js @@ -381,6 +381,23 @@ function createProgramAndEmit(fileLoader, options, bazelOpts, files, disabledTse diff --git a/yarn.lock b/yarn.lock index a1edc0286594..05a01d383834 100644 --- a/yarn.lock +++ b/yarn.lock @@ -320,36 +320,36 @@ integrity sha512-fDWMV2x03/K5dZnAEBeKS0gpn0LWCiv5kjhMB6q0f1Q5x6S7/+xoownxgWyNRo+qHxn+a2CtQSCRUpSC8QNg/w== "@bazel/ibazel@^0.12.3": - version "0.12.3" - resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.12.3.tgz#c8c82647f920cd529c7793c50e087e1a754a5973" - integrity sha512-dyx62Uo5kogrxFmqFNpGvbavfr8yjmuQlOyZczOuA60piULwlUsO7Oh3/1OUWKDSXaMMqHhFQfpdl+z0HjI6TQ== + version "0.12.4" + resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.12.4.tgz#ddda7c8ead6e29dc8d637af446086a750f395218" + integrity sha512-FzOy+esB/fXVDbAmL6Ce2yCEy+PESZih8GypKhi0B8XzoZHAAn3QNnQcMNwo9PrIfp3G1989nM/JQ1b8jwEinQ== -"@bazel/jasmine@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.5.0.tgz#be980cb8e9f82a87036e27f86278bd7a54d74c43" - integrity sha512-r06GTWKxZYs6msPTbIJ+vcHLQke6wMULo3p4w3ecDybRzKq54syjSzlmejIm9wJ8OHrVyRRSvHgvygxCGJfhTA== +"@bazel/jasmine@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.6.0.tgz#c469ab8725d9a2e48c0c3c965861ff8add9272ac" + integrity sha512-WtOQDtIMHKTxlp0+FcdrADV6LMrpJV7eEGZippSNFPL5YhwwrPfCSOs5WkooatsrjL5YEszswzqQXFjvC7EZKQ== dependencies: jasmine "~3.5.0" jasmine-core "~3.5.0" jasmine-reporters "~2.3.2" v8-coverage "1.0.9" -"@bazel/karma@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.5.0.tgz#75ea27c3c2a8a7fadbb5c5ab644c3acd3bc22702" - integrity sha512-j5S2Xya4Rr7vK0DzTaZ8FKDHBydtTNldwlx+rihjKJgbEBt76wQM7ucXD6aSA23lC+JM/dPRSKkpIIGeWf2JdQ== +"@bazel/karma@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.6.0.tgz#98950b71114dd9ec169e6778a35d31ae1f578655" + integrity sha512-9cX0E1SiMWwA70ZMFnMzeqSRn3biduGx03bGV77FSUYKocZpyfU2cOEygYGfxAqHnyM7x4cS8nflRv3+ZE0Aqg== dependencies: tmp "0.1.0" -"@bazel/protractor@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.5.0.tgz#ac92442bf38f5cd718812e4cca41ba2e5ebf1fa5" - integrity sha512-nUwOOUjNGJUU18JiE3sPOBzIul0jvGApEEikntKTLLwQ7w7/1TnOdXDWvHXrXRW3nwit6flWIzEUoFtWgwtCeg== +"@bazel/protractor@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.6.0.tgz#cf095a1dbc038def7031c513a3b87f4e79bedb00" + integrity sha512-gPiRv0oUJbVPpQ9nrwe5vjkffAc8VsYJhpTGgG+8aPdOaTLWgmBP/sy4BdfijU9O1Z/mNYojQCZgMzQz6kAvdg== -"@bazel/typescript@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.5.0.tgz#d69324c08e7dbfe10b21a6fcb7b4d66c71c8d171" - integrity sha512-Vi8n1p35EhxGC22TEnmnVPlyakrALyH2ccVN5J6YeZXE1oWlSMSqQEhXKTjqUfQ3FT76nW1K91AdH4TG3me5nQ== +"@bazel/typescript@^1.6.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.6.0.tgz#8dfd29e71bcf917d5f9cb67f19ac4dcfc9082439" + integrity sha512-vAKuwy1Hgl+t3M3sH/G0oqHRYN35TdENj+0lsCI3x7EbSzyI6cbA3YQrLrlyvdScksqOpZa3PZ3UBGqfJJq2DA== dependencies: protobufjs "6.8.8" semver "5.6.0"