c4cb1f1bba
* chore(NA): first custom rules for jsts_transpiler * chore(NA): update jsts_transpiler macro * chore(NA): moving @elastic/datemath to babel transpiler * chore(NA): change gitignore rules for bazel * chore(NA): moving @kbn/ace to babel transpiler * chore(NA): remove deps from js_library * chore(NA): added runtime deps * chore(NA): do not transpile packages/kbn-ace/src/ace/modes/x_json/worker/x_json.ace.worker.js Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
97 lines
1.6 KiB
Python
97 lines
1.6 KiB
Python
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
|
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
|
|
|
PKG_BASE_NAME = "kbn-ace"
|
|
PKG_REQUIRE_NAME = "@kbn/ace"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"src/**/*.ts",
|
|
"src/ace/modes/x_json/worker/x_json.ace.worker.js",
|
|
],
|
|
exclude = [
|
|
"src/ace/modes/x_json/worker/worker.d.ts",
|
|
"**/*.test.*",
|
|
],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"package.json",
|
|
"README.md"
|
|
]
|
|
|
|
RUNTIME_DEPS = [
|
|
"@npm//brace",
|
|
"@npm//lodash",
|
|
"@npm//raw-loader",
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"@npm//brace",
|
|
"@npm//@types/lodash",
|
|
"@npm//@types/node",
|
|
]
|
|
|
|
jsts_transpiler(
|
|
name = "target_node",
|
|
srcs = SRCS,
|
|
additional_args = [
|
|
"--copy-files",
|
|
"--quiet"
|
|
],
|
|
build_pkg_name = package_name(),
|
|
)
|
|
|
|
ts_config(
|
|
name = "tsconfig",
|
|
src = "tsconfig.json",
|
|
deps = [
|
|
"//:tsconfig.base.json",
|
|
],
|
|
)
|
|
|
|
ts_project(
|
|
name = "tsc_types",
|
|
args = ['--pretty'],
|
|
srcs = SRCS,
|
|
deps = TYPES_DEPS,
|
|
declaration = True,
|
|
declaration_map = True,
|
|
emit_declaration_only = True,
|
|
incremental = False,
|
|
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", ":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"],
|
|
)
|