@teambit/application 0.0.630 → 0.0.632
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/app-type-list.d.ts +2 -2
- package/dist/app-type-list.js.map +1 -1
- package/dist/application.main.runtime.d.ts +6 -3
- package/dist/application.main.runtime.js +13 -5
- package/dist/application.main.runtime.js.map +1 -1
- package/dist/application.service.js.map +1 -1
- package/dist/apps-env-type.d.ts +2 -2
- package/dist/apps-env-type.js.map +1 -1
- package/dist/{preview-1676604673087.js → preview-1676811569495.js} +2 -2
- package/package-tar/teambit-application-0.0.632.tgz +0 -0
- package/package.json +12 -11
- package/package-tar/teambit-application-0.0.630.tgz +0 -0
package/dist/app-type-list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EnvContext, EnvHandler } from
|
|
2
|
-
import { ApplicationType } from
|
|
1
|
+
import { EnvContext, EnvHandler } from '@teambit/envs';
|
|
2
|
+
import { ApplicationType } from './application-type';
|
|
3
3
|
export declare type AppTypeListOptions = {
|
|
4
4
|
name?: string;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AppTypeList","constructor","name","appTypes","context","compute","map","appType","from","options"],"sources":["app-type-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from
|
|
1
|
+
{"version":3,"names":["AppTypeList","constructor","name","appTypes","context","compute","map","appType","from","options"],"sources":["app-type-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from '@teambit/envs';\nimport { ApplicationType } from './application-type';\n\nexport type AppTypeListOptions = {\n name?: string;\n};\n\nexport class AppTypeList {\n constructor(\n readonly name: string,\n private appTypes: EnvHandler<ApplicationType<any>>[],\n private context: EnvContext\n ) {}\n\n compute(): ApplicationType<any>[] {\n return this.appTypes.map((appType) => appType(this.context));\n }\n\n static from(appTypes: EnvHandler<ApplicationType<any>>[], options: AppTypeListOptions = {}): EnvHandler<AppTypeList> {\n return (context: EnvContext) => {\n const name = options.name || 'app-type-list';\n return new AppTypeList(name, appTypes, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,WAAW,CAAC;EACvBC,WAAW,CACAC,IAAY,EACbC,QAA4C,EAC5CC,OAAmB,EAC3B;IAAA,KAHSF,IAAY,GAAZA,IAAY;IAAA,KACbC,QAA4C,GAA5CA,QAA4C;IAAA,KAC5CC,OAAmB,GAAnBA,OAAmB;EAC1B;EAEHC,OAAO,GAA2B;IAChC,OAAO,IAAI,CAACF,QAAQ,CAACG,GAAG,CAAEC,OAAO,IAAKA,OAAO,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EAC9D;EAEA,OAAOI,IAAI,CAACL,QAA4C,EAAEM,OAA2B,GAAG,CAAC,CAAC,EAA2B;IACnH,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,eAAe;MAC5C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACjD,CAAC;EACH;AACF;AAAC"}
|
|
@@ -2,6 +2,7 @@ import { CLIMain } from '@teambit/cli';
|
|
|
2
2
|
import { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
3
3
|
import { SlotRegistry } from '@teambit/harmony';
|
|
4
4
|
import { Workspace } from '@teambit/workspace';
|
|
5
|
+
import { WatcherMain } from '@teambit/watcher';
|
|
5
6
|
import { BuilderMain } from '@teambit/builder';
|
|
6
7
|
import { Logger, LoggerMain } from '@teambit/logger';
|
|
7
8
|
import { EnvsMain } from '@teambit/envs';
|
|
@@ -57,7 +58,8 @@ export declare class ApplicationMain {
|
|
|
57
58
|
private aspectLoader;
|
|
58
59
|
private workspace;
|
|
59
60
|
private logger;
|
|
60
|
-
|
|
61
|
+
private watcher;
|
|
62
|
+
constructor(appSlot: ApplicationSlot, appTypeSlot: ApplicationTypeSlot, deploymentProviderSlot: DeploymentProviderSlot, config: ApplicationAspectConfig, envs: EnvsMain, componentAspect: ComponentMain, appService: AppService, aspectLoader: AspectLoaderMain, workspace: Workspace, logger: Logger, watcher: WatcherMain);
|
|
61
63
|
/**
|
|
62
64
|
* register a new app.
|
|
63
65
|
*/
|
|
@@ -125,13 +127,14 @@ export declare class ApplicationMain {
|
|
|
125
127
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
126
128
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
127
129
|
static slots: (((registerFn: () => string) => SlotRegistry<ApplicationType<unknown>[]>) | ((registerFn: () => string) => SlotRegistry<Application[]>) | ((registerFn: () => string) => SlotRegistry<DeploymentProvider[]>))[];
|
|
128
|
-
static provider([cli, loggerAspect, builder, envs, component, aspectLoader, workspace]: [
|
|
130
|
+
static provider([cli, loggerAspect, builder, envs, component, aspectLoader, workspace, watcher]: [
|
|
129
131
|
CLIMain,
|
|
130
132
|
LoggerMain,
|
|
131
133
|
BuilderMain,
|
|
132
134
|
EnvsMain,
|
|
133
135
|
ComponentMain,
|
|
134
136
|
AspectLoaderMain,
|
|
135
|
-
Workspace
|
|
137
|
+
Workspace,
|
|
138
|
+
WatcherMain
|
|
136
139
|
], config: ApplicationAspectConfig, [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot]): Promise<ApplicationMain>;
|
|
137
140
|
}
|
|
@@ -58,6 +58,13 @@ function _bitError() {
|
|
|
58
58
|
};
|
|
59
59
|
return data;
|
|
60
60
|
}
|
|
61
|
+
function _watcher() {
|
|
62
|
+
const data = _interopRequireDefault(require("@teambit/watcher"));
|
|
63
|
+
_watcher = function () {
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
61
68
|
function _builder() {
|
|
62
69
|
const data = require("@teambit/builder");
|
|
63
70
|
_builder = function () {
|
|
@@ -177,7 +184,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
177
184
|
class ApplicationMain {
|
|
178
185
|
constructor(appSlot,
|
|
179
186
|
// TODO unused
|
|
180
|
-
appTypeSlot, deploymentProviderSlot, config, envs, componentAspect, appService, aspectLoader, workspace, logger) {
|
|
187
|
+
appTypeSlot, deploymentProviderSlot, config, envs, componentAspect, appService, aspectLoader, workspace, logger, watcher) {
|
|
181
188
|
this.appSlot = appSlot;
|
|
182
189
|
this.appTypeSlot = appTypeSlot;
|
|
183
190
|
this.deploymentProviderSlot = deploymentProviderSlot;
|
|
@@ -188,6 +195,7 @@ class ApplicationMain {
|
|
|
188
195
|
this.aspectLoader = aspectLoader;
|
|
189
196
|
this.workspace = workspace;
|
|
190
197
|
this.logger = logger;
|
|
198
|
+
this.watcher = watcher;
|
|
191
199
|
(0, _defineProperty2().default)(this, "defaultOpts", {
|
|
192
200
|
dev: false,
|
|
193
201
|
ssr: false,
|
|
@@ -357,7 +365,7 @@ class ApplicationMain {
|
|
|
357
365
|
}
|
|
358
366
|
const port = await app.run(context);
|
|
359
367
|
if (options.watch) {
|
|
360
|
-
this.
|
|
368
|
+
this.watcher.watch({
|
|
361
369
|
preCompile: false
|
|
362
370
|
}).catch(err => {
|
|
363
371
|
// don't throw an error, we don't want to break the "run" process
|
|
@@ -395,10 +403,10 @@ class ApplicationMain {
|
|
|
395
403
|
const appContext = new (_appContext().AppContext)(appName, context.dev, component, this.workspace.path, context, hostRootDir);
|
|
396
404
|
return appContext;
|
|
397
405
|
}
|
|
398
|
-
static async provider([cli, loggerAspect, builder, envs, component, aspectLoader, workspace], config, [appTypeSlot, appSlot, deploymentProviderSlot]) {
|
|
406
|
+
static async provider([cli, loggerAspect, builder, envs, component, aspectLoader, workspace, watcher], config, [appTypeSlot, appSlot, deploymentProviderSlot]) {
|
|
399
407
|
const logger = loggerAspect.createLogger(_application().ApplicationAspect.id);
|
|
400
408
|
const appService = new (_application2().AppService)();
|
|
401
|
-
const application = new ApplicationMain(appSlot, appTypeSlot, deploymentProviderSlot, config, envs, component, appService, aspectLoader, workspace, logger);
|
|
409
|
+
const application = new ApplicationMain(appSlot, appTypeSlot, deploymentProviderSlot, config, envs, component, appService, aspectLoader, workspace, logger, watcher);
|
|
402
410
|
appService.registerAppType = application.registerAppType.bind(application);
|
|
403
411
|
const appCmd = new (_app().AppCmd)();
|
|
404
412
|
appCmd.commands = [new (_app().AppListCmd)(application), new (_run().RunCmd)(application, logger)];
|
|
@@ -427,7 +435,7 @@ class ApplicationMain {
|
|
|
427
435
|
}
|
|
428
436
|
exports.ApplicationMain = ApplicationMain;
|
|
429
437
|
(0, _defineProperty2().default)(ApplicationMain, "runtime", _cli().MainRuntime);
|
|
430
|
-
(0, _defineProperty2().default)(ApplicationMain, "dependencies", [_cli().CLIAspect, _logger().LoggerAspect, _builder().BuilderAspect, _envs().EnvsAspect, _component().default, _aspectLoader().AspectLoaderAspect, _workspace().default]);
|
|
438
|
+
(0, _defineProperty2().default)(ApplicationMain, "dependencies", [_cli().CLIAspect, _logger().LoggerAspect, _builder().BuilderAspect, _envs().EnvsAspect, _component().default, _aspectLoader().AspectLoaderAspect, _workspace().default, _watcher().default]);
|
|
431
439
|
(0, _defineProperty2().default)(ApplicationMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
432
440
|
_application().ApplicationAspect.addRuntime(ApplicationMain);
|
|
433
441
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ApplicationMain","constructor","appSlot","appTypeSlot","deploymentProviderSlot","config","envs","componentAspect","appService","aspectLoader","workspace","logger","dev","ssr","watch","defaultPortRange","registerApp","app","register","listApps","flatten","values","mapApps","toArray","listAppsById","id","undefined","get","toString","getAppById","apps","head","calculateAppByComponent","component","listAppTypes","listAppsFromComponents","components","getHost","list","appTypesPatterns","getAppPatterns","filter","files","filesystem","byGlob","length","appTypes","map","appType","getAppPattern","loadApps","pluginsToLoad","flatMap","appComponent","file","path","appManifests","compact","pluginPath","appManifest","require","default","err","error","getApp","appName","find","name","getAppByNameOrId","appNameOrId","byName","byId","BitError","globPattern","registerAppType","plugin","AppTypePlugin","registerPlugins","getAppAspect","getAppOrThrow","AppNotFound","computeOptions","opts","defaultOpts","loadAppsToSlot","runApp","options","context","createAppContext","runSsr","AppNoSsr","result","port","run","watcher","watchAll","preCompile","catch","errors","getAppIdOrThrow","maybeApp","ComponentID","fromString","host","c","isEqual","env","createEnvironment","res","results","data","hostRootDir","getComponentPackagePath","appContext","AppContext","provider","cli","loggerAspect","builder","createLogger","ApplicationAspect","AppService","application","bind","appCmd","AppCmd","commands","AppListCmd","RunCmd","AppPlugin","registerBuildTasks","AppsBuildTask","registerSnapTasks","DeployTask","registerTagTasks","registerService","registerGroup","AppListCmdDeprecated","onComponentLoad","loadedComponent","type","applicationType","MainRuntime","CLIAspect","LoggerAspect","BuilderAspect","EnvsAspect","ComponentAspect","AspectLoaderAspect","WorkspaceAspect","Slot","withType","addRuntime"],"sources":["application.main.runtime.ts"],"sourcesContent":["import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli';\nimport { compact, flatten, head } from 'lodash';\nimport { AspectLoaderMain, AspectLoaderAspect } from '@teambit/aspect-loader';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport ComponentAspect, { ComponentMain, ComponentID, Component } from '@teambit/component';\nimport { ApplicationType } from './application-type';\nimport { Application } from './application';\nimport { DeploymentProvider } from './deployment-provider';\nimport { AppNotFound } from './exceptions';\nimport { ApplicationAspect } from './application.aspect';\nimport { AppListCmdDeprecated } from './app-list.cmd';\nimport { AppsBuildTask } from './build.task';\nimport { RunCmd } from './run.cmd';\nimport { AppService } from './application.service';\nimport { AppCmd, AppListCmd } from './app.cmd';\nimport { AppPlugin } from './app.plugin';\nimport { AppTypePlugin } from './app-type.plugin';\nimport { AppContext } from './app-context';\nimport { DeployTask } from './deploy.task';\nimport { AppNoSsr } from './exceptions/app-no-ssr';\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\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 ) {}\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 /**\n * map all apps by component ID.\n */\n mapApps() {\n return this.appSlot.toArray();\n }\n\n /**\n * list apps by a component id.\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 */\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 async listAppsFromComponents() {\n const components = await this.componentAspect.getHost().list();\n const appTypesPatterns = this.getAppPatterns();\n const apps = components.filter((component) => {\n // has app plugin from registered types.\n const files = component.filesystem.byGlob(appTypesPatterns);\n return !!files.length;\n });\n\n return apps;\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;\n }\n\n async loadApps(): Promise<Application[]> {\n const apps = await this.listAppsFromComponents();\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 // const app = require(appPath);\n const appManifests = compact(pluginsToLoad.map((pluginPath) => {\n try {\n // eslint-disable-next-line\n const appManifest = require(pluginPath)?.default;\n return appManifest;\n } catch (err) {\n this.logger.error(`failed loading app manifest: ${pluginPath}`);\n return undefined;\n }\n }));\n \n return appManifests;\n }\n\n /**\n * get an app.\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>(appType: ApplicationType<T>) {\n const plugin = new AppTypePlugin(this.getAppPattern(appType), appType, this.appSlot);\n this.aspectLoader.registerPlugins([plugin]);\n this.appTypeSlot.register([appType]);\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 */\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 async runApp(appName: string, options?: ServeAppOptions) {\n options = this.computeOptions(options);\n const app = this.getAppOrThrow(appName);\n const context = await this.createAppContext(app.name);\n if (!context) throw new AppNotFound(appName);\n\n if (options.ssr) {\n if (!app.runSsr) throw new AppNoSsr(appName);\n\n const result = await app.runSsr(context);\n return { app, ...result };\n }\n\n const port = await app.run(context);\n if (options.watch) {\n this.workspace.watcher\n .watchAll({\n preCompile: false,\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 return { app, port, errors: undefined };\n }\n\n /**\n * get the component ID of a certain app.\n */\n 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 return ComponentID.fromString(maybeApp[0]);\n }\n\n private async createAppContext(appName: string): Promise<AppContext> {\n const host = this.componentAspect.getHost();\n const components = await host.list();\n const id = this.getAppIdOrThrow(appName);\n const component = components.find((c) => c.id.isEqual(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 = this.workspace.getComponentPackagePath(component);\n const appContext = new AppContext(appName, context.dev, component, this.workspace.path, context, hostRootDir);\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 ];\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]: [\n CLIMain,\n LoggerMain,\n BuilderMain,\n EnvsMain,\n ComponentMain,\n AspectLoaderMain,\n Workspace\n ],\n config: ApplicationAspectConfig,\n [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot]\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 );\n appService.registerAppType = application.registerAppType.bind(application);\n const appCmd = new AppCmd();\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), new AppListCmdDeprecated(application), appCmd);\n // cli.registerOnStart(async () => {\n // await application.loadAppsToSlot();\n // });\n if (workspace) {\n workspace.onComponentLoad(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 }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CAAC,CAAC;IAChEhH,IAAI,CAACiI,eAAe,CAAC/H,UAAU,CAAC;IAChC4G,GAAG,CAACoB,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC;IACzCpB,GAAG,CAAClG,QAAQ,CAAC,KAAI8G,aAAM,EAACN,WAAW,EAAE/G,MAAM,CAAC,EAAE,KAAI8H,+BAAoB,EAACf,WAAW,CAAC,EAAEE,MAAM,CAAC;IAC5F;IACA;IACA;IACA,IAAIlH,SAAS,EAAE;MACbA,SAAS,CAACgI,eAAe,CAAC,MAAOC,eAAe,IAA+C;QAC7F,MAAM1H,GAAG,GAAGyG,WAAW,CAAC1F,uBAAuB,CAAC2G,eAAe,CAAC;QAChE,IAAI,CAAC1H,GAAG,EAAE,OAAOS,SAAS;QAC1B,OAAO;UACLuC,OAAO,EAAEhD,GAAG,CAACkD,IAAI;UACjByE,IAAI,EAAE3H,GAAG,CAAC4H;QACZ,CAAC;MACH,CAAC,CAAC;IACJ;IAEA,OAAOnB,WAAW;EACpB;AACF;AAAC;AAAA,gCArTY1H,eAAe,aA+OT8I,kBAAW;AAAA,gCA/OjB9I,eAAe,kBAgPJ,CACpB+I,gBAAS,EACTC,sBAAY,EACZC,wBAAa,EACbC,kBAAU,EACVC,oBAAe,EACfC,kCAAkB,EAClBC,oBAAe,CAChB;AAAA,gCAxPUrJ,eAAe,WA0PX,CACbsJ,eAAI,CAACC,QAAQ,EAA8B,EAC3CD,eAAI,CAACC,QAAQ,EAAiB,EAC9BD,eAAI,CAACC,QAAQ,EAAwB,CACtC;AAyDH/B,gCAAiB,CAACgC,UAAU,CAACxJ,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"names":["ApplicationMain","constructor","appSlot","appTypeSlot","deploymentProviderSlot","config","envs","componentAspect","appService","aspectLoader","workspace","logger","watcher","dev","ssr","watch","defaultPortRange","registerApp","app","register","listApps","flatten","values","mapApps","toArray","listAppsById","id","undefined","get","toString","getAppById","apps","head","calculateAppByComponent","component","listAppTypes","listAppsFromComponents","components","getHost","list","appTypesPatterns","getAppPatterns","filter","files","filesystem","byGlob","length","appTypes","map","appType","getAppPattern","loadApps","pluginsToLoad","flatMap","appComponent","file","path","appManifests","compact","pluginPath","appManifest","require","default","err","error","getApp","appName","find","name","getAppByNameOrId","appNameOrId","byName","byId","BitError","globPattern","registerAppType","plugin","AppTypePlugin","registerPlugins","getAppAspect","getAppOrThrow","AppNotFound","computeOptions","opts","defaultOpts","loadAppsToSlot","runApp","options","context","createAppContext","runSsr","AppNoSsr","result","port","run","preCompile","catch","errors","getAppIdOrThrow","maybeApp","ComponentID","fromString","host","c","isEqual","env","createEnvironment","res","results","data","hostRootDir","getComponentPackagePath","appContext","AppContext","provider","cli","loggerAspect","builder","createLogger","ApplicationAspect","AppService","application","bind","appCmd","AppCmd","commands","AppListCmd","RunCmd","AppPlugin","registerBuildTasks","AppsBuildTask","registerSnapTasks","DeployTask","registerTagTasks","registerService","registerGroup","AppListCmdDeprecated","onComponentLoad","loadedComponent","type","applicationType","MainRuntime","CLIAspect","LoggerAspect","BuilderAspect","EnvsAspect","ComponentAspect","AspectLoaderAspect","WorkspaceAspect","WatcherAspect","Slot","withType","addRuntime"],"sources":["application.main.runtime.ts"],"sourcesContent":["import { MainRuntime, CLIMain, CLIAspect } from '@teambit/cli';\nimport { compact, flatten, head } from 'lodash';\nimport { AspectLoaderMain, AspectLoaderAspect } from '@teambit/aspect-loader';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport WatcherAspect, { WatcherMain } from '@teambit/watcher';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport ComponentAspect, { ComponentMain, ComponentID, Component } from '@teambit/component';\nimport { ApplicationType } from './application-type';\nimport { Application } from './application';\nimport { DeploymentProvider } from './deployment-provider';\nimport { AppNotFound } from './exceptions';\nimport { ApplicationAspect } from './application.aspect';\nimport { AppListCmdDeprecated } from './app-list.cmd';\nimport { AppsBuildTask } from './build.task';\nimport { RunCmd } from './run.cmd';\nimport { AppService } from './application.service';\nimport { AppCmd, AppListCmd } from './app.cmd';\nimport { AppPlugin } from './app.plugin';\nimport { AppTypePlugin } from './app-type.plugin';\nimport { AppContext } from './app-context';\nimport { DeployTask } from './deploy.task';\nimport { AppNoSsr } from './exceptions/app-no-ssr';\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\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 ) {}\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 /**\n * map all apps by component ID.\n */\n mapApps() {\n return this.appSlot.toArray();\n }\n\n /**\n * list apps by a component id.\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 */\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 async listAppsFromComponents() {\n const components = await this.componentAspect.getHost().list();\n const appTypesPatterns = this.getAppPatterns();\n const apps = components.filter((component) => {\n // has app plugin from registered types.\n const files = component.filesystem.byGlob(appTypesPatterns);\n return !!files.length;\n });\n\n return apps;\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;\n }\n\n async loadApps(): Promise<Application[]> {\n const apps = await this.listAppsFromComponents();\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 // const app = require(appPath);\n const appManifests = compact(\n pluginsToLoad.map((pluginPath) => {\n try {\n // eslint-disable-next-line\n const appManifest = require(pluginPath)?.default;\n return appManifest;\n } catch (err) {\n this.logger.error(`failed loading app manifest: ${pluginPath}`);\n return undefined;\n }\n })\n );\n\n return appManifests;\n }\n\n /**\n * get an app.\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>(appType: ApplicationType<T>) {\n const plugin = new AppTypePlugin(this.getAppPattern(appType), appType, this.appSlot);\n this.aspectLoader.registerPlugins([plugin]);\n this.appTypeSlot.register([appType]);\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 */\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 async runApp(appName: string, options?: ServeAppOptions) {\n options = this.computeOptions(options);\n const app = this.getAppOrThrow(appName);\n const context = await this.createAppContext(app.name);\n if (!context) throw new AppNotFound(appName);\n\n if (options.ssr) {\n if (!app.runSsr) throw new AppNoSsr(appName);\n\n const result = await app.runSsr(context);\n return { app, ...result };\n }\n\n const port = await app.run(context);\n if (options.watch) {\n this.watcher\n .watch({\n preCompile: false,\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 return { app, port, errors: undefined };\n }\n\n /**\n * get the component ID of a certain app.\n */\n 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 return ComponentID.fromString(maybeApp[0]);\n }\n\n private async createAppContext(appName: string): Promise<AppContext> {\n const host = this.componentAspect.getHost();\n const components = await host.list();\n const id = this.getAppIdOrThrow(appName);\n const component = components.find((c) => c.id.isEqual(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 = this.workspace.getComponentPackagePath(component);\n const appContext = new AppContext(appName, context.dev, component, this.workspace.path, context, hostRootDir);\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 ];\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]: [\n CLIMain,\n LoggerMain,\n BuilderMain,\n EnvsMain,\n ComponentMain,\n AspectLoaderMain,\n Workspace,\n WatcherMain\n ],\n config: ApplicationAspectConfig,\n [appTypeSlot, appSlot, deploymentProviderSlot]: [ApplicationTypeSlot, ApplicationSlot, DeploymentProviderSlot]\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 );\n appService.registerAppType = application.registerAppType.bind(application);\n const appCmd = new AppCmd();\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), new AppListCmdDeprecated(application), appCmd);\n // cli.registerOnStart(async () => {\n // await application.loadAppsToSlot();\n // });\n if (workspace) {\n workspace.onComponentLoad(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 }\n\n return application;\n }\n}\n\nApplicationAspect.addRuntime(ApplicationMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;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AI,CAACC,QAAQ,EAA8B,EAC3CD,eAAI,CAACC,QAAQ,EAAiB,EAC9BD,eAAI,CAACC,QAAQ,EAAwB,CACtC;AA2DHhC,gCAAiB,CAACiC,UAAU,CAACxJ,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AppService","run","context","appContext","Object","assign","dev","errors","transform","env","apps","undefined","appTypesList","appTypes","compute","forEach","appType","registerAppType","getAppTypes"],"sources":["application.service.ts"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';\nimport { ApplicationType } from './application-type';\n\ntype ApplicationTransformationMap = ServiceTransformationMap
|
|
1
|
+
{"version":3,"names":["AppService","run","context","appContext","Object","assign","dev","errors","transform","env","apps","undefined","appTypesList","appTypes","compute","forEach","appType","registerAppType","getAppTypes"],"sources":["application.service.ts"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap, ExecutionContext } from '@teambit/envs';\nimport { ApplicationType } from './application-type';\n\ntype ApplicationTransformationMap = ServiceTransformationMap & {\n getAppTypes: () => ApplicationType<any>[];\n};\nexport class AppService implements EnvService<any> {\n name = 'application';\n registerAppType: (appType: ApplicationType<any>) => void;\n\n async run(context: ExecutionContext) {\n const appContext = Object.assign(context, {\n dev: true,\n errors: [],\n });\n\n return appContext;\n }\n\n transform(env: Env, context: EnvContext): ApplicationTransformationMap | undefined {\n // Old env\n if (!env?.apps) return undefined;\n const appTypesList = env.apps()(context);\n const appTypes = appTypesList.compute();\n appTypes.forEach((appType) => {\n this.registerAppType(appType);\n });\n return {\n getAppTypes: () => {\n return appTypes;\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAMO,MAAMA,UAAU,CAA4B;EAAA;IAAA,8CAC1C,aAAa;IAAA;EAAA;EAGpB,MAAMC,GAAG,CAACC,OAAyB,EAAE;IACnC,MAAMC,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACH,OAAO,EAAE;MACxCI,GAAG,EAAE,IAAI;MACTC,MAAM,EAAE;IACV,CAAC,CAAC;IAEF,OAAOJ,UAAU;EACnB;EAEAK,SAAS,CAACC,GAAQ,EAAEP,OAAmB,EAA4C;IACjF;IACA,IAAI,EAACO,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEC,IAAI,GAAE,OAAOC,SAAS;IAChC,MAAMC,YAAY,GAAGH,GAAG,CAACC,IAAI,EAAE,CAACR,OAAO,CAAC;IACxC,MAAMW,QAAQ,GAAGD,YAAY,CAACE,OAAO,EAAE;IACvCD,QAAQ,CAACE,OAAO,CAAEC,OAAO,IAAK;MAC5B,IAAI,CAACC,eAAe,CAACD,OAAO,CAAC;IAC/B,CAAC,CAAC;IACF,OAAO;MACLE,WAAW,EAAE,MAAM;QACjB,OAAOL,QAAQ;MACjB;IACF,CAAC;EACH;AACF;AAAC"}
|
package/dist/apps-env-type.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["apps-env-type.ts"],"sourcesContent":["import { EnvHandler } from
|
|
1
|
+
{"version":3,"names":[],"sources":["apps-env-type.ts"],"sourcesContent":["import { EnvHandler } from '@teambit/envs';\nimport { AppTypeList } from './app-type-list';\n\nexport interface AppsEnv {\n /**\n * return a template list instance.\n */\n apps(): EnvHandler<AppTypeList>;\n}\n"],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.632/dist/application.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@0.0.632/dist/application.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/application",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.632",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/harmony/application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "application",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.632"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
"core-js": "^3.0.0",
|
|
18
18
|
"@babel/runtime": "7.20.0",
|
|
19
19
|
"@teambit/harmony": "0.4.6",
|
|
20
|
-
"@teambit/builder": "0.0.
|
|
21
|
-
"@teambit/component": "0.0.
|
|
22
|
-
"@teambit/isolator": "0.0.
|
|
23
|
-
"@teambit/envs": "0.0.
|
|
20
|
+
"@teambit/builder": "0.0.990",
|
|
21
|
+
"@teambit/component": "0.0.990",
|
|
22
|
+
"@teambit/isolator": "0.0.990",
|
|
23
|
+
"@teambit/envs": "0.0.990",
|
|
24
24
|
"@teambit/cli-table": "0.0.41",
|
|
25
|
-
"@teambit/cli": "0.0.
|
|
26
|
-
"@teambit/aspect-loader": "0.0.
|
|
25
|
+
"@teambit/cli": "0.0.664",
|
|
26
|
+
"@teambit/aspect-loader": "0.0.990",
|
|
27
27
|
"@teambit/bit-error": "0.0.402",
|
|
28
|
-
"@teambit/logger": "0.0.
|
|
29
|
-
"@teambit/
|
|
28
|
+
"@teambit/logger": "0.0.757",
|
|
29
|
+
"@teambit/watcher": "0.0.2",
|
|
30
|
+
"@teambit/workspace": "0.0.990"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/react": "^17.0.8",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"@types/testing-library__jest-dom": "5.9.5"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"@teambit/legacy": "1.0.
|
|
43
|
+
"@teambit/legacy": "1.0.445",
|
|
43
44
|
"react": "^16.8.0 || ^17.0.0",
|
|
44
45
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
45
46
|
},
|
|
Binary file
|