From 7b76628a6a03729cb9c48f9cded6495c7fc51653 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 16 Jan 2023 10:54:24 +0100 Subject: [PATCH] core-plugin-api: migrate to use exports Signed-off-by: Patrik Oldsberg --- packages/core-plugin-api/alpha-api-report.md | 27 ++++++++++++++++++++ packages/core-plugin-api/api-report.md | 16 ------------ packages/core-plugin-api/package.json | 24 ++++++++++++----- packages/core-plugin-api/src/alpha.ts | 17 ++++++++++++ packages/core-plugin-api/src/index.ts | 1 - 5 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 packages/core-plugin-api/alpha-api-report.md create mode 100644 packages/core-plugin-api/src/alpha.ts diff --git a/packages/core-plugin-api/alpha-api-report.md b/packages/core-plugin-api/alpha-api-report.md new file mode 100644 index 0000000000..b66fee8207 --- /dev/null +++ b/packages/core-plugin-api/alpha-api-report.md @@ -0,0 +1,27 @@ +## API Report File for "@backstage/core-plugin-api" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { ReactNode } from 'react'; + +// @alpha +export interface PluginOptionsProviderProps { + // (undocumented) + children: ReactNode; + // Warning: (ae-forgotten-export) The symbol "BackstagePlugin" needs to be exported by the entry point alpha.d.ts + // + // (undocumented) + plugin?: BackstagePlugin; +} + +// @alpha +export const PluginProvider: (props: PluginOptionsProviderProps) => JSX.Element; + +// @alpha +export function usePluginOptions< + TPluginOptions extends {} = {}, +>(): TPluginOptions; + +// (No @packageDocumentation comment for this package) +``` diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 91f05921bf..4887f0b7f2 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -649,17 +649,6 @@ export type PluginFeatureFlagConfig = { name: string; }; -// @alpha -export interface PluginOptionsProviderProps { - // (undocumented) - children: ReactNode; - // (undocumented) - plugin?: BackstagePlugin; -} - -// @alpha -export const PluginProvider: (props: PluginOptionsProviderProps) => JSX.Element; - // @public export type ProfileInfo = { email?: string; @@ -760,11 +749,6 @@ export function useElementFilter( dependencies?: any[], ): T; -// @alpha -export function usePluginOptions< - TPluginOptions extends {} = {}, ->(): TPluginOptions; - // @public export function useRouteRef( routeRef: ExternalRouteRef, diff --git a/packages/core-plugin-api/package.json b/packages/core-plugin-api/package.json index f1f023eedb..e01c99f384 100644 --- a/packages/core-plugin-api/package.json +++ b/packages/core-plugin-api/package.json @@ -3,10 +3,21 @@ "description": "Core API used by Backstage plugins", "version": "1.4.0", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts", - "alphaTypes": "dist/index.alpha.d.ts" + "access": "public" + }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts" + }, + "typesVersions": { + "*": { + "*": [ + "src/index.ts" + ], + "alpha": [ + "src/alpha.ts" + ] + } }, "backstage": { "role": "web-library" @@ -24,7 +35,7 @@ "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "build": "backstage-cli package build --experimental-type-build", + "build": "backstage-cli package build", "lint": "backstage-cli package lint", "test": "backstage-cli package test", "prepack": "backstage-cli package prepack", @@ -60,7 +71,6 @@ "msw": "^0.49.0" }, "files": [ - "dist", - "alpha" + "dist" ] } diff --git a/packages/core-plugin-api/src/alpha.ts b/packages/core-plugin-api/src/alpha.ts new file mode 100644 index 0000000000..09983a48e9 --- /dev/null +++ b/packages/core-plugin-api/src/alpha.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './plugin-options'; diff --git a/packages/core-plugin-api/src/index.ts b/packages/core-plugin-api/src/index.ts index e8edd38ff3..30fc35b62a 100644 --- a/packages/core-plugin-api/src/index.ts +++ b/packages/core-plugin-api/src/index.ts @@ -22,7 +22,6 @@ export * from './analytics'; export * from './apis'; -export * from './plugin-options'; export * from './app'; export * from './extensions'; export * from './icons';