Skip to content

Commit

Permalink
chore(NA): moving @kbn/interpreter to babel transpiler (#108512) (#10…
Browse files Browse the repository at this point in the history
…9410)

* chore(NA): moving @kbn/interpreter to babel transpiler

* chore(NA): fix imports

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
  • Loading branch information
kibanamachine and mistic authored Aug 20, 2021
1 parent b42c869 commit bcc5766
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
3 changes: 3 additions & 0 deletions packages/kbn-interpreter/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
18 changes: 12 additions & 6 deletions packages/kbn-interpreter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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-interpreter"
PKG_REQUIRE_NAME = "@kbn/interpreter"
Expand All @@ -25,7 +26,7 @@ NPM_MODULE_EXTRA_FILES = [
"package.json",
]

SRC_DEPS = [
RUNTIME_DEPS = [
"@npm//lodash",
]

Expand All @@ -35,7 +36,11 @@ TYPES_DEPS = [
"@npm//@types/node",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

peggy(
name = "grammar",
Expand All @@ -62,14 +67,15 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
allow_js = True,
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
Expand All @@ -78,7 +84,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES + [":grammar"],
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-interpreter/common/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"private": true,
"main": "../target/common/index.js",
"types": "../target/common/index.d.ts"
"main": "../target_node/common/index.js",
"types": "../target_types/common/index.d.ts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { fromExpression } from '@kbn/interpreter/target/common/lib/ast';
import { fromExpression } from '@kbn/interpreter/common';
import { getType } from './get_type';

describe('ast fromExpression', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-interpreter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"allowJs": true,
"outDir": "./target/types",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./target_types",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-interpreter/src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { Capabilities, HttpSetup } from 'kibana/public';
import { i18n } from '@kbn/i18n';
import { RecursiveReadonly } from '@kbn/utility-types';
import { Ast } from '@kbn/interpreter/target/common';
import { Ast } from '@kbn/interpreter/common';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
import { IndexPatternsContract, TimefilterContract } from '../../../../../src/plugins/data/public';
import { ReactExpressionRendererType } from '../../../../../src/plugins/expressions/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { Ast } from '@kbn/interpreter/target/common';
import { Ast } from '@kbn/interpreter/common';
import { getSuggestions } from './metric_suggestions';
import { LensIconChartMetric } from '../assets/chart_metric';
import { Visualization, OperationMetadata, DatasourcePublicAPI } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { Ast } from '@kbn/interpreter/target/common';
import { Ast } from '@kbn/interpreter/common';
import { Position } from '@elastic/charts';
import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks';
import { getXyVisualization } from './xy_visualization';
Expand Down

0 comments on commit bcc5766

Please sign in to comment.