From 151bf9bd1851d340af3033e672222862e69df9a9 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 13:24:33 +0200 Subject: [PATCH 01/89] import all core aspects main runtimes to make sure it's part of the bundle --- scopes/harmony/bit/manifests.ts | 372 +++++++++++++++++++++++--------- 1 file changed, 276 insertions(+), 96 deletions(-) diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index fcf3cc573b91..363c789b677c 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -1,100 +1,188 @@ -import { AspectAspect } from '@teambit/aspect'; -import AspectLoaderAspect from '@teambit/aspect-loader'; -import { BuilderAspect } from '@teambit/builder'; -import { BundlerAspect } from '@teambit/bundler'; -import { CacheAspect } from '@teambit/cache'; -import { CLIAspect } from '@teambit/cli'; -import { CompilerAspect } from '@teambit/compiler'; -import { ComponentAspect } from '@teambit/component'; -import { CompositionsAspect } from '@teambit/compositions'; -import { ConfigAspect } from '@teambit/config'; -import { DependencyResolverAspect } from '@teambit/dependency-resolver'; -import { DeprecationAspect } from '@teambit/deprecation'; -import { DocsAspect } from '@teambit/docs'; -import { EnvsAspect } from '@teambit/envs'; -import { EnvAspect } from '@teambit/env'; -import { ExpressAspect } from '@teambit/express'; -import { YarnAspect } from '@teambit/yarn'; -import { GeneratorAspect } from '@teambit/generator'; -import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app'; -import { GraphAspect } from '@teambit/graph'; -import { GraphqlAspect } from '@teambit/graphql'; -import { InsightsAspect } from '@teambit/insights'; -import { IsolatorAspect } from '@teambit/isolator'; -import { JestAspect } from '@teambit/jest'; -import { LoggerAspect } from '@teambit/logger'; -import { NodeAspect } from '@teambit/node'; -import { NotificationsAspect } from '@teambit/notifications'; -import { PanelUiAspect } from '@teambit/panels'; -import { PkgAspect } from '@teambit/pkg'; -import { PnpmAspect } from '@teambit/pnpm'; -import { PreviewAspect } from '@teambit/preview'; -import { ComponentSizerAspect } from '@teambit/component-sizer'; -import { ReactAspect } from '@teambit/react'; -import { ReactNativeAspect } from '@teambit/react-native'; -import { ReactRouterAspect } from '@teambit/react-router'; -import { ReactElementsAspect } from '@teambit/react-elements'; -import { ElementsAspect } from '@teambit/elements'; -import { SchemaAspect } from '@teambit/schema'; -import { PubsubAspect } from '@teambit/pubsub'; -import { ScopeAspect } from '@teambit/scope'; -// import { StencilAspect } from '@teambit/stencil'; -import { TesterAspect } from '@teambit/tester'; -import { MultiTesterAspect } from '@teambit/multi-tester'; -import { TypescriptAspect } from '@teambit/typescript'; -import { BabelAspect } from '@teambit/babel'; -import { UIAspect } from '@teambit/ui'; -import { VariantsAspect } from '@teambit/variants'; -import { WebpackAspect } from '@teambit/webpack'; -import { WorkspaceAspect } from '@teambit/workspace'; -import { InstallAspect } from '@teambit/install'; -import { LinterAspect } from '@teambit/linter'; -import { FormatterAspect } from '@teambit/formatter'; -import { ChangelogAspect } from '@teambit/changelog'; -import { CodeAspect } from '@teambit/code'; -import { CommandBarAspect } from '@teambit/command-bar'; -import { SidebarAspect } from '@teambit/sidebar'; -import { ComponentTreeAspect } from '@teambit/component-tree'; -import { DevFilesAspect } from '@teambit/dev-files'; -import { ESLintAspect } from '@teambit/eslint'; -import { PrettierAspect } from '@teambit/prettier'; -import { SignAspect } from '@teambit/sign'; -import WorkerAspect from '@teambit/worker'; -import { GlobalConfigAspect } from '@teambit/global-config'; -import MultiCompilerAspect from '@teambit/multi-compiler'; -import MDXAspect from '@teambit/mdx'; -import ReadmeAspect from '@teambit/readme'; -import { ApplicationAspect } from '@teambit/application'; -import { UpdateDependenciesAspect } from '@teambit/update-dependencies'; -import { ExportAspect } from '@teambit/export'; -import { ImporterAspect } from '@teambit/importer'; -import { EjectAspect } from '@teambit/eject'; -import { UserAgentAspect } from '@teambit/user-agent'; -import { HtmlAspect } from '@teambit/html'; -import { LanesAspect } from '@teambit/lanes'; -import { ForkingAspect } from '@teambit/forking'; -import { RenamingAspect } from '@teambit/renaming'; -import { ComponentLogAspect } from '@teambit/component-log'; -import { ClearCacheAspect } from '@teambit/clear-cache'; -import { DiagnosticAspect } from '@teambit/diagnostic'; -import { NewComponentHelperAspect } from '@teambit/new-component-helper'; -import { MochaAspect } from '@teambit/mocha'; -import { BitCustomAspectAspect } from '@teambit/bit-custom-aspect'; -import { CommunityAspect } from '@teambit/community'; -import { CloudAspect } from '@teambit/cloud'; -import { StatusAspect } from '@teambit/status'; -import { SnappingAspect } from '@teambit/snapping'; -import { MergingAspect } from '@teambit/merging'; -import { IssuesAspect } from '@teambit/issues'; -import { RefactoringAspect } from '@teambit/refactoring'; -import { ComponentCompareAspect } from '@teambit/component-compare'; -import { ListerAspect } from '@teambit/lister'; -import { DependenciesAspect } from '@teambit/dependencies'; -import { RemoveAspect } from '@teambit/remove'; -import { MergeLanesAspect } from '@teambit/merge-lanes'; -import { CheckoutAspect } from '@teambit/checkout'; -import { APIReferenceAspect } from '@teambit/api-reference'; +import { AspectAspect } from '@teambit/aspect/aspect.aspect'; +import {AspectMain} from '@teambit/aspect/aspect.main.runtime'; +import AspectLoaderAspect from '@teambit/aspect-loader/aspect-loader.aspect'; +import {AspectLoaderMain} from '@teambit/aspect-loader/aspect-loader.main.runtime'; +import { BuilderAspect } from '@teambit/builder/builder.aspect'; +import {BuilderMain} from '@teambit/builder/builder.main.runtime'; +import { BundlerAspect } from '@teambit/bundler/bundler.aspect'; +import {BundlerMain} from '@teambit/bundler/bundler.main.runtime'; +import { CacheAspect } from '@teambit/cache/cache.aspect'; +import {CacheMain} from '@teambit/cache/cache.main.runtime'; +import { CLIAspect } from '@teambit/cli/cli.aspect'; +import {CLIMain} from '@teambit/cli/cli.main.runtime'; +import { CompilerAspect } from '@teambit/compiler/compiler.aspect'; +import {CompilerMain} from '@teambit/compiler/compiler.main.runtime'; +import { ComponentAspect } from '@teambit/component/component.aspect'; +import {ComponentMain} from '@teambit/component/component.main.runtime'; +import { CompositionsAspect } from '@teambit/compositions/compositions.aspect'; +import {CompositionsMain} from '@teambit/compositions/compositions.main.runtime'; +import { ConfigAspect } from '@teambit/config/config.aspect'; +import {ConfigMain} from '@teambit/config/config.main.runtime'; +import { DependencyResolverAspect } from '@teambit/dependency-resolver/dependency-resolver.aspect'; +import {DependencyResolverMain} from '@teambit/dependency-resolver/dependency-resolver.main.runtime'; +import { DeprecationAspect } from '@teambit/deprecation/deprecation.aspect'; +import {DeprecationMain} from '@teambit/deprecation/deprecation.main.runtime'; +import { DocsAspect } from '@teambit/docs/docs.aspect'; +import {DocsMain} from '@teambit/docs/docs.main.runtime'; +import { EnvsAspect } from '@teambit/envs/environments.aspect'; +import {EnvsMain} from '@teambit/envs/environments.main.runtime'; +import { EnvAspect } from '@teambit/env/env.aspect'; +import {EnvMain} from '@teambit/env/env.main.runtime'; +import { ExpressAspect } from '@teambit/express/express.aspect'; +import {ExpressMain} from '@teambit/express/express.main.runtime'; +import { YarnAspect } from '@teambit/yarn/yarn.aspect'; +import {YarnMain} from '@teambit/yarn/yarn.main.runtime'; +import { GeneratorAspect } from '@teambit/generator/generator.aspect'; +import {GeneratorMain} from '@teambit/generator/generator.main.runtime'; +import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app/harmony-ui-app.aspect'; +import {HarmonyUiAppMain} from '@teambit/harmony-ui-app/harmony-ui-app.main.runtime'; +import { GraphAspect } from '@teambit/graph/graph.aspect'; +import {GraphMain} from '@teambit/graph/graph.main.runtime'; +import { GraphqlAspect } from '@teambit/graphql/graphql.aspect'; +import {GraphqlMain} from '@teambit/graphql/graphql.main.runtime'; +import { InsightsAspect } from '@teambit/insights/insights.aspect'; +import {InsightsMain} from '@teambit/insights/insights.main.runtime'; +import { IsolatorAspect } from '@teambit/isolator/isolator.aspect'; +import {IsolatorMain} from '@teambit/isolator/isolator.main.runtime'; +import { JestAspect } from '@teambit/jest/jest.aspect'; +import {JestMain} from '@teambit/jest/jest.main.runtime'; +import { LoggerAspect } from '@teambit/logger/logger.aspect'; +import {LoggerMain} from '@teambit/logger/logger.main.runtime'; +import { NodeAspect } from '@teambit/node/node.aspect'; +import {NodeMain} from '@teambit/node/node.main.runtime'; +import { NotificationsAspect } from '@teambit/notifications/notifications.aspect'; +import { PanelUiAspect } from '@teambit/panels/panel-ui.aspect'; +import {PanelUIMain} from '@teambit/panels/panel-ui.main.runtime'; +import { PkgAspect } from '@teambit/pkg/pkg.aspect'; +import {PkgMain} from '@teambit/pkg/pkg.main.runtime'; +import { PnpmAspect } from '@teambit/pnpm/pnpm.aspect'; +import {PnpmMain} from '@teambit/pnpm/pnpm.main.runtime'; +import { PreviewAspect } from '@teambit/preview/preview.aspect'; +import {PreviewMain} from '@teambit/preview/preview.main.runtime'; +import { ComponentSizerAspect } from '@teambit/component-sizer/component-sizer.aspect'; +import {ComponentSizerMain} from '@teambit/component-sizer/component-sizer.main.runtime'; +import { ReactAspect } from '@teambit/react/react.aspect'; +import {ReactMain} from '@teambit/react/react.main.runtime'; +import { ReactNativeAspect } from '@teambit/react-native/react-native.aspect'; +import {ReactNativeMain} from '@teambit/react-native/react-native.main.runtime'; +import { ReactRouterAspect } from '@teambit/react-router/react-router.aspect'; +import { ReactElementsAspect } from '@teambit/react-elements/react-elements.aspect'; +import {ReactElementsMain} from '@teambit/react-elements/react-elements.main.runtime'; +import { ElementsAspect } from '@teambit/elements/elements.aspect'; +import {ElementsMain} from '@teambit/elements/elements.main.runtime'; +import { SchemaAspect } from '@teambit/schema/schema.aspect'; +import {SchemaMain} from '@teambit/schema/schema.main.runtime'; +import { PubsubAspect } from '@teambit/pubsub/pubsub.aspect'; +import {PubsubMain} from '@teambit/pubsub/pubsub.main.runtime'; +import { ScopeAspect } from '@teambit/scope/scope.aspect'; +import {ScopeMain} from '@teambit/scope/scope.main.runtime'; +// import { StencilAspect } from '@teambit/stencil/stencil.aspect'; +// {impor}{ StencMain } from '@teambit/stencil/stencil.main.runtime'; +import { TesterAspect } from '@teambit/tester/tester.aspect'; +import {TesterMain} from '@teambit/tester/tester.main.runtime'; +import { MultiTesterAspect } from '@teambit/multi-tester/multi-tester.aspect'; +import {MultiTesterMain} from '@teambit/multi-tester/multi-tester.main.runtime'; +import { TypescriptAspect } from '@teambit/typescript/typescript.aspect'; +import {TypescriptMain} from '@teambit/typescript/typescript.main.runtime'; +import { BabelAspect } from '@teambit/babel/babel.aspect'; +import {BabelMain} from '@teambit/babel/babel.main.runtime'; +import { UIAspect } from '@teambit/ui/ui.aspect'; +import {UiMain} from '@teambit/ui/ui.main.runtime'; +import { VariantsAspect } from '@teambit/variants/variants.aspect'; +import {VariantsMain} from '@teambit/variants/variants.main.runtime'; +import { WebpackAspect } from '@teambit/webpack/webpack.aspect'; +import {WebpackMain} from '@teambit/webpack/webpack.main.runtime'; +import { WorkspaceAspect } from '@teambit/workspace/workspace.aspect'; +import {WorkspaceMain} from '@teambit/workspace/workspace.main.runtime'; +import { InstallAspect } from '@teambit/install/install.aspect'; +import {InstallMain} from '@teambit/install/install.main.runtime'; +import { LinterAspect } from '@teambit/linter/linter.aspect'; +import {LinterMain} from '@teambit/linter/linter.main.runtime'; +import { FormatterAspect } from '@teambit/formatter/formatter.aspect'; +import {FormatterMain} from '@teambit/formatter/formatter.main.runtime'; +import { ChangelogAspect } from '@teambit/changelog/changelog.aspect'; +import { CodeAspect } from '@teambit/code/code.aspect'; +import { CommandBarAspect } from '@teambit/command-bar/command-bar.aspect'; +import { SidebarAspect } from '@teambit/sidebar/sidebar.aspect'; +import { ComponentTreeAspect } from '@teambit/component-tree/component-tree.aspect'; +import { DevFilesAspect } from '@teambit/dev-files/dev-files.aspect'; +import {DevFilesMain} from '@teambit/dev-files/dev-files.main.runtime'; +import { ESLintAspect } from '@teambit/eslint/eslint.aspect'; +import {ESLintMain} from '@teambit/eslint/eslint.main.runtime'; +import { PrettierAspect } from '@teambit/prettier/prettier.aspect'; +import {PrettierMain} from '@teambit/prettier/prettier.main.runtime'; +import { SignAspect } from '@teambit/sign/sign.aspect'; +import {SignMain} from '@teambit/sign/sign.main.runtime'; +import { WorkerAspect } from '@teambit/worker/worker.aspect'; +import {WorkerMain} from '@teambit/worker/worker.main.runtime'; +import { GlobalConfigAspect } from '@teambit/global-config/global-config.aspect'; +import {GlobalConfigMain} from '@teambit/global-config/global-config.main.runtime'; +import { MultiCompilerAspect } from '@teambit/multi-compiler/multi-compiler.aspect'; +import {MultiCompilerMain} from '@teambit/multi-compiler/multi-compiler.main.runtime'; +import { MDXAspect } from '@teambit/mdx/mdx.aspect'; +import {MDXMain} from '@teambit/mdx/mdx.main.runtime'; +import { ReadmeAspect } from '@teambit/readme/readme.aspect'; +import {ReadmeMain} from '@teambit/readme/readme.main.runtime'; +import { ApplicationAspect } from '@teambit/application/application.aspect'; +import {ApplicationMain} from '@teambit/application/application.main.runtime'; +import { UpdateDependenciesAspect } from '@teambit/update-dependencies/update-dependencies.aspect'; +import {UpdateDependenciesMain} from '@teambit/update-dependencies/update-dependencies.main.runtime'; +import { ExportAspect } from '@teambit/export/export.aspect'; +import {ExportMain} from '@teambit/export/export.main.runtime'; +import { ImporterAspect } from '@teambit/importer/importer.aspect'; +import {ImporterMain} from '@teambit/importer/importer.main.runtime'; +import { EjectAspect } from '@teambit/eject/eject.aspect'; +import {EjectMain} from '@teambit/eject/eject.main.runtime'; +import { UserAgentAspect } from '@teambit/user-agent/user-agent.aspect'; +import { HtmlAspect } from '@teambit/html/html.aspect'; +import {HtmlMain} from '@teambit/html/html.main.runtime'; +import { LanesAspect } from '@teambit/lanes/lanes.aspect'; +import {LanesMain} from '@teambit/lanes/lanes.main.runtime'; +import { ForkingAspect } from '@teambit/forking/forking.aspect'; +import {ForkingMain} from '@teambit/forking/forking.main.runtime'; +import { RenamingAspect } from '@teambit/renaming/renaming.aspect'; +import {RenamingMain} from '@teambit/renaming/renaming.main.runtime'; +import { ComponentLogAspect } from '@teambit/component-log/component-log.aspect'; +import {ComponentLogMain} from '@teambit/component-log/component-log.main.runtime'; +import { ClearCacheAspect } from '@teambit/clear-cache/clear-cache.aspect'; +import {ClearCacheMain} from '@teambit/clear-cache/clear-cache.main.runtime'; +import { DiagnosticAspect } from '@teambit/diagnostic/diagnostic.aspect'; +import {DiagnosticMain} from '@teambit/diagnostic/diagnostic.main.runtime'; +import { NewComponentHelperAspect } from '@teambit/new-component-helper/new-component-helper.aspect'; +import {NewComponentHelperMain} from '@teambit/new-component-helper/new-component-helper.main.runtime'; +import { MochaAspect } from '@teambit/mocha/mocha.aspect'; +import {MochaMain} from '@teambit/mocha/mocha.main.runtime'; +import { BitCustomAspectAspect } from '@teambit/bit-custom-aspect/bit-custom-aspect.aspect'; +import {BitCustomAspectMain} from '@teambit/bit-custom-aspect/bit-custom-aspect.main.runtime'; +import { CommunityAspect } from '@teambit/community/community.aspect'; +import {CommunityMain} from '@teambit/community/community.main.runtime'; +import { CloudAspect } from '@teambit/cloud/cloud.aspect'; +import {CloudMain} from '@teambit/cloud/cloud.main.runtime'; +import { StatusAspect } from '@teambit/status/status.aspect'; +import {StatusMain} from '@teambit/status/status.main.runtime'; +import { SnappingAspect } from '@teambit/snapping/snapping.aspect'; +import {SnappingMain} from '@teambit/snapping/snapping.main.runtime'; +import { MergingAspect } from '@teambit/merging/merging.aspect'; +import {MergingMain} from '@teambit/merging/merging.main.runtime'; +import { IssuesAspect } from '@teambit/issues/issues.aspect'; +import {IssuesMain} from '@teambit/issues/issues.main.runtime'; +import { RefactoringAspect } from '@teambit/refactoring/refactoring.aspect'; +import {RefactoringMain} from '@teambit/refactoring/refactoring.main.runtime'; +import { ComponentCompareAspect } from '@teambit/component-compare/component-compare.aspect'; +import {ComponentCompareMain} from '@teambit/component-compare/component-compare.main.runtime'; +import { ListerAspect } from '@teambit/lister/lister.aspect'; +import {ListerMain} from '@teambit/lister/lister.main.runtime'; +import { DependenciesAspect } from '@teambit/dependencies/dependencies.aspect'; +import {DependenciesMain} from '@teambit/dependencies/dependencies.main.runtime'; +import { RemoveAspect } from '@teambit/remove/remove.aspect'; +import {RemoveMain} from '@teambit/remove/remove.main.runtime'; +import { MergeLanesAspect } from '@teambit/merge-lanes/merge-lanes.aspect'; +import {MergeLanesMain} from '@teambit/merge-lanes/merge-lanes.main.runtime'; +import { CheckoutAspect } from '@teambit/checkout/checkout.aspect'; +import {CheckoutMain} from '@teambit/checkout/checkout.main.runtime'; +import { APIReferenceAspect } from '@teambit/api-reference/api-reference.aspect'; import { BitAspect } from './bit.aspect'; +import {BitMain} from './bit.main.runtime'; export const manifestsMap = { [AspectLoaderAspect.id]: AspectLoaderAspect, @@ -194,6 +282,98 @@ export const manifestsMap = { [APIReferenceAspect.id]: APIReferenceAspect, }; +export const runtimesMap = { + [AspectAspect.id]: AspectMain, + [AspectLoaderAspect.id]: AspectLoaderMain, + [BuilderAspect.id]: BuilderMain, + [BundlerAspect.id]: BundlerMain, + [CacheAspect.id]: CacheMain, + [CLIAspect.id]: CLIMain, + [CompilerAspect.id]: CompilerMain, + [ComponentAspect.id]: ComponentMain, + [CompositionsAspect.id]: CompositionsMain, + [ConfigAspect.id]: ConfigMain, + [DependencyResolverAspect.id]: DependencyResolverMain, + [DeprecationAspect.id]: DeprecationMain, + [DocsAspect.id]: DocsMain, + [EnvsAspect.id]: EnvsMain, + [EnvAspect.id]: EnvMain, + [ExpressAspect.id]: ExpressMain, + [YarnAspect.id]: YarnMain, + [GeneratorAspect.id]: GeneratorMain, + [HarmonyUiAppAspect.id]: HarmonyUiAppMain, + [GraphAspect.id]: GraphMain, + [GraphqlAspect.id]: GraphqlMain, + [InsightsAspect.id]: InsightsMain, + [IsolatorAspect.id]: IsolatorMain, + [JestAspect.id]: JestMain, + [LoggerAspect.id]: LoggerMain, + [NodeAspect.id]: NodeMain, + [PanelUiAspect.id]: PanelUIMain, + [PkgAspect.id]: PkgMain, + [PnpmAspect.id]: PnpmMain, + [PreviewAspect.id]: PreviewMain, + [ComponentSizerAspect.id]: ComponentSizerMain, + [ReactAspect.id]: ReactMain, + [ReactNativeAspect.id]: ReactNativeMain, + [ReactElementsAspect.id]: ReactElementsMain, + [ElementsAspect.id]: ElementsMain, + [SchemaAspect.id]: SchemaMain, + [PubsubAspect.id]: PubsubMain, + [ScopeAspect.id]: ScopeMain, + [TesterAspect.id]: TesterMain, + [MultiTesterAspect.id]: MultiTesterMain, + [TypescriptAspect.id]: TypescriptMain, + [BabelAspect.id]: BabelMain, + [UIAspect.id]: UiMain, + [VariantsAspect.id]: VariantsMain, + [WebpackAspect.id]: WebpackMain, + [WorkspaceAspect.id]: WorkspaceMain, + [InstallAspect.id]: InstallMain, + [LinterAspect.id]: LinterMain, + [FormatterAspect.id]: FormatterMain, + [DevFilesAspect.id]: DevFilesMain, + [ESLintAspect.id]: ESLintMain, + [PrettierAspect.id]: PrettierMain, + [SignAspect.id]: SignMain, + [WorkerAspect.id]: WorkerMain, + [GlobalConfigAspect.id]: GlobalConfigMain, + [MultiCompilerAspect.id]: MultiCompilerMain, + [MDXAspect.id]: MDXMain, + [ReadmeAspect.id]: ReadmeMain, + [ApplicationAspect.id]: ApplicationMain, + [UpdateDependenciesAspect.id]: UpdateDependenciesMain, + [ExportAspect.id]: ExportMain, + [ImporterAspect.id]: ImporterMain, + [EjectAspect.id]: EjectMain, + [HtmlAspect.id]: HtmlMain, + [LanesAspect.id]: LanesMain, + [ForkingAspect.id]: ForkingMain, + [RenamingAspect.id]: RenamingMain, + [ComponentLogAspect.id]: ComponentLogMain, + [ClearCacheAspect.id]: ClearCacheMain, + [DiagnosticAspect.id]: DiagnosticMain, + [NewComponentHelperAspect.id]: NewComponentHelperMain, + [MochaAspect.id]: MochaMain, + [BitCustomAspectAspect.id]: BitCustomAspectMain, + [CommunityAspect.id]: CommunityMain, + [CloudAspect.id]: CloudMain, + [StatusAspect.id]: StatusMain, + [SnappingAspect.id]: SnappingMain, + [MergingAspect.id]: MergingMain, + [IssuesAspect.id]: IssuesMain, + [RefactoringAspect.id]: RefactoringMain, + [ComponentCompareAspect.id]: ComponentCompareMain, + [ListerAspect.id]: ListerMain, + [DependenciesAspect.id]: DependenciesMain, + [RemoveAspect.id]: RemoveMain, + [MergeLanesAspect.id]: MergeLanesMain, + [CheckoutAspect.id]: CheckoutMain, + [BitAspect.id]: BitMain, +} + +console.log(runtimesMap) + export function isCoreAspect(id: string) { const _reserved = [BitAspect.id, ConfigAspect.id]; if (_reserved.includes(id)) return true; From fbaedad0051639c925a9f1885b3f90fa42ae6cd8 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 13:25:52 +0200 Subject: [PATCH 02/89] now that we import all the core aspect main runtimes we don't need to use that require aspect func in load bit --- scopes/harmony/bit/load-bit.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/bit/load-bit.ts b/scopes/harmony/bit/load-bit.ts index 3e0367d5d0e3..e13e008a5ff7 100644 --- a/scopes/harmony/bit/load-bit.ts +++ b/scopes/harmony/bit/load-bit.ts @@ -223,11 +223,14 @@ export async function loadBit(path = process.cwd()) { const aspectsToLoad = [CLIAspect]; const loadCLIOnly = shouldLoadInSafeMode(); if (!loadCLIOnly) { - aspectsToLoad.push(BitAspect); + // aspectsToLoad.push(BitAspect); + aspectsToLoad.push(...(Object.values(manifestsMap))); } + // console.log('aspectsToLoad', aspectsToLoad) const harmony = await Harmony.load(aspectsToLoad, MainRuntime.name, configMap); - await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); + // await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); + await harmony.run(); if (loadCLIOnly) return harmony; loader.start('loading aspects...'); const aspectLoader = harmony.get('teambit.harmony/aspect-loader'); From 613ee4eead5532e6ca8ac69f3542d46d288525ab Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 13:26:45 +0200 Subject: [PATCH 03/89] require yargs instead of import it as it causes bundling issues --- scopes/harmony/cli/cli-parser.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/cli/cli-parser.ts b/scopes/harmony/cli/cli-parser.ts index 43cf5c257e26..085af95a5195 100644 --- a/scopes/harmony/cli/cli-parser.ts +++ b/scopes/harmony/cli/cli-parser.ts @@ -1,5 +1,5 @@ import didYouMean from 'didyoumean'; -import yargs from 'yargs'; +// import yargs from 'yargs'; import { Command } from '@teambit/legacy/dist/cli/command'; import { GroupsType } from '@teambit/legacy/dist/cli/command-groups'; import { compact } from 'lodash'; @@ -12,6 +12,12 @@ import { formatHelp } from './help'; import { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter'; import { CommandNotFound } from './exceptions/command-not-found'; +// Using require instead of import because of this issue: +// https://github.com/evanw/esbuild/issues/1492 +// couldn't make the other solutions to work but it worth another try in the future +const yargs = require('yargs'); + + export class CLIParser { constructor( private commands: Command[], From b05336851ecff3856f3d956a5a506cb64905fe98 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 13:28:34 +0200 Subject: [PATCH 04/89] WIP - first bundling script (with hard coded stuff) --- scopes/harmony/bit/bundle.ts | 96 ++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 scopes/harmony/bit/bundle.ts diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts new file mode 100644 index 000000000000..36fff180b39a --- /dev/null +++ b/scopes/harmony/bit/bundle.ts @@ -0,0 +1,96 @@ +import { build } from 'esbuild'; +import ignorePlugin from 'esbuild-plugin-ignore'; +import { join } from 'path'; + +function bundle(){ + const appFile = `bit.app`; + // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); + const _outfile = join('/Users/giladshoham/dev/bit/bit/bundle', `${appFile}.js`); + // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `test-app.js`); + return build({ + define: { + // 'process.env.JSON_LOGS': 'true', + 'process.env.BIT_LOG': `"debug"`, + // 'import_meta_url': 'import_meta_url', + 'import_meta.url': 'import_meta_url', + }, + entryPoints: ['/Users/giladshoham/dev/bit/bit/scopes/harmony/bit/app.ts'], + // entryPoints: ['/Users/giladshoham/dev/bit/bit/node_modules/@teambit/bit/dist/app.js'], + // entryPoints: ['/Users/giladshoham/dev/temp/bundle-bit/node_modules/@my-scope/bit-bundle/dist/test-app.js'], + // entryPoints: ['/Users/giladshoham/dev/temp/bundle-bit/my-scope/bit-bundle/test-app.ts'] + bundle: true, + logLevel: 'error', + platform: 'node', + mainFields: ['main', 'module' ], + format: 'cjs', + keepNames: true, + outfile: _outfile, + inject: [join(__dirname,'./import-meta-url.js')], + + external: [ + '@babel/preset-react', + 'ink', + 'style-loader', + 'mini-css-extract-plugin', + '@pmmmwh/react-refresh-webpack-plugin', + '@teambit/react.babel.bit-react-transformer', + 'source-map-loader', + 'babel-loader', + 'react-refresh/babel', + 'babel-loader', + '@babel/preset-react', + '@babel/preset-env', + 'react-refresh/babel', + '@teambit/mdx.modules.mdx-loader', + '@swc/core', + // 'esbuild' + // 'mime' + ], + plugins: [ + // sassPlugin(), + ignorePlugin([ + // { resourceRegExp: /(.*)\.ui\.runtime\.*/g }, + { resourceRegExp: /\.(s[ac]ss|css)$/ }, + // { resourceRegExp: new RegExp('^@swc/core') }, + { resourceRegExp: new RegExp('^jest-resolve') }, + { resourceRegExp: new RegExp('^@vue/compiler-sfc') }, + { resourceRegExp: new RegExp('^batch') }, + { resourceRegExp: new RegExp('^../build/Release/cpufeatures.node') }, + { resourceRegExp: new RegExp('^pnpapi') }, + // { resourceRegExp: new RegExp('^shelljs') }, + // { resourceRegExp: new RegExp('^react') }, + // { resourceRegExp: new RegExp('^react-router-dom') }, + { resourceRegExp: new RegExp('^esbuild') }, + // { resourceRegExp: new RegExp('^../prelude/bootstrap.js') }, + // { resourceRegExp: new RegExp('^./html.docs.mdx') }, + // { resourceRegExp: new RegExp('^stream-browserify') }, + // { resourceRegExp: new RegExp('^expose-loader') }, + // { resourceRegExp: new RegExp('^querystring-es3') }, + // { resourceRegExp: new RegExp('^assert/') }, + // { resourceRegExp: new RegExp('^buffer/') }, + // { resourceRegExp: new RegExp('^constants-browserify') }, + // { resourceRegExp: new RegExp('^crypto-browserify') }, + // { resourceRegExp: new RegExp('^domain-browser') }, + // { resourceRegExp: new RegExp('^stream-http') }, + // { resourceRegExp: new RegExp('^https-browserify') }, + // { resourceRegExp: new RegExp('^os-browserify/browser') }, + // { resourceRegExp: new RegExp('^path-browserify') }, + // { resourceRegExp: new RegExp('^punycode/') }, + // { resourceRegExp: new RegExp('^process/browser') }, + // { resourceRegExp: new RegExp('^querystring-es3') }, + // { resourceRegExp: new RegExp('^stream-browserify') }, + // { resourceRegExp: new RegExp('^string_decoder/') }, + // { resourceRegExp: new RegExp('^util/') }, + // { resourceRegExp: new RegExp('^timers-browserify') }, + // { resourceRegExp: new RegExp('^tty-browserify') }, + // { resourceRegExp: new RegExp('^url/') }, + // { resourceRegExp: new RegExp('^util/') }, + // { resourceRegExp: new RegExp('^vm-browserify') }, + // { resourceRegExp: new RegExp('^browserify-zlib') }, + ]), + ], + loader: { '.png': 'binary', '.node': 'binary' }, + }); +} + +bundle().then((res) => console.log('done', res)); From 83935fcbedc358e46e6920e133d34fb568e307f0 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 13:57:40 +0200 Subject: [PATCH 05/89] externals updates --- scopes/harmony/bit/bundle.ts | 79 +++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts index 36fff180b39a..c1854c8e2b59 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle.ts @@ -2,7 +2,7 @@ import { build } from 'esbuild'; import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; -function bundle(){ +function bundle() { const appFile = `bit.app`; // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); const _outfile = join('/Users/giladshoham/dev/bit/bit/bundle', `${appFile}.js`); @@ -10,7 +10,7 @@ function bundle(){ return build({ define: { // 'process.env.JSON_LOGS': 'true', - 'process.env.BIT_LOG': `"debug"`, + 'process.env.BIT_LOG': `'debug'`, // 'import_meta_url': 'import_meta_url', 'import_meta.url': 'import_meta_url', }, @@ -21,11 +21,11 @@ function bundle(){ bundle: true, logLevel: 'error', platform: 'node', - mainFields: ['main', 'module' ], + mainFields: ['main', 'module'], format: 'cjs', keepNames: true, outfile: _outfile, - inject: [join(__dirname,'./import-meta-url.js')], + inject: [join(__dirname, './import-meta-url.js')], external: [ '@babel/preset-react', @@ -43,6 +43,75 @@ function bundle(){ 'react-refresh/babel', '@teambit/mdx.modules.mdx-loader', '@swc/core', + '@babel/plugin-proposal-class-properties', + '@babel/plugin-proposal-decorators', + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-syntax-typescript', + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-transform-runtime', + '@babel/preset-typescript', + '@mdx-js/react', + '@teambit/mdx.ui.mdx-scope-context', + '@teambit/node/jest/jest.config', + '@typescript-eslint/parser', + 'assert/', + 'babel-jest', + 'babel-plugin-istanbul', + 'babel-plugin-transform-typescript-metadata', + 'babel-preset-current-node-syntax', + 'babel-preset-jest', + 'babel-preset-react-app/webpack-overrides', + 'browserify-zlib', + 'buffer/', + 'constants-browserify', + 'crypto-browserify', + 'css-loader', + 'domain-browser', + 'eslint-config-airbnb-typescript', + 'eslint-config-prettier', + 'espree', + 'expose-loader', + 'https-browserify', + 'jest', + 'jest-circus/runner', + 'jest-jasmine2', + 'less-loader', + 'os-browserify/browser', + 'path-browserify', + 'postcss-flexbugs-fixes', + 'postcss-loader', + 'postcss-normalize', + 'process/browser', + 'punycode/', + 'querystring-es3', + 'react', + 'react-dom', + 'react-dom/server', + 'react/jsx-dev-runtime.js', + 'react/jsx-runtime.js', + 'resolve-url-loader', + 'sass-loader', + 'stream-browserify', + 'stream-http', + 'string_decoder/', + 'timers-browserify', + 'tty-browserify', + 'url/', + 'util/', + 'vm-browserify', + 'watchpack', + 'webpack/hot/dev-server', + 'webpack/hot/only-dev-server', + 'source-map-support', + 'css-minimizer-webpack-plugin', + 'html-webpack-plugin', + 'jest-worker', + 'mocha', + 'rollup-plugin-terser', + 'terser-webpack-plugin', + 'uglify-js', + 'uid-number', + 'webpack-dev-server', // 'esbuild' // 'mime' ], @@ -93,4 +162,4 @@ function bundle(){ }); } -bundle().then((res) => console.log('done', res)); +bundle().then((res) => console.log(JSON.stringify(res, null, 2))); From 95b3f0d6167e978d86b00115f10572f3a3562128 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 15:57:05 +0200 Subject: [PATCH 06/89] remove tsconfig from eslint config (it will anyway generated on runtime) --- scopes/react/react/eslint/eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/react/react/eslint/eslintrc.js b/scopes/react/react/eslint/eslintrc.js index 90df02c9e916..daa08f0e71ed 100644 --- a/scopes/react/react/eslint/eslintrc.js +++ b/scopes/react/react/eslint/eslintrc.js @@ -7,6 +7,6 @@ module.exports = { // parser: require.resolve('@typescript-eslint/parser'), // createDefaultProgram: true, // resolve the env tsconfig. - project: require.resolve('../typescript/tsconfig.json'), + project: 'auto generated by bit linter', }, }; From 3d174e424ad2d27bb640c86ba46941171930d1d9 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 15:57:34 +0200 Subject: [PATCH 07/89] update externals --- scopes/harmony/bit/bundle.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts index c1854c8e2b59..677ca6083f60 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle.ts @@ -112,6 +112,13 @@ function bundle() { 'uglify-js', 'uid-number', 'webpack-dev-server', + '@svgr/webpack', + 'new-url-loader', + 'react-native-web', + '@teambit/react.eslint-config-bit-react', + '@teambit/react.ui.docs-app', + '@teambit/react.ui.compositions-app', + 'babel-preset-react-app', // 'esbuild' // 'mime' ], From cadc837562323bf2452409632525f5f90f26ea2a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 19 Jan 2023 16:17:37 +0200 Subject: [PATCH 08/89] move imports --- scopes/harmony/bit/manifests.ts | 182 ++++++++++++++++---------------- 1 file changed, 92 insertions(+), 90 deletions(-) diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index 363c789b677c..2f0d9780a9ba 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -1,188 +1,190 @@ import { AspectAspect } from '@teambit/aspect/aspect.aspect'; -import {AspectMain} from '@teambit/aspect/aspect.main.runtime'; import AspectLoaderAspect from '@teambit/aspect-loader/aspect-loader.aspect'; -import {AspectLoaderMain} from '@teambit/aspect-loader/aspect-loader.main.runtime'; import { BuilderAspect } from '@teambit/builder/builder.aspect'; -import {BuilderMain} from '@teambit/builder/builder.main.runtime'; import { BundlerAspect } from '@teambit/bundler/bundler.aspect'; -import {BundlerMain} from '@teambit/bundler/bundler.main.runtime'; import { CacheAspect } from '@teambit/cache/cache.aspect'; -import {CacheMain} from '@teambit/cache/cache.main.runtime'; import { CLIAspect } from '@teambit/cli/cli.aspect'; -import {CLIMain} from '@teambit/cli/cli.main.runtime'; import { CompilerAspect } from '@teambit/compiler/compiler.aspect'; -import {CompilerMain} from '@teambit/compiler/compiler.main.runtime'; import { ComponentAspect } from '@teambit/component/component.aspect'; -import {ComponentMain} from '@teambit/component/component.main.runtime'; import { CompositionsAspect } from '@teambit/compositions/compositions.aspect'; -import {CompositionsMain} from '@teambit/compositions/compositions.main.runtime'; import { ConfigAspect } from '@teambit/config/config.aspect'; -import {ConfigMain} from '@teambit/config/config.main.runtime'; import { DependencyResolverAspect } from '@teambit/dependency-resolver/dependency-resolver.aspect'; -import {DependencyResolverMain} from '@teambit/dependency-resolver/dependency-resolver.main.runtime'; import { DeprecationAspect } from '@teambit/deprecation/deprecation.aspect'; -import {DeprecationMain} from '@teambit/deprecation/deprecation.main.runtime'; import { DocsAspect } from '@teambit/docs/docs.aspect'; -import {DocsMain} from '@teambit/docs/docs.main.runtime'; import { EnvsAspect } from '@teambit/envs/environments.aspect'; -import {EnvsMain} from '@teambit/envs/environments.main.runtime'; import { EnvAspect } from '@teambit/env/env.aspect'; -import {EnvMain} from '@teambit/env/env.main.runtime'; import { ExpressAspect } from '@teambit/express/express.aspect'; -import {ExpressMain} from '@teambit/express/express.main.runtime'; import { YarnAspect } from '@teambit/yarn/yarn.aspect'; -import {YarnMain} from '@teambit/yarn/yarn.main.runtime'; import { GeneratorAspect } from '@teambit/generator/generator.aspect'; -import {GeneratorMain} from '@teambit/generator/generator.main.runtime'; import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app/harmony-ui-app.aspect'; -import {HarmonyUiAppMain} from '@teambit/harmony-ui-app/harmony-ui-app.main.runtime'; import { GraphAspect } from '@teambit/graph/graph.aspect'; -import {GraphMain} from '@teambit/graph/graph.main.runtime'; import { GraphqlAspect } from '@teambit/graphql/graphql.aspect'; -import {GraphqlMain} from '@teambit/graphql/graphql.main.runtime'; import { InsightsAspect } from '@teambit/insights/insights.aspect'; -import {InsightsMain} from '@teambit/insights/insights.main.runtime'; import { IsolatorAspect } from '@teambit/isolator/isolator.aspect'; -import {IsolatorMain} from '@teambit/isolator/isolator.main.runtime'; import { JestAspect } from '@teambit/jest/jest.aspect'; -import {JestMain} from '@teambit/jest/jest.main.runtime'; import { LoggerAspect } from '@teambit/logger/logger.aspect'; -import {LoggerMain} from '@teambit/logger/logger.main.runtime'; import { NodeAspect } from '@teambit/node/node.aspect'; -import {NodeMain} from '@teambit/node/node.main.runtime'; import { NotificationsAspect } from '@teambit/notifications/notifications.aspect'; import { PanelUiAspect } from '@teambit/panels/panel-ui.aspect'; -import {PanelUIMain} from '@teambit/panels/panel-ui.main.runtime'; import { PkgAspect } from '@teambit/pkg/pkg.aspect'; -import {PkgMain} from '@teambit/pkg/pkg.main.runtime'; import { PnpmAspect } from '@teambit/pnpm/pnpm.aspect'; -import {PnpmMain} from '@teambit/pnpm/pnpm.main.runtime'; import { PreviewAspect } from '@teambit/preview/preview.aspect'; -import {PreviewMain} from '@teambit/preview/preview.main.runtime'; import { ComponentSizerAspect } from '@teambit/component-sizer/component-sizer.aspect'; -import {ComponentSizerMain} from '@teambit/component-sizer/component-sizer.main.runtime'; import { ReactAspect } from '@teambit/react/react.aspect'; -import {ReactMain} from '@teambit/react/react.main.runtime'; import { ReactNativeAspect } from '@teambit/react-native/react-native.aspect'; -import {ReactNativeMain} from '@teambit/react-native/react-native.main.runtime'; import { ReactRouterAspect } from '@teambit/react-router/react-router.aspect'; import { ReactElementsAspect } from '@teambit/react-elements/react-elements.aspect'; -import {ReactElementsMain} from '@teambit/react-elements/react-elements.main.runtime'; import { ElementsAspect } from '@teambit/elements/elements.aspect'; -import {ElementsMain} from '@teambit/elements/elements.main.runtime'; import { SchemaAspect } from '@teambit/schema/schema.aspect'; -import {SchemaMain} from '@teambit/schema/schema.main.runtime'; import { PubsubAspect } from '@teambit/pubsub/pubsub.aspect'; -import {PubsubMain} from '@teambit/pubsub/pubsub.main.runtime'; import { ScopeAspect } from '@teambit/scope/scope.aspect'; -import {ScopeMain} from '@teambit/scope/scope.main.runtime'; // import { StencilAspect } from '@teambit/stencil/stencil.aspect'; -// {impor}{ StencMain } from '@teambit/stencil/stencil.main.runtime'; import { TesterAspect } from '@teambit/tester/tester.aspect'; -import {TesterMain} from '@teambit/tester/tester.main.runtime'; import { MultiTesterAspect } from '@teambit/multi-tester/multi-tester.aspect'; -import {MultiTesterMain} from '@teambit/multi-tester/multi-tester.main.runtime'; import { TypescriptAspect } from '@teambit/typescript/typescript.aspect'; -import {TypescriptMain} from '@teambit/typescript/typescript.main.runtime'; import { BabelAspect } from '@teambit/babel/babel.aspect'; -import {BabelMain} from '@teambit/babel/babel.main.runtime'; import { UIAspect } from '@teambit/ui/ui.aspect'; -import {UiMain} from '@teambit/ui/ui.main.runtime'; import { VariantsAspect } from '@teambit/variants/variants.aspect'; -import {VariantsMain} from '@teambit/variants/variants.main.runtime'; import { WebpackAspect } from '@teambit/webpack/webpack.aspect'; -import {WebpackMain} from '@teambit/webpack/webpack.main.runtime'; import { WorkspaceAspect } from '@teambit/workspace/workspace.aspect'; -import {WorkspaceMain} from '@teambit/workspace/workspace.main.runtime'; import { InstallAspect } from '@teambit/install/install.aspect'; -import {InstallMain} from '@teambit/install/install.main.runtime'; import { LinterAspect } from '@teambit/linter/linter.aspect'; -import {LinterMain} from '@teambit/linter/linter.main.runtime'; import { FormatterAspect } from '@teambit/formatter/formatter.aspect'; -import {FormatterMain} from '@teambit/formatter/formatter.main.runtime'; import { ChangelogAspect } from '@teambit/changelog/changelog.aspect'; import { CodeAspect } from '@teambit/code/code.aspect'; import { CommandBarAspect } from '@teambit/command-bar/command-bar.aspect'; import { SidebarAspect } from '@teambit/sidebar/sidebar.aspect'; import { ComponentTreeAspect } from '@teambit/component-tree/component-tree.aspect'; import { DevFilesAspect } from '@teambit/dev-files/dev-files.aspect'; -import {DevFilesMain} from '@teambit/dev-files/dev-files.main.runtime'; import { ESLintAspect } from '@teambit/eslint/eslint.aspect'; -import {ESLintMain} from '@teambit/eslint/eslint.main.runtime'; import { PrettierAspect } from '@teambit/prettier/prettier.aspect'; -import {PrettierMain} from '@teambit/prettier/prettier.main.runtime'; import { SignAspect } from '@teambit/sign/sign.aspect'; -import {SignMain} from '@teambit/sign/sign.main.runtime'; import { WorkerAspect } from '@teambit/worker/worker.aspect'; -import {WorkerMain} from '@teambit/worker/worker.main.runtime'; import { GlobalConfigAspect } from '@teambit/global-config/global-config.aspect'; -import {GlobalConfigMain} from '@teambit/global-config/global-config.main.runtime'; import { MultiCompilerAspect } from '@teambit/multi-compiler/multi-compiler.aspect'; -import {MultiCompilerMain} from '@teambit/multi-compiler/multi-compiler.main.runtime'; import { MDXAspect } from '@teambit/mdx/mdx.aspect'; -import {MDXMain} from '@teambit/mdx/mdx.main.runtime'; import { ReadmeAspect } from '@teambit/readme/readme.aspect'; -import {ReadmeMain} from '@teambit/readme/readme.main.runtime'; import { ApplicationAspect } from '@teambit/application/application.aspect'; -import {ApplicationMain} from '@teambit/application/application.main.runtime'; import { UpdateDependenciesAspect } from '@teambit/update-dependencies/update-dependencies.aspect'; -import {UpdateDependenciesMain} from '@teambit/update-dependencies/update-dependencies.main.runtime'; import { ExportAspect } from '@teambit/export/export.aspect'; -import {ExportMain} from '@teambit/export/export.main.runtime'; import { ImporterAspect } from '@teambit/importer/importer.aspect'; -import {ImporterMain} from '@teambit/importer/importer.main.runtime'; import { EjectAspect } from '@teambit/eject/eject.aspect'; -import {EjectMain} from '@teambit/eject/eject.main.runtime'; import { UserAgentAspect } from '@teambit/user-agent/user-agent.aspect'; import { HtmlAspect } from '@teambit/html/html.aspect'; -import {HtmlMain} from '@teambit/html/html.main.runtime'; import { LanesAspect } from '@teambit/lanes/lanes.aspect'; -import {LanesMain} from '@teambit/lanes/lanes.main.runtime'; import { ForkingAspect } from '@teambit/forking/forking.aspect'; -import {ForkingMain} from '@teambit/forking/forking.main.runtime'; import { RenamingAspect } from '@teambit/renaming/renaming.aspect'; -import {RenamingMain} from '@teambit/renaming/renaming.main.runtime'; import { ComponentLogAspect } from '@teambit/component-log/component-log.aspect'; -import {ComponentLogMain} from '@teambit/component-log/component-log.main.runtime'; import { ClearCacheAspect } from '@teambit/clear-cache/clear-cache.aspect'; -import {ClearCacheMain} from '@teambit/clear-cache/clear-cache.main.runtime'; import { DiagnosticAspect } from '@teambit/diagnostic/diagnostic.aspect'; -import {DiagnosticMain} from '@teambit/diagnostic/diagnostic.main.runtime'; import { NewComponentHelperAspect } from '@teambit/new-component-helper/new-component-helper.aspect'; -import {NewComponentHelperMain} from '@teambit/new-component-helper/new-component-helper.main.runtime'; import { MochaAspect } from '@teambit/mocha/mocha.aspect'; -import {MochaMain} from '@teambit/mocha/mocha.main.runtime'; import { BitCustomAspectAspect } from '@teambit/bit-custom-aspect/bit-custom-aspect.aspect'; -import {BitCustomAspectMain} from '@teambit/bit-custom-aspect/bit-custom-aspect.main.runtime'; import { CommunityAspect } from '@teambit/community/community.aspect'; -import {CommunityMain} from '@teambit/community/community.main.runtime'; import { CloudAspect } from '@teambit/cloud/cloud.aspect'; -import {CloudMain} from '@teambit/cloud/cloud.main.runtime'; import { StatusAspect } from '@teambit/status/status.aspect'; -import {StatusMain} from '@teambit/status/status.main.runtime'; import { SnappingAspect } from '@teambit/snapping/snapping.aspect'; -import {SnappingMain} from '@teambit/snapping/snapping.main.runtime'; import { MergingAspect } from '@teambit/merging/merging.aspect'; -import {MergingMain} from '@teambit/merging/merging.main.runtime'; import { IssuesAspect } from '@teambit/issues/issues.aspect'; -import {IssuesMain} from '@teambit/issues/issues.main.runtime'; import { RefactoringAspect } from '@teambit/refactoring/refactoring.aspect'; -import {RefactoringMain} from '@teambit/refactoring/refactoring.main.runtime'; import { ComponentCompareAspect } from '@teambit/component-compare/component-compare.aspect'; -import {ComponentCompareMain} from '@teambit/component-compare/component-compare.main.runtime'; import { ListerAspect } from '@teambit/lister/lister.aspect'; -import {ListerMain} from '@teambit/lister/lister.main.runtime'; import { DependenciesAspect } from '@teambit/dependencies/dependencies.aspect'; -import {DependenciesMain} from '@teambit/dependencies/dependencies.main.runtime'; import { RemoveAspect } from '@teambit/remove/remove.aspect'; -import {RemoveMain} from '@teambit/remove/remove.main.runtime'; import { MergeLanesAspect } from '@teambit/merge-lanes/merge-lanes.aspect'; -import {MergeLanesMain} from '@teambit/merge-lanes/merge-lanes.main.runtime'; import { CheckoutAspect } from '@teambit/checkout/checkout.aspect'; -import {CheckoutMain} from '@teambit/checkout/checkout.main.runtime'; import { APIReferenceAspect } from '@teambit/api-reference/api-reference.aspect'; + +import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; +import { AspectLoaderMain } from '@teambit/aspect-loader/aspect-loader.main.runtime'; +import { BuilderMain } from '@teambit/builder/builder.main.runtime'; +import { BundlerMain } from '@teambit/bundler/bundler.main.runtime'; +import { CacheMain } from '@teambit/cache/cache.main.runtime'; +import { CLIMain } from '@teambit/cli/cli.main.runtime'; +import { CompilerMain } from '@teambit/compiler/compiler.main.runtime'; +import { ComponentMain } from '@teambit/component/component.main.runtime'; +import { CompositionsMain } from '@teambit/compositions/compositions.main.runtime'; +import { ConfigMain } from '@teambit/config/config.main.runtime'; +import { DependencyResolverMain } from '@teambit/dependency-resolver/dependency-resolver.main.runtime'; +import { DeprecationMain } from '@teambit/deprecation/deprecation.main.runtime'; +import { DocsMain } from '@teambit/docs/docs.main.runtime'; +import { EnvsMain } from '@teambit/envs/environments.main.runtime'; +import { EnvMain } from '@teambit/env/env.main.runtime'; +import { ExpressMain } from '@teambit/express/express.main.runtime'; +import { YarnMain } from '@teambit/yarn/yarn.main.runtime'; +import { GeneratorMain } from '@teambit/generator/generator.main.runtime'; +import { HarmonyUiAppMain } from '@teambit/harmony-ui-app/harmony-ui-app.main.runtime'; +import { GraphMain } from '@teambit/graph/graph.main.runtime'; +import { GraphqlMain } from '@teambit/graphql/graphql.main.runtime'; +import { InsightsMain } from '@teambit/insights/insights.main.runtime'; +import { IsolatorMain } from '@teambit/isolator/isolator.main.runtime'; +import { JestMain } from '@teambit/jest/jest.main.runtime'; +import { LoggerMain } from '@teambit/logger/logger.main.runtime'; +import { NodeMain } from '@teambit/node/node.main.runtime'; +import { PanelUIMain } from '@teambit/panels/panel-ui.main.runtime'; +import { PkgMain } from '@teambit/pkg/pkg.main.runtime'; +import { PnpmMain } from '@teambit/pnpm/pnpm.main.runtime'; +import { PreviewMain } from '@teambit/preview/preview.main.runtime'; +import { ComponentSizerMain } from '@teambit/component-sizer/component-sizer.main.runtime'; +import { ReactMain } from '@teambit/react/react.main.runtime'; +import { ReactNativeMain } from '@teambit/react-native/react-native.main.runtime'; +import { ReactElementsMain } from '@teambit/react-elements/react-elements.main.runtime'; +import { ElementsMain } from '@teambit/elements/elements.main.runtime'; +import { SchemaMain } from '@teambit/schema/schema.main.runtime'; +import { PubsubMain } from '@teambit/pubsub/pubsub.main.runtime'; +import { ScopeMain } from '@teambit/scope/scope.main.runtime'; +// {impor}{ StencMain } from '@teambit/stencil/stencil.main.runtime'; +import { TesterMain } from '@teambit/tester/tester.main.runtime'; +import { MultiTesterMain } from '@teambit/multi-tester/multi-tester.main.runtime'; +import { TypescriptMain } from '@teambit/typescript/typescript.main.runtime'; +import { BabelMain } from '@teambit/babel/babel.main.runtime'; +import { UiMain } from '@teambit/ui/ui.main.runtime'; +import { VariantsMain } from '@teambit/variants/variants.main.runtime'; +import { WebpackMain } from '@teambit/webpack/webpack.main.runtime'; +import { WorkspaceMain } from '@teambit/workspace/workspace.main.runtime'; +import { InstallMain } from '@teambit/install/install.main.runtime'; +import { LinterMain } from '@teambit/linter/linter.main.runtime'; +import { FormatterMain } from '@teambit/formatter/formatter.main.runtime'; +import { DevFilesMain } from '@teambit/dev-files/dev-files.main.runtime'; +import { ESLintMain } from '@teambit/eslint/eslint.main.runtime'; +import { PrettierMain } from '@teambit/prettier/prettier.main.runtime'; +import { SignMain } from '@teambit/sign/sign.main.runtime'; +import { WorkerMain } from '@teambit/worker/worker.main.runtime'; +import { GlobalConfigMain } from '@teambit/global-config/global-config.main.runtime'; +import { MultiCompilerMain } from '@teambit/multi-compiler/multi-compiler.main.runtime'; +import { MDXMain } from '@teambit/mdx/mdx.main.runtime'; +import { ReadmeMain } from '@teambit/readme/readme.main.runtime'; +import { ApplicationMain } from '@teambit/application/application.main.runtime'; +import { UpdateDependenciesMain } from '@teambit/update-dependencies/update-dependencies.main.runtime'; +import { ExportMain } from '@teambit/export/export.main.runtime'; +import { ImporterMain } from '@teambit/importer/importer.main.runtime'; +import { EjectMain } from '@teambit/eject/eject.main.runtime'; +import { HtmlMain } from '@teambit/html/html.main.runtime'; +import { LanesMain } from '@teambit/lanes/lanes.main.runtime'; +import { ForkingMain } from '@teambit/forking/forking.main.runtime'; +import { RenamingMain } from '@teambit/renaming/renaming.main.runtime'; +import { ComponentLogMain } from '@teambit/component-log/component-log.main.runtime'; +import { ClearCacheMain } from '@teambit/clear-cache/clear-cache.main.runtime'; +import { DiagnosticMain } from '@teambit/diagnostic/diagnostic.main.runtime'; +import { NewComponentHelperMain } from '@teambit/new-component-helper/new-component-helper.main.runtime'; +import { MochaMain } from '@teambit/mocha/mocha.main.runtime'; +import { BitCustomAspectMain } from '@teambit/bit-custom-aspect/bit-custom-aspect.main.runtime'; +import { CommunityMain } from '@teambit/community/community.main.runtime'; +import { CloudMain } from '@teambit/cloud/cloud.main.runtime'; +import { StatusMain } from '@teambit/status/status.main.runtime'; +import { SnappingMain } from '@teambit/snapping/snapping.main.runtime'; +import { MergingMain } from '@teambit/merging/merging.main.runtime'; +import { IssuesMain } from '@teambit/issues/issues.main.runtime'; +import { RefactoringMain } from '@teambit/refactoring/refactoring.main.runtime'; +import { ComponentCompareMain } from '@teambit/component-compare/component-compare.main.runtime'; +import { ListerMain } from '@teambit/lister/lister.main.runtime'; +import { DependenciesMain } from '@teambit/dependencies/dependencies.main.runtime'; +import { RemoveMain } from '@teambit/remove/remove.main.runtime'; +import { MergeLanesMain } from '@teambit/merge-lanes/merge-lanes.main.runtime'; +import { CheckoutMain } from '@teambit/checkout/checkout.main.runtime'; + +import { BitMain } from './bit.main.runtime'; import { BitAspect } from './bit.aspect'; -import {BitMain} from './bit.main.runtime'; export const manifestsMap = { [AspectLoaderAspect.id]: AspectLoaderAspect, @@ -370,9 +372,9 @@ export const runtimesMap = { [MergeLanesAspect.id]: MergeLanesMain, [CheckoutAspect.id]: CheckoutMain, [BitAspect.id]: BitMain, -} +}; -console.log(runtimesMap) +console.log(runtimesMap); export function isCoreAspect(id: string) { const _reserved = [BitAspect.id, ConfigAspect.id]; From 9589d7c3cd480e13c98cdcdb30a2d47dbf3cd1b5 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 26 Mar 2023 12:41:23 +0300 Subject: [PATCH 09/89] add esbuild plugins to policy --- workspace.jsonc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workspace.jsonc b/workspace.jsonc index c5e17bb048e5..d9ed1353577e 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -222,6 +222,8 @@ "dagre": "0.8.5", "didyoumean": "1.2.1", "enquirer": "2.3.6", + "esbuild": "^0.17.12", + "esbuild-plugin-ignore": "^1.1.1", "eslint-config-airbnb-typescript": { "version": "5.1.0", "preserve": true From 2484fe67522d9dd47a84f9f4781c34075675446f Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 26 Mar 2023 12:41:34 +0300 Subject: [PATCH 10/89] adjust bundle script --- scopes/harmony/bit/bundle.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts index 677ca6083f60..cc0c2750af43 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle.ts @@ -12,7 +12,7 @@ function bundle() { // 'process.env.JSON_LOGS': 'true', 'process.env.BIT_LOG': `'debug'`, // 'import_meta_url': 'import_meta_url', - 'import_meta.url': 'import_meta_url', + // 'import_meta.url': 'import_meta_url', }, entryPoints: ['/Users/giladshoham/dev/bit/bit/scopes/harmony/bit/app.ts'], // entryPoints: ['/Users/giladshoham/dev/bit/bit/node_modules/@teambit/bit/dist/app.js'], @@ -25,9 +25,11 @@ function bundle() { format: 'cjs', keepNames: true, outfile: _outfile, - inject: [join(__dirname, './import-meta-url.js')], + // inject: [join(__dirname, './import-meta-url.js')], external: [ + 'yoga-layout-prebuilt', + '@surma/rollup-plugin-off-main-thread', '@babel/preset-react', 'ink', 'style-loader', From 0009c691dbf0951fbefdb9fdc7f405d721d97c22 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 16 Jul 2023 19:24:16 +0300 Subject: [PATCH 11/89] fixes --- scopes/harmony/bit/bundle.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts index cc0c2750af43..5551a05254ed 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle.ts @@ -32,6 +32,7 @@ function bundle() { '@surma/rollup-plugin-off-main-thread', '@babel/preset-react', 'ink', + 'canvas', 'style-loader', 'mini-css-extract-plugin', '@pmmmwh/react-refresh-webpack-plugin', From e34dc547b6e34e06147033e0ca73b6a2d0e63347 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 20 Jul 2023 13:52:05 +0300 Subject: [PATCH 12/89] manifests fixes --- scopes/harmony/bit/manifests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index 8127d2bfe285..6f7228f9c0c0 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -102,7 +102,7 @@ import { MoverAspect } from '@teambit/mover/mover.aspect'; import { WatcherAspect } from '@teambit/watcher/watcher.aspect'; import { StashAspect } from '@teambit/stash/stash.aspect'; import { GitAspect } from '@teambit/git/git.aspect'; -import { IpcEventsAspect } from '@teambit/ipc-events.aspect'; +import { IpcEventsAspect } from '@teambit/ipc-events/ipc-events.aspect'; import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; import { AspectLoaderMain } from '@teambit/aspect-loader/aspect-loader.main.runtime'; @@ -198,7 +198,7 @@ import { WatcherMain } from '@teambit/watcher/watcher.main.runtime'; import { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files/workspace-config-files.main.runtime'; import { StashMain } from '@teambit/stash/stash.main.runtime'; import { GitMain } from '@teambit/git/git.main.runtime'; -import { IpcEventsMain } from '@teambit/ipc-events.main.runtime'; +import { IpcEventsMain } from '@teambit/ipc-events/ipc-events.main.runtime'; import { BitMain } from './bit.main.runtime'; import { BitAspect } from './bit.aspect'; From 6dd25051b5a2bb483b136e8e4231d5ecf279acda Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 20 Jul 2023 14:06:29 +0300 Subject: [PATCH 13/89] move jest config inside instead of top --- scopes/react/react-native/react-native.main.runtime.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scopes/react/react-native/react-native.main.runtime.ts b/scopes/react/react-native/react-native.main.runtime.ts index cc74d6341885..14b76e3af747 100644 --- a/scopes/react/react-native/react-native.main.runtime.ts +++ b/scopes/react/react-native/react-native.main.runtime.ts @@ -15,8 +15,6 @@ import { componentTemplates, workspaceTemplates } from './react-native.templates import { previewConfigTransformer, devServerConfigTransformer } from './webpack/webpack-transformers'; import { ReactNativeEnv } from './react-native.env'; -const jestConfig = require.resolve('./jest/jest.config'); - export class ReactNativeMain { constructor( private react: ReactMain, @@ -113,6 +111,8 @@ export class ReactNativeMain { static dependencies: Aspect[] = [ReactAspect, EnvsAspect, GeneratorAspect, AspectAspect]; static runtime = MainRuntime; static async provider([react, envs, generator, aspect]: [ReactMain, EnvsMain, GeneratorMain, AspectMain]) { + const jestConfig = require.resolve('./jest/jest.config'); + const webpackModifiers: UseWebpackModifiers = { previewConfig: [previewConfigTransformer], devServerConfig: [devServerConfigTransformer], From 1dbdd6ddaebd8ef283aee76f522dde6624100518 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 20 Jul 2023 15:17:22 +0300 Subject: [PATCH 14/89] expose manifests map as a function (to support the bundling hoisting correctly) --- scopes/harmony/bit/bit.main.runtime.ts | 10 +- scopes/harmony/bit/bit.provider.ts | 4 +- scopes/harmony/bit/load-bit.ts | 10 +- scopes/harmony/bit/manifests.ts | 247 +++++++++++++------------ 4 files changed, 142 insertions(+), 129 deletions(-) diff --git a/scopes/harmony/bit/bit.main.runtime.ts b/scopes/harmony/bit/bit.main.runtime.ts index 6ecf63289623..0410ac6474d6 100644 --- a/scopes/harmony/bit/bit.main.runtime.ts +++ b/scopes/harmony/bit/bit.main.runtime.ts @@ -3,19 +3,23 @@ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extensio import { BitAspect } from './bit.aspect'; import { provideBit } from './bit.provider'; -import { manifestsMap } from './manifests'; +import { getManifestsMap } from './manifests'; -const manifests = Object.values(manifestsMap); +const manifestsMap = getManifestsMap(); export function registerCoreExtensions() { const allCoreExtensionsNames = Object.keys(manifestsMap); ExtensionDataList.registerManyCoreExtensionNames(allCoreExtensionsNames); } +function getDeps() { + return Object.values(manifestsMap); +} + export const BitMain = { name: 'bit', runtime: MainRuntime, - dependencies: manifests, + dependencies: getDeps(), provider: provideBit, }; diff --git a/scopes/harmony/bit/bit.provider.ts b/scopes/harmony/bit/bit.provider.ts index f321779232e0..8e0e3a675bd2 100644 --- a/scopes/harmony/bit/bit.provider.ts +++ b/scopes/harmony/bit/bit.provider.ts @@ -1,4 +1,4 @@ -import { manifestsMap } from './manifests'; +import { getManifestsMap } from './manifests'; export type BitDeps = []; @@ -16,6 +16,6 @@ export type BitConfig = { export async function provideBit() { return { - manifestsMap, + manifestsMap: getManifestsMap(), }; } diff --git a/scopes/harmony/bit/load-bit.ts b/scopes/harmony/bit/load-bit.ts index 8744e76fb43f..7fa1166b115b 100644 --- a/scopes/harmony/bit/load-bit.ts +++ b/scopes/harmony/bit/load-bit.ts @@ -50,11 +50,13 @@ import { ExternalActions } from '@teambit/legacy/dist/api/scope/lib/action'; import loader from '@teambit/legacy/dist/cli/loader'; import { readdir } from 'fs-extra'; import { resolve } from 'path'; -import { manifestsMap } from './manifests'; +import { getManifestsMap } from './manifests'; import { BitAspect } from './bit.aspect'; import { registerCoreExtensions } from './bit.main.runtime'; import { BitConfig } from './bit.provider'; +const manifestsMap = getManifestsMap(); + async function loadLegacyConfig(config: any) { const harmony = await Harmony.load([ConfigAspect], ConfigRuntime.name, config.toObject()); await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); @@ -214,6 +216,8 @@ function shouldRunAsDaemon() { } export async function loadBit(path = process.cwd()) { + console.log('🚀 ~ file: load-bit.ts:218 ~ loadBit ~ path:', path); + clearGlobalsIfNeeded(); logger.info(`*** Loading Bit *** argv:\n${process.argv.join('\n')}`); const config = await getConfig(path); @@ -233,9 +237,11 @@ export async function loadBit(path = process.cwd()) { if (shouldRunAsDaemon()) { logger.isDaemon = true; } - // console.log('aspectsToLoad', aspectsToLoad) + console.log('aspectsToLoad'); const harmony = await Harmony.load(aspectsToLoad, MainRuntime.name, configMap); + console.log('after load', aspectsToLoad); + // await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); await harmony.run(); if (loadCLIOnly) return harmony; diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index 6f7228f9c0c0..9426dfc0df6f 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -104,7 +104,7 @@ import { StashAspect } from '@teambit/stash/stash.aspect'; import { GitAspect } from '@teambit/git/git.aspect'; import { IpcEventsAspect } from '@teambit/ipc-events/ipc-events.aspect'; -import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; +// import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; import { AspectLoaderMain } from '@teambit/aspect-loader/aspect-loader.main.runtime'; import { BuilderMain } from '@teambit/builder/builder.main.runtime'; import { BundlerMain } from '@teambit/bundler/bundler.main.runtime'; @@ -127,16 +127,16 @@ import { GraphMain } from '@teambit/graph/graph.main.runtime'; import { GraphqlMain } from '@teambit/graphql/graphql.main.runtime'; import { InsightsMain } from '@teambit/insights/insights.main.runtime'; import { IsolatorMain } from '@teambit/isolator/isolator.main.runtime'; -import { JestMain } from '@teambit/jest/jest.main.runtime'; +// import { JestMain } from '@teambit/jest/jest.main.runtime'; import { LoggerMain } from '@teambit/logger/logger.main.runtime'; -import { NodeMain } from '@teambit/node/node.main.runtime'; +// import { NodeMain } from '@teambit/node/node.main.runtime'; import { PanelUIMain } from '@teambit/panels/panel-ui.main.runtime'; import { PkgMain } from '@teambit/pkg/pkg.main.runtime'; import { PnpmMain } from '@teambit/pnpm/pnpm.main.runtime'; -import { PreviewMain } from '@teambit/preview/preview.main.runtime'; +// import { PreviewMain } from '@teambit/preview/preview.main.runtime'; import { ComponentSizerMain } from '@teambit/component-sizer/component-sizer.main.runtime'; -import { ReactMain } from '@teambit/react/react.main.runtime'; -import { ReactNativeMain } from '@teambit/react-native/react-native.main.runtime'; +// import { ReactMain } from '@teambit/react/react.main.runtime'; +// import { ReactNativeMain } from '@teambit/react-native/react-native.main.runtime'; import { ReactElementsMain } from '@teambit/react-elements/react-elements.main.runtime'; import { ElementsMain } from '@teambit/elements/elements.main.runtime'; import { SchemaMain } from '@teambit/schema/schema.main.runtime'; @@ -168,7 +168,7 @@ import { UpdateDependenciesMain } from '@teambit/update-dependencies/update-depe import { ExportMain } from '@teambit/export/export.main.runtime'; import { ImporterMain } from '@teambit/importer/importer.main.runtime'; import { EjectMain } from '@teambit/eject/eject.main.runtime'; -import { HtmlMain } from '@teambit/html/html.main.runtime'; +// import { HtmlMain } from '@teambit/html/html.main.runtime'; import { LanesMain } from '@teambit/lanes/lanes.main.runtime'; import { ForkingMain } from '@teambit/forking/forking.main.runtime'; import { RenamingMain } from '@teambit/renaming/renaming.main.runtime'; @@ -203,115 +203,118 @@ import { IpcEventsMain } from '@teambit/ipc-events/ipc-events.main.runtime'; import { BitMain } from './bit.main.runtime'; import { BitAspect } from './bit.aspect'; -export const manifestsMap = { - [AspectLoaderAspect.id]: AspectLoaderAspect, - [CLIAspect.id]: CLIAspect, - [DevFilesAspect.id]: DevFilesAspect, - [WorkspaceAspect.id]: WorkspaceAspect, - [WorkspaceConfigFilesAspect.id]: WorkspaceConfigFilesAspect, - [InstallAspect.id]: InstallAspect, - [ESLintAspect.id]: ESLintAspect, - [PrettierAspect.id]: PrettierAspect, - [CompilerAspect.id]: CompilerAspect, - [LinterAspect.id]: LinterAspect, - [FormatterAspect.id]: FormatterAspect, - [ComponentAspect.id]: ComponentAspect, - [MDXAspect.id]: MDXAspect, - [ReadmeAspect.id]: ReadmeAspect, - [PreviewAspect.id]: PreviewAspect, - [ComponentSizerAspect.id]: ComponentSizerAspect, - [DocsAspect.id]: DocsAspect, - [YarnAspect.id]: YarnAspect, - [CompositionsAspect.id]: CompositionsAspect, - [GlobalConfigAspect.id]: GlobalConfigAspect, - [GraphqlAspect.id]: GraphqlAspect, - [PnpmAspect.id]: PnpmAspect, - [MultiCompilerAspect.id]: MultiCompilerAspect, - [UIAspect.id]: UIAspect, - [GeneratorAspect.id]: GeneratorAspect, - [EnvsAspect.id]: EnvsAspect, - [EnvAspect.id]: EnvAspect, - [GraphAspect.id]: GraphAspect, - [PubsubAspect.id]: PubsubAspect, - [DependencyResolverAspect.id]: DependencyResolverAspect, - [InsightsAspect.id]: InsightsAspect, - [IsolatorAspect.id]: IsolatorAspect, - [LoggerAspect.id]: LoggerAspect, - [PkgAspect.id]: PkgAspect, - [ReactAspect.id]: ReactAspect, - [ReactNativeAspect.id]: ReactNativeAspect, - [ReactElementsAspect.id]: ReactElementsAspect, - [ElementsAspect.id]: ElementsAspect, - [WorkerAspect.id]: WorkerAspect, - // [StencilAspect.id]: StencilAspect, - [ScopeAspect.id]: ScopeAspect, - [TesterAspect.id]: TesterAspect, - [MultiTesterAspect.id]: MultiTesterAspect, - [BuilderAspect.id]: BuilderAspect, - [VariantsAspect.id]: VariantsAspect, - [DeprecationAspect.id]: DeprecationAspect, - [ExpressAspect.id]: ExpressAspect, - [AspectAspect.id]: AspectAspect, - [WebpackAspect.id]: WebpackAspect, - [SchemaAspect.id]: SchemaAspect, - [ReactRouterAspect.id]: ReactRouterAspect, - [TypescriptAspect.id]: TypescriptAspect, - [PanelUiAspect.id]: PanelUiAspect, - [BabelAspect.id]: BabelAspect, - [NodeAspect.id]: NodeAspect, - [NotificationsAspect.id]: NotificationsAspect, - [BundlerAspect.id]: BundlerAspect, - [JestAspect.id]: JestAspect, - [CacheAspect.id]: CacheAspect, - [ChangelogAspect.id]: ChangelogAspect, - [CodeAspect.id]: CodeAspect, - [CommandBarAspect.id]: CommandBarAspect, - [SidebarAspect.id]: SidebarAspect, - [ComponentTreeAspect.id]: ComponentTreeAspect, - [SignAspect.id]: SignAspect, - [UpdateDependenciesAspect.id]: UpdateDependenciesAspect, - [ExportAspect.id]: ExportAspect, - [ImporterAspect.id]: ImporterAspect, - [HarmonyUiAppAspect.id]: HarmonyUiAppAspect, - [UserAgentAspect.id]: UserAgentAspect, - [ApplicationAspect.id]: ApplicationAspect, - [EjectAspect.id]: EjectAspect, - [HtmlAspect.id]: HtmlAspect, - [LanesAspect.id]: LanesAspect, - [ForkingAspect.id]: ForkingAspect, - [RenamingAspect.id]: RenamingAspect, - [NewComponentHelperAspect.id]: NewComponentHelperAspect, - [ComponentLogAspect.id]: ComponentLogAspect, - [ClearCacheAspect.id]: ClearCacheAspect, - [MochaAspect.id]: MochaAspect, - [BitCustomAspectAspect.id]: BitCustomAspectAspect, - [DiagnosticAspect.id]: DiagnosticAspect, - [StatusAspect.id]: StatusAspect, - [CommunityAspect.id]: CommunityAspect, - [CloudAspect.id]: CloudAspect, - [SnappingAspect.id]: SnappingAspect, - [MergingAspect.id]: MergingAspect, - [IssuesAspect.id]: IssuesAspect, - [RefactoringAspect.id]: RefactoringAspect, - [ComponentCompareAspect.id]: ComponentCompareAspect, - [ListerAspect.id]: ListerAspect, - [DependenciesAspect.id]: DependenciesAspect, - [RemoveAspect.id]: RemoveAspect, - [MergeLanesAspect.id]: MergeLanesAspect, - [CheckoutAspect.id]: CheckoutAspect, - [ComponentWriterAspect.id]: ComponentWriterAspect, - [APIReferenceAspect.id]: APIReferenceAspect, - [ApiServerAspect.id]: ApiServerAspect, - [TrackerAspect.id]: TrackerAspect, - [MoverAspect.id]: MoverAspect, - [WatcherAspect.id]: WatcherAspect, - [StashAspect.id]: StashAspect, - [GitAspect.id]: GitAspect, - [IpcEventsAspect.id]: IpcEventsAspect, -}; +export function getManifestsMap() { + const manifestsMap = { + [AspectLoaderAspect.id]: AspectLoaderAspect, + [CLIAspect.id]: CLIAspect, + [DevFilesAspect.id]: DevFilesAspect, + [WorkspaceAspect.id]: WorkspaceAspect, + [WorkspaceConfigFilesAspect.id]: WorkspaceConfigFilesAspect, + [InstallAspect.id]: InstallAspect, + [ESLintAspect.id]: ESLintAspect, + [PrettierAspect.id]: PrettierAspect, + [CompilerAspect.id]: CompilerAspect, + [LinterAspect.id]: LinterAspect, + [FormatterAspect.id]: FormatterAspect, + [ComponentAspect.id]: ComponentAspect, + [MDXAspect.id]: MDXAspect, + [ReadmeAspect.id]: ReadmeAspect, + [PreviewAspect.id]: PreviewAspect, + [ComponentSizerAspect.id]: ComponentSizerAspect, + [DocsAspect.id]: DocsAspect, + [YarnAspect.id]: YarnAspect, + [CompositionsAspect.id]: CompositionsAspect, + [GlobalConfigAspect.id]: GlobalConfigAspect, + [GraphqlAspect.id]: GraphqlAspect, + [PnpmAspect.id]: PnpmAspect, + [MultiCompilerAspect.id]: MultiCompilerAspect, + [UIAspect.id]: UIAspect, + [GeneratorAspect.id]: GeneratorAspect, + [EnvsAspect.id]: EnvsAspect, + [EnvAspect.id]: EnvAspect, + [GraphAspect.id]: GraphAspect, + [PubsubAspect.id]: PubsubAspect, + [DependencyResolverAspect.id]: DependencyResolverAspect, + [InsightsAspect.id]: InsightsAspect, + [IsolatorAspect.id]: IsolatorAspect, + [LoggerAspect.id]: LoggerAspect, + [PkgAspect.id]: PkgAspect, + [ReactAspect.id]: ReactAspect, + [ReactNativeAspect.id]: ReactNativeAspect, + [ReactElementsAspect.id]: ReactElementsAspect, + [ElementsAspect.id]: ElementsAspect, + [WorkerAspect.id]: WorkerAspect, + // [StencilAspect.id]: StencilAspect, + [ScopeAspect.id]: ScopeAspect, + [TesterAspect.id]: TesterAspect, + [MultiTesterAspect.id]: MultiTesterAspect, + [BuilderAspect.id]: BuilderAspect, + [VariantsAspect.id]: VariantsAspect, + [DeprecationAspect.id]: DeprecationAspect, + [ExpressAspect.id]: ExpressAspect, + [AspectAspect.id]: AspectAspect, + [WebpackAspect.id]: WebpackAspect, + [SchemaAspect.id]: SchemaAspect, + [ReactRouterAspect.id]: ReactRouterAspect, + [TypescriptAspect.id]: TypescriptAspect, + [PanelUiAspect.id]: PanelUiAspect, + [BabelAspect.id]: BabelAspect, + [NodeAspect.id]: NodeAspect, + [NotificationsAspect.id]: NotificationsAspect, + [BundlerAspect.id]: BundlerAspect, + [JestAspect.id]: JestAspect, + [CacheAspect.id]: CacheAspect, + [ChangelogAspect.id]: ChangelogAspect, + [CodeAspect.id]: CodeAspect, + [CommandBarAspect.id]: CommandBarAspect, + [SidebarAspect.id]: SidebarAspect, + [ComponentTreeAspect.id]: ComponentTreeAspect, + [SignAspect.id]: SignAspect, + [UpdateDependenciesAspect.id]: UpdateDependenciesAspect, + [ExportAspect.id]: ExportAspect, + [ImporterAspect.id]: ImporterAspect, + [HarmonyUiAppAspect.id]: HarmonyUiAppAspect, + [UserAgentAspect.id]: UserAgentAspect, + [ApplicationAspect.id]: ApplicationAspect, + [EjectAspect.id]: EjectAspect, + [HtmlAspect.id]: HtmlAspect, + [LanesAspect.id]: LanesAspect, + [ForkingAspect.id]: ForkingAspect, + [RenamingAspect.id]: RenamingAspect, + [NewComponentHelperAspect.id]: NewComponentHelperAspect, + [ComponentLogAspect.id]: ComponentLogAspect, + [ClearCacheAspect.id]: ClearCacheAspect, + [MochaAspect.id]: MochaAspect, + [BitCustomAspectAspect.id]: BitCustomAspectAspect, + [DiagnosticAspect.id]: DiagnosticAspect, + [StatusAspect.id]: StatusAspect, + [CommunityAspect.id]: CommunityAspect, + [CloudAspect.id]: CloudAspect, + [SnappingAspect.id]: SnappingAspect, + [MergingAspect.id]: MergingAspect, + [IssuesAspect.id]: IssuesAspect, + [RefactoringAspect.id]: RefactoringAspect, + [ComponentCompareAspect.id]: ComponentCompareAspect, + [ListerAspect.id]: ListerAspect, + [DependenciesAspect.id]: DependenciesAspect, + [RemoveAspect.id]: RemoveAspect, + [MergeLanesAspect.id]: MergeLanesAspect, + [CheckoutAspect.id]: CheckoutAspect, + [ComponentWriterAspect.id]: ComponentWriterAspect, + [APIReferenceAspect.id]: APIReferenceAspect, + [ApiServerAspect.id]: ApiServerAspect, + [TrackerAspect.id]: TrackerAspect, + [MoverAspect.id]: MoverAspect, + [WatcherAspect.id]: WatcherAspect, + [StashAspect.id]: StashAspect, + [GitAspect.id]: GitAspect, + [IpcEventsAspect.id]: IpcEventsAspect, + }; + return manifestsMap; +} export const runtimesMap = { - [AspectAspect.id]: AspectMain, + // [AspectAspect.id]: AspectMain, [AspectLoaderAspect.id]: AspectLoaderMain, [BuilderAspect.id]: BuilderMain, [BundlerAspect.id]: BundlerMain, @@ -334,16 +337,16 @@ export const runtimesMap = { [GraphqlAspect.id]: GraphqlMain, [InsightsAspect.id]: InsightsMain, [IsolatorAspect.id]: IsolatorMain, - [JestAspect.id]: JestMain, + // [JestAspect.id]: JestMain, [LoggerAspect.id]: LoggerMain, - [NodeAspect.id]: NodeMain, + // [NodeAspect.id]: NodeMain, [PanelUiAspect.id]: PanelUIMain, [PkgAspect.id]: PkgMain, [PnpmAspect.id]: PnpmMain, - [PreviewAspect.id]: PreviewMain, + // [PreviewAspect.id]: PreviewMain, [ComponentSizerAspect.id]: ComponentSizerMain, - [ReactAspect.id]: ReactMain, - [ReactNativeAspect.id]: ReactNativeMain, + // [ReactAspect.id]: ReactMain, + // [ReactNativeAspect.id]: ReactNativeMain, [ReactElementsAspect.id]: ReactElementsMain, [ElementsAspect.id]: ElementsMain, [SchemaAspect.id]: SchemaMain, @@ -374,7 +377,7 @@ export const runtimesMap = { [ExportAspect.id]: ExportMain, [ImporterAspect.id]: ImporterMain, [EjectAspect.id]: EjectMain, - [HtmlAspect.id]: HtmlMain, + // [HtmlAspect.id]: HtmlMain, [LanesAspect.id]: LanesMain, [ForkingAspect.id]: ForkingMain, [RenamingAspect.id]: RenamingMain, @@ -408,15 +411,15 @@ export const runtimesMap = { [BitAspect.id]: BitMain, }; -console.log(runtimesMap); - export function isCoreAspect(id: string) { + const manifestsMap = getManifestsMap(); const _reserved = [BitAspect.id, ConfigAspect.id]; if (_reserved.includes(id)) return true; return !!manifestsMap[id]; } export function getAllCoreAspectsIds(): string[] { + const manifestsMap = getManifestsMap(); const _reserved = [BitAspect.id, ConfigAspect.id]; return [...Object.keys(manifestsMap), ..._reserved]; } From 1b0549f23768ad221f9ae359e0d5ee45773c704e Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 20 Jul 2023 15:17:33 +0300 Subject: [PATCH 15/89] add more ignores --- scopes/harmony/bit/bundle.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle.ts index 5551a05254ed..728313af7fa4 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle.ts @@ -28,13 +28,17 @@ function bundle() { // inject: [join(__dirname, './import-meta-url.js')], external: [ + 'jest.worker', + 'yoga-layout', 'yoga-layout-prebuilt', '@surma/rollup-plugin-off-main-thread', '@babel/preset-react', 'ink', + 'rrweb-cssom', 'canvas', 'style-loader', 'mini-css-extract-plugin', + '@prerenderer/renderer-jsdom', '@pmmmwh/react-refresh-webpack-plugin', '@teambit/react.babel.bit-react-transformer', 'source-map-loader', From 5614efc45cb098f9e5e943a5670ae52945591e55 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 20 Jul 2023 17:17:04 +0300 Subject: [PATCH 16/89] fix config aspect instances --- scopes/harmony/bit/load-bit.ts | 14 ++++++-------- scopes/harmony/config/config.main.runtime.ts | 7 ++++++- scopes/harmony/config/index.ts | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/scopes/harmony/bit/load-bit.ts b/scopes/harmony/bit/load-bit.ts index 7fa1166b115b..5e422044fee6 100644 --- a/scopes/harmony/bit/load-bit.ts +++ b/scopes/harmony/bit/load-bit.ts @@ -25,7 +25,7 @@ import { } from '@teambit/aspect-loader'; import json from 'comment-json'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import { ConfigAspect, ConfigRuntime } from '@teambit/config'; +import { ConfigRuntime, getConfigAspect } from '@teambit/config'; import { Harmony, RuntimeDefinition, Extension } from '@teambit/harmony'; // TODO: expose this types from harmony (once we have a way to expose it only for node) import { Config, ConfigOptions } from '@teambit/harmony/dist/harmony-config'; @@ -58,8 +58,10 @@ import { BitConfig } from './bit.provider'; const manifestsMap = getManifestsMap(); async function loadLegacyConfig(config: any) { - const harmony = await Harmony.load([ConfigAspect], ConfigRuntime.name, config.toObject()); - await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); + const aspectsToLoad = [getConfigAspect()]; + const harmony = await Harmony.load(aspectsToLoad, ConfigRuntime.name, config.toObject()); + // await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); + await harmony.run(); } async function getConfig(cwd = process.cwd()) { @@ -216,8 +218,6 @@ function shouldRunAsDaemon() { } export async function loadBit(path = process.cwd()) { - console.log('🚀 ~ file: load-bit.ts:218 ~ loadBit ~ path:', path); - clearGlobalsIfNeeded(); logger.info(`*** Loading Bit *** argv:\n${process.argv.join('\n')}`); const config = await getConfig(path); @@ -237,13 +237,11 @@ export async function loadBit(path = process.cwd()) { if (shouldRunAsDaemon()) { logger.isDaemon = true; } - console.log('aspectsToLoad'); const harmony = await Harmony.load(aspectsToLoad, MainRuntime.name, configMap); - console.log('after load', aspectsToLoad); - // await harmony.run(async (aspect: Extension, runtime: RuntimeDefinition) => requireAspects(aspect, runtime)); await harmony.run(); + if (loadCLIOnly) return harmony; loader.start('loading aspects...'); const aspectLoader = harmony.get('teambit.harmony/aspect-loader'); diff --git a/scopes/harmony/config/config.main.runtime.ts b/scopes/harmony/config/config.main.runtime.ts index f01c1c5c23af..c1841ee006c1 100644 --- a/scopes/harmony/config/config.main.runtime.ts +++ b/scopes/harmony/config/config.main.runtime.ts @@ -88,6 +88,7 @@ export class ConfigMain { return config; } + // static runtime = ConfigRuntime; static runtime = MainRuntime; static slots = []; static dependencies = []; @@ -113,9 +114,13 @@ export class ConfigMain { return configMain; } } - ConfigAspect.addRuntime(ConfigMain); +// Required for esbuild to work properly +export function getConfigAspect() { + return ConfigAspect; +} + function onLegacyWorkspaceConfigIsExist(): WorkspaceConfigIsExistFunction { return async (dirPath: PathOsBased): Promise => { return WorkspaceConfig.isExist(dirPath); diff --git a/scopes/harmony/config/index.ts b/scopes/harmony/config/index.ts index c84d3ef21807..25c6360e8d9a 100644 --- a/scopes/harmony/config/index.ts +++ b/scopes/harmony/config/index.ts @@ -1,3 +1,3 @@ -export { ConfigMain } from './config.main.runtime'; +export { ConfigMain, getConfigAspect } from './config.main.runtime'; export { ConfigAspect, ConfigRuntime } from './config.aspect'; export { ComponentScopeDirMap, getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from './workspace-config'; From 2b6c8eaa6fb712a9e3e96ac25c38aa23854332b8 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 13:17:41 +0300 Subject: [PATCH 17/89] restructure bundle files and add readme --- scopes/harmony/bit/bundle/bundle.ts | 8 ++++++++ .../harmony/bit/{bundle.ts => bundle/esbuild.ts} | 6 ++---- scopes/harmony/bit/bundle/readme.md | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 scopes/harmony/bit/bundle/bundle.ts rename scopes/harmony/bit/{bundle.ts => bundle/esbuild.ts} (98%) create mode 100644 scopes/harmony/bit/bundle/readme.md diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts new file mode 100644 index 000000000000..984204e38d16 --- /dev/null +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -0,0 +1,8 @@ +import { runEsbuild } from './esbuild'; + +async function runBundle() { + const esbuildRes = await runEsbuild(); + return esbuildRes; +} + +runBundle().then((res) => console.log(JSON.stringify(res, null, 2))); diff --git a/scopes/harmony/bit/bundle.ts b/scopes/harmony/bit/bundle/esbuild.ts similarity index 98% rename from scopes/harmony/bit/bundle.ts rename to scopes/harmony/bit/bundle/esbuild.ts index 728313af7fa4..b1875e5b73a0 100644 --- a/scopes/harmony/bit/bundle.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -2,7 +2,7 @@ import { build } from 'esbuild'; import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; -function bundle() { +export function runEsbuild() { const appFile = `bit.app`; // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); const _outfile = join('/Users/giladshoham/dev/bit/bit/bundle', `${appFile}.js`); @@ -28,7 +28,7 @@ function bundle() { // inject: [join(__dirname, './import-meta-url.js')], external: [ - 'jest.worker', + // 'jest.worker', 'yoga-layout', 'yoga-layout-prebuilt', '@surma/rollup-plugin-off-main-thread', @@ -175,5 +175,3 @@ function bundle() { loader: { '.png': 'binary', '.node': 'binary' }, }); } - -bundle().then((res) => console.log(JSON.stringify(res, null, 2))); diff --git a/scopes/harmony/bit/bundle/readme.md b/scopes/harmony/bit/bundle/readme.md new file mode 100644 index 000000000000..7cc2d20fd8e7 --- /dev/null +++ b/scopes/harmony/bit/bundle/readme.md @@ -0,0 +1,16 @@ +## create bundle: + +``` +node node_modules/@teambit/bit/dist/bundle/bundle.js > bundle.result.json +``` + +## Use the bundle + +``` +node /bit/bundle/bit.app.js +``` + +## structure + +1. bundle.ts - main file to generate the bundle +2. esbuild.ts - running the esbuild bundler From 5ecf019fc6d60107151ded9ca0203cff14ad3d5d Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 13:33:07 +0300 Subject: [PATCH 18/89] restore core aspects to manifests --- scopes/harmony/bit/manifests.ts | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index 9426dfc0df6f..f274bdf5e4a7 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -38,7 +38,6 @@ import { ElementsAspect } from '@teambit/elements/elements.aspect'; import { SchemaAspect } from '@teambit/schema/schema.aspect'; import { PubsubAspect } from '@teambit/pubsub/pubsub.aspect'; import { ScopeAspect } from '@teambit/scope/scope.aspect'; -// import { StencilAspect } from '@teambit/stencil/stencil.aspect'; import { TesterAspect } from '@teambit/tester/tester.aspect'; import { MultiTesterAspect } from '@teambit/multi-tester/multi-tester.aspect'; import { TypescriptAspect } from '@teambit/typescript/typescript.aspect'; @@ -104,7 +103,7 @@ import { StashAspect } from '@teambit/stash/stash.aspect'; import { GitAspect } from '@teambit/git/git.aspect'; import { IpcEventsAspect } from '@teambit/ipc-events/ipc-events.aspect'; -// import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; +import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; import { AspectLoaderMain } from '@teambit/aspect-loader/aspect-loader.main.runtime'; import { BuilderMain } from '@teambit/builder/builder.main.runtime'; import { BundlerMain } from '@teambit/bundler/bundler.main.runtime'; @@ -127,22 +126,21 @@ import { GraphMain } from '@teambit/graph/graph.main.runtime'; import { GraphqlMain } from '@teambit/graphql/graphql.main.runtime'; import { InsightsMain } from '@teambit/insights/insights.main.runtime'; import { IsolatorMain } from '@teambit/isolator/isolator.main.runtime'; -// import { JestMain } from '@teambit/jest/jest.main.runtime'; +import { JestMain } from '@teambit/jest/jest.main.runtime'; import { LoggerMain } from '@teambit/logger/logger.main.runtime'; -// import { NodeMain } from '@teambit/node/node.main.runtime'; +import { NodeMain } from '@teambit/node/node.main.runtime'; import { PanelUIMain } from '@teambit/panels/panel-ui.main.runtime'; import { PkgMain } from '@teambit/pkg/pkg.main.runtime'; import { PnpmMain } from '@teambit/pnpm/pnpm.main.runtime'; -// import { PreviewMain } from '@teambit/preview/preview.main.runtime'; +import { PreviewMain } from '@teambit/preview/preview.main.runtime'; import { ComponentSizerMain } from '@teambit/component-sizer/component-sizer.main.runtime'; -// import { ReactMain } from '@teambit/react/react.main.runtime'; -// import { ReactNativeMain } from '@teambit/react-native/react-native.main.runtime'; +import { ReactMain } from '@teambit/react/react.main.runtime'; +import { ReactNativeMain } from '@teambit/react-native/react-native.main.runtime'; import { ReactElementsMain } from '@teambit/react-elements/react-elements.main.runtime'; import { ElementsMain } from '@teambit/elements/elements.main.runtime'; import { SchemaMain } from '@teambit/schema/schema.main.runtime'; import { PubsubMain } from '@teambit/pubsub/pubsub.main.runtime'; import { ScopeMain } from '@teambit/scope/scope.main.runtime'; -// {impor}{ StencMain } from '@teambit/stencil/stencil.main.runtime'; import { TesterMain } from '@teambit/tester/tester.main.runtime'; import { MultiTesterMain } from '@teambit/multi-tester/multi-tester.main.runtime'; import { TypescriptMain } from '@teambit/typescript/typescript.main.runtime'; @@ -168,7 +166,7 @@ import { UpdateDependenciesMain } from '@teambit/update-dependencies/update-depe import { ExportMain } from '@teambit/export/export.main.runtime'; import { ImporterMain } from '@teambit/importer/importer.main.runtime'; import { EjectMain } from '@teambit/eject/eject.main.runtime'; -// import { HtmlMain } from '@teambit/html/html.main.runtime'; +import { HtmlMain } from '@teambit/html/html.main.runtime'; import { LanesMain } from '@teambit/lanes/lanes.main.runtime'; import { ForkingMain } from '@teambit/forking/forking.main.runtime'; import { RenamingMain } from '@teambit/renaming/renaming.main.runtime'; @@ -244,7 +242,6 @@ export function getManifestsMap() { [ReactElementsAspect.id]: ReactElementsAspect, [ElementsAspect.id]: ElementsAspect, [WorkerAspect.id]: WorkerAspect, - // [StencilAspect.id]: StencilAspect, [ScopeAspect.id]: ScopeAspect, [TesterAspect.id]: TesterAspect, [MultiTesterAspect.id]: MultiTesterAspect, @@ -314,7 +311,7 @@ export function getManifestsMap() { } export const runtimesMap = { - // [AspectAspect.id]: AspectMain, + [AspectAspect.id]: AspectMain, [AspectLoaderAspect.id]: AspectLoaderMain, [BuilderAspect.id]: BuilderMain, [BundlerAspect.id]: BundlerMain, @@ -337,16 +334,16 @@ export const runtimesMap = { [GraphqlAspect.id]: GraphqlMain, [InsightsAspect.id]: InsightsMain, [IsolatorAspect.id]: IsolatorMain, - // [JestAspect.id]: JestMain, + [JestAspect.id]: JestMain, [LoggerAspect.id]: LoggerMain, - // [NodeAspect.id]: NodeMain, + [NodeAspect.id]: NodeMain, [PanelUiAspect.id]: PanelUIMain, [PkgAspect.id]: PkgMain, [PnpmAspect.id]: PnpmMain, - // [PreviewAspect.id]: PreviewMain, + [PreviewAspect.id]: PreviewMain, [ComponentSizerAspect.id]: ComponentSizerMain, - // [ReactAspect.id]: ReactMain, - // [ReactNativeAspect.id]: ReactNativeMain, + [ReactAspect.id]: ReactMain, + [ReactNativeAspect.id]: ReactNativeMain, [ReactElementsAspect.id]: ReactElementsMain, [ElementsAspect.id]: ElementsMain, [SchemaAspect.id]: SchemaMain, @@ -377,7 +374,7 @@ export const runtimesMap = { [ExportAspect.id]: ExportMain, [ImporterAspect.id]: ImporterMain, [EjectAspect.id]: EjectMain, - // [HtmlAspect.id]: HtmlMain, + [HtmlAspect.id]: HtmlMain, [LanesAspect.id]: LanesMain, [ForkingAspect.id]: ForkingMain, [RenamingAspect.id]: RenamingMain, From 76b3e02ced0e158fd191e558357614a6c888287b Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 14:15:27 +0300 Subject: [PATCH 19/89] bundle - generateCoreAspectsBarrelFile --- scopes/harmony/bit/app.ts | 3 + scopes/harmony/bit/bundle/bundle.ts | 2 + .../bundle/generate-core-aspects-exports.ts | 31 +++++ scopes/harmony/bit/core-aspects-exports.ts | 104 +++++++++++++++++ scopes/harmony/bit/core-aspects-ids.ts | 106 ++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 scopes/harmony/bit/bundle/generate-core-aspects-exports.ts create mode 100644 scopes/harmony/bit/core-aspects-exports.ts create mode 100644 scopes/harmony/bit/core-aspects-ids.ts diff --git a/scopes/harmony/bit/app.ts b/scopes/harmony/bit/app.ts index 5802311a82fb..c484df50ce54 100644 --- a/scopes/harmony/bit/app.ts +++ b/scopes/harmony/bit/app.ts @@ -16,6 +16,9 @@ import { bootstrap } from '@teambit/legacy/dist/bootstrap'; import { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors'; import { runCLI } from './load-bit'; +// Export APIs from all core aspects to be used in the bundled app +// export * from './core-aspects-exports'; + // eslint-disable-next-line @typescript-eslint/no-floating-promises initApp(); diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 984204e38d16..eba9bb417d1a 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -1,6 +1,8 @@ import { runEsbuild } from './esbuild'; +import { generateCoreAspectsBarrelFile } from './generate-core-aspects-exports'; async function runBundle() { + await generateCoreAspectsBarrelFile(); const esbuildRes = await runEsbuild(); return esbuildRes; } diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts b/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts new file mode 100644 index 000000000000..18e477a03004 --- /dev/null +++ b/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts @@ -0,0 +1,31 @@ +import camelcase from 'camelcase'; +import { getCoreAspectName, getCoreAspectPackageName } from '@teambit/aspect-loader'; +import fs from 'fs-extra'; +import { join } from 'path'; + +import { coreAspectsIds } from '../core-aspects-ids'; + +const FILE_NAME = 'core-aspects-exports.ts'; +// const filePath = join('..', FILE_NAME); +// TODO: make it not hard coded +const filePath = join('/Users/giladshoham/dev/bit/bit/scopes/harmony/bit', FILE_NAME); + +export function generateCoreAspectsBarrelFile() { + const exports = generateExports(); + const autoGeneratedMessage = `// This file is auto generated by generate-core-aspects-exports.ts`; + const content = `${autoGeneratedMessage}\n${exports}`; + return fs.outputFile(filePath, content); +} + +function generateExports(): string { + const exportsLines = coreAspectsIds.map((id) => { + const name = getCoreAspectName(id); + const packageName = getCoreAspectPackageName(id); + return generateOneExport(name, packageName); + }); + return exportsLines.join('\n'); +} + +function generateOneExport(name, packageName) { + return `export * as ${camelcase(name)} from '${packageName}';`; +} diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts new file mode 100644 index 000000000000..b5af8a01c847 --- /dev/null +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -0,0 +1,104 @@ +// This file is auto generated by generate-core-aspects-exports.ts +export * as aspectLoader from '@teambit/aspect-loader'; +export * as cli from '@teambit/cli'; +export * as devFiles from '@teambit/dev-files'; +export * as workspace from '@teambit/workspace'; +export * as workspaceConfigFiles from '@teambit/workspace-config-files'; +export * as install from '@teambit/install'; +export * as eslint from '@teambit/eslint'; +export * as prettier from '@teambit/prettier'; +export * as compiler from '@teambit/compiler'; +export * as linter from '@teambit/linter'; +export * as formatter from '@teambit/formatter'; +export * as component from '@teambit/component'; +export * as mdx from '@teambit/mdx'; +export * as readme from '@teambit/readme'; +export * as preview from '@teambit/preview'; +export * as componentSizer from '@teambit/component-sizer'; +export * as docs from '@teambit/docs'; +export * as yarn from '@teambit/yarn'; +export * as compositions from '@teambit/compositions'; +export * as globalConfig from '@teambit/global-config'; +export * as graphql from '@teambit/graphql'; +export * as pnpm from '@teambit/pnpm'; +export * as multiCompiler from '@teambit/multi-compiler'; +export * as ui from '@teambit/ui'; +export * as generator from '@teambit/generator'; +export * as envs from '@teambit/envs'; +export * as env from '@teambit/env'; +export * as graph from '@teambit/graph'; +export * as pubsub from '@teambit/pubsub'; +export * as dependencyResolver from '@teambit/dependency-resolver'; +export * as insights from '@teambit/insights'; +export * as isolator from '@teambit/isolator'; +export * as logger from '@teambit/logger'; +export * as pkg from '@teambit/pkg'; +export * as react from '@teambit/react'; +export * as reactNative from '@teambit/react-native'; +export * as reactElements from '@teambit/react-elements'; +export * as elements from '@teambit/elements'; +export * as worker from '@teambit/worker'; +export * as scope from '@teambit/scope'; +export * as tester from '@teambit/tester'; +export * as multiTester from '@teambit/multi-tester'; +export * as builder from '@teambit/builder'; +export * as variants from '@teambit/variants'; +export * as deprecation from '@teambit/deprecation'; +export * as express from '@teambit/express'; +export * as aspect from '@teambit/aspect'; +export * as webpack from '@teambit/webpack'; +export * as schema from '@teambit/schema'; +export * as reactRouter from '@teambit/react-router'; +export * as typescript from '@teambit/typescript'; +export * as panels from '@teambit/panels'; +export * as babel from '@teambit/babel'; +export * as node from '@teambit/node'; +export * as notifications from '@teambit/notifications'; +export * as bundler from '@teambit/bundler'; +export * as jest from '@teambit/jest'; +export * as cache from '@teambit/cache'; +export * as changelog from '@teambit/changelog'; +export * as code from '@teambit/code'; +export * as commandBar from '@teambit/command-bar'; +export * as sidebar from '@teambit/sidebar'; +export * as componentTree from '@teambit/component-tree'; +export * as sign from '@teambit/sign'; +export * as updateDependencies from '@teambit/update-dependencies'; +export * as export from '@teambit/export'; +export * as importer from '@teambit/importer'; +export * as harmonyUiApp from '@teambit/harmony-ui-app'; +export * as userAgent from '@teambit/user-agent'; +export * as application from '@teambit/application'; +export * as eject from '@teambit/eject'; +export * as html from '@teambit/html'; +export * as lanes from '@teambit/lanes'; +export * as forking from '@teambit/forking'; +export * as renaming from '@teambit/renaming'; +export * as newComponentHelper from '@teambit/new-component-helper'; +export * as componentLog from '@teambit/component-log'; +export * as clearCache from '@teambit/clear-cache'; +export * as mocha from '@teambit/mocha'; +export * as bitCustomAspect from '@teambit/bit-custom-aspect'; +export * as diagnostic from '@teambit/diagnostic'; +export * as status from '@teambit/status'; +export * as community from '@teambit/community'; +export * as cloud from '@teambit/cloud'; +export * as snapping from '@teambit/snapping'; +export * as merging from '@teambit/merging'; +export * as issues from '@teambit/issues'; +export * as refactoring from '@teambit/refactoring'; +export * as componentCompare from '@teambit/component-compare'; +export * as lister from '@teambit/lister'; +export * as dependencies from '@teambit/dependencies'; +export * as remove from '@teambit/remove'; +export * as mergeLanes from '@teambit/merge-lanes'; +export * as checkout from '@teambit/checkout'; +export * as componentWriter from '@teambit/component-writer'; +export * as apiReference from '@teambit/api-reference'; +export * as apiServer from '@teambit/api-server'; +export * as tracker from '@teambit/tracker'; +export * as mover from '@teambit/mover'; +export * as watcher from '@teambit/watcher'; +export * as stash from '@teambit/stash'; +export * as git from '@teambit/git'; +export * as ipcEvents from '@teambit/ipc-events'; diff --git a/scopes/harmony/bit/core-aspects-ids.ts b/scopes/harmony/bit/core-aspects-ids.ts new file mode 100644 index 000000000000..93fa9b2e922d --- /dev/null +++ b/scopes/harmony/bit/core-aspects-ids.ts @@ -0,0 +1,106 @@ +// TODO: combine this with the manifests somehow +export const coreAspectsIds = [ + 'teambit.harmony/aspect-loader', + 'teambit.harmony/cli', + 'teambit.component/dev-files', + 'teambit.workspace/workspace', + 'teambit.workspace/workspace-config-files', + 'teambit.bit/install', + 'teambit.defender/eslint', + 'teambit.defender/prettier', + 'teambit.compilation/compiler', + 'teambit.defender/linter', + 'teambit.defender/formatter', + 'teambit.component/component', + 'teambit.mdx/mdx', + 'teambit.mdx/readme', + 'teambit.preview/preview', + 'teambit.component/component-sizer', + 'teambit.docs/docs', + 'teambit.dependencies/yarn', + 'teambit.compositions/compositions', + 'teambit.harmony/global-config', + 'teambit.harmony/graphql', + 'teambit.dependencies/pnpm', + 'teambit.compilation/multi-compiler', + 'teambit.ui-foundation/ui', + 'teambit.generator/generator', + 'teambit.envs/envs', + 'teambit.envs/env', + 'teambit.component/graph', + 'teambit.harmony/pubsub', + 'teambit.dependencies/dependency-resolver', + 'teambit.explorer/insights', + 'teambit.component/isolator', + 'teambit.harmony/logger', + 'teambit.pkg/pkg', + 'teambit.react/react', + 'teambit.react/react-native', + 'teambit.react/react-elements', + 'teambit.web-components/elements', + 'teambit.harmony/worker', + 'teambit.scope/scope', + 'teambit.defender/tester', + 'teambit.defender/multi-tester', + 'teambit.pipelines/builder', + 'teambit.workspace/variants', + 'teambit.component/deprecation', + 'teambit.harmony/express', + 'teambit.harmony/aspect', + 'teambit.webpack/webpack', + 'teambit.semantics/schema', + 'teambit.ui-foundation/react-router', + 'teambit.typescript/typescript', + 'teambit.ui-foundation/panels', + 'teambit.compilation/babel', + 'teambit.harmony/node', + 'teambit.ui-foundation/notifications', + 'teambit.compilation/bundler', + 'teambit.defender/jest', + 'teambit.harmony/cache', + 'teambit.component/changelog', + 'teambit.component/code', + 'teambit.explorer/command-bar', + 'teambit.ui-foundation/sidebar', + 'teambit.component/component-tree', + 'teambit.scope/sign', + 'teambit.scope/update-dependencies', + 'teambit.scope/export', + 'teambit.scope/importer', + 'teambit.ui-foundation/harmony-ui-app', + 'teambit.ui-foundation/user-agent', + 'teambit.harmony/application', + 'teambit.workspace/eject', + 'teambit.html/html', + 'teambit.lanes/lanes', + 'teambit.component/forking', + 'teambit.component/renaming', + 'teambit.component/new-component-helper', + 'teambit.component/component-log', + 'teambit.bit/clear-cache', + 'teambit.defender/mocha', + 'teambit.harmony/bit-custom-aspect', + 'teambit.harmony/diagnostic', + 'teambit.component/status', + 'teambit.community/community', + 'teambit.cloud/cloud', + 'teambit.component/snapping', + 'teambit.component/merging', + 'teambit.component/issues', + 'teambit.component/refactoring', + 'teambit.component/component-compare', + 'teambit.component/lister', + 'teambit.dependencies/dependencies', + 'teambit.component/remove', + 'teambit.lanes/merge-lanes', + 'teambit.component/checkout', + 'teambit.component/component-writer', + 'teambit.api-reference/api-reference', + 'teambit.harmony/api-server', + 'teambit.component/tracker', + 'teambit.component/mover', + 'teambit.workspace/watcher', + 'teambit.component/stash', + 'teambit.git/git', + 'teambit.harmony/ipc-events', +]; From f91bf9e302a8835df2350af1a29c55a1ec1eb841 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 15:24:02 +0300 Subject: [PATCH 20/89] ignore bundle outputs --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3370be4a875a..a205d0e97a51 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,6 @@ scopes/component/component-issues/dist/ # component version scopes/component/component-version/dist/ + +# bundle output +bundle From 18c027b1931e2ba34ed2f6e28b5971977f2755e5 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 15:27:05 +0300 Subject: [PATCH 21/89] generate core aspects modules --- scopes/harmony/bit/bundle/bundle.ts | 7 +++- scopes/harmony/bit/bundle/esbuild.ts | 7 ++-- .../bundle/generate-core-aspects-modules.ts | 34 +++++++++++++++++++ scopes/harmony/bit/bundle/readme.md | 1 + 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 scopes/harmony/bit/bundle/generate-core-aspects-modules.ts diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index eba9bb417d1a..471cd02b3daa 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -1,9 +1,14 @@ import { runEsbuild } from './esbuild'; import { generateCoreAspectsBarrelFile } from './generate-core-aspects-exports'; +import { generateCoreAspectsModules } from './generate-core-aspects-modules'; + +const outDir = '/Users/giladshoham/dev/bit/bit/bundle'; +const appFile = 'bit.app.js'; async function runBundle() { await generateCoreAspectsBarrelFile(); - const esbuildRes = await runEsbuild(); + const esbuildRes = await runEsbuild(outDir, appFile); + await generateCoreAspectsModules(outDir, appFile); return esbuildRes; } diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index b1875e5b73a0..b7a1f7555aa7 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -2,10 +2,9 @@ import { build } from 'esbuild'; import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; -export function runEsbuild() { - const appFile = `bit.app`; +export function runEsbuild(outDir: string, appFile: string) { // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); - const _outfile = join('/Users/giladshoham/dev/bit/bit/bundle', `${appFile}.js`); + const _outfile = join(outDir, appFile); // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `test-app.js`); return build({ define: { @@ -134,6 +133,8 @@ export function runEsbuild() { ignorePlugin([ // { resourceRegExp: /(.*)\.ui\.runtime\.*/g }, { resourceRegExp: /\.(s[ac]ss|css)$/ }, + { resourceRegExp: /\.(mdx)$/ }, + { resourceRegExp: /\.(md)$/ }, // { resourceRegExp: new RegExp('^@swc/core') }, { resourceRegExp: new RegExp('^jest-resolve') }, { resourceRegExp: new RegExp('^@vue/compiler-sfc') }, diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts new file mode 100644 index 000000000000..0f0c69260e99 --- /dev/null +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -0,0 +1,34 @@ +import camelcase from 'camelcase'; +import { getCoreAspectName, getCoreAspectPackageName } from '@teambit/aspect-loader'; +import fs from 'fs-extra'; +import { join } from 'path'; + +import { coreAspectsIds } from '../core-aspects-ids'; + +export function generateCoreAspectsModules(bundleDir: string, appName: string) { + const generateOneAspectP = coreAspectsIds.map((id) => { + return handleOneAspect(bundleDir, id, appName); + }); + return Promise.all(generateOneAspectP); +} + +async function handleOneAspect(bundleDir: string, id: string, appName: string) { + const name = getCoreAspectName(id); + const packageName = getCoreAspectPackageName(id); + + const dirPath = join(bundleDir, packageName); + await fs.ensureDir(dirPath); + const indexFilePath = join(dirPath, 'index.js'); + const indexFileContent = getIndexContent(name, appName); + return fs.outputFile(indexFilePath, indexFileContent); +} + +function getIndexContent(name: string, appName: string) { + const camelName = camelcase(name); + return ` +// This file is auto generated by generate-core-aspects-modules.ts +Object.defineProperty(exports, "__esModule", { value: true }); +const { ${camelName} } = require("../../${appName}"); +module.exports = ${camelName}; +`; +} diff --git a/scopes/harmony/bit/bundle/readme.md b/scopes/harmony/bit/bundle/readme.md index 7cc2d20fd8e7..1d41b9eadc2f 100644 --- a/scopes/harmony/bit/bundle/readme.md +++ b/scopes/harmony/bit/bundle/readme.md @@ -14,3 +14,4 @@ node /bit/bundle/bit.app.js 1. bundle.ts - main file to generate the bundle 2. esbuild.ts - running the esbuild bundler +3. generate-core-aspects-exports - This will generate a file that exports all the core aspects From 8c7b59b74a71a839023b21d17b279a780d49ec21 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 15:27:26 +0300 Subject: [PATCH 22/89] export from generate core aspects barrel file --- scopes/harmony/bit/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/harmony/bit/app.ts b/scopes/harmony/bit/app.ts index c484df50ce54..35ba13fd90e5 100644 --- a/scopes/harmony/bit/app.ts +++ b/scopes/harmony/bit/app.ts @@ -17,7 +17,7 @@ import { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors'; import { runCLI } from './load-bit'; // Export APIs from all core aspects to be used in the bundled app -// export * from './core-aspects-exports'; +export * from './core-aspects-exports'; // eslint-disable-next-line @typescript-eslint/no-floating-promises initApp(); From 0d51e302ab5f7eb588e28c2d9e3b5fa5f6fd700e Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 15:33:29 +0300 Subject: [PATCH 23/89] handle exports / modules for harmony / legacy --- .../bit/bundle/generate-core-aspects-exports.ts | 2 ++ .../bit/bundle/generate-core-aspects-modules.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts b/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts index 18e477a03004..45245894da68 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-exports.ts @@ -23,6 +23,8 @@ function generateExports(): string { const packageName = getCoreAspectPackageName(id); return generateOneExport(name, packageName); }); + exportsLines.push(generateOneExport('legacy', '@teambit/legacy')); + exportsLines.push(generateOneExport('harmony', '@teambit/harmony')); return exportsLines.join('\n'); } diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index 0f0c69260e99..b368965ff3e6 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -7,15 +7,16 @@ import { coreAspectsIds } from '../core-aspects-ids'; export function generateCoreAspectsModules(bundleDir: string, appName: string) { const generateOneAspectP = coreAspectsIds.map((id) => { - return handleOneAspect(bundleDir, id, appName); + const name = getCoreAspectName(id); + const packageName = getCoreAspectPackageName(id); + return handleOneAspect(bundleDir, name, packageName, appName); }); + generateOneAspectP.push(handleOneAspect(bundleDir, 'legacy', '@teambit/legacy', appName)); + generateOneAspectP.push(handleOneAspect(bundleDir, 'harmony', '@teambit/harmony', appName)); return Promise.all(generateOneAspectP); } -async function handleOneAspect(bundleDir: string, id: string, appName: string) { - const name = getCoreAspectName(id); - const packageName = getCoreAspectPackageName(id); - +async function handleOneAspect(bundleDir: string, name: string, packageName: string, appName: string) { const dirPath = join(bundleDir, packageName); await fs.ensureDir(dirPath); const indexFilePath = join(dirPath, 'index.js'); From 52b88a6afecec3750953ec24af4718020b539e69 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 15:34:40 +0300 Subject: [PATCH 24/89] fix generated modules path --- scopes/harmony/bit/bundle/generate-core-aspects-modules.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index b368965ff3e6..90ffec18b5e5 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -17,7 +17,7 @@ export function generateCoreAspectsModules(bundleDir: string, appName: string) { } async function handleOneAspect(bundleDir: string, name: string, packageName: string, appName: string) { - const dirPath = join(bundleDir, packageName); + const dirPath = join(bundleDir, 'node_modules', packageName); await fs.ensureDir(dirPath); const indexFilePath = join(dirPath, 'index.js'); const indexFileContent = getIndexContent(name, appName); From c1db47a4e134cd7a9c93f7cdc6c260eb380c31ed Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 16:07:45 +0300 Subject: [PATCH 25/89] do not load core aspects defs when exclude core is true --- .../workspace/workspace-aspects-loader.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/scopes/workspace/workspace/workspace-aspects-loader.ts b/scopes/workspace/workspace/workspace-aspects-loader.ts index d676742c99c0..fe787efab6c8 100644 --- a/scopes/workspace/workspace/workspace-aspects-loader.ts +++ b/scopes/workspace/workspace/workspace-aspects-loader.ts @@ -242,9 +242,6 @@ needed-for: ${neededFor || ''}. using opts: ${JSON.stringify(mergedOpts const callId = Math.floor(Math.random() * 1000); const loggerPrefix = `[${callId}] workspace resolveAspects,`; - this.logger.debug( - `${loggerPrefix}, resolving aspects for - runtimeName: ${runtimeName}, componentIds: ${componentIds}` - ); const defaultOpts: ResolveAspectsOptions = { excludeCore: false, requestedOnly: false, @@ -254,6 +251,13 @@ needed-for: ${neededFor || ''}. using opts: ${JSON.stringify(mergedOpts resolveEnvsFromRoots: this.resolveEnvsFromRoots, }; const mergedOpts = { ...defaultOpts, ...opts }; + this.logger.debug( + `${loggerPrefix}, resolving aspects for - runtimeName: ${runtimeName}, componentIds: ${componentIds}, opts: ${JSON.stringify( + mergedOpts, + null, + 2 + )}` + ); const idsToResolve = componentIds ? componentIds.map((id) => id.toString()) : this.harmony.extensionsIds; const coreAspectsIds = this.aspectLoader.getCoreAspectIds(); const configuredAspects = this.aspectLoader.getConfiguredAspects(); @@ -274,13 +278,15 @@ needed-for: ${neededFor || ''}. using opts: ${JSON.stringify(mergedOpts components, this.getWorkspaceAspectResolver([], runtimeName) ); - - const coreAspectDefs = await Promise.all( - coreAspectsIds.map(async (coreId) => { - const rawDef = await getAspectDef(coreId, runtimeName); - return this.aspectLoader.loadDefinition(rawDef); - }) - ); + let coreAspectDefs: AspectDefinition[] = []; + if (!mergedOpts.excludeCore) { + coreAspectDefs = await Promise.all( + coreAspectsIds.map(async (coreId) => { + const rawDef = await getAspectDef(coreId, runtimeName); + return this.aspectLoader.loadDefinition(rawDef); + }) + ); + } const idsToFilter = idsToResolve.map((idStr) => ComponentID.fromString(idStr)); const targetDefs = wsAspectDefs.concat(coreAspectDefs); From b1b40b28c346d88707107869c8642f3157355fe5 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 16:09:10 +0300 Subject: [PATCH 26/89] add todo about sourcemaps --- scopes/harmony/bit/bundle/esbuild.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index b7a1f7555aa7..ee1031fcb0f0 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -20,6 +20,8 @@ export function runEsbuild(outDir: string, appFile: string) { bundle: true, logLevel: 'error', platform: 'node', + // TODO: maybe enable sourcemap later + // sourcemap: true, mainFields: ['main', 'module'], format: 'cjs', keepNames: true, From 3a87c279e57908d4e02a28d54efd88608e94aeaa Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 16:09:21 +0300 Subject: [PATCH 27/89] fix gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a205d0e97a51..c11544b2783a 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,4 @@ scopes/component/component-issues/dist/ scopes/component/component-version/dist/ # bundle output -bundle +/bundle From 52a6fe1258f6387a132eafe54dd81c75870cd017 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 17:22:24 +0300 Subject: [PATCH 28/89] update core aspects exports --- scopes/harmony/bit/core-aspects-exports.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts index b5af8a01c847..38eb8c1032ed 100644 --- a/scopes/harmony/bit/core-aspects-exports.ts +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -102,3 +102,5 @@ export * as watcher from '@teambit/watcher'; export * as stash from '@teambit/stash'; export * as git from '@teambit/git'; export * as ipcEvents from '@teambit/ipc-events'; +export * as legacy from '@teambit/legacy'; +export * as harmony from '@teambit/harmony'; From 10076bd1cd8b54f30b9730f884e894fc90bf620c Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 23 Jul 2023 17:49:50 +0300 Subject: [PATCH 29/89] do not add core envs aspect defs to env runtime --- scopes/envs/envs/environments.main.runtime.ts | 3 ++- scopes/envs/envs/runtime/env-runtime.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scopes/envs/envs/environments.main.runtime.ts b/scopes/envs/envs/environments.main.runtime.ts index a41110c9723a..d7349326474c 100644 --- a/scopes/envs/envs/environments.main.runtime.ts +++ b/scopes/envs/envs/environments.main.runtime.ts @@ -985,7 +985,8 @@ export class EnvsMain { ); } - private async getEnvAspectDef(envId: string): Promise { + private async getEnvAspectDef(envId: string): Promise { + if (this.isCoreEnv(envId)) return undefined; const host = this.componentMain.getHost(); const id = await host.resolveComponentId(envId); // We don't want to filter by runtime here as we want to also get envs that configured as plugins. so they don't diff --git a/scopes/envs/envs/runtime/env-runtime.ts b/scopes/envs/envs/runtime/env-runtime.ts index e1e2a9003796..ff149fa8ee3c 100644 --- a/scopes/envs/envs/runtime/env-runtime.ts +++ b/scopes/envs/envs/runtime/env-runtime.ts @@ -26,6 +26,6 @@ export class EnvRuntime { /** * Aspect definition of the env. */ - readonly envAspectDefinition: AspectDefinition + readonly envAspectDefinition?: AspectDefinition ) {} } From 942d6c9f7a051415280b7de559a42535a2382af8 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 14:20:41 +0300 Subject: [PATCH 30/89] add esbuild config files plugin --- .../bit/bundle/config-files-esbuild-plugin.ts | 127 ++++++++++++++++++ scopes/harmony/bit/bundle/esbuild.ts | 2 + 2 files changed, 129 insertions(+) create mode 100644 scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts new file mode 100644 index 000000000000..b47148a954ce --- /dev/null +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -0,0 +1,127 @@ +import { ParsedPath, basename, format, join, parse } from 'path'; +import { OnResolveArgs } from 'esbuild'; +import fs from 'fs-extra'; + +function handleConfigFile(args: OnResolveArgs, bundleDir: string) { + console.log('im here', args); + if ( + args.kind === 'require-resolve' && + args.importer.includes('/scopes/') && + // ignore templates we want to keep it as is + !args.importer.includes('/templates/') + ) { + if (args.path.startsWith('@teambit')) { + return handleModulePath(args, bundleDir); + } + if (args.path.startsWith('.')) { + return handleRelativePath(args, bundleDir); + } + } + return undefined; +} + +async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { + const parsed = parse(args.path); + console.log('parsed', parsed); + const origFilePath = join(args.resolveDir, args.path); + const targetDirName = getTargetDirName(args.resolveDir); + const targetDir = join(bundleDir, targetDirName, parsed.dir); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:28 ~ handleRelativePath ~ targetDir:', targetDir); + await fs.ensureDir(targetDir); + const resolvedFilePath = require.resolve(origFilePath); + console.log( + '🚀 ~ file: config-files-esbuild-plugin.ts:32 ~ handleRelativePath ~ resolvedFilePath:', + resolvedFilePath + ); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:32 ~ handleRelativePath ~ origFilePath:', origFilePath); + console.log( + '🚀 ~ file: config-files-esbuild-plugin.ts:33 ~ handleRelativePath ~ join(targetDir, parsed.base):', + join(targetDir, parsed.base) + ); + console.log( + '🚀 ~ file: config-files-esbuild-plugin.ts:36 ~ handleRelativePath ~ basename(resolvedFilePath):', + basename(resolvedFilePath) + ); + await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); + const newPath = replaceRelativePath(targetDirName, parsed); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:38 ~ handleRelativePath ~ newPath:', newPath); + + return { + path: newPath, + namespace: 'bit-config-file', + external: true, + }; +} + +function getTargetDirName(resolveDir: string): string { + const parts = resolveDir.split('/scopes/'); + if (parts.length !== 2) { + throw new Error('unable to find scopes dir'); + } + return parts[1].split('/').join('.'); +} +function handleModulePath(args: OnResolveArgs, bundleDir: string) { + return { + // Keep the path as-is + path: args.path, + namespace: 'bit-config-file', + external: true, + }; +} +function replaceRelativePath(targetDirName: string, parsedPath: ParsedPath) { + parsedPath.dir = `./${targetDirName}/${parsedPath.dir.replace('./', '')}`; + const formatted = format(parsedPath); + return formatted; +} + +export const configFilesEsbuildPlugin = (bundleDir: string) => { + return { + name: 'config-files', + setup(build) { + // Intercept import paths starting with "http:" and "https:" so + // esbuild doesn't attempt to map them to a file system location. + // Tag them with the "http-url" namespace to associate them with + // this plugin. + build.onResolve({ filter: /jest.config$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + + // We also want to intercept all import paths inside downloaded + // files and resolve them against the original URL. All of these + // files will be in the "http-url" namespace. Make sure to keep + // the newly resolved URL in the "http-url" namespace so imports + // inside it will also be resolved as URLs recursively. + // build.onResolve({ filter: /.*/, namespace: 'http-url' }, args => ({ + // path: new URL(args.path, args.importer).toString(), + // namespace: 'http-url', + // })) + + // When a URL is loaded, we want to actually download the content + // from the internet. This has just enough logic to be able to + // handle the example import from unpkg.com but in reality this + // would probably need to be more complex. + // build.onLoad({ filter: /.*/, namespace: 'http-url' }, async (args) => { + // let contents = await new Promise((resolve, reject) => { + // function fetch(url) { + // console.log(`Downloading: ${url}`) + // let lib = url.startsWith('https') ? https : http + // let req = lib.get(url, res => { + // if ([301, 302, 307].includes(res.statusCode)) { + // fetch(new URL(res.headers.location, url).toString()) + // req.abort() + // } else if (res.statusCode === 200) { + // let chunks = [] + // res.on('data', chunk => chunks.push(chunk)) + // res.on('end', () => resolve(Buffer.concat(chunks))) + // } else { + // reject(new Error(`GET ${url} failed: status ${res.statusCode}`)) + // } + // }).on('error', reject) + // } + // fetch(args.path) + // }) + // return { contents } + // }) + }, + }; +}; diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index ee1031fcb0f0..cd9f65f028ed 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -1,6 +1,7 @@ import { build } from 'esbuild'; import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; +import { configFilesEsbuildPlugin } from './config-files-esbuild-plugin'; export function runEsbuild(outDir: string, appFile: string) { // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); @@ -174,6 +175,7 @@ export function runEsbuild(outDir: string, appFile: string) { // { resourceRegExp: new RegExp('^vm-browserify') }, // { resourceRegExp: new RegExp('^browserify-zlib') }, ]), + configFilesEsbuildPlugin(outDir), ], loader: { '.png': 'binary', '.node': 'binary' }, }); From 9162021d6c3fd0e7b8e205b594f268adc93896e0 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 15:52:04 +0300 Subject: [PATCH 31/89] esbuild plugin handle module paths config files --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index b47148a954ce..fb44c42a90f3 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -60,7 +60,14 @@ function getTargetDirName(resolveDir: string): string { } return parts[1].split('/').join('.'); } -function handleModulePath(args: OnResolveArgs, bundleDir: string) { +async function handleModulePath(args: OnResolveArgs, bundleDir: string) { + const resolvedFilePath = require.resolve(args.path); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:65 ~ handleModulePath ~ resolvedFilePath:', resolvedFilePath); + const parsed = parse(args.path); + const targetDir = join(bundleDir, 'node_modules', parsed.dir); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:67 ~ handleModulePath ~ targetDir:', targetDir); + await fs.ensureDir(targetDir); + await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); return { // Keep the path as-is path: args.path, From abe239f9b7b9fbaabe82e23679a3069af3d3de93 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 16:35:49 +0300 Subject: [PATCH 32/89] handle more files to copy --- .../bit/bundle/config-files-esbuild-plugin.ts | 77 ++++++++++++++++++- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index fb44c42a90f3..dd66ce5618e8 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -23,7 +23,12 @@ function handleConfigFile(args: OnResolveArgs, bundleDir: string) { async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const parsed = parse(args.path); console.log('parsed', parsed); - const origFilePath = join(args.resolveDir, args.path); + const packageDirName = getPackageDirName(args.resolveDir); + // const origFilePath = join(args.resolveDir, args.path); + const relativePath = getFilePathRelativeToPackage(args.resolveDir, args.path); + // TODO: dist is hard coded now which is not great + const origFilePath = join(packageDirName, 'dist', relativePath); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:27 ~ handleRelativePath ~ origFilePath:', origFilePath); const targetDirName = getTargetDirName(args.resolveDir); const targetDir = join(bundleDir, targetDirName, parsed.dir); console.log('🚀 ~ file: config-files-esbuild-plugin.ts:28 ~ handleRelativePath ~ targetDir:', targetDir); @@ -33,7 +38,6 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { '🚀 ~ file: config-files-esbuild-plugin.ts:32 ~ handleRelativePath ~ resolvedFilePath:', resolvedFilePath ); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:32 ~ handleRelativePath ~ origFilePath:', origFilePath); console.log( '🚀 ~ file: config-files-esbuild-plugin.ts:33 ~ handleRelativePath ~ join(targetDir, parsed.base):', join(targetDir, parsed.base) @@ -53,6 +57,32 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { }; } +function getFilePathRelativeToPackage(resolveDir: string, filePath: string): string { + const parts = resolveDir.split('/scopes/'); + if (parts.length !== 2) { + throw new Error('unable to find scopes dir'); + } + const idParts = parts[1].split('/'); + // [0] is the scope name [1] is the component name + // array from index 2 to the end is the internal path + const relativePath = idParts.slice(2).join('/'); + return join(relativePath, filePath); +} + +function getPackageDirName(resolveDir: string): string { + // TODO: consider taking it from the bit show package name + // based on the root dir from the bitmap + // for now doing it like this to make it faster + const parts = resolveDir.split('/scopes/'); + if (parts.length !== 2) { + throw new Error('unable to find scopes dir'); + } + const idParts = parts[1].split('/'); + // [0] is the scope name + const name = idParts[1]; + return `@teambit/${name}`; +} + function getTargetDirName(resolveDir: string): string { const parts = resolveDir.split('/scopes/'); if (parts.length !== 2) { @@ -76,7 +106,14 @@ async function handleModulePath(args: OnResolveArgs, bundleDir: string) { }; } function replaceRelativePath(targetDirName: string, parsedPath: ParsedPath) { - parsedPath.dir = `./${targetDirName}/${parsedPath.dir.replace('./', '')}`; + if (parsedPath.dir === '.') { + return `./${targetDirName}/${parsedPath.base}`; + } + const relativePath = parsedPath.dir.split('/').slice(1).join('/'); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:110 ~ replaceRelativePath ~ parsedPath.dir:', parsedPath.dir); + console.log('🚀 ~ file: config-files-esbuild-plugin.ts:110 ~ replaceRelativePath ~ relativePath:', relativePath); + // parsedPath.dir = `./${targetDirName}/${parsedPath.dir.replace('./', '')}`; + parsedPath.dir = `./${targetDirName}/${relativePath}`; const formatted = format(parsedPath); return formatted; } @@ -93,6 +130,40 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /jest.worker$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + + build.onResolve({ filter: /eslintrc.js$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + + build.onResolve({ filter: /prettier.config.js$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + + build.onResolve({ filter: /tsconfig.json$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /tsconfig.cjs.json$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /refreshOverlayInterop$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /webpackHotDevClient$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /\/mount$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /html-docs-app$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /\/preview.preview.runtime$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + // We also want to intercept all import paths inside downloaded // files and resolve them against the original URL. All of these // files will be in the "http-url" namespace. Make sure to keep From 7fe2467f660dc35fcb4c661d7903d66025349885 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 16:56:57 +0300 Subject: [PATCH 33/89] improve config files esbuild plugin --- .../bit/bundle/config-files-esbuild-plugin.ts | 73 ++++++++----------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index dd66ce5618e8..7353466e9c1d 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -1,7 +1,13 @@ -import { ParsedPath, basename, format, join, parse } from 'path'; +import { basename, dirname, join, parse } from 'path'; import { OnResolveArgs } from 'esbuild'; import fs from 'fs-extra'; +type ParsedArgs = { + scopeName: string; + componentName: string; + relativePath: string; +}; + function handleConfigFile(args: OnResolveArgs, bundleDir: string) { console.log('im here', args); if ( @@ -23,14 +29,18 @@ function handleConfigFile(args: OnResolveArgs, bundleDir: string) { async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const parsed = parse(args.path); console.log('parsed', parsed); - const packageDirName = getPackageDirName(args.resolveDir); + const { componentName, relativePath, scopeName } = parseArgs(args); + // const packageDirName = getPackageDirName(args.resolveDir); + const packageDirName = `@teambit/${componentName}`; // const origFilePath = join(args.resolveDir, args.path); - const relativePath = getFilePathRelativeToPackage(args.resolveDir, args.path); + // const relativePath = getFilePathRelativeToPackage(args.resolveDir, args.path); // TODO: dist is hard coded now which is not great const origFilePath = join(packageDirName, 'dist', relativePath); console.log('🚀 ~ file: config-files-esbuild-plugin.ts:27 ~ handleRelativePath ~ origFilePath:', origFilePath); - const targetDirName = getTargetDirName(args.resolveDir); - const targetDir = join(bundleDir, targetDirName, parsed.dir); + // const targetDirName = getTargetDirName(args.resolveDir); + const targetDirName = `${scopeName}.${componentName}`; + // const targetDir = join(bundleDir, targetDirName, parsed.dir); + const targetDir = join(bundleDir, targetDirName, dirname(relativePath)); console.log('🚀 ~ file: config-files-esbuild-plugin.ts:28 ~ handleRelativePath ~ targetDir:', targetDir); await fs.ensureDir(targetDir); const resolvedFilePath = require.resolve(origFilePath); @@ -47,7 +57,8 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { basename(resolvedFilePath) ); await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); - const newPath = replaceRelativePath(targetDirName, parsed); + // const newPath = replaceRelativePath(targetDirName, parsed); + const newPath = `./${targetDirName}/${relativePath}`; console.log('🚀 ~ file: config-files-esbuild-plugin.ts:38 ~ handleRelativePath ~ newPath:', newPath); return { @@ -57,39 +68,27 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { }; } -function getFilePathRelativeToPackage(resolveDir: string, filePath: string): string { +function parseArgs(args: OnResolveArgs): ParsedArgs { + const resolveDir = args.resolveDir; + const filePath = args.path; const parts = resolveDir.split('/scopes/'); if (parts.length !== 2) { throw new Error('unable to find scopes dir'); } const idParts = parts[1].split('/'); - // [0] is the scope name [1] is the component name - // array from index 2 to the end is the internal path - const relativePath = idParts.slice(2).join('/'); - return join(relativePath, filePath); -} - -function getPackageDirName(resolveDir: string): string { - // TODO: consider taking it from the bit show package name - // based on the root dir from the bitmap - // for now doing it like this to make it faster - const parts = resolveDir.split('/scopes/'); - if (parts.length !== 2) { - throw new Error('unable to find scopes dir'); + const scopeName = idParts[0]; + const componentName = idParts[1]; + let relativePath = filePath; + if (idParts.length > 2) { + relativePath = join(idParts.slice(2).join('/'), filePath); } - const idParts = parts[1].split('/'); - // [0] is the scope name - const name = idParts[1]; - return `@teambit/${name}`; + return { + scopeName, + componentName, + relativePath, + }; } -function getTargetDirName(resolveDir: string): string { - const parts = resolveDir.split('/scopes/'); - if (parts.length !== 2) { - throw new Error('unable to find scopes dir'); - } - return parts[1].split('/').join('.'); -} async function handleModulePath(args: OnResolveArgs, bundleDir: string) { const resolvedFilePath = require.resolve(args.path); console.log('🚀 ~ file: config-files-esbuild-plugin.ts:65 ~ handleModulePath ~ resolvedFilePath:', resolvedFilePath); @@ -105,18 +104,6 @@ async function handleModulePath(args: OnResolveArgs, bundleDir: string) { external: true, }; } -function replaceRelativePath(targetDirName: string, parsedPath: ParsedPath) { - if (parsedPath.dir === '.') { - return `./${targetDirName}/${parsedPath.base}`; - } - const relativePath = parsedPath.dir.split('/').slice(1).join('/'); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:110 ~ replaceRelativePath ~ parsedPath.dir:', parsedPath.dir); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:110 ~ replaceRelativePath ~ relativePath:', relativePath); - // parsedPath.dir = `./${targetDirName}/${parsedPath.dir.replace('./', '')}`; - parsedPath.dir = `./${targetDirName}/${relativePath}`; - const formatted = format(parsedPath); - return formatted; -} export const configFilesEsbuildPlugin = (bundleDir: string) => { return { From 78eac1c001e5e9126680db9f43447ee4e09e3553 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 18:00:12 +0300 Subject: [PATCH 34/89] handle more config files (also from node_modules) --- .../bit/bundle/config-files-esbuild-plugin.ts | 88 ++++++++++--------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 7353466e9c1d..32d790c4605e 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -10,9 +10,12 @@ type ParsedArgs = { function handleConfigFile(args: OnResolveArgs, bundleDir: string) { console.log('im here', args); + if (args.path.includes('html-docs-app')) { + console.log('this is me', args); + } if ( args.kind === 'require-resolve' && - args.importer.includes('/scopes/') && + (args.importer.includes('/scopes/') || args.importer.includes('node_modules/@teambit')) && // ignore templates we want to keep it as is !args.importer.includes('/templates/') ) { @@ -29,7 +32,7 @@ function handleConfigFile(args: OnResolveArgs, bundleDir: string) { async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const parsed = parse(args.path); console.log('parsed', parsed); - const { componentName, relativePath, scopeName } = parseArgs(args); + const { componentName, relativePath, scopeName } = await parseArgs(args); // const packageDirName = getPackageDirName(args.resolveDir); const packageDirName = `@teambit/${componentName}`; // const origFilePath = join(args.resolveDir, args.path); @@ -68,7 +71,30 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { }; } -function parseArgs(args: OnResolveArgs): ParsedArgs { +async function parseArgs(args: OnResolveArgs): Promise { + if (args.resolveDir.includes('/scopes/')) { + return parseArgsFromSrc(args); + } + return parseArgsFromNodeModules(args); +} +async function parseArgsFromNodeModules(args: OnResolveArgs): Promise { + const resolveDir = args.resolveDir; + const filePath = args.path; + const parts = resolveDir.split('/@teambit/'); + const idParts = parts[1].split('/'); + const componentName = idParts[0]; + const relativePath = filePath; + const packageJsonPath = join(parts[0], '@teambit', componentName, 'package.json'); + const jsonValue = await fs.readJson(packageJsonPath); + const scopeName = jsonValue.componentId.scope.replace('teambit.', ''); + return { + scopeName, + componentName, + relativePath: relativePath.replace('./', ''), + }; +} + +function parseArgsFromSrc(args: OnResolveArgs): ParsedArgs { const resolveDir = args.resolveDir; const filePath = args.path; const parts = resolveDir.split('/scopes/'); @@ -85,7 +111,7 @@ function parseArgs(args: OnResolveArgs): ParsedArgs { return { scopeName, componentName, - relativePath, + relativePath: relativePath.replace('./', ''), }; } @@ -116,6 +142,12 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /jest.config$/ }, (args) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /jest.cjs.config$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /jest.base.config$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); build.onResolve({ filter: /jest.worker$/ }, (args) => { return handleConfigFile(args, bundleDir); @@ -141,7 +173,7 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /webpackHotDevClient$/ }, (args) => { return handleConfigFile(args, bundleDir); }); - build.onResolve({ filter: /\/mount$/ }, (args) => { + build.onResolve({ filter: /mount$/ }, (args) => { return handleConfigFile(args, bundleDir); }); build.onResolve({ filter: /html-docs-app$/ }, (args) => { @@ -150,43 +182,15 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /\/preview.preview.runtime$/ }, (args) => { return handleConfigFile(args, bundleDir); }); - - // We also want to intercept all import paths inside downloaded - // files and resolve them against the original URL. All of these - // files will be in the "http-url" namespace. Make sure to keep - // the newly resolved URL in the "http-url" namespace so imports - // inside it will also be resolved as URLs recursively. - // build.onResolve({ filter: /.*/, namespace: 'http-url' }, args => ({ - // path: new URL(args.path, args.importer).toString(), - // namespace: 'http-url', - // })) - - // When a URL is loaded, we want to actually download the content - // from the internet. This has just enough logic to be able to - // handle the example import from unpkg.com but in reality this - // would probably need to be more complex. - // build.onLoad({ filter: /.*/, namespace: 'http-url' }, async (args) => { - // let contents = await new Promise((resolve, reject) => { - // function fetch(url) { - // console.log(`Downloading: ${url}`) - // let lib = url.startsWith('https') ? https : http - // let req = lib.get(url, res => { - // if ([301, 302, 307].includes(res.statusCode)) { - // fetch(new URL(res.headers.location, url).toString()) - // req.abort() - // } else if (res.statusCode === 200) { - // let chunks = [] - // res.on('data', chunk => chunks.push(chunk)) - // res.on('end', () => resolve(Buffer.concat(chunks))) - // } else { - // reject(new Error(`GET ${url} failed: status ${res.statusCode}`)) - // } - // }).on('error', reject) - // } - // fetch(args.path) - // }) - // return { contents } - // }) + build.onResolve({ filter: /setupTests$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /css-transform$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /file-transform$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); }, }; }; From cf83bdb75ada2c3df293fb607f97fc7004be2e3c Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 18:01:05 +0300 Subject: [PATCH 35/89] externalize more packages --- scopes/harmony/bit/bundle/esbuild.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index cd9f65f028ed..ebefc6e9f1ca 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -63,6 +63,9 @@ export function runEsbuild(outDir: string, appFile: string) { '@teambit/mdx.ui.mdx-scope-context', '@teambit/node/jest/jest.config', '@typescript-eslint/parser', + 'identity-obj-proxy', + 'jest-environment-jsdom', + 'react-app-polyfill/jsdom', 'assert/', 'babel-jest', 'babel-plugin-istanbul', From dcbfbac375ab9e98ceb382d8d4d1077ca22c1ba3 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 18:01:46 +0300 Subject: [PATCH 36/89] remove file extensions from jest config --- scopes/react/react/jest/jest.base.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scopes/react/react/jest/jest.base.config.js b/scopes/react/react/jest/jest.base.config.js index ba3b578f82e9..15f09b4c05f2 100644 --- a/scopes/react/react/jest/jest.base.config.js +++ b/scopes/react/react/jest/jest.base.config.js @@ -7,15 +7,15 @@ module.exports = { // "!src/**/*.d.ts" // ], setupFiles: [require.resolve('react-app-polyfill/jsdom')], - setupFilesAfterEnv: [require.resolve('./setupTests.js')], + setupFilesAfterEnv: [require.resolve('./setupTests')], // "testMatch": [ // "/src/**/__tests__/**/*.{js,jsx,ts,tsx}", // "/src/**/*.{spec,test}.{js,jsx,ts,tsx}" // ], testEnvironment: require.resolve('jest-environment-jsdom'), transform: { - '^.+\\.css$': require.resolve('./transformers/css-transform.js'), - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./transformers/file-transform.js'), + '^.+\\.css$': require.resolve('./transformers/css-transform'), + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./transformers/file-transform'), // '^(?!.*\\.(svg|png|jpg|jpeg|gif|webp|woff|ttf|woff2)$)': require.resolve('./file-transform.js'), }, transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx|cjs)$', '^.+\\.module\\.(css|sass|scss)$'], From 5efed4e1d1fb45c653c67e78c20d759659056dbf Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 24 Jul 2023 18:02:31 +0300 Subject: [PATCH 37/89] force some react env jest config bundling (hack) --- scopes/react/react/react.env.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scopes/react/react/react.env.ts b/scopes/react/react/react.env.ts index 19bf1ea06f08..8abe7bbecfb2 100644 --- a/scopes/react/react/react.env.ts +++ b/scopes/react/react/react.env.ts @@ -153,8 +153,17 @@ export class ReactEnv * @returns */ createCjsJestTester(jestConfigPath?: string, jestModulePath?: string): Tester { - const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', ''); - const defaultConfig = join(pathToSource, './jest/jest.cjs.config.js'); + // const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', ''); + // const defaultConfig = join(pathToSource, './jest/jest.cjs.config.js'); + // TODO: this is a hack to make sure the jest config is copied to the bundle folder + // we should make it a better way + // Force esbuild to copy this file + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const baseConfigPath = require.resolve('./jest/jest.base.config'); + // Force esbuild to copy require.resolve from this file + // eslint-disable-next-line global-require + const baseConfig = require('./jest/jest.base.config'); + const defaultConfig = require.resolve('./jest/jest.cjs.config'); const config = jestConfigPath || defaultConfig; return this.jestAspect.createTester(config, jestModulePath || require.resolve('jest')); } From d2ba72d8f759574a651973ba06de62f5fe59811c Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 13:40:00 +0300 Subject: [PATCH 38/89] clean logs --- .../bit/bundle/config-files-esbuild-plugin.ts | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 32d790c4605e..a890bbf4afc1 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -9,10 +9,6 @@ type ParsedArgs = { }; function handleConfigFile(args: OnResolveArgs, bundleDir: string) { - console.log('im here', args); - if (args.path.includes('html-docs-app')) { - console.log('this is me', args); - } if ( args.kind === 'require-resolve' && (args.importer.includes('/scopes/') || args.importer.includes('node_modules/@teambit')) && @@ -31,7 +27,6 @@ function handleConfigFile(args: OnResolveArgs, bundleDir: string) { async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const parsed = parse(args.path); - console.log('parsed', parsed); const { componentName, relativePath, scopeName } = await parseArgs(args); // const packageDirName = getPackageDirName(args.resolveDir); const packageDirName = `@teambit/${componentName}`; @@ -39,31 +34,15 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { // const relativePath = getFilePathRelativeToPackage(args.resolveDir, args.path); // TODO: dist is hard coded now which is not great const origFilePath = join(packageDirName, 'dist', relativePath); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:27 ~ handleRelativePath ~ origFilePath:', origFilePath); // const targetDirName = getTargetDirName(args.resolveDir); const targetDirName = `${scopeName}.${componentName}`; // const targetDir = join(bundleDir, targetDirName, parsed.dir); const targetDir = join(bundleDir, targetDirName, dirname(relativePath)); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:28 ~ handleRelativePath ~ targetDir:', targetDir); await fs.ensureDir(targetDir); const resolvedFilePath = require.resolve(origFilePath); - console.log( - '🚀 ~ file: config-files-esbuild-plugin.ts:32 ~ handleRelativePath ~ resolvedFilePath:', - resolvedFilePath - ); - console.log( - '🚀 ~ file: config-files-esbuild-plugin.ts:33 ~ handleRelativePath ~ join(targetDir, parsed.base):', - join(targetDir, parsed.base) - ); - console.log( - '🚀 ~ file: config-files-esbuild-plugin.ts:36 ~ handleRelativePath ~ basename(resolvedFilePath):', - basename(resolvedFilePath) - ); await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); // const newPath = replaceRelativePath(targetDirName, parsed); const newPath = `./${targetDirName}/${relativePath}`; - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:38 ~ handleRelativePath ~ newPath:', newPath); - return { path: newPath, namespace: 'bit-config-file', @@ -117,10 +96,8 @@ function parseArgsFromSrc(args: OnResolveArgs): ParsedArgs { async function handleModulePath(args: OnResolveArgs, bundleDir: string) { const resolvedFilePath = require.resolve(args.path); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:65 ~ handleModulePath ~ resolvedFilePath:', resolvedFilePath); const parsed = parse(args.path); const targetDir = join(bundleDir, 'node_modules', parsed.dir); - console.log('🚀 ~ file: config-files-esbuild-plugin.ts:67 ~ handleModulePath ~ targetDir:', targetDir); await fs.ensureDir(targetDir); await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); return { From f6315f3c14f282305acfdf8e122d390dfed87f62 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 13:40:24 +0300 Subject: [PATCH 39/89] output esbuild duration --- .../harmony/bit/bundle/esbuild-plugin-time.ts | 28 +++++++++++++++++++ scopes/harmony/bit/bundle/esbuild.ts | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 scopes/harmony/bit/bundle/esbuild-plugin-time.ts diff --git a/scopes/harmony/bit/bundle/esbuild-plugin-time.ts b/scopes/harmony/bit/bundle/esbuild-plugin-time.ts new file mode 100644 index 000000000000..ade1178ff04d --- /dev/null +++ b/scopes/harmony/bit/bundle/esbuild-plugin-time.ts @@ -0,0 +1,28 @@ +// Based on https://github.com/DasRed/esbuild-plugin-time/blob/main/src/index.js +import chalk from 'chalk'; + +export const timeEsbuildPlugin = (name) => { + return { + name: 'Log', + setup(build) { + let time; + + build.onStart(() => { + time = new Date(); + if (name) { + console.log(`Build started for ${chalk.green(name)}`); + } else { + console.log(`Build started`); + } + }); + + build.onEnd(() => { + if (name) { + console.log(`Build ended ${chalk.green(name)}: ${chalk.yellow(`${new Date() - time}ms`)}`); + } else { + console.log(`Build ended: ${chalk.yellow(`${new Date() - time}ms`)}`); + } + }); + }, + }; +}; diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index ebefc6e9f1ca..1e0f93f5ddf7 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -2,6 +2,7 @@ import { build } from 'esbuild'; import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; import { configFilesEsbuildPlugin } from './config-files-esbuild-plugin'; +import { timeEsbuildPlugin } from './esbuild-plugin-time'; export function runEsbuild(outDir: string, appFile: string) { // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); @@ -179,6 +180,7 @@ export function runEsbuild(outDir: string, appFile: string) { // { resourceRegExp: new RegExp('^browserify-zlib') }, ]), configFilesEsbuildPlugin(outDir), + timeEsbuildPlugin('Bit bundle'), ], loader: { '.png': 'binary', '.node': 'binary' }, }); From 465b11db8b885c9fbe0839a01075bdcc3155bf9b Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:49:17 +0300 Subject: [PATCH 40/89] create package.json with external deps --- .../harmony/bit/bundle/create-package-json.ts | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 scopes/harmony/bit/bundle/create-package-json.ts diff --git a/scopes/harmony/bit/bundle/create-package-json.ts b/scopes/harmony/bit/bundle/create-package-json.ts new file mode 100644 index 000000000000..becb14c80da3 --- /dev/null +++ b/scopes/harmony/bit/bundle/create-package-json.ts @@ -0,0 +1,129 @@ +import findUp from 'find-up'; +import { join } from 'path'; +import { get } from 'lodash'; +import fs from 'fs-extra'; +import { parse } from 'comment-json'; +import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { externals } from './externals'; + +let wsJsonc: any; +let packageJson: any; + +async function getWsRootDir() { + const consumerInfo = await getConsumerInfo(process.cwd()); + if (!consumerInfo) throw new Error('unable to find consumer'); + return consumerInfo.path; +} + +function getPackageJsonPath(wsRootDir: string) { + return join(wsRootDir, 'package.json'); +} + +function getWorkspaceJsoncPath(wsRootDir: string) { + return join(wsRootDir, 'workspace.jsonc'); +} + +function loadPackageJson(wsRootDir: string) { + const packageJsonPath = getPackageJsonPath(wsRootDir); + // eslint-disable-next-line import/no-dynamic-require, global-require + const pkgJson = require(packageJsonPath); + packageJson = pkgJson; +} + +function loadWsJsonc(wsRootDir: string) { + const wsJsoncPath = getWorkspaceJsoncPath(wsRootDir); + // eslint-disable-next-line import/no-dynamic-require, global-require + const content = fs.readFileSync(wsJsoncPath, 'utf8'); + const parsed = parse(content); + wsJsonc = parsed; +} + +function resolveFromWsJsonc(packageName: string): string | undefined { + const wsJsoncPolicy = wsJsonc['teambit.dependencies/dependency-resolver'].policy; + const wsJsoncDependencies = wsJsoncPolicy.dependencies; + const wsJsoncPeerDependencies = wsJsoncPolicy.peerDependencies; + if (!wsJsoncPolicy) return undefined; + const val = wsJsoncDependencies[packageName] || wsJsoncPeerDependencies[packageName]; + if (!val) return undefined; + const packageVersion = typeof val === 'string' ? val : val.version; + return packageVersion; +} + +function resolveFromPackageJson(packageName: string): string | undefined { + const packageVersion = + get(packageJson, ['dependencies', packageName]) || + get(packageJson, ['devDependencies', packageName]) || + get(packageJson, ['peerDependencies', packageName]); + return packageVersion; +} + +async function resolveFromNodeModules(packageName: string): Promise { + try { + const resolvedPath = require.resolve(packageName); + if (!resolvedPath) return undefined; + const packageJsonPath = findUp.sync('package.json', { cwd: resolvedPath }); + if (!packageJsonPath) return undefined; + // eslint-disable-next-line import/no-dynamic-require, global-require + const pkgJson = require(packageJsonPath); + if (pkgJson.name !== packageName) return undefined; + return pkgJson.version; + } catch (err) { + return undefined; + } +} + +function resolveHardCoded(packageName: string): string | undefined { + // TODO: resolve this in a better way + const hardCoded = { + assert: '2.0.0', + util: '0.12.3', + url: '0.11.0', + string_decoder: '1.3.0', + punycode: '2.1.1', + 'react-app-polyfill': '1.0.6', + }; + return hardCoded[packageName]; +} + +async function resolveExternalVersion(packageName: string) { + const hardCodedVersion = resolveHardCoded(packageName); + if (hardCodedVersion) return hardCodedVersion; + const wsJsoncVersion = resolveFromWsJsonc(packageName); + if (wsJsoncVersion) return wsJsoncVersion; + const packageJsonVersion = resolveFromPackageJson(packageName); + if (packageJsonVersion) return packageJsonVersion; + const nodeModulesVersion = await resolveFromNodeModules(packageName); + if (nodeModulesVersion) return nodeModulesVersion; + return undefined; +} + +const getPackageName = (packageName: string) => { + const parts = packageName.split('/'); + if (parts.length === 1) return parts[0]; + if (!parts[0].startsWith('@')) return parts[0]; + return `${parts[0]}/${parts[1]}`; +}; + +export async function generatePackageJson(bundleDir: string) { + const wsRootDir = await getWsRootDir(); + loadPackageJson(wsRootDir); + loadWsJsonc(wsRootDir); + const deps = {}; + const depsP = externals.map(async (packageName) => { + const name = getPackageName(packageName); + const version = await resolveExternalVersion(name); + if (!version) { + console.log(`unable to resolve version for ${name}`); + return; + } + deps[name] = version; + }); + await Promise.all(depsP); + const finalPackageJson = { + name: 'bundle', + version: '0.0.0', + dependencies: deps, + }; + const packageJsonPath = join(bundleDir, 'package.json'); + fs.writeFileSync(packageJsonPath, JSON.stringify(finalPackageJson, null, 2)); +} From 1775e68a7168fcbdb31ca83ce30bd842196e9ca1 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:49:39 +0300 Subject: [PATCH 41/89] generate npmrc with bit's registry --- scopes/harmony/bit/bundle/generate-npmrc.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 scopes/harmony/bit/bundle/generate-npmrc.ts diff --git a/scopes/harmony/bit/bundle/generate-npmrc.ts b/scopes/harmony/bit/bundle/generate-npmrc.ts new file mode 100644 index 000000000000..319ed50503dd --- /dev/null +++ b/scopes/harmony/bit/bundle/generate-npmrc.ts @@ -0,0 +1,9 @@ +import { writeFileSync } from 'fs-extra'; +import { join } from 'path'; + +const content = `@teambit:registry=https://node-registry.bit.cloud`; + +export function generateNpmrc(bundleDir: string) { + const filePath = join(bundleDir, '.npmrc'); + writeFileSync(filePath, content); +} From 4a342a667c938694f083616d8016e2f957ae4fb8 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:50:08 +0300 Subject: [PATCH 42/89] copy pacakge.json of core aspects --- .../bundle/generate-core-aspects-modules.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index 90ffec18b5e5..e30d43368a02 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -1,3 +1,4 @@ +import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; import camelcase from 'camelcase'; import { getCoreAspectName, getCoreAspectPackageName } from '@teambit/aspect-loader'; import fs from 'fs-extra'; @@ -5,7 +6,17 @@ import { join } from 'path'; import { coreAspectsIds } from '../core-aspects-ids'; -export function generateCoreAspectsModules(bundleDir: string, appName: string) { +let wsRootDir: string; + +async function loadWsRootDir() { + const consumerInfo = await getConsumerInfo(process.cwd()); + if (!consumerInfo) throw new Error('unable to find consumer'); + wsRootDir = consumerInfo.path; + return consumerInfo.path; +} + +export async function generateCoreAspectsModules(bundleDir: string, appName: string) { + await loadWsRootDir(); const generateOneAspectP = coreAspectsIds.map((id) => { const name = getCoreAspectName(id); const packageName = getCoreAspectPackageName(id); @@ -19,11 +30,22 @@ export function generateCoreAspectsModules(bundleDir: string, appName: string) { async function handleOneAspect(bundleDir: string, name: string, packageName: string, appName: string) { const dirPath = join(bundleDir, 'node_modules', packageName); await fs.ensureDir(dirPath); + await generateIndexFile(dirPath, name, appName); + await copyPackageJson(dirPath, packageName); +} + +async function generateIndexFile(dirPath: string, name: string, appName: string) { const indexFilePath = join(dirPath, 'index.js'); const indexFileContent = getIndexContent(name, appName); return fs.outputFile(indexFilePath, indexFileContent); } +async function copyPackageJson(dirPath: string, packageName: string) { + const packageJsonPath = join(wsRootDir, 'node_modules', packageName, 'package.json'); + const targetPath = join(dirPath, 'package.json'); + return fs.copyFile(packageJsonPath, targetPath); +} + function getIndexContent(name: string, appName: string) { const camelName = camelcase(name); return ` From 8cdda40b8fee3fd9adccaaf62b5c1d2987694e28 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:50:28 +0300 Subject: [PATCH 43/89] move externals to a dedicated file --- scopes/harmony/bit/bundle/esbuild.ts | 107 +------------------------ scopes/harmony/bit/bundle/externals.ts | 104 ++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 105 deletions(-) create mode 100644 scopes/harmony/bit/bundle/externals.ts diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index 1e0f93f5ddf7..1ed5ca76ed47 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -3,6 +3,7 @@ import ignorePlugin from 'esbuild-plugin-ignore'; import { join } from 'path'; import { configFilesEsbuildPlugin } from './config-files-esbuild-plugin'; import { timeEsbuildPlugin } from './esbuild-plugin-time'; +import { externals } from './externals'; export function runEsbuild(outDir: string, appFile: string) { // const _outfile = join('/Users/giladshoham/dev/temp/bundle-bit/output', `${appFile}.js`); @@ -30,111 +31,7 @@ export function runEsbuild(outDir: string, appFile: string) { outfile: _outfile, // inject: [join(__dirname, './import-meta-url.js')], - external: [ - // 'jest.worker', - 'yoga-layout', - 'yoga-layout-prebuilt', - '@surma/rollup-plugin-off-main-thread', - '@babel/preset-react', - 'ink', - 'rrweb-cssom', - 'canvas', - 'style-loader', - 'mini-css-extract-plugin', - '@prerenderer/renderer-jsdom', - '@pmmmwh/react-refresh-webpack-plugin', - '@teambit/react.babel.bit-react-transformer', - 'source-map-loader', - 'babel-loader', - 'react-refresh/babel', - 'babel-loader', - '@babel/preset-react', - '@babel/preset-env', - 'react-refresh/babel', - '@teambit/mdx.modules.mdx-loader', - '@swc/core', - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-decorators', - '@babel/plugin-proposal-object-rest-spread', - '@babel/plugin-syntax-typescript', - '@babel/plugin-transform-modules-commonjs', - '@babel/plugin-transform-runtime', - '@babel/preset-typescript', - '@mdx-js/react', - '@teambit/mdx.ui.mdx-scope-context', - '@teambit/node/jest/jest.config', - '@typescript-eslint/parser', - 'identity-obj-proxy', - 'jest-environment-jsdom', - 'react-app-polyfill/jsdom', - 'assert/', - 'babel-jest', - 'babel-plugin-istanbul', - 'babel-plugin-transform-typescript-metadata', - 'babel-preset-current-node-syntax', - 'babel-preset-jest', - 'babel-preset-react-app/webpack-overrides', - 'browserify-zlib', - 'buffer/', - 'constants-browserify', - 'crypto-browserify', - 'css-loader', - 'domain-browser', - 'eslint-config-airbnb-typescript', - 'eslint-config-prettier', - 'espree', - 'expose-loader', - 'https-browserify', - 'jest', - 'jest-circus/runner', - 'jest-jasmine2', - 'less-loader', - 'os-browserify/browser', - 'path-browserify', - 'postcss-flexbugs-fixes', - 'postcss-loader', - 'postcss-normalize', - 'process/browser', - 'punycode/', - 'querystring-es3', - 'react', - 'react-dom', - 'react-dom/server', - 'react/jsx-dev-runtime.js', - 'react/jsx-runtime.js', - 'resolve-url-loader', - 'sass-loader', - 'stream-browserify', - 'stream-http', - 'string_decoder/', - 'timers-browserify', - 'tty-browserify', - 'url/', - 'util/', - 'vm-browserify', - 'watchpack', - 'webpack/hot/dev-server', - 'webpack/hot/only-dev-server', - 'source-map-support', - 'css-minimizer-webpack-plugin', - 'html-webpack-plugin', - 'jest-worker', - 'mocha', - 'rollup-plugin-terser', - 'terser-webpack-plugin', - 'uglify-js', - 'uid-number', - 'webpack-dev-server', - '@svgr/webpack', - 'new-url-loader', - 'react-native-web', - '@teambit/react.eslint-config-bit-react', - '@teambit/react.ui.docs-app', - '@teambit/react.ui.compositions-app', - 'babel-preset-react-app', - // 'esbuild' - // 'mime' - ], + external: externals, plugins: [ // sassPlugin(), ignorePlugin([ diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts new file mode 100644 index 000000000000..c50bd2d8f9ac --- /dev/null +++ b/scopes/harmony/bit/bundle/externals.ts @@ -0,0 +1,104 @@ +export const externals = [ + // 'jest.worker', + 'yoga-layout', + 'yoga-layout-prebuilt', + '@surma/rollup-plugin-off-main-thread', + '@babel/preset-react', + 'ink', + 'rrweb-cssom', + 'canvas', + 'style-loader', + 'mini-css-extract-plugin', + '@prerenderer/renderer-jsdom', + '@pmmmwh/react-refresh-webpack-plugin', + '@teambit/react.babel.bit-react-transformer', + 'source-map-loader', + 'babel-loader', + 'react-refresh/babel', + 'babel-loader', + '@babel/preset-react', + '@babel/preset-env', + '@teambit/mdx.modules.mdx-loader', + '@swc/core', + '@babel/plugin-proposal-class-properties', + '@babel/plugin-proposal-decorators', + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-syntax-typescript', + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-transform-runtime', + '@babel/preset-typescript', + '@mdx-js/react', + '@teambit/mdx.ui.mdx-scope-context', + '@teambit/node/jest/jest.config', + '@typescript-eslint/parser', + 'identity-obj-proxy', + 'jest-environment-jsdom', + 'react-app-polyfill/jsdom', + 'assert/', + 'babel-jest', + 'babel-plugin-istanbul', + 'babel-plugin-transform-typescript-metadata', + 'babel-preset-current-node-syntax', + 'babel-preset-jest', + 'babel-preset-react-app/webpack-overrides', + 'browserify-zlib', + 'buffer/', + 'constants-browserify', + 'crypto-browserify', + 'css-loader', + 'domain-browser', + 'eslint-config-airbnb-typescript', + 'eslint-config-prettier', + 'espree', + 'expose-loader', + 'https-browserify', + 'jest', + 'jest-circus/runner', + 'jest-jasmine2', + 'less-loader', + 'os-browserify/browser', + 'path-browserify', + 'postcss-flexbugs-fixes', + 'postcss-loader', + 'postcss-normalize', + 'process/browser', + 'punycode/', + 'querystring-es3', + 'react', + 'react-dom', + 'react-dom/server', + 'react/jsx-dev-runtime.js', + 'react/jsx-runtime.js', + 'resolve-url-loader', + 'sass-loader', + 'stream-browserify', + 'stream-http', + 'string_decoder/', + 'timers-browserify', + 'tty-browserify', + 'url/', + 'util/', + 'vm-browserify', + 'watchpack', + 'webpack/hot/dev-server', + 'webpack/hot/only-dev-server', + 'source-map-support', + 'css-minimizer-webpack-plugin', + 'html-webpack-plugin', + 'jest-worker', + 'mocha', + 'rollup-plugin-terser', + 'terser-webpack-plugin', + 'uglify-js', + 'uid-number', + 'webpack-dev-server', + '@svgr/webpack', + 'new-url-loader', + 'react-native-web', + '@teambit/react.eslint-config-bit-react', + '@teambit/react.ui.docs-app', + '@teambit/react.ui.compositions-app', + 'babel-preset-react-app', + // 'esbuild' + // 'mime' +]; From a640fa5e65d134106a1183f9ced37f192b8b855a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:50:43 +0300 Subject: [PATCH 44/89] update main flow --- scopes/harmony/bit/bundle/bundle.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 471cd02b3daa..d7c637dc085e 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -1,11 +1,16 @@ import { runEsbuild } from './esbuild'; import { generateCoreAspectsBarrelFile } from './generate-core-aspects-exports'; import { generateCoreAspectsModules } from './generate-core-aspects-modules'; +import { generatePackageJson } from './create-package-json'; +import { generateNpmrc } from './generate-npmrc'; -const outDir = '/Users/giladshoham/dev/bit/bit/bundle'; +// const outDir = '/Users/giladshoham/dev/bit/bit/bundle'; +const outDir = '/tmp/bit-bundle'; const appFile = 'bit.app.js'; async function runBundle() { + generateNpmrc(outDir); + await generatePackageJson(outDir); await generateCoreAspectsBarrelFile(); const esbuildRes = await runEsbuild(outDir, appFile); await generateCoreAspectsModules(outDir, appFile); From ed4c5236ca724eced0a4e44dd5803efaf326da7c Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 15:50:52 +0300 Subject: [PATCH 45/89] update readme --- scopes/harmony/bit/bundle/readme.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/bit/bundle/readme.md b/scopes/harmony/bit/bundle/readme.md index 1d41b9eadc2f..f25a0c5d2d82 100644 --- a/scopes/harmony/bit/bundle/readme.md +++ b/scopes/harmony/bit/bundle/readme.md @@ -12,6 +12,9 @@ node /bit/bundle/bit.app.js ## structure +1. generate-npmrc.ts - generate an npmrc file with the bit registry + (so you can install external packages with regular pcaakge manager) +1. create-package-json.ts - generate a package.json file with all external packages 1. bundle.ts - main file to generate the bundle -2. esbuild.ts - running the esbuild bundler -3. generate-core-aspects-exports - This will generate a file that exports all the core aspects +1. esbuild.ts - running the esbuild bundler +1. generate-core-aspects-exports - This will generate a file that exports all the core aspects From d0b7dcb92713debfb5f64b49e0b64fc4b7ec988a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 26 Jul 2023 16:07:03 +0300 Subject: [PATCH 46/89] add missing core aspects --- .../harmony/bit/bundle/generate-core-aspects-modules.ts | 8 +++++--- scopes/harmony/bit/core-aspects-exports.ts | 2 ++ scopes/harmony/bit/core-aspects-ids.ts | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index e30d43368a02..4d6c0e936a67 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -31,7 +31,7 @@ async function handleOneAspect(bundleDir: string, name: string, packageName: str const dirPath = join(bundleDir, 'node_modules', packageName); await fs.ensureDir(dirPath); await generateIndexFile(dirPath, name, appName); - await copyPackageJson(dirPath, packageName); + await generatePackageJson(dirPath, packageName); } async function generateIndexFile(dirPath: string, name: string, appName: string) { @@ -40,10 +40,12 @@ async function generateIndexFile(dirPath: string, name: string, appName: string) return fs.outputFile(indexFilePath, indexFileContent); } -async function copyPackageJson(dirPath: string, packageName: string) { +async function generatePackageJson(dirPath: string, packageName: string) { const packageJsonPath = join(wsRootDir, 'node_modules', packageName, 'package.json'); const targetPath = join(dirPath, 'package.json'); - return fs.copyFile(packageJsonPath, targetPath); + const origPackageJson = await fs.readJson(packageJsonPath); + origPackageJson.main = 'index.js'; + return fs.writeJson(targetPath, origPackageJson, { spaces: 2 }); } function getIndexContent(name: string, appName: string) { diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts index 38eb8c1032ed..d42d55cb6f7a 100644 --- a/scopes/harmony/bit/core-aspects-exports.ts +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -1,4 +1,6 @@ // This file is auto generated by generate-core-aspects-exports.ts +export * as bit from '@teambit/bit'; +export * as config from '@teambit/config'; export * as aspectLoader from '@teambit/aspect-loader'; export * as cli from '@teambit/cli'; export * as devFiles from '@teambit/dev-files'; diff --git a/scopes/harmony/bit/core-aspects-ids.ts b/scopes/harmony/bit/core-aspects-ids.ts index 93fa9b2e922d..ecaa197cfa69 100644 --- a/scopes/harmony/bit/core-aspects-ids.ts +++ b/scopes/harmony/bit/core-aspects-ids.ts @@ -1,5 +1,7 @@ // TODO: combine this with the manifests somehow export const coreAspectsIds = [ + 'teambit.harmony/bit', + 'teambit.harmony/config', 'teambit.harmony/aspect-loader', 'teambit.harmony/cli', 'teambit.component/dev-files', From c0c702a127c823c9fd7d75dc26ca0f8b579323ef Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 27 Jul 2023 10:24:52 +0300 Subject: [PATCH 47/89] add bundle script --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 4136767ebb2b..f5be74198959 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "bit-hub-test-circle": "mocha --require ./babel-register --reporter mocha-circleci-reporter ./e2e/bit-hub/*.ts", "clean": "rm -rf dist && rm -rf types", "build": "npm run build:src", + "bundle": "node node_modules/@teambit/bit/dist/bundle/bundle.js", "build:types": "./scripts/build-types.bash", "build:types:windows": ".\\scripts\\build-types.bat", "link-bit-legacy": "node ./scripts/link-bit-legacy.js", From 798d9c878847f3a5d911e6c6015a4fc26ae7f774 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 7 Aug 2023 15:15:14 +0300 Subject: [PATCH 48/89] trying tsup --- scopes/harmony/bit/bundle/bundle.ts | 18 ++++++----- scopes/harmony/bit/bundle/externals.ts | 1 + scopes/harmony/bit/bundle/tsup.ts | 41 ++++++++++++++++++++++++++ workspace.jsonc | 3 +- 4 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 scopes/harmony/bit/bundle/tsup.ts diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index d7c637dc085e..5bf6768e8572 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -3,18 +3,22 @@ import { generateCoreAspectsBarrelFile } from './generate-core-aspects-exports'; import { generateCoreAspectsModules } from './generate-core-aspects-modules'; import { generatePackageJson } from './create-package-json'; import { generateNpmrc } from './generate-npmrc'; +import { runTsup } from './tsup'; -// const outDir = '/Users/giladshoham/dev/bit/bit/bundle'; -const outDir = '/tmp/bit-bundle'; +// const rootOutDir = '/Users/giladshoham/dev/bit/bit/bundle'; +const rootOutDir = '/tmp/bit-bundle'; +const bundleDir = `${rootOutDir}/bundle`; const appFile = 'bit.app.js'; async function runBundle() { - generateNpmrc(outDir); - await generatePackageJson(outDir); + // const esbuildRes = await runEsbuild(rootOutDir, appFile); + const tsupRes = await runTsup(bundleDir, appFile); + await generateCoreAspectsModules(rootOutDir, appFile); + generateNpmrc(rootOutDir); + await generatePackageJson(rootOutDir); await generateCoreAspectsBarrelFile(); - const esbuildRes = await runEsbuild(outDir, appFile); - await generateCoreAspectsModules(outDir, appFile); - return esbuildRes; + // return esbuildRes; + return tsupRes; } runBundle().then((res) => console.log(JSON.stringify(res, null, 2))); diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index c50bd2d8f9ac..3ab99b02631f 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -99,6 +99,7 @@ export const externals = [ '@teambit/react.ui.docs-app', '@teambit/react.ui.compositions-app', 'babel-preset-react-app', + 'tippy.js', // 'esbuild' // 'mime' ]; diff --git a/scopes/harmony/bit/bundle/tsup.ts b/scopes/harmony/bit/bundle/tsup.ts new file mode 100644 index 000000000000..731da3933372 --- /dev/null +++ b/scopes/harmony/bit/bundle/tsup.ts @@ -0,0 +1,41 @@ +import ignorePlugin from 'esbuild-plugin-ignore'; +import { build, Options, defineConfig } from 'tsup'; +import { configFilesEsbuildPlugin } from './config-files-esbuild-plugin'; +import { timeEsbuildPlugin } from './esbuild-plugin-time'; +import { externals } from './externals'; + +export async function runTsup(outDir: string, appFile: string) { + const opts: Options = { + entry: ['/Users/giladshoham/dev/bit/bit/scopes/harmony/bit/app.ts'], + splitting: false, + sourcemap: true, + clean: true, + dts: true, + format: ['cjs'], + target: 'node18', + outDir, + platform: 'node', + external: externals, + keepNames: true, + esbuildPlugins: [ + ignorePlugin([ + // { resourceRegExp: /(.*)\.ui\.runtime\.*/g }, + { resourceRegExp: /\.(s[ac]ss|css)$/ }, + { resourceRegExp: /\.(mdx)$/ }, + { resourceRegExp: /\.(md)$/ }, + { resourceRegExp: new RegExp('^jest-resolve') }, + { resourceRegExp: new RegExp('^@vue/compiler-sfc') }, + { resourceRegExp: new RegExp('^batch') }, + { resourceRegExp: new RegExp('^../build/Release/cpufeatures.node') }, + { resourceRegExp: new RegExp('^pnpapi') }, + { resourceRegExp: new RegExp('^esbuild') }, + ]), + configFilesEsbuildPlugin(outDir), + timeEsbuildPlugin('Bit bundle'), + ], + esbuildOptions(options, context) { + options.define['process.env.BIT_LOG'] = '"debug"'; + }, + }; + return build(opts); +} diff --git a/workspace.jsonc b/workspace.jsonc index 571791b0b918..77ec6a04b7b0 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -373,6 +373,7 @@ "tempy": "1.0.1", "terser-webpack-plugin": "5.2.0", "tippy.js": "6.2.7", + "tsup": "7.2.0", "ua-parser-js": "0.7.24", "unist-util-remove": "2.0.1", "unist-util-visit": "2.0.3", @@ -1003,4 +1004,4 @@ "teambit.react/react": "-" } } -} \ No newline at end of file +} From c41f2e6f7b8d6fbffe085427eb4d5221b592882c Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 7 Aug 2023 15:15:40 +0300 Subject: [PATCH 49/89] ensure folder exists --- scopes/harmony/bit/bundle/generate-npmrc.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/generate-npmrc.ts b/scopes/harmony/bit/bundle/generate-npmrc.ts index 319ed50503dd..80d1b0360ef7 100644 --- a/scopes/harmony/bit/bundle/generate-npmrc.ts +++ b/scopes/harmony/bit/bundle/generate-npmrc.ts @@ -1,9 +1,10 @@ -import { writeFileSync } from 'fs-extra'; +import { ensureDirSync, writeFileSync } from 'fs-extra'; import { join } from 'path'; const content = `@teambit:registry=https://node-registry.bit.cloud`; export function generateNpmrc(bundleDir: string) { + ensureDirSync(bundleDir); const filePath = join(bundleDir, '.npmrc'); writeFileSync(filePath, content); } From ced0b86a1cf86408cf3220a3477f134fc76254da Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 13 Aug 2023 12:56:15 +0300 Subject: [PATCH 50/89] move back to esbuild --- scopes/harmony/bit/bundle/bundle.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 5bf6768e8572..26e90fee7f85 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -11,14 +11,14 @@ const bundleDir = `${rootOutDir}/bundle`; const appFile = 'bit.app.js'; async function runBundle() { - // const esbuildRes = await runEsbuild(rootOutDir, appFile); - const tsupRes = await runTsup(bundleDir, appFile); + const esbuildRes = await runEsbuild(bundleDir, appFile); + // const tsupRes = await runTsup(bundleDir, appFile); await generateCoreAspectsModules(rootOutDir, appFile); generateNpmrc(rootOutDir); await generatePackageJson(rootOutDir); await generateCoreAspectsBarrelFile(); - // return esbuildRes; - return tsupRes; + return esbuildRes; + // return tsupRes; } runBundle().then((res) => console.log(JSON.stringify(res, null, 2))); From a08f3767a7de46f8c6de3755989d1500c3b7a8d6 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 16:55:31 +0300 Subject: [PATCH 51/89] add more externals --- scopes/harmony/bit/bundle/externals.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index 3ab99b02631f..fbf1bf80a59e 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -1,5 +1,6 @@ export const externals = [ // 'jest.worker', + 'browserslist', 'yoga-layout', 'yoga-layout-prebuilt', '@surma/rollup-plugin-off-main-thread', @@ -16,6 +17,7 @@ export const externals = [ 'babel-loader', 'react-refresh/babel', 'babel-loader', + '@babel/runtime', '@babel/preset-react', '@babel/preset-env', '@teambit/mdx.modules.mdx-loader', @@ -86,6 +88,7 @@ export const externals = [ 'css-minimizer-webpack-plugin', 'html-webpack-plugin', 'jest-worker', + 'jest-environment-node', 'mocha', 'rollup-plugin-terser', 'terser-webpack-plugin', From e707df979698a5dd1ab18c0991e415b3cbc33f99 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 16:56:04 +0300 Subject: [PATCH 52/89] update browserslist version --- workspace.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace.jsonc b/workspace.jsonc index ec005b4fa54a..c937640f2c43 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -844,7 +844,7 @@ "@apollo/client": "3.6.9", "@teambit/legacy": "1.0.540", "graphql": "15.8.0", - "browserslist": "4.16.3", + "browserslist": "4.21.10", "reflect-metadata": "0.1.13", "monaco-editor": "0.33.0", "mz": "2.7.0", From 953986c77bf5d8069274b96fd7d4c8d6a252bcbb Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 16:56:21 +0300 Subject: [PATCH 53/89] add copy files of core aspects --- scopes/harmony/bit/bundle/bundle.ts | 2 + .../bit/bundle/copy-files-of-core-aspects.ts | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 26e90fee7f85..91fafff453c6 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -4,6 +4,7 @@ import { generateCoreAspectsModules } from './generate-core-aspects-modules'; import { generatePackageJson } from './create-package-json'; import { generateNpmrc } from './generate-npmrc'; import { runTsup } from './tsup'; +import { copyFilesOfCoreAspects } from './copy-files-of-core-aspects'; // const rootOutDir = '/Users/giladshoham/dev/bit/bit/bundle'; const rootOutDir = '/tmp/bit-bundle'; @@ -14,6 +15,7 @@ async function runBundle() { const esbuildRes = await runEsbuild(bundleDir, appFile); // const tsupRes = await runTsup(bundleDir, appFile); await generateCoreAspectsModules(rootOutDir, appFile); + await copyFilesOfCoreAspects(rootOutDir); generateNpmrc(rootOutDir); await generatePackageJson(rootOutDir); await generateCoreAspectsBarrelFile(); diff --git a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts new file mode 100644 index 000000000000..d4415d3786bd --- /dev/null +++ b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts @@ -0,0 +1,44 @@ +import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { getCoreAspectPackageName } from '@teambit/aspect-loader'; +import fs from 'fs-extra'; +import { join } from 'path'; + +const FILES_TO_COPY = { + 'teambit.react/react': ['jest/jest.cjs.config.js'], +}; + +let wsRootDir: string; + +async function loadWsRootDir() { + const consumerInfo = await getConsumerInfo(process.cwd()); + if (!consumerInfo) throw new Error('unable to find consumer'); + wsRootDir = consumerInfo.path; + return consumerInfo.path; +} + +export async function copyFilesOfCoreAspects(bundleDir: string) { + await loadWsRootDir(); + const coreAspectsIds = Object.keys(FILES_TO_COPY); + const generateOneAspectP = coreAspectsIds.map((id) => { + const packageName = getCoreAspectPackageName(id); + const files = FILES_TO_COPY[id]; + return handleOneAspect(bundleDir, packageName, files); + }); + return Promise.all(generateOneAspectP); +} + +async function handleOneAspect(bundleDir: string, packageName: string, files: string[]) { + const srcDir = join(wsRootDir, 'node_modules', packageName); + const targetDir = join(bundleDir, 'node_modules', packageName); + await Promise.all( + files.map(async (file) => { + return handleOneFile(srcDir, targetDir, file); + }) + ); +} + +async function handleOneFile(srcDir: string, targetDir: string, file: string) { + const srcPath = join(srcDir, file); + const targetPath = join(targetDir, file); + return fs.copy(srcPath, targetPath); +} From 34490c3576f41311239efcf0f4ac00680d335f37 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 17:03:10 +0300 Subject: [PATCH 54/89] improve copy files for core aspects --- scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts index d4415d3786bd..bc235dd51412 100644 --- a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts +++ b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts @@ -4,7 +4,7 @@ import fs from 'fs-extra'; import { join } from 'path'; const FILES_TO_COPY = { - 'teambit.react/react': ['jest/jest.cjs.config.js'], + 'teambit.react/react': ['jest'], }; let wsRootDir: string; @@ -40,5 +40,9 @@ async function handleOneAspect(bundleDir: string, packageName: string, files: st async function handleOneFile(srcDir: string, targetDir: string, file: string) { const srcPath = join(srcDir, file); const targetPath = join(targetDir, file); + const exists = await fs.pathExists(targetPath); + if (exists) { + await fs.remove(targetPath); + } return fs.copy(srcPath, targetPath); } From dc2b486e19f82eb6c62e502a911fff05de318319 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 17:49:49 +0300 Subject: [PATCH 55/89] improve copy files --- scopes/harmony/bit/bundle/bundle.ts | 2 +- .../bit/bundle/copy-files-of-core-aspects.ts | 58 +++++++++++++++---- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 91fafff453c6..882232c36536 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -15,7 +15,7 @@ async function runBundle() { const esbuildRes = await runEsbuild(bundleDir, appFile); // const tsupRes = await runTsup(bundleDir, appFile); await generateCoreAspectsModules(rootOutDir, appFile); - await copyFilesOfCoreAspects(rootOutDir); + await copyFilesOfCoreAspects(rootOutDir, bundleDir); generateNpmrc(rootOutDir); await generatePackageJson(rootOutDir); await generateCoreAspectsBarrelFile(); diff --git a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts index bc235dd51412..5b89992a92be 100644 --- a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts +++ b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts @@ -3,8 +3,20 @@ import { getCoreAspectPackageName } from '@teambit/aspect-loader'; import fs from 'fs-extra'; import { join } from 'path'; +type Item = { + paths: string[]; + targets: string[]; +}; + const FILES_TO_COPY = { - 'teambit.react/react': ['jest'], + 'teambit.react/react': [ + { + paths: ['jest'], + // package - copy to "rootOutDir/node_modules/packageName" + // configs-dir - "rootOutDir/bundle-dir/{scopeName}.{aspectName}" + targets: ['package', 'configs-dir'], + }, + ], }; let wsRootDir: string; @@ -16,30 +28,54 @@ async function loadWsRootDir() { return consumerInfo.path; } -export async function copyFilesOfCoreAspects(bundleDir: string) { +export async function copyFilesOfCoreAspects(rootOutDir: string, bundleDir: string) { await loadWsRootDir(); const coreAspectsIds = Object.keys(FILES_TO_COPY); const generateOneAspectP = coreAspectsIds.map((id) => { const packageName = getCoreAspectPackageName(id); - const files = FILES_TO_COPY[id]; - return handleOneAspect(bundleDir, packageName, files); + return handleOneAspect(id, rootOutDir, bundleDir, packageName); }); return Promise.all(generateOneAspectP); } -async function handleOneAspect(bundleDir: string, packageName: string, files: string[]) { +async function handleOneAspect(aspectId: string, rootOutDir: string, bundleDir: string, packageName: string) { + const items = FILES_TO_COPY[aspectId]; const srcDir = join(wsRootDir, 'node_modules', packageName); - const targetDir = join(bundleDir, 'node_modules', packageName); + const packageTargetDir = join(rootOutDir, 'node_modules', packageName); + const configDirName = getConfigDirName(aspectId); + const configDirTargetDir = join(bundleDir, configDirName); await Promise.all( - files.map(async (file) => { - return handleOneFile(srcDir, targetDir, file); + items.map(async (item) => { + return handleOneItem(item, srcDir, packageTargetDir, configDirTargetDir); }) ); } -async function handleOneFile(srcDir: string, targetDir: string, file: string) { - const srcPath = join(srcDir, file); - const targetPath = join(targetDir, file); +function getConfigDirName(aspectId: string): string { + const parts = aspectId.split('/'); + const [, scopeName] = parts[0].split('.'); + return `${scopeName}.${parts[1]}`; +} + +async function handleOneItem(item: Item, srcDir: string, packageTargetDir: string, configDirTargetDir: string) { + const { paths, targets } = item; + const copyP = paths.flatMap((path) => { + return targets.map((target) => { + if (target === 'package') { + return handleOnePath(srcDir, packageTargetDir, path); + } + if (target === 'configs-dir') { + return handleOnePath(srcDir, configDirTargetDir, path); + } + return Promise.reject(new Error(`unknown target ${target}`)); + }); + }); + return Promise.all(copyP); +} + +async function handleOnePath(srcDir: string, targetDir: string, path: string) { + const srcPath = join(srcDir, path); + const targetPath = join(targetDir, path); const exists = await fs.pathExists(targetPath); if (exists) { await fs.remove(targetPath); From 5c6bd02112079633e1d5d025d70057fb3bf86770 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 18:05:32 +0300 Subject: [PATCH 56/89] improve core aspect path calc --- scopes/harmony/aspect-loader/core-aspects.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/aspect-loader/core-aspects.ts b/scopes/harmony/aspect-loader/core-aspects.ts index a13a43380210..398816603e55 100644 --- a/scopes/harmony/aspect-loader/core-aspects.ts +++ b/scopes/harmony/aspect-loader/core-aspects.ts @@ -1,6 +1,6 @@ import { BitError } from '@teambit/bit-error'; import { existsSync, readdir } from 'fs-extra'; -import { join, resolve } from 'path'; +import { basename, dirname, join, resolve } from 'path'; import { Config } from '@teambit/bvm.config'; let _bvmConfig; @@ -15,13 +15,26 @@ function getAspectDirFromPath(id: string, pathsToResolveAspects?: string[]): str } else { moduleDirectory = require.resolve(packageName); } - const dirPath = join(moduleDirectory, '../..'); // to remove the "index.js" at the end + const dirPath = getCoreAspectDirFromPath(moduleDirectory); if (!existsSync(dirPath)) { throw new Error(`unable to find ${aspectName} in ${dirPath}`); } return dirPath; } +function getCoreAspectDirFromPath(resolvedModulesPath: string): string { + if (!resolvedModulesPath.includes('@teambit')) { + throw new Error(`unable to find core aspect in ${resolvedModulesPath}`); + } + let currentDir = resolvedModulesPath; + let parentDir = dirname(currentDir); + while (basename(parentDir) !== '@teambit') { + currentDir = parentDir; + parentDir = dirname(currentDir); + } + return currentDir; +} + export function getAspectDir(id: string): string { const aspectName = getCoreAspectName(id); let dirPath; From 540b342c41cd43379839cbb46b15539a2559f872 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 18:19:18 +0300 Subject: [PATCH 57/89] derefrence copied files --- scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts index 5b89992a92be..39f6561e0c4e 100644 --- a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts +++ b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts @@ -80,5 +80,5 @@ async function handleOnePath(srcDir: string, targetDir: string, path: string) { if (exists) { await fs.remove(targetPath); } - return fs.copy(srcPath, targetPath); + return fs.copy(srcPath, targetPath, { dereference: true }); } From d68863e785ce14926175b53de1845d24e3dd1583 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 18:19:37 +0300 Subject: [PATCH 58/89] readability --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index a890bbf4afc1..7a63ea676333 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -40,7 +40,8 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const targetDir = join(bundleDir, targetDirName, dirname(relativePath)); await fs.ensureDir(targetDir); const resolvedFilePath = require.resolve(origFilePath); - await fs.copyFile(resolvedFilePath, join(targetDir, basename(resolvedFilePath))); + const copyTarget = join(targetDir, basename(resolvedFilePath)); + await fs.copyFile(resolvedFilePath, copyTarget); // const newPath = replaceRelativePath(targetDirName, parsed); const newPath = `./${targetDirName}/${relativePath}`; return { From 58d77510f2684930265581636cf9d5865b75e889 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 14 Aug 2023 18:23:52 +0300 Subject: [PATCH 59/89] add more externals required for tests (jest config) --- scopes/harmony/bit/bundle/externals.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index fbf1bf80a59e..ad2eb8a24b42 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -6,6 +6,7 @@ export const externals = [ '@surma/rollup-plugin-off-main-thread', '@babel/preset-react', 'ink', + 'camelcase', 'rrweb-cssom', 'canvas', 'style-loader', @@ -17,6 +18,8 @@ export const externals = [ 'babel-loader', 'react-refresh/babel', 'babel-loader', + '@babel/core', + '@testing-library/jest-dom', '@babel/runtime', '@babel/preset-react', '@babel/preset-env', From 160f6fa247a5eaaf16d4dc0acdbdfffbb9118c24 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 15 Aug 2023 12:45:39 +0300 Subject: [PATCH 60/89] handle asset.d.ts and style.d.ts files --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 7 +++++++ scopes/react/react/react.env.ts | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 7a63ea676333..0fe7fc43bac9 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -139,6 +139,13 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /asset.d.ts$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /style.d.ts$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /tsconfig.json$/ }, (args) => { return handleConfigFile(args, bundleDir); }); diff --git a/scopes/react/react/react.env.ts b/scopes/react/react/react.env.ts index 8abe7bbecfb2..8db29ebcdadf 100644 --- a/scopes/react/react/react.env.ts +++ b/scopes/react/react/react.env.ts @@ -198,13 +198,14 @@ export class ReactEnv private createTsCompilerOptions(mode: CompilerMode = 'dev'): TypeScriptCompilerOptions { const tsconfig = mode === 'dev' ? cloneDeep(defaultTsConfig) : cloneDeep(buildTsConfig); - const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist/', '/src/'); + // const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist/', '/src/'); + const types = [require.resolve('./typescript/style.d.ts'), require.resolve('./typescript/asset.d.ts')]; const compileJs = true; const compileJsx = true; return { tsconfig, // TODO: @david please remove this line and refactor to be something that makes sense. - types: [resolve(pathToSource, './typescript/style.d.ts'), resolve(pathToSource, './typescript/asset.d.ts')], + types, compileJs, compileJsx, }; From 1f1f621540ab5803a16fbd61ab3356d158d0f662 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 15 Aug 2023 13:10:19 +0300 Subject: [PATCH 61/89] copy ts d.ts files --- scopes/harmony/bit/bundle/bundle.ts | 2 + scopes/harmony/bit/bundle/copy-other-files.ts | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 scopes/harmony/bit/bundle/copy-other-files.ts diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 882232c36536..623c2c2d11be 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -5,6 +5,7 @@ import { generatePackageJson } from './create-package-json'; import { generateNpmrc } from './generate-npmrc'; import { runTsup } from './tsup'; import { copyFilesOfCoreAspects } from './copy-files-of-core-aspects'; +import { copyOtherFiles } from './copy-other-files'; // const rootOutDir = '/Users/giladshoham/dev/bit/bit/bundle'; const rootOutDir = '/tmp/bit-bundle'; @@ -16,6 +17,7 @@ async function runBundle() { // const tsupRes = await runTsup(bundleDir, appFile); await generateCoreAspectsModules(rootOutDir, appFile); await copyFilesOfCoreAspects(rootOutDir, bundleDir); + await copyOtherFiles(bundleDir); generateNpmrc(rootOutDir); await generatePackageJson(rootOutDir); await generateCoreAspectsBarrelFile(); diff --git a/scopes/harmony/bit/bundle/copy-other-files.ts b/scopes/harmony/bit/bundle/copy-other-files.ts new file mode 100644 index 000000000000..8f6d2defd3c3 --- /dev/null +++ b/scopes/harmony/bit/bundle/copy-other-files.ts @@ -0,0 +1,42 @@ +import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import fs from 'fs-extra'; +import { basename, join } from 'path'; +import globby from 'globby'; + +const PATTERNS_TO_COPY = ['node_modules/typescript/lib/*.d.ts']; + +let wsRootDir: string; + +async function loadWsRootDir() { + const consumerInfo = await getConsumerInfo(process.cwd()); + if (!consumerInfo) throw new Error('unable to find consumer'); + wsRootDir = consumerInfo.path; + return consumerInfo.path; +} + +export async function copyOtherFiles(bundleDir: string) { + await loadWsRootDir(); + const copyP = PATTERNS_TO_COPY.map((file) => { + return handleOnePattern(wsRootDir, bundleDir, file); + }); + return Promise.all(copyP); +} + +async function handleOnePattern(srcDir: string, targetDir: string, pattern: string) { + const files = await globby(pattern, { cwd: srcDir }); + return Promise.all( + files.map((file) => { + return handleOnePath(srcDir, targetDir, file); + }) + ); +} + +async function handleOnePath(srcDir: string, targetDir: string, path: string) { + const srcPath = join(srcDir, path); + const targetPath = join(targetDir, basename(path)); + const exists = await fs.pathExists(targetPath); + if (exists) { + await fs.remove(targetPath); + } + return fs.copy(srcPath, targetPath, { dereference: true }); +} From 7b80033f497201657cc1a13973cc42c697ee01c1 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 15 Aug 2023 15:03:09 +0300 Subject: [PATCH 62/89] add minify in comment --- scopes/harmony/bit/bundle/esbuild.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index 1ed5ca76ed47..51a76ca0b660 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -23,6 +23,7 @@ export function runEsbuild(outDir: string, appFile: string) { bundle: true, logLevel: 'error', platform: 'node', + // minify: true, // TODO: maybe enable sourcemap later // sourcemap: true, mainFields: ['main', 'module'], From 5836d5d66099f751ca8a6bd6528c7e2297cade7b Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 21 Jan 2024 16:59:53 +0200 Subject: [PATCH 63/89] remove elements leftovers --- scopes/harmony/bit/core-aspects-exports.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts index d42d55cb6f7a..316456a5b790 100644 --- a/scopes/harmony/bit/core-aspects-exports.ts +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -37,8 +37,6 @@ export * as logger from '@teambit/logger'; export * as pkg from '@teambit/pkg'; export * as react from '@teambit/react'; export * as reactNative from '@teambit/react-native'; -export * as reactElements from '@teambit/react-elements'; -export * as elements from '@teambit/elements'; export * as worker from '@teambit/worker'; export * as scope from '@teambit/scope'; export * as tester from '@teambit/tester'; @@ -80,7 +78,6 @@ export * as newComponentHelper from '@teambit/new-component-helper'; export * as componentLog from '@teambit/component-log'; export * as clearCache from '@teambit/clear-cache'; export * as mocha from '@teambit/mocha'; -export * as bitCustomAspect from '@teambit/bit-custom-aspect'; export * as diagnostic from '@teambit/diagnostic'; export * as status from '@teambit/status'; export * as community from '@teambit/community'; From f0969a426213faabbd51c81a7009ca83a14324b7 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 21 Jan 2024 17:55:14 +0200 Subject: [PATCH 64/89] improve config files esbuild plugin resolution --- .../bit/bundle/config-files-esbuild-plugin.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 0fe7fc43bac9..76a033b906fd 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -25,6 +25,16 @@ function handleConfigFile(args: OnResolveArgs, bundleDir: string) { return undefined; } +function resolveRelativePath(filePath: string) { + try { + const resolvedFilePath = require.resolve(filePath); + return resolvedFilePath; + } catch (err) { + const resolvedFilePath = require.resolve(`${filePath}.js`); + return resolvedFilePath; + } +} + async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const parsed = parse(args.path); const { componentName, relativePath, scopeName } = await parseArgs(args); @@ -39,7 +49,7 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { // const targetDir = join(bundleDir, targetDirName, parsed.dir); const targetDir = join(bundleDir, targetDirName, dirname(relativePath)); await fs.ensureDir(targetDir); - const resolvedFilePath = require.resolve(origFilePath); + const resolvedFilePath = resolveRelativePath(origFilePath); const copyTarget = join(targetDir, basename(resolvedFilePath)); await fs.copyFile(resolvedFilePath, copyTarget); // const newPath = replaceRelativePath(targetDirName, parsed); From 53237f9530a3f81533323a212a7fd72488f43232 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 21 Jan 2024 18:07:51 +0200 Subject: [PATCH 65/89] remove elements left overs --- scopes/harmony/bit/core-aspects-ids.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/scopes/harmony/bit/core-aspects-ids.ts b/scopes/harmony/bit/core-aspects-ids.ts index ecaa197cfa69..573665b210d5 100644 --- a/scopes/harmony/bit/core-aspects-ids.ts +++ b/scopes/harmony/bit/core-aspects-ids.ts @@ -38,8 +38,6 @@ export const coreAspectsIds = [ 'teambit.pkg/pkg', 'teambit.react/react', 'teambit.react/react-native', - 'teambit.react/react-elements', - 'teambit.web-components/elements', 'teambit.harmony/worker', 'teambit.scope/scope', 'teambit.defender/tester', @@ -81,7 +79,6 @@ export const coreAspectsIds = [ 'teambit.component/component-log', 'teambit.bit/clear-cache', 'teambit.defender/mocha', - 'teambit.harmony/bit-custom-aspect', 'teambit.harmony/diagnostic', 'teambit.component/status', 'teambit.community/community', From 2b09cea782f06a79be24c34a04b4bfe7a16b5f21 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Sun, 28 Jan 2024 11:54:18 +0200 Subject: [PATCH 66/89] add missing exports in esm files --- scopes/compilation/compiler/esm.mjs | 1 + scopes/component/merging/esm.mjs | 1 + scopes/harmony/bit/esm.mjs | 1 + scopes/harmony/cli/esm.mjs | 1 + scopes/harmony/config/esm.mjs | 1 + ...review.main.runtime.tsx => preview.main.runtime.ts} | 0 scopes/typescript/typescript/esm.mjs | 10 ++++++++++ scopes/workspace/config-merger/esm.mjs | 7 +++++++ scopes/workspace/workspace/esm.mjs | 4 ++++ 9 files changed, 26 insertions(+) rename scopes/preview/preview/{preview.main.runtime.tsx => preview.main.runtime.ts} (100%) create mode 100644 scopes/workspace/config-merger/esm.mjs diff --git a/scopes/compilation/compiler/esm.mjs b/scopes/compilation/compiler/esm.mjs index 7df613026333..9ee7e122ad96 100644 --- a/scopes/compilation/compiler/esm.mjs +++ b/scopes/compilation/compiler/esm.mjs @@ -4,5 +4,6 @@ import cjsModule from './index.js'; export const CompilerAspect = cjsModule.CompilerAspect; export const CompilerTask = cjsModule.CompilerTask; export const CompilationInitiator = cjsModule.CompilationInitiator; +export const CompilerErrorEvent = cjsModule.CompilerErrorEvent; export default cjsModule; diff --git a/scopes/component/merging/esm.mjs b/scopes/component/merging/esm.mjs index 0a55299b5e5e..0c05c244be3b 100644 --- a/scopes/component/merging/esm.mjs +++ b/scopes/component/merging/esm.mjs @@ -10,5 +10,6 @@ export const getRemovedOutput = cjsModule.getRemovedOutput; export const getAddedOutput = cjsModule.getAddedOutput; export const ConfigMergeResult = cjsModule.ConfigMergeResult; export const MergingAspect = cjsModule.MergingAspect; +export const getWorkspaceConfigUpdateOutput = cjsModule.getWorkspaceConfigUpdateOutput; export default cjsModule; diff --git a/scopes/harmony/bit/esm.mjs b/scopes/harmony/bit/esm.mjs index d41ae4eda6b5..4144bb960d6c 100644 --- a/scopes/harmony/bit/esm.mjs +++ b/scopes/harmony/bit/esm.mjs @@ -11,6 +11,7 @@ export const getAllCoreAspectsIds = cjsModule.getAllCoreAspectsIds; export const registerCoreExtensions = cjsModule.registerCoreExtensions; export const BitAspect = cjsModule.BitAspect; export const loadBit = cjsModule.loadBit; +export const restoreGlobals = cjsModule.restoreGlobals; export default cjsModule; diff --git a/scopes/harmony/cli/esm.mjs b/scopes/harmony/cli/esm.mjs index 66d4772ecdd8..54515279ecf9 100644 --- a/scopes/harmony/cli/esm.mjs +++ b/scopes/harmony/cli/esm.mjs @@ -2,5 +2,6 @@ import cjsModule from './index.js'; export const CLIAspect = cjsModule.CLIAspect; +export const MainRuntime = cjsModule.MainRuntime; export default cjsModule; diff --git a/scopes/harmony/config/esm.mjs b/scopes/harmony/config/esm.mjs index df8dc99a09fb..a119b739949f 100644 --- a/scopes/harmony/config/esm.mjs +++ b/scopes/harmony/config/esm.mjs @@ -5,5 +5,6 @@ export const ConfigAspect = cjsModule.ConfigAspect; export const ConfigRuntime = cjsModule.ConfigRuntime; export const getWorkspaceConfigTemplateParsed = cjsModule.getWorkspaceConfigTemplateParsed; export const stringifyWorkspaceConfig = cjsModule.stringifyWorkspaceConfig; +export const getConfigAspect = cjsModule.getConfigAspect; export default cjsModule; diff --git a/scopes/preview/preview/preview.main.runtime.tsx b/scopes/preview/preview/preview.main.runtime.ts similarity index 100% rename from scopes/preview/preview/preview.main.runtime.tsx rename to scopes/preview/preview/preview.main.runtime.ts diff --git a/scopes/typescript/typescript/esm.mjs b/scopes/typescript/typescript/esm.mjs index 25e216753055..7508e908d937 100644 --- a/scopes/typescript/typescript/esm.mjs +++ b/scopes/typescript/typescript/esm.mjs @@ -6,6 +6,16 @@ export const TypeScriptExtractor = cjsModule.TypeScriptExtractor; export const TypescriptCompiler = cjsModule.TypescriptCompiler; export const TypescriptAspect = cjsModule.TypescriptAspect; export const SchemaExtractorContext = cjsModule.SchemaExtractorContext; +export const importTransformer = cjsModule.importTransformer; +export const exportTransformer = cjsModule.exportTransformer; +export const classNamesTransformer = cjsModule.classNamesTransformer; +export const functionNamesTransformer = cjsModule.functionNamesTransformer; +export const interfaceNamesTransformer = cjsModule.interfaceNamesTransformer; +export const typeAliasNamesTransformer = cjsModule.typeAliasNamesTransformer; +export const variableNamesTransformer = cjsModule.variableNamesTransformer; +export const transformSourceFile = cjsModule.transformSourceFile; +export const expressionStatementTransformer = cjsModule.expressionStatementTransformer; +export const typeReferenceTransformer = cjsModule.typeReferenceTransformer; export default cjsModule; diff --git a/scopes/workspace/config-merger/esm.mjs b/scopes/workspace/config-merger/esm.mjs new file mode 100644 index 000000000000..829b9d1368be --- /dev/null +++ b/scopes/workspace/config-merger/esm.mjs @@ -0,0 +1,7 @@ +// eslint-disable-next-line import/no-unresolved +import cjsModule from './index.js'; + +export const ConfigMergerAspect = cjsModule.ConfigMergerAspect; +export const ComponentConfigMerger = cjsModule.ComponentConfigMerger; + +export default cjsModule; diff --git a/scopes/workspace/workspace/esm.mjs b/scopes/workspace/workspace/esm.mjs index 4e6bf4fed00a..95b37201560e 100644 --- a/scopes/workspace/workspace/esm.mjs +++ b/scopes/workspace/workspace/esm.mjs @@ -4,5 +4,9 @@ import cjsModule from './index.js'; export const ComponentStatus = cjsModule.ComponentStatus; export const WorkspaceAspect = cjsModule.WorkspaceAspect; export const WorkspaceContext = cjsModule.WorkspaceContext; +export const OutsideWorkspaceError = cjsModule.OutsideWorkspaceError; +export const OnComponentChangeEvent = cjsModule.OnComponentChangeEvent; +export const OnComponentAddEvent = cjsModule.OnComponentAddEvent; +export const OnComponentRemovedEvent = cjsModule.OnComponentRemovedEvent; export default cjsModule; From 296c48a40ed73f29e1b5d11bc0b143e60165bc51 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 13 Feb 2024 12:19:26 +0200 Subject: [PATCH 67/89] add missing export in merging esm.mjs --- scopes/component/merging/esm.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/scopes/component/merging/esm.mjs b/scopes/component/merging/esm.mjs index 0c05c244be3b..a8865064719c 100644 --- a/scopes/component/merging/esm.mjs +++ b/scopes/component/merging/esm.mjs @@ -11,5 +11,6 @@ export const getAddedOutput = cjsModule.getAddedOutput; export const ConfigMergeResult = cjsModule.ConfigMergeResult; export const MergingAspect = cjsModule.MergingAspect; export const getWorkspaceConfigUpdateOutput = cjsModule.getWorkspaceConfigUpdateOutput; +export const compIsAlreadyMergedMsg = cjsModule.compIsAlreadyMergedMsg; export default cjsModule; From 74494ad2443e1bcd1a818c62528078471ced1f01 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 13 Feb 2024 13:04:36 +0200 Subject: [PATCH 68/89] add missing externals --- scopes/harmony/bit/bundle/externals.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index ad2eb8a24b42..4c1324433d25 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -106,6 +106,9 @@ export const externals = [ '@teambit/react.ui.compositions-app', 'babel-preset-react-app', 'tippy.js', + '@babel/plugin-transform-object-rest-spread', + '@babel/plugin-transform-class-properties', + '@bitdev/react.webpack.refresh-overlay', // 'esbuild' // 'mime' ]; From b42c56abe0e3a42e02e30d031404273cb66540c3 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 13 Feb 2024 13:04:57 +0200 Subject: [PATCH 69/89] handle jest cjs transformer --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 3 +++ scopes/react/react/jest/jest.cjs.config.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 76a033b906fd..c4bfa92825a4 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -186,6 +186,9 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /file-transform$/ }, (args) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /cjs-transformer$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); }, }; }; diff --git a/scopes/react/react/jest/jest.cjs.config.js b/scopes/react/react/jest/jest.cjs.config.js index 77efed1c3ad4..b9794415c510 100644 --- a/scopes/react/react/jest/jest.cjs.config.js +++ b/scopes/react/react/jest/jest.cjs.config.js @@ -1,6 +1,6 @@ const baseConfig = require('./jest.base.config'); -const cjsTransformer = require.resolve('./transformers/cjs-transformer.js'); +const cjsTransformer = require.resolve('./transformers/cjs-transformer'); const cjsTransform = { ...baseConfig.transform, '^.+\\.(js|jsx|ts|tsx|cjs)$': cjsTransformer }; const cjsConfig = { ...baseConfig, transform: cjsTransform }; From 946cfc9402d59c7d9236039ca2a676fef321b475 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 19 Feb 2024 13:46:24 +0200 Subject: [PATCH 70/89] fixes for workspace config proto --- scopes/harmony/config/workspace-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scopes/harmony/config/workspace-config.ts b/scopes/harmony/config/workspace-config.ts index 69f6a5e974cf..8969759b8b2c 100644 --- a/scopes/harmony/config/workspace-config.ts +++ b/scopes/harmony/config/workspace-config.ts @@ -18,7 +18,7 @@ import { ExtensionAlreadyConfigured } from './exceptions'; import InvalidConfigFile from './exceptions/invalid-config-file'; import { HostConfig } from './types'; -const INTERNAL_CONFIG_PROPS = ['$schema', '$schemaVersion']; +const INTERNAL_CONFIG_PROPS = ['$schema', '$schemaVersion', 'require']; export type LegacyInitProps = { standAlone?: boolean; From cf98ad4b714fc6a4fa38b23d65e406571c8a529a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 20 Feb 2024 13:17:37 +0200 Subject: [PATCH 71/89] refactor(core-aspects) - use named import to import aspects manifests --- .../api-reference.ui.runtime.tsx | 4 ++-- scopes/cloud/cloud/cloud.main.runtime.ts | 12 +++++------ scopes/cloud/cloud/cloud.ui.runtime.tsx | 4 ++-- .../bundler/bundler.main.runtime.ts | 2 +- .../compiler/compiler.main.runtime.ts | 8 ++++---- .../checkout/checkout.main.runtime.ts | 6 +++--- scopes/component/checkout/checkout.spec.ts | 4 ++-- .../component-compare.main.runtime.ts | 7 ++++--- .../component-compare.ui.runtime.tsx | 2 +- .../component-log.main.runtime.ts | 2 +- .../component-sizer.main.runtime.ts | 6 +++--- .../component-writer.main.runtime.ts | 8 ++++---- .../component/component.ui.runtime.tsx | 8 ++++---- .../deprecation/deprecation.main.runtime.ts | 2 +- .../dev-files/dev-files.main.runtime.ts | 4 ++-- .../component/forking/forking.main.runtime.ts | 12 +++++------ .../isolator/isolator.main.runtime.ts | 2 +- .../component/lister/lister.main.runtime.ts | 2 +- .../component/merging/merging.main.runtime.ts | 12 +++++------ scopes/component/mover/mover.main.runtime.ts | 2 +- .../new-component-helper.main.runtime.ts | 4 ++-- .../refactoring/refactoring.main.runtime.ts | 6 +++--- .../component/remove/remove.main.runtime.ts | 8 ++++---- .../renaming/renaming.main.runtime.ts | 16 +++++++-------- scopes/component/renaming/renaming.spec.ts | 2 +- .../snapping/generate-comp-from-scope.ts | 2 +- .../snapping/snapping.main.runtime.ts | 10 +++++----- scopes/component/stash/stash.main.runtime.ts | 6 +++--- .../component/status/status.main.runtime.ts | 6 +++--- .../mock-components/mock-components.ts | 4 ++-- .../component/tracker/tracker.main.runtime.ts | 2 +- .../compositions/compositions.main.runtime.ts | 4 ++-- scopes/defender/tester/tester.main.runtime.ts | 2 +- .../dependencies-loader.ts | 2 +- .../dependencies/dependencies.main.runtime.ts | 10 +++++----- .../dependency-resolver.main.runtime.ts | 6 +++--- scopes/dependencies/pnpm/pnpm.ui.runtime.tsx | 2 +- scopes/dependencies/yarn/yarn.ui.runtime.tsx | 2 +- scopes/docs/docs/docs.main.runtime.ts | 4 ++-- scopes/docs/docs/docs.ui.runtime.tsx | 4 ++-- scopes/envs/env/env.main.runtime.ts | 4 ++-- scopes/envs/envs/environments.main.runtime.ts | 4 ++-- .../command-bar/command-bar.ui.runtime.tsx | 2 +- .../insights/insights.main.runtime.ts | 2 +- .../generator/component-generator.ts | 2 +- .../generator/generator.main.runtime.ts | 14 ++++++------- .../generator/workspace-generator.ts | 10 +++++----- .../api-server/api-server.main.runtime.ts | 20 +++++++++---------- .../application/application.main.runtime.ts | 8 ++++---- scopes/harmony/aspect/aspect.main.runtime.ts | 4 ++-- .../diagnostic/diagnostic.main.runtime.ts | 2 +- .../ipc-events/ipc-events.main.runtime.ts | 2 +- scopes/harmony/node/node.main.runtime.ts | 2 +- scopes/lanes/lanes/lanes.main.runtime.ts | 8 ++++---- scopes/lanes/lanes/lanes.spec.ts | 6 +++--- scopes/lanes/lanes/lanes.ui.runtime.tsx | 6 +++--- .../merge-lanes/merge-lanes.main.runtime.ts | 11 +++++----- scopes/mdx/mdx/mdx.main.runtime.ts | 6 +++--- scopes/mdx/readme/readme.main.runtime.ts | 4 ++-- .../builder/artifact/artifact-extractor.ts | 2 +- .../pipelines/builder/builder.main.runtime.ts | 2 +- scopes/pkg/pkg/pkg.main.runtime.ts | 2 +- scopes/pkg/pkg/pkg.ui.runtime.tsx | 2 +- .../preview/preview/preview.main.runtime.ts | 8 ++++---- .../preview/preview.preview.runtime.tsx | 2 +- .../preview-placeholder.tsx | 2 +- .../react-native/react-native.main.runtime.ts | 2 +- scopes/react/react/react.main.runtime.ts | 2 +- scopes/react/react/react.preview.runtime.ts | 2 +- scopes/react/react/react.ui.runtime.tsx | 2 +- scopes/scope/export/export.main.runtime.ts | 4 ++-- .../scope/importer/importer.main.runtime.ts | 12 +++++------ scopes/scope/scope/scope.main.runtime.ts | 4 ++-- scopes/scope/scope/scope.ui.runtime.tsx | 2 +- scopes/scope/sign/sign.main.runtime.ts | 2 +- .../semantics/schema/schema.main.runtime.ts | 6 +++--- scopes/semantics/schema/schema.spec.ts | 4 ++-- .../typescript/typescript.extractor.ts | 2 +- .../typescript/typescript.main.runtime.ts | 6 +++--- .../harmony-ui-app.main.runtime.ts | 2 +- scopes/ui-foundation/ui/ui.main.runtime.ts | 2 +- .../webpack/webpack/webpack.main.runtime.ts | 2 +- scopes/workspace/eject/eject.main.runtime.ts | 2 +- .../workspace/install/install.main.runtime.ts | 4 ++-- .../workspace/watcher/watcher.main.runtime.ts | 8 ++++---- .../workspace/workspace.ui.runtime.tsx | 4 ++-- 86 files changed, 212 insertions(+), 210 deletions(-) diff --git a/scopes/api-reference/api-reference/api-reference.ui.runtime.tsx b/scopes/api-reference/api-reference/api-reference.ui.runtime.tsx index 13ff72ee3fd6..d000e407f5fe 100644 --- a/scopes/api-reference/api-reference/api-reference.ui.runtime.tsx +++ b/scopes/api-reference/api-reference/api-reference.ui.runtime.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { flatten } from 'lodash'; -import ComponentAspect, { ComponentUI } from '@teambit/component'; +import { ComponentAspect, ComponentUI } from '@teambit/component'; import { UIRuntime } from '@teambit/ui'; import { APIRefPage } from '@teambit/api-reference.sections.api-reference-page'; import { APIRefSection } from '@teambit/api-reference.sections.api-reference-section'; @@ -24,7 +24,7 @@ import { thisRenderer } from '@teambit/api-reference.renderers.this'; import { APIRefRenderersProvider } from '@teambit/api-reference.hooks.use-api-renderers'; import { decoratorRenderer } from '@teambit/api-reference.renderers.decorator'; import { SchemaNodeConstructor, SchemaRegistry, Schemas } from '@teambit/semantics.entities.semantic-schema'; -import CodeAspect, { CodeUI } from '@teambit/code'; +import { CodeAspect, CodeUI } from '@teambit/code'; import { TaggedExports } from '@teambit/tagged-exports'; import { APIReferenceAspect } from './api-reference.aspect'; diff --git a/scopes/cloud/cloud/cloud.main.runtime.ts b/scopes/cloud/cloud/cloud.main.runtime.ts index 07546a0e0c0b..d036fee90951 100644 --- a/scopes/cloud/cloud/cloud.main.runtime.ts +++ b/scopes/cloud/cloud/cloud.main.runtime.ts @@ -1,5 +1,5 @@ import { Slot, SlotRegistry } from '@teambit/harmony'; -import CLIAspect, { CLIMain, MainRuntime } from '@teambit/cli'; +import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { v4 } from 'uuid'; import chalk from 'chalk'; import os from 'os'; @@ -24,14 +24,14 @@ import { CFG_USER_TOKEN_KEY, CFG_USER_NAME_KEY, } from '@teambit/legacy/dist/constants'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import globalFlags from '@teambit/legacy/dist/cli/global-flags'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { ExpressAspect, ExpressMain } from '@teambit/express'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { execSync } from 'child_process'; -import UIAspect, { UiMain } from '@teambit/ui'; +import { UIAspect, UiMain } from '@teambit/ui'; import { cloudSchema } from './cloud.graphql'; import { CloudAspect } from './cloud.aspect'; import { LoginCmd } from './login.cmd'; diff --git a/scopes/cloud/cloud/cloud.ui.runtime.tsx b/scopes/cloud/cloud/cloud.ui.runtime.tsx index 04e6e1257c88..48d09b2bcf06 100644 --- a/scopes/cloud/cloud/cloud.ui.runtime.tsx +++ b/scopes/cloud/cloud/cloud.ui.runtime.tsx @@ -5,8 +5,8 @@ import { SubMenu } from '@teambit/design.controls.menu'; // import { useThemePicker, useNextTheme } from '@teambit/base-react.themes.theme-switcher'; import { Slot } from '@teambit/harmony'; import { UserBar, UserBarItem, UserBarItemSlot, UserBarSection, UserBarSectionSlot } from '@teambit/cloud.ui.user-bar'; -import LanesAspect, { LanesUI } from '@teambit/lanes'; -import WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace'; +import { LanesAspect, LanesUI } from '@teambit/lanes'; +import { WorkspaceAspect, WorkspaceUI } from '@teambit/workspace'; import { ComponentAspect, ComponentUI } from '@teambit/component'; import { CloudAspect } from './cloud.aspect'; diff --git a/scopes/compilation/bundler/bundler.main.runtime.ts b/scopes/compilation/bundler/bundler.main.runtime.ts index fed087a1f6ca..28957f0a7933 100644 --- a/scopes/compilation/bundler/bundler.main.runtime.ts +++ b/scopes/compilation/bundler/bundler.main.runtime.ts @@ -1,4 +1,4 @@ -import PubsubAspect, { PubsubMain } from '@teambit/pubsub'; +import { PubsubAspect, PubsubMain } from '@teambit/pubsub'; import { MainRuntime } from '@teambit/cli'; import { Component, ComponentAspect } from '@teambit/component'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; diff --git a/scopes/compilation/compiler/compiler.main.runtime.ts b/scopes/compilation/compiler/compiler.main.runtime.ts index 42c027513907..0f94f72727d7 100644 --- a/scopes/compilation/compiler/compiler.main.runtime.ts +++ b/scopes/compilation/compiler/compiler.main.runtime.ts @@ -1,20 +1,20 @@ import * as path from 'path'; import fs from 'fs-extra'; -import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader'; +import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; import { BuilderAspect, BuilderMain } from '@teambit/builder'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { IssuesClasses } from '@teambit/component-issues'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import { Component } from '@teambit/component'; import { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants'; -import WatcherAspect, { WatcherMain } from '@teambit/watcher'; +import { WatcherAspect, WatcherMain } from '@teambit/watcher'; import { EnvsAspect, EnvsMain, ExecutionContext } from '@teambit/envs'; import { ComponentID } from '@teambit/component-id'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { LoggerAspect, LoggerMain } from '@teambit/logger'; import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; import { PubsubAspect, PubsubMain } from '@teambit/pubsub'; -import UIAspect, { UiMain } from '@teambit/ui'; +import { UIAspect, UiMain } from '@teambit/ui'; import { Workspace, WorkspaceAspect } from '@teambit/workspace'; import { CompilerAspect } from './compiler.aspect'; import { CompileCmd } from './compiler.cmd'; diff --git a/scopes/component/checkout/checkout.main.runtime.ts b/scopes/component/checkout/checkout.main.runtime.ts index 3bcc98723a2a..92a3862a1386 100644 --- a/scopes/component/checkout/checkout.main.runtime.ts +++ b/scopes/component/checkout/checkout.main.runtime.ts @@ -1,13 +1,13 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { BitError } from '@teambit/bit-error'; import { compact } from 'lodash'; import { BEFORE_CHECKOUT } from '@teambit/legacy/dist/cli/loader/loader-messages'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; import { UPDATE_DEPS_ON_IMPORT, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle'; import { ApplyVersionResults, FailedComponents } from '@teambit/merging'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { HEAD, LATEST } from '@teambit/legacy/dist/constants'; import { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer'; import { diff --git a/scopes/component/checkout/checkout.spec.ts b/scopes/component/checkout/checkout.spec.ts index b10eb4b4f3bd..de0eea59c266 100644 --- a/scopes/component/checkout/checkout.spec.ts +++ b/scopes/component/checkout/checkout.spec.ts @@ -2,8 +2,8 @@ import chai, { expect } from 'chai'; import fs from 'fs-extra'; import { ComponentID } from '@teambit/component-id'; import { loadAspect } from '@teambit/harmony.testing.load-aspect'; -import SnappingAspect, { SnappingMain } from '@teambit/snapping'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { SnappingAspect, SnappingMain } from '@teambit/snapping'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { mockWorkspace, destroyWorkspace, WorkspaceData } from '@teambit/workspace.testing.mock-workspace'; import { mockComponents } from '@teambit/component.testing.mock-components'; import { CheckoutMain } from './checkout.main.runtime'; diff --git a/scopes/component/component-compare/component-compare.main.runtime.ts b/scopes/component/component-compare/component-compare.main.runtime.ts index fe42b72ed6ff..f59258d6fceb 100644 --- a/scopes/component/component-compare/component-compare.main.runtime.ts +++ b/scopes/component/component-compare/component-compare.main.runtime.ts @@ -4,10 +4,11 @@ import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/work import { ComponentID } from '@teambit/component-id'; import { ScopeMain, ScopeAspect } from '@teambit/scope'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; -import BuilderAspect from '@teambit/builder'; +import { BuilderAspect } from '@teambit/builder'; import { ModelComponent, Version } from '@teambit/legacy/dist/scope/models'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component'; -import DependencyResolverAspect, { +import { + DependencyResolverAspect, DependencyList, DependencyResolverMain, SerializedDependency, @@ -22,7 +23,7 @@ import { } from '@teambit/legacy/dist/consumer/component-ops/components-diff'; import { diffBetweenComponentsObjects } from '@teambit/legacy/dist/consumer/component-ops/components-object-diff'; import { TesterMain, TesterAspect } from '@teambit/tester'; -import ComponentAspect, { Component, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain } from '@teambit/component'; import { componentCompareSchema } from './component-compare.graphql'; import { ComponentCompareAspect } from './component-compare.aspect'; import { DiffCmd } from './diff-cmd'; diff --git a/scopes/component/component-compare/component-compare.ui.runtime.tsx b/scopes/component/component-compare/component-compare.ui.runtime.tsx index d99c4c1e2d34..e1cf45b3caeb 100644 --- a/scopes/component/component-compare/component-compare.ui.runtime.tsx +++ b/scopes/component/component-compare/component-compare.ui.runtime.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { RouteProps } from 'react-router-dom'; import flatten from 'lodash.flatten'; import { Harmony, Slot, SlotRegistry } from '@teambit/harmony'; -import ComponentAspect, { ComponentUI } from '@teambit/component'; +import { ComponentAspect, ComponentUI } from '@teambit/component'; import { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare'; import { UIRuntime } from '@teambit/ui'; import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router'; diff --git a/scopes/component/component-log/component-log.main.runtime.ts b/scopes/component/component-log/component-log.main.runtime.ts index c90e9654e2d9..60c9029b50fb 100644 --- a/scopes/component/component-log/component-log.main.runtime.ts +++ b/scopes/component/component-log/component-log.main.runtime.ts @@ -4,7 +4,7 @@ import { LegacyComponentLog as ComponentLog } from '@teambit/legacy-component-lo import path from 'path'; import moment from 'moment'; import pMap from 'p-map'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { compact } from 'lodash'; import pMapSeries from 'p-map-series'; import { Version } from '@teambit/legacy/dist/scope/models'; diff --git a/scopes/component/component-sizer/component-sizer.main.runtime.ts b/scopes/component/component-sizer/component-sizer.main.runtime.ts index b8d498440a30..d03f84078919 100644 --- a/scopes/component/component-sizer/component-sizer.main.runtime.ts +++ b/scopes/component/component-sizer/component-sizer.main.runtime.ts @@ -1,7 +1,7 @@ import { MainRuntime } from '@teambit/cli'; -import ComponentAspect, { Component } from '@teambit/component'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; -import PreviewAspect, { ComponentPreviewSize, PreviewMain } from '@teambit/preview'; +import { ComponentAspect, Component } from '@teambit/component'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; +import { PreviewAspect, ComponentPreviewSize, PreviewMain } from '@teambit/preview'; import { ComponentSizerAspect } from './component-sizer.aspect'; import { componentSizerSchema } from './component-sizer.graphql'; diff --git a/scopes/component/component-writer/component-writer.main.runtime.ts b/scopes/component/component-writer/component-writer.main.runtime.ts index 897171dbb894..b396b058931c 100644 --- a/scopes/component/component-writer/component-writer.main.runtime.ts +++ b/scopes/component/component-writer/component-writer.main.runtime.ts @@ -1,20 +1,20 @@ import { MainRuntime } from '@teambit/cli'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import InstallAspect, { InstallMain } from '@teambit/install'; +import { InstallAspect, InstallMain } from '@teambit/install'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { BitError } from '@teambit/bit-error'; import fs from 'fs-extra'; import { uniq } from 'lodash'; import mapSeries from 'p-map-series'; import * as path from 'path'; -import MoverAspect, { MoverMain } from '@teambit/mover'; +import { MoverAspect, MoverMain } from '@teambit/mover'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component'; import { isDir, isDirEmptySync } from '@teambit/legacy/dist/utils'; import { PathLinuxRelative, pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path'; import ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map'; import DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist'; -import ConfigMergerAspect, { ConfigMergerMain, WorkspaceConfigUpdateResult } from '@teambit/config-merger'; +import { ConfigMergerAspect, ConfigMergerMain, WorkspaceConfigUpdateResult } from '@teambit/config-merger'; import Consumer from '@teambit/legacy/dist/consumer/consumer'; import ComponentWriter, { ComponentWriterProps } from './component-writer'; import { ComponentWriterAspect } from './component-writer.aspect'; diff --git a/scopes/component/component/component.ui.runtime.tsx b/scopes/component/component/component.ui.runtime.tsx index 0ee43b73a585..670eac7749e2 100644 --- a/scopes/component/component/component.ui.runtime.tsx +++ b/scopes/component/component/component.ui.runtime.tsx @@ -3,12 +3,12 @@ import flatten from 'lodash.flatten'; import copy from 'copy-to-clipboard'; import type { RouteProps } from 'react-router-dom'; import type { LinkProps } from '@teambit/base-react.navigation.link'; -import CommandBarAspect, { CommandBarUI, CommandEntry } from '@teambit/command-bar'; +import { CommandBarAspect, CommandBarUI, CommandEntry } from '@teambit/command-bar'; import { DeprecationIcon } from '@teambit/component.ui.deprecation-icon'; import { Slot, SlotRegistry } from '@teambit/harmony'; -import PreviewAspect, { ClickInsideAnIframeEvent } from '@teambit/preview'; -import PubsubAspect, { BitBaseEvent, PubsubUI } from '@teambit/pubsub'; -import ReactRouterAspect, { ReactRouterUI } from '@teambit/react-router'; +import { PreviewAspect, ClickInsideAnIframeEvent } from '@teambit/preview'; +import { PubsubAspect, BitBaseEvent, PubsubUI } from '@teambit/pubsub'; +import { ReactRouterAspect, ReactRouterUI } from '@teambit/react-router'; import { UIRuntime } from '@teambit/ui'; import { groupBy } from 'lodash'; import { isBrowser } from '@teambit/ui-foundation.ui.is-browser'; diff --git a/scopes/component/deprecation/deprecation.main.runtime.ts b/scopes/component/deprecation/deprecation.main.runtime.ts index 14829e6218d2..79cad905b02c 100644 --- a/scopes/component/deprecation/deprecation.main.runtime.ts +++ b/scopes/component/deprecation/deprecation.main.runtime.ts @@ -2,7 +2,7 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import semver from 'semver'; import { ComponentMain, ComponentAspect, Component, ComponentID } from '@teambit/component'; import { ScopeMain, ScopeAspect } from '@teambit/scope'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { ComponentIdObj } from '@teambit/component-id'; import { DeprecationAspect } from './deprecation.aspect'; diff --git a/scopes/component/dev-files/dev-files.main.runtime.ts b/scopes/component/dev-files/dev-files.main.runtime.ts index 08b292750b74..fa7c0d2a6b08 100644 --- a/scopes/component/dev-files/dev-files.main.runtime.ts +++ b/scopes/component/dev-files/dev-files.main.runtime.ts @@ -1,10 +1,10 @@ import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources'; import { MainRuntime } from '@teambit/cli'; import { parse } from 'comment-json'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { flatten, isFunction } from 'lodash'; import { SlotRegistry, Slot } from '@teambit/harmony'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { EnvsAspect, EnvsMain } from '@teambit/envs'; import LegacyComponent from '@teambit/legacy/dist/consumer/component'; import { Component, ComponentMain, ComponentAspect } from '@teambit/component'; diff --git a/scopes/component/forking/forking.main.runtime.ts b/scopes/component/forking/forking.main.runtime.ts index dfa2672f992d..1587ac28b1b0 100644 --- a/scopes/component/forking/forking.main.runtime.ts +++ b/scopes/component/forking/forking.main.runtime.ts @@ -1,17 +1,17 @@ import { BitError } from '@teambit/bit-error'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { importTransformer, exportTransformer } from '@teambit/typescript'; -import ComponentAspect, { Component, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain } from '@teambit/component'; import { ComponentDependency, DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { ComponentConfig } from '@teambit/generator'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { isHash } from '@teambit/component-version'; import { InstallAspect, InstallMain } from '@teambit/install'; import { ComponentID, ComponentIdObj, ComponentIdList } from '@teambit/component-id'; -import NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper'; -import PkgAspect, { PkgMain } from '@teambit/pkg'; -import RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { NewComponentHelperAspect, NewComponentHelperMain } from '@teambit/new-component-helper'; +import { PkgAspect, PkgMain } from '@teambit/pkg'; +import { RefactoringAspect, MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { snapToSemver } from '@teambit/component-package-version'; import { uniqBy } from 'lodash'; import pMapSeries from 'p-map-series'; diff --git a/scopes/component/isolator/isolator.main.runtime.ts b/scopes/component/isolator/isolator.main.runtime.ts index 22797a44d904..750db4581660 100644 --- a/scopes/component/isolator/isolator.main.runtime.ts +++ b/scopes/component/isolator/isolator.main.runtime.ts @@ -27,7 +27,7 @@ import { import { Logger, LoggerAspect, LoggerMain, LongProcessLogger } from '@teambit/logger'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; import LegacyScope from '@teambit/legacy/dist/scope/scope'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { DEPENDENCIES_FIELDS, PACKAGE_JSON, diff --git a/scopes/component/lister/lister.main.runtime.ts b/scopes/component/lister/lister.main.runtime.ts index a0213befb9fd..0ed2ea186326 100644 --- a/scopes/component/lister/lister.main.runtime.ts +++ b/scopes/component/lister/lister.main.runtime.ts @@ -1,6 +1,6 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { BEFORE_LOCAL_LIST, BEFORE_REMOTE_LIST } from '@teambit/legacy/dist/cli/loader/loader-messages'; import { ComponentID } from '@teambit/component-id'; import { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions'; diff --git a/scopes/component/merging/merging.main.runtime.ts b/scopes/component/merging/merging.main.runtime.ts index 75a7260b4127..08fb7a367663 100644 --- a/scopes/component/merging/merging.main.runtime.ts +++ b/scopes/component/merging/merging.main.runtime.ts @@ -1,5 +1,5 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { Consumer } from '@teambit/legacy/dist/consumer'; import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list'; import { @@ -8,7 +8,7 @@ import { getMergeStrategyInteractive, MergeOptions, } from '@teambit/legacy/dist/consumer/versions-ops/merge-version'; -import SnappingAspect, { SnappingMain, TagResults } from '@teambit/snapping'; +import { SnappingAspect, SnappingMain, TagResults } from '@teambit/snapping'; import hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard'; import mapSeries from 'p-map-series'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; @@ -20,13 +20,13 @@ import { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models'; import { Ref } from '@teambit/legacy/dist/scope/objects'; import chalk from 'chalk'; import { ConfigAspect, ConfigMain } from '@teambit/config'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; import { pathNormalizeToLinux } from '@teambit/legacy/dist/utils'; import { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { compact } from 'lodash'; import { MergeResultsThreeWay } from '@teambit/legacy/dist/consumer/versions-ops/merge-version/three-way-merge'; import { @@ -47,7 +47,7 @@ import { } from '@teambit/config-merger'; import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance'; import { InstallMain, InstallAspect } from '@teambit/install'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { MergeCmd } from './merge-cmd'; import { MergingAspect } from './merging.aspect'; import { MergeStatusProvider, MergeStatusProviderOptions } from './merge-status-provider'; diff --git a/scopes/component/mover/mover.main.runtime.ts b/scopes/component/mover/mover.main.runtime.ts index 8a484aa0461c..fc332df8520a 100644 --- a/scopes/component/mover/mover.main.runtime.ts +++ b/scopes/component/mover/mover.main.runtime.ts @@ -2,7 +2,7 @@ import fs from 'fs-extra'; import { BitError } from '@teambit/bit-error'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { isEmpty } from 'lodash'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { isDir } from '@teambit/legacy/dist/utils'; import moveSync from '@teambit/legacy/dist/utils/fs/move-sync'; import { PathOsBasedAbsolute, PathOsBasedRelative } from '@teambit/legacy/dist/utils/path'; diff --git a/scopes/component/new-component-helper/new-component-helper.main.runtime.ts b/scopes/component/new-component-helper/new-component-helper.main.runtime.ts index 75b252ede2ae..b7f2a9e8b998 100644 --- a/scopes/component/new-component-helper/new-component-helper.main.runtime.ts +++ b/scopes/component/new-component-helper/new-component-helper.main.runtime.ts @@ -4,12 +4,12 @@ import { BitError } from '@teambit/bit-error'; import { InvalidScopeName, isValidScopeName } from '@teambit/legacy-bit-id'; import { MainRuntime } from '@teambit/cli'; import { Component } from '@teambit/component'; -import TrackerAspect, { TrackerMain } from '@teambit/tracker'; +import { TrackerAspect, TrackerMain } from '@teambit/tracker'; import { isDirEmpty } from '@teambit/legacy/dist/utils'; import { ComponentID } from '@teambit/component-id'; import { Harmony } from '@teambit/harmony'; import { PathLinuxRelative } from '@teambit/legacy/dist/utils/path'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { PkgAspect } from '@teambit/pkg'; import { RenamingAspect } from '@teambit/renaming'; import { EnvsAspect } from '@teambit/envs'; diff --git a/scopes/component/refactoring/refactoring.main.runtime.ts b/scopes/component/refactoring/refactoring.main.runtime.ts index 66bae4add502..a88fb2bfc1a5 100644 --- a/scopes/component/refactoring/refactoring.main.runtime.ts +++ b/scopes/component/refactoring/refactoring.main.runtime.ts @@ -3,10 +3,10 @@ import { isBinaryFile } from 'isbinaryfile'; import camelCase from 'camelcase'; import { compact } from 'lodash'; import replacePackageName from '@teambit/legacy/dist/utils/string/replace-package-name'; -import ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentID, ComponentMain } from '@teambit/component'; import { BitError } from '@teambit/bit-error'; import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources'; -import PkgAspect, { PkgMain } from '@teambit/pkg'; +import { PkgAspect, PkgMain } from '@teambit/pkg'; import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { SourceFileTransformer, @@ -21,7 +21,7 @@ import { expressionStatementTransformer, typeReferenceTransformer, } from '@teambit/typescript'; -import PrettierAspect, { PrettierMain } from '@teambit/prettier'; +import { PrettierAspect, PrettierMain } from '@teambit/prettier'; import { Formatter } from '@teambit/formatter'; import { RefactoringAspect } from './refactoring.aspect'; import { DependencyNameRefactorCmd, RefactorCmd } from './refactor.cmd'; diff --git a/scopes/component/remove/remove.main.runtime.ts b/scopes/component/remove/remove.main.runtime.ts index ece72945ae76..a651e61fb05e 100644 --- a/scopes/component/remove/remove.main.runtime.ts +++ b/scopes/component/remove/remove.main.runtime.ts @@ -1,9 +1,9 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; import { ConsumerNotFound } from '@teambit/legacy/dist/consumer/exceptions'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { compact } from 'lodash'; import hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard'; import { getRemoteBitIdsByWildcards } from '@teambit/legacy/dist/api/consumer/lib/list-scope'; @@ -11,10 +11,10 @@ import { BitError } from '@teambit/bit-error'; import deleteComponentsFiles from '@teambit/legacy/dist/consumer/component-ops/delete-component-files'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { IssuesClasses } from '@teambit/component-issues'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import pMapSeries from 'p-map-series'; import { NoHeadNoVersion } from '@teambit/legacy/dist/scope/exceptions/no-head-no-version'; -import ComponentAspect, { Component, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain } from '@teambit/component'; import { removeComponentsFromNodeModules } from '@teambit/legacy/dist/consumer/component/package-json-utils'; import { RemoveCmd } from './remove-cmd'; import { RemoveComponentsResult, removeComponents } from './remove-components'; diff --git a/scopes/component/renaming/renaming.main.runtime.ts b/scopes/component/renaming/renaming.main.runtime.ts index 6846c3244702..2fadd5ca9354 100644 --- a/scopes/component/renaming/renaming.main.runtime.ts +++ b/scopes/component/renaming/renaming.main.runtime.ts @@ -4,17 +4,17 @@ import { ConfigAspect, ConfigMain } from '@teambit/config'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { linkToNodeModulesByComponents } from '@teambit/workspace.modules.node-modules-linker'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import ComponentAspect, { Component, ComponentID, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentID, ComponentMain } from '@teambit/component'; import { DeprecationAspect, DeprecationMain } from '@teambit/deprecation'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { compact } from 'lodash'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; -import NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; -import RefactoringAspect, { MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring'; -import ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; +import { NewComponentHelperAspect, NewComponentHelperMain } from '@teambit/new-component-helper'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; +import { RefactoringAspect, MultipleStringsReplacement, RefactoringMain } from '@teambit/refactoring'; +import { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import pMapSeries from 'p-map-series'; import { InstallMain, InstallAspect } from '@teambit/install'; import { isValidIdChunk, InvalidName } from '@teambit/legacy-bit-id'; diff --git a/scopes/component/renaming/renaming.spec.ts b/scopes/component/renaming/renaming.spec.ts index ae29a7aef06f..8a5c6697780b 100644 --- a/scopes/component/renaming/renaming.spec.ts +++ b/scopes/component/renaming/renaming.spec.ts @@ -1,6 +1,6 @@ import chai, { expect } from 'chai'; import { loadManyAspects } from '@teambit/harmony.testing.load-aspect'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { mockWorkspace, destroyWorkspace, WorkspaceData } from '@teambit/workspace.testing.mock-workspace'; import { mockComponents } from '@teambit/component.testing.mock-components'; import { RenamingMain } from './renaming.main.runtime'; diff --git a/scopes/component/snapping/generate-comp-from-scope.ts b/scopes/component/snapping/generate-comp-from-scope.ts index acc75641cd89..c9092dd2fbbe 100644 --- a/scopes/component/snapping/generate-comp-from-scope.ts +++ b/scopes/component/snapping/generate-comp-from-scope.ts @@ -8,7 +8,7 @@ import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config'; import { Component } from '@teambit/component'; import { CURRENT_SCHEMA } from '@teambit/legacy/dist/consumer/component/component-schema'; import { DependenciesMain } from '@teambit/dependencies'; -import DependencyResolverAspect, { DependencyResolverMain } from '@teambit/dependency-resolver'; +import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { FileData } from './snap-from-scope.cmd'; import type { SnappingMain, SnapDataParsed } from './snapping.main.runtime'; diff --git a/scopes/component/snapping/snapping.main.runtime.ts b/scopes/component/snapping/snapping.main.runtime.ts index e4c4e200f25b..922c43f50782 100644 --- a/scopes/component/snapping/snapping.main.runtime.ts +++ b/scopes/component/snapping/snapping.main.runtime.ts @@ -2,7 +2,7 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { Graph, Node, Edge } from '@teambit/graph.cleargraph'; import { LegacyOnTagResult } from '@teambit/legacy/dist/scope/scope'; import { FlattenedDependenciesGetter } from '@teambit/legacy/dist/scope/component-ops/get-flattened-dependencies'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import semver, { ReleaseType } from 'semver'; import { compact, difference, uniq } from 'lodash'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; @@ -22,18 +22,18 @@ import { InsightsAspect, InsightsMain } from '@teambit/insights'; import { concurrentComponentsLimit } from '@teambit/legacy/dist/utils/concurrency'; import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { Lane, ModelComponent } from '@teambit/legacy/dist/scope/models'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import { Component } from '@teambit/component'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config'; import { BuilderAspect, BuilderMain } from '@teambit/builder'; import { LaneId } from '@teambit/lane-id'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { ExportAspect, ExportMain } from '@teambit/export'; import UnmergedComponents from '@teambit/legacy/dist/scope/lanes/unmerged-components'; import { isHash, isTag } from '@teambit/component-version'; import { BitObject, Ref, Repository } from '@teambit/legacy/dist/scope/objects'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { ArtifactFiles, ArtifactSource, @@ -41,7 +41,7 @@ import { } from '@teambit/legacy/dist/consumer/component/sources/artifact-files'; import { VersionNotFound, ComponentNotFound, HeadNotFound } from '@teambit/legacy/dist/scope/exceptions'; import { AutoTagResult } from '@teambit/legacy/dist/scope/component-ops/auto-tag'; -import DependenciesAspect, { DependenciesMain } from '@teambit/dependencies'; +import { DependenciesAspect, DependenciesMain } from '@teambit/dependencies'; import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources'; import Version, { DepEdge, DepEdgeType, Log } from '@teambit/legacy/dist/scope/models/version'; import { SnapCmd } from './snap-cmd'; diff --git a/scopes/component/stash/stash.main.runtime.ts b/scopes/component/stash/stash.main.runtime.ts index c4b827b3ddda..53aa17dca636 100644 --- a/scopes/component/stash/stash.main.runtime.ts +++ b/scopes/component/stash/stash.main.runtime.ts @@ -1,11 +1,11 @@ -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; -import SnappingAspect, { SnappingMain } from '@teambit/snapping'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; +import { SnappingAspect, SnappingMain } from '@teambit/snapping'; import { Component, ComponentID } from '@teambit/component'; import { BitError } from '@teambit/bit-error'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component'; import { compact } from 'lodash'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import CheckoutAspect, { CheckoutMain } from '@teambit/checkout'; +import { CheckoutAspect, CheckoutMain } from '@teambit/checkout'; import { StashAspect } from './stash.aspect'; import { StashCmd, StashLoadCmd, StashSaveCmd } from './stash.cmd'; import { StashData } from './stash-data'; diff --git a/scopes/component/status/status.main.runtime.ts b/scopes/component/status/status.main.runtime.ts index 8d624f3716c8..88bf62f349f3 100644 --- a/scopes/component/status/status.main.runtime.ts +++ b/scopes/component/status/status.main.runtime.ts @@ -2,8 +2,8 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import pMapSeries from 'p-map-series'; import { LaneId } from '@teambit/lane-id'; import { IssuesClasses, IssuesList } from '@teambit/component-issues'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; -import LanesAspect, { LanesMain } from '@teambit/lanes'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { LanesAspect, LanesMain } from '@teambit/lanes'; import { ComponentID } from '@teambit/component-id'; import { Component, InvalidComponent } from '@teambit/component'; import loader from '@teambit/legacy/dist/cli/loader'; @@ -15,7 +15,7 @@ import ComponentsList from '@teambit/legacy/dist/consumer/component/components-l import { ModelComponent } from '@teambit/legacy/dist/scope/models'; import { InsightsAspect, InsightsMain } from '@teambit/insights'; import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import { StatusCmd } from './status-cmd'; import { StatusAspect } from './status.aspect'; import { MiniStatusCmd, MiniStatusOpts } from './mini-status-cmd'; diff --git a/scopes/component/testing/mock-components/mock-components.ts b/scopes/component/testing/mock-components/mock-components.ts index f27c3625c2b2..9592afbe8283 100644 --- a/scopes/component/testing/mock-components/mock-components.ts +++ b/scopes/component/testing/mock-components/mock-components.ts @@ -1,12 +1,12 @@ import { CompilerAspect, CompilerMain } from '@teambit/compiler'; import { loadManyAspects } from '@teambit/harmony.testing.load-aspect'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { InstallAspect } from '@teambit/install'; import type { InstallMain } from '@teambit/install'; import fs from 'fs-extra'; import pMapSeries from 'p-map-series'; import path from 'path'; -import TrackerAspect, { TrackerMain } from '@teambit/tracker'; +import { TrackerAspect, TrackerMain } from '@teambit/tracker'; import { ComponentID } from '@teambit/component-id'; type CompDirs = { diff --git a/scopes/component/tracker/tracker.main.runtime.ts b/scopes/component/tracker/tracker.main.runtime.ts index 601bf8cc3002..a1b6a7665ce0 100644 --- a/scopes/component/tracker/tracker.main.runtime.ts +++ b/scopes/component/tracker/tracker.main.runtime.ts @@ -2,7 +2,7 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import path from 'path'; import { ComponentID } from '@teambit/component-id'; import EnvsAspect from '@teambit/envs'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path'; import { AddCmd } from './add-cmd'; diff --git a/scopes/compositions/compositions/compositions.main.runtime.ts b/scopes/compositions/compositions/compositions.main.runtime.ts index f57cd368f887..51de0b3a13e8 100644 --- a/scopes/compositions/compositions/compositions.main.runtime.ts +++ b/scopes/compositions/compositions/compositions.main.runtime.ts @@ -1,8 +1,8 @@ import { MainRuntime } from '@teambit/cli'; import { AspectData, Component, ComponentMap, IComponent } from '@teambit/component'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader'; import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources'; diff --git a/scopes/defender/tester/tester.main.runtime.ts b/scopes/defender/tester/tester.main.runtime.ts index 9a87576bfddc..3f4537fe7450 100644 --- a/scopes/defender/tester/tester.main.runtime.ts +++ b/scopes/defender/tester/tester.main.runtime.ts @@ -9,7 +9,7 @@ import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { BuilderAspect, BuilderMain } from '@teambit/builder'; import { UiMain, UIAspect } from '@teambit/ui'; import { merge } from 'lodash'; -import DevFilesAspect, { DevFilesMain } from '@teambit/dev-files'; +import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; import { TestsResult } from '@teambit/tests-results'; import { ComponentsResults, CallbackFn, Tests } from './tester'; import { TestCmd } from './test.cmd'; diff --git a/scopes/dependencies/dependencies/dependencies-loader/dependencies-loader.ts b/scopes/dependencies/dependencies/dependencies-loader/dependencies-loader.ts index b4b41a1b359b..03779dd56b84 100644 --- a/scopes/dependencies/dependencies/dependencies-loader/dependencies-loader.ts +++ b/scopes/dependencies/dependencies/dependencies-loader/dependencies-loader.ts @@ -8,7 +8,7 @@ import Component from '@teambit/legacy/dist/consumer/component/consumer-componen import { DependencyLoaderOpts } from '@teambit/legacy/dist/consumer/component/component-loader'; import { COMPONENT_CONFIG_FILE_NAME } from '@teambit/legacy/dist/constants'; import { Workspace } from '@teambit/workspace'; -import DependencyResolverAspect, { DependencyResolverMain } from '@teambit/dependency-resolver'; +import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import { DevFilesMain } from '@teambit/dev-files'; import { AspectLoaderMain } from '@teambit/aspect-loader'; import { DependenciesData } from './dependencies-data'; diff --git a/scopes/dependencies/dependencies/dependencies.main.runtime.ts b/scopes/dependencies/dependencies/dependencies.main.runtime.ts index a76d00e29d6e..96b892d5aa4a 100644 --- a/scopes/dependencies/dependencies/dependencies.main.runtime.ts +++ b/scopes/dependencies/dependencies/dependencies.main.runtime.ts @@ -6,16 +6,16 @@ import { DependencyResolverMain, KEY_NAME_BY_LIFECYCLE_TYPE, } from '@teambit/dependency-resolver'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { cloneDeep, compact, set } from 'lodash'; import pMapSeries from 'p-map-series'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component'; import ComponentLoader, { DependencyLoaderOpts } from '@teambit/legacy/dist/consumer/component/component-loader'; -import DevFilesAspect, { DevFilesMain } from '@teambit/dev-files'; -import GraphAspect, { ComponentIdGraph, GraphMain } from '@teambit/graph'; -import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader'; +import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; +import { GraphAspect, ComponentIdGraph, GraphMain } from '@teambit/graph'; +import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; import { snapToSemver } from '@teambit/component-package-version'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { DependenciesLoader } from './dependencies-loader/dependencies-loader'; import { DependenciesData, OverridesDependenciesData } from './dependencies-loader/dependencies-data'; import { diff --git a/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts b/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts index 7780a33fa5c5..68bbfd3636f5 100644 --- a/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts +++ b/scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts @@ -3,7 +3,7 @@ import mapSeries from 'p-map-series'; import { MainRuntime } from '@teambit/cli'; import { getAllCoreAspectsIds } from '@teambit/bit'; import { getRelativeRootComponentDir } from '@teambit/bit-roots'; -import ComponentAspect, { Component, ComponentMap, ComponentMain, IComponent } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMap, ComponentMain, IComponent } from '@teambit/component'; import type { ConfigMain } from '@teambit/config'; import { join } from 'path'; import { compact, get, pick, uniq, omit } from 'lodash'; @@ -33,8 +33,8 @@ import { readCAFileSync } from '@pnpm/network.ca-file'; import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources'; import { ProjectManifest } from '@pnpm/types'; import semver, { SemVer } from 'semver'; -import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { PackageJsonTransformer } from '@teambit/workspace.modules.node-modules-linker'; import { Registries, Registry } from './registry'; import { applyUpdates, UpdatedComponent } from './apply-updates'; diff --git a/scopes/dependencies/pnpm/pnpm.ui.runtime.tsx b/scopes/dependencies/pnpm/pnpm.ui.runtime.tsx index 0e0881fef3c0..f052f90a431d 100644 --- a/scopes/dependencies/pnpm/pnpm.ui.runtime.tsx +++ b/scopes/dependencies/pnpm/pnpm.ui.runtime.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { UIRuntime } from '@teambit/ui'; import { Install } from '@teambit/ui-foundation.ui.use-box.menu'; -import ComponentAspect, { ComponentUI, ConsumePlugin } from '@teambit/component'; +import { ComponentAspect, ComponentUI, ConsumePlugin } from '@teambit/component'; import { PnpmAspect } from './pnpm.aspect'; export class PnpmUI { diff --git a/scopes/dependencies/yarn/yarn.ui.runtime.tsx b/scopes/dependencies/yarn/yarn.ui.runtime.tsx index ec84487236a1..8d0609f895a6 100644 --- a/scopes/dependencies/yarn/yarn.ui.runtime.tsx +++ b/scopes/dependencies/yarn/yarn.ui.runtime.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { UIRuntime } from '@teambit/ui'; import { Install } from '@teambit/ui-foundation.ui.use-box.menu'; -import ComponentAspect, { ComponentUI, ConsumePlugin } from '@teambit/component'; +import { ComponentAspect, ComponentUI, ConsumePlugin } from '@teambit/component'; import { YarnAspect } from './yarn.aspect'; export class YarnUI { diff --git a/scopes/docs/docs/docs.main.runtime.ts b/scopes/docs/docs/docs.main.runtime.ts index 2c43bbdeb0cb..657d0fba8cc3 100644 --- a/scopes/docs/docs/docs.main.runtime.ts +++ b/scopes/docs/docs/docs.main.runtime.ts @@ -3,12 +3,12 @@ import { MainRuntime } from '@teambit/cli'; import { LoggerAspect, LoggerMain, Logger } from '@teambit/logger'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; import { Component, ComponentMap, IComponent } from '@teambit/component'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { PkgAspect, PkgMain } from '@teambit/pkg'; import type { Environment } from '@teambit/envs'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { PreviewAspect, PreviewMain } from '@teambit/preview'; -import DevFilesAspect, { DevFilesMain } from '@teambit/dev-files'; +import { DevFilesAspect, DevFilesMain } from '@teambit/dev-files'; import { ComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader'; import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources'; import { Workspace, WorkspaceAspect } from '@teambit/workspace'; diff --git a/scopes/docs/docs/docs.ui.runtime.tsx b/scopes/docs/docs/docs.ui.runtime.tsx index 512e076202dc..726ad3edbe4e 100644 --- a/scopes/docs/docs/docs.ui.runtime.tsx +++ b/scopes/docs/docs/docs.ui.runtime.tsx @@ -3,10 +3,10 @@ import { flatten } from 'lodash'; import { ComponentAspect, ComponentUI } from '@teambit/component'; import { Slot } from '@teambit/harmony'; import { UIRuntime } from '@teambit/ui'; -import ComponentCompareAspect, { ComponentCompareUI } from '@teambit/component-compare'; +import { ComponentCompareAspect, ComponentCompareUI } from '@teambit/component-compare'; import { OverviewCompare } from '@teambit/docs.ui.overview-compare'; import { OverviewCompareSection } from '@teambit/docs.ui.overview-compare-section'; -import APIReferenceAspect, { APIReferenceUI } from '@teambit/api-reference'; +import { APIReferenceAspect, APIReferenceUI } from '@teambit/api-reference'; import { DocsAspect } from './docs.aspect'; import { OverviewSection } from './overview.section'; import type { TitleBadgeSlot, TitleBadge, OverviewOptionsSlot, OverviewOptions } from './overview'; diff --git a/scopes/envs/env/env.main.runtime.ts b/scopes/envs/env/env.main.runtime.ts index 4973f076a58b..4bb97d0f2beb 100644 --- a/scopes/envs/env/env.main.runtime.ts +++ b/scopes/envs/env/env.main.runtime.ts @@ -1,6 +1,6 @@ -import AspectAspect, { AspectMain } from '@teambit/aspect'; +import { AspectAspect, AspectMain } from '@teambit/aspect'; import { MainRuntime } from '@teambit/cli'; -import EnvsAspect, { Environment, EnvsMain, EnvTransformer } from '@teambit/envs'; +import { EnvsAspect, Environment, EnvsMain, EnvTransformer } from '@teambit/envs'; import { EnvAspect } from './env.aspect'; import { EnvEnv } from './env.env'; diff --git a/scopes/envs/envs/environments.main.runtime.ts b/scopes/envs/envs/environments.main.runtime.ts index e98e3c112536..92c4072ae0d2 100644 --- a/scopes/envs/envs/environments.main.runtime.ts +++ b/scopes/envs/envs/environments.main.runtime.ts @@ -5,7 +5,7 @@ import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { Component, ComponentAspect, ComponentMain } from '@teambit/component'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import pMapSeries from 'p-map-series'; import { IssuesClasses } from '@teambit/component-issues'; import { Harmony, Slot, SlotRegistry } from '@teambit/harmony'; @@ -15,7 +15,7 @@ import { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/cons import { BitError } from '@teambit/bit-error'; import findDuplications from '@teambit/legacy/dist/utils/array/find-duplications'; import { head, uniq } from 'lodash'; -import WorkerAspect, { WorkerMain } from '@teambit/worker'; +import { WorkerAspect, WorkerMain } from '@teambit/worker'; import { ComponentID } from '@teambit/component-id'; import { EnvService } from './services'; import { Environment } from './environment'; diff --git a/scopes/explorer/command-bar/command-bar.ui.runtime.tsx b/scopes/explorer/command-bar/command-bar.ui.runtime.tsx index d1c829de52aa..176b277cbe71 100644 --- a/scopes/explorer/command-bar/command-bar.ui.runtime.tsx +++ b/scopes/explorer/command-bar/command-bar.ui.runtime.tsx @@ -2,7 +2,7 @@ import React, { useState, ComponentType } from 'react'; import flatten from 'lodash.flatten'; import Mousetrap from 'mousetrap'; import { Slot, SlotRegistry } from '@teambit/harmony'; -import UIAspect, { UIRuntime, UiUI } from '@teambit/ui'; +import { UIAspect, UIRuntime, UiUI } from '@teambit/ui'; import { PubsubAspect, PubsubUI } from '@teambit/pubsub'; import { ReactRouterAspect } from '@teambit/react-router'; import { isBrowser } from '@teambit/ui-foundation.ui.is-browser'; diff --git a/scopes/explorer/insights/insights.main.runtime.ts b/scopes/explorer/insights/insights.main.runtime.ts index b476e0505fe6..e96a9942c73b 100644 --- a/scopes/explorer/insights/insights.main.runtime.ts +++ b/scopes/explorer/insights/insights.main.runtime.ts @@ -1,7 +1,7 @@ import { CLIAspect, MainRuntime, CLIMain } from '@teambit/cli'; import { GraphAspect, GraphMain } from '@teambit/graph'; import { IssuesClasses } from '@teambit/component-issues'; -import IssuesAspect, { IssuesMain } from '@teambit/issues'; +import { IssuesAspect, IssuesMain } from '@teambit/issues'; import pMapSeries from 'p-map-series'; import { Component } from '@teambit/component'; import { InsightsAspect } from './insights.aspect'; diff --git a/scopes/generator/generator/component-generator.ts b/scopes/generator/generator/component-generator.ts index e307020cba27..b299d5a8694b 100644 --- a/scopes/generator/generator/component-generator.ts +++ b/scopes/generator/generator/component-generator.ts @@ -3,7 +3,7 @@ import fs from 'fs-extra'; import pMapSeries from 'p-map-series'; import path from 'path'; import { Workspace } from '@teambit/workspace'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; import camelcase from 'camelcase'; import { BitError } from '@teambit/bit-error'; import { Logger } from '@teambit/logger'; diff --git a/scopes/generator/generator/generator.main.runtime.ts b/scopes/generator/generator/generator.main.runtime.ts index 12d283d46088..124da4ee7189 100644 --- a/scopes/generator/generator/generator.main.runtime.ts +++ b/scopes/generator/generator/generator.main.runtime.ts @@ -1,20 +1,20 @@ import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { EnvDefinition, EnvsAspect, EnvsMain } from '@teambit/envs'; import ComponentConfig from '@teambit/legacy/dist/consumer/config'; -import WorkspaceConfigFilesAspect, { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; +import { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; -import ComponentAspect, { ComponentID } from '@teambit/component'; +import { ComponentAspect, ComponentID } from '@teambit/component'; import type { ComponentMain, Component } from '@teambit/component'; import { isCoreAspect, loadBit, restoreGlobals } from '@teambit/bit'; import { Slot, SlotRegistry } from '@teambit/harmony'; -import GitAspect, { GitMain } from '@teambit/git'; +import { GitAspect, GitMain } from '@teambit/git'; import { BitError } from '@teambit/bit-error'; -import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader'; -import TrackerAspect, { TrackerMain } from '@teambit/tracker'; -import NewComponentHelperAspect, { NewComponentHelperMain } from '@teambit/new-component-helper'; +import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; +import { TrackerAspect, TrackerMain } from '@teambit/tracker'; +import { NewComponentHelperAspect, NewComponentHelperMain } from '@teambit/new-component-helper'; import { compact } from 'lodash'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { ComponentTemplate } from './component-template'; diff --git a/scopes/generator/generator/workspace-generator.ts b/scopes/generator/generator/workspace-generator.ts index de4c5a82a8d9..8d381c86bd57 100644 --- a/scopes/generator/generator/workspace-generator.ts +++ b/scopes/generator/generator/workspace-generator.ts @@ -4,20 +4,20 @@ import { Harmony } from '@teambit/harmony'; import { Component } from '@teambit/component'; import execa from 'execa'; import pMapSeries from 'p-map-series'; -import UIAspect, { UiMain } from '@teambit/ui'; +import { UIAspect, UiMain } from '@teambit/ui'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { WorkspaceAspect, Workspace } from '@teambit/workspace'; -import ForkingAspect, { ForkingMain } from '@teambit/forking'; +import { ForkingAspect, ForkingMain } from '@teambit/forking'; import { init } from '@teambit/legacy/dist/api/consumer'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; import getGitExecutablePath from '@teambit/legacy/dist/utils/git/git-executable'; import GitNotFound from '@teambit/legacy/dist/utils/git/exceptions/git-not-found'; import { resolve, join } from 'path'; import { ComponentID } from '@teambit/component-id'; -import GitAspect, { GitMain } from '@teambit/git'; +import { GitAspect, GitMain } from '@teambit/git'; import { InstallAspect, InstallMain } from '@teambit/install'; -import WorkspaceConfigFilesAspect, { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; +import { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; // import { ComponentGenerator } from './component-generator'; import { WorkspaceTemplate, WorkspaceContext } from './workspace-template'; import { NewOptions } from './new.cmd'; diff --git a/scopes/harmony/api-server/api-server.main.runtime.ts b/scopes/harmony/api-server/api-server.main.runtime.ts index 606765665f26..f60cc00977af 100644 --- a/scopes/harmony/api-server/api-server.main.runtime.ts +++ b/scopes/harmony/api-server/api-server.main.runtime.ts @@ -1,20 +1,20 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { ExpressAspect, ExpressMain } from '@teambit/express'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import LanesAspect, { LanesMain } from '@teambit/lanes'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; -import SnappingAspect, { SnappingMain } from '@teambit/snapping'; +import { LanesAspect, LanesMain } from '@teambit/lanes'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; +import { SnappingAspect, SnappingMain } from '@teambit/snapping'; import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; -import ComponentCompareAspect, { ComponentCompareMain } from '@teambit/component-compare'; -import ComponentLogAspect, { ComponentLogMain } from '@teambit/component-log'; -import WatcherAspect, { WatcherMain } from '@teambit/watcher'; +import { ComponentCompareAspect, ComponentCompareMain } from '@teambit/component-compare'; +import { ComponentLogAspect, ComponentLogMain } from '@teambit/component-log'; +import { WatcherAspect, WatcherMain } from '@teambit/watcher'; import { ConfigAspect, ConfigMain } from '@teambit/config'; import { ExportAspect, ExportMain } from '@teambit/export'; -import CheckoutAspect, { CheckoutMain } from '@teambit/checkout'; -import InstallAspect, { InstallMain } from '@teambit/install'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { CheckoutAspect, CheckoutMain } from '@teambit/checkout'; +import { InstallAspect, InstallMain } from '@teambit/install'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { Component } from '@teambit/component'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { ApiServerAspect } from './api-server.aspect'; import { CLIRoute } from './cli.route'; import { ServerCmd } from './server.cmd'; diff --git a/scopes/harmony/application/application.main.runtime.ts b/scopes/harmony/application/application.main.runtime.ts index e37a30ef5ef8..1eb6e59fb44b 100644 --- a/scopes/harmony/application/application.main.runtime.ts +++ b/scopes/harmony/application/application.main.runtime.ts @@ -2,14 +2,14 @@ import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli'; import { compact, flatten, head } from 'lodash'; import { AspectLoaderMain, AspectLoaderAspect } from '@teambit/aspect-loader'; import { Slot, SlotRegistry, Harmony } from '@teambit/harmony'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { BitError } from '@teambit/bit-error'; -import WatcherAspect, { WatcherMain } from '@teambit/watcher'; +import { WatcherAspect, WatcherMain } from '@teambit/watcher'; import { BuilderAspect, BuilderMain } from '@teambit/builder'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { EnvsAspect, EnvsMain } from '@teambit/envs'; -import ComponentAspect, { ComponentMain, ComponentID, Component } from '@teambit/component'; +import { ComponentAspect, ComponentMain, ComponentID, Component } from '@teambit/component'; import { ApplicationType } from './application-type'; import { Application } from './application'; import { DeploymentProvider } from './deployment-provider'; diff --git a/scopes/harmony/aspect/aspect.main.runtime.ts b/scopes/harmony/aspect/aspect.main.runtime.ts index caaffbf696ef..aeddf34697fc 100644 --- a/scopes/harmony/aspect/aspect.main.runtime.ts +++ b/scopes/harmony/aspect/aspect.main.runtime.ts @@ -12,8 +12,8 @@ import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; import { BabelAspect, BabelMain } from '@teambit/babel'; import { ComponentID } from '@teambit/component-id'; import { AspectList } from '@teambit/component'; -import WorkerAspect, { WorkerMain } from '@teambit/worker'; -import WorkspaceAspect, { ExtensionsOrigin, Workspace } from '@teambit/workspace'; +import { WorkerAspect, WorkerMain } from '@teambit/worker'; +import { WorkspaceAspect, ExtensionsOrigin, Workspace } from '@teambit/workspace'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; import { AspectAspect } from './aspect.aspect'; import { AspectEnv } from './aspect.env'; diff --git a/scopes/harmony/diagnostic/diagnostic.main.runtime.ts b/scopes/harmony/diagnostic/diagnostic.main.runtime.ts index 7dd61686f480..194d3511715a 100644 --- a/scopes/harmony/diagnostic/diagnostic.main.runtime.ts +++ b/scopes/harmony/diagnostic/diagnostic.main.runtime.ts @@ -3,7 +3,7 @@ import { getHarmonyVersion } from '@teambit/legacy/dist/bootstrap'; import { Slot, SlotRegistry } from '@teambit/harmony'; import { MainRuntime } from '@teambit/cli'; import { ExpressAspect, ExpressMain } from '@teambit/express'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { DiagnosticAspect } from './diagnostic.aspect'; import { DiagnosticRoute } from './diagnostic.route'; import { DiagnosticGraphql } from './diagnostic.graphql'; diff --git a/scopes/harmony/ipc-events/ipc-events.main.runtime.ts b/scopes/harmony/ipc-events/ipc-events.main.runtime.ts index 8cb7077d0618..5c7ad665ae3c 100644 --- a/scopes/harmony/ipc-events/ipc-events.main.runtime.ts +++ b/scopes/harmony/ipc-events/ipc-events.main.runtime.ts @@ -1,4 +1,4 @@ -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { Slot, SlotRegistry } from '@teambit/harmony'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import pMapSeries from 'p-map-series'; diff --git a/scopes/harmony/node/node.main.runtime.ts b/scopes/harmony/node/node.main.runtime.ts index 92c1e507f8af..d56af76b4c1a 100644 --- a/scopes/harmony/node/node.main.runtime.ts +++ b/scopes/harmony/node/node.main.runtime.ts @@ -9,7 +9,7 @@ import { MainRuntime } from '@teambit/cli'; import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; import { BuildTask } from '@teambit/builder'; import { ComponentID } from '@teambit/component-id'; -import WorkerAspect, { WorkerMain } from '@teambit/worker'; +import { WorkerAspect, WorkerMain } from '@teambit/worker'; import { Compiler } from '@teambit/compiler'; import { PackageJsonProps } from '@teambit/pkg'; import { EnvsAspect, EnvsMain, EnvTransformer, Environment, EnvContext } from '@teambit/envs'; diff --git a/scopes/lanes/lanes/lanes.main.runtime.ts b/scopes/lanes/lanes/lanes.main.runtime.ts index 30103d896343..b5022894ffe1 100644 --- a/scopes/lanes/lanes/lanes.main.runtime.ts +++ b/scopes/lanes/lanes/lanes.main.runtime.ts @@ -18,7 +18,7 @@ import { HistoryItem } from '@teambit/legacy/dist/scope/models/lane-history'; import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { ComponentIdList, ComponentID } from '@teambit/component-id'; import { InvalidScopeName, isValidScopeName } from '@teambit/legacy-bit-id'; -import ComponentAspect, { Component, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain } from '@teambit/component'; import removeLanes from '@teambit/legacy/dist/consumer/lanes/remove-lanes'; import { Lane, LaneHistory, Version } from '@teambit/legacy/dist/scope/models'; import { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data'; @@ -27,11 +27,11 @@ import { ExportAspect, ExportMain } from '@teambit/export'; import { compact } from 'lodash'; import { ComponentCompareMain, ComponentCompareAspect } from '@teambit/component-compare'; import { Ref } from '@teambit/legacy/dist/scope/objects'; -import ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer'; +import { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer'; import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; import { MergingMain, MergingAspect } from '@teambit/merging'; -import CheckoutAspect, { CheckoutMain } from '@teambit/checkout'; +import { CheckoutAspect, CheckoutMain } from '@teambit/checkout'; import { ChangeType } from '@teambit/lanes.entities.lane-diff'; import ComponentsList, { DivergeDataPerId } from '@teambit/legacy/dist/consumer/component/components-list'; import { NoCommonSnap } from '@teambit/legacy/dist/scope/exceptions/no-common-snap'; diff --git a/scopes/lanes/lanes/lanes.spec.ts b/scopes/lanes/lanes/lanes.spec.ts index cff9f4954432..f13440eb314a 100644 --- a/scopes/lanes/lanes/lanes.spec.ts +++ b/scopes/lanes/lanes/lanes.spec.ts @@ -2,9 +2,9 @@ import { expect } from 'chai'; import fs from 'fs-extra'; import path from 'path'; import { loadAspect, loadManyAspects } from '@teambit/harmony.testing.load-aspect'; -import RemoveAspect, { RemoveMain } from '@teambit/remove'; -import SnappingAspect, { SnappingMain } from '@teambit/snapping'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { RemoveAspect, RemoveMain } from '@teambit/remove'; +import { SnappingAspect, SnappingMain } from '@teambit/snapping'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { ExportAspect, ExportMain } from '@teambit/export'; import { LaneId } from '@teambit/lane-id'; import { SUPPORT_LANE_HISTORY, addFeature, removeFeature } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle'; diff --git a/scopes/lanes/lanes/lanes.ui.runtime.tsx b/scopes/lanes/lanes/lanes.ui.runtime.tsx index 7c1bbc157989..e5bdf65baf8b 100644 --- a/scopes/lanes/lanes/lanes.ui.runtime.tsx +++ b/scopes/lanes/lanes/lanes.ui.runtime.tsx @@ -5,9 +5,9 @@ import { LaneCompare, LaneCompareProps as DefaultLaneCompareProps } from '@teamb import { UIRuntime, UiUI, UIAspect } from '@teambit/ui'; import { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router'; import { NotFoundPage } from '@teambit/design.ui.pages.not-found'; -import ScopeAspect, { ScopeContext, ScopeUI } from '@teambit/scope'; -import WorkspaceAspect, { WorkspaceUI } from '@teambit/workspace'; -import ComponentAspect, { ComponentUI, useIdFromLocation, ComponentID } from '@teambit/component'; +import { ScopeAspect, ScopeContext, ScopeUI } from '@teambit/scope'; +import { WorkspaceAspect, WorkspaceUI } from '@teambit/workspace'; +import { ComponentAspect, ComponentUI, useIdFromLocation, ComponentID } from '@teambit/component'; import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu'; import { LaneOverview, LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview'; import { diff --git a/scopes/lanes/merge-lanes/merge-lanes.main.runtime.ts b/scopes/lanes/merge-lanes/merge-lanes.main.runtime.ts index 69c2be2fe053..6228ca520fdd 100644 --- a/scopes/lanes/merge-lanes/merge-lanes.main.runtime.ts +++ b/scopes/lanes/merge-lanes/merge-lanes.main.runtime.ts @@ -1,15 +1,16 @@ import { BitError } from '@teambit/bit-error'; import path from 'path'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import ImporterAspect, { ImporterMain } from '@teambit/importer'; +import { ImporterAspect, ImporterMain } from '@teambit/importer'; import { LanesAspect, LanesMain } from '@teambit/lanes'; -import MergingAspect, { +import { + MergingAspect, MergingMain, ComponentMergeStatus, ApplyVersionResults, compIsAlreadyMergedMsg, } from '@teambit/merging'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { getBasicLog } from '@teambit/legacy/dist/utils/bit/basic-log'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; import { Log } from '@teambit/legacy/dist/scope/models/version'; @@ -21,12 +22,12 @@ import { DEFAULT_LANE, LaneId } from '@teambit/lane-id'; import { ConfigMergeResult } from '@teambit/config-merger'; import { Lane, Version } from '@teambit/legacy/dist/scope/models'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import CheckoutAspect, { CheckoutMain, CheckoutProps, throwForFailures } from '@teambit/checkout'; +import { CheckoutAspect, CheckoutMain, CheckoutProps, throwForFailures } from '@teambit/checkout'; import { SnapsDistance } from '@teambit/legacy/dist/scope/component-ops/snaps-distance'; import { RemoveAspect, RemoveMain } from '@teambit/remove'; import { compact, uniq } from 'lodash'; import { ExportAspect, ExportMain } from '@teambit/export'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { BitObject, Ref } from '@teambit/legacy/dist/scope/objects'; import { getDivergeData } from '@teambit/legacy/dist/scope/component-ops/get-diverge-data'; import { MergeLanesAspect } from './merge-lanes.aspect'; diff --git a/scopes/mdx/mdx/mdx.main.runtime.ts b/scopes/mdx/mdx/mdx.main.runtime.ts index 37ad41b80de1..dc6dec948166 100644 --- a/scopes/mdx/mdx/mdx.main.runtime.ts +++ b/scopes/mdx/mdx/mdx.main.runtime.ts @@ -5,13 +5,13 @@ import { BabelAspect, BabelMain } from '@teambit/babel'; import { MainRuntime } from '@teambit/cli'; import { CompilerAspect, CompilerMain } from '@teambit/compiler'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import DocsAspect, { DocsMain } from '@teambit/docs'; +import { DocsAspect, DocsMain } from '@teambit/docs'; import { ComponentID } from '@teambit/component-id'; import { LoggerMain } from '@teambit/logger'; import { WorkerMain } from '@teambit/worker'; import { EnvContext, EnvsAspect, EnvsMain } from '@teambit/envs'; -import MultiCompilerAspect, { MultiCompilerMain } from '@teambit/multi-compiler'; -import ReactAspect, { ReactEnv, ReactMain } from '@teambit/react'; +import { MultiCompilerAspect, MultiCompilerMain } from '@teambit/multi-compiler'; +import { ReactAspect, ReactEnv, ReactMain } from '@teambit/react'; import { GeneratorAspect, GeneratorMain } from '@teambit/generator'; import { MDXAspect } from './mdx.aspect'; import { MDXCompiler, MDXCompilerOpts } from './mdx.compiler'; diff --git a/scopes/mdx/readme/readme.main.runtime.ts b/scopes/mdx/readme/readme.main.runtime.ts index 1a893ddccf77..b667798c7b04 100644 --- a/scopes/mdx/readme/readme.main.runtime.ts +++ b/scopes/mdx/readme/readme.main.runtime.ts @@ -1,7 +1,7 @@ import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { MainRuntime } from '@teambit/cli'; -import MDXAspect, { MdxEnv, MDXMain } from '@teambit/mdx'; -import DocsAspect, { DocsMain } from '@teambit/docs'; +import { MDXAspect, MdxEnv, MDXMain } from '@teambit/mdx'; +import { DocsAspect, DocsMain } from '@teambit/docs'; import { ReadmeAspect } from './readme.aspect'; import { ReadmeEnv } from './readme.env'; diff --git a/scopes/pipelines/builder/artifact/artifact-extractor.ts b/scopes/pipelines/builder/artifact/artifact-extractor.ts index 247e222a7de3..d5d613af1359 100644 --- a/scopes/pipelines/builder/artifact/artifact-extractor.ts +++ b/scopes/pipelines/builder/artifact/artifact-extractor.ts @@ -2,7 +2,7 @@ import path from 'path'; import filenamify from 'filenamify'; import fs from 'fs-extra'; import { ComponentMain } from '@teambit/component'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; import pMapSeries from 'p-map-series'; import minimatch from 'minimatch'; diff --git a/scopes/pipelines/builder/builder.main.runtime.ts b/scopes/pipelines/builder/builder.main.runtime.ts index 18e684de750a..5e4d882ff690 100644 --- a/scopes/pipelines/builder/builder.main.runtime.ts +++ b/scopes/pipelines/builder/builder.main.runtime.ts @@ -7,7 +7,7 @@ import { Component, ComponentMap, IComponent, ComponentAspect, ComponentMain, Co import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { Slot, SlotRegistry } from '@teambit/harmony'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import AspectAspect from '@teambit/aspect'; import { ScopeAspect, ScopeMain } from '@teambit/scope'; diff --git a/scopes/pkg/pkg/pkg.main.runtime.ts b/scopes/pkg/pkg/pkg.main.runtime.ts index bdd65068f007..faf734ef93de 100644 --- a/scopes/pkg/pkg/pkg.main.runtime.ts +++ b/scopes/pkg/pkg/pkg.main.runtime.ts @@ -2,7 +2,7 @@ import { compact, omit } from 'lodash'; import { join } from 'path'; import fs from 'fs-extra'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import ComponentAspect, { Component, ComponentMain, IComponent, Snap } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain, IComponent, Snap } from '@teambit/component'; import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { Slot, SlotRegistry } from '@teambit/harmony'; import { IsolatorAspect, IsolatorMain } from '@teambit/isolator'; diff --git a/scopes/pkg/pkg/pkg.ui.runtime.tsx b/scopes/pkg/pkg/pkg.ui.runtime.tsx index 5a9493d87f73..628a465d8a11 100644 --- a/scopes/pkg/pkg/pkg.ui.runtime.tsx +++ b/scopes/pkg/pkg/pkg.ui.runtime.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { UIRuntime } from '@teambit/ui'; import { Install } from '@teambit/ui-foundation.ui.use-box.menu'; -import ComponentAspect, { ComponentUI, ConsumePlugin } from '@teambit/component'; +import { ComponentAspect, ComponentUI, ConsumePlugin } from '@teambit/component'; import { PkgAspect } from './pkg.aspect'; export class PkgUI { diff --git a/scopes/preview/preview/preview.main.runtime.ts b/scopes/preview/preview/preview.main.runtime.ts index fbd9630ade17..9f979ff7d611 100644 --- a/scopes/preview/preview/preview.main.runtime.ts +++ b/scopes/preview/preview/preview.main.runtime.ts @@ -25,14 +25,14 @@ import { join } from 'path'; import { PkgAspect, PkgMain } from '@teambit/pkg'; import { AspectLoaderAspect, getAspectDir, getAspectDirFromBvm } from '@teambit/aspect-loader'; import type { AspectDefinition, AspectLoaderMain } from '@teambit/aspect-loader'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { LoggerAspect, LoggerMain, Logger } from '@teambit/logger'; import { DependencyResolverAspect } from '@teambit/dependency-resolver'; import type { DependencyResolverMain } from '@teambit/dependency-resolver'; import { ArtifactFiles } from '@teambit/legacy/dist/consumer/component/sources/artifact-files'; -import WatcherAspect, { WatcherMain } from '@teambit/watcher'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { WatcherAspect, WatcherMain } from '@teambit/watcher'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { ONLY_OVERVIEW, isFeatureEnabled } from '@teambit/legacy/dist/api/consumer/lib/feature-toggle'; import { BundlingStrategyNotFound } from './exceptions'; import { generateLink, MainModulesMap } from './generate-link'; diff --git a/scopes/preview/preview/preview.preview.runtime.tsx b/scopes/preview/preview/preview.preview.runtime.tsx index 8303f6f5e2e4..99cf4c4f9c3b 100644 --- a/scopes/preview/preview/preview.preview.runtime.tsx +++ b/scopes/preview/preview/preview.preview.runtime.tsx @@ -1,4 +1,4 @@ -import PubsubAspect, { PubsubPreview } from '@teambit/pubsub'; +import { PubsubAspect, PubsubPreview } from '@teambit/pubsub'; import { Slot, SlotRegistry } from '@teambit/harmony'; import { ComponentID } from '@teambit/component-id'; import crossFetch from 'cross-fetch'; diff --git a/scopes/preview/ui/preview-placeholder/preview-placeholder.tsx b/scopes/preview/ui/preview-placeholder/preview-placeholder.tsx index ed573ce1468e..50743dc3d15e 100644 --- a/scopes/preview/ui/preview-placeholder/preview-placeholder.tsx +++ b/scopes/preview/ui/preview-placeholder/preview-placeholder.tsx @@ -1,5 +1,5 @@ import React, { useMemo, ComponentType, ReactNode } from 'react'; -import CompositionsAspect, { ComponentComposition, Composition } from '@teambit/compositions'; +import { CompositionsAspect, ComponentComposition, Composition } from '@teambit/compositions'; import { H3, H5 } from '@teambit/design.ui.heading'; import { capitalize } from '@teambit/toolbox.string.capitalize'; import { Icon } from '@teambit/evangelist.elements.icon'; diff --git a/scopes/react/react-native/react-native.main.runtime.ts b/scopes/react/react-native/react-native.main.runtime.ts index ba00f9246f45..aa36f5997cdc 100644 --- a/scopes/react/react-native/react-native.main.runtime.ts +++ b/scopes/react/react-native/react-native.main.runtime.ts @@ -5,7 +5,7 @@ import { MainRuntime } from '@teambit/cli'; import { merge } from 'lodash'; import { BuildTask } from '@teambit/builder'; import { Aspect } from '@teambit/harmony'; -import AspectAspect, { AspectMain } from '@teambit/aspect'; +import { AspectAspect, AspectMain } from '@teambit/aspect'; import { PackageJsonProps } from '@teambit/pkg'; import { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs'; import { ReactAspect, ReactMain, ReactEnv, UseWebpackModifiers } from '@teambit/react'; diff --git a/scopes/react/react/react.main.runtime.ts b/scopes/react/react/react.main.runtime.ts index 3dc9dc1a41e6..c092da36b844 100644 --- a/scopes/react/react/react.main.runtime.ts +++ b/scopes/react/react/react.main.runtime.ts @@ -30,7 +30,7 @@ import { LinterContext } from '@teambit/linter'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { ESLintMain, ESLintAspect, EslintConfigTransformer } from '@teambit/eslint'; import { PrettierMain, PrettierAspect, PrettierConfigTransformer } from '@teambit/prettier'; -import WorkerAspect, { WorkerMain } from '@teambit/worker'; +import { WorkerAspect, WorkerMain } from '@teambit/worker'; import { ReactAspect } from './react.aspect'; import { ReactEnv } from './react.env'; diff --git a/scopes/react/react/react.preview.runtime.ts b/scopes/react/react/react.preview.runtime.ts index 85788c7f469b..4eeeb7e879c5 100644 --- a/scopes/react/react/react.preview.runtime.ts +++ b/scopes/react/react/react.preview.runtime.ts @@ -1,7 +1,7 @@ import { ComponentType } from 'react'; import flatten from 'lodash.flatten'; import { SlotRegistry, Slot } from '@teambit/harmony'; -import PreviewAspect, { PreviewPreview, PreviewRuntime, RenderingContextProvider } from '@teambit/preview'; +import { PreviewAspect, PreviewPreview, PreviewRuntime, RenderingContextProvider } from '@teambit/preview'; import { HighlighterProvider } from '@teambit/react.ui.highlighter-provider'; import { ReactAspect } from './react.aspect'; diff --git a/scopes/react/react/react.ui.runtime.tsx b/scopes/react/react/react.ui.runtime.tsx index fa30896058b6..69a26eddea06 100644 --- a/scopes/react/react/react.ui.runtime.tsx +++ b/scopes/react/react/react.ui.runtime.tsx @@ -4,7 +4,7 @@ import { UIRuntime } from '@teambit/ui'; import { TesterAspect, TesterUI } from '@teambit/tester'; import { AddingTests } from '@teambit/react.instructions.react.adding-tests'; import { AddingCompositions } from '@teambit/react.instructions.react.adding-compositions'; -import APIReferenceAspect, { APIReferenceUI } from '@teambit/api-reference'; +import { APIReferenceAspect, APIReferenceUI } from '@teambit/api-reference'; import { reactRenderer } from '@teambit/api-reference.renderers.react'; import { ReactAspect } from './react.aspect'; diff --git a/scopes/scope/export/export.main.runtime.ts b/scopes/scope/export/export.main.runtime.ts index 096ec0a694c4..706747a24b1a 100644 --- a/scopes/scope/export/export.main.runtime.ts +++ b/scopes/scope/export/export.main.runtime.ts @@ -1,6 +1,6 @@ import fs from 'fs-extra'; import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { BitError } from '@teambit/bit-error'; import { Analytics } from '@teambit/legacy/dist/analytics/analytics'; import { ComponentID, ComponentIdList } from '@teambit/component-id'; @@ -24,7 +24,7 @@ import { RemoveAspect, RemoveMain } from '@teambit/remove'; import { Lane, ModelComponent, Symlink, Version } from '@teambit/legacy/dist/scope/models'; import hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard'; import { Scope } from '@teambit/legacy/dist/scope'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { LaneReadmeComponent } from '@teambit/legacy/dist/scope/models/lane'; import { Http } from '@teambit/legacy/dist/scope/network/http'; diff --git a/scopes/scope/importer/importer.main.runtime.ts b/scopes/scope/importer/importer.main.runtime.ts index 951229d1538d..6502b765c275 100644 --- a/scopes/scope/importer/importer.main.runtime.ts +++ b/scopes/scope/importer/importer.main.runtime.ts @@ -1,24 +1,24 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { Analytics } from '@teambit/legacy/dist/analytics/analytics'; import ConsumerComponent from '@teambit/legacy/dist/consumer/component'; import componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name'; import { InvalidScopeName, InvalidScopeNameFromRemote } from '@teambit/legacy-bit-id'; import pMapSeries from 'p-map-series'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; -import ComponentWriterAspect, { ComponentWriterMain } from '@teambit/component-writer'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; +import { ComponentWriterAspect, ComponentWriterMain } from '@teambit/component-writer'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { DEFAULT_LANE, LaneId } from '@teambit/lane-id'; import ScopeComponentsImporter from '@teambit/legacy/dist/scope/component-ops/scope-components-importer'; import { importAllArtifactsFromLane } from '@teambit/legacy/dist/consumer/component/sources/artifact-files'; -import InstallAspect, { InstallMain } from '@teambit/install'; +import { InstallAspect, InstallMain } from '@teambit/install'; import loader from '@teambit/legacy/dist/cli/loader'; import { ComponentIdList, ComponentID } from '@teambit/component-id'; import { Lane } from '@teambit/legacy/dist/scope/models'; import { ScopeNotFoundOrDenied } from '@teambit/legacy/dist/remotes/exceptions/scope-not-found-or-denied'; -import GraphAspect, { GraphMain } from '@teambit/graph'; +import { GraphAspect, GraphMain } from '@teambit/graph'; import { LaneNotFound } from '@teambit/legacy/dist/api/scope/lib/exceptions/lane-not-found'; import { BitError } from '@teambit/bit-error'; import { ImportCmd } from './import.cmd'; diff --git a/scopes/scope/scope/scope.main.runtime.ts b/scopes/scope/scope/scope.main.runtime.ts index 30c2874a4008..02373c9b26cc 100644 --- a/scopes/scope/scope/scope.main.runtime.ts +++ b/scopes/scope/scope/scope.main.runtime.ts @@ -1,4 +1,4 @@ -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; import { ExternalActions } from '@teambit/legacy/dist/api/scope/lib/action'; import mapSeries from 'p-map-series'; import path from 'path'; @@ -48,7 +48,7 @@ import { resumeExport } from '@teambit/legacy/dist/scope/component-ops/export-sc import { GLOBAL_SCOPE } from '@teambit/legacy/dist/constants'; import { BitId } from '@teambit/legacy-bit-id'; import { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { compact, slice, difference, partition } from 'lodash'; import { DepEdge } from '@teambit/legacy/dist/scope/models/version'; import { ComponentNotFound } from './exceptions'; diff --git a/scopes/scope/scope/scope.ui.runtime.tsx b/scopes/scope/scope/scope.ui.runtime.tsx index c9a116e7eadc..8ae390040782 100644 --- a/scopes/scope/scope/scope.ui.runtime.tsx +++ b/scopes/scope/scope/scope.ui.runtime.tsx @@ -11,7 +11,7 @@ import { MenuItemSlot, MenuItem } from '@teambit/ui-foundation.ui.main-dropdown' import { RouteProps } from 'react-router-dom'; import { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu'; import { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item'; -import CommandBarAspect, { CommandBarUI, CommandHandler } from '@teambit/command-bar'; +import { CommandBarAspect, CommandBarUI, CommandHandler } from '@teambit/command-bar'; import { ScopeModel } from '@teambit/scope.models.scope-model'; import { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer'; import { LanesModel } from '@teambit/lanes.ui.models.lanes-model'; diff --git a/scopes/scope/sign/sign.main.runtime.ts b/scopes/scope/sign/sign.main.runtime.ts index 9c154571bf06..e5424b8990c1 100644 --- a/scopes/scope/sign/sign.main.runtime.ts +++ b/scopes/scope/sign/sign.main.runtime.ts @@ -17,7 +17,7 @@ import { Remotes } from '@teambit/legacy/dist/remotes'; import { ComponentIdList } from '@teambit/component-id'; import Version, { Log } from '@teambit/legacy/dist/scope/models/version'; import { Http } from '@teambit/legacy/dist/scope/network/http'; -import LanesAspect, { LanesMain } from '@teambit/lanes'; +import { LanesAspect, LanesMain } from '@teambit/lanes'; import { LaneId } from '@teambit/lane-id'; import { Lane } from '@teambit/legacy/dist/scope/models'; import { SignCmd } from './sign.cmd'; diff --git a/scopes/semantics/schema/schema.main.runtime.ts b/scopes/semantics/schema/schema.main.runtime.ts index 2779439d8388..65d84a90a16f 100644 --- a/scopes/semantics/schema/schema.main.runtime.ts +++ b/scopes/semantics/schema/schema.main.runtime.ts @@ -1,7 +1,7 @@ import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli'; -import ComponentAspect, { Component, ComponentMain } from '@teambit/component'; +import { ComponentAspect, Component, ComponentMain } from '@teambit/component'; import { Slot, SlotRegistry } from '@teambit/harmony'; -import GraphqlAspect, { GraphqlMain } from '@teambit/graphql'; +import { GraphqlAspect, GraphqlMain } from '@teambit/graphql'; import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { PrettierConfigMutator } from '@teambit/defender.prettier.config-mutator'; @@ -14,7 +14,7 @@ import { } from '@teambit/semantics.entities.semantic-schema'; import { BuilderMain, BuilderAspect } from '@teambit/builder'; import { Workspace, WorkspaceAspect } from '@teambit/workspace'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { Formatter } from '@teambit/formatter'; import { Parser } from './parser'; import { SchemaAspect } from './schema.aspect'; diff --git a/scopes/semantics/schema/schema.spec.ts b/scopes/semantics/schema/schema.spec.ts index fc7e06671cae..92f21f60bb3f 100644 --- a/scopes/semantics/schema/schema.spec.ts +++ b/scopes/semantics/schema/schema.spec.ts @@ -3,11 +3,11 @@ import fs from 'fs-extra'; import chai, { expect } from 'chai'; import { APISchema, UnknownSchema } from '@teambit/semantics.entities.semantic-schema'; import chaiSubset from 'chai-subset'; -import TrackerAspect, { TrackerMain } from '@teambit/tracker'; +import { TrackerAspect, TrackerMain } from '@teambit/tracker'; import { loadAspect, loadManyAspects } from '@teambit/harmony.testing.load-aspect'; import { mockWorkspace, destroyWorkspace, WorkspaceData } from '@teambit/workspace.testing.mock-workspace'; import { ComponentID } from '@teambit/component-id'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import { SchemaMain } from './schema.main.runtime'; import { SchemaAspect } from '.'; diff --git a/scopes/typescript/typescript/typescript.extractor.ts b/scopes/typescript/typescript/typescript.extractor.ts index f2e9748c7bea..e7653ca535a2 100644 --- a/scopes/typescript/typescript/typescript.extractor.ts +++ b/scopes/typescript/typescript/typescript.extractor.ts @@ -10,7 +10,7 @@ import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources'; import { EnvContext } from '@teambit/envs'; import { Formatter } from '@teambit/formatter'; import { Logger } from '@teambit/logger'; -import AspectLoaderAspect, { AspectLoaderMain, getCoreAspectPackageName } from '@teambit/aspect-loader'; +import { AspectLoaderAspect, AspectLoaderMain, getCoreAspectPackageName } from '@teambit/aspect-loader'; import { ScopeMain } from '@teambit/scope'; import pMapSeries from 'p-map-series'; import { compact, flatten } from 'lodash'; diff --git a/scopes/typescript/typescript/typescript.main.runtime.ts b/scopes/typescript/typescript/typescript.main.runtime.ts index 397353069422..44d4d8c02de3 100644 --- a/scopes/typescript/typescript/typescript.main.runtime.ts +++ b/scopes/typescript/typescript/typescript.main.runtime.ts @@ -11,11 +11,11 @@ import type { Workspace } from '@teambit/workspace'; import { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver'; import pMapSeries from 'p-map-series'; import { TsserverClient, TsserverClientOpts } from '@teambit/ts-server'; -import AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader'; -import WatcherAspect, { WatcherMain, WatchOptions } from '@teambit/watcher'; +import { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader'; +import { WatcherAspect, WatcherMain, WatchOptions } from '@teambit/watcher'; import type { Component, ComponentID } from '@teambit/component'; import { BuilderAspect, BuilderMain } from '@teambit/builder'; -import EnvsAspect, { EnvsMain } from '@teambit/envs'; +import { EnvsAspect, EnvsMain } from '@teambit/envs'; import { ScopeMain, ScopeAspect } from '@teambit/scope'; import { TypeScriptExtractor } from './typescript.extractor'; import { TypeScriptCompilerOptions } from './compiler-options'; diff --git a/scopes/ui-foundation/harmony-ui-app/harmony-ui-app/harmony-ui-app.main.runtime.ts b/scopes/ui-foundation/harmony-ui-app/harmony-ui-app/harmony-ui-app.main.runtime.ts index 1cce8ca3e7e7..c76ec3cc1bbf 100644 --- a/scopes/ui-foundation/harmony-ui-app/harmony-ui-app/harmony-ui-app.main.runtime.ts +++ b/scopes/ui-foundation/harmony-ui-app/harmony-ui-app/harmony-ui-app.main.runtime.ts @@ -1,6 +1,6 @@ import { ApplicationAspect, ApplicationMain } from '@teambit/application'; import { MainRuntime } from '@teambit/cli'; -import UIAspect, { UiMain } from '@teambit/ui'; +import { UIAspect, UiMain } from '@teambit/ui'; import { ComponentAspect, ComponentMain } from '@teambit/component'; import { HarmonyAppOptions } from './harmony-app-options'; import { HarmonyUiAppAspect } from './harmony-ui-app.aspect'; diff --git a/scopes/ui-foundation/ui/ui.main.runtime.ts b/scopes/ui-foundation/ui/ui.main.runtime.ts index ddd00a116482..aefc49374d14 100644 --- a/scopes/ui-foundation/ui/ui.main.runtime.ts +++ b/scopes/ui-foundation/ui/ui.main.runtime.ts @@ -12,7 +12,7 @@ import { GraphqlAspect } from '@teambit/graphql'; import chalk from 'chalk'; import { Slot, SlotRegistry, Harmony } from '@teambit/harmony'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import PubsubAspect, { PubsubMain } from '@teambit/pubsub'; +import { PubsubAspect, PubsubMain } from '@teambit/pubsub'; import { sha1 } from '@teambit/legacy/dist/utils'; import pMapSeries from 'p-map-series'; import fs from 'fs-extra'; diff --git a/scopes/webpack/webpack/webpack.main.runtime.ts b/scopes/webpack/webpack/webpack.main.runtime.ts index b1e84cab83f4..d0b682d5fb5d 100644 --- a/scopes/webpack/webpack/webpack.main.runtime.ts +++ b/scopes/webpack/webpack/webpack.main.runtime.ts @@ -1,5 +1,5 @@ import webpack, { Configuration } from 'webpack'; -import PubsubAspect, { PubsubMain } from '@teambit/pubsub'; +import { PubsubAspect, PubsubMain } from '@teambit/pubsub'; import { BundlerAspect, BundlerContext, diff --git a/scopes/workspace/eject/eject.main.runtime.ts b/scopes/workspace/eject/eject.main.runtime.ts index 7e13ad8eae6b..4ee61d58cf75 100644 --- a/scopes/workspace/eject/eject.main.runtime.ts +++ b/scopes/workspace/eject/eject.main.runtime.ts @@ -1,7 +1,7 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { ComponentID } from '@teambit/component-id'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; -import WorkspaceAspect, { OutsideWorkspaceError, Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace'; import { InstallAspect, InstallMain } from '@teambit/install'; import { EjectCmd } from './eject-cmd'; import { EjectAspect } from './eject.aspect'; diff --git a/scopes/workspace/install/install.main.runtime.ts b/scopes/workspace/install/install.main.runtime.ts index dec6a1f320a4..919b3fae5353 100644 --- a/scopes/workspace/install/install.main.runtime.ts +++ b/scopes/workspace/install/install.main.runtime.ts @@ -21,7 +21,7 @@ import { NodeModulesLinksResult, } from '@teambit/workspace.modules.node-modules-linker'; import { EnvsMain, EnvsAspect } from '@teambit/envs'; -import IpcEventsAspect, { IpcEventsMain } from '@teambit/ipc-events'; +import { IpcEventsAspect, IpcEventsMain } from '@teambit/ipc-events'; import { IssuesClasses } from '@teambit/component-issues'; import { GetComponentManifestsOptions, @@ -40,7 +40,7 @@ import { WorkspacePolicy, UpdatedComponent, } from '@teambit/dependency-resolver'; -import WorkspaceConfigFilesAspect, { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; +import { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { IssuesAspect, IssuesMain } from '@teambit/issues'; import { snapToSemver } from '@teambit/component-package-version'; diff --git a/scopes/workspace/watcher/watcher.main.runtime.ts b/scopes/workspace/watcher/watcher.main.runtime.ts index 6e67bcb16536..180959a4b7e9 100644 --- a/scopes/workspace/watcher/watcher.main.runtime.ts +++ b/scopes/workspace/watcher/watcher.main.runtime.ts @@ -1,12 +1,12 @@ import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli'; import { SlotRegistry, Slot } from '@teambit/harmony'; -import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config'; -import ScopeAspect, { ScopeMain } from '@teambit/scope'; +import { GlobalConfigAspect, GlobalConfigMain } from '@teambit/global-config'; +import { ScopeAspect, ScopeMain } from '@teambit/scope'; import { ComponentID } from '@teambit/component-id'; -import IpcEventsAspect, { IpcEventsMain } from '@teambit/ipc-events'; +import { IpcEventsAspect, IpcEventsMain } from '@teambit/ipc-events'; import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger'; import { PubsubAspect, PubsubMain } from '@teambit/pubsub'; -import WorkspaceAspect, { Workspace } from '@teambit/workspace'; +import { WorkspaceAspect, Workspace } from '@teambit/workspace'; import pMapSeries from 'p-map-series'; import { WatchCommand } from './watch.cmd'; import { Watcher, WatchOptions } from './watcher'; diff --git a/scopes/workspace/workspace/workspace.ui.runtime.tsx b/scopes/workspace/workspace/workspace.ui.runtime.tsx index 7ec24a307789..714deb6d65c9 100644 --- a/scopes/workspace/workspace/workspace.ui.runtime.tsx +++ b/scopes/workspace/workspace/workspace.ui.runtime.tsx @@ -4,13 +4,13 @@ import { ComponentTreeAspect, ComponentTreeUI, ComponentTreeNode } from '@teambi import { Slot, SlotRegistry } from '@teambit/harmony'; import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router'; import { Menu, MenuWidgetSlot, MenuWidget } from '@teambit/ui-foundation.ui.menu'; -import SidebarAspect, { SidebarUI, SidebarItem, SidebarItemSlot } from '@teambit/sidebar'; +import { SidebarAspect, SidebarUI, SidebarItem, SidebarItemSlot } from '@teambit/sidebar'; import { MenuItemSlot, MenuItem } from '@teambit/ui-foundation.ui.main-dropdown'; import { UIAspect, UIRootUI as UIRoot, UIRuntime, UiUI } from '@teambit/ui'; import { GraphAspect, GraphUI } from '@teambit/graph'; import React, { ReactNode } from 'react'; import { RouteProps } from 'react-router-dom'; -import CommandBarAspect, { CommandBarUI, CommandHandler } from '@teambit/command-bar'; +import { CommandBarAspect, CommandBarUI, CommandHandler } from '@teambit/command-bar'; import { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item'; import type { DrawerType } from '@teambit/ui-foundation.ui.tree.drawer'; import { ComponentFilters } from '@teambit/component.ui.component-filters.component-filter-context'; From 5089cdb8c0d82a5d7c532b920d74c0de3a278cb8 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 21 Feb 2024 15:05:50 +0200 Subject: [PATCH 72/89] add config merger aspect to core ids --- scopes/harmony/bit/core-aspects-exports.ts | 1 + scopes/harmony/bit/core-aspects-ids.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts index 316456a5b790..984df3c1952a 100644 --- a/scopes/harmony/bit/core-aspects-exports.ts +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -1,6 +1,7 @@ // This file is auto generated by generate-core-aspects-exports.ts export * as bit from '@teambit/bit'; export * as config from '@teambit/config'; +export * as configMerger from '@teambit/config-merger'; export * as aspectLoader from '@teambit/aspect-loader'; export * as cli from '@teambit/cli'; export * as devFiles from '@teambit/dev-files'; diff --git a/scopes/harmony/bit/core-aspects-ids.ts b/scopes/harmony/bit/core-aspects-ids.ts index 573665b210d5..109f09280118 100644 --- a/scopes/harmony/bit/core-aspects-ids.ts +++ b/scopes/harmony/bit/core-aspects-ids.ts @@ -2,6 +2,7 @@ export const coreAspectsIds = [ 'teambit.harmony/bit', 'teambit.harmony/config', + 'teambit.harmony/config-merger', 'teambit.harmony/aspect-loader', 'teambit.harmony/cli', 'teambit.component/dev-files', From edb0d68d282a00ac9294d27937903c0c04b39575 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 21 Feb 2024 15:06:35 +0200 Subject: [PATCH 73/89] esm fixes on package.json and esm.mjs file copy --- .../bit/bundle/generate-core-aspects-modules.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index 4d6c0e936a67..cd1621ed8213 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -31,6 +31,7 @@ async function handleOneAspect(bundleDir: string, name: string, packageName: str const dirPath = join(bundleDir, 'node_modules', packageName); await fs.ensureDir(dirPath); await generateIndexFile(dirPath, name, appName); + await generateEsmMjsFile(dirPath, packageName); await generatePackageJson(dirPath, packageName); } @@ -40,11 +41,26 @@ async function generateIndexFile(dirPath: string, name: string, appName: string) return fs.outputFile(indexFilePath, indexFileContent); } +async function generateEsmMjsFile(dirPath: string, packageName: string) { + const esmMjsPath = join(wsRootDir, 'node_modules', packageName, 'esm.mjs'); + const exists = await fs.pathExists(esmMjsPath); + if (exists) { + const targetPath = join(dirPath, 'esm.mjs'); + return fs.copyFile(esmMjsPath, targetPath); + } + return Promise.resolve(); +} + async function generatePackageJson(dirPath: string, packageName: string) { const packageJsonPath = join(wsRootDir, 'node_modules', packageName, 'package.json'); const targetPath = join(dirPath, 'package.json'); const origPackageJson = await fs.readJson(packageJsonPath); origPackageJson.main = 'index.js'; + if (origPackageJson.exports && origPackageJson.exports['.']) { + origPackageJson.exports['.'].node.require = './index.js'; + origPackageJson.exports['.'].node.import = './esm.mjs'; + origPackageJson.exports['.'].default = './index.js'; + } return fs.writeJson(targetPath, origPackageJson, { spaces: 2 }); } From 5f27727b6f06319ead97b9c4f2cf80cda1f96772 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Wed, 21 Feb 2024 15:07:14 +0200 Subject: [PATCH 74/89] improve core aspect loading when using bundle --- scopes/harmony/aspect-loader/core-aspects.ts | 27 +++++++++++++++----- scopes/harmony/bit/load-bit.ts | 6 ++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/scopes/harmony/aspect-loader/core-aspects.ts b/scopes/harmony/aspect-loader/core-aspects.ts index 9333aebe2856..60feccc38087 100644 --- a/scopes/harmony/aspect-loader/core-aspects.ts +++ b/scopes/harmony/aspect-loader/core-aspects.ts @@ -1,8 +1,9 @@ import { BitError } from '@teambit/bit-error'; -import { existsSync, readdir } from 'fs-extra'; +import { existsSync, pathExists, readdir } from 'fs-extra'; import { basename, dirname, join, resolve } from 'path'; import { Config } from '@teambit/bvm.config'; import { findCurrentBvmDir } from '@teambit/bvm.path'; +import findRoot from 'find-root'; let _bvmConfig; @@ -75,7 +76,13 @@ export function getAspectDir(id: string): string { dirPath = resolve(__dirname, '../..', aspectName, 'dist'); } if (!existsSync(dirPath)) { - throw new Error(`unable to find ${aspectName} in ${dirPath}`); + // Maybe it's bundle + const aspectPackage = getCoreAspectPackageName(id); + try { + dirPath = findRoot(require.resolve(aspectPackage)); + } catch (err: any) { + throw new Error(`unable to find ${aspectName}`); + } } return dirPath; } @@ -133,7 +140,9 @@ function getCoreAspectDirFromPath(resolvedModulesPath: string): string { } export function getAspectDistDir(id: string) { - return resolve(`${getAspectDir(id)}/dist`); + const aspectDir = getAspectDir(id); + // When running from bundle there won't be a dist folder + return resolve(`${aspectDir}/dist`); } export function getCoreAspectName(id: string): string { @@ -148,9 +157,15 @@ export function getCoreAspectPackageName(id: string): string { } export async function getAspectDef(aspectName: string, runtime?: string) { - const dirPath = getAspectDistDir(aspectName); + let dirPath = getAspectDir(aspectName); + const distDirPath = getAspectDistDir(aspectName); + const isDistDirExists = await pathExists(distDirPath); + if (distDirPath && isDistDirExists) { + dirPath = join(dirPath, '..'); + } - const files = await readdir(dirPath); + const filesDir = distDirPath && isDistDirExists ? distDirPath : dirPath; + const files = await readdir(filesDir); let runtimeFile; if (runtime) { runtimeFile = files.find((file) => file.includes(`.${runtime}.runtime.js`)) || null; @@ -159,7 +174,7 @@ export async function getAspectDef(aspectName: string, runtime?: string) { return { id: aspectName, - aspectPath: join(dirPath, '..'), + aspectPath: dirPath, aspectFilePath: aspectFile ? resolve(`${dirPath}/${aspectFile}`) : null, runtimePath: runtimeFile ? resolve(`${dirPath}/${runtimeFile}`) : null, }; diff --git a/scopes/harmony/bit/load-bit.ts b/scopes/harmony/bit/load-bit.ts index 9c90009d07e9..b4411172aa2f 100644 --- a/scopes/harmony/bit/load-bit.ts +++ b/scopes/harmony/bit/load-bit.ts @@ -175,11 +175,11 @@ export async function requireAspects(aspect: Extension, runtime: RuntimeDefiniti } function getMainAspect() { - const mainAspectDir = getAspectDir(BitAspect.id); - let version: string | undefined; const packageName = getCoreAspectPackageName(BitAspect.id); - + let version: string | undefined; + let mainAspectDir = ''; try { + mainAspectDir = getAspectDir(BitAspect.id); // eslint-disable-next-line global-require const packageJson = require(`${mainAspectDir}/package.json`); version = packageJson.version; From d9dea875f0abeb36a14db1e9e393cb75b119e37a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 29 Feb 2024 16:13:34 +0200 Subject: [PATCH 75/89] generate sea and pkg configs (WIP) --- scopes/harmony/bit/bundle/bundle.ts | 17 +++++++++++------ .../harmony/bit/bundle/create-package-json.ts | 12 +++++++++++- .../harmony/bit/bundle/generate-sea-config.ts | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 scopes/harmony/bit/bundle/generate-sea-config.ts diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 623c2c2d11be..143b87e68c63 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -6,21 +6,26 @@ import { generateNpmrc } from './generate-npmrc'; import { runTsup } from './tsup'; import { copyFilesOfCoreAspects } from './copy-files-of-core-aspects'; import { copyOtherFiles } from './copy-other-files'; +import { generateSeaConfig } from './generate-sea-config'; // const rootOutDir = '/Users/giladshoham/dev/bit/bit/bundle'; const rootOutDir = '/tmp/bit-bundle'; -const bundleDir = `${rootOutDir}/bundle`; -const appFile = 'bit.app.js'; +const bundleDirName = 'bundle'; +const bundleDir = `${rootOutDir}/${bundleDirName}`; +const appFileBaseName = 'bit.app'; +const jsAppFile = `${appFileBaseName}.js`; +const blobAppFile = `${appFileBaseName}.blob`; async function runBundle() { - const esbuildRes = await runEsbuild(bundleDir, appFile); - // const tsupRes = await runTsup(bundleDir, appFile); - await generateCoreAspectsModules(rootOutDir, appFile); + const esbuildRes = await runEsbuild(bundleDir, jsAppFile); + // const tsupRes = await runTsup(bundleDir, jsAppFile); + await generateCoreAspectsModules(rootOutDir, jsAppFile); await copyFilesOfCoreAspects(rootOutDir, bundleDir); await copyOtherFiles(bundleDir); generateNpmrc(rootOutDir); - await generatePackageJson(rootOutDir); + await generatePackageJson(rootOutDir, bundleDirName, jsAppFile); await generateCoreAspectsBarrelFile(); + await generateSeaConfig(bundleDir, jsAppFile, blobAppFile); return esbuildRes; // return tsupRes; } diff --git a/scopes/harmony/bit/bundle/create-package-json.ts b/scopes/harmony/bit/bundle/create-package-json.ts index becb14c80da3..f40eee416c2b 100644 --- a/scopes/harmony/bit/bundle/create-package-json.ts +++ b/scopes/harmony/bit/bundle/create-package-json.ts @@ -104,7 +104,17 @@ const getPackageName = (packageName: string) => { return `${parts[0]}/${parts[1]}`; }; -export async function generatePackageJson(bundleDir: string) { +function getPkgConfig() { + const pkgConfig = { + scripts: 'build/**/*.js', + assets: 'views/**/*', + targets: ['latest-macos-arm64'], + outputPath: 'pkg-bundle', + }; + return pkgConfig; +} + +export async function generatePackageJson(bundleDir: string, bundleDirName: string, jsAppFile: string) { const wsRootDir = await getWsRootDir(); loadPackageJson(wsRootDir); loadWsJsonc(wsRootDir); diff --git a/scopes/harmony/bit/bundle/generate-sea-config.ts b/scopes/harmony/bit/bundle/generate-sea-config.ts new file mode 100644 index 000000000000..a2c7a227f510 --- /dev/null +++ b/scopes/harmony/bit/bundle/generate-sea-config.ts @@ -0,0 +1,15 @@ +import fs from 'fs-extra'; +import { join } from 'path'; + +export async function generateSeaConfig(bundleDir: string, jsAppFile: string, blobAppFile: string) { + const config = { + main: join(bundleDir, jsAppFile), + output: join(bundleDir, blobAppFile), + disableExperimentalSEAWarning: true, // Default: false + useSnapshot: false, // Default: false + useCodeCache: true, // Default: false + }; + + const seaConfigPath = join(bundleDir, 'sea-config.json'); + fs.writeJSONSync(seaConfigPath, config, { spaces: 2 }); +} From 1473cf09ba536a8f2fe3243ab8462f30c155cdda Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 29 Feb 2024 17:53:34 +0200 Subject: [PATCH 76/89] bump esbuild --- workspace.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace.jsonc b/workspace.jsonc index 0835c3152809..13ea1eac6ea1 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -384,7 +384,7 @@ "dagre": "0.8.5", "didyoumean": "1.2.1", "enquirer": "2.3.6", - "esbuild": "^0.17.12", + "esbuild": "^0.20.1", "esbuild-plugin-ignore": "^1.1.1", "eslint-config-airbnb-typescript": "12.0.0", "eslint-import-resolver-node": "0.3.4", From 3558b09612048b15f8c8d9d48d4b8944edeabd0a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 4 Mar 2024 15:38:21 +0200 Subject: [PATCH 77/89] add binary script to readme --- scopes/harmony/bit/bundle/readme.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scopes/harmony/bit/bundle/readme.md b/scopes/harmony/bit/bundle/readme.md index f25a0c5d2d82..4c93c291b1d2 100644 --- a/scopes/harmony/bit/bundle/readme.md +++ b/scopes/harmony/bit/bundle/readme.md @@ -18,3 +18,25 @@ node /bit/bundle/bit.app.js 1. bundle.ts - main file to generate the bundle 1. esbuild.ts - running the esbuild bundler 1. generate-core-aspects-exports - This will generate a file that exports all the core aspects + +## binary + +1. node --experimental-sea-config sea-config.json +1. cp $(command -v node) bit-app +1. codesign --remove-signature bit-app +1. npx postject bit-app NODE_SEA_BLOB bit.app.blob \ + --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ + --macho-segment-name NODE_SEA +1. codesign --sign - bit-app + +## binary script + +``` +node --experimental-sea-config sea-config.json +cp $(command -v node) bit-app +codesign --remove-signature bit-app +npx postject bit-app NODE_SEA_BLOB bit.app.blob \ + --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ + --macho-segment-name NODE_SEA +codesign --sign - bit-app +``` From c4e190e73aef942d906df77db40a58e84106bc4a Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 5 Mar 2024 13:05:31 +0200 Subject: [PATCH 78/89] generate esbuild metafile for bundle analysis --- scopes/harmony/bit/bundle/bundle.ts | 6 +++++- scopes/harmony/bit/bundle/esbuild.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scopes/harmony/bit/bundle/bundle.ts b/scopes/harmony/bit/bundle/bundle.ts index 143b87e68c63..301cf96ce66b 100644 --- a/scopes/harmony/bit/bundle/bundle.ts +++ b/scopes/harmony/bit/bundle/bundle.ts @@ -1,3 +1,5 @@ +import fs from 'fs-extra'; +import { omit } from 'lodash'; import { runEsbuild } from './esbuild'; import { generateCoreAspectsBarrelFile } from './generate-core-aspects-exports'; import { generateCoreAspectsModules } from './generate-core-aspects-modules'; @@ -26,7 +28,9 @@ async function runBundle() { await generatePackageJson(rootOutDir, bundleDirName, jsAppFile); await generateCoreAspectsBarrelFile(); await generateSeaConfig(bundleDir, jsAppFile, blobAppFile); - return esbuildRes; + const metafile = esbuildRes.metafile; + await fs.writeJSON(`${bundleDir}/metafile.json`, metafile, { spaces: 2 }); + return omit(esbuildRes, ['metafile']); // return tsupRes; } diff --git a/scopes/harmony/bit/bundle/esbuild.ts b/scopes/harmony/bit/bundle/esbuild.ts index 51a76ca0b660..56fd3e6c87c4 100644 --- a/scopes/harmony/bit/bundle/esbuild.ts +++ b/scopes/harmony/bit/bundle/esbuild.ts @@ -24,6 +24,7 @@ export function runEsbuild(outDir: string, appFile: string) { logLevel: 'error', platform: 'node', // minify: true, + metafile: true, // TODO: maybe enable sourcemap later // sourcemap: true, mainFields: ['main', 'module'], From 0f7aaf58c1bd136e5ab66e7b3fe9c57c7b3ec920 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Thu, 16 May 2024 14:03:00 +0300 Subject: [PATCH 79/89] fix getting bit version from bundle --- src/bootstrap.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bootstrap.ts b/src/bootstrap.ts index 278db69c4ab5..1d65229c62aa 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -130,8 +130,17 @@ function enableLoaderIfPossible() { export function getHarmonyVersion(showValidSemver = false) { try { const teambitBit = require.resolve('@teambit/bit'); + // For bundle cases, the teambitBit point to a flat folder that contains the package.json + let packageJsonPath = path.join(teambitBit, '../', 'package.json'); + if (!fs.existsSync(packageJsonPath)) { + // for dev cases, the teambitBit point to the dist folder that doesn't contains the package.json + packageJsonPath = path.join(teambitBit, '../..', 'package.json'); + } + if (!fs.existsSync(packageJsonPath)) { + throw new Error('unable to find Bit version (package.json not found)'); + } // eslint-disable-next-line - const packageJson = require(path.join(teambitBit, '../..', 'package.json')); + const packageJson = require(packageJsonPath); if (packageJson.version) return packageJson.version; // this is running locally if (packageJson.componentId && packageJson.componentId.version) { From 3d2a32a37fe623e75b477cd340c4c91bca0dbff1 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 16 Dec 2024 13:22:05 +0200 Subject: [PATCH 80/89] update esbuild --- workspace.jsonc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace.jsonc b/workspace.jsonc index c613b38ec2af..6d6505f0a39f 100644 --- a/workspace.jsonc +++ b/workspace.jsonc @@ -564,7 +564,7 @@ "diff": "^7.0.0", "dreidels": "0.6.1", "enquirer": "2.3.6", - "esbuild": "^0.20.1", + "esbuild": "^0.24.0", "esbuild-plugin-ignore": "^1.1.1", "eslint-config-airbnb-typescript": "17.1.0", "eslint-import-resolver-node": "0.3.4", From 417c9f360d12e2c48dd7a0045bf5b87e3c25a21e Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 16 Dec 2024 13:49:05 +0200 Subject: [PATCH 81/89] remove old file --- scopes/react/react/jest/jest.base.config.js | 31 --------------------- 1 file changed, 31 deletions(-) delete mode 100644 scopes/react/react/jest/jest.base.config.js diff --git a/scopes/react/react/jest/jest.base.config.js b/scopes/react/react/jest/jest.base.config.js deleted file mode 100644 index 15f09b4c05f2..000000000000 --- a/scopes/react/react/jest/jest.base.config.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - // "roots": [ - // "/src" - // ], - // "collectCoverageFrom": [ - // "src/**/*.{js,jsx,ts,tsx}", - // "!src/**/*.d.ts" - // ], - setupFiles: [require.resolve('react-app-polyfill/jsdom')], - setupFilesAfterEnv: [require.resolve('./setupTests')], - // "testMatch": [ - // "/src/**/__tests__/**/*.{js,jsx,ts,tsx}", - // "/src/**/*.{spec,test}.{js,jsx,ts,tsx}" - // ], - testEnvironment: require.resolve('jest-environment-jsdom'), - transform: { - '^.+\\.css$': require.resolve('./transformers/css-transform'), - '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./transformers/file-transform'), - // '^(?!.*\\.(svg|png|jpg|jpeg|gif|webp|woff|ttf|woff2)$)': require.resolve('./file-transform.js'), - }, - transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx|cjs)$', '^.+\\.module\\.(css|sass|scss)$'], - modulePaths: [], - moduleNameMapper: { - '\\.(css|less|scss|sass)$': require.resolve('identity-obj-proxy'), - '^react-native$': require.resolve('react-native-web'), - '^.+\\.module\\.(css|sass|scss)$': require.resolve('identity-obj-proxy'), - }, - moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'], - testTimeout: 30000, // @todo remove this once mocha-tester is ready and aspect-api testing are using it. - // watchPlugins: [require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname')], -}; From 07d43f08d62cafcdb83f8930034ff4559d44863f Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 16 Dec 2024 13:58:55 +0200 Subject: [PATCH 82/89] remove react-native --- scopes/harmony/bit/core-aspects-exports.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scopes/harmony/bit/core-aspects-exports.ts b/scopes/harmony/bit/core-aspects-exports.ts index 984df3c1952a..f54faedd85e7 100644 --- a/scopes/harmony/bit/core-aspects-exports.ts +++ b/scopes/harmony/bit/core-aspects-exports.ts @@ -37,7 +37,6 @@ export * as isolator from '@teambit/isolator'; export * as logger from '@teambit/logger'; export * as pkg from '@teambit/pkg'; export * as react from '@teambit/react'; -export * as reactNative from '@teambit/react-native'; export * as worker from '@teambit/worker'; export * as scope from '@teambit/scope'; export * as tester from '@teambit/tester'; From 62a8ef65de1e291262b98b3470ced186746f0bcd Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Mon, 16 Dec 2024 14:26:32 +0200 Subject: [PATCH 83/89] fixes --- .../harmony/bit/bundle/config-files-esbuild-plugin.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index aca173eb91e4..51ba10ad18d2 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -42,8 +42,7 @@ async function handleRelativePath(args: OnResolveArgs, bundleDir: string) { const packageDirName = `@teambit/${componentName}`; // const origFilePath = join(args.resolveDir, args.path); // const relativePath = getFilePathRelativeToPackage(args.resolveDir, args.path); - // TODO: dist is hard coded now which is not great - const origFilePath = join(packageDirName, 'dist', relativePath); + const origFilePath = join(packageDirName, relativePath); // const targetDirName = getTargetDirName(args.resolveDir); const targetDirName = `${scopeName}.${componentName}`; // const targetDir = join(bundleDir, targetDirName, parsed.dir); @@ -73,14 +72,16 @@ async function parseArgsFromNodeModules(args: OnResolveArgs): Promise Date: Mon, 16 Dec 2024 17:06:07 +0200 Subject: [PATCH 84/89] fixes --- scopes/react/react/react.env.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scopes/react/react/react.env.ts b/scopes/react/react/react.env.ts index 2074cba9d17a..3133ee22b8be 100644 --- a/scopes/react/react/react.env.ts +++ b/scopes/react/react/react.env.ts @@ -167,14 +167,6 @@ export class ReactEnv createCjsJestTester(jestConfigPath?: string, jestModulePath?: string): Tester { // const pathToSource = pathNormalizeToLinux(__dirname).replace('/dist', ''); // const defaultConfig = join(pathToSource, './jest/jest.cjs.config.js'); - // TODO: this is a hack to make sure the jest config is copied to the bundle folder - // we should make it a better way - // Force esbuild to copy this file - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const baseConfigPath = require.resolve('./jest/jest.base.config'); - // Force esbuild to copy require.resolve from this file - // eslint-disable-next-line global-require - // const baseConfig = require('./jest/jest.base.config'); const defaultConfig = require.resolve('./jest/jest.cjs.config'); const config = jestConfigPath || defaultConfig; const worker = this.getJestWorker(); From 1b2c3a684d6ca12c4f2de3c1b25e59a4b167db39 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 17 Dec 2024 12:22:50 +0200 Subject: [PATCH 85/89] remove react native --- scopes/harmony/bit/bundle/externals.ts | 1 - scopes/harmony/bit/core-aspects-ids.ts | 1 - .../react-native/react-native.main.runtime.ts | 133 ------------------ 3 files changed, 135 deletions(-) delete mode 100644 scopes/react/react-native/react-native.main.runtime.ts diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index 4c1324433d25..574e65d7bb81 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -100,7 +100,6 @@ export const externals = [ 'webpack-dev-server', '@svgr/webpack', 'new-url-loader', - 'react-native-web', '@teambit/react.eslint-config-bit-react', '@teambit/react.ui.docs-app', '@teambit/react.ui.compositions-app', diff --git a/scopes/harmony/bit/core-aspects-ids.ts b/scopes/harmony/bit/core-aspects-ids.ts index 109f09280118..dd0af8620a23 100644 --- a/scopes/harmony/bit/core-aspects-ids.ts +++ b/scopes/harmony/bit/core-aspects-ids.ts @@ -38,7 +38,6 @@ export const coreAspectsIds = [ 'teambit.harmony/logger', 'teambit.pkg/pkg', 'teambit.react/react', - 'teambit.react/react-native', 'teambit.harmony/worker', 'teambit.scope/scope', 'teambit.defender/tester', diff --git a/scopes/react/react-native/react-native.main.runtime.ts b/scopes/react/react-native/react-native.main.runtime.ts deleted file mode 100644 index aa36f5997cdc..000000000000 --- a/scopes/react/react-native/react-native.main.runtime.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { EnvPolicyConfigObject } from '@teambit/dependency-resolver'; -import { TsConfigSourceFile } from 'typescript'; -import type { TsCompilerOptionsWithoutTsConfig } from '@teambit/typescript'; -import { MainRuntime } from '@teambit/cli'; -import { merge } from 'lodash'; -import { BuildTask } from '@teambit/builder'; -import { Aspect } from '@teambit/harmony'; -import { AspectAspect, AspectMain } from '@teambit/aspect'; -import { PackageJsonProps } from '@teambit/pkg'; -import { EnvsAspect, EnvsMain, EnvTransformer, Environment } from '@teambit/envs'; -import { ReactAspect, ReactMain, ReactEnv, UseWebpackModifiers } from '@teambit/react'; -import { ReactNativeAspect } from './react-native.aspect'; -import { previewConfigTransformer, devServerConfigTransformer } from './webpack/webpack-transformers'; -import { ReactNativeEnv } from './react-native.env'; - -export class ReactNativeMain { - constructor( - private react: ReactMain, - - readonly reactNativeEnv: ReactNativeEnv, - - private envs: EnvsMain - ) {} - - icon() { - return 'https://static.bit.dev/extensions-icons/react.svg'; - } - - /** - * @deprecated use useTypescript() - * override the TS config of the environment. - */ - overrideTsConfig: ( - tsconfig?: TsConfigSourceFile, - compilerOptions?: Partial, - tsModule?: any - ) => EnvTransformer = this.react.overrideTsConfig.bind(this.react); - - /** - * override the jest config of the environment. - */ - overrideJestConfig = this.react.overrideJestConfig.bind(this.react); - - /** - * override the env build pipeline. - */ - overrideBuildPipe: (tasks: BuildTask[]) => EnvTransformer = this.react.overrideBuildPipe.bind(this.react); - - /** - * @deprecated use useTypescript() - * override the build ts config. - */ - overrideBuildTsConfig: ( - tsconfig?: TsConfigSourceFile, - compilerOptions?: Partial - ) => EnvTransformer = this.react.overrideBuildTsConfig.bind(this.react); - - /** - * override package json properties. - */ - overridePackageJsonProps: (props: PackageJsonProps) => EnvTransformer = this.react.overridePackageJsonProps.bind( - this.react - ); - - /** - * override the env's typescript config for both dev and build time. - * Replaces both overrideTsConfig (devConfig) and overrideBuildTsConfig (buildConfig) - */ - useTypescript = this.react.useTypescript.bind(this.react); - - /** - * override the env's dev server and preview webpack configurations. - * Replaces both overrideDevServerConfig and overridePreviewConfig - */ - useWebpack(modifiers?: UseWebpackModifiers) { - const mergedModifiers: UseWebpackModifiers = { - previewConfig: [previewConfigTransformer].concat(modifiers?.previewConfig ?? []), - devServerConfig: [devServerConfigTransformer].concat(modifiers?.devServerConfig ?? []), - }; - return this.react.useWebpack(mergedModifiers); - } - - /** - * An API to mutate the prettier config - */ - usePrettier = this.react.usePrettier.bind(this.react); - - /** - * An API to mutate the eslint config - */ - useEslint = this.react.useEslint.bind(this.react); - - /** - * override the dependency configuration of the component environment. - */ - overrideDependencies(dependencyPolicy: EnvPolicyConfigObject) { - return this.envs.override({ - getDependencies: () => merge(this.reactNativeEnv.getDependencies(), dependencyPolicy), - }); - } - - /** - * create a new composition of the node environment. - */ - compose(transformers: EnvTransformer[], targetEnv: Environment = {}) { - return this.envs.compose(this.envs.merge(targetEnv, this.reactNativeEnv), transformers); - } - - static dependencies: Aspect[] = [ReactAspect, EnvsAspect, AspectAspect]; - static runtime = MainRuntime; - static async provider([react, envs, aspect]: [ReactMain, EnvsMain, AspectMain]) { - const jestConfig = require.resolve('./jest/jest.config'); - - const webpackModifiers: UseWebpackModifiers = { - previewConfig: [previewConfigTransformer], - devServerConfig: [devServerConfigTransformer], - }; - - const reactNativeComposedEnv: ReactNativeEnv = envs.merge( - new ReactNativeEnv(aspect), - react.compose([react.useWebpack(webpackModifiers), react.overrideJestConfig(jestConfig)]) - ); - envs.registerEnv(reactNativeComposedEnv); - - // if (generator) { - // generator.registerComponentTemplate(componentTemplates); - // } - - return new ReactNativeMain(react, reactNativeComposedEnv, envs); - } -} - -ReactNativeAspect.addRuntime(ReactNativeMain); From de8b463c2dbf8655c47c7e43d229be1136314fe6 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 17 Dec 2024 12:23:56 +0200 Subject: [PATCH 86/89] replace getConsumerInfo with getWorkspaceInfo --- scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts | 4 ++-- scopes/harmony/bit/bundle/copy-other-files.ts | 4 ++-- scopes/harmony/bit/bundle/create-package-json.ts | 4 ++-- scopes/harmony/bit/bundle/generate-core-aspects-modules.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts index 39f6561e0c4e..40b6f21530cd 100644 --- a/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts +++ b/scopes/harmony/bit/bundle/copy-files-of-core-aspects.ts @@ -1,4 +1,4 @@ -import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator'; import { getCoreAspectPackageName } from '@teambit/aspect-loader'; import fs from 'fs-extra'; import { join } from 'path'; @@ -22,7 +22,7 @@ const FILES_TO_COPY = { let wsRootDir: string; async function loadWsRootDir() { - const consumerInfo = await getConsumerInfo(process.cwd()); + const consumerInfo = await getWorkspaceInfo(process.cwd()); if (!consumerInfo) throw new Error('unable to find consumer'); wsRootDir = consumerInfo.path; return consumerInfo.path; diff --git a/scopes/harmony/bit/bundle/copy-other-files.ts b/scopes/harmony/bit/bundle/copy-other-files.ts index 8f6d2defd3c3..478467c1ffee 100644 --- a/scopes/harmony/bit/bundle/copy-other-files.ts +++ b/scopes/harmony/bit/bundle/copy-other-files.ts @@ -1,4 +1,4 @@ -import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator'; import fs from 'fs-extra'; import { basename, join } from 'path'; import globby from 'globby'; @@ -8,7 +8,7 @@ const PATTERNS_TO_COPY = ['node_modules/typescript/lib/*.d.ts']; let wsRootDir: string; async function loadWsRootDir() { - const consumerInfo = await getConsumerInfo(process.cwd()); + const consumerInfo = await getWorkspaceInfo(process.cwd()); if (!consumerInfo) throw new Error('unable to find consumer'); wsRootDir = consumerInfo.path; return consumerInfo.path; diff --git a/scopes/harmony/bit/bundle/create-package-json.ts b/scopes/harmony/bit/bundle/create-package-json.ts index 44036d2eba45..b8cdc1bc90f0 100644 --- a/scopes/harmony/bit/bundle/create-package-json.ts +++ b/scopes/harmony/bit/bundle/create-package-json.ts @@ -3,14 +3,14 @@ import { join } from 'path'; import { get } from 'lodash'; import fs from 'fs-extra'; import { parse } from 'comment-json'; -import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator'; import { externals } from './externals'; let wsJsonc: any; let packageJson: any; async function getWsRootDir() { - const consumerInfo = await getConsumerInfo(process.cwd()); + const consumerInfo = await getWorkspaceInfo(process.cwd()); if (!consumerInfo) throw new Error('unable to find consumer'); return consumerInfo.path; } diff --git a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts index cd1621ed8213..a49d9a4f3a91 100644 --- a/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts +++ b/scopes/harmony/bit/bundle/generate-core-aspects-modules.ts @@ -1,4 +1,4 @@ -import { getConsumerInfo } from '@teambit/legacy/dist/consumer'; +import { getWorkspaceInfo } from '@teambit/workspace.modules.workspace-locator'; import camelcase from 'camelcase'; import { getCoreAspectName, getCoreAspectPackageName } from '@teambit/aspect-loader'; import fs from 'fs-extra'; @@ -9,7 +9,7 @@ import { coreAspectsIds } from '../core-aspects-ids'; let wsRootDir: string; async function loadWsRootDir() { - const consumerInfo = await getConsumerInfo(process.cwd()); + const consumerInfo = await getWorkspaceInfo(process.cwd()); if (!consumerInfo) throw new Error('unable to find consumer'); wsRootDir = consumerInfo.path; return consumerInfo.path; From 0f7240a9ac0f6b8859b8c01f3a46a11b4546356b Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 17 Dec 2024 12:48:38 +0200 Subject: [PATCH 87/89] fixes --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 51ba10ad18d2..8fd38b6a4013 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -190,6 +190,12 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /cjs-transformer$/ }, (args) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /svg-transformer$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); + build.onResolve({ filter: /file-mock.js$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); }, }; }; From 43c0aab4558bd421faa460c0ef01be41efda3698 Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 17 Dec 2024 13:59:10 +0200 Subject: [PATCH 88/89] more fixes --- scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts | 3 +++ scopes/harmony/bit/bundle/create-package-json.ts | 6 ++++++ scopes/harmony/bit/bundle/externals.ts | 2 ++ 3 files changed, 11 insertions(+) diff --git a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts index 8fd38b6a4013..531d40a0cd05 100644 --- a/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts +++ b/scopes/harmony/bit/bundle/config-files-esbuild-plugin.ts @@ -190,6 +190,9 @@ export const configFilesEsbuildPlugin = (bundleDir: string) => { build.onResolve({ filter: /cjs-transformer$/ }, (args) => { return handleConfigFile(args, bundleDir); }); + build.onResolve({ filter: /esm-transformer$/ }, (args) => { + return handleConfigFile(args, bundleDir); + }); build.onResolve({ filter: /svg-transformer$/ }, (args) => { return handleConfigFile(args, bundleDir); }); diff --git a/scopes/harmony/bit/bundle/create-package-json.ts b/scopes/harmony/bit/bundle/create-package-json.ts index b8cdc1bc90f0..b9c2ede25fcb 100644 --- a/scopes/harmony/bit/bundle/create-package-json.ts +++ b/scopes/harmony/bit/bundle/create-package-json.ts @@ -81,6 +81,12 @@ function resolveHardCoded(packageName: string): string | undefined { string_decoder: '1.3.0', punycode: '2.1.1', 'react-app-polyfill': '1.0.6', + 'identity-obj-proxy': '3.0.0', + uuid: '^10.0.0', + 'babel-preset-jest': '29.2.0', + espree: '9.6.1', + '@bitdev/react.webpack.refresh-overlay': '0.0.2', + '@surma/rollup-plugin-off-main-thread': '2.2.3', }; return hardCoded[packageName]; } diff --git a/scopes/harmony/bit/bundle/externals.ts b/scopes/harmony/bit/bundle/externals.ts index 574e65d7bb81..2cb054f5ef10 100644 --- a/scopes/harmony/bit/bundle/externals.ts +++ b/scopes/harmony/bit/bundle/externals.ts @@ -37,6 +37,7 @@ export const externals = [ '@teambit/node/jest/jest.config', '@typescript-eslint/parser', 'identity-obj-proxy', + 'uuid', 'jest-environment-jsdom', 'react-app-polyfill/jsdom', 'assert/', @@ -108,6 +109,7 @@ export const externals = [ '@babel/plugin-transform-object-rest-spread', '@babel/plugin-transform-class-properties', '@bitdev/react.webpack.refresh-overlay', + 'events', // 'esbuild' // 'mime' ]; From 2ea0c3c7d21752cabfc05194a0ca3ea4142b64ca Mon Sep 17 00:00:00 2001 From: Gilad Shoham Date: Tue, 17 Dec 2024 13:59:40 +0200 Subject: [PATCH 89/89] update manifests file --- scopes/harmony/bit/manifests.ts | 627 +++++++++++++++++++++----------- 1 file changed, 415 insertions(+), 212 deletions(-) diff --git a/scopes/harmony/bit/manifests.ts b/scopes/harmony/bit/manifests.ts index 33cf1c32bbde..f34a6babd9ef 100644 --- a/scopes/harmony/bit/manifests.ts +++ b/scopes/harmony/bit/manifests.ts @@ -1,226 +1,429 @@ -import { AspectAspect } from '@teambit/aspect'; -import { AspectLoaderAspect } from '@teambit/aspect-loader'; -import { BuilderAspect } from '@teambit/builder'; -import { BundlerAspect } from '@teambit/bundler'; -import { CacheAspect } from '@teambit/cache'; -import { CLIAspect } from '@teambit/cli'; -import { CompilerAspect } from '@teambit/compiler'; -import { ComponentAspect } from '@teambit/component'; -import { CompositionsAspect } from '@teambit/compositions'; -import { ConfigAspect } from '@teambit/config'; -import { DependencyResolverAspect } from '@teambit/dependency-resolver'; -import { DeprecationAspect } from '@teambit/deprecation'; -import { DocsAspect } from '@teambit/docs'; -import { EnvsAspect } from '@teambit/envs'; -import { EnvAspect } from '@teambit/env'; -import { ExpressAspect } from '@teambit/express'; -import { YarnAspect } from '@teambit/yarn'; -import { GeneratorAspect } from '@teambit/generator'; -import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app'; -import { GraphAspect } from '@teambit/graph'; -import { GraphqlAspect } from '@teambit/graphql'; -import { InsightsAspect } from '@teambit/insights'; -import { IsolatorAspect } from '@teambit/isolator'; -import { JestAspect } from '@teambit/jest'; -import { LoggerAspect } from '@teambit/logger'; -import { NodeAspect } from '@teambit/node'; -import { NotificationsAspect } from '@teambit/notifications'; -import { PanelUiAspect } from '@teambit/panels'; -import { PkgAspect } from '@teambit/pkg'; -import { PnpmAspect } from '@teambit/pnpm'; -import { PreviewAspect } from '@teambit/preview'; -import { ComponentSizerAspect } from '@teambit/component-sizer'; -import { ReactAspect } from '@teambit/react'; -import { ReactRouterAspect } from '@teambit/react-router'; -import { SchemaAspect } from '@teambit/schema'; -import { PubsubAspect } from '@teambit/pubsub'; -import { ScopeAspect } from '@teambit/scope'; -// import { StencilAspect } from '@teambit/stencil'; -import { TesterAspect } from '@teambit/tester'; -import { MultiTesterAspect } from '@teambit/multi-tester'; -import { TypescriptAspect } from '@teambit/typescript'; -import { BabelAspect } from '@teambit/babel'; -import { UIAspect } from '@teambit/ui'; -import { VariantsAspect } from '@teambit/variants'; -import { WebpackAspect } from '@teambit/webpack'; -import { WorkspaceAspect } from '@teambit/workspace'; -import { WorkspaceConfigFilesAspect } from '@teambit/workspace-config-files'; -import { InstallAspect } from '@teambit/install'; -import { LinterAspect } from '@teambit/linter'; -import { FormatterAspect } from '@teambit/formatter'; -import { ChangelogAspect } from '@teambit/changelog'; -import { CodeAspect } from '@teambit/code'; -import { CommandBarAspect } from '@teambit/command-bar'; -import { SidebarAspect } from '@teambit/sidebar'; -import { ComponentTreeAspect } from '@teambit/component-tree'; -import { DevFilesAspect } from '@teambit/dev-files'; -import { ESLintAspect } from '@teambit/eslint'; -import { PrettierAspect } from '@teambit/prettier'; -import { SignAspect } from '@teambit/sign'; -import { WorkerAspect } from '@teambit/worker'; -import { GlobalConfigAspect } from '@teambit/global-config'; -import { MultiCompilerAspect } from '@teambit/multi-compiler'; -import { MDXAspect } from '@teambit/mdx'; -import { ReadmeAspect } from '@teambit/readme'; -import { ApplicationAspect } from '@teambit/application'; -import { UpdateDependenciesAspect } from '@teambit/update-dependencies'; -import { ExportAspect } from '@teambit/export'; -import { ImporterAspect } from '@teambit/importer'; -import { EjectAspect } from '@teambit/eject'; -import { UserAgentAspect } from '@teambit/user-agent'; -import { HtmlAspect } from '@teambit/html'; -import { LanesAspect } from '@teambit/lanes'; -import { ForkingAspect } from '@teambit/forking'; -import { RenamingAspect } from '@teambit/renaming'; -import { ComponentLogAspect } from '@teambit/component-log'; -import { ClearCacheAspect } from '@teambit/clear-cache'; -import { DiagnosticAspect } from '@teambit/diagnostic'; -import { NewComponentHelperAspect } from '@teambit/new-component-helper'; -import { MochaAspect } from '@teambit/mocha'; -import { CommunityAspect } from '@teambit/community'; -import { CloudAspect } from '@teambit/cloud'; -import { StatusAspect } from '@teambit/status'; -import { SnappingAspect } from '@teambit/snapping'; -import { MergingAspect } from '@teambit/merging'; -import { IssuesAspect } from '@teambit/issues'; -import { RefactoringAspect } from '@teambit/refactoring'; -import { ComponentCompareAspect } from '@teambit/component-compare'; -import { ListerAspect } from '@teambit/lister'; -import { DependenciesAspect } from '@teambit/dependencies'; -import { RemoveAspect } from '@teambit/remove'; -import { MergeLanesAspect } from '@teambit/merge-lanes'; -import { CheckoutAspect } from '@teambit/checkout'; -import { APIReferenceAspect } from '@teambit/api-reference'; -import { ApiServerAspect } from '@teambit/api-server'; -import { ComponentWriterAspect } from '@teambit/component-writer'; -import { TrackerAspect } from '@teambit/tracker'; -import { MoverAspect } from '@teambit/mover'; -import { WatcherAspect } from '@teambit/watcher'; -import { StashAspect } from '@teambit/stash'; -import { GitAspect } from '@teambit/git'; -import { IpcEventsAspect } from '@teambit/ipc-events'; -import { ConfigMergerAspect } from '@teambit/config-merger'; -import { VersionHistoryAspect } from '@teambit/version-history'; -import { HostInitializerAspect } from '@teambit/host-initializer'; -import { DoctorAspect } from '@teambit/doctor'; -import { ApplyAspect } from '@teambit/apply'; +import { AspectAspect } from '@teambit/aspect/aspect.aspect'; +import { AspectLoaderAspect } from '@teambit/aspect-loader/aspect-loader.aspect'; +import { BuilderAspect } from '@teambit/builder/builder.aspect'; +import { BundlerAspect } from '@teambit/bundler/bundler.aspect'; +import { CacheAspect } from '@teambit/cache/cache.aspect'; +import { CLIAspect } from '@teambit/cli/cli.aspect'; +import { CompilerAspect } from '@teambit/compiler/compiler.aspect'; +import { ComponentAspect } from '@teambit/component/component.aspect'; +import { CompositionsAspect } from '@teambit/compositions/compositions.aspect'; +import { ConfigAspect } from '@teambit/config/config.aspect'; +import { DependencyResolverAspect } from '@teambit/dependency-resolver/dependency-resolver.aspect'; +import { DeprecationAspect } from '@teambit/deprecation/deprecation.aspect'; +import { DocsAspect } from '@teambit/docs/docs.aspect'; +import { EnvsAspect } from '@teambit/envs/environments.aspect'; +import { EnvAspect } from '@teambit/env/env.aspect'; +import { ExpressAspect } from '@teambit/express/express.aspect'; +import { YarnAspect } from '@teambit/yarn/yarn.aspect'; +import { GeneratorAspect } from '@teambit/generator/generator.aspect'; +import { HarmonyUiAppAspect } from '@teambit/harmony-ui-app/harmony-ui-app.aspect'; +import { GraphAspect } from '@teambit/graph/graph.aspect'; +import { GraphqlAspect } from '@teambit/graphql/graphql.aspect'; +import { InsightsAspect } from '@teambit/insights/insights.aspect'; +import { IsolatorAspect } from '@teambit/isolator/isolator.aspect'; +import { JestAspect } from '@teambit/jest/jest.aspect'; +import { LoggerAspect } from '@teambit/logger/logger.aspect'; +import { NodeAspect } from '@teambit/node/node.aspect'; +import { NotificationsAspect } from '@teambit/notifications/notifications.aspect'; +import { PanelUiAspect } from '@teambit/panels/panel-ui.aspect'; +import { PkgAspect } from '@teambit/pkg/pkg.aspect'; +import { PnpmAspect } from '@teambit/pnpm/pnpm.aspect'; +import { PreviewAspect } from '@teambit/preview/preview.aspect'; +import { ComponentSizerAspect } from '@teambit/component-sizer/component-sizer.aspect'; +import { ReactAspect } from '@teambit/react/react.aspect'; +import { ReactRouterAspect } from '@teambit/react-router/react-router.aspect'; +import { SchemaAspect } from '@teambit/schema/schema.aspect'; +import { PubsubAspect } from '@teambit/pubsub/pubsub.aspect'; +import { ScopeAspect } from '@teambit/scope/scope.aspect'; +// import { StencilAspect } from '@teambit/stencil/stencil.aspect'; +import { TesterAspect } from '@teambit/tester/tester.aspect'; +import { MultiTesterAspect } from '@teambit/multi-tester/multi-tester.aspect'; +import { TypescriptAspect } from '@teambit/typescript/typescript.aspect'; +import { BabelAspect } from '@teambit/babel/babel.aspect'; +import { UIAspect } from '@teambit/ui/ui.aspect'; +import { VariantsAspect } from '@teambit/variants/variants.aspect'; +import { WebpackAspect } from '@teambit/webpack/webpack.aspect'; +import { WorkspaceAspect } from '@teambit/workspace/workspace.aspect'; +import { WorkspaceConfigFilesAspect } from '@teambit/workspace-config-files/workspace-config-files.aspect'; +import { InstallAspect } from '@teambit/install/install.aspect'; +import { LinterAspect } from '@teambit/linter/linter.aspect'; +import { FormatterAspect } from '@teambit/formatter/formatter.aspect'; +import { ChangelogAspect } from '@teambit/changelog/changelog.aspect'; +import { CodeAspect } from '@teambit/code/code.aspect'; +import { CommandBarAspect } from '@teambit/command-bar/command-bar.aspect'; +import { SidebarAspect } from '@teambit/sidebar/sidebar.aspect'; +import { ComponentTreeAspect } from '@teambit/component-tree/component-tree.aspect'; +import { DevFilesAspect } from '@teambit/dev-files/dev-files.aspect'; +import { ESLintAspect } from '@teambit/eslint/eslint.aspect'; +import { PrettierAspect } from '@teambit/prettier/prettier.aspect'; +import { SignAspect } from '@teambit/sign/sign.aspect'; +import { WorkerAspect } from '@teambit/worker/worker.aspect'; +import { GlobalConfigAspect } from '@teambit/global-config/global-config.aspect'; +import { MultiCompilerAspect } from '@teambit/multi-compiler/multi-compiler.aspect'; +import { MDXAspect } from '@teambit/mdx/mdx.aspect'; +import { ReadmeAspect } from '@teambit/readme/readme.aspect'; +import { ApplicationAspect } from '@teambit/application/application.aspect'; +import { UpdateDependenciesAspect } from '@teambit/update-dependencies/update-dependencies.aspect'; +import { ExportAspect } from '@teambit/export/export.aspect'; +import { ImporterAspect } from '@teambit/importer/importer.aspect'; +import { EjectAspect } from '@teambit/eject/eject.aspect'; +import { UserAgentAspect } from '@teambit/user-agent/user-agent.aspect'; +// import { HtmlAspect } from '@teambit/html/html.aspect'; +import { LanesAspect } from '@teambit/lanes/lanes.aspect'; +import { ForkingAspect } from '@teambit/forking/forking.aspect'; +import { RenamingAspect } from '@teambit/renaming/renaming.aspect'; +import { ComponentLogAspect } from '@teambit/component-log/component-log.aspect'; +import { ClearCacheAspect } from '@teambit/clear-cache/clear-cache.aspect'; +import { DiagnosticAspect } from '@teambit/diagnostic/diagnostic.aspect'; +import { NewComponentHelperAspect } from '@teambit/new-component-helper/new-component-helper.aspect'; +import { MochaAspect } from '@teambit/mocha/mocha.aspect'; +import { CommunityAspect } from '@teambit/community/community.aspect'; +import { CloudAspect } from '@teambit/cloud/cloud.aspect'; +import { StatusAspect } from '@teambit/status/status.aspect'; +import { SnappingAspect } from '@teambit/snapping/snapping.aspect'; +import { MergingAspect } from '@teambit/merging/merging.aspect'; +import { IssuesAspect } from '@teambit/issues/issues.aspect'; +import { RefactoringAspect } from '@teambit/refactoring/refactoring.aspect'; +import { ComponentCompareAspect } from '@teambit/component-compare/component-compare.aspect'; +import { ListerAspect } from '@teambit/lister/lister.aspect'; +import { DependenciesAspect } from '@teambit/dependencies/dependencies.aspect'; +import { RemoveAspect } from '@teambit/remove/remove.aspect'; +import { MergeLanesAspect } from '@teambit/merge-lanes/merge-lanes.aspect'; +import { CheckoutAspect } from '@teambit/checkout/checkout.aspect'; +import { APIReferenceAspect } from '@teambit/api-reference/api-reference.aspect'; +import { ApiServerAspect } from '@teambit/api-server/api-server.aspect'; +import { ComponentWriterAspect } from '@teambit/component-writer/component-writer.aspect'; +import { TrackerAspect } from '@teambit/tracker/tracker.aspect'; +import { MoverAspect } from '@teambit/mover/mover.aspect'; +import { WatcherAspect } from '@teambit/watcher/watcher.aspect'; +import { StashAspect } from '@teambit/stash/stash.aspect'; +import { GitAspect } from '@teambit/git/git.aspect'; +import { IpcEventsAspect } from '@teambit/ipc-events/ipc-events.aspect'; +import { ConfigMergerAspect } from '@teambit/config-merger/config-merger.aspect'; +import { VersionHistoryAspect } from '@teambit/version-history/version-history.aspect'; +import { HostInitializerAspect } from '@teambit/host-initializer/host-initializer.aspect'; +import { DoctorAspect } from '@teambit/doctor/doctor.aspect'; +import { ApplyAspect } from '@teambit/apply/apply.aspect'; + +import { AspectMain } from '@teambit/aspect/aspect.main.runtime'; +import { AspectLoaderMain } from '@teambit/aspect-loader/aspect-loader.main.runtime'; +import { BuilderMain } from '@teambit/builder/builder.main.runtime'; +import { BundlerMain } from '@teambit/bundler/bundler.main.runtime'; +import { CacheMain } from '@teambit/cache/cache.main.runtime'; +import { CLIMain } from '@teambit/cli/cli.main.runtime'; +import { CompilerMain } from '@teambit/compiler/compiler.main.runtime'; +import { ComponentMain } from '@teambit/component/component.main.runtime'; +import { CompositionsMain } from '@teambit/compositions/compositions.main.runtime'; +// import { ConfigMain } from '@teambit/config/config.main.runtime'; +import { DependencyResolverMain } from '@teambit/dependency-resolver/dependency-resolver.main.runtime'; +import { DeprecationMain } from '@teambit/deprecation/deprecation.main.runtime'; +import { DocsMain } from '@teambit/docs/docs.main.runtime'; +import { EnvsMain } from '@teambit/envs/environments.main.runtime'; +import { EnvMain } from '@teambit/env/env.main.runtime'; +import { ExpressMain } from '@teambit/express/express.main.runtime'; +import { YarnMain } from '@teambit/yarn/yarn.main.runtime'; +import { GeneratorMain } from '@teambit/generator/generator.main.runtime'; +import { HarmonyUiAppMain } from '@teambit/harmony-ui-app/harmony-ui-app.main.runtime'; +import { GraphMain } from '@teambit/graph/graph.main.runtime'; +import { GraphqlMain } from '@teambit/graphql/graphql.main.runtime'; +import { InsightsMain } from '@teambit/insights/insights.main.runtime'; +import { IsolatorMain } from '@teambit/isolator/isolator.main.runtime'; +import { JestMain } from '@teambit/jest/jest.main.runtime'; +import { LoggerMain } from '@teambit/logger/logger.main.runtime'; +import { NodeMain } from '@teambit/node/node.main.runtime'; +import { PanelUIMain } from '@teambit/panels/panel-ui.main.runtime'; +import { PkgMain } from '@teambit/pkg/pkg.main.runtime'; +import { PnpmMain } from '@teambit/pnpm/pnpm.main.runtime'; +import { PreviewMain } from '@teambit/preview/preview.main.runtime'; +import { ComponentSizerMain } from '@teambit/component-sizer/component-sizer.main.runtime'; +import { ReactMain } from '@teambit/react/react.main.runtime'; +import { SchemaMain } from '@teambit/schema/schema.main.runtime'; +import { PubsubMain } from '@teambit/pubsub/pubsub.main.runtime'; +import { ScopeMain } from '@teambit/scope/scope.main.runtime'; +// import { StencilMain } from '@teambit/stencil/stencil.main.runtime'; +import { TesterMain } from '@teambit/tester/tester.main.runtime'; +import { MultiTesterMain } from '@teambit/multi-tester/multi-tester.main.runtime'; +import { TypescriptMain } from '@teambit/typescript/typescript.main.runtime'; +import { BabelMain } from '@teambit/babel/babel.main.runtime'; +import { UiMain } from '@teambit/ui/ui.main.runtime'; +import { VariantsMain } from '@teambit/variants/variants.main.runtime'; +import { WebpackMain } from '@teambit/webpack/webpack.main.runtime'; +import { WorkspaceMain } from '@teambit/workspace/workspace.main.runtime'; +import { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files/workspace-config-files.main.runtime'; +import { InstallMain } from '@teambit/install/install.main.runtime'; +import { LinterMain } from '@teambit/linter/linter.main.runtime'; +import { FormatterMain } from '@teambit/formatter/formatter.main.runtime'; +import { DevFilesMain } from '@teambit/dev-files/dev-files.main.runtime'; +import { ESLintMain } from '@teambit/eslint/eslint.main.runtime'; +import { PrettierMain } from '@teambit/prettier/prettier.main.runtime'; +import { SignMain } from '@teambit/sign/sign.main.runtime'; +import { WorkerMain } from '@teambit/worker/worker.main.runtime'; +import { GlobalConfigMain } from '@teambit/global-config/global-config.main.runtime'; +import { MultiCompilerMain } from '@teambit/multi-compiler/multi-compiler.main.runtime'; +import { MDXMain } from '@teambit/mdx/mdx.main.runtime'; +import { ReadmeMain } from '@teambit/readme/readme.main.runtime'; +import { ApplicationMain } from '@teambit/application/application.main.runtime'; +import { UpdateDependenciesMain } from '@teambit/update-dependencies/update-dependencies.main.runtime'; +import { ExportMain } from '@teambit/export/export.main.runtime'; +import { ImporterMain } from '@teambit/importer/importer.main.runtime'; +import { EjectMain } from '@teambit/eject/eject.main.runtime'; +// import { HtmlMain } from '@teambit/html/html.main.runtime'; +import { LanesMain } from '@teambit/lanes/lanes.main.runtime'; +import { ForkingMain } from '@teambit/forking/forking.main.runtime'; +import { RenamingMain } from '@teambit/renaming/renaming.main.runtime'; +import { ComponentLogMain } from '@teambit/component-log/component-log.main.runtime'; +import { ClearCacheMain } from '@teambit/clear-cache/clear-cache.main.runtime'; +import { DiagnosticMain } from '@teambit/diagnostic/diagnostic.main.runtime'; +import { NewComponentHelperMain } from '@teambit/new-component-helper/new-component-helper.main.runtime'; +import { MochaMain } from '@teambit/mocha/mocha.main.runtime'; +import { CommunityMain } from '@teambit/community/community.main.runtime'; +import { CloudMain } from '@teambit/cloud/cloud.main.runtime'; +import { StatusMain } from '@teambit/status/status.main.runtime'; +import { SnappingMain } from '@teambit/snapping/snapping.main.runtime'; +import { MergingMain } from '@teambit/merging/merging.main.runtime'; +import { IssuesMain } from '@teambit/issues/issues.main.runtime'; +import { RefactoringMain } from '@teambit/refactoring/refactoring.main.runtime'; +import { ComponentCompareMain } from '@teambit/component-compare/component-compare.main.runtime'; +import { ListerMain } from '@teambit/lister/lister.main.runtime'; +import { DependenciesMain } from '@teambit/dependencies/dependencies.main.runtime'; +import { RemoveMain } from '@teambit/remove/remove.main.runtime'; +import { MergeLanesMain } from '@teambit/merge-lanes/merge-lanes.main.runtime'; +import { CheckoutMain } from '@teambit/checkout/checkout.main.runtime'; +import { ApiServerMain } from '@teambit/api-server/api-server.main.runtime'; +import { ComponentWriterMain } from '@teambit/component-writer/component-writer.main.runtime'; +import { TrackerMain } from '@teambit/tracker/tracker.main.runtime'; +import { MoverMain } from '@teambit/mover/mover.main.runtime'; +import { WatcherMain } from '@teambit/watcher/watcher.main.runtime'; +import { StashMain } from '@teambit/stash/stash.main.runtime'; +import { GitMain } from '@teambit/git/git.main.runtime'; +import { IpcEventsMain } from '@teambit/ipc-events/ipc-events.main.runtime'; +import { ConfigMergerMain } from '@teambit/config-merger/config-merger.main.runtime'; +import { VersionHistoryMain } from '@teambit/version-history/version-history.main.runtime'; +import { HostInitializerMain } from '@teambit/host-initializer/host-initializer.main.runtime'; +import { DoctorMain } from '@teambit/doctor/doctor.main.runtime'; +import { ApplyMain } from '@teambit/apply/apply.main.runtime'; + import { BitAspect } from './bit.aspect'; -export const manifestsMap = { - [AspectLoaderAspect.id]: AspectLoaderAspect, - [CLIAspect.id]: CLIAspect, - [DevFilesAspect.id]: DevFilesAspect, - [WorkspaceAspect.id]: WorkspaceAspect, - [WorkspaceConfigFilesAspect.id]: WorkspaceConfigFilesAspect, - [InstallAspect.id]: InstallAspect, - [ESLintAspect.id]: ESLintAspect, - [PrettierAspect.id]: PrettierAspect, - [CompilerAspect.id]: CompilerAspect, - [LinterAspect.id]: LinterAspect, - [FormatterAspect.id]: FormatterAspect, - [ComponentAspect.id]: ComponentAspect, - [MDXAspect.id]: MDXAspect, - [ReadmeAspect.id]: ReadmeAspect, - [PreviewAspect.id]: PreviewAspect, - [ComponentSizerAspect.id]: ComponentSizerAspect, - [DocsAspect.id]: DocsAspect, - [YarnAspect.id]: YarnAspect, - [CompositionsAspect.id]: CompositionsAspect, - [GlobalConfigAspect.id]: GlobalConfigAspect, - [GraphqlAspect.id]: GraphqlAspect, - [PnpmAspect.id]: PnpmAspect, - [MultiCompilerAspect.id]: MultiCompilerAspect, - [UIAspect.id]: UIAspect, - [GeneratorAspect.id]: GeneratorAspect, - [EnvsAspect.id]: EnvsAspect, - [EnvAspect.id]: EnvAspect, - [GraphAspect.id]: GraphAspect, - [PubsubAspect.id]: PubsubAspect, - [DependencyResolverAspect.id]: DependencyResolverAspect, - [InsightsAspect.id]: InsightsAspect, - [IsolatorAspect.id]: IsolatorAspect, - [LoggerAspect.id]: LoggerAspect, - [PkgAspect.id]: PkgAspect, - [ReactAspect.id]: ReactAspect, - [WorkerAspect.id]: WorkerAspect, - // [StencilAspect.id]: StencilAspect, - [ScopeAspect.id]: ScopeAspect, - [TesterAspect.id]: TesterAspect, - [MultiTesterAspect.id]: MultiTesterAspect, - [BuilderAspect.id]: BuilderAspect, - [VariantsAspect.id]: VariantsAspect, - [DeprecationAspect.id]: DeprecationAspect, - [ExpressAspect.id]: ExpressAspect, - [AspectAspect.id]: AspectAspect, - [WebpackAspect.id]: WebpackAspect, - [SchemaAspect.id]: SchemaAspect, - [ReactRouterAspect.id]: ReactRouterAspect, - [TypescriptAspect.id]: TypescriptAspect, - [PanelUiAspect.id]: PanelUiAspect, - [BabelAspect.id]: BabelAspect, - [NodeAspect.id]: NodeAspect, - [NotificationsAspect.id]: NotificationsAspect, - [BundlerAspect.id]: BundlerAspect, - [JestAspect.id]: JestAspect, - [CacheAspect.id]: CacheAspect, - [ChangelogAspect.id]: ChangelogAspect, - [CodeAspect.id]: CodeAspect, - [CommandBarAspect.id]: CommandBarAspect, - [SidebarAspect.id]: SidebarAspect, - [ComponentTreeAspect.id]: ComponentTreeAspect, - [SignAspect.id]: SignAspect, - [UpdateDependenciesAspect.id]: UpdateDependenciesAspect, - [ExportAspect.id]: ExportAspect, - [ImporterAspect.id]: ImporterAspect, - [HarmonyUiAppAspect.id]: HarmonyUiAppAspect, - [UserAgentAspect.id]: UserAgentAspect, - [ApplicationAspect.id]: ApplicationAspect, - [EjectAspect.id]: EjectAspect, - [HtmlAspect.id]: HtmlAspect, - [LanesAspect.id]: LanesAspect, - [ForkingAspect.id]: ForkingAspect, - [RenamingAspect.id]: RenamingAspect, - [NewComponentHelperAspect.id]: NewComponentHelperAspect, - [ComponentLogAspect.id]: ComponentLogAspect, - [ClearCacheAspect.id]: ClearCacheAspect, - [MochaAspect.id]: MochaAspect, - [DiagnosticAspect.id]: DiagnosticAspect, - [StatusAspect.id]: StatusAspect, - [CommunityAspect.id]: CommunityAspect, - [CloudAspect.id]: CloudAspect, - [SnappingAspect.id]: SnappingAspect, - [MergingAspect.id]: MergingAspect, - [IssuesAspect.id]: IssuesAspect, - [RefactoringAspect.id]: RefactoringAspect, - [ComponentCompareAspect.id]: ComponentCompareAspect, - [ListerAspect.id]: ListerAspect, - [DependenciesAspect.id]: DependenciesAspect, - [RemoveAspect.id]: RemoveAspect, - [MergeLanesAspect.id]: MergeLanesAspect, - [CheckoutAspect.id]: CheckoutAspect, - [ComponentWriterAspect.id]: ComponentWriterAspect, - [APIReferenceAspect.id]: APIReferenceAspect, - [ApiServerAspect.id]: ApiServerAspect, - [TrackerAspect.id]: TrackerAspect, - [MoverAspect.id]: MoverAspect, - [WatcherAspect.id]: WatcherAspect, - [StashAspect.id]: StashAspect, - [GitAspect.id]: GitAspect, - [IpcEventsAspect.id]: IpcEventsAspect, - [ConfigMergerAspect.id]: ConfigMergerAspect, - [VersionHistoryAspect.id]: VersionHistoryAspect, - [HostInitializerAspect.id]: HostInitializerAspect, - [DoctorAspect.id]: DoctorAspect, - [ApplyAspect.id]: ApplyAspect, +export function getManifestsMap() { + const manifestsMap = { + [AspectLoaderAspect.id]: AspectLoaderAspect, + [CLIAspect.id]: CLIAspect, + [DevFilesAspect.id]: DevFilesAspect, + [WorkspaceAspect.id]: WorkspaceAspect, + [WorkspaceConfigFilesAspect.id]: WorkspaceConfigFilesAspect, + [InstallAspect.id]: InstallAspect, + [ESLintAspect.id]: ESLintAspect, + [PrettierAspect.id]: PrettierAspect, + [CompilerAspect.id]: CompilerAspect, + [LinterAspect.id]: LinterAspect, + [FormatterAspect.id]: FormatterAspect, + [ComponentAspect.id]: ComponentAspect, + [MDXAspect.id]: MDXAspect, + [ReadmeAspect.id]: ReadmeAspect, + [PreviewAspect.id]: PreviewAspect, + [ComponentSizerAspect.id]: ComponentSizerAspect, + [DocsAspect.id]: DocsAspect, + [YarnAspect.id]: YarnAspect, + [CompositionsAspect.id]: CompositionsAspect, + [GlobalConfigAspect.id]: GlobalConfigAspect, + [GraphqlAspect.id]: GraphqlAspect, + [PnpmAspect.id]: PnpmAspect, + [MultiCompilerAspect.id]: MultiCompilerAspect, + [UIAspect.id]: UIAspect, + [GeneratorAspect.id]: GeneratorAspect, + [EnvsAspect.id]: EnvsAspect, + [EnvAspect.id]: EnvAspect, + [GraphAspect.id]: GraphAspect, + [PubsubAspect.id]: PubsubAspect, + [DependencyResolverAspect.id]: DependencyResolverAspect, + [InsightsAspect.id]: InsightsAspect, + [IsolatorAspect.id]: IsolatorAspect, + [LoggerAspect.id]: LoggerAspect, + [PkgAspect.id]: PkgAspect, + [ReactAspect.id]: ReactAspect, + [WorkerAspect.id]: WorkerAspect, + // [StencilAspect.id]: StencilAspect, + [ScopeAspect.id]: ScopeAspect, + [TesterAspect.id]: TesterAspect, + [MultiTesterAspect.id]: MultiTesterAspect, + [BuilderAspect.id]: BuilderAspect, + [VariantsAspect.id]: VariantsAspect, + [DeprecationAspect.id]: DeprecationAspect, + [ExpressAspect.id]: ExpressAspect, + [AspectAspect.id]: AspectAspect, + [WebpackAspect.id]: WebpackAspect, + [SchemaAspect.id]: SchemaAspect, + [ReactRouterAspect.id]: ReactRouterAspect, + [TypescriptAspect.id]: TypescriptAspect, + [PanelUiAspect.id]: PanelUiAspect, + [BabelAspect.id]: BabelAspect, + [NodeAspect.id]: NodeAspect, + [NotificationsAspect.id]: NotificationsAspect, + [BundlerAspect.id]: BundlerAspect, + [JestAspect.id]: JestAspect, + [CacheAspect.id]: CacheAspect, + [ChangelogAspect.id]: ChangelogAspect, + [CodeAspect.id]: CodeAspect, + [CommandBarAspect.id]: CommandBarAspect, + [SidebarAspect.id]: SidebarAspect, + [ComponentTreeAspect.id]: ComponentTreeAspect, + [SignAspect.id]: SignAspect, + [UpdateDependenciesAspect.id]: UpdateDependenciesAspect, + [ExportAspect.id]: ExportAspect, + [ImporterAspect.id]: ImporterAspect, + [HarmonyUiAppAspect.id]: HarmonyUiAppAspect, + [UserAgentAspect.id]: UserAgentAspect, + [ApplicationAspect.id]: ApplicationAspect, + [EjectAspect.id]: EjectAspect, + // [HtmlAspect.id]: HtmlAspect, + [LanesAspect.id]: LanesAspect, + [ForkingAspect.id]: ForkingAspect, + [RenamingAspect.id]: RenamingAspect, + [NewComponentHelperAspect.id]: NewComponentHelperAspect, + [ComponentLogAspect.id]: ComponentLogAspect, + [ClearCacheAspect.id]: ClearCacheAspect, + [MochaAspect.id]: MochaAspect, + [DiagnosticAspect.id]: DiagnosticAspect, + [StatusAspect.id]: StatusAspect, + [CommunityAspect.id]: CommunityAspect, + [CloudAspect.id]: CloudAspect, + [SnappingAspect.id]: SnappingAspect, + [MergingAspect.id]: MergingAspect, + [IssuesAspect.id]: IssuesAspect, + [RefactoringAspect.id]: RefactoringAspect, + [ComponentCompareAspect.id]: ComponentCompareAspect, + [ListerAspect.id]: ListerAspect, + [DependenciesAspect.id]: DependenciesAspect, + [RemoveAspect.id]: RemoveAspect, + [MergeLanesAspect.id]: MergeLanesAspect, + [CheckoutAspect.id]: CheckoutAspect, + [ComponentWriterAspect.id]: ComponentWriterAspect, + [APIReferenceAspect.id]: APIReferenceAspect, + [ApiServerAspect.id]: ApiServerAspect, + [TrackerAspect.id]: TrackerAspect, + [MoverAspect.id]: MoverAspect, + [WatcherAspect.id]: WatcherAspect, + [StashAspect.id]: StashAspect, + [GitAspect.id]: GitAspect, + [IpcEventsAspect.id]: IpcEventsAspect, + [ConfigMergerAspect.id]: ConfigMergerAspect, + [VersionHistoryAspect.id]: VersionHistoryAspect, + [HostInitializerAspect.id]: HostInitializerAspect, + [DoctorAspect.id]: DoctorAspect, + [ApplyAspect.id]: ApplyAspect, + }; + return manifestsMap; +} + +export const runtimesMap = { + [AspectLoaderAspect.id]: AspectLoaderMain, + [CLIAspect.id]: CLIMain, + [DevFilesAspect.id]: DevFilesMain, + [WorkspaceAspect.id]: WorkspaceMain, + [WorkspaceConfigFilesAspect.id]: WorkspaceConfigFilesMain, + [InstallAspect.id]: InstallMain, + [ESLintAspect.id]: ESLintMain, + [PrettierAspect.id]: PrettierMain, + [CompilerAspect.id]: CompilerMain, + [LinterAspect.id]: LinterMain, + [FormatterAspect.id]: FormatterMain, + [ComponentAspect.id]: ComponentMain, + [MDXAspect.id]: MDXMain, + [ReadmeAspect.id]: ReadmeMain, + [PreviewAspect.id]: PreviewMain, + [ComponentSizerAspect.id]: ComponentSizerMain, + [DocsAspect.id]: DocsMain, + [YarnAspect.id]: YarnMain, + [CompositionsAspect.id]: CompositionsMain, + [GlobalConfigAspect.id]: GlobalConfigMain, + [GraphqlAspect.id]: GraphqlMain, + [PnpmAspect.id]: PnpmMain, + [MultiCompilerAspect.id]: MultiCompilerMain, + [UIAspect.id]: UiMain, + [GeneratorAspect.id]: GeneratorMain, + [EnvsAspect.id]: EnvsMain, + [EnvAspect.id]: EnvMain, + [GraphAspect.id]: GraphMain, + [PubsubAspect.id]: PubsubMain, + [DependencyResolverAspect.id]: DependencyResolverMain, + [InsightsAspect.id]: InsightsMain, + [IsolatorAspect.id]: IsolatorMain, + [LoggerAspect.id]: LoggerMain, + [PkgAspect.id]: PkgMain, + [ReactAspect.id]: ReactMain, + [WorkerAspect.id]: WorkerMain, + // [StencilAspect.id]: StencilMain, + [ScopeAspect.id]: ScopeMain, + [TesterAspect.id]: TesterMain, + [MultiTesterAspect.id]: MultiTesterMain, + [BuilderAspect.id]: BuilderMain, + [VariantsAspect.id]: VariantsMain, + [DeprecationAspect.id]: DeprecationMain, + [ExpressAspect.id]: ExpressMain, + [AspectAspect.id]: AspectMain, + [WebpackAspect.id]: WebpackMain, + [SchemaAspect.id]: SchemaMain, + [TypescriptAspect.id]: TypescriptMain, + [PanelUiAspect.id]: PanelUIMain, + [BabelAspect.id]: BabelMain, + [NodeAspect.id]: NodeMain, + [BundlerAspect.id]: BundlerMain, + [JestAspect.id]: JestMain, + [CacheAspect.id]: CacheMain, + [SignAspect.id]: SignMain, + [UpdateDependenciesAspect.id]: UpdateDependenciesMain, + [ExportAspect.id]: ExportMain, + [ImporterAspect.id]: ImporterMain, + [HarmonyUiAppAspect.id]: HarmonyUiAppMain, + [ApplicationAspect.id]: ApplicationMain, + [EjectAspect.id]: EjectMain, + // [HtmlAspect.id]: HtmlMain, + [LanesAspect.id]: LanesMain, + [ForkingAspect.id]: ForkingMain, + [RenamingAspect.id]: RenamingMain, + [NewComponentHelperAspect.id]: NewComponentHelperMain, + [ComponentLogAspect.id]: ComponentLogMain, + [ClearCacheAspect.id]: ClearCacheMain, + [MochaAspect.id]: MochaMain, + [DiagnosticAspect.id]: DiagnosticMain, + [StatusAspect.id]: StatusMain, + [CommunityAspect.id]: CommunityMain, + [CloudAspect.id]: CloudMain, + [SnappingAspect.id]: SnappingMain, + [MergingAspect.id]: MergingMain, + [IssuesAspect.id]: IssuesMain, + [RefactoringAspect.id]: RefactoringMain, + [ComponentCompareAspect.id]: ComponentCompareMain, + [ListerAspect.id]: ListerMain, + [DependenciesAspect.id]: DependenciesMain, + [RemoveAspect.id]: RemoveMain, + [MergeLanesAspect.id]: MergeLanesMain, + [CheckoutAspect.id]: CheckoutMain, + [ComponentWriterAspect.id]: ComponentWriterMain, + [ApiServerAspect.id]: ApiServerMain, + [TrackerAspect.id]: TrackerMain, + [MoverAspect.id]: MoverMain, + [WatcherAspect.id]: WatcherMain, + [StashAspect.id]: StashMain, + [GitAspect.id]: GitMain, + [IpcEventsAspect.id]: IpcEventsMain, + [ConfigMergerAspect.id]: ConfigMergerMain, + [VersionHistoryAspect.id]: VersionHistoryMain, + [HostInitializerAspect.id]: HostInitializerMain, + [DoctorAspect.id]: DoctorMain, + [ApplyAspect.id]: ApplyMain, }; export function isCoreAspect(id: string) { + const manifestsMap = getManifestsMap(); const _reserved = [BitAspect.id, ConfigAspect.id]; if (_reserved.includes(id)) return true; return !!manifestsMap[id]; } export function getAllCoreAspectsIds(): string[] { + const manifestsMap = getManifestsMap(); const _reserved = [BitAspect.id, ConfigAspect.id]; return [...Object.keys(manifestsMap), ..._reserved]; }