From f4a12d68f86b67d9517d005f3bbcd3b0958dda5f Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Tue, 30 Mar 2021 11:09:41 +0200 Subject: [PATCH] export type and runtme code separation (#95320) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/home/public/index.ts | 12 ++++++---- .../home/public/services/environment/index.ts | 3 ++- .../services/feature_catalogue/index.ts | 6 ++--- src/plugins/home/public/services/index.ts | 23 ++++++++++++++++--- .../home/public/services/tutorials/index.ts | 5 ++-- src/plugins/home/server/index.ts | 9 ++++---- src/plugins/home/server/services/index.ts | 19 +++++++-------- .../home/server/services/sample_data/index.ts | 13 ++++++----- .../home/server/services/tutorials/index.ts | 13 +++++------ src/plugins/home/tsconfig.json | 3 ++- 10 files changed, 66 insertions(+), 40 deletions(-) diff --git a/src/plugins/home/public/index.ts b/src/plugins/home/public/index.ts index b458a07f912dd..dd02bf65dd8b0 100644 --- a/src/plugins/home/public/index.ts +++ b/src/plugins/home/public/index.ts @@ -8,24 +8,28 @@ import { PluginInitializerContext } from 'kibana/public'; -export { +export type { FeatureCatalogueSetup, EnvironmentSetup, TutorialSetup, HomePublicPluginSetup, HomePublicPluginStart, } from './plugin'; -export { + +export { FeatureCatalogueCategory } from './services'; + +export type { FeatureCatalogueEntry, FeatureCatalogueSolution, - FeatureCatalogueCategory, Environment, TutorialVariables, TutorialDirectoryNoticeComponent, TutorialDirectoryHeaderLinkComponent, TutorialModuleNoticeComponent, } from './services'; -export * from '../common/instruction_variant'; + +export { INSTRUCTION_VARIANT, getDisplayText } from '../common/instruction_variant'; + import { HomePublicPlugin } from './plugin'; export const plugin = (initializerContext: PluginInitializerContext) => diff --git a/src/plugins/home/public/services/environment/index.ts b/src/plugins/home/public/services/environment/index.ts index ab5297ed0e14c..6cbfffa1275e2 100644 --- a/src/plugins/home/public/services/environment/index.ts +++ b/src/plugins/home/public/services/environment/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export { EnvironmentService, Environment, EnvironmentServiceSetup } from './environment'; +export { EnvironmentService } from './environment'; +export type { Environment, EnvironmentServiceSetup } from './environment'; diff --git a/src/plugins/home/public/services/feature_catalogue/index.ts b/src/plugins/home/public/services/feature_catalogue/index.ts index fe1090e15a623..c89f26c8f8949 100644 --- a/src/plugins/home/public/services/feature_catalogue/index.ts +++ b/src/plugins/home/public/services/feature_catalogue/index.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -export { - FeatureCatalogueCategory, +export { FeatureCatalogueCategory, FeatureCatalogueRegistry } from './feature_catalogue_registry'; + +export type { FeatureCatalogueEntry, FeatureCatalogueSolution, - FeatureCatalogueRegistry, FeatureCatalogueRegistrySetup, } from './feature_catalogue_registry'; diff --git a/src/plugins/home/public/services/index.ts b/src/plugins/home/public/services/index.ts index 29f3dee61537e..8cd4c8d84e0f7 100644 --- a/src/plugins/home/public/services/index.ts +++ b/src/plugins/home/public/services/index.ts @@ -6,6 +6,23 @@ * Side Public License, v 1. */ -export * from './feature_catalogue'; -export * from './environment'; -export * from './tutorials'; +export { FeatureCatalogueCategory, FeatureCatalogueRegistry } from './feature_catalogue'; + +export type { + FeatureCatalogueEntry, + FeatureCatalogueSolution, + FeatureCatalogueRegistrySetup, +} from './feature_catalogue'; + +export { EnvironmentService } from './environment'; +export type { Environment, EnvironmentServiceSetup } from './environment'; + +export { TutorialService } from './tutorials'; + +export type { + TutorialVariables, + TutorialServiceSetup, + TutorialDirectoryNoticeComponent, + TutorialDirectoryHeaderLinkComponent, + TutorialModuleNoticeComponent, +} from './tutorials'; diff --git a/src/plugins/home/public/services/tutorials/index.ts b/src/plugins/home/public/services/tutorials/index.ts index cbfa95c753f4d..8de12c31249d8 100644 --- a/src/plugins/home/public/services/tutorials/index.ts +++ b/src/plugins/home/public/services/tutorials/index.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ -export { - TutorialService, +export { TutorialService } from './tutorial_service'; + +export type { TutorialVariables, TutorialServiceSetup, TutorialDirectoryNoticeComponent, diff --git a/src/plugins/home/server/index.ts b/src/plugins/home/server/index.ts index fa150b2da8e5d..840a5944a1343 100644 --- a/src/plugins/home/server/index.ts +++ b/src/plugins/home/server/index.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ -export { HomeServerPluginSetup, HomeServerPluginStart } from './plugin'; -export { TutorialProvider } from './services'; -export { SampleDatasetProvider, SampleDataRegistrySetup } from './services'; +export type { HomeServerPluginSetup, HomeServerPluginStart } from './plugin'; +export type { TutorialProvider } from './services'; +export type { SampleDatasetProvider, SampleDataRegistrySetup } from './services'; import { PluginInitializerContext, PluginConfigDescriptor } from 'kibana/server'; import { HomeServerPlugin } from './plugin'; import { configSchema, ConfigSchema } from '../config'; @@ -26,4 +26,5 @@ export const config: PluginConfigDescriptor = { export const plugin = (initContext: PluginInitializerContext) => new HomeServerPlugin(initContext); export { INSTRUCTION_VARIANT } from '../common/instruction_variant'; -export { ArtifactsSchema, TutorialsCategory } from './services/tutorials'; +export { TutorialsCategory } from './services/tutorials'; +export type { ArtifactsSchema } from './services/tutorials'; diff --git a/src/plugins/home/server/services/index.ts b/src/plugins/home/server/services/index.ts index 8f41ca0aae00c..7f26c886ab4b6 100644 --- a/src/plugins/home/server/services/index.ts +++ b/src/plugins/home/server/services/index.ts @@ -9,9 +9,12 @@ // provided to other plugins as APIs // should model the plugin lifecycle -export { TutorialsRegistry, TutorialsRegistrySetup, TutorialsRegistryStart } from './tutorials'; -export { - TutorialsCategory, +export { TutorialsRegistry } from './tutorials'; +export type { TutorialsRegistrySetup, TutorialsRegistryStart } from './tutorials'; + +export { TutorialsCategory } from './tutorials'; + +export type { ParamTypes, InstructionSetSchema, ParamsSchema, @@ -24,10 +27,8 @@ export { ScopedTutorialContextFactory, } from './tutorials'; -export { - SampleDataRegistry, - SampleDataRegistrySetup, - SampleDataRegistryStart, -} from './sample_data'; +export { SampleDataRegistry } from './sample_data'; + +export type { SampleDataRegistrySetup, SampleDataRegistryStart } from './sample_data'; -export { SampleDatasetSchema, SampleDatasetProvider } from './sample_data'; +export type { SampleDatasetSchema, SampleDatasetProvider } from './sample_data'; diff --git a/src/plugins/home/server/services/sample_data/index.ts b/src/plugins/home/server/services/sample_data/index.ts index 8a504291a7262..30384dad8951d 100644 --- a/src/plugins/home/server/services/sample_data/index.ts +++ b/src/plugins/home/server/services/sample_data/index.ts @@ -6,10 +6,11 @@ * Side Public License, v 1. */ -export { - SampleDataRegistry, - SampleDataRegistrySetup, - SampleDataRegistryStart, -} from './sample_data_registry'; +export { SampleDataRegistry } from './sample_data_registry'; -export { SampleDatasetSchema, SampleDatasetProvider } from './lib/sample_dataset_registry_types'; +export type { SampleDataRegistrySetup, SampleDataRegistryStart } from './sample_data_registry'; + +export type { + SampleDatasetSchema, + SampleDatasetProvider, +} from './lib/sample_dataset_registry_types'; diff --git a/src/plugins/home/server/services/tutorials/index.ts b/src/plugins/home/server/services/tutorials/index.ts index 89ac528eab06f..92f6de716185d 100644 --- a/src/plugins/home/server/services/tutorials/index.ts +++ b/src/plugins/home/server/services/tutorials/index.ts @@ -6,13 +6,12 @@ * Side Public License, v 1. */ -export { - TutorialsRegistry, - TutorialsRegistrySetup, - TutorialsRegistryStart, -} from './tutorials_registry'; -export { - TutorialsCategory, +export { TutorialsRegistry } from './tutorials_registry'; +export type { TutorialsRegistrySetup, TutorialsRegistryStart } from './tutorials_registry'; + +export { TutorialsCategory } from './lib/tutorials_registry_types'; + +export type { ParamTypes, InstructionSetSchema, ParamsSchema, diff --git a/src/plugins/home/tsconfig.json b/src/plugins/home/tsconfig.json index b2613eeecdfb0..b15e1fc011b92 100644 --- a/src/plugins/home/tsconfig.json +++ b/src/plugins/home/tsconfig.json @@ -5,7 +5,8 @@ "outDir": "./target/types", "emitDeclarationOnly": true, "declaration": true, - "declarationMap": true + "declarationMap": true, + "isolatedModules": true }, "include": [ "common/**/*",