@teambit/application 1.0.1158 → 1.0.1160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application.main.runtime.js +13 -4
- package/dist/application.main.runtime.js.map +1 -1
- package/dist/{preview-1788904049748.js → preview-1789064510576.js} +2 -2
- package/dist/select-apps-plugin-defs.d.ts +17 -0
- package/dist/select-apps-plugin-defs.js +58 -0
- package/dist/select-apps-plugin-defs.js.map +1 -0
- package/dist/select-apps-plugin-defs.spec.d.ts +1 -0
- package/dist/select-apps-plugin-defs.spec.js +94 -0
- package/dist/select-apps-plugin-defs.spec.js.map +1 -0
- package/package.json +12 -11
|
@@ -144,6 +144,13 @@ function _appType() {
|
|
|
144
144
|
};
|
|
145
145
|
return data;
|
|
146
146
|
}
|
|
147
|
+
function _selectAppsPluginDefs() {
|
|
148
|
+
const data = require("./select-apps-plugin-defs");
|
|
149
|
+
_selectAppsPluginDefs = function () {
|
|
150
|
+
return data;
|
|
151
|
+
};
|
|
152
|
+
return data;
|
|
153
|
+
}
|
|
147
154
|
function _appContext() {
|
|
148
155
|
const data = require("./app-context");
|
|
149
156
|
_appContext = function () {
|
|
@@ -345,10 +352,12 @@ class ApplicationMain {
|
|
|
345
352
|
const appTypesPatterns = this.getAppPatterns();
|
|
346
353
|
const isApp = this.hasAppTypePattern(component, appTypesPatterns);
|
|
347
354
|
if (!isApp) return undefined;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
355
|
+
|
|
356
|
+
// the same app-type can be registered more than once, when two versions of the aspect that defines it are loaded
|
|
357
|
+
// (harmony registers extensions by their full id, including the version, so both providers run).
|
|
358
|
+
// in such a case, the app file matches both plugin-defs and is registered twice into the app-slot, where the last
|
|
359
|
+
// registration overwrites the previous one, possibly with an outdated implementation of the app-type.
|
|
360
|
+
const appsPluginDefs = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(this.aspectLoader.getPluginDefsByAspectId(), appTypesPatterns, component.state.aspects.ids);
|
|
352
361
|
// const fileResolver = this.aspectLoader.pluginFileResolver(component, rootDir);
|
|
353
362
|
|
|
354
363
|
const plugins = this.aspectLoader.getPluginsFromDefs(component, rootDir, appsPluginDefs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_lodash","_aspectLoader","_harmony","_workspace","_bitError","_watcher","_builder","_scope","_logger","_envs","_component","_exceptions","_application","_buildApplication","_run","_application2","_app","_app2","_appType","_appContext","_deploy","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ApplicationMain","constructor","appSlot","appTypeSlot","deploymentProviderSlot","config","envs","componentAspect","appService","aspectLoader","workspace","logger","watcher","harmony","dev","ssr","watch","defaultPortRange","registerApp","app","register","listApps","flatten","values","listAppsIdsAndNames","loadAllAppsAsAspects","appComponents","mapApps","flatMap","id","apps","map","name","BitError","toString","toArray","poolIds","listAppsComponents","appsWithEnvLoaded","state","issues","getIssueByName","warn","appIds","getHost","loadAspects","listAppsById","undefined","get","getAppById","head","calculateAppByComponent","component","listAppTypes","listAppsFromComponents","host","components","getMany","loadExtensions","executeLoadSlot","loadSeedersAsAspects","list","appTypesPatterns","getAppPatterns","appsComponents","hasAppTypePattern","patterns","files","filesystem","byGlob","appTypes","appType","getAppPattern","concat","BIT_APP_PATTERN","loadApps","pluginsToLoad","appComponent","file","path","appManifests","Promise","all","compact","pluginPath","isModule","isEsmModule","appManifest","loadEsm","default","error","loadAppsFromComponent","rootDir","isApp","allPluginDefs","getPluginDefs","appsPluginDefs","pluginDef","includes","pattern","plugins","getPluginsFromDefs","loadedPlugins","has","load","MainRuntime","loadExtensionsByManifests","seeders","getApp","appName","find","getAppByNameOrId","appNameOrId","byName","byId","globPattern","registerAppType","AppTypePlugin","registerPlugins","getAppAspect","getAppOrThrow","AppNotFound","computeOptions","opts","defaultOpts","loadAppsToSlot","runApp","options","setComponentPathsRegExps","context","createAppContext","port","args","instance","run","preCompile","compile","catch","err","isOldApi","errors","getAppIdOrThrow","maybeApp","resolveComponentId","env","createEnvironment","res","results","hostRootDir","getComponentPackagePath","workspaceComponentDir","componentDir","appContext","AppContext","createAppBuildContext","capsuleRootDir","provider","cli","loggerAspect","builder","scope","createLogger","ApplicationAspect","AppService","application","bind","appCmd","AppCmd","commands","AppListCmd","RunCmd","AppPlugin","registerBuildTasks","AppsBuildTask","registerSnapTasks","DeployTask","registerTagTasks","registerService","registerGroup","calcAppOnLoad","loadedComponent","type","applicationType","registerOnComponentLoad","registerOnCompAspectReCalc","exports","CLIAspect","LoggerAspect","BuilderAspect","EnvsAspect","ComponentAspect","AspectLoaderAspect","WorkspaceAspect","WatcherAspect","ScopeAspect","Slot","withType","addRuntime"],"sources":["application.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { MainRuntime, CLIAspect } from '@teambit/cli';\nimport { compact, flatten, head } from 'lodash';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { AspectLoaderAspect } from '@teambit/aspect-loader';\nimport type { SlotRegistry, Harmony } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport type { WatcherMain } from '@teambit/watcher';\nimport { WatcherAspect } from '@teambit/watcher';\nimport type { BuilderMain } from '@teambit/builder';\nimport { BuilderAspect } from '@teambit/builder';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { EnvsMain } from '@teambit/envs';\nimport { EnvsAspect } from '@teambit/envs';\nimport type { ComponentMain, ComponentID, Component } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport type { ApplicationType } from './application-type';\nimport type { Application } from './application';\nimport type { DeploymentProvider } from './deployment-provider';\nimport { AppNotFound } from './exceptions';\nimport { ApplicationAspect } from './application.aspect';\nimport { AppsBuildTask } from './build-application.task';\nimport { RunCmd } from './run.cmd';\nimport { AppService } from './application.service';\nimport { AppCmd, AppListCmd } from './app.cmd';\nimport { AppPlugin, BIT_APP_PATTERN } from './app.plugin';\nimport { AppTypePlugin } from './app-type.plugin';\nimport { AppContext } from './app-context';\nimport { DeployTask } from './deploy.task';\n\nexport type ApplicationTypeSlot = SlotRegistry<ApplicationType<unknown>[]>;\nexport type ApplicationSlot = SlotRegistry<Application[]>;\nexport type DeploymentProviderSlot = SlotRegistry<DeploymentProvider[]>;\n\nexport type ApplicationAspectConfig = {\n /**\n * envs ids to load app types.\n */\n envs?: string[];\n};\n\n/**\n * Application meta data that is stored on the component on load if it's an application.\n */\nexport type ApplicationMetadata = {\n appName: string;\n type?: string;\n};\n\nexport type ServeAppOptions = {\n /**\n * default port range used to serve applications.\n */\n defaultPortRange?: [start: number, end: number];\n\n /**\n * determine whether to start the application in dev mode.\n */\n dev: boolean;\n\n /**\n * actively watch and compile the workspace (like the bit watch command)\n * @default true\n */\n watch?: boolean;\n\n /**\n * determine whether to start the application in server side mode.\n * @default false\n */\n ssr?: boolean;\n\n /**\n * exact port to run the app\n */\n port?: number;\n\n /**\n * arguments passing to the app.\n */\n args?: string;\n};\n\nexport class ApplicationMain {\n constructor(\n private appSlot: ApplicationSlot,\n // TODO unused\n private appTypeSlot: ApplicationTypeSlot,\n private deploymentProviderSlot: DeploymentProviderSlot,\n private config: ApplicationAspectConfig,\n private envs: EnvsMain,\n private componentAspect: ComponentMain,\n private appService: AppService,\n private aspectLoader: AspectLoaderMain,\n private workspace: Workspace,\n private logger: Logger,\n private watcher: WatcherMain,\n private harmony: Harmony\n ) {}\n\n /**\n * register a new app.\n */\n registerApp(app: Application) {\n this.appSlot.register([app]);\n return this;\n }\n\n /**\n * list all registered apps.\n */\n listApps(): Application[] {\n return flatten(this.appSlot.values());\n }\n\n async listAppsIdsAndNames(): Promise<{ id: string; name: string }[]> {\n await this.loadAllAppsAsAspects();\n const appComponents = this.mapApps();\n return appComponents.flatMap(([id, apps]) => {\n return apps.map((app) => {\n if (!app.name) throw new BitError(`app ${id.toString()} is missing a name`);\n return { id, name: app.name };\n });\n });\n }\n\n /**\n * map all apps by component ID.\n */\n mapApps() {\n return this.appSlot.toArray();\n }\n\n /**\n * instead of adding apps to workspace.jsonc, this method gets all apps components and load them as aspects so then\n * they could register to the apps slots and be available to list/run etc.\n * if poolIds is provided, it will load only the apps that are part of the pool.\n */\n async loadAllAppsAsAspects(poolIds?: ComponentID[]): Promise<ComponentID[]> {\n const apps = await this.listAppsComponents(poolIds);\n if (!apps.length) return [];\n // do not load apps that their env was not loaded yet. their package-json may not be up to date. e.g. it could be\n // cjs, when the env needs it as esm. once it is loaded, node.js saved the package.json in the cache with no way to\n // refresh it.\n const appsWithEnvLoaded = apps.filter((app) => !app.state.issues.getIssueByName('NonLoadedEnv'));\n if (apps.length !== appsWithEnvLoaded.length) {\n this.logger.warn(`some apps were not loaded as aspects because their env was not loaded yet`);\n }\n const appIds = appsWithEnvLoaded.map((app) => app.id);\n await this.componentAspect.getHost().loadAspects(appIds.map((id) => id.toString()));\n return appIds;\n }\n\n /**\n * list apps by a component id.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n listAppsById(id?: ComponentID): Application[] | undefined {\n if (!id) return undefined;\n return this.appSlot.get(id.toString());\n }\n\n /**\n * get an application by a component id.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n async getAppById(id: ComponentID) {\n const apps = await this.listAppsById(id);\n if (!apps) return undefined;\n return head(apps);\n }\n\n /**\n * calculate an application by a component.\n * This should be only used during the on component load slot\n */\n calculateAppByComponent(component: Component) {\n const apps = this.appSlot.get(component.id.toString());\n if (!apps) return undefined;\n return head(apps);\n }\n\n listAppTypes() {\n return flatten(this.appTypeSlot.values());\n }\n\n /**\n * @deprecated use `listAppsComponents` instead.\n * @returns\n */\n async listAppsFromComponents(): Promise<Component[]> {\n return this.listAppsComponents();\n }\n\n /**\n * list all components that are apps.\n * if poolIds is provided, it will load only the apps that are part of the pool.\n */\n async listAppsComponents(poolIds?: ComponentID[]): Promise<Component[]> {\n const host = this.workspace || this.componentAspect.getHost();\n if (!host) return [];\n const components = poolIds\n ? this.workspace\n ? await this.workspace.getMany(poolIds, {\n loadExtensions: true,\n executeLoadSlot: true,\n loadSeedersAsAspects: true,\n })\n : await host.getMany(poolIds)\n : await host.list();\n const appTypesPatterns = this.getAppPatterns();\n const appsComponents = components.filter((component) => this.hasAppTypePattern(component, appTypesPatterns));\n return appsComponents;\n }\n\n private hasAppTypePattern(component: Component, appTypesPatterns?: string[]): boolean {\n const patterns = appTypesPatterns || this.getAppPatterns();\n // has app plugin from registered types.\n const files = component.filesystem.byGlob(patterns);\n return !!files.length;\n }\n\n getAppPatterns() {\n const appTypes = this.listAppTypes();\n const appTypesPatterns = appTypes.map((appType) => {\n return this.getAppPattern(appType);\n });\n\n return appTypesPatterns.concat(BIT_APP_PATTERN);\n }\n\n async loadApps(): Promise<Application[]> {\n const apps = await this.listAppsComponents();\n const appTypesPatterns = this.getAppPatterns();\n\n const pluginsToLoad = apps.flatMap((appComponent) => {\n const files = appComponent.filesystem.byGlob(appTypesPatterns);\n return files.map((file) => file.path);\n });\n\n // const app = require(appPath);\n const appManifests = Promise.all(\n compact(\n pluginsToLoad.map(async (pluginPath) => {\n try {\n const isModule = await this.aspectLoader.isEsmModule(pluginPath);\n if (isModule) {\n const appManifest = await this.aspectLoader.loadEsm(pluginPath);\n return appManifest;\n }\n // eslint-disable-next-line\n const appManifest = require(pluginPath)?.default;\n return appManifest;\n } catch {\n this.logger.error(`failed loading app manifest: ${pluginPath}`);\n return undefined;\n }\n })\n )\n );\n\n return appManifests;\n }\n\n async loadAppsFromComponent(component: Component, rootDir: string): Promise<Application[] | undefined> {\n const appTypesPatterns = this.getAppPatterns();\n const isApp = this.hasAppTypePattern(component, appTypesPatterns);\n if (!isApp) return undefined;\n\n const allPluginDefs = this.aspectLoader.getPluginDefs();\n\n const appsPluginDefs = allPluginDefs.filter((pluginDef) => {\n return appTypesPatterns.includes(pluginDef.pattern.toString());\n });\n // const fileResolver = this.aspectLoader.pluginFileResolver(component, rootDir);\n\n const plugins = this.aspectLoader.getPluginsFromDefs(component, rootDir, appsPluginDefs);\n let loadedPlugins;\n if (plugins.has()) {\n loadedPlugins = await plugins.load(MainRuntime.name);\n await this.aspectLoader.loadExtensionsByManifests([loadedPlugins], { seeders: [component.id.toString()] });\n }\n\n const listAppsById = this.listAppsById(component.id);\n return listAppsById;\n }\n\n /**\n * get an app.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n getApp(appName: string, id?: ComponentID): Application | undefined {\n const apps = id ? this.listAppsById(id) : this.listApps();\n if (!apps) return undefined;\n return apps.find((app) => app.name === appName);\n }\n\n getAppByNameOrId(appNameOrId: string): Application | undefined {\n const byName = this.getApp(appNameOrId);\n if (byName) return byName;\n const byId = this.appSlot.get(appNameOrId);\n if (!byId || !byId.length) return undefined;\n if (byId.length > 1) {\n throw new BitError(\n `unable to figure out what app to retrieve. the id \"${appNameOrId}\" has more than one app. please use the app-name`\n );\n }\n return byId[0];\n }\n\n getAppPattern(appType: ApplicationType<unknown>) {\n if (appType.globPattern) return appType.globPattern;\n return `*.${appType.name}.*`;\n }\n\n /**\n * registers a new app and sets a plugin for it.\n */\n registerAppType<T>(...appTypes: Array<ApplicationType<T>>) {\n const plugins = appTypes.map((appType) => {\n return new AppTypePlugin(this.getAppPattern(appType), appType, this.appSlot);\n });\n\n this.aspectLoader.registerPlugins(plugins);\n this.appTypeSlot.register(appTypes);\n return this;\n }\n\n /**\n * get an app AspectId.\n */\n getAppAspect(appName: string): string | undefined {\n return this.appSlot.toArray().find(([, apps]) => apps.find((app) => app.name === appName))?.[0];\n }\n\n /**\n * get app to throw.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n getAppOrThrow(appName: string): Application {\n const app = this.getAppByNameOrId(appName);\n if (!app) throw new AppNotFound(appName);\n return app;\n }\n\n defaultOpts: ServeAppOptions = {\n dev: false,\n ssr: false,\n watch: true,\n defaultPortRange: [3100, 3500],\n };\n private computeOptions(opts: Partial<ServeAppOptions> = {}) {\n return {\n ...this.defaultOpts,\n ...opts,\n };\n }\n\n async loadAppsToSlot() {\n const apps = await this.loadApps();\n this.appSlot.register(apps);\n return this;\n }\n\n /**\n * run an app.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n async runApp(\n appName: string,\n options?: ServeAppOptions\n ): Promise<{\n app: Application;\n port: number | undefined;\n errors?: Error[];\n isOldApi: boolean;\n }> {\n await this.workspace.setComponentPathsRegExps();\n options = this.computeOptions(options);\n const app = this.getAppOrThrow(appName);\n const context = await this.createAppContext(app.name, options.port, options.args);\n if (!context) throw new AppNotFound(appName);\n\n const instance = await app.run(context);\n if (options.watch) {\n this.watcher\n .watch({\n preCompile: false,\n compile: true,\n })\n .catch((err) => {\n // don't throw an error, we don't want to break the \"run\" process\n this.logger.error(`compilation failed`, err);\n });\n }\n\n const isOldApi = typeof instance === 'number';\n const port = isOldApi ? instance : instance?.port;\n\n return { app, port, errors: undefined, isOldApi };\n }\n\n /**\n * get the component ID of a certain app.\n */\n async getAppIdOrThrow(appName: string) {\n const maybeApp = this.appSlot.toArray().find(([, apps]) => {\n return apps.find((app) => app.name === appName);\n });\n\n if (!maybeApp) throw new AppNotFound(appName);\n\n const host = this.componentAspect.getHost();\n return host.resolveComponentId(maybeApp[0]);\n }\n\n private async createAppContext(appName: string, port?: number, args?: string): Promise<AppContext> {\n const host = this.componentAspect.getHost();\n // const components = await host.list();\n const id = await this.getAppIdOrThrow(appName);\n // const component = components.find((c) => c.id.isEqual(id));\n const component = await host.get(id);\n if (!component) throw new AppNotFound(appName);\n\n const env = await this.envs.createEnvironment([component]);\n const res = await env.run(this.appService);\n const context = res.results[0].data;\n if (!context) throw new AppNotFound(appName);\n const hostRootDir = await this.workspace.getComponentPackagePath(component);\n const workspaceComponentDir = this.workspace.componentDir(component.id);\n\n const appContext = new AppContext(\n appName,\n this.harmony,\n context.dev,\n component,\n this.workspace.path,\n context,\n hostRootDir,\n port,\n args,\n workspaceComponentDir\n );\n return appContext;\n }\n\n async createAppBuildContext(id: ComponentID, appName: string, capsuleRootDir: string, rootDir?: string) {\n const host = this.componentAspect.getHost();\n // const components = await host.list();\n // const component = components.find((c) => c.id.isEqual(id));\n const component = await host.get(id);\n if (!component) throw new AppNotFound(appName);\n\n const env = await this.envs.createEnvironment([component]);\n const res = await env.run(this.appService);\n const context = res.results[0].data;\n if (!context) throw new AppNotFound(appName);\n\n const appContext = new AppContext(\n appName,\n this.harmony,\n context.dev,\n component,\n capsuleRootDir,\n context,\n rootDir,\n undefined,\n undefined,\n undefined,\n undefined\n );\n return appContext;\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n LoggerAspect,\n BuilderAspect,\n EnvsAspect,\n ComponentAspect,\n AspectLoaderAspect,\n WorkspaceAspect,\n WatcherAspect,\n ScopeAspect,\n ];\n\n static slots = [\n Slot.withType<ApplicationType<unknown>[]>(),\n Slot.withType<Application[]>(),\n Slot.withType<DeploymentProvider[]>(),\n ];\n\n static async provider(\n [cli, loggerAspect, builder, envs, component, aspectLoader, workspace, watcher, scope]: [\n CLIMain,\n LoggerMain,\n BuilderMain,\n EnvsMain,\n ComponentMain,\n AspectLoaderMain,\n Workspace,\n WatcherMain,\n ScopeMain,\n ],\n config: ApplicationAspectConfig,\n [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot],\n harmony: Harmony\n ) {\n const logger = loggerAspect.createLogger(ApplicationAspect.id);\n const appService = new AppService();\n const application = new ApplicationMain(\n appSlot,\n appTypeSlot,\n deploymentProviderSlot,\n config,\n envs,\n component,\n appService,\n aspectLoader,\n workspace,\n logger,\n watcher,\n harmony\n );\n appService.registerAppType = application.registerAppType.bind(application);\n const appCmd = new AppCmd(application);\n appCmd.commands = [new AppListCmd(application), new RunCmd(application, logger)];\n aspectLoader.registerPlugins([new AppPlugin(appSlot)]);\n builder.registerBuildTasks([new AppsBuildTask(application)]);\n builder.registerSnapTasks([new DeployTask(application, builder)]);\n builder.registerTagTasks([new DeployTask(application, builder)]);\n envs.registerService(appService);\n cli.registerGroup('apps', 'Applications');\n cli.register(new RunCmd(application, logger), appCmd);\n // cli.registerOnStart(async () => {\n // await application.loadAppsToSlot();\n // });\n const calcAppOnLoad = async (loadedComponent): Promise<ApplicationMetadata | undefined> => {\n const app = application.calculateAppByComponent(loadedComponent);\n if (!app) return undefined;\n return {\n appName: app.name,\n type: app.applicationType,\n };\n };\n if (workspace) {\n workspace.registerOnComponentLoad(calcAppOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(calcAppOnLoad);\n }\n\n return application;\n }\n}\n\nApplicationAspect.addRuntime(ApplicationMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC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KAAK,EAAE;MACTA,KAAK,CAACwB,0BAA0B,CAACL,aAAa,CAAC;IACjD;IAEA,OAAOf,WAAW;EACpB;AACF;AAACqB,OAAA,CAAAzL,eAAA,GAAAA,eAAA;AAAAhB,eAAA,CAxdYgB,eAAe,aAuYTyG,kBAAW;AAAAzH,eAAA,CAvYjBgB,eAAe,kBAwYJ,CACpB0L,gBAAS,EACTC,sBAAY,EACZC,wBAAa,EACbC,kBAAU,EACVC,4BAAe,EACfC,kCAAkB,EAClBC,4BAAe,EACfC,wBAAa,EACbC,oBAAW,CACZ;AAAAlN,eAAA,CAlZUgB,eAAe,WAoZX,CACbmM,eAAI,CAACC,QAAQ,CAA6B,CAAC,EAC3CD,eAAI,CAACC,QAAQ,CAAgB,CAAC,EAC9BD,eAAI,CAACC,QAAQ,CAAuB,CAAC,CACtC;AAkEHlC,gCAAiB,CAACmC,UAAU,CAACrM,eAAe,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_lodash","_aspectLoader","_harmony","_workspace","_bitError","_watcher","_builder","_scope","_logger","_envs","_component","_exceptions","_application","_buildApplication","_run","_application2","_app","_app2","_appType","_selectAppsPluginDefs","_appContext","_deploy","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ApplicationMain","constructor","appSlot","appTypeSlot","deploymentProviderSlot","config","envs","componentAspect","appService","aspectLoader","workspace","logger","watcher","harmony","dev","ssr","watch","defaultPortRange","registerApp","app","register","listApps","flatten","values","listAppsIdsAndNames","loadAllAppsAsAspects","appComponents","mapApps","flatMap","id","apps","map","name","BitError","toString","toArray","poolIds","listAppsComponents","appsWithEnvLoaded","state","issues","getIssueByName","warn","appIds","getHost","loadAspects","listAppsById","undefined","get","getAppById","head","calculateAppByComponent","component","listAppTypes","listAppsFromComponents","host","components","getMany","loadExtensions","executeLoadSlot","loadSeedersAsAspects","list","appTypesPatterns","getAppPatterns","appsComponents","hasAppTypePattern","patterns","files","filesystem","byGlob","appTypes","appType","getAppPattern","concat","BIT_APP_PATTERN","loadApps","pluginsToLoad","appComponent","file","path","appManifests","Promise","all","compact","pluginPath","isModule","isEsmModule","appManifest","loadEsm","default","error","loadAppsFromComponent","rootDir","isApp","appsPluginDefs","selectAppsPluginDefs","getPluginDefsByAspectId","aspects","ids","plugins","getPluginsFromDefs","loadedPlugins","has","load","MainRuntime","loadExtensionsByManifests","seeders","getApp","appName","find","getAppByNameOrId","appNameOrId","byName","byId","globPattern","registerAppType","AppTypePlugin","registerPlugins","getAppAspect","getAppOrThrow","AppNotFound","computeOptions","opts","defaultOpts","loadAppsToSlot","runApp","options","setComponentPathsRegExps","context","createAppContext","port","args","instance","run","preCompile","compile","catch","err","isOldApi","errors","getAppIdOrThrow","maybeApp","resolveComponentId","env","createEnvironment","res","results","hostRootDir","getComponentPackagePath","workspaceComponentDir","componentDir","appContext","AppContext","createAppBuildContext","capsuleRootDir","provider","cli","loggerAspect","builder","scope","createLogger","ApplicationAspect","AppService","application","bind","appCmd","AppCmd","commands","AppListCmd","RunCmd","AppPlugin","registerBuildTasks","AppsBuildTask","registerSnapTasks","DeployTask","registerTagTasks","registerService","registerGroup","calcAppOnLoad","loadedComponent","type","applicationType","registerOnComponentLoad","registerOnCompAspectReCalc","exports","CLIAspect","LoggerAspect","BuilderAspect","EnvsAspect","ComponentAspect","AspectLoaderAspect","WorkspaceAspect","WatcherAspect","ScopeAspect","Slot","withType","addRuntime"],"sources":["application.main.runtime.ts"],"sourcesContent":["import type { CLIMain } from '@teambit/cli';\nimport { MainRuntime, CLIAspect } from '@teambit/cli';\nimport { compact, flatten, head } from 'lodash';\nimport type { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { AspectLoaderAspect } from '@teambit/aspect-loader';\nimport type { SlotRegistry, Harmony } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport type { WatcherMain } from '@teambit/watcher';\nimport { WatcherAspect } from '@teambit/watcher';\nimport type { BuilderMain } from '@teambit/builder';\nimport { BuilderAspect } from '@teambit/builder';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { EnvsMain } from '@teambit/envs';\nimport { EnvsAspect } from '@teambit/envs';\nimport type { ComponentMain, ComponentID, Component } from '@teambit/component';\nimport { ComponentAspect } from '@teambit/component';\nimport type { ApplicationType } from './application-type';\nimport type { Application } from './application';\nimport type { DeploymentProvider } from './deployment-provider';\nimport { AppNotFound } from './exceptions';\nimport { ApplicationAspect } from './application.aspect';\nimport { AppsBuildTask } from './build-application.task';\nimport { RunCmd } from './run.cmd';\nimport { AppService } from './application.service';\nimport { AppCmd, AppListCmd } from './app.cmd';\nimport { AppPlugin, BIT_APP_PATTERN } from './app.plugin';\nimport { AppTypePlugin } from './app-type.plugin';\nimport { selectAppsPluginDefs } from './select-apps-plugin-defs';\nimport { AppContext } from './app-context';\nimport { DeployTask } from './deploy.task';\n\nexport type ApplicationTypeSlot = SlotRegistry<ApplicationType<unknown>[]>;\nexport type ApplicationSlot = SlotRegistry<Application[]>;\nexport type DeploymentProviderSlot = SlotRegistry<DeploymentProvider[]>;\n\nexport type ApplicationAspectConfig = {\n /**\n * envs ids to load app types.\n */\n envs?: string[];\n};\n\n/**\n * Application meta data that is stored on the component on load if it's an application.\n */\nexport type ApplicationMetadata = {\n appName: string;\n type?: string;\n};\n\nexport type ServeAppOptions = {\n /**\n * default port range used to serve applications.\n */\n defaultPortRange?: [start: number, end: number];\n\n /**\n * determine whether to start the application in dev mode.\n */\n dev: boolean;\n\n /**\n * actively watch and compile the workspace (like the bit watch command)\n * @default true\n */\n watch?: boolean;\n\n /**\n * determine whether to start the application in server side mode.\n * @default false\n */\n ssr?: boolean;\n\n /**\n * exact port to run the app\n */\n port?: number;\n\n /**\n * arguments passing to the app.\n */\n args?: string;\n};\n\nexport class ApplicationMain {\n constructor(\n private appSlot: ApplicationSlot,\n // TODO unused\n private appTypeSlot: ApplicationTypeSlot,\n private deploymentProviderSlot: DeploymentProviderSlot,\n private config: ApplicationAspectConfig,\n private envs: EnvsMain,\n private componentAspect: ComponentMain,\n private appService: AppService,\n private aspectLoader: AspectLoaderMain,\n private workspace: Workspace,\n private logger: Logger,\n private watcher: WatcherMain,\n private harmony: Harmony\n ) {}\n\n /**\n * register a new app.\n */\n registerApp(app: Application) {\n this.appSlot.register([app]);\n return this;\n }\n\n /**\n * list all registered apps.\n */\n listApps(): Application[] {\n return flatten(this.appSlot.values());\n }\n\n async listAppsIdsAndNames(): Promise<{ id: string; name: string }[]> {\n await this.loadAllAppsAsAspects();\n const appComponents = this.mapApps();\n return appComponents.flatMap(([id, apps]) => {\n return apps.map((app) => {\n if (!app.name) throw new BitError(`app ${id.toString()} is missing a name`);\n return { id, name: app.name };\n });\n });\n }\n\n /**\n * map all apps by component ID.\n */\n mapApps() {\n return this.appSlot.toArray();\n }\n\n /**\n * instead of adding apps to workspace.jsonc, this method gets all apps components and load them as aspects so then\n * they could register to the apps slots and be available to list/run etc.\n * if poolIds is provided, it will load only the apps that are part of the pool.\n */\n async loadAllAppsAsAspects(poolIds?: ComponentID[]): Promise<ComponentID[]> {\n const apps = await this.listAppsComponents(poolIds);\n if (!apps.length) return [];\n // do not load apps that their env was not loaded yet. their package-json may not be up to date. e.g. it could be\n // cjs, when the env needs it as esm. once it is loaded, node.js saved the package.json in the cache with no way to\n // refresh it.\n const appsWithEnvLoaded = apps.filter((app) => !app.state.issues.getIssueByName('NonLoadedEnv'));\n if (apps.length !== appsWithEnvLoaded.length) {\n this.logger.warn(`some apps were not loaded as aspects because their env was not loaded yet`);\n }\n const appIds = appsWithEnvLoaded.map((app) => app.id);\n await this.componentAspect.getHost().loadAspects(appIds.map((id) => id.toString()));\n return appIds;\n }\n\n /**\n * list apps by a component id.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n listAppsById(id?: ComponentID): Application[] | undefined {\n if (!id) return undefined;\n return this.appSlot.get(id.toString());\n }\n\n /**\n * get an application by a component id.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n async getAppById(id: ComponentID) {\n const apps = await this.listAppsById(id);\n if (!apps) return undefined;\n return head(apps);\n }\n\n /**\n * calculate an application by a component.\n * This should be only used during the on component load slot\n */\n calculateAppByComponent(component: Component) {\n const apps = this.appSlot.get(component.id.toString());\n if (!apps) return undefined;\n return head(apps);\n }\n\n listAppTypes() {\n return flatten(this.appTypeSlot.values());\n }\n\n /**\n * @deprecated use `listAppsComponents` instead.\n * @returns\n */\n async listAppsFromComponents(): Promise<Component[]> {\n return this.listAppsComponents();\n }\n\n /**\n * list all components that are apps.\n * if poolIds is provided, it will load only the apps that are part of the pool.\n */\n async listAppsComponents(poolIds?: ComponentID[]): Promise<Component[]> {\n const host = this.workspace || this.componentAspect.getHost();\n if (!host) return [];\n const components = poolIds\n ? this.workspace\n ? await this.workspace.getMany(poolIds, {\n loadExtensions: true,\n executeLoadSlot: true,\n loadSeedersAsAspects: true,\n })\n : await host.getMany(poolIds)\n : await host.list();\n const appTypesPatterns = this.getAppPatterns();\n const appsComponents = components.filter((component) => this.hasAppTypePattern(component, appTypesPatterns));\n return appsComponents;\n }\n\n private hasAppTypePattern(component: Component, appTypesPatterns?: string[]): boolean {\n const patterns = appTypesPatterns || this.getAppPatterns();\n // has app plugin from registered types.\n const files = component.filesystem.byGlob(patterns);\n return !!files.length;\n }\n\n getAppPatterns() {\n const appTypes = this.listAppTypes();\n const appTypesPatterns = appTypes.map((appType) => {\n return this.getAppPattern(appType);\n });\n\n return appTypesPatterns.concat(BIT_APP_PATTERN);\n }\n\n async loadApps(): Promise<Application[]> {\n const apps = await this.listAppsComponents();\n const appTypesPatterns = this.getAppPatterns();\n\n const pluginsToLoad = apps.flatMap((appComponent) => {\n const files = appComponent.filesystem.byGlob(appTypesPatterns);\n return files.map((file) => file.path);\n });\n\n // const app = require(appPath);\n const appManifests = Promise.all(\n compact(\n pluginsToLoad.map(async (pluginPath) => {\n try {\n const isModule = await this.aspectLoader.isEsmModule(pluginPath);\n if (isModule) {\n const appManifest = await this.aspectLoader.loadEsm(pluginPath);\n return appManifest;\n }\n // eslint-disable-next-line\n const appManifest = require(pluginPath)?.default;\n return appManifest;\n } catch {\n this.logger.error(`failed loading app manifest: ${pluginPath}`);\n return undefined;\n }\n })\n )\n );\n\n return appManifests;\n }\n\n async loadAppsFromComponent(component: Component, rootDir: string): Promise<Application[] | undefined> {\n const appTypesPatterns = this.getAppPatterns();\n const isApp = this.hasAppTypePattern(component, appTypesPatterns);\n if (!isApp) return undefined;\n\n // the same app-type can be registered more than once, when two versions of the aspect that defines it are loaded\n // (harmony registers extensions by their full id, including the version, so both providers run).\n // in such a case, the app file matches both plugin-defs and is registered twice into the app-slot, where the last\n // registration overwrites the previous one, possibly with an outdated implementation of the app-type.\n const appsPluginDefs = selectAppsPluginDefs(\n this.aspectLoader.getPluginDefsByAspectId(),\n appTypesPatterns,\n component.state.aspects.ids\n );\n // const fileResolver = this.aspectLoader.pluginFileResolver(component, rootDir);\n\n const plugins = this.aspectLoader.getPluginsFromDefs(component, rootDir, appsPluginDefs);\n let loadedPlugins;\n if (plugins.has()) {\n loadedPlugins = await plugins.load(MainRuntime.name);\n await this.aspectLoader.loadExtensionsByManifests([loadedPlugins], { seeders: [component.id.toString()] });\n }\n\n const listAppsById = this.listAppsById(component.id);\n return listAppsById;\n }\n\n /**\n * get an app.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n getApp(appName: string, id?: ComponentID): Application | undefined {\n const apps = id ? this.listAppsById(id) : this.listApps();\n if (!apps) return undefined;\n return apps.find((app) => app.name === appName);\n }\n\n getAppByNameOrId(appNameOrId: string): Application | undefined {\n const byName = this.getApp(appNameOrId);\n if (byName) return byName;\n const byId = this.appSlot.get(appNameOrId);\n if (!byId || !byId.length) return undefined;\n if (byId.length > 1) {\n throw new BitError(\n `unable to figure out what app to retrieve. the id \"${appNameOrId}\" has more than one app. please use the app-name`\n );\n }\n return byId[0];\n }\n\n getAppPattern(appType: ApplicationType<unknown>) {\n if (appType.globPattern) return appType.globPattern;\n return `*.${appType.name}.*`;\n }\n\n /**\n * registers a new app and sets a plugin for it.\n */\n registerAppType<T>(...appTypes: Array<ApplicationType<T>>) {\n const plugins = appTypes.map((appType) => {\n return new AppTypePlugin(this.getAppPattern(appType), appType, this.appSlot);\n });\n\n this.aspectLoader.registerPlugins(plugins);\n this.appTypeSlot.register(appTypes);\n return this;\n }\n\n /**\n * get an app AspectId.\n */\n getAppAspect(appName: string): string | undefined {\n return this.appSlot.toArray().find(([, apps]) => apps.find((app) => app.name === appName))?.[0];\n }\n\n /**\n * get app to throw.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n getAppOrThrow(appName: string): Application {\n const app = this.getAppByNameOrId(appName);\n if (!app) throw new AppNotFound(appName);\n return app;\n }\n\n defaultOpts: ServeAppOptions = {\n dev: false,\n ssr: false,\n watch: true,\n defaultPortRange: [3100, 3500],\n };\n private computeOptions(opts: Partial<ServeAppOptions> = {}) {\n return {\n ...this.defaultOpts,\n ...opts,\n };\n }\n\n async loadAppsToSlot() {\n const apps = await this.loadApps();\n this.appSlot.register(apps);\n return this;\n }\n\n /**\n * run an app.\n * make sure to call `this.loadAllAppsAsAspects` before calling this method in case the app is not listed in workspace.jsonc\n */\n async runApp(\n appName: string,\n options?: ServeAppOptions\n ): Promise<{\n app: Application;\n port: number | undefined;\n errors?: Error[];\n isOldApi: boolean;\n }> {\n await this.workspace.setComponentPathsRegExps();\n options = this.computeOptions(options);\n const app = this.getAppOrThrow(appName);\n const context = await this.createAppContext(app.name, options.port, options.args);\n if (!context) throw new AppNotFound(appName);\n\n const instance = await app.run(context);\n if (options.watch) {\n this.watcher\n .watch({\n preCompile: false,\n compile: true,\n })\n .catch((err) => {\n // don't throw an error, we don't want to break the \"run\" process\n this.logger.error(`compilation failed`, err);\n });\n }\n\n const isOldApi = typeof instance === 'number';\n const port = isOldApi ? instance : instance?.port;\n\n return { app, port, errors: undefined, isOldApi };\n }\n\n /**\n * get the component ID of a certain app.\n */\n async getAppIdOrThrow(appName: string) {\n const maybeApp = this.appSlot.toArray().find(([, apps]) => {\n return apps.find((app) => app.name === appName);\n });\n\n if (!maybeApp) throw new AppNotFound(appName);\n\n const host = this.componentAspect.getHost();\n return host.resolveComponentId(maybeApp[0]);\n }\n\n private async createAppContext(appName: string, port?: number, args?: string): Promise<AppContext> {\n const host = this.componentAspect.getHost();\n // const components = await host.list();\n const id = await this.getAppIdOrThrow(appName);\n // const component = components.find((c) => c.id.isEqual(id));\n const component = await host.get(id);\n if (!component) throw new AppNotFound(appName);\n\n const env = await this.envs.createEnvironment([component]);\n const res = await env.run(this.appService);\n const context = res.results[0].data;\n if (!context) throw new AppNotFound(appName);\n const hostRootDir = await this.workspace.getComponentPackagePath(component);\n const workspaceComponentDir = this.workspace.componentDir(component.id);\n\n const appContext = new AppContext(\n appName,\n this.harmony,\n context.dev,\n component,\n this.workspace.path,\n context,\n hostRootDir,\n port,\n args,\n workspaceComponentDir\n );\n return appContext;\n }\n\n async createAppBuildContext(id: ComponentID, appName: string, capsuleRootDir: string, rootDir?: string) {\n const host = this.componentAspect.getHost();\n // const components = await host.list();\n // const component = components.find((c) => c.id.isEqual(id));\n const component = await host.get(id);\n if (!component) throw new AppNotFound(appName);\n\n const env = await this.envs.createEnvironment([component]);\n const res = await env.run(this.appService);\n const context = res.results[0].data;\n if (!context) throw new AppNotFound(appName);\n\n const appContext = new AppContext(\n appName,\n this.harmony,\n context.dev,\n component,\n capsuleRootDir,\n context,\n rootDir,\n undefined,\n undefined,\n undefined,\n undefined\n );\n return appContext;\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n LoggerAspect,\n BuilderAspect,\n EnvsAspect,\n ComponentAspect,\n AspectLoaderAspect,\n WorkspaceAspect,\n WatcherAspect,\n ScopeAspect,\n ];\n\n static slots = [\n Slot.withType<ApplicationType<unknown>[]>(),\n Slot.withType<Application[]>(),\n Slot.withType<DeploymentProvider[]>(),\n ];\n\n static async provider(\n [cli, loggerAspect, builder, envs, component, aspectLoader, workspace, watcher, scope]: [\n CLIMain,\n LoggerMain,\n BuilderMain,\n EnvsMain,\n ComponentMain,\n AspectLoaderMain,\n Workspace,\n WatcherMain,\n ScopeMain,\n ],\n config: ApplicationAspectConfig,\n [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot],\n harmony: Harmony\n ) {\n const logger = loggerAspect.createLogger(ApplicationAspect.id);\n const appService = new AppService();\n const application = new ApplicationMain(\n appSlot,\n appTypeSlot,\n deploymentProviderSlot,\n config,\n envs,\n component,\n appService,\n aspectLoader,\n workspace,\n logger,\n watcher,\n harmony\n );\n appService.registerAppType = application.registerAppType.bind(application);\n const appCmd = new AppCmd(application);\n appCmd.commands = [new AppListCmd(application), new RunCmd(application, logger)];\n aspectLoader.registerPlugins([new AppPlugin(appSlot)]);\n builder.registerBuildTasks([new AppsBuildTask(application)]);\n builder.registerSnapTasks([new DeployTask(application, builder)]);\n builder.registerTagTasks([new DeployTask(application, builder)]);\n envs.registerService(appService);\n cli.registerGroup('apps', 'Applications');\n cli.register(new RunCmd(application, logger), appCmd);\n // cli.registerOnStart(async () => {\n // await application.loadAppsToSlot();\n // });\n const calcAppOnLoad = async (loadedComponent): Promise<ApplicationMetadata | undefined> => {\n const app = application.calculateAppByComponent(loadedComponent);\n if (!app) return undefined;\n return {\n appName: app.name,\n type: app.applicationType,\n };\n };\n if (workspace) {\n workspace.registerOnComponentLoad(calcAppOnLoad);\n }\n if (scope) {\n scope.registerOnCompAspectReCalc(calcAppOnLoad);\n }\n\n return application;\n }\n}\n\nApplicationAspect.addRuntime(ApplicationMain);\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAS,OAAA;EAAA,MAAAT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eAAe,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_application@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_application@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_application@1.0.1160/dist/application.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_application@1.0.1160/dist/application.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PluginDefinition } from '@teambit/aspect-loader';
|
|
2
|
+
export type PluginDefsByAspectId = Array<[string, PluginDefinition[]]>;
|
|
3
|
+
/**
|
|
4
|
+
* harmony registers extensions by their full id, including the version. as a result, when two versions of the same
|
|
5
|
+
* aspect are loaded (e.g. a component uses the latest snap of an app-type aspect, while another aspect it depends on
|
|
6
|
+
* is pinned to an older version of it), both providers run and both register the same app-type.
|
|
7
|
+
* the app file then matches both plugin-defs and is registered to the app-slot twice, where the last registration
|
|
8
|
+
* overwrites the previous one (`SlotRegistry.register` sets the value by the registering extension id), so the app
|
|
9
|
+
* could end up being built by an outdated implementation of the app-type.
|
|
10
|
+
*
|
|
11
|
+
* only defs of the same aspect (regardless of its version) with the same pattern compete with each other. defs that
|
|
12
|
+
* were registered by other aspects are always kept, also when they happen to use the same pattern.
|
|
13
|
+
* out of the competing versions, the one that the component itself uses is preferred (its aspect-list is the
|
|
14
|
+
* authoritative source for the component being built), and when none of them is in the component's aspect-list, the
|
|
15
|
+
* first registered one is used.
|
|
16
|
+
*/
|
|
17
|
+
export declare function selectAppsPluginDefs(defsByAspectId: PluginDefsByAspectId, appTypesPatterns: string[], componentAspectIds: string[]): PluginDefinition[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectAppsPluginDefs = selectAppsPluginDefs;
|
|
7
|
+
function _lodash() {
|
|
8
|
+
const data = require("lodash");
|
|
9
|
+
_lodash = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* aspect-ids of loaded extensions are either core-aspect ids, which have no version, or "<scope>/<name>@<version>".
|
|
16
|
+
*/
|
|
17
|
+
function idWithoutVersion(aspectId) {
|
|
18
|
+
const versionSeparatorIndex = aspectId.indexOf('@');
|
|
19
|
+
return versionSeparatorIndex === -1 ? aspectId : aspectId.slice(0, versionSeparatorIndex);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* harmony registers extensions by their full id, including the version. as a result, when two versions of the same
|
|
24
|
+
* aspect are loaded (e.g. a component uses the latest snap of an app-type aspect, while another aspect it depends on
|
|
25
|
+
* is pinned to an older version of it), both providers run and both register the same app-type.
|
|
26
|
+
* the app file then matches both plugin-defs and is registered to the app-slot twice, where the last registration
|
|
27
|
+
* overwrites the previous one (`SlotRegistry.register` sets the value by the registering extension id), so the app
|
|
28
|
+
* could end up being built by an outdated implementation of the app-type.
|
|
29
|
+
*
|
|
30
|
+
* only defs of the same aspect (regardless of its version) with the same pattern compete with each other. defs that
|
|
31
|
+
* were registered by other aspects are always kept, also when they happen to use the same pattern.
|
|
32
|
+
* out of the competing versions, the one that the component itself uses is preferred (its aspect-list is the
|
|
33
|
+
* authoritative source for the component being built), and when none of them is in the component's aspect-list, the
|
|
34
|
+
* first registered one is used.
|
|
35
|
+
*/
|
|
36
|
+
function selectAppsPluginDefs(defsByAspectId, appTypesPatterns, componentAspectIds) {
|
|
37
|
+
const selected = new Map();
|
|
38
|
+
defsByAspectId.forEach(([aspectId, defs]) => {
|
|
39
|
+
const appDefs = defs.filter(def => appTypesPatterns.includes(def.pattern.toString()));
|
|
40
|
+
if (!appDefs.length) return;
|
|
41
|
+
const usedByComponent = componentAspectIds.includes(aspectId);
|
|
42
|
+
const defsPerPattern = (0, _lodash().groupBy)(appDefs, def => def.pattern.toString());
|
|
43
|
+
Object.entries(defsPerPattern).forEach(([pattern, patternDefs]) => {
|
|
44
|
+
const key = `${idWithoutVersion(aspectId)}::${pattern}`;
|
|
45
|
+
const alreadySelected = selected.get(key);
|
|
46
|
+
if (alreadySelected && (alreadySelected.usedByComponent || !usedByComponent)) return;
|
|
47
|
+
selected.set(key, {
|
|
48
|
+
defs: patternDefs,
|
|
49
|
+
usedByComponent
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return Array.from(selected.values()).flatMap(({
|
|
54
|
+
defs
|
|
55
|
+
}) => defs);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=select-apps-plugin-defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","idWithoutVersion","aspectId","versionSeparatorIndex","indexOf","slice","selectAppsPluginDefs","defsByAspectId","appTypesPatterns","componentAspectIds","selected","Map","forEach","defs","appDefs","filter","def","includes","pattern","toString","length","usedByComponent","defsPerPattern","groupBy","Object","entries","patternDefs","key","alreadySelected","get","set","Array","from","values","flatMap"],"sources":["select-apps-plugin-defs.ts"],"sourcesContent":["import { groupBy } from 'lodash';\nimport type { PluginDefinition } from '@teambit/aspect-loader';\n\nexport type PluginDefsByAspectId = Array<[string, PluginDefinition[]]>;\n\n/**\n * aspect-ids of loaded extensions are either core-aspect ids, which have no version, or \"<scope>/<name>@<version>\".\n */\nfunction idWithoutVersion(aspectId: string): string {\n const versionSeparatorIndex = aspectId.indexOf('@');\n return versionSeparatorIndex === -1 ? aspectId : aspectId.slice(0, versionSeparatorIndex);\n}\n\n/**\n * harmony registers extensions by their full id, including the version. as a result, when two versions of the same\n * aspect are loaded (e.g. a component uses the latest snap of an app-type aspect, while another aspect it depends on\n * is pinned to an older version of it), both providers run and both register the same app-type.\n * the app file then matches both plugin-defs and is registered to the app-slot twice, where the last registration\n * overwrites the previous one (`SlotRegistry.register` sets the value by the registering extension id), so the app\n * could end up being built by an outdated implementation of the app-type.\n *\n * only defs of the same aspect (regardless of its version) with the same pattern compete with each other. defs that\n * were registered by other aspects are always kept, also when they happen to use the same pattern.\n * out of the competing versions, the one that the component itself uses is preferred (its aspect-list is the\n * authoritative source for the component being built), and when none of them is in the component's aspect-list, the\n * first registered one is used.\n */\nexport function selectAppsPluginDefs(\n defsByAspectId: PluginDefsByAspectId,\n appTypesPatterns: string[],\n componentAspectIds: string[]\n): PluginDefinition[] {\n const selected = new Map<string, { defs: PluginDefinition[]; usedByComponent: boolean }>();\n defsByAspectId.forEach(([aspectId, defs]) => {\n const appDefs = defs.filter((def) => appTypesPatterns.includes(def.pattern.toString()));\n if (!appDefs.length) return;\n const usedByComponent = componentAspectIds.includes(aspectId);\n const defsPerPattern = groupBy(appDefs, (def) => def.pattern.toString());\n Object.entries(defsPerPattern).forEach(([pattern, patternDefs]) => {\n const key = `${idWithoutVersion(aspectId)}::${pattern}`;\n const alreadySelected = selected.get(key);\n if (alreadySelected && (alreadySelected.usedByComponent || !usedByComponent)) return;\n selected.set(key, { defs: patternDefs, usedByComponent });\n });\n });\n return Array.from(selected.values()).flatMap(({ defs }) => defs);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA;AACA;AACA;AACA,SAASE,gBAAgBA,CAACC,QAAgB,EAAU;EAClD,MAAMC,qBAAqB,GAAGD,QAAQ,CAACE,OAAO,CAAC,GAAG,CAAC;EACnD,OAAOD,qBAAqB,K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U,KAAK,CAACC,IAAI,CAACtB,QAAQ,CAACuB,MAAM,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;IAAErB;EAAK,CAAC,KAAKA,IAAI,CAAC;AAClE","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _selectAppsPluginDefs() {
|
|
11
|
+
const data = require("./select-apps-plugin-defs");
|
|
12
|
+
_selectAppsPluginDefs = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function pluginDef(pattern) {
|
|
18
|
+
return {
|
|
19
|
+
pattern,
|
|
20
|
+
runtimes: ['main'],
|
|
21
|
+
register: () => {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const APP_TYPE_PATTERN = '*.my-app-type.*';
|
|
25
|
+
const OTHER_APP_TYPE_PATTERN = '*.other-app-type.*';
|
|
26
|
+
const LANE_SNAP_ASPECT_ID = 'my-scope/app-type-aspect@abcd1234';
|
|
27
|
+
const RELEASED_ASPECT_ID = 'my-scope/app-type-aspect@0.0.243';
|
|
28
|
+
describe('selectAppsPluginDefs', () => {
|
|
29
|
+
it('should return the def when a single aspect registered the pattern', () => {
|
|
30
|
+
const def = pluginDef(APP_TYPE_PATTERN);
|
|
31
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [def]]];
|
|
32
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
33
|
+
(0, _chai().expect)(result).to.deep.equal([def]);
|
|
34
|
+
});
|
|
35
|
+
it('should filter out defs whose pattern is not an app-type pattern', () => {
|
|
36
|
+
const appDef = pluginDef(APP_TYPE_PATTERN);
|
|
37
|
+
const nonAppDef = pluginDef('*.some-other-plugin.*');
|
|
38
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [appDef, nonAppDef]]];
|
|
39
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], []);
|
|
40
|
+
(0, _chai().expect)(result).to.deep.equal([appDef]);
|
|
41
|
+
});
|
|
42
|
+
it('should return one def per pattern when two versions of the same aspect registered it', () => {
|
|
43
|
+
const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);
|
|
44
|
+
const fromReleased = pluginDef(APP_TYPE_PATTERN);
|
|
45
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [fromLaneSnap]], [RELEASED_ASPECT_ID, [fromReleased]]];
|
|
46
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
47
|
+
(0, _chai().expect)(result).to.have.lengthOf(1);
|
|
48
|
+
(0, _chai().expect)(result[0]).to.equal(fromLaneSnap);
|
|
49
|
+
});
|
|
50
|
+
it('should prefer the version used by the component even when it was registered last', () => {
|
|
51
|
+
const fromReleased = pluginDef(APP_TYPE_PATTERN);
|
|
52
|
+
const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);
|
|
53
|
+
const defsByAspectId = [[RELEASED_ASPECT_ID, [fromReleased]], [LANE_SNAP_ASPECT_ID, [fromLaneSnap]]];
|
|
54
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
55
|
+
(0, _chai().expect)(result[0]).to.equal(fromLaneSnap);
|
|
56
|
+
});
|
|
57
|
+
it('should fallback to the first registered def when no version is in the component aspect-list', () => {
|
|
58
|
+
const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);
|
|
59
|
+
const fromReleased = pluginDef(APP_TYPE_PATTERN);
|
|
60
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [fromLaneSnap]], [RELEASED_ASPECT_ID, [fromReleased]]];
|
|
61
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], ['my-scope/unrelated@1.0.0']);
|
|
62
|
+
(0, _chai().expect)(result[0]).to.equal(fromLaneSnap);
|
|
63
|
+
});
|
|
64
|
+
it('should keep defs of different patterns', () => {
|
|
65
|
+
const appDef = pluginDef(APP_TYPE_PATTERN);
|
|
66
|
+
const otherAppDef = pluginDef(OTHER_APP_TYPE_PATTERN);
|
|
67
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [appDef]], ['my-scope/another-aspect@1.0.0', [otherAppDef]]];
|
|
68
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN, OTHER_APP_TYPE_PATTERN], []);
|
|
69
|
+
(0, _chai().expect)(result).to.have.lengthOf(2);
|
|
70
|
+
});
|
|
71
|
+
it('should keep all defs of the selected aspect-version when it registered the pattern more than once', () => {
|
|
72
|
+
const first = pluginDef(APP_TYPE_PATTERN);
|
|
73
|
+
const second = pluginDef(APP_TYPE_PATTERN);
|
|
74
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [first, second]]];
|
|
75
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
76
|
+
(0, _chai().expect)(result).to.deep.equal([first, second]);
|
|
77
|
+
});
|
|
78
|
+
it('should keep defs of different aspects that share the same pattern', () => {
|
|
79
|
+
const fromOneAspect = pluginDef(APP_TYPE_PATTERN);
|
|
80
|
+
const fromAnotherAspect = pluginDef(APP_TYPE_PATTERN);
|
|
81
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [fromOneAspect]], ['my-scope/another-aspect@1.0.0', [fromAnotherAspect]]];
|
|
82
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
83
|
+
(0, _chai().expect)(result).to.deep.equal([fromOneAspect, fromAnotherAspect]);
|
|
84
|
+
});
|
|
85
|
+
it('should keep all defs of an aspect-version that registered several app-types', () => {
|
|
86
|
+
const appDef = pluginDef(APP_TYPE_PATTERN);
|
|
87
|
+
const otherAppDef = pluginDef(OTHER_APP_TYPE_PATTERN);
|
|
88
|
+
const defsByAspectId = [[LANE_SNAP_ASPECT_ID, [appDef, otherAppDef]], [RELEASED_ASPECT_ID, [pluginDef(APP_TYPE_PATTERN), pluginDef(OTHER_APP_TYPE_PATTERN)]]];
|
|
89
|
+
const result = (0, _selectAppsPluginDefs().selectAppsPluginDefs)(defsByAspectId, [APP_TYPE_PATTERN, OTHER_APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);
|
|
90
|
+
(0, _chai().expect)(result).to.deep.equal([appDef, otherAppDef]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=select-apps-plugin-defs.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_selectAppsPluginDefs","pluginDef","pattern","runtimes","register","APP_TYPE_PATTERN","OTHER_APP_TYPE_PATTERN","LANE_SNAP_ASPECT_ID","RELEASED_ASPECT_ID","describe","it","def","defsByAspectId","result","selectAppsPluginDefs","expect","to","deep","equal","appDef","nonAppDef","fromLaneSnap","fromReleased","have","lengthOf","otherAppDef","first","second","fromOneAspect","fromAnotherAspect"],"sources":["select-apps-plugin-defs.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport type { PluginDefinition } from '@teambit/aspect-loader';\nimport type { PluginDefsByAspectId } from './select-apps-plugin-defs';\nimport { selectAppsPluginDefs } from './select-apps-plugin-defs';\n\nfunction pluginDef(pattern: string): PluginDefinition {\n return { pattern, runtimes: ['main'], register: () => {} } as unknown as PluginDefinition;\n}\n\nconst APP_TYPE_PATTERN = '*.my-app-type.*';\nconst OTHER_APP_TYPE_PATTERN = '*.other-app-type.*';\nconst LANE_SNAP_ASPECT_ID = 'my-scope/app-type-aspect@abcd1234';\nconst RELEASED_ASPECT_ID = 'my-scope/app-type-aspect@0.0.243';\n\ndescribe('selectAppsPluginDefs', () => {\n it('should return the def when a single aspect registered the pattern', () => {\n const def = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [[LANE_SNAP_ASPECT_ID, [def]]];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);\n expect(result).to.deep.equal([def]);\n });\n it('should filter out defs whose pattern is not an app-type pattern', () => {\n const appDef = pluginDef(APP_TYPE_PATTERN);\n const nonAppDef = pluginDef('*.some-other-plugin.*');\n const defsByAspectId: PluginDefsByAspectId = [[LANE_SNAP_ASPECT_ID, [appDef, nonAppDef]]];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], []);\n expect(result).to.deep.equal([appDef]);\n });\n it('should return one def per pattern when two versions of the same aspect registered it', () => {\n const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);\n const fromReleased = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [LANE_SNAP_ASPECT_ID, [fromLaneSnap]],\n [RELEASED_ASPECT_ID, [fromReleased]],\n ];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);\n expect(result).to.have.lengthOf(1);\n expect(result[0]).to.equal(fromLaneSnap);\n });\n it('should prefer the version used by the component even when it was registered last', () => {\n const fromReleased = pluginDef(APP_TYPE_PATTERN);\n const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [RELEASED_ASPECT_ID, [fromReleased]],\n [LANE_SNAP_ASPECT_ID, [fromLaneSnap]],\n ];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);\n expect(result[0]).to.equal(fromLaneSnap);\n });\n it('should fallback to the first registered def when no version is in the component aspect-list', () => {\n const fromLaneSnap = pluginDef(APP_TYPE_PATTERN);\n const fromReleased = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [LANE_SNAP_ASPECT_ID, [fromLaneSnap]],\n [RELEASED_ASPECT_ID, [fromReleased]],\n ];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], ['my-scope/unrelated@1.0.0']);\n expect(result[0]).to.equal(fromLaneSnap);\n });\n it('should keep defs of different patterns', () => {\n const appDef = pluginDef(APP_TYPE_PATTERN);\n const otherAppDef = pluginDef(OTHER_APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [LANE_SNAP_ASPECT_ID, [appDef]],\n ['my-scope/another-aspect@1.0.0', [otherAppDef]],\n ];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN, OTHER_APP_TYPE_PATTERN], []);\n expect(result).to.have.lengthOf(2);\n });\n it('should keep all defs of the selected aspect-version when it registered the pattern more than once', () => {\n const first = pluginDef(APP_TYPE_PATTERN);\n const second = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [[LANE_SNAP_ASPECT_ID, [first, second]]];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);\n expect(result).to.deep.equal([first, second]);\n });\n it('should keep defs of different aspects that share the same pattern', () => {\n const fromOneAspect = pluginDef(APP_TYPE_PATTERN);\n const fromAnotherAspect = pluginDef(APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [LANE_SNAP_ASPECT_ID, [fromOneAspect]],\n ['my-scope/another-aspect@1.0.0', [fromAnotherAspect]],\n ];\n const result = selectAppsPluginDefs(defsByAspectId, [APP_TYPE_PATTERN], [LANE_SNAP_ASPECT_ID]);\n expect(result).to.deep.equal([fromOneAspect, fromAnotherAspect]);\n });\n it('should keep all defs of an aspect-version that registered several app-types', () => {\n const appDef = pluginDef(APP_TYPE_PATTERN);\n const otherAppDef = pluginDef(OTHER_APP_TYPE_PATTERN);\n const defsByAspectId: PluginDefsByAspectId = [\n [LANE_SNAP_ASPECT_ID, [appDef, otherAppDef]],\n [RELEASED_ASPECT_ID, [pluginDef(APP_TYPE_PATTERN), pluginDef(OTHER_APP_TYPE_PATTERN)]],\n ];\n const result = selectAppsPluginDefs(\n defsByAspectId,\n [APP_TYPE_PATTERN, OTHER_APP_TYPE_PATTERN],\n [LANE_SNAP_ASPECT_ID]\n );\n expect(result).to.deep.equal([appDef, otherAppDef]);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,sBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,qBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAASG,SAASA,CAACC,OAAe,EAAoB;EACpD,OAAO;IAAEA,OAAO;IAAEC,QAAQ,EAAE,CAAC,MAAM,CAAC;IAAEC,QAAQ,EAAEA,CAAA,KAAM,CAAC;EAAE,CAAC;AAC5D;AAEA,MAAMC,gBAAgB,GAAG,iBAAiB;AAC1C,MAAMC,sBAAsB,GAAG,oBAAoB;AACnD,MAAMC,mBAAmB,GAAG,mCAAmC;AAC/D,MAAMC,kBAAkB,GAAG,kCAAkC;AAE7DC,QAAQ,CAAC,sBAAsB,EAAE,MAAM;EACrCC,EAAE,CAAC,mEAAmE,EAAE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AACqB,aAAa,CAAC,CAAC,EACtC,CAAC,+BAA+B,EAAE,CAACC,iBAAiB,CAAC,CAAC,CACvD;IACD,MAAMhB,MAAM,GAAG,IAAAC,4CAAoB,EAACF,cAAc,EAAE,CAACP,gBAAgB,CAAC,EAAE,CAACE,mBAAmB,CAAC,CAAC;IAC9F,IAAAQ,cAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,CAACU,aAAa,EAAEC,iBAAiB,CAAC,CAAC;EAClE,CAAC,CAAC;EACFnB,EAAE,CAAC,6EAA6E,EAAE,MAAM;IACtF,MAAMS,MAAM,GAAGlB,SAAS,CAACI,gBAAgB,CAAC;IAC1C,MAAMoB,WAAW,GAAGxB,SAAS,CAACK,sBAAsB,CAAC;IACrD,MAAMM,cAAoC,GAAG,CAC3C,CAACL,mBAAmB,EAAE,CAACY,MAAM,EAAEM,WAAW,CAAC,CAAC,EAC5C,CAACjB,kBAAkB,EAAE,CAACP,SAAS,CAACI,gBAAgB,CAAC,EAAEJ,SAAS,CAACK,sBAAsB,CAAC,CAAC,CAAC,CACvF;IACD,MAAMO,MAAM,GAAG,IAAAC,4CAAoB,EACjCF,cAAc,EACd,CAACP,gBAAgB,EAAEC,sBAAsB,CAAC,EAC1C,CAACC,mBAAmB,CACtB,CAAC;IACD,IAAAQ,cAAM,EAACF,MAAM,CAAC,CAACG,EAAE,CAACC,IAAI,CAACC,KAAK,CAAC,CAACC,MAAM,EAAEM,WAAW,CAAC,CAAC;EACrD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/application",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1160",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "application",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1160"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"@teambit/bit-error": "0.0.404",
|
|
20
20
|
"@teambit/cli": "0.0.1389",
|
|
21
21
|
"@teambit/cli-table": "0.0.63",
|
|
22
|
-
"@teambit/builder": "1.0.
|
|
23
|
-
"@teambit/component": "1.0.
|
|
24
|
-
"@teambit/isolator": "1.0.
|
|
25
|
-
"@teambit/envs": "1.0.
|
|
26
|
-
"@teambit/aspect-loader": "1.0.
|
|
27
|
-
"@teambit/scope": "1.0.
|
|
28
|
-
"@teambit/watcher": "1.0.
|
|
29
|
-
"@teambit/workspace": "1.0.
|
|
22
|
+
"@teambit/builder": "1.0.1160",
|
|
23
|
+
"@teambit/component": "1.0.1160",
|
|
24
|
+
"@teambit/isolator": "1.0.1160",
|
|
25
|
+
"@teambit/envs": "1.0.1160",
|
|
26
|
+
"@teambit/aspect-loader": "1.0.1160",
|
|
27
|
+
"@teambit/scope": "1.0.1160",
|
|
28
|
+
"@teambit/watcher": "1.0.1160",
|
|
29
|
+
"@teambit/workspace": "1.0.1160"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/lodash": "4.14.165",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"@teambit/harmony.envs.core-aspect-env": "2.1.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
37
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
38
|
+
"chai": "5.2.1"
|
|
38
39
|
},
|
|
39
40
|
"license": "Apache-2.0",
|
|
40
41
|
"optionalDependencies": {},
|