7336717d61
* chore(NA): replace babel config files by inline presets by default in the js_ts_transpiler rule * chore(NA): update @kbn/ace build to exclude worker file * chore(NA): remove config file support Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
123 lines
2.1 KiB
Python
123 lines
2.1 KiB
Python
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
|
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
|
|
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
|
|
|
PKG_BASE_NAME = "kbn-monaco"
|
|
PKG_REQUIRE_NAME = "@kbn/monaco"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"src/**/*",
|
|
],
|
|
exclude = [
|
|
"**/*.test.*",
|
|
"**/README.md",
|
|
],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"package.json",
|
|
"README.md"
|
|
]
|
|
|
|
RUNTIME_DEPS = [
|
|
"//packages/kbn-babel-preset",
|
|
"//packages/kbn-i18n",
|
|
"@npm//antlr4ts",
|
|
"@npm//babel-loader",
|
|
"@npm//monaco-editor",
|
|
"@npm//raw-loader",
|
|
"@npm//regenerator-runtime",
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"//packages/kbn-i18n",
|
|
"@npm//antlr4ts",
|
|
"@npm//monaco-editor",
|
|
"@npm//@types/jest",
|
|
"@npm//@types/node",
|
|
]
|
|
|
|
jsts_transpiler(
|
|
name = "target_node",
|
|
srcs = SRCS,
|
|
build_pkg_name = package_name(),
|
|
)
|
|
|
|
jsts_transpiler(
|
|
name = "target_web",
|
|
srcs = SRCS,
|
|
build_pkg_name = package_name(),
|
|
web = True,
|
|
)
|
|
|
|
webpack(
|
|
name = "target_workers",
|
|
data = RUNTIME_DEPS + [
|
|
":src",
|
|
"webpack.config.js",
|
|
],
|
|
output_dir = True,
|
|
args = [
|
|
"--config",
|
|
"$(location webpack.config.js)",
|
|
"--output-path",
|
|
"$(@D)",
|
|
"--env.prod",
|
|
"--display=minimal"
|
|
],
|
|
)
|
|
|
|
ts_config(
|
|
name = "tsconfig",
|
|
src = "tsconfig.json",
|
|
deps = [
|
|
"//:tsconfig.base.json",
|
|
"//:tsconfig.bazel.json",
|
|
],
|
|
)
|
|
|
|
ts_project(
|
|
name = "tsc_types",
|
|
args = ['--pretty'],
|
|
srcs = SRCS,
|
|
deps = TYPES_DEPS,
|
|
declaration = True,
|
|
declaration_map = True,
|
|
emit_declaration_only = True,
|
|
out_dir = "target_types",
|
|
source_map = True,
|
|
root_dir = "src",
|
|
tsconfig = ":tsconfig",
|
|
)
|
|
|
|
js_library(
|
|
name = PKG_BASE_NAME,
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
|
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":target_workers", ":tsc_types"],
|
|
package_name = PKG_REQUIRE_NAME,
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
pkg_npm(
|
|
name = "npm_module",
|
|
deps = [
|
|
":%s" % PKG_BASE_NAME,
|
|
]
|
|
)
|
|
|
|
filegroup(
|
|
name = "build",
|
|
srcs = [
|
|
":npm_module",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
)
|