chore(NA): splits types from code on @kbn/ui-shared-deps-npm (#122788)

This commit is contained in:
Tiago Costa 2022-01-13 02:23:18 +00:00 committed by GitHub
parent f47839ecaf
commit a6d21cc715
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 14 deletions

View file

@ -1,10 +1,11 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_BASE_NAME = "kbn-ui-shared-deps-npm"
PKG_REQUIRE_NAME = "@kbn/ui-shared-deps-npm"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__ui-shared-deps-npm"
SOURCE_FILES = glob(
[
@ -150,7 +151,7 @@ webpack(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types", ":shared_built_assets"],
deps = RUNTIME_DEPS + [":target_node", ":shared_built_assets"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
@ -169,3 +170,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"],
)

View file

@ -4,6 +4,5 @@
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "target_node/index.js",
"browser": "target_node/entry.js",
"types": "target_types/index.d.ts"
"browser": "target_node/entry.js"
}

View file

@ -12,20 +12,26 @@
const Path = require('path');
// extracted const vars
const distDir = Path.resolve(__dirname, '../shared_built_assets');
const dllManifestPath = Path.resolve(distDir, 'kbn-ui-shared-deps-npm-manifest.json');
const dllFilename = 'kbn-ui-shared-deps-npm.dll.js';
const publicPathLoader = require.resolve('./public_path_loader');
/**
* Absolute path to the distributable directory
*/
exports.distDir = Path.resolve(__dirname, '../shared_built_assets');
exports.distDir = distDir;
/**
* Path to dll manifest of modules included in this bundle
*/
exports.dllManifestPath = Path.resolve(exports.distDir, 'kbn-ui-shared-deps-npm-manifest.json');
exports.dllManifestPath = dllManifestPath;
/**
* Filename of the main bundle file in the distributable directory
*/
exports.dllFilename = 'kbn-ui-shared-deps-npm.dll.js';
exports.dllFilename = dllFilename;
/**
* Filename of the light-theme css file in the distributable directory
@ -54,4 +60,4 @@ exports.darkCssDistFilename = (themeVersion) => {
/**
* Webpack loader for configuring the public path lookup from `window.__kbnPublicPath__`.
*/
exports.publicPathLoader = require.resolve('./public_path_loader');
exports.publicPathLoader = publicPathLoader;