chore(NA): moving @kbn/es-query to babel transpiler (#107281)

* chore(NA): moving @kbn/es-query to babel transpiler

* chore(NA): update limits
This commit is contained in:
Tiago Costa 2021-07-30 18:38:02 +01:00 committed by GitHub
parent 926db441b9
commit e0ea3233d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 58 additions and 69 deletions

View file

@ -1,4 +1,4 @@
const { USES_STYLED_COMPONENTS } = require('@kbn/dev-utils');
const { USES_STYLED_COMPONENTS } = require('@kbn/babel-preset/styled_components_files');
module.exports = {
extends: [

View file

@ -25,6 +25,7 @@ NPM_MODULE_EXTRA_FILES = [
]
DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"@npm//eslint-config-prettier",
"@npm//semver",

View file

@ -8,6 +8,7 @@ SOURCE_FILES = glob([
"common_preset.js",
"istanbul_preset.js",
"node_preset.js",
"styled_components_files.js",
"webpack_preset.js",
])

View file

@ -0,0 +1,20 @@
/*
* 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 = {
/**
* Synchronized regex list of files that use `styled-components`.
* Used by `kbn-babel-preset` and `elastic-eslint-config-kibana`.
*/
USES_STYLED_COMPONENTS: [
/packages[\/\\]kbn-ui-shared-deps[\/\\]/,
/src[\/\\]plugins[\/\\](data|kibana_react)[\/\\]/,
/x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime)[\/\\]/,
/x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/,
],
};

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
const { USES_STYLED_COMPONENTS } = require.resolve('@kbn/dev-utils');
const { USES_STYLED_COMPONENTS } = require.resolve('./styled_components_files');
module.exports = () => {
return {

View file

@ -46,14 +46,3 @@ export async function transformFileWithBabel(file: File) {
file.extname = '.js';
transformedFiles.add(file);
}
/**
* Synchronized regex list of files that use `styled-components`.
* Used by `kbn-babel-preset` and `elastic-eslint-config-kibana`.
*/
export const USES_STYLED_COMPONENTS = [
/packages[\/\\]kbn-ui-shared-deps[\/\\]/,
/src[\/\\]plugins[\/\\](data|kibana_react)[\/\\]/,
/x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime)[\/\\]/,
/x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/,
];

View file

@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}

View file

@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"]
}

View file

@ -1,6 +1,7 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@npm//peggy:index.bzl", "peggy")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
PKG_BASE_NAME = "kbn-es-query"
PKG_REQUIRE_NAME = "@kbn/es-query"
@ -29,7 +30,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]
SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/kbn-common-utils",
"//packages/kbn-config-schema",
"//packages/kbn-i18n",
@ -41,14 +42,15 @@ SRC_DEPS = [
]
TYPES_DEPS = [
"//packages/kbn-common-utils",
"//packages/kbn-i18n",
"@npm//@elastic/elasticsearch",
"@npm//@types/jest",
"@npm//@types/lodash",
"@npm//@types/moment-timezone",
"@npm//@types/node",
]
DEPS = SRC_DEPS + TYPES_DEPS
peggy(
name = "grammar",
data = [
@ -64,6 +66,19 @@ peggy(
],
)
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
config_file = ".babelrc.browser"
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
@ -72,47 +87,25 @@ ts_config(
],
)
ts_config(
name = "tsconfig_browser",
src = "tsconfig.browser.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.browser.json",
],
)
ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_dir = "target_types",
declaration_map = True,
incremental = True,
out_dir = "target_node",
emit_declaration_only = True,
incremental = False,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
)
ts_project(
name = "tsc_browser",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
declaration = False,
incremental = True,
out_dir = "target_web",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig_browser",
)
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES + [":grammar"],
deps = DEPS + [":tsc", ":tsc_browser"],
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

View file

@ -1,21 +0,0 @@
{
"extends": "../../tsconfig.browser.json",
"compilerOptions": {
"incremental": true,
"outDir": "./target_web",
"declaration": false,
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-es-query/src",
"types": [
"jest",
"node"
],
},
"include": [
"src/**/*"
],
"exclude": [
"**/__fixtures__/**/*",
"**/__mocks__/**/*"
]
}

View file

@ -1,11 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": true,
"declarationDir": "./target_types",
"outDir": "./target_node",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"incremental": false,
"outDir": "./target_types",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-es-query/src",
"types": [

View file

@ -13,7 +13,7 @@ pageLoadAssetSize:
dashboard: 374194
dashboardEnhanced: 65646
dashboardMode: 22716
data: 900000
data: 943821
dataEnhanced: 50420
devTools: 38637
discover: 99999