@teambit/preview 1.0.228 → 1.0.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/__bit_junit.xml +2 -2
- package/artifacts/preview/teambit_preview_preview-preview.js +1 -1
- package/artifacts/schema.json +889 -205
- package/dist/artifact-file-middleware.d.ts +12 -0
- package/dist/bundler/chunks.d.ts +17 -0
- package/dist/bundler/create-peer-link.spec.d.ts +1 -0
- package/dist/bundler/create-peers-link.d.ts +2 -0
- package/dist/bundler/html-plugin.d.ts +5 -0
- package/dist/bundler/html-template.d.ts +2 -0
- package/dist/bundling-strategy.d.ts +23 -0
- package/dist/component-preview.d.ts +2 -0
- package/dist/component-preview.route.d.ts +20 -0
- package/dist/env-preview-template.task.d.ts +45 -0
- package/dist/env-template.route.d.ts +25 -0
- package/dist/events/click-inside-an-iframe.d.ts +12 -0
- package/dist/events/index.d.ts +1 -0
- package/dist/exceptions/bundling-strategy-not-found.d.ts +4 -0
- package/dist/exceptions/index.d.ts +4 -0
- package/dist/exceptions/preview-artifact-not-found.d.ts +5 -0
- package/dist/exceptions/preview-not-found.d.ts +3 -0
- package/dist/exceptions/preview-output-file-not-found.d.ts +5 -0
- package/dist/execution-ref.d.ts +11 -0
- package/dist/generate-link.d.ts +9 -0
- package/dist/gql/fetch-component-aspects.d.ts +1 -0
- package/dist/html-utils.d.ts +6 -0
- package/dist/index.d.ts +9 -0
- package/dist/mk-temp-dir.d.ts +1 -0
- package/dist/pre-bundle-utils.d.ts +12 -0
- package/dist/pre-bundle.d.ts +8 -0
- package/dist/pre-bundle.task.d.ts +15 -0
- package/dist/{preview-1712805335812.js → preview-1712891953391.js} +2 -2
- package/dist/preview-artifact.d.ts +8 -0
- package/dist/preview-assets.route.d.ts +19 -0
- package/dist/preview-context.d.ts +4 -0
- package/dist/preview-definition.d.ts +34 -0
- package/dist/preview-env.d.ts +39 -0
- package/dist/preview-modules.d.ts +1 -0
- package/dist/preview-type.d.ts +25 -0
- package/dist/preview.aspect.d.ts +4 -0
- package/dist/preview.composition.d.ts +1 -0
- package/dist/preview.d.ts +11 -0
- package/dist/preview.graphql.d.ts +32 -0
- package/dist/preview.main.runtime.d.ts +343 -0
- package/dist/preview.preview.runtime.d.ts +77 -0
- package/dist/preview.route.d.ts +20 -0
- package/dist/preview.service.d.ts +29 -0
- package/dist/preview.start-plugin.d.ts +35 -0
- package/dist/preview.task.d.ts +39 -0
- package/dist/rendering-context.d.ts +18 -0
- package/dist/size-event.d.ts +9 -0
- package/dist/strategies/component-strategy.d.ts +54 -0
- package/dist/strategies/env-strategy.d.ts +41 -0
- package/dist/strategies/generate-component-link.d.ts +6 -0
- package/dist/strategies/index.d.ts +3 -0
- package/dist/strategies/strategies-names.d.ts +2 -0
- package/dist/types/preview-module.d.ts +1 -0
- package/dist/webpack/webpack.config.d.ts +2 -0
- package/package.json +23 -23
- package/tsconfig.json +1 -61
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Middleware } from '@teambit/express';
|
2
|
+
import type { Logger } from '@teambit/logger';
|
3
|
+
export type PreviewUrlParams = {
|
4
|
+
/**
|
5
|
+
* preview name like overview or composition
|
6
|
+
*/
|
7
|
+
previewName?: string;
|
8
|
+
/** `/preview/:filePath(*)` */
|
9
|
+
filePath?: string;
|
10
|
+
};
|
11
|
+
export type GetCacheControlFunc = (filePath: string, contents: string, mimeType?: string | null) => string | undefined;
|
12
|
+
export declare function getArtifactFileMiddleware(logger: Logger, getCacheControlFunc?: GetCacheControlFunc): Middleware;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { BundlerEntryMap } from '@teambit/bundler';
|
2
|
+
export declare const CHUNK_NAMES: {
|
3
|
+
previewRoot: string;
|
4
|
+
peers: string;
|
5
|
+
};
|
6
|
+
type TemplateEntryOptions = {
|
7
|
+
previewRootPath: string;
|
8
|
+
peers: string | string[];
|
9
|
+
previewModules: {
|
10
|
+
name: string;
|
11
|
+
entry: string;
|
12
|
+
/** other preview modules to includes */
|
13
|
+
include?: string[];
|
14
|
+
}[];
|
15
|
+
};
|
16
|
+
export declare function generateTemplateEntries(options: TemplateEntryOptions): BundlerEntryMap;
|
17
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { BuildContext, BuiltTaskResult } from '@teambit/builder';
|
2
|
+
import { Target, BundlerResult, BundlerContext } from '@teambit/bundler';
|
3
|
+
import { PreviewDefinition } from './preview-definition';
|
4
|
+
import { PreviewTask } from './preview.task';
|
5
|
+
type ComputeTargetsExtraContextKeys = {
|
6
|
+
splitComponentBundle?: boolean;
|
7
|
+
};
|
8
|
+
export type ComputeTargetsContext = BuildContext & ComputeTargetsExtraContextKeys;
|
9
|
+
export interface BundlingStrategy {
|
10
|
+
/**
|
11
|
+
* name of the bundling strategy.
|
12
|
+
*/
|
13
|
+
name: string;
|
14
|
+
/**
|
15
|
+
* compute bundling targets for the build context.
|
16
|
+
*/
|
17
|
+
computeTargets(context: ComputeTargetsContext, previewDefs: PreviewDefinition[], previewTask: PreviewTask): Promise<Target[]>;
|
18
|
+
/**
|
19
|
+
* compute the results of the bundler.
|
20
|
+
*/
|
21
|
+
computeResults(context: BundlerContext, results: BundlerResult[], previewTask: PreviewTask): Promise<BuiltTaskResult>;
|
22
|
+
}
|
23
|
+
export {};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="express" />
|
2
|
+
import type { NextFunction, Request, Response, Route } from '@teambit/express';
|
3
|
+
import type { Logger } from '@teambit/logger';
|
4
|
+
import { PreviewMain } from './preview.main.runtime';
|
5
|
+
import type { PreviewUrlParams } from './artifact-file-middleware';
|
6
|
+
export declare class ComponentPreviewRoute implements Route {
|
7
|
+
/**
|
8
|
+
* preview extension.
|
9
|
+
*/
|
10
|
+
private preview;
|
11
|
+
private logger;
|
12
|
+
constructor(
|
13
|
+
/**
|
14
|
+
* preview extension.
|
15
|
+
*/
|
16
|
+
preview: PreviewMain, logger: Logger);
|
17
|
+
route: string;
|
18
|
+
method: string;
|
19
|
+
middlewares: (import("@teambit/express").Middleware | ((req: Request<PreviewUrlParams>, res: Response, next: NextFunction) => Promise<void | import("express").Response<any, Record<string, any>>>))[];
|
20
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { BuildContext, BuiltTaskResult, BuildTask, TaskLocation, ComponentResult } from '@teambit/builder';
|
2
|
+
import { AspectLoaderMain } from '@teambit/aspect-loader';
|
3
|
+
import { BundlerContext, BundlerResult } from '@teambit/bundler';
|
4
|
+
import type { EnvsMain } from '@teambit/envs';
|
5
|
+
import { Logger } from '@teambit/logger';
|
6
|
+
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
7
|
+
import type { PreviewMain } from './preview.main.runtime';
|
8
|
+
export type ModuleExpose = {
|
9
|
+
name: string;
|
10
|
+
path: string;
|
11
|
+
include?: string[];
|
12
|
+
};
|
13
|
+
export declare const GENERATE_ENV_TEMPLATE_TASK_NAME = "GenerateEnvTemplate";
|
14
|
+
export declare class EnvPreviewTemplateTask implements BuildTask {
|
15
|
+
private preview;
|
16
|
+
private envs;
|
17
|
+
private aspectLoader;
|
18
|
+
private dependencyResolver;
|
19
|
+
private logger;
|
20
|
+
aspectId: string;
|
21
|
+
name: string;
|
22
|
+
location: TaskLocation;
|
23
|
+
constructor(preview: PreviewMain, envs: EnvsMain, aspectLoader: AspectLoaderMain, dependencyResolver: DependencyResolverMain, logger: Logger);
|
24
|
+
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
25
|
+
private runBundlerForGroups;
|
26
|
+
private shouldUseDefaultBundler;
|
27
|
+
private getEnvTargetFromComponent;
|
28
|
+
private generateEntries;
|
29
|
+
computeResults(context: BundlerContext, results: BundlerResult[]): Promise<{
|
30
|
+
componentsResults: ComponentResult[];
|
31
|
+
artifacts: {
|
32
|
+
name: string;
|
33
|
+
globPatterns: string[];
|
34
|
+
rootDir: string;
|
35
|
+
}[];
|
36
|
+
}>;
|
37
|
+
private getPreviewModules;
|
38
|
+
private computeOutputPath;
|
39
|
+
}
|
40
|
+
export declare function getArtifactDirectory(): string;
|
41
|
+
export declare function getArtifactDef(): {
|
42
|
+
name: string;
|
43
|
+
globPatterns: string[];
|
44
|
+
rootDir: string;
|
45
|
+
}[];
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/// <reference types="express" />
|
2
|
+
import type { NextFunction, Request, Response } from '@teambit/express';
|
3
|
+
import type { ComponentUrlParams, RegisteredComponentRoute } from '@teambit/component';
|
4
|
+
import type { Logger } from '@teambit/logger';
|
5
|
+
import type { PreviewMain } from './preview.main.runtime';
|
6
|
+
type UrlParams = ComponentUrlParams & {
|
7
|
+
filePath?: string;
|
8
|
+
};
|
9
|
+
export declare class EnvTemplateRoute implements RegisteredComponentRoute {
|
10
|
+
/**
|
11
|
+
* preview extension.
|
12
|
+
*/
|
13
|
+
private preview;
|
14
|
+
private logger;
|
15
|
+
constructor(
|
16
|
+
/**
|
17
|
+
* preview extension.
|
18
|
+
*/
|
19
|
+
preview: PreviewMain, logger: Logger);
|
20
|
+
route: string;
|
21
|
+
method: string;
|
22
|
+
resolveComponent: boolean;
|
23
|
+
middlewares: (import("@teambit/express").Middleware | ((req: Request<UrlParams>, res: Response, next: NextFunction) => Promise<void | import("express").Response<any, Record<string, any>>>))[];
|
24
|
+
}
|
25
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { BitBaseEvent } from '@teambit/pubsub';
|
2
|
+
declare class ClickInsideAnIframeEventData {
|
3
|
+
private clickEvent;
|
4
|
+
constructor(clickEvent: any);
|
5
|
+
}
|
6
|
+
export declare class ClickInsideAnIframeEvent extends BitBaseEvent<ClickInsideAnIframeEventData> {
|
7
|
+
readonly timestamp: number;
|
8
|
+
readonly clickEvent: any;
|
9
|
+
static readonly TYPE = "click-inside-an-iframe";
|
10
|
+
constructor(timestamp: number, clickEvent: any);
|
11
|
+
}
|
12
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './click-inside-an-iframe';
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export { PreviewNotFound } from './preview-not-found';
|
2
|
+
export { PreviewArtifactNotFound } from './preview-artifact-not-found';
|
3
|
+
export { BundlingStrategyNotFound } from './bundling-strategy-not-found';
|
4
|
+
export { PreviewOutputFileNotFound } from './preview-output-file-not-found';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Component, ComponentID } from '@teambit/component';
|
2
|
+
import type { ExecutionContext } from '@teambit/envs';
|
3
|
+
export declare class ExecutionRef {
|
4
|
+
executionCtx: ExecutionContext;
|
5
|
+
constructor(executionCtx: ExecutionContext);
|
6
|
+
currentComponents: Component[];
|
7
|
+
add(added: Component): void;
|
8
|
+
remove(removed: ComponentID): void;
|
9
|
+
update(next: Component): void;
|
10
|
+
get(id: ComponentID): Component | undefined;
|
11
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { ComponentMap } from '@teambit/component';
|
2
|
+
export type MainModulesMap = {
|
3
|
+
/**
|
4
|
+
* Path to default module in case there is no specific module for the current environment.
|
5
|
+
*/
|
6
|
+
default: string;
|
7
|
+
[envId: string]: string;
|
8
|
+
};
|
9
|
+
export declare function generateLink(prefix: string, componentMap: ComponentMap<string[]>, mainModulesMap?: MainModulesMap, isSplitComponentBundle?: boolean): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function fetchComponentAspects(componentId: string): Promise<string[] | undefined>;
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
export { PreviewAspect as default, PreviewAspect, PreviewRuntime } from './preview.aspect';
|
2
|
+
export * from './events';
|
3
|
+
export type { PreviewEnv, Preview } from './preview-env';
|
4
|
+
export type { PreviewMain, EnvPreviewConfig, ComponentPreviewSize, PreviewStrategyName, PreviewFiles, ComponentPreviewMetaData, } from './preview.main.runtime';
|
5
|
+
export type { PreviewPreview, RenderingContextOptions, RenderingContextProvider } from './preview.preview.runtime';
|
6
|
+
export type { PreviewDefinition } from './preview-definition';
|
7
|
+
export type { PreviewModule, ModuleFile } from './types/preview-module';
|
8
|
+
export type { RenderingContext } from './rendering-context';
|
9
|
+
export { ENV_PREVIEW_STRATEGY_NAME, COMPONENT_PREVIEW_STRATEGY_NAME } from './strategies/strategies-names';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function makeTempDir(prefix?: string): string;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { UIRoot } from '@teambit/ui';
|
2
|
+
import { SlotRegistry } from '@teambit/harmony';
|
3
|
+
import { ArtifactDefinition } from '@teambit/builder';
|
4
|
+
export type UIRootRegistry = SlotRegistry<UIRoot>;
|
5
|
+
export declare const BUNDLE_HASH_FILENAME = ".hash";
|
6
|
+
export declare function readBundleHash(bundleId: string, bundleDir: string, aspectDir: string): string;
|
7
|
+
export declare function createBundleHash(uiRoot: UIRoot, runtime: string): Promise<string>;
|
8
|
+
export declare function generateBundleHash(uiRoot: UIRoot, runtime: string, outputPath: string): Promise<void>;
|
9
|
+
export declare function getBundleArtifactDirectory(bundleDir: string, aspectDir: string): string;
|
10
|
+
export declare function getBundleArtifactDef(bundleDir: string, aspectDir: string): ArtifactDefinition;
|
11
|
+
export declare function getBundlePath(bundleId: string, bundleDir: string, aspectDir: string): string | undefined;
|
12
|
+
export declare function clearConsole(): void;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { AspectDefinition } from '@teambit/aspect-loader';
|
2
|
+
import webpack from 'webpack';
|
3
|
+
export declare const RUNTIME_NAME = "preview";
|
4
|
+
export declare const PUBLIC_DIR: string;
|
5
|
+
export declare const UIROOT_ASPECT_ID = "teambit.workspace/workspace";
|
6
|
+
export declare const generatePreBundlePreviewEntry: (aspectDefs: AspectDefinition[], rootExtensionName: string, runtimeName: string, rootAspectId: string, dir: string) => string;
|
7
|
+
export declare function buildPreBundlePreview(resolvedAspects: AspectDefinition[], customOutputDir?: string): Promise<webpack.Stats>;
|
8
|
+
export declare function generateBundlePreviewEntry(rootAspectId: string, previewPreBundlePath: string, config: object): Promise<string>;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { BuildContext, BuildTask, BuiltTaskResult, TaskLocation } from '@teambit/builder';
|
2
|
+
import { Logger } from '@teambit/logger';
|
3
|
+
import { UiMain } from '@teambit/ui';
|
4
|
+
export declare const BUNDLE_TASK_NAME = "PreBundlePreview";
|
5
|
+
export declare const BUNDLE_DIR = "ui-bundle";
|
6
|
+
export declare class PreBundlePreviewTask implements BuildTask {
|
7
|
+
private ui;
|
8
|
+
private logger;
|
9
|
+
aspectId: string;
|
10
|
+
name: string;
|
11
|
+
location: TaskLocation;
|
12
|
+
constructor(ui: UiMain, logger: Logger);
|
13
|
+
execute(context: BuildContext): Promise<BuiltTaskResult>;
|
14
|
+
private generateHash;
|
15
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.230/dist/preview.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.230/dist/preview.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
|
2
|
+
export declare class PreviewArtifact {
|
3
|
+
private artifacts;
|
4
|
+
constructor(artifacts: AbstractVinyl[]);
|
5
|
+
getPaths(): string[];
|
6
|
+
getFile(path: string): AbstractVinyl | undefined;
|
7
|
+
getFileEndsWith(path: string): AbstractVinyl | undefined;
|
8
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="express" />
|
2
|
+
import type { Request, Response, Route } from '@teambit/express';
|
3
|
+
import type { Logger } from '@teambit/logger';
|
4
|
+
import { PreviewMain } from './preview.main.runtime';
|
5
|
+
export declare class PreviewAssetsRoute implements Route {
|
6
|
+
/**
|
7
|
+
* preview extension.
|
8
|
+
*/
|
9
|
+
private preview;
|
10
|
+
private logger;
|
11
|
+
constructor(
|
12
|
+
/**
|
13
|
+
* preview extension.
|
14
|
+
*/
|
15
|
+
preview: PreviewMain, logger: Logger);
|
16
|
+
route: string;
|
17
|
+
method: string;
|
18
|
+
middlewares: ((req: Request, res: Response) => Promise<import("express").Response<any, Record<string, any>>>)[];
|
19
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { Component, ComponentMap } from '@teambit/component';
|
2
|
+
import type { Environment, ExecutionContext } from '@teambit/envs';
|
3
|
+
import type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
|
4
|
+
export interface PreviewDefinition {
|
5
|
+
/**
|
6
|
+
* extension preview prefix
|
7
|
+
*/
|
8
|
+
prefix: string;
|
9
|
+
/**
|
10
|
+
* which other extension modules to include in the preview context.
|
11
|
+
*/
|
12
|
+
include?: string[];
|
13
|
+
/**
|
14
|
+
* path of the default template to be executed.
|
15
|
+
*/
|
16
|
+
renderTemplatePath: (context: ExecutionContext) => Promise<string | undefined>;
|
17
|
+
/**
|
18
|
+
* get the template by env.
|
19
|
+
* TODO: refactor `renderTemplatePath` to accept only an env and remove this method.
|
20
|
+
*/
|
21
|
+
renderTemplatePathByEnv: (env: Environment) => Promise<string | undefined>;
|
22
|
+
/**
|
23
|
+
* get all files to require in the preview runtime.
|
24
|
+
*/
|
25
|
+
getModuleMap(components: Component[]): Promise<ComponentMap<AbstractVinyl[]>>;
|
26
|
+
/**
|
27
|
+
* Whether to include the peers chunk in the output html
|
28
|
+
*/
|
29
|
+
includePeers?: boolean;
|
30
|
+
/**
|
31
|
+
* Get metadata for the preview
|
32
|
+
*/
|
33
|
+
getMetadata?: (component: Component) => Promise<unknown>;
|
34
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler';
|
2
|
+
import { AsyncEnvHandler, EnvHandler } from '@teambit/envs';
|
3
|
+
/**
|
4
|
+
* interface for implementing component previews
|
5
|
+
* using bit's development environments.
|
6
|
+
*/
|
7
|
+
export interface PreviewEnv {
|
8
|
+
preview(): EnvHandler<Preview>;
|
9
|
+
}
|
10
|
+
export type Preview = {
|
11
|
+
/**
|
12
|
+
* return an instance of a mounter.
|
13
|
+
*/
|
14
|
+
getMounter: () => string;
|
15
|
+
/**
|
16
|
+
* return a path to a docs template.
|
17
|
+
*/
|
18
|
+
getDocsTemplate: () => string;
|
19
|
+
/**
|
20
|
+
* return a dev server instance to use for previews.
|
21
|
+
*/
|
22
|
+
getDevServer: (context: DevServerContext) => EnvHandler<DevServer> | AsyncEnvHandler<DevServer>;
|
23
|
+
/**
|
24
|
+
* return an instance for a preview bundler.
|
25
|
+
*/
|
26
|
+
getBundler: (context: BundlerContext) => EnvHandler<Bundler> | AsyncEnvHandler<Bundler>;
|
27
|
+
/**
|
28
|
+
* return the id of the dev server.
|
29
|
+
* used for deduplication of dev servers
|
30
|
+
*/
|
31
|
+
getDevEnvId: () => string;
|
32
|
+
/**
|
33
|
+
* dependencies that will bundled as part of the env template and will configured as externals for the component bundle
|
34
|
+
* these dependencies will be available in the preview on the window.
|
35
|
+
* these dependencies will have only one instance on the page.
|
36
|
+
* for dev server these dependencies will be aliased
|
37
|
+
*/
|
38
|
+
getHostDependencies: () => string[];
|
39
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { PreviewModules, linkModules, PREVIEW_MODULES } from '@teambit/preview.modules.preview-modules';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { ComponentID } from '@teambit/component-id';
|
2
|
+
import { RenderingContext } from './rendering-context';
|
3
|
+
import { PreviewModule } from './types/preview-module';
|
4
|
+
export interface PreviewType {
|
5
|
+
/**
|
6
|
+
* preview name to register.
|
7
|
+
*/
|
8
|
+
name: string;
|
9
|
+
/**
|
10
|
+
* preview render method.
|
11
|
+
*/
|
12
|
+
render(componentId: ComponentID, envId: string, linkedModules: PreviewModule<any>, includedPreviews: string[], renderingContext: RenderingContext): void;
|
13
|
+
/**
|
14
|
+
* determine if this will be the default preview to render.
|
15
|
+
*/
|
16
|
+
default?: boolean;
|
17
|
+
/**
|
18
|
+
* which other extension modules to include in the preview context.
|
19
|
+
*/
|
20
|
+
include?: string[];
|
21
|
+
/**
|
22
|
+
* select relevant information to show in preview context
|
23
|
+
*/
|
24
|
+
selectPreviewModel?: (componentId: string, module: PreviewModule) => any;
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Bundler, BundlerContext, DevServer, DevServerContext } from '@teambit/bundler';
|
2
|
+
export interface Preview {
|
3
|
+
/**
|
4
|
+
* get a dev server instance of the.
|
5
|
+
*/
|
6
|
+
getDevServer(context: DevServerContext): DevServer;
|
7
|
+
/**
|
8
|
+
* get bundler instance.
|
9
|
+
*/
|
10
|
+
getBundler(context: BundlerContext): Bundler;
|
11
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Component } from '@teambit/component';
|
2
|
+
import { PreviewMain } from './preview.main.runtime';
|
3
|
+
export declare function previewSchema(previewExtension: PreviewMain): {
|
4
|
+
typeDefs: import("graphql").DocumentNode;
|
5
|
+
resolvers: {
|
6
|
+
Component: {
|
7
|
+
preview: (component: Component) => {
|
8
|
+
component: Component;
|
9
|
+
};
|
10
|
+
};
|
11
|
+
Preview: {
|
12
|
+
includesEnvTemplate: ({ component }: {
|
13
|
+
component: any;
|
14
|
+
}) => Promise<boolean>;
|
15
|
+
isScaling: ({ component }: {
|
16
|
+
component: any;
|
17
|
+
}) => Promise<boolean>;
|
18
|
+
legacyHeader: ({ component }: {
|
19
|
+
component: any;
|
20
|
+
}) => Promise<boolean>;
|
21
|
+
onlyOverview: ({ component }: {
|
22
|
+
component: any;
|
23
|
+
}) => Promise<boolean>;
|
24
|
+
useNameParam: ({ component }: {
|
25
|
+
component: any;
|
26
|
+
}) => Promise<boolean>;
|
27
|
+
skipIncludes: ({ component }: {
|
28
|
+
component: any;
|
29
|
+
}) => Promise<boolean>;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
};
|