chore(NA): moving @kbn/ui-shared-deps to babel transpiler (#109323) (#109508)

* chore(NA): moving @kbn/ui-shared-deps to babel transpiler

* fix(NA): missing correct paths on package.json files

* chore(NA): update jest integration snapshots

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-08-20 14:42:03 -04:00 committed by GitHub
parent 1bcfd01bfd
commit 9bf58e60bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 18 deletions

View file

@ -132,7 +132,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
expect(foo.cache.getModuleCount()).toBe(6);
expect(foo.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Array [
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target_node/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/async_import.ts,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/foo/public/ext.ts,
@ -155,7 +155,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
<absolute path>/node_modules/@kbn/optimizer/postcss.config.js,
<absolute path>/node_modules/css-loader/package.json,
<absolute path>/node_modules/style-loader/package.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target_node/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.scss,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/plugins/bar/public/index.ts,
@ -175,7 +175,7 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
expect(baz.cache.getReferencedFiles()).toMatchInlineSnapshot(`
Array [
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/bazel-out/<platform>-fastbuild/bin/packages/kbn-ui-shared-deps/target_node/public_path_module_creator.js,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/kibana.json,
<absolute path>/packages/kbn-optimizer/src/__fixtures__/__tmp__/mock_repo/x-pack/baz/public/index.ts,
<absolute path>/packages/kbn-optimizer/src/worker/entry_point_creator.ts,

View file

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

View file

@ -1,6 +1,7 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
PKG_BASE_NAME = "kbn-ui-shared-deps"
PKG_REQUIRE_NAME = "@kbn/ui-shared-deps"
@ -28,7 +29,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]
SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/elastic-datemath",
"//packages/elastic-safer-lodash-set",
"//packages/kbn-analytics",
@ -71,10 +72,53 @@ SRC_DEPS = [
]
TYPES_DEPS = [
"//packages/elastic-datemath",
"//packages/elastic-safer-lodash-set",
"//packages/kbn-analytics",
"//packages/kbn-babel-preset",
"//packages/kbn-i18n",
"//packages/kbn-monaco",
"//packages/kbn-std",
"//packages/kbn-utils",
"@npm//@elastic/charts",
"@npm//@elastic/eui",
"@npm//@elastic/numeral",
"@npm//@emotion/react",
"@npm//abortcontroller-polyfill",
"@npm//angular",
"@npm//babel-loader",
"@npm//core-js",
"@npm//css-loader",
"@npm//fflate",
"@npm//jquery",
"@npm//loader-utils",
"@npm//mini-css-extract-plugin",
"@npm//moment",
"@npm//moment-timezone",
"@npm//raw-loader",
"@npm//react",
"@npm//react-dom",
"@npm//react-intl",
"@npm//react-is",
"@npm//react-router",
"@npm//react-router-dom",
"@npm//regenerator-runtime",
"@npm//resize-observer-polyfill",
"@npm//rison-node",
"@npm//rxjs",
"@npm//styled-components",
"@npm//symbol-observable",
"@npm//url-loader",
"@npm//val-loader",
"@npm//whatwg-fetch",
"@npm//@types/node",
]
DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
@ -86,22 +130,23 @@ 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",
source_map = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
source_map = True,
tsconfig = ":tsconfig",
)
webpack(
name = "shared_built_assets",
data = DEPS + [
data = RUNTIME_DEPS + [
"//:package.json",
":srcs",
":tsconfig",
@ -120,7 +165,7 @@ webpack(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc", ":shared_built_assets"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types", ":shared_built_assets"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

View file

@ -1,4 +1,4 @@
{
"main": "../target/flot_charts/index.js",
"types": "../target/flot_charts/index.d.ts"
"main": "../target_node/flot_charts/index.js",
"types": "../target_types/flot_charts/index.d.ts"
}

View file

@ -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"
}

View file

@ -1,4 +1,4 @@
{
"main": "../target/theme.js",
"types": "../target/theme.d.ts"
"main": "../target_node/theme.js",
"types": "../target_types/theme.d.ts"
}

View file

@ -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-ui-shared-deps/src",