diff --git a/package.json b/package.json index e82e4382aaaff..efddb946320d4 100644 --- a/package.json +++ b/package.json @@ -600,6 +600,7 @@ "@types/kbn__securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils/npm_module_types", "@types/kbn__server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools/npm_module_types", "@types/kbn__server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository/npm_module_types", + "@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types", "@types/license-checker": "15.0.0", "@types/listr": "^0.14.0", "@types/loader-utils": "^1.1.3", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 2f13cabc45fb1..724d9810910bd 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -117,6 +117,7 @@ filegroup( "//packages/kbn-securitysolution-utils:build_types", "//packages/kbn-server-http-tools:build_types", "//packages/kbn-server-route-repository:build_types", + "//packages/kbn-std:build_types", ], ) diff --git a/packages/kbn-cli-dev-mode/BUILD.bazel b/packages/kbn-cli-dev-mode/BUILD.bazel index 0a50dcf272723..05524d4325cc6 100644 --- a/packages/kbn-cli-dev-mode/BUILD.bazel +++ b/packages/kbn-cli-dev-mode/BUILD.bazel @@ -54,7 +54,7 @@ TYPES_DEPS = [ "//packages/kbn-logging", "//packages/kbn-optimizer:npm_module_types", "//packages/kbn-server-http-tools:npm_module_types", - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "//packages/kbn-utils", "@npm//argsplit", "@npm//chokidar", diff --git a/packages/kbn-config/BUILD.bazel b/packages/kbn-config/BUILD.bazel index 0353b2d16be7b..719dd32fd606f 100644 --- a/packages/kbn-config/BUILD.bazel +++ b/packages/kbn-config/BUILD.bazel @@ -48,7 +48,7 @@ TYPES_DEPS = [ "//packages/elastic-safer-lodash-set", "//packages/kbn-config-schema:npm_module_types", "//packages/kbn-logging", - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "//packages/kbn-utility-types", "//packages/kbn-i18n:npm_module_types", "@npm//load-json-file", diff --git a/packages/kbn-logging/BUILD.bazel b/packages/kbn-logging/BUILD.bazel index 71a7ece15aa73..8e55456069ee4 100644 --- a/packages/kbn-logging/BUILD.bazel +++ b/packages/kbn-logging/BUILD.bazel @@ -32,7 +32,7 @@ RUNTIME_DEPS = [ ] TYPES_DEPS = [ - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "@npm//@types/jest", "@npm//@types/node", ] diff --git a/packages/kbn-optimizer/BUILD.bazel b/packages/kbn-optimizer/BUILD.bazel index 4dc5a8676c078..bc41caf812aaa 100644 --- a/packages/kbn-optimizer/BUILD.bazel +++ b/packages/kbn-optimizer/BUILD.bazel @@ -68,7 +68,7 @@ TYPES_DEPS = [ "//packages/kbn-config:npm_module_types", "//packages/kbn-config-schema:npm_module_types", "//packages/kbn-dev-utils:npm_module_types", - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "//packages/kbn-ui-shared-deps-npm", "//packages/kbn-ui-shared-deps-src", "//packages/kbn-utils", diff --git a/packages/kbn-std/BUILD.bazel b/packages/kbn-std/BUILD.bazel index 182722c642238..c9d83b4dea229 100644 --- a/packages/kbn-std/BUILD.bazel +++ b/packages/kbn-std/BUILD.bazel @@ -1,9 +1,10 @@ -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") +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") PKG_BASE_NAME = "kbn-std" PKG_REQUIRE_NAME = "@kbn/std" +TYPES_PKG_REQUIRE_NAME = "@types/kbn__std" SOURCE_FILES = glob( [ @@ -77,7 +78,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"], package_name = PKG_REQUIRE_NAME, visibility = ["//visibility:public"], ) @@ -96,3 +97,20 @@ filegroup( ], visibility = ["//visibility:public"], ) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = TYPES_PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [ + ":npm_module_types", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-std/package.json b/packages/kbn-std/package.json index cb4d6ad0d8aaf..12f52afbd05cd 100644 --- a/packages/kbn-std/package.json +++ b/packages/kbn-std/package.json @@ -1,7 +1,6 @@ { "name": "@kbn/std", "main": "./target_node/index.js", - "types": "./target_types/index.d.ts", "version": "1.0.0", "license": "SSPL-1.0 OR Elastic License 2.0", "private": true diff --git a/packages/kbn-test/BUILD.bazel b/packages/kbn-test/BUILD.bazel index eae0fe2cdf5dc..1ff9677615f5a 100644 --- a/packages/kbn-test/BUILD.bazel +++ b/packages/kbn-test/BUILD.bazel @@ -77,7 +77,7 @@ RUNTIME_DEPS = [ TYPES_DEPS = [ "//packages/kbn-dev-utils:npm_module_types", "//packages/kbn-i18n-react:npm_module_types", - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "//packages/kbn-utils", "@npm//@elastic/elasticsearch", "@npm//axios", diff --git a/packages/kbn-ui-shared-deps-src/BUILD.bazel b/packages/kbn-ui-shared-deps-src/BUILD.bazel index f7e1fe27475c6..e32834b3f2e8f 100644 --- a/packages/kbn-ui-shared-deps-src/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-src/BUILD.bazel @@ -48,7 +48,7 @@ TYPES_DEPS = [ "//packages/kbn-i18n:npm_module_types", "//packages/kbn-i18n-react:npm_module_types", "//packages/kbn-monaco:npm_module_types", - "//packages/kbn-std", + "//packages/kbn-std:npm_module_types", "//packages/kbn-ui-shared-deps-npm", "@npm//@elastic/eui", "@npm//webpack", diff --git a/yarn.lock b/yarn.lock index 04d24cdf6d221..443096829ba9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5997,6 +5997,10 @@ version "0.0.0" uid "" +"@types/kbn__std@link:bazel-bin/packages/kbn-std/npm_module_types": + version "0.0.0" + uid "" + "@types/keyv@*": version "3.1.1" resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7"