mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
chore(NA): moving @kbn/optimizer to babel transpiler (#109231)
* chore(NA): adds 7.16 into backportrc * chore(NA): moving @kbn/optimizer to babel transpiler
This commit is contained in:
parent
63db90b0c4
commit
cfd5dad174
6 changed files with 37 additions and 22 deletions
4
packages/kbn-optimizer/.babelrc
Normal file
4
packages/kbn-optimizer/.babelrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"presets": ["@kbn/babel-preset/node_preset"],
|
||||
"ignore": ["**/*.test.js"]
|
||||
}
|
|
@ -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-optimizer"
|
||||
PKG_REQUIRE_NAME = "@kbn/optimizer"
|
||||
|
@ -29,7 +30,7 @@ NPM_MODULE_EXTRA_FILES = [
|
|||
"README.md"
|
||||
]
|
||||
|
||||
SRC_DEPS = [
|
||||
RUNTIME_DEPS = [
|
||||
"//packages/kbn-config",
|
||||
"//packages/kbn-dev-utils",
|
||||
"//packages/kbn-std",
|
||||
|
@ -59,6 +60,22 @@ SRC_DEPS = [
|
|||
]
|
||||
|
||||
TYPES_DEPS = [
|
||||
"//packages/kbn-config",
|
||||
"//packages/kbn-dev-utils",
|
||||
"//packages/kbn-std",
|
||||
"//packages/kbn-ui-shared-deps",
|
||||
"//packages/kbn-utils",
|
||||
"@npm//chalk",
|
||||
"@npm//clean-webpack-plugin",
|
||||
"@npm//cpy",
|
||||
"@npm//del",
|
||||
"@npm//execa",
|
||||
"@npm//jest-diff",
|
||||
"@npm//lmdb-store",
|
||||
"@npm//pirates",
|
||||
"@npm//resize-observer-polyfill",
|
||||
"@npm//rxjs",
|
||||
"@npm//zlib",
|
||||
"@npm//@types/compression-webpack-plugin",
|
||||
"@npm//@types/jest",
|
||||
"@npm//@types/json-stable-stringify",
|
||||
|
@ -72,7 +89,11 @@ TYPES_DEPS = [
|
|||
"@npm//@types/webpack-sources",
|
||||
]
|
||||
|
||||
DEPS = SRC_DEPS + TYPES_DEPS
|
||||
jsts_transpiler(
|
||||
name = "target_node",
|
||||
srcs = SRCS,
|
||||
build_pkg_name = package_name(),
|
||||
)
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
|
@ -84,13 +105,14 @@ ts_config(
|
|||
)
|
||||
|
||||
ts_project(
|
||||
name = "tsc",
|
||||
name = "tsc_types",
|
||||
args = ['--pretty'],
|
||||
srcs = SRCS,
|
||||
deps = DEPS,
|
||||
deps = TYPES_DEPS,
|
||||
declaration = True,
|
||||
declaration_map = True,
|
||||
out_dir = "target",
|
||||
emit_declaration_only = True,
|
||||
out_dir = "target_types",
|
||||
source_map = True,
|
||||
root_dir = "src",
|
||||
tsconfig = ":tsconfig",
|
||||
|
@ -99,7 +121,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"],
|
||||
)
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: ['@kbn/babel-preset/node_preset'],
|
||||
ignore: ['**/*.test.js'],
|
||||
};
|
|
@ -3,6 +3,6 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "./target/index.js",
|
||||
"types": "./target/index.d.ts"
|
||||
"main": "./target_node/index.js",
|
||||
"types": "./target_types/index.d.ts"
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"extends": "../../tsconfig.bazel.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./target/types",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "./target_types",
|
||||
"rootDir": "./src",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": "../../../../packages/kbn-optimizer/src",
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
// Note: In theory importing the polyfill should not be needed, as Babel should
|
||||
// include the necessary polyfills when using `@babel/preset-env`, but for some
|
||||
// reason it did not work. See https://github.com/elastic/kibana/issues/14506
|
||||
import '@kbn/optimizer/target/node/polyfill';
|
||||
import '@kbn/optimizer/target_node/node/polyfill';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue