chore(NA): moving @kbn/ace to babel transpiler (#106922) (#107056)

* 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>

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
This commit is contained in:
Kibana Machine 2021-07-28 15:37:39 -04:00 committed by GitHub
parent 86ce6d9752
commit 8ee1419468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 11 deletions

View file

@ -0,0 +1,6 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": [
"src/ace/modes/x_json/worker/x_json.ace.worker.js"
]
}

View file

@ -1,5 +1,6 @@
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"
@ -7,6 +8,7 @@ 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",
@ -26,18 +28,27 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]
SRC_DEPS = [
RUNTIME_DEPS = [
"@npm//brace",
"@npm//lodash",
"@npm//raw-loader",
]
TYPES_DEPS = [
"@npm//brace",
"@npm//@types/lodash",
"@npm//@types/node",
]
DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
additional_args = [
"--copy-files",
"--quiet"
],
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
@ -48,14 +59,15 @@ ts_config(
)
ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
emit_declaration_only = True,
incremental = False,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
@ -64,7 +76,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

View file

@ -2,7 +2,7 @@
"name": "@kbn/ace",
"version": "1.0.0",
"private": true,
"main": "./target/index.js",
"types": "./target/index.d.ts",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -1,10 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": true,
"outDir": "./target",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"incremental": false,
"outDir": "./target_types",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-ace/src",
"stripInternal": true,