2021-04-23 20:50:40 +02:00
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
2021-08-04 01:27:39 +02:00
|
|
|
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
|
2021-04-23 20:50:40 +02:00
|
|
|
|
|
|
|
PKG_BASE_NAME = "kbn-babel-code-parser"
|
|
|
|
PKG_REQUIRE_NAME = "@kbn/babel-code-parser"
|
|
|
|
|
|
|
|
SOURCE_FILES = glob(
|
|
|
|
[
|
|
|
|
"src/**/*",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"**/*.test.*"
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "srcs",
|
|
|
|
srcs = SRCS,
|
|
|
|
)
|
|
|
|
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
|
|
"package.json",
|
|
|
|
"README.md",
|
|
|
|
]
|
|
|
|
|
2021-08-04 01:27:39 +02:00
|
|
|
RUNTIME_DEPS = [
|
2021-04-23 20:50:40 +02:00
|
|
|
"@npm//@babel/parser",
|
|
|
|
"@npm//@babel/traverse",
|
|
|
|
"@npm//lodash",
|
|
|
|
]
|
|
|
|
|
2021-08-04 01:27:39 +02:00
|
|
|
jsts_transpiler(
|
|
|
|
name = "target_node",
|
|
|
|
srcs = SRCS,
|
|
|
|
build_pkg_name = package_name(),
|
2021-04-23 20:50:40 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
js_library(
|
|
|
|
name = PKG_BASE_NAME,
|
|
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
2021-08-04 01:27:39 +02:00
|
|
|
deps = RUNTIME_DEPS + [":target_node"],
|
2021-04-23 20:50:40 +02:00
|
|
|
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"],
|
|
|
|
)
|