11load ("@npm//@bazel/typescript:index.bzl" , "ts_config" , "ts_project" )
22load ("@build_bazel_rules_nodejs//:index.bzl" , "js_library" , "pkg_npm" )
3+ load ("//src/dev/bazel:index.bzl" , "jsts_transpiler" )
34
45PKG_BASE_NAME = "kbn-securitysolution-list-api"
56
@@ -27,21 +28,36 @@ NPM_MODULE_EXTRA_FILES = [
2728 "README.md" ,
2829]
2930
30- SRC_DEPS = [
31+ RUNTIME_DEPS = [
32+ "//packages/kbn-securitysolution-io-ts-list-types" ,
3133 "//packages/kbn-securitysolution-io-ts-utils" ,
3234 "//packages/kbn-securitysolution-list-constants" ,
33- "//packages/kbn-securitysolution-io-ts-list-types" ,
3435 "@npm//fp-ts" ,
3536 "@npm//io-ts" ,
36- "@npm//tslib" ,
3737]
3838
3939TYPES_DEPS = [
40+ "//packages/kbn-securitysolution-io-ts-list-types" ,
41+ "//packages/kbn-securitysolution-io-ts-utils" ,
42+ "//packages/kbn-securitysolution-list-constants" ,
43+ "@npm//fp-ts" ,
44+ "@npm//io-ts" ,
4045 "@npm//@types/jest" ,
4146 "@npm//@types/node" ,
4247]
4348
44- DEPS = SRC_DEPS + TYPES_DEPS
49+ jsts_transpiler (
50+ name = "target_node" ,
51+ srcs = SRCS ,
52+ build_pkg_name = package_name (),
53+ )
54+
55+ jsts_transpiler (
56+ name = "target_web" ,
57+ srcs = SRCS ,
58+ build_pkg_name = package_name (),
59+ config_file = ".babelrc.browser"
60+ )
4561
4662ts_config (
4763 name = "tsconfig" ,
@@ -53,24 +69,25 @@ ts_config(
5369)
5470
5571ts_project (
56- name = "tsc " ,
72+ name = "tsc_types " ,
5773 srcs = SRCS ,
74+ deps = TYPES_DEPS ,
5875 args = ["--pretty" ],
5976 declaration = True ,
6077 declaration_map = True ,
61- out_dir = "target" ,
78+ emit_declaration_only = True ,
79+ out_dir = "target_types" ,
6280 root_dir = "src" ,
6381 source_map = True ,
6482 tsconfig = ":tsconfig" ,
65- deps = DEPS ,
6683)
6784
6885js_library (
6986 name = PKG_BASE_NAME ,
70- package_name = PKG_REQUIRE_NAME ,
7187 srcs = NPM_MODULE_EXTRA_FILES ,
88+ deps = RUNTIME_DEPS + [":target_node" , ":target_web" , ":tsc_types" ],
89+ package_name = PKG_REQUIRE_NAME ,
7290 visibility = ["//visibility:public" ],
73- deps = DEPS + [":tsc" ],
7491)
7592
7693pkg_npm (
0 commit comments