backend-common: migrate to use exports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-16 00:37:38 +01:00
parent c09421fed8
commit 6b9eefae6b
5 changed files with 65 additions and 30 deletions
@@ -0,0 +1,32 @@
## API Report File for "@backstage/backend-common"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { Duration } from 'luxon';
// @alpha
export interface Context {
readonly abortSignal: AbortSignal;
readonly deadline: Date | undefined;
value<T = unknown>(key: string): T | undefined;
}
// @alpha
export class Contexts {
static root(): Context;
static withAbort(
parentCtx: Context,
source: AbortController | AbortSignal,
): Context;
static withTimeoutDuration(parentCtx: Context, timeout: Duration): Context;
static withTimeoutMillis(parentCtx: Context, timeout: number): Context;
static withValue(
parentCtx: Context,
key: string,
value: unknown | ((previous: unknown | undefined) => unknown),
): Context;
}
// (No @packageDocumentation comment for this package)
```
-24
View File
@@ -20,7 +20,6 @@ import { Config } from '@backstage/config';
import { ConfigService } from '@backstage/backend-plugin-api';
import cors from 'cors';
import Docker from 'dockerode';
import { Duration } from 'luxon';
import { ErrorRequestHandler } from 'express';
import express from 'express';
import { GerritIntegration } from '@backstage/integration';
@@ -211,29 +210,6 @@ export interface ContainerRunner {
runContainer(opts: RunContainerOptions): Promise<void>;
}
// @alpha
export interface Context {
readonly abortSignal: AbortSignal;
readonly deadline: Date | undefined;
value<T = unknown>(key: string): T | undefined;
}
// @alpha
export class Contexts {
static root(): Context;
static withAbort(
parentCtx: Context,
source: AbortController | AbortSignal,
): Context;
static withTimeoutDuration(parentCtx: Context, timeout: Duration): Context;
static withTimeoutMillis(parentCtx: Context, timeout: number): Context;
static withValue(
parentCtx: Context,
key: string,
value: unknown | ((previous: unknown | undefined) => unknown),
): Context;
}
// @public
export function createDatabaseClient(
dbConfig: Config,
+16 -5
View File
@@ -5,10 +5,21 @@
"main": "src/index.ts",
"types": "src/index.ts",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.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": "node-library"
@@ -24,7 +35,7 @@
],
"license": "Apache-2.0",
"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",
+17
View File
@@ -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 './context';
-1
View File
@@ -24,7 +24,6 @@ export { legacyPlugin, makeLegacyPlugin } from './legacy';
export type { LegacyCreateRouter } from './legacy';
export * from './cache';
export { loadBackendConfig } from './config';
export * from './context';
export * from './database';
export * from './discovery';
export * from './hot';