@teambit/preview 1.0.225 → 1.0.227

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.
Files changed (59) hide show
  1. package/artifacts/__bit_junit.xml +2 -2
  2. package/artifacts/preview/teambit_preview_preview-preview.js +1 -1
  3. package/artifacts/schema.json +207 -891
  4. package/dist/{preview-1712546198033.js → preview-1712719054377.js} +2 -2
  5. package/package.json +23 -23
  6. package/tsconfig.json +61 -1
  7. package/dist/artifact-file-middleware.d.ts +0 -12
  8. package/dist/bundler/chunks.d.ts +0 -17
  9. package/dist/bundler/create-peer-link.spec.d.ts +0 -1
  10. package/dist/bundler/create-peers-link.d.ts +0 -2
  11. package/dist/bundler/html-plugin.d.ts +0 -5
  12. package/dist/bundler/html-template.d.ts +0 -2
  13. package/dist/bundling-strategy.d.ts +0 -23
  14. package/dist/component-preview.d.ts +0 -2
  15. package/dist/component-preview.route.d.ts +0 -20
  16. package/dist/env-preview-template.task.d.ts +0 -45
  17. package/dist/env-template.route.d.ts +0 -25
  18. package/dist/events/click-inside-an-iframe.d.ts +0 -12
  19. package/dist/events/index.d.ts +0 -1
  20. package/dist/exceptions/bundling-strategy-not-found.d.ts +0 -4
  21. package/dist/exceptions/index.d.ts +0 -4
  22. package/dist/exceptions/preview-artifact-not-found.d.ts +0 -5
  23. package/dist/exceptions/preview-not-found.d.ts +0 -3
  24. package/dist/exceptions/preview-output-file-not-found.d.ts +0 -5
  25. package/dist/execution-ref.d.ts +0 -11
  26. package/dist/generate-link.d.ts +0 -9
  27. package/dist/gql/fetch-component-aspects.d.ts +0 -1
  28. package/dist/html-utils.d.ts +0 -6
  29. package/dist/index.d.ts +0 -9
  30. package/dist/mk-temp-dir.d.ts +0 -1
  31. package/dist/pre-bundle-utils.d.ts +0 -12
  32. package/dist/pre-bundle.d.ts +0 -8
  33. package/dist/pre-bundle.task.d.ts +0 -15
  34. package/dist/preview-artifact.d.ts +0 -8
  35. package/dist/preview-assets.route.d.ts +0 -19
  36. package/dist/preview-context.d.ts +0 -4
  37. package/dist/preview-definition.d.ts +0 -34
  38. package/dist/preview-env.d.ts +0 -39
  39. package/dist/preview-modules.d.ts +0 -1
  40. package/dist/preview-type.d.ts +0 -25
  41. package/dist/preview.aspect.d.ts +0 -4
  42. package/dist/preview.composition.d.ts +0 -1
  43. package/dist/preview.d.ts +0 -11
  44. package/dist/preview.graphql.d.ts +0 -32
  45. package/dist/preview.main.runtime.d.ts +0 -343
  46. package/dist/preview.preview.runtime.d.ts +0 -77
  47. package/dist/preview.route.d.ts +0 -20
  48. package/dist/preview.service.d.ts +0 -29
  49. package/dist/preview.start-plugin.d.ts +0 -35
  50. package/dist/preview.task.d.ts +0 -39
  51. package/dist/rendering-context.d.ts +0 -18
  52. package/dist/size-event.d.ts +0 -9
  53. package/dist/strategies/component-strategy.d.ts +0 -54
  54. package/dist/strategies/env-strategy.d.ts +0 -41
  55. package/dist/strategies/generate-component-link.d.ts +0 -6
  56. package/dist/strategies/index.d.ts +0 -3
  57. package/dist/strategies/strategies-names.d.ts +0 -2
  58. package/dist/types/preview-module.d.ts +0 -1
  59. package/dist/webpack/webpack.config.d.ts +0 -2
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.225/dist/preview.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.225/dist/preview.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.227/dist/preview.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.227/dist/preview.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/preview",
3
- "version": "1.0.225",
3
+ "version": "1.0.227",
4
4
  "homepage": "https://bit.cloud/teambit/preview/preview",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.preview",
8
8
  "name": "preview",
9
- "version": "1.0.225"
9
+ "version": "1.0.227"
10
10
  },
11
11
  "dependencies": {
12
12
  "mime": "2.5.2",
@@ -28,30 +28,30 @@
28
28
  "@teambit/component-id": "1.2.0",
29
29
  "@teambit/bit-error": "0.0.404",
30
30
  "@teambit/react.webpack.react-webpack": "1.0.25",
31
- "@teambit/express": "0.0.958",
32
- "@teambit/logger": "0.0.952",
33
- "@teambit/builder": "1.0.225",
34
- "@teambit/bundler": "1.0.225",
35
- "@teambit/component": "1.0.225",
31
+ "@teambit/express": "0.0.959",
32
+ "@teambit/logger": "0.0.953",
33
+ "@teambit/builder": "1.0.227",
34
+ "@teambit/bundler": "1.0.227",
35
+ "@teambit/component": "1.0.227",
36
36
  "@teambit/preview.ui.component-preview": "1.0.5",
37
- "@teambit/aspect-loader": "1.0.225",
38
- "@teambit/cli": "0.0.859",
39
- "@teambit/dependency-resolver": "1.0.225",
40
- "@teambit/envs": "1.0.225",
37
+ "@teambit/aspect-loader": "1.0.227",
38
+ "@teambit/cli": "0.0.860",
39
+ "@teambit/dependency-resolver": "1.0.227",
40
+ "@teambit/envs": "1.0.227",
41
41
  "@teambit/toolbox.path.to-windows-compatible-path": "0.0.496",
42
- "@teambit/ui": "1.0.225",
43
- "@teambit/isolator": "1.0.225",
42
+ "@teambit/ui": "1.0.227",
43
+ "@teambit/isolator": "1.0.227",
44
44
  "@teambit/harmony.modules.harmony-root-generator": "0.0.4",
45
- "@teambit/cache": "0.0.952",
46
- "@teambit/graphql": "1.0.225",
47
- "@teambit/pkg": "1.0.225",
48
- "@teambit/pubsub": "1.0.225",
49
- "@teambit/scope": "1.0.225",
50
- "@teambit/watcher": "1.0.225",
51
- "@teambit/workspace": "1.0.225",
52
- "@teambit/compiler": "1.0.225",
45
+ "@teambit/cache": "0.0.953",
46
+ "@teambit/graphql": "1.0.227",
47
+ "@teambit/pkg": "1.0.227",
48
+ "@teambit/pubsub": "1.0.227",
49
+ "@teambit/scope": "1.0.227",
50
+ "@teambit/watcher": "1.0.227",
51
+ "@teambit/workspace": "1.0.227",
52
+ "@teambit/compiler": "1.0.227",
53
53
  "@teambit/preview.cli.webpack-events-listener": "0.0.175",
54
- "@teambit/webpack": "1.0.225"
54
+ "@teambit/webpack": "1.0.227"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/mime": "2.0.3",
@@ -66,7 +66,7 @@
66
66
  "chai": "4.3.0",
67
67
  "@types/lodash.compact": "3.0.6",
68
68
  "@types/mocha": "9.1.0",
69
- "@teambit/harmony.envs.core-aspect-env": "0.0.27",
69
+ "@teambit/harmony.envs.core-aspect-env": "0.0.30",
70
70
  "@teambit/preview.aspect-docs.preview": "0.0.167"
71
71
  },
72
72
  "peerDependencies": {
package/tsconfig.json CHANGED
@@ -20,7 +20,8 @@
20
20
  "emitDeclarationOnly": true,
21
21
  "strict": true,
22
22
  "strictPropertyInitialization": false,
23
- "noImplicitAny": false
23
+ "noImplicitAny": false,
24
+ "composite": true
24
25
  },
25
26
  "exclude": [
26
27
  "artifacts",
@@ -35,5 +36,64 @@
35
36
  "include": [
36
37
  "**/*",
37
38
  "**/*.json"
39
+ ],
40
+ "references": [
41
+ {
42
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_express@0.0.959"
43
+ },
44
+ {
45
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.953"
46
+ },
47
+ {
48
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pipelines_builder@1.0.227"
49
+ },
50
+ {
51
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@1.0.227"
52
+ },
53
+ {
54
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@1.0.227"
55
+ },
56
+ {
57
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@1.0.227"
58
+ },
59
+ {
60
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.860"
61
+ },
62
+ {
63
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.envs_envs@1.0.227"
64
+ },
65
+ {
66
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.227"
67
+ },
68
+ {
69
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_isolator@1.0.227"
70
+ },
71
+ {
72
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cache@0.0.953"
73
+ },
74
+ {
75
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_graphql@1.0.227"
76
+ },
77
+ {
78
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.pkg_pkg@1.0.227"
79
+ },
80
+ {
81
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.227"
82
+ },
83
+ {
84
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.scope_scope@1.0.227"
85
+ },
86
+ {
87
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_watcher@1.0.227"
88
+ },
89
+ {
90
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.workspace_workspace@1.0.227"
91
+ },
92
+ {
93
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_compiler@1.0.227"
94
+ },
95
+ {
96
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.webpack_webpack@1.0.227"
97
+ }
38
98
  ]
39
99
  }
@@ -1,12 +0,0 @@
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;
@@ -1,17 +0,0 @@
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 {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export declare function writePeerLink(peers: string[], workdir: string): Promise<string>;
2
- export declare function generatePeerLink(peers: string[]): string;
@@ -1,5 +0,0 @@
1
- import type { BundlerHtmlConfig } from '@teambit/bundler';
2
- import { PreviewDefinition } from '../preview-definition';
3
- export declare function generateHtmlConfig(previewDef: PreviewDefinition, options: {
4
- dev?: boolean;
5
- }): BundlerHtmlConfig;
@@ -1,2 +0,0 @@
1
- /** html template for Previews (docs, compositions, etc) */
2
- export declare function html(title: string): string;
@@ -1,23 +0,0 @@
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 {};
@@ -1,2 +0,0 @@
1
- import { ComponentPreview } from '@teambit/preview.ui.component-preview';
2
- export { ComponentPreview };
@@ -1,20 +0,0 @@
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
- }
@@ -1,45 +0,0 @@
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
- }[];
@@ -1,25 +0,0 @@
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 {};
@@ -1,12 +0,0 @@
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 {};
@@ -1 +0,0 @@
1
- export * from './click-inside-an-iframe';
@@ -1,4 +0,0 @@
1
- export declare class BundlingStrategyNotFound extends Error {
2
- private strategyName;
3
- constructor(strategyName: string);
4
- }
@@ -1,4 +0,0 @@
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';
@@ -1,5 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
- import { ComponentID } from '@teambit/component';
3
- export declare class PreviewArtifactNotFound extends BitError {
4
- constructor(componentId: ComponentID);
5
- }
@@ -1,3 +0,0 @@
1
- export declare class PreviewNotFound extends Error {
2
- constructor(name: string | null);
3
- }
@@ -1,5 +0,0 @@
1
- import { BitError } from '@teambit/bit-error';
2
- import { ComponentID } from '@teambit/component';
3
- export declare class PreviewOutputFileNotFound extends BitError {
4
- constructor(componentId: ComponentID, filePath: string);
5
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export declare function fetchComponentAspects(componentId: string): Promise<string[] | undefined>;
@@ -1,6 +0,0 @@
1
- export declare function loadScript({ src }: {
2
- src: string;
3
- }): Promise<void>;
4
- export declare function loadLink({ href }: {
5
- href: string;
6
- }): Promise<void>;
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
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';
@@ -1 +0,0 @@
1
- export declare function makeTempDir(prefix?: string): string;
@@ -1,12 +0,0 @@
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;
@@ -1,8 +0,0 @@
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>;
@@ -1,15 +0,0 @@
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,8 +0,0 @@
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
- }
@@ -1,19 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- import { BuildContext } from '@teambit/builder';
2
- export interface PreviewContext extends BuildContext {
3
- entries: string[];
4
- }
@@ -1,34 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export { PreviewModules, linkModules, PREVIEW_MODULES } from '@teambit/preview.modules.preview-modules';
@@ -1,25 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- import { Aspect, RuntimeDefinition } from '@teambit/harmony';
2
- export declare const PreviewRuntime: RuntimeDefinition;
3
- export declare const PreviewAspect: Aspect;
4
- export default PreviewAspect;
@@ -1 +0,0 @@
1
- export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
package/dist/preview.d.ts DELETED
@@ -1,11 +0,0 @@
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
- }