build: Add sourcemap output from ng_rollup_bundle (#23276)
PR Close #23276
This commit is contained in:
parent
58143555bc
commit
37c1634276
|
@ -2,9 +2,9 @@ workspace(name = "angular")
|
|||
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
url = "https://github.com/bazelbuild/rules_nodejs/archive/99166f8eb7fc628ca561acf9f9a51a1c26edadad.zip",
|
||||
strip_prefix = "rules_nodejs-99166f8eb7fc628ca561acf9f9a51a1c26edadad",
|
||||
sha256 = "338e8495e5d1fa16de7190106c5675372ff4a347f6004e203e84a168db96281e",
|
||||
url = "https://github.com/bazelbuild/rules_nodejs/archive/1931156c232a08356dfda02e9c8b0275c2e63c00.zip",
|
||||
strip_prefix = "rules_nodejs-1931156c232a08356dfda02e9c8b0275c2e63c00",
|
||||
sha256 = "9cfe33276a6ac0076ee9ee159c4a2576f9851c0f437435b5ac19b2e592493078",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
|
||||
|
|
|
@ -16,7 +16,8 @@ load("@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
|
|||
"ROLLUP_OUTPUTS",
|
||||
"write_rollup_config",
|
||||
"run_rollup",
|
||||
"run_uglify")
|
||||
"run_uglify",
|
||||
"run_sourcemapexplorer")
|
||||
load("@build_bazel_rules_nodejs//internal:collect_es6_sources.bzl", collect_es2015_sources = "collect_es6_sources")
|
||||
load(":esm5.bzl", "esm5_outputs_aspect", "flatten_esm5", "esm5_root_dir")
|
||||
|
||||
|
@ -44,11 +45,16 @@ def _ng_rollup_bundle(ctx):
|
|||
esm5_sources = flatten_esm5(ctx)
|
||||
|
||||
rollup_config = write_rollup_config(ctx, [BO_PLUGIN], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]))
|
||||
run_rollup(ctx, esm5_sources, rollup_config, ctx.outputs.build_es5)
|
||||
rollup_sourcemap = run_rollup(ctx, esm5_sources, rollup_config, ctx.outputs.build_es5)
|
||||
|
||||
run_uglify(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min,
|
||||
comments = False)
|
||||
run_uglify(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min_debug,
|
||||
sourcemap = run_uglify(ctx,
|
||||
ctx.outputs.build_es5,
|
||||
ctx.outputs.build_es5_min,
|
||||
comments = False,
|
||||
in_source_map = rollup_sourcemap)
|
||||
run_uglify(ctx,
|
||||
ctx.outputs.build_es5,
|
||||
ctx.outputs.build_es5_min_debug,
|
||||
debug = True, comments = False)
|
||||
|
||||
umd_rollup_config = write_rollup_config(ctx, filename = "_%s_umd.rollup.conf.js", output_format = "umd")
|
||||
|
@ -56,7 +62,9 @@ def _ng_rollup_bundle(ctx):
|
|||
|
||||
run_brotli(ctx, ctx.outputs.build_es5_min, ctx.outputs.build_es5_min_compressed)
|
||||
|
||||
return DefaultInfo(files=depset([ctx.outputs.build_es5_min]))
|
||||
run_sourcemapexplorer(ctx, ctx.outputs.build_es5_min, sourcemap, ctx.outputs.explore_html)
|
||||
|
||||
return DefaultInfo(files=depset([ctx.outputs.build_es5_min, sourcemap]))
|
||||
|
||||
ng_rollup_bundle = rule(
|
||||
implementation = _ng_rollup_bundle,
|
||||
|
|
Loading…
Reference in New Issue