60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
package(default_visibility = ["//visibility:public"])
|
|
|
|
load("//tools:defaults.bzl", "ng_module", "ng_package")
|
|
|
|
ng_module(
|
|
name = "service-worker",
|
|
srcs = glob(
|
|
[
|
|
"*.ts",
|
|
"src/**/*.ts",
|
|
],
|
|
),
|
|
module_name = "@angular/service-worker",
|
|
deps = [
|
|
"//packages/common",
|
|
"//packages/core",
|
|
"@rxjs",
|
|
"@rxjs//operators",
|
|
],
|
|
)
|
|
|
|
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",
|
|
srcs = ["//packages/service-worker/worker:ngsw_worker.es6.js"],
|
|
outs = ["ngsw-worker.js"],
|
|
# Remove sourcemap since this file will be served in production site
|
|
# See https://github.com/angular/angular/issues/23596
|
|
cmd = "grep -v '//# sourceMappingURL' < $< > $@",
|
|
)
|
|
|
|
ng_package(
|
|
name = "npm_package",
|
|
srcs = [
|
|
"package.json",
|
|
"safety-worker.js",
|
|
"//packages/service-worker/config:package.json",
|
|
],
|
|
data = [
|
|
":ngsw_config_binary",
|
|
":ngsw_worker_renamed",
|
|
"//packages/service-worker/config",
|
|
],
|
|
entry_point = "packages/service-worker/index.js",
|
|
tags = [
|
|
"ivy-jit",
|
|
"release-with-framework",
|
|
],
|
|
deps = [
|
|
":service-worker",
|
|
"//packages/service-worker/config",
|
|
],
|
|
)
|