Skip to content

Commit

Permalink
chore(NA): moving @kbn/babel-code-parser to babel transpiler (elastic…
Browse files Browse the repository at this point in the history
…#107574)

* chore(NA): moving @kbn/babel-code-parser to babel transpiler

* chore(NA): fix package.json main field
  • Loading branch information
mistic authored and vadimkibana committed Aug 8, 2021
1 parent 818b2d3 commit 2011d61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
27 changes: 7 additions & 20 deletions packages/kbn-babel-code-parser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//@babel/cli:index.bzl", "babel")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")

PKG_BASE_NAME = "kbn-babel-code-parser"
PKG_REQUIRE_NAME = "@kbn/babel-code-parser"
Expand All @@ -25,35 +25,22 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]

DEPS = [
"//packages/kbn-babel-preset",
RUNTIME_DEPS = [
"@npm//@babel/parser",
"@npm//@babel/traverse",
"@npm//lodash",
]

babel(
name = "target",
data = DEPS + [
":srcs",
".babelrc",
],
output_dir = True,
# the following arg paths includes $(execpath) as babel runs on the sandbox root
args = [
"./%s/src" % package_name(),
"--config-file",
"./%s/.babelrc" % package_name(),
"--out-dir",
"$(@D)",
"--quiet"
],
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":target"],
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-babel-code-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "babel code parser for Kibana",
"private": true,
"version": "1.0.0",
"main": "./target/index.js",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0",
"repository": {
"type": "git",
Expand Down

0 comments on commit 2011d61

Please sign in to comment.