From 4b2e98d55dde4f6040a021a6ebd35d29fb5f8fdf Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 29 Mar 2022 22:52:29 +0200 Subject: [PATCH] fix(bazel): remove unnecessary file extractions from `ng_package` (#45470) Looks like there is some old legacy code for extracting files from NPM packages. This is already captured by the unscoped ESM2020 output extraction. PR Close #45470 --- packages/bazel/src/ng_package/ng_package.bzl | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/bazel/src/ng_package/ng_package.bzl b/packages/bazel/src/ng_package/ng_package.bzl index 6ae0dd3614f..0a9eec84e17 100644 --- a/packages/bazel/src/ng_package/ng_package.bzl +++ b/packages/bazel/src/ng_package/ng_package.bzl @@ -244,9 +244,6 @@ def _serialize_files_for_arg(files): result.append(_serialize_file(file)) return json.encode(result) -def _filter_js_inputs(all_inputs): - return [f for f in all_inputs if f.path.endswith(".js") or f.path.endswith(".json")] - def _find_matching_file(files, search_short_path): for file in files: if file.short_path == search_short_path: @@ -411,19 +408,10 @@ def _ng_package_impl(ctx): guessed_paths = guessed_paths, )) - # Also include files from npm fine grained deps as inputs. - # These deps are identified by the NpmPackageInfo provider. - node_modules_files = [] - for dep in ctx.attr.deps: - if NpmPackageInfo in dep: - # Note: `to_list` is expensive but we want to filter out non-JS files - # as these would result in a larger set of runfiles. - node_modules_files += _filter_js_inputs(dep.files.to_list()) - # Note: For creating the bundles, we use all the ESM2020 sources that have been # collected from the dependencies. This allows for bundling of code that is not # necessarily part of the owning package (using the `externals` attribute) - rollup_inputs = depset(node_modules_files + unscoped_esm2020) + rollup_inputs = depset(unscoped_esm2020) esm2020_config = _write_rollup_config(ctx, ctx.bin_dir.path, filename = "_%s.rollup_esm2020.conf.js") esm2015_config = _write_rollup_config(ctx, ctx.bin_dir.path, filename = "_%s.rollup_esm2015.conf.js", downlevel_to_es2015 = True)