2021-09-08 18:41:24 -04:00
|
|
|
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
|
|
|
|
load("@npm//@bazel/terser:index.bzl", "terser_minified")
|
2021-11-21 18:19:47 -05:00
|
|
|
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
|
2021-11-23 22:09:07 -05:00
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_web")
|
2021-09-08 18:41:24 -04:00
|
|
|
load("@npm//html-insert-assets:index.bzl", "html_insert_assets")
|
2021-11-07 18:57:52 -05:00
|
|
|
load("//tools:angular_ts_project.bzl", "ng_ts_project")
|
|
|
|
|
load("//tools:typescript.bzl", "ts_project")
|
2021-09-08 18:41:24 -04:00
|
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
|
|
|
|
|
sass_library(
|
|
|
|
|
name = "material-theming",
|
2021-11-21 18:19:47 -05:00
|
|
|
srcs = ["@npm//:node_modules/@angular/material/_index.scss"],
|
2021-09-08 18:41:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
sass_binary(
|
|
|
|
|
name = "shell-chrome-styles",
|
|
|
|
|
src = "styles.scss",
|
|
|
|
|
sourcemap = False,
|
2021-11-21 18:19:47 -05:00
|
|
|
deps = [":material-theming"],
|
2021-09-08 18:41:24 -04:00
|
|
|
)
|
|
|
|
|
|
2021-11-07 18:57:52 -05:00
|
|
|
ts_project(
|
|
|
|
|
name = "devtools-ts",
|
2021-09-08 18:41:24 -04:00
|
|
|
srcs = [
|
2021-11-21 18:19:47 -05:00
|
|
|
"devtools.ts",
|
2021-09-08 18:41:24 -04:00
|
|
|
],
|
|
|
|
|
deps = [
|
|
|
|
|
"@npm//@types/chrome",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
2021-11-07 18:57:52 -05:00
|
|
|
js_library(
|
|
|
|
|
name = "devtools",
|
2021-11-21 18:19:47 -05:00
|
|
|
deps = [":devtools-ts"],
|
2021-11-07 18:57:52 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
ng_ts_project(
|
2021-09-08 18:41:24 -04:00
|
|
|
name = "src",
|
|
|
|
|
srcs = [
|
2021-11-21 18:19:47 -05:00
|
|
|
"main.ts",
|
|
|
|
|
"polyfills.ts",
|
2021-09-08 18:41:24 -04:00
|
|
|
],
|
|
|
|
|
deps = [
|
2021-11-21 18:19:47 -05:00
|
|
|
"//projects/ng-devtools",
|
|
|
|
|
"//projects/shell-chrome/src/app",
|
|
|
|
|
"//projects/shell-chrome/src/environments:environment",
|
|
|
|
|
"@npm//@angular/core",
|
|
|
|
|
"@npm//@angular/platform-browser-dynamic",
|
2021-09-08 18:41:24 -04:00
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
rollup_bundle(
|
|
|
|
|
name = "devtools-app-bundle-es2015",
|
|
|
|
|
config_file = "rollup.config.js",
|
|
|
|
|
entry_point = "main.ts",
|
|
|
|
|
output_dir = True,
|
|
|
|
|
deps = [
|
|
|
|
|
":src",
|
|
|
|
|
"@npm//@rollup/plugin-commonjs",
|
|
|
|
|
"@npm//@rollup/plugin-node-resolve",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
terser_minified(
|
|
|
|
|
name = "devtools-app-bundle-es2015.min",
|
|
|
|
|
src = ":devtools-app-bundle-es2015",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Files that we serve in both development and production
|
|
|
|
|
_ASSETS = [
|
|
|
|
|
# This label references an output of the "styles" sass_binary above.
|
|
|
|
|
":shell-chrome-styles",
|
|
|
|
|
":manifest.json",
|
|
|
|
|
|
|
|
|
|
# We load zone.js outside the bundle. That's because it's a "pollyfill"
|
|
|
|
|
# which speculates that such features might be available in a browser.
|
|
|
|
|
# Also it's tricky to configure dead code elimination to understand that
|
|
|
|
|
# zone.js is used, given that we don't have any import statement that
|
|
|
|
|
# imports from it.
|
|
|
|
|
"@npm//:node_modules/zone.js/dist/zone.min.js",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
html_insert_assets(
|
|
|
|
|
name = "inject_scripts_for_prod",
|
|
|
|
|
outs = ["index.html"],
|
|
|
|
|
args = [
|
|
|
|
|
"--html=$(execpath //projects/shell-chrome/src:_index.html)",
|
|
|
|
|
"--out=$@",
|
|
|
|
|
"--roots=. $(RULEDIR)",
|
|
|
|
|
"--assets",
|
|
|
|
|
] + ["$(execpath %s)" % s for s in _ASSETS],
|
|
|
|
|
data = ["//projects/shell-chrome/src:_index.html"] + _ASSETS,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
rollup_bundle(
|
|
|
|
|
name = "devtools-es2015",
|
|
|
|
|
entry_point = "devtools.ts",
|
|
|
|
|
format = "iife",
|
|
|
|
|
deps = [
|
|
|
|
|
":devtools",
|
2021-11-21 18:19:47 -05:00
|
|
|
],
|
2021-09-08 18:41:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
pkg_web(
|
|
|
|
|
name = "prodapp",
|
|
|
|
|
srcs = _ASSETS + [
|
|
|
|
|
":devtools-es2015",
|
|
|
|
|
"//projects/shell-chrome/src/app:ng-validate-es2015",
|
|
|
|
|
"//projects/shell-chrome/src/app:background-es2015",
|
|
|
|
|
"//projects/shell-chrome/src/app:backend-es2015",
|
|
|
|
|
"//projects/shell-chrome/src/app:content-script-es2015",
|
|
|
|
|
":devtools-app-bundle-es2015",
|
|
|
|
|
":inject_scripts_for_prod",
|
|
|
|
|
"//projects/shell-chrome/src/assets",
|
|
|
|
|
"//projects/shell-chrome/src/popups",
|
|
|
|
|
"//projects/shell-chrome/src:devtools.html",
|
|
|
|
|
"//projects/ng-devtools/src/lib/images",
|
|
|
|
|
],
|
|
|
|
|
additional_root_paths = [
|
|
|
|
|
"projects/ng-devtools/src/lib",
|
|
|
|
|
],
|
2021-11-21 18:19:47 -05:00
|
|
|
)
|