Skip to content

Commit

Permalink
chore(NA): splits types from code on @kbn/mapbox-gl (#121078)
Browse files Browse the repository at this point in the history
* chore(NA): splits types from code on @kbn/mapbox-gl

* chore(NA): fix exported types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
mistic and kibanamachine authored Dec 14, 2021
1 parent 442ccad commit 8c7ed78
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@
"@types/kbn__field-types": "link:bazel-bin/packages/kbn-field-types/npm_module_types",
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
"@types/license-checker": "15.0.0",
"@types/listr": "^0.14.0",
"@types/loader-utils": "^1.1.3",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ filegroup(
"//packages/kbn-field-types:build_types",
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react:build_types",
"//packages/kbn-mapbox-gl:build_types",
],
)

Expand Down
26 changes: 22 additions & 4 deletions packages/kbn-mapbox-gl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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("//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-mapbox-gl"
PKG_REQUIRE_NAME = "@kbn/mapbox-gl"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__mapbox-gl"

SOURCE_FILES = glob(
[
Expand Down Expand Up @@ -71,7 +72,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"],
)
Expand All @@ -90,3 +91,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"],
)
3 changes: 1 addition & 2 deletions packages/kbn-mapbox-gl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts"
"main": "./target_node/index.js"
}
5 changes: 3 additions & 2 deletions packages/kbn-mapbox-gl/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import './typings';
import type {
Map,
GeoJSONSource,
Expand All @@ -25,13 +24,15 @@ import type {
Point,
CustomLayerInterface,
} from 'maplibre-gl';
import mapboxgl from 'maplibre-gl/dist/maplibre-gl-csp';
// @ts-expect-error
import mapboxglDist from 'maplibre-gl/dist/maplibre-gl-csp';
// @ts-expect-error
import mbRtlPlugin from '!!file-loader!@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js';
// @ts-expect-error
import mbWorkerUrl from '!!file-loader!maplibre-gl/dist/maplibre-gl-csp-worker';
import 'maplibre-gl/dist/maplibre-gl.css';

const mapboxgl: any = mapboxglDist;
mapboxgl.workerUrl = mbWorkerUrl;
mapboxgl.setRTLTextPlugin(mbRtlPlugin);

Expand Down
10 changes: 0 additions & 10 deletions packages/kbn-mapbox-gl/src/typings.ts

This file was deleted.

4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5865,6 +5865,10 @@
version "0.0.0"
uid ""

"@types/kbn__mapbox-gl@link:bazel-bin/packages/kbn-mapbox-gl/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"
Expand Down

0 comments on commit 8c7ed78

Please sign in to comment.