build: add a ng_package rule for @angular/router (#22628)
PR Close #22628
This commit is contained in:
parent
fcb8c492d6
commit
ce649f725f
|
@ -9,15 +9,15 @@ genrule(
|
||||||
npm_package(
|
npm_package(
|
||||||
name = "npm_package",
|
name = "npm_package",
|
||||||
srcs = [
|
srcs = [
|
||||||
"package.json",
|
|
||||||
"index.bzl",
|
"index.bzl",
|
||||||
|
"package.json",
|
||||||
"//packages/bazel/src:package_assets",
|
"//packages/bazel/src:package_assets",
|
||||||
],
|
],
|
||||||
deps = [":workspace"],
|
|
||||||
# Re-host //packages/bazel/ which is just // in the public distro
|
# Re-host //packages/bazel/ which is just // in the public distro
|
||||||
replacements = {
|
replacements = {
|
||||||
"//packages/bazel/": "//",
|
"//packages/bazel/": "//",
|
||||||
"angular/packages/bazel/": "angular/",
|
"angular/packages/bazel/": "angular/",
|
||||||
},
|
},
|
||||||
stamp_data = "//tools:stamp_data",
|
stamp_data = "//tools:stamp_data",
|
||||||
|
deps = [":workspace"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,17 +18,38 @@ WELL_KNOWN_GLOBALS = {
|
||||||
"@angular/core": "ng.core",
|
"@angular/core": "ng.core",
|
||||||
"@angular/common": "ng.common",
|
"@angular/common": "ng.common",
|
||||||
"@angular/platform-browser": "ng.platformBrowser",
|
"@angular/platform-browser": "ng.platformBrowser",
|
||||||
"rxjs/Observable": "Rx",
|
|
||||||
"rxjs/Observer": "Rx",
|
|
||||||
"rxjs/Subject": "Rx",
|
|
||||||
"rxjs/Subscription": "Rx",
|
|
||||||
"rxjs/observable/merge": "Rx.Observable",
|
|
||||||
"rxjs/observable/of": "Rx.Observable.prototype",
|
|
||||||
"rxjs/operator/concatMap": "Rx.Observable.prototype",
|
|
||||||
"rxjs/operator/filter": "Rx.Observable.prototype",
|
|
||||||
"rxjs/operator/map": "Rx.Observable.prototype",
|
|
||||||
"rxjs/operator/share": "Rx.Observable.prototype",
|
|
||||||
}
|
}
|
||||||
|
WELL_KNOWN_GLOBALS.update({"rxjs/%s" % s: "Rx" for s in [
|
||||||
|
"BehaviorSubject",
|
||||||
|
"Observable",
|
||||||
|
"Observer",
|
||||||
|
"Subject",
|
||||||
|
"Subscription",
|
||||||
|
"util/EmptyError",
|
||||||
|
]})
|
||||||
|
WELL_KNOWN_GLOBALS.update({"rxjs/observable/%s" % s: "Rx.Observable" for s in [
|
||||||
|
"from",
|
||||||
|
"fromPromise",
|
||||||
|
"forkJoin",
|
||||||
|
"merge",
|
||||||
|
"of",
|
||||||
|
]})
|
||||||
|
WELL_KNOWN_GLOBALS.update({"rxjs/operator/%s" % s: "Rx.Observable.prototype" for s in [
|
||||||
|
"catch",
|
||||||
|
"concatAll",
|
||||||
|
"concatMap",
|
||||||
|
"every",
|
||||||
|
"first",
|
||||||
|
"filter",
|
||||||
|
"last",
|
||||||
|
"map",
|
||||||
|
"mergeAll",
|
||||||
|
"mergeMap",
|
||||||
|
"reduce",
|
||||||
|
"share",
|
||||||
|
"toPromise",
|
||||||
|
]})
|
||||||
|
|
||||||
|
|
||||||
def _rollup(ctx, rollup_config, entry_point, inputs, js_output, format = "es"):
|
def _rollup(ctx, rollup_config, entry_point, inputs, js_output, format = "es"):
|
||||||
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
map_output = ctx.actions.declare_file(js_output.basename + ".map", sibling = js_output)
|
||||||
|
@ -102,7 +123,7 @@ def _ng_package_impl(ctx):
|
||||||
esm5 = []
|
esm5 = []
|
||||||
bundles = []
|
bundles = []
|
||||||
|
|
||||||
for entry_point in [''] + ctx.attr.secondary_entry_points:
|
for entry_point in [""] + ctx.attr.secondary_entry_points:
|
||||||
es2015_entry_point = "/".join([p for p in [
|
es2015_entry_point = "/".join([p for p in [
|
||||||
ctx.bin_dir.path,
|
ctx.bin_dir.path,
|
||||||
ctx.label.package,
|
ctx.label.package,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ng_module")
|
load("//tools:defaults.bzl", "ng_module", "ng_package")
|
||||||
|
|
||||||
ng_module(
|
ng_module(
|
||||||
name = "router",
|
name = "router",
|
||||||
|
@ -19,3 +19,18 @@ ng_module(
|
||||||
"@rxjs",
|
"@rxjs",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ng_package(
|
||||||
|
name = "npm_package",
|
||||||
|
srcs = ["package.json"],
|
||||||
|
entry_point = "packages/router/index.js",
|
||||||
|
secondary_entry_points = [
|
||||||
|
"testing",
|
||||||
|
"upgrade",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
":router",
|
||||||
|
"//packages/router/testing",
|
||||||
|
"//packages/router/upgrade",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
|
@ -4,7 +4,6 @@ load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ng_module(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
module_name = "@angular/router/testing",
|
module_name = "@angular/router/testing",
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
|
ng_module(
|
||||||
|
name = "upgrade",
|
||||||
|
srcs = glob(["**/*.ts"]),
|
||||||
|
module_name = "@angular/router/upgrade",
|
||||||
|
deps = [
|
||||||
|
"//packages/core",
|
||||||
|
"//packages/router",
|
||||||
|
],
|
||||||
|
)
|
Loading…
Reference in New Issue