@teambit/application 0.0.263 → 0.0.271
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/__preview-1642994756471.js +1 -0
- package/dist/app-build-context.d.ts +17 -0
- package/dist/app-build-context.js +3 -0
- package/dist/{deploy-context.js.map → app-build-context.js.map} +0 -0
- package/dist/app-build-result.d.ts +2 -2
- package/dist/app-deploy-context.d.ts +8 -0
- package/dist/app-deploy-context.js +3 -0
- package/dist/app-deploy-context.js.map +1 -0
- package/dist/application.d.ts +4 -5
- package/dist/build.task.d.ts +0 -1
- package/dist/build.task.js +25 -10
- package/dist/build.task.js.map +1 -1
- package/dist/deploy.task.d.ts +0 -1
- package/dist/deploy.task.js +21 -17
- package/dist/deploy.task.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +25 -9
- package/dist/index.js.map +1 -1
- package/package-tar/teambit-application-0.0.271.tgz +0 -0
- package/package.json +11 -11
- package/dist/deploy-context.d.ts +0 -4
- package/dist/deploy-context.js +0 -3
- package/package-tar/teambit-application-0.0.263.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { Capsule } from '@teambit/isolator';
|
|
3
|
+
import { BuildContext } from '@teambit/builder';
|
|
4
|
+
export interface AppBuildContext extends BuildContext {
|
|
5
|
+
/**
|
|
6
|
+
* name of the type of the app. e.g. `react-app`
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Application capsule
|
|
11
|
+
*/
|
|
12
|
+
capsule: Capsule;
|
|
13
|
+
/**
|
|
14
|
+
* app Component object
|
|
15
|
+
*/
|
|
16
|
+
appComponent: Component;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Component } from '@teambit/component';
|
|
2
|
+
import { Capsule } from '@teambit/isolator';
|
|
3
|
+
import { BuildContext, ArtifactDefinition } from '@teambit/builder';
|
|
4
|
+
export interface AppDeployContext extends BuildContext {
|
|
5
|
+
capsule: Capsule;
|
|
6
|
+
appComponent: Component;
|
|
7
|
+
artifacts?: ArtifactDefinition[];
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/dist/application.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { BuildContext } from '@teambit/builder';
|
|
2
|
-
import { Capsule } from '@teambit/isolator';
|
|
3
1
|
import { AppContext } from './app-context';
|
|
4
|
-
import {
|
|
2
|
+
import { AppDeployContext } from './app-deploy-context';
|
|
3
|
+
import { AppBuildContext } from './app-build-context';
|
|
5
4
|
import { AppBuildResult } from './app-build-result';
|
|
6
|
-
export declare type DeployFn = (context:
|
|
5
|
+
export declare type DeployFn = (context: AppDeployContext) => Promise<void>;
|
|
7
6
|
export interface Application {
|
|
8
7
|
/**
|
|
9
8
|
* name of the application. e.g. ripple-ci.
|
|
@@ -16,7 +15,7 @@ export interface Application {
|
|
|
16
15
|
/**
|
|
17
16
|
* build the application.
|
|
18
17
|
*/
|
|
19
|
-
build?(context:
|
|
18
|
+
build?(context: AppBuildContext): Promise<AppBuildResult>;
|
|
20
19
|
/**
|
|
21
20
|
* application deployment. this is a build task.
|
|
22
21
|
*/
|
package/dist/build.task.d.ts
CHANGED
package/dist/build.task.js
CHANGED
|
@@ -69,17 +69,38 @@ class AppsBuildTask {
|
|
|
69
69
|
|
|
70
70
|
async execute(context) {
|
|
71
71
|
const apps = this.application.listApps();
|
|
72
|
+
const {
|
|
73
|
+
capsuleNetwork
|
|
74
|
+
} = context;
|
|
72
75
|
const componentsResults = await (0, _pMapSeries().default)(apps, async app => {
|
|
73
76
|
const aspectId = this.application.getAppAspect(app.name);
|
|
74
77
|
if (!aspectId) return undefined;
|
|
75
|
-
const
|
|
76
|
-
const capsule = this.getCapsule(capsules, aspectId);
|
|
78
|
+
const capsule = capsuleNetwork.seedersCapsules.getCapsuleIgnoreVersion(_component().ComponentID.fromString(aspectId));
|
|
77
79
|
if (!capsule || !app.build) return undefined;
|
|
78
|
-
const
|
|
80
|
+
const {
|
|
81
|
+
component
|
|
82
|
+
} = capsule;
|
|
83
|
+
const appDeployContext = Object.assign(context, {
|
|
84
|
+
capsule,
|
|
85
|
+
appComponent: component,
|
|
86
|
+
name: app.name
|
|
87
|
+
});
|
|
88
|
+
const deployContext = await app.build(appDeployContext);
|
|
79
89
|
return {
|
|
80
90
|
artifacts: deployContext.artifacts,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @guysaar223
|
|
94
|
+
* @ram8
|
|
95
|
+
* TODO: we need to think how to pass private metadata between build pipes, maybe create shared context
|
|
96
|
+
* or create new deploy context on builder
|
|
97
|
+
*/
|
|
98
|
+
// @ts-ignore
|
|
81
99
|
componentResult: {
|
|
82
|
-
component: capsule.component
|
|
100
|
+
component: capsule.component,
|
|
101
|
+
_metadata: {
|
|
102
|
+
deployContext
|
|
103
|
+
}
|
|
83
104
|
}
|
|
84
105
|
};
|
|
85
106
|
});
|
|
@@ -97,12 +118,6 @@ class AppsBuildTask {
|
|
|
97
118
|
};
|
|
98
119
|
}
|
|
99
120
|
|
|
100
|
-
getCapsule(capsules, aspectId) {
|
|
101
|
-
const aspectCapsuleId = _component().ComponentID.fromString(aspectId).toStringWithoutVersion();
|
|
102
|
-
|
|
103
|
-
return capsules.find(capsule => capsule.component.id.toStringWithoutVersion() === aspectCapsuleId);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
exports.AppsBuildTask = AppsBuildTask;
|
package/dist/build.task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["build.task.ts"],"names":["BUILD_TASK","AppsBuildTask","constructor","application","opt","deploy","ApplicationAspect","id","execute","context","apps","listApps","componentsResults","app","aspectId","getAppAspect","name","undefined","
|
|
1
|
+
{"version":3,"sources":["build.task.ts"],"names":["BUILD_TASK","AppsBuildTask","constructor","application","opt","deploy","ApplicationAspect","id","execute","context","apps","listApps","capsuleNetwork","componentsResults","app","aspectId","getAppAspect","name","undefined","capsule","seedersCapsules","getCapsuleIgnoreVersion","ComponentID","fromString","build","component","appDeployContext","Object","assign","appComponent","deployContext","artifacts","componentResult","_metadata","flatMap","res","filter","a","_componentsResults","map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAIO,MAAMA,UAAU,GAAG,mBAAnB;;;AAUA,MAAMC,aAAN,CAAyC;AAI9CC,EAAAA,WAAW,CAASC,WAAT,EAA+CC,GAAY,GAAG;AAAEC,IAAAA,MAAM,EAAE;AAAV,GAA9D,EAAgF;AAAA,SAAvEF,WAAuE,GAAvEA,WAAuE;AAAA,SAAjCC,GAAiC,GAAjCA,GAAiC;AAAA,kDAHpFJ,UAGoF;AAAA,sDAFhFM,iCAAkBC,EAE8D;AAAA,sDADvE,KACuE;AAAE;;AAEhF,QAAPC,OAAO,CAACC,OAAD,EAAkD;AAC7D,UAAMC,IAAI,GAAG,KAAKP,WAAL,CAAiBQ,QAAjB,EAAb;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAqBH,OAA3B;AACA,UAAMI,iBAAiB,GAAG,MAAM,2BAAUH,IAAV,EAAgB,MAAOI,GAAP,IAAiD;AAC/F,YAAMC,QAAQ,GAAG,KAAKZ,WAAL,CAAiBa,YAAjB,CAA8BF,GAAG,CAACG,IAAlC,CAAjB;AACA,UAAI,CAACF,QAAL,EAAe,OAAOG,SAAP;AACf,YAAMC,OAAO,GAAGP,cAAc,CAACQ,eAAf,CAA+BC,uBAA/B,CAAuDC,yBAAYC,UAAZ,CAAuB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ArtifactDefinition } from '@teambit/builder';\nimport { ComponentID } from '@teambit/component';\nimport { ApplicationAspect } from './application.aspect';\nimport { ApplicationMain } from './application.main.runtime';\nimport { AppBuildContext } from './app-build-context';\n\nexport const BUILD_TASK = 'build_application';\n\nexport type AppsResults = {\n componentResult: ComponentResult;\n artifacts?: ArtifactDefinition[];\n};\n\nexport type Options = {\n deploy: boolean;\n};\nexport class AppsBuildTask implements BuildTask {\n name = BUILD_TASK;\n aspectId = ApplicationAspect.id;\n readonly location = 'end';\n constructor(private application: ApplicationMain, private opt: Options = { deploy: true }) {}\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const apps = this.application.listApps();\n const { capsuleNetwork } = context;\n const componentsResults = await mapSeries(apps, async (app): Promise<AppsResults | undefined> => {\n const aspectId = this.application.getAppAspect(app.name);\n if (!aspectId) return undefined;\n const capsule = capsuleNetwork.seedersCapsules.getCapsuleIgnoreVersion(ComponentID.fromString(aspectId));\n if (!capsule || !app.build) return undefined;\n const { component } = capsule;\n const appDeployContext: AppBuildContext = Object.assign(context, {\n capsule,\n appComponent: component,\n name: app.name,\n });\n const deployContext = await app.build(appDeployContext);\n\n return {\n artifacts: deployContext.artifacts,\n /**\n * @guysaar223\n * @ram8\n * TODO: we need to think how to pass private metadata between build pipes, maybe create shared context\n * or create new deploy context on builder\n */\n // @ts-ignore\n componentResult: { component: capsule.component, _metadata: { deployContext } },\n };\n });\n\n const artifacts = componentsResults\n .flatMap((res) => {\n return res?.artifacts;\n })\n .filter((a) => !!a) as ArtifactDefinition[];\n const _componentsResults = componentsResults\n .map((res) => {\n return res?.componentResult;\n })\n .filter((a) => !!a) as ComponentResult[];\n return {\n artifacts,\n componentsResults: _componentsResults,\n };\n }\n}\n"]}
|
package/dist/deploy.task.d.ts
CHANGED
package/dist/deploy.task.js
CHANGED
|
@@ -74,23 +74,33 @@ class DeployTask {
|
|
|
74
74
|
async execute(context) {
|
|
75
75
|
const apps = this.application.listApps();
|
|
76
76
|
const componentsResults = await (0, _pMapSeries().default)(apps, async app => {
|
|
77
|
-
var
|
|
77
|
+
var _componentResults$_me;
|
|
78
78
|
|
|
79
79
|
const aspectId = this.application.getAppAspect(app.name);
|
|
80
80
|
if (!aspectId) return undefined;
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
if (!(capsule !== null && capsule !== void 0 && capsule.component)) return undefined;
|
|
81
|
+
const capsule = context.capsuleNetwork.seedersCapsules.getCapsuleIgnoreVersion(_component().ComponentID.fromString(aspectId));
|
|
82
|
+
if (!capsule || !(capsule !== null && capsule !== void 0 && capsule.component)) return undefined;
|
|
84
83
|
const buildTask = this.getBuildTask(context.previousTasksResults, context.envRuntime.id);
|
|
85
84
|
if (!buildTask) return undefined;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
const componentResults = buildTask.componentsResults.find(res => res.component.id.isEqual(capsule.component.id, {
|
|
86
|
+
ignoreVersion: true
|
|
87
|
+
}));
|
|
88
|
+
/**
|
|
89
|
+
* @guysaar223
|
|
90
|
+
* @ram8
|
|
91
|
+
* TODO: we need to think how to pass private metadata between build pipes, maybe create shared context
|
|
92
|
+
* or create new deploy context on builder
|
|
93
|
+
*/
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
|
|
96
|
+
const _metadata = (componentResults === null || componentResults === void 0 ? void 0 : (_componentResults$_me = componentResults._metadata) === null || _componentResults$_me === void 0 ? void 0 : _componentResults$_me.deployContext) || {};
|
|
97
|
+
|
|
98
|
+
const appDeployContext = Object.assign(context, _metadata, {
|
|
99
|
+
capsule,
|
|
100
|
+
appComponent: capsule.component
|
|
91
101
|
});
|
|
92
|
-
if (!
|
|
93
|
-
await app.deploy(
|
|
102
|
+
if (!app.deploy) return undefined;
|
|
103
|
+
await app.deploy(appDeployContext);
|
|
94
104
|
return {
|
|
95
105
|
componentResult: {
|
|
96
106
|
component: capsule.component
|
|
@@ -114,12 +124,6 @@ class DeployTask {
|
|
|
114
124
|
}) => task.aspectId === _application().ApplicationAspect.id && task.name === _build().BUILD_TASK && env.id === runtime);
|
|
115
125
|
}
|
|
116
126
|
|
|
117
|
-
getCapsule(capsules, aspectId) {
|
|
118
|
-
const aspectCapsuleId = _component().ComponentID.fromString(aspectId).toStringWithoutVersion();
|
|
119
|
-
|
|
120
|
-
return capsules.find(capsule => capsule.component.id.toStringWithoutVersion() === aspectCapsuleId);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
exports.DeployTask = DeployTask;
|
package/dist/deploy.task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["deploy.task.ts"],"names":["DEPLOY_TASK","DeployTask","constructor","application","builder","ApplicationAspect","id","execute","context","apps","listApps","componentsResults","app","aspectId","getAppAspect","name","undefined","
|
|
1
|
+
{"version":3,"sources":["deploy.task.ts"],"names":["DEPLOY_TASK","DeployTask","constructor","application","builder","ApplicationAspect","id","execute","context","apps","listApps","componentsResults","app","aspectId","getAppAspect","name","undefined","capsule","capsuleNetwork","seedersCapsules","getCapsuleIgnoreVersion","ComponentID","fromString","component","buildTask","getBuildTask","previousTasksResults","envRuntime","componentResults","find","res","isEqual","ignoreVersion","_metadata","deployContext","appDeployContext","Object","assign","appComponent","deploy","componentResult","_componentsResults","map","filter","a","taskResults","runtime","task","env","BUILD_TASK"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGO,MAAMA,WAAW,GAAG,oBAApB;;;AAEA,MAAMC,UAAN,CAAsC;AAI3CC,EAAAA,WAAW,CAASC,WAAT,EAA+CC,OAA/C,EAAqE;AAAA,SAA5DD,WAA4D,GAA5DA,WAA4D;AAAA,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KAA8C,EAAhE;;AACA,YAAMC,gBAAkC,GAAGC,MAAM,CAACC,MAAP,CAAc7B,OAAd,EAAuByB,SAAvB,EAAkC;AAC3EhB,QAAAA,OAD2E;AAE3EqB,QAAAA,YAAY,EAAErB,OAAO,CAACM;AAFqD,OAAlC,CAA3C;AAIA,UAAI,CAACX,GAAG,CAAC2B,MAAT,EAAiB,OAAOvB,SAAP;AACjB,YAAMJ,GAAG,CAAC2B,MAAJ,CAAWJ,gBAAX,CAAN;AAEA,aAAO;AACLK,QAAAA,eAAe,EAAE;AAAEjB,UAAAA,SAAS,EAAEN,OAAO,CAACM;AAArB;AADZ,OAAP;AAGD,KA5B+B,CAAhC;;AA8BA,UAAMkB,kBAAkB,GAAG9B,iBAAiB,CACzC+B,GADwB,CACnBZ,GAAD,IAAS;AACZ,aAAOA,GAAP,aAAOA,GAAP,uBAAOA,GAAG,CAAEU,eAAZ;AACD,KAHwB,EAIxBG,MAJwB,CAIhBC,CAAD,IAAO,CAAC,CAACA,CAJQ,CAA3B;;AAMA,WAAO;AACLjC,MAAAA,iBAAiB,EAAE8B;AADd,KAAP;AAGD;;AAEOhB,EAAAA,YAAY,CAACoB,WAAD,EAA6BC,OAA7B,EAA8C;AAChE,WAAOD,WAAW,CAAChB,IAAZ,CACL,CAAC;AAAEkB,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAD,KAAmBD,IAAI,CAAClC,QAAL,KAAkBR,iCAAkBC,EAApC,IAA0CyC,IAAI,CAAChC,IAAL,KAAckC,mBAAxD,IAAsED,GAAG,CAAC1C,EAAJ,KAAWwC,OAD/F,CAAP;AAGD;;AArD0C","sourcesContent":["import mapSeries from 'p-map-series';\nimport { BuilderMain, BuildTask, BuildContext, ComponentResult, TaskResults } from '@teambit/builder';\nimport { ComponentID } from '@teambit/component';\nimport { ApplicationAspect } from './application.aspect';\nimport { ApplicationMain } from './application.main.runtime';\nimport { BUILD_TASK } from './build.task';\nimport { AppDeployContext } from './app-deploy-context';\n\nexport const DEPLOY_TASK = 'deploy_application';\n\nexport class DeployTask implements BuildTask {\n name = DEPLOY_TASK;\n aspectId = ApplicationAspect.id;\n readonly location = 'end';\n constructor(private application: ApplicationMain, private builder: BuilderMain) {}\n\n async execute(context: BuildContext): Promise<any> {\n const apps = this.application.listApps();\n const componentsResults = await mapSeries(apps, async (app): Promise<any> => {\n const aspectId = this.application.getAppAspect(app.name);\n if (!aspectId) return undefined;\n const capsule = context.capsuleNetwork.seedersCapsules.getCapsuleIgnoreVersion(ComponentID.fromString(aspectId));\n if (!capsule || !capsule?.component) return undefined;\n const buildTask = this.getBuildTask(context.previousTasksResults, context.envRuntime.id);\n if (!buildTask) return undefined;\n const componentResults = buildTask.componentsResults.find((res) =>\n res.component.id.isEqual(capsule.component.id, { ignoreVersion: true })\n );\n /**\n * @guysaar223\n * @ram8\n * TODO: we need to think how to pass private metadata between build pipes, maybe create shared context\n * or create new deploy context on builder\n */\n // @ts-ignore\n const _metadata = componentResults?._metadata?.deployContext || {};\n const appDeployContext: AppDeployContext = Object.assign(context, _metadata, {\n capsule,\n appComponent: capsule.component,\n });\n if (!app.deploy) return undefined;\n await app.deploy(appDeployContext);\n\n return {\n componentResult: { component: capsule.component },\n };\n });\n\n const _componentsResults = componentsResults\n .map((res) => {\n return res?.componentResult;\n })\n .filter((a) => !!a) as ComponentResult[];\n\n return {\n componentsResults: _componentsResults,\n };\n }\n\n private getBuildTask(taskResults: TaskResults[], runtime: string) {\n return taskResults.find(\n ({ task, env }) => task.aspectId === ApplicationAspect.id && task.name === BUILD_TASK && env.id === runtime\n );\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export type { Application, DeployFn } from './application';
|
|
|
4
4
|
export { AppContext } from './app-context';
|
|
5
5
|
export { DeploymentProvider } from './deployment-provider';
|
|
6
6
|
export { ApplicationType } from './application-type';
|
|
7
|
-
export {
|
|
7
|
+
export { AppDeployContext } from './app-deploy-context';
|
|
8
|
+
export { AppBuildContext } from './app-build-context';
|
|
8
9
|
export { AppBuildResult } from './app-build-result';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "AppBuildContext", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _appBuildContext().AppBuildContext;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "AppBuildResult", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -15,22 +21,22 @@ Object.defineProperty(exports, "AppContext", {
|
|
|
15
21
|
return _appContext().AppContext;
|
|
16
22
|
}
|
|
17
23
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "AppDeployContext", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
21
|
-
return
|
|
27
|
+
return _appDeployContext().AppDeployContext;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "ApplicationAspect", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
27
|
-
return
|
|
33
|
+
return _application().ApplicationAspect;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "ApplicationType", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
|
33
|
-
return
|
|
39
|
+
return _applicationType().ApplicationType;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
36
42
|
Object.defineProperty(exports, "DeploymentProvider", {
|
|
@@ -80,10 +86,20 @@ function _applicationType() {
|
|
|
80
86
|
return data;
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
function
|
|
84
|
-
const data = require("./deploy-context");
|
|
89
|
+
function _appDeployContext() {
|
|
90
|
+
const data = require("./app-deploy-context");
|
|
91
|
+
|
|
92
|
+
_appDeployContext = function () {
|
|
93
|
+
return data;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function _appBuildContext() {
|
|
100
|
+
const data = require("./app-build-context");
|
|
85
101
|
|
|
86
|
-
|
|
102
|
+
_appBuildContext = function () {
|
|
87
103
|
return data;
|
|
88
104
|
};
|
|
89
105
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA","sourcesContent":["export { ApplicationAspect } from './application.aspect';\nexport type { ApplicationMain } from './application.main.runtime';\nexport type { Application, DeployFn } from './application';\nexport { AppContext } from './app-context';\nexport { DeploymentProvider } from './deployment-provider';\nexport { ApplicationType } from './application-type';\nexport { AppDeployContext } from './app-deploy-context';\nexport { AppBuildContext } from './app-build-context';\nexport { AppBuildResult } from './app-build-result';\n"]}
|
|
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.271",
|
|
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.271"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"ink": "3.0.8",
|
|
17
17
|
"@babel/runtime": "7.12.18",
|
|
18
18
|
"core-js": "^3.0.0",
|
|
19
|
-
"@teambit/builder": "0.0.
|
|
20
|
-
"@teambit/component": "0.0.
|
|
21
|
-
"@teambit/
|
|
19
|
+
"@teambit/builder": "0.0.629",
|
|
20
|
+
"@teambit/component": "0.0.629",
|
|
21
|
+
"@teambit/isolator": "0.0.629",
|
|
22
|
+
"@teambit/envs": "0.0.629",
|
|
22
23
|
"@teambit/cli-table": "0.0.33",
|
|
23
|
-
"@teambit/cli": "0.0.
|
|
24
|
-
"@teambit/aspect-loader": "0.0.
|
|
25
|
-
"@teambit/logger": "0.0.
|
|
26
|
-
"@teambit/isolator": "0.0.621"
|
|
24
|
+
"@teambit/cli": "0.0.433",
|
|
25
|
+
"@teambit/aspect-loader": "0.0.629",
|
|
26
|
+
"@teambit/logger": "0.0.522"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/lodash": "4.14.165",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/node": "12.20.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@teambit/legacy": "1.0.
|
|
38
|
+
"@teambit/legacy": "1.0.209",
|
|
39
39
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
40
40
|
"react": "^16.8.0 || ^17.0.0"
|
|
41
41
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react": "-"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@teambit/legacy": "1.0.
|
|
66
|
+
"@teambit/legacy": "1.0.209",
|
|
67
67
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
68
68
|
"react": "^16.8.0 || ^17.0.0"
|
|
69
69
|
}
|
package/dist/deploy-context.d.ts
DELETED
package/dist/deploy-context.js
DELETED
|
Binary file
|