From c5b822917a6fe9042de604cf19657deacc7a28a3 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 25 Aug 2021 17:37:08 +0100 Subject: [PATCH 1/4] chore(NA): moving @kbn/securitysolution-io-ts-types to babel transpiler --- .../kbn-securitysolution-io-ts-types/.babelrc | 4 +++ .../BUILD.bazel | 29 ++++++++++--------- .../package.json | 4 +-- .../tsconfig.json | 3 +- 4 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 packages/kbn-securitysolution-io-ts-types/.babelrc diff --git a/packages/kbn-securitysolution-io-ts-types/.babelrc b/packages/kbn-securitysolution-io-ts-types/.babelrc new file mode 100644 index 0000000000000..40a198521b903 --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-types/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/node_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel index fdf3ef64460d9..6cc995efcc5ac 100644 --- a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel +++ b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel @@ -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-securitysolution-io-ts-types" PKG_REQUIRE_NAME = "@kbn/securitysolution-io-ts-types" @@ -26,26 +27,27 @@ NPM_MODULE_EXTRA_FILES = [ "README.md", ] -SRC_DEPS = [ +RUNTIME_DEPS = [ "//packages/kbn-securitysolution-io-ts-utils", - "//packages/elastic-datemath", "@npm//fp-ts", "@npm//io-ts", - "@npm//lodash", - "@npm//moment", - "@npm//tslib", "@npm//uuid", ] TYPES_DEPS = [ - "@npm//@types/flot", + "//packages/kbn-securitysolution-io-ts-utils", + "@npm//fp-ts", + "@npm//io-ts", "@npm//@types/jest", - "@npm//@types/lodash", "@npm//@types/node", "@npm//@types/uuid" ] -DEPS = SRC_DEPS + TYPES_DEPS +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) ts_config( name = "tsconfig", @@ -57,22 +59,23 @@ 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", - source_map = True, + emit_declaration_only = True, + out_dir = "target_types", root_dir = "src", + source_map = True, tsconfig = ":tsconfig", ) 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"], ) diff --git a/packages/kbn-securitysolution-io-ts-types/package.json b/packages/kbn-securitysolution-io-ts-types/package.json index 0381a6d24a136..fc6fdfb900938 100644 --- a/packages/kbn-securitysolution-io-ts-types/package.json +++ b/packages/kbn-securitysolution-io-ts-types/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "io ts utilities and types to be shared with plugins from the security solution project", "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", "private": true } diff --git a/packages/kbn-securitysolution-io-ts-types/tsconfig.json b/packages/kbn-securitysolution-io-ts-types/tsconfig.json index 12de4ed6ccb76..c640181145be8 100644 --- a/packages/kbn-securitysolution-io-ts-types/tsconfig.json +++ b/packages/kbn-securitysolution-io-ts-types/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "outDir": "target", + "emitDeclarationOnly": true, + "outDir": "target_types", "rootDir": "src", "sourceMap": true, "sourceRoot": "../../../../packages/kbn-securitysolution-io-ts-types/src", From b5c04ef9e9784c3c0f11d25b5cb35e681c9a94e6 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 25 Aug 2021 18:50:49 +0100 Subject: [PATCH 2/4] chore(NA): update limits --- packages/kbn-optimizer/limits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 3f846eaff2855..abd9a30b2b833 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -66,7 +66,6 @@ pageLoadAssetSize: searchprofiler: 67080 security: 95864 securityOss: 30806 - securitySolution: 217673 share: 99061 snapshotRestore: 79032 spaces: 57868 @@ -116,3 +115,4 @@ pageLoadAssetSize: expressionShape: 34008 interactiveSetup: 18532 expressionTagcloud: 27505 + securitySolution: 253930 From 4349aabd150f132c195f6559444b7ee41bd25d0a Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Wed, 25 Aug 2021 22:39:12 +0100 Subject: [PATCH 3/4] chore(NA): update limits file --- packages/kbn-optimizer/limits.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index d24e12e66d938..445fa6bff2800 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -114,5 +114,5 @@ pageLoadAssetSize: expressionShape: 34008 interactiveSetup: 18532 expressionTagcloud: 27505 - securitySolution: 253930 expressions: 239290 + securitySolution: 231753 From 2bb6755fbfc8c408d2bdf5d89b2e2507c18b8943 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 26 Aug 2021 13:29:50 +0100 Subject: [PATCH 4/4] chore(NA): introduce web bundles --- .../kbn-securitysolution-io-ts-types/.babelrc.browser | 4 ++++ packages/kbn-securitysolution-io-ts-types/BUILD.bazel | 9 ++++++++- packages/kbn-securitysolution-io-ts-types/package.json | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 packages/kbn-securitysolution-io-ts-types/.babelrc.browser diff --git a/packages/kbn-securitysolution-io-ts-types/.babelrc.browser b/packages/kbn-securitysolution-io-ts-types/.babelrc.browser new file mode 100644 index 0000000000000..71bbfbcd6eb2f --- /dev/null +++ b/packages/kbn-securitysolution-io-ts-types/.babelrc.browser @@ -0,0 +1,4 @@ +{ + "presets": ["@kbn/babel-preset/webpack_preset"], + "ignore": ["**/*.test.ts", "**/*.test.tsx"] +} diff --git a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel index 6cc995efcc5ac..adabf9708a59f 100644 --- a/packages/kbn-securitysolution-io-ts-types/BUILD.bazel +++ b/packages/kbn-securitysolution-io-ts-types/BUILD.bazel @@ -49,6 +49,13 @@ jsts_transpiler( 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", @@ -75,7 +82,7 @@ ts_project( js_library( name = PKG_BASE_NAME, srcs = NPM_MODULE_EXTRA_FILES, - deps = RUNTIME_DEPS + [":target_node", ":tsc_types"], + deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) diff --git a/packages/kbn-securitysolution-io-ts-types/package.json b/packages/kbn-securitysolution-io-ts-types/package.json index fc6fdfb900938..767c8d0f0cbcb 100644 --- a/packages/kbn-securitysolution-io-ts-types/package.json +++ b/packages/kbn-securitysolution-io-ts-types/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "description": "io ts utilities and types to be shared with plugins from the security solution project", "license": "SSPL-1.0 OR Elastic License 2.0", + "browser": "target_web/index.js", "main": "./target_node/index.js", "types": "./target_types/index.d.ts", "private": true