2018-03-07 14:26:11 -05:00
|
|
|
load("//tools:defaults.bzl", "ng_module", "ng_package")
|
2017-12-06 09:56:49 -05:00
|
|
|
|
2019-01-16 04:19:01 -05:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2018-02-13 11:19:33 -05:00
|
|
|
ng_module(
|
2017-12-06 09:56:49 -05:00
|
|
|
name = "service-worker",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
"src/**/*.ts",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
deps = [
|
|
|
|
"//packages/common",
|
|
|
|
"//packages/core",
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//rxjs",
|
2017-12-06 09:56:49 -05:00
|
|
|
],
|
|
|
|
)
|
2018-03-07 14:26:11 -05:00
|
|
|
|
2018-03-30 12:45:42 -04:00
|
|
|
genrule(
|
|
|
|
name = "ngsw_config_binary",
|
|
|
|
srcs = ["//packages/service-worker/cli:ngsw_config.js"],
|
|
|
|
outs = ["ngsw-config.js"],
|
|
|
|
cmd = "echo '#!/usr/bin/env node' > $@ && cat $< >> $@",
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "ngsw_worker_renamed",
|
2019-03-14 22:35:00 -04:00
|
|
|
srcs = ["//packages/service-worker/worker:ngsw_worker.es2015.js"],
|
2018-03-30 12:45:42 -04:00
|
|
|
outs = ["ngsw-worker.js"],
|
2018-07-13 16:27:50 -04:00
|
|
|
# Remove sourcemap since this file will be served in production site
|
|
|
|
# See https://github.com/angular/angular/issues/23596
|
|
|
|
cmd = "grep -v '//# sourceMappingURL' < $< > $@",
|
2018-03-30 12:45:42 -04:00
|
|
|
)
|
|
|
|
|
2018-03-07 14:26:11 -05:00
|
|
|
ng_package(
|
|
|
|
name = "npm_package",
|
2018-03-13 14:00:53 -04:00
|
|
|
srcs = [
|
|
|
|
"package.json",
|
|
|
|
"//packages/service-worker/config:package.json",
|
|
|
|
],
|
2018-03-30 12:45:42 -04:00
|
|
|
data = [
|
2018-12-28 12:03:09 -05:00
|
|
|
"safety-worker.js",
|
2018-03-30 12:45:42 -04:00
|
|
|
":ngsw_config_binary",
|
|
|
|
":ngsw_worker_renamed",
|
|
|
|
"//packages/service-worker/config",
|
2018-12-28 12:03:09 -05:00
|
|
|
"//packages/service-worker/config:schema.json",
|
2018-03-30 12:45:42 -04:00
|
|
|
],
|
2019-06-07 16:38:06 -04:00
|
|
|
entry_point = ":index.ts",
|
2018-03-30 16:48:47 -04:00
|
|
|
tags = [
|
2018-03-30 12:45:42 -04:00
|
|
|
"release-with-framework",
|
2018-03-30 16:48:47 -04:00
|
|
|
],
|
2018-12-11 19:53:42 -05:00
|
|
|
# Do not add more to this list.
|
|
|
|
# Dependencies on the full npm_package cause long re-builds.
|
|
|
|
visibility = ["//visibility:private"],
|
2018-03-07 14:26:11 -05:00
|
|
|
deps = [
|
|
|
|
":service-worker",
|
|
|
|
"//packages/service-worker/config",
|
|
|
|
],
|
|
|
|
)
|