@teambit/bundler 0.0.881 → 0.0.883
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/bundle.js +0 -3
- package/dist/bundle.js.map +1 -1
- package/dist/bundler.aspect.js +0 -5
- package/dist/bundler.aspect.js.map +1 -1
- package/dist/bundler.composition.js +0 -6
- package/dist/bundler.composition.js.map +1 -1
- package/dist/bundler.main.runtime.js +7 -54
- package/dist/bundler.main.runtime.js.map +1 -1
- package/dist/component-server.js +1 -34
- package/dist/component-server.js.map +1 -1
- package/dist/dedup-envs.js +0 -14
- package/dist/dedup-envs.js.map +1 -1
- package/dist/dev-server.graphql.js +2 -7
- package/dist/dev-server.graphql.js.map +1 -1
- package/dist/dev-server.service.js +4 -42
- package/dist/dev-server.service.js.map +1 -1
- package/dist/events/components-server-started-event.js +1 -12
- package/dist/events/components-server-started-event.js.map +1 -1
- package/dist/events/index.js +0 -2
- package/dist/events/index.js.map +1 -1
- package/dist/exceptions/bind-error.js +0 -2
- package/dist/exceptions/bind-error.js.map +1 -1
- package/dist/exceptions/index.js +0 -3
- package/dist/exceptions/index.js.map +1 -1
- package/dist/get-entry.js +0 -3
- package/dist/get-entry.js.map +1 -1
- package/dist/index.js +0 -23
- package/dist/index.js.map +1 -1
- package/dist/select-port.js +0 -5
- package/dist/select-port.js.map +1 -1
- package/package-tar/teambit-bundler-0.0.883.tgz +0 -0
- package/package.json +8 -8
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-bundler-0.0.881.tgz +0 -0
package/dist/bundle.js
CHANGED
package/dist/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Bundle","constructor","errors"],"sources":["bundle.ts"],"sourcesContent":["export class Bundle {\n constructor(readonly errors: Error) {}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Bundle","constructor","errors"],"sources":["bundle.ts"],"sourcesContent":["export class Bundle {\n constructor(readonly errors: Error) {}\n}\n"],"mappings":";;;;;;AAAO,MAAMA,MAAM,CAAC;EAClBC,WAAW,CAAUC,MAAa,EAAE;IAAA,KAAfA,MAAa,GAAbA,MAAa;EAAG;AACvC;AAAC"}
|
package/dist/bundler.aspect.js
CHANGED
|
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BundlerAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const BundlerAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.compilation/bundler'
|
|
20
16
|
});
|
|
21
|
-
|
|
22
17
|
exports.BundlerAspect = BundlerAspect;
|
|
23
18
|
|
|
24
19
|
//# sourceMappingURL=bundler.aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BundlerAspect","Aspect","create","id"],"sources":["bundler.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const BundlerAspect = Aspect.create({\n id: 'teambit.compilation/bundler',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["BundlerAspect","Aspect","create","id"],"sources":["bundler.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const BundlerAspect = Aspect.create({\n id: 'teambit.compilation/bundler',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,aAAa,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACzCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Logo = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
21
16
|
style: {
|
|
22
17
|
height: '100%',
|
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
|
29
24
|
},
|
|
30
25
|
src: "https://static.bit.dev/extensions-icons/bundler.svg"
|
|
31
26
|
}));
|
|
32
|
-
|
|
33
27
|
exports.Logo = Logo;
|
|
34
28
|
|
|
35
29
|
//# sourceMappingURL=bundler.composition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["bundler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/bundler.svg\" />\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["bundler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/bundler.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAqD,EAAG,CAE1F;AAAC"}
|
|
@@ -1,126 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.BundlerMain = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _pubsub() {
|
|
25
18
|
const data = _interopRequireDefault(require("@teambit/pubsub"));
|
|
26
|
-
|
|
27
19
|
_pubsub = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _cli() {
|
|
35
25
|
const data = require("@teambit/cli");
|
|
36
|
-
|
|
37
26
|
_cli = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _component() {
|
|
45
32
|
const data = require("@teambit/component");
|
|
46
|
-
|
|
47
33
|
_component = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _dependencyResolver() {
|
|
55
39
|
const data = require("@teambit/dependency-resolver");
|
|
56
|
-
|
|
57
40
|
_dependencyResolver = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _envs() {
|
|
65
46
|
const data = require("@teambit/envs");
|
|
66
|
-
|
|
67
47
|
_envs = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _graphql() {
|
|
75
53
|
const data = require("@teambit/graphql");
|
|
76
|
-
|
|
77
54
|
_graphql = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _harmony() {
|
|
85
60
|
const data = require("@teambit/harmony");
|
|
86
|
-
|
|
87
61
|
_harmony = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
function _bundler() {
|
|
95
67
|
const data = require("./bundler.aspect");
|
|
96
|
-
|
|
97
68
|
_bundler = function () {
|
|
98
69
|
return data;
|
|
99
70
|
};
|
|
100
|
-
|
|
101
71
|
return data;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
function _devServer() {
|
|
105
74
|
const data = require("./dev-server.graphql");
|
|
106
|
-
|
|
107
75
|
_devServer = function () {
|
|
108
76
|
return data;
|
|
109
77
|
};
|
|
110
|
-
|
|
111
78
|
return data;
|
|
112
79
|
}
|
|
113
|
-
|
|
114
80
|
function _devServer2() {
|
|
115
81
|
const data = require("./dev-server.service");
|
|
116
|
-
|
|
117
82
|
_devServer2 = function () {
|
|
118
83
|
return data;
|
|
119
84
|
};
|
|
120
|
-
|
|
121
85
|
return data;
|
|
122
86
|
}
|
|
123
|
-
|
|
124
87
|
/**
|
|
125
88
|
* bundler extension.
|
|
126
89
|
*/
|
|
@@ -149,15 +112,14 @@ class BundlerMain {
|
|
|
149
112
|
this.runtimeSlot = runtimeSlot;
|
|
150
113
|
(0, _defineProperty2().default)(this, "_componentServers", void 0);
|
|
151
114
|
}
|
|
115
|
+
|
|
152
116
|
/**
|
|
153
117
|
* load all given components in corresponding dev servers.
|
|
154
118
|
* @param components defaults to all components in the workspace.
|
|
155
119
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
120
|
async devServer(components) {
|
|
159
|
-
const envRuntime = await this.envs.createEnvironment(components);
|
|
160
|
-
|
|
121
|
+
const envRuntime = await this.envs.createEnvironment(components);
|
|
122
|
+
// TODO: this must be refactored away from here. this logic should be in the Preview.
|
|
161
123
|
const servers = await envRuntime.runOnce(this.devService, {
|
|
162
124
|
dedicatedEnvDevServers: this.config.dedicatedEnvDevServers
|
|
163
125
|
});
|
|
@@ -165,25 +127,21 @@ class BundlerMain {
|
|
|
165
127
|
this.indexByComponent();
|
|
166
128
|
return this._componentServers;
|
|
167
129
|
}
|
|
130
|
+
|
|
168
131
|
/**
|
|
169
132
|
* get a dev server instance containing a component.
|
|
170
133
|
* @param component
|
|
171
134
|
*/
|
|
172
|
-
|
|
173
|
-
|
|
174
135
|
getComponentServer(component) {
|
|
175
136
|
if (!this._componentServers) return undefined;
|
|
176
137
|
const envId = this.envs.getEnvId(component);
|
|
177
|
-
|
|
178
138
|
const server = this._componentServers.find(componentServer => componentServer.context.relatedContexts.includes(envId) || componentServer.context.id === envId);
|
|
179
|
-
|
|
180
139
|
return server;
|
|
181
140
|
}
|
|
141
|
+
|
|
182
142
|
/**
|
|
183
143
|
* compute entry files for bundling components in a given execution context.
|
|
184
144
|
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
145
|
async computeEntries(context) {
|
|
188
146
|
const slotEntries = await Promise.all(this.runtimeSlot.values().map(async browserRuntime => browserRuntime.entry(context)));
|
|
189
147
|
const slotPaths = slotEntries.reduce((acc, current) => {
|
|
@@ -192,25 +150,23 @@ class BundlerMain {
|
|
|
192
150
|
});
|
|
193
151
|
return slotPaths;
|
|
194
152
|
}
|
|
153
|
+
|
|
195
154
|
/**
|
|
196
155
|
* register a new browser runtime environment.
|
|
197
156
|
* @param browserRuntime
|
|
198
157
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
158
|
registerTarget(browserRuntime) {
|
|
202
159
|
browserRuntime.map(runtime => {
|
|
203
160
|
return this.runtimeSlot.register(runtime);
|
|
204
161
|
});
|
|
205
162
|
return this;
|
|
206
163
|
}
|
|
164
|
+
|
|
207
165
|
/**
|
|
208
166
|
* component servers.
|
|
209
167
|
*/
|
|
210
168
|
|
|
211
|
-
|
|
212
169
|
indexByComponent() {}
|
|
213
|
-
|
|
214
170
|
static async provider([pubsub, envs, graphql, dependencyResolver], config, [runtimeSlot]) {
|
|
215
171
|
const devServerService = new (_devServer2().DevServerService)(pubsub, dependencyResolver, runtimeSlot);
|
|
216
172
|
const bundler = new BundlerMain(config, pubsub, envs, devServerService, runtimeSlot);
|
|
@@ -218,9 +174,7 @@ class BundlerMain {
|
|
|
218
174
|
graphql.register((0, _devServer().devServerSchema)(bundler));
|
|
219
175
|
return bundler;
|
|
220
176
|
}
|
|
221
|
-
|
|
222
177
|
}
|
|
223
|
-
|
|
224
178
|
exports.BundlerMain = BundlerMain;
|
|
225
179
|
(0, _defineProperty2().default)(BundlerMain, "slots", [_harmony().Slot.withType()]);
|
|
226
180
|
(0, _defineProperty2().default)(BundlerMain, "runtime", _cli().MainRuntime);
|
|
@@ -228,7 +182,6 @@ exports.BundlerMain = BundlerMain;
|
|
|
228
182
|
(0, _defineProperty2().default)(BundlerMain, "defaultConfig", {
|
|
229
183
|
dedicatedEnvDevServers: []
|
|
230
184
|
});
|
|
231
|
-
|
|
232
185
|
_bundler().BundlerAspect.addRuntime(BundlerMain);
|
|
233
186
|
|
|
234
187
|
//# sourceMappingURL=bundler.main.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BundlerMain","constructor","config","pubsub","envs","devService","runtimeSlot","devServer","components","envRuntime","createEnvironment","servers","runOnce","dedicatedEnvDevServers","_componentServers","indexByComponent","getComponentServer","component","undefined","envId","getEnvId","server","find","componentServer","context","relatedContexts","includes","id","computeEntries","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat","registerTarget","runtime","register","provider","graphql","dependencyResolver","devServerService","DevServerService","bundler","registerService","devServerSchema","Slot","withType","MainRuntime","PubsubAspect","EnvsAspect","GraphqlAspect","DependencyResolverAspect","ComponentAspect","BundlerAspect","addRuntime"],"sources":["bundler.main.runtime.ts"],"sourcesContent":["import PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect } from '@teambit/component';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { BrowserRuntime } from './browser-runtime';\nimport { BundlerAspect } from './bundler.aspect';\nimport { ComponentServer } from './component-server';\nimport { BundlerContext } from './bundler-context';\nimport { devServerSchema } from './dev-server.graphql';\nimport { DevServerService } from './dev-server.service';\n\nexport type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;\n\nexport type BundlerConfig = {\n dedicatedEnvDevServers: string[];\n};\n\n/**\n * bundler extension.\n */\nexport class BundlerMain {\n constructor(\n readonly config: BundlerConfig,\n /**\n * Pubsub extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * environments extension.\n */\n private envs: EnvsMain,\n\n /**\n * dev server service.\n */\n private devService: DevServerService,\n\n /**\n * browser runtime slot.\n */\n private runtimeSlot: BrowserRuntimeSlot\n ) {}\n\n /**\n * load all given components in corresponding dev servers.\n * @param components defaults to all components in the workspace.\n */\n async devServer(components: Component[]): Promise<ComponentServer[]> {\n const envRuntime = await this.envs.createEnvironment(components);\n // TODO: this must be refactored away from here. this logic should be in the Preview.\n const servers: ComponentServer[] = await envRuntime.runOnce<ComponentServer[]>(this.devService, {\n dedicatedEnvDevServers: this.config.dedicatedEnvDevServers,\n });\n this._componentServers = servers;\n\n this.indexByComponent();\n\n return this._componentServers;\n }\n\n /**\n * get a dev server instance containing a component.\n * @param component\n */\n getComponentServer(component: Component): undefined | ComponentServer {\n if (!this._componentServers) return undefined;\n const envId = this.envs.getEnvId(component);\n const server = this._componentServers.find(\n (componentServer) =>\n componentServer.context.relatedContexts.includes(envId) || componentServer.context.id === envId\n );\n\n return server;\n }\n\n /**\n * compute entry files for bundling components in a given execution context.\n */\n async computeEntries(context: BundlerContext) {\n const slotEntries = await Promise.all(\n this.runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))\n );\n\n const slotPaths = slotEntries.reduce((acc, current) => {\n acc = acc.concat(current);\n return acc;\n });\n\n return slotPaths;\n }\n\n /**\n * register a new browser runtime environment.\n * @param browserRuntime\n */\n registerTarget(browserRuntime: BrowserRuntime[]) {\n browserRuntime.map((runtime) => {\n return this.runtimeSlot.register(runtime);\n });\n\n return this;\n }\n\n /**\n * component servers.\n */\n private _componentServers: null | ComponentServer[];\n\n private indexByComponent() {}\n\n static slots = [Slot.withType<BrowserRuntime>()];\n\n static runtime = MainRuntime;\n static dependencies = [PubsubAspect, EnvsAspect, GraphqlAspect, DependencyResolverAspect, ComponentAspect];\n\n static defaultConfig = {\n dedicatedEnvDevServers: [],\n };\n\n static async provider(\n [pubsub, envs, graphql, dependencyResolver]: [PubsubMain, EnvsMain, GraphqlMain, DependencyResolverMain],\n config,\n [runtimeSlot]: [BrowserRuntimeSlot]\n ) {\n const devServerService = new DevServerService(pubsub, dependencyResolver, runtimeSlot);\n const bundler = new BundlerMain(config, pubsub, envs, devServerService, runtimeSlot);\n envs.registerService(devServerService);\n\n graphql.register(devServerSchema(bundler));\n\n return bundler;\n }\n}\n\nBundlerAspect.addRuntime(BundlerMain);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["BundlerMain","constructor","config","pubsub","envs","devService","runtimeSlot","devServer","components","envRuntime","createEnvironment","servers","runOnce","dedicatedEnvDevServers","_componentServers","indexByComponent","getComponentServer","component","undefined","envId","getEnvId","server","find","componentServer","context","relatedContexts","includes","id","computeEntries","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat","registerTarget","runtime","register","provider","graphql","dependencyResolver","devServerService","DevServerService","bundler","registerService","devServerSchema","Slot","withType","MainRuntime","PubsubAspect","EnvsAspect","GraphqlAspect","DependencyResolverAspect","ComponentAspect","BundlerAspect","addRuntime"],"sources":["bundler.main.runtime.ts"],"sourcesContent":["import PubsubAspect, { PubsubMain } from '@teambit/pubsub';\nimport { MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect } from '@teambit/component';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { BrowserRuntime } from './browser-runtime';\nimport { BundlerAspect } from './bundler.aspect';\nimport { ComponentServer } from './component-server';\nimport { BundlerContext } from './bundler-context';\nimport { devServerSchema } from './dev-server.graphql';\nimport { DevServerService } from './dev-server.service';\n\nexport type BrowserRuntimeSlot = SlotRegistry<BrowserRuntime>;\n\nexport type BundlerConfig = {\n dedicatedEnvDevServers: string[];\n};\n\n/**\n * bundler extension.\n */\nexport class BundlerMain {\n constructor(\n readonly config: BundlerConfig,\n /**\n * Pubsub extension.\n */\n private pubsub: PubsubMain,\n\n /**\n * environments extension.\n */\n private envs: EnvsMain,\n\n /**\n * dev server service.\n */\n private devService: DevServerService,\n\n /**\n * browser runtime slot.\n */\n private runtimeSlot: BrowserRuntimeSlot\n ) {}\n\n /**\n * load all given components in corresponding dev servers.\n * @param components defaults to all components in the workspace.\n */\n async devServer(components: Component[]): Promise<ComponentServer[]> {\n const envRuntime = await this.envs.createEnvironment(components);\n // TODO: this must be refactored away from here. this logic should be in the Preview.\n const servers: ComponentServer[] = await envRuntime.runOnce<ComponentServer[]>(this.devService, {\n dedicatedEnvDevServers: this.config.dedicatedEnvDevServers,\n });\n this._componentServers = servers;\n\n this.indexByComponent();\n\n return this._componentServers;\n }\n\n /**\n * get a dev server instance containing a component.\n * @param component\n */\n getComponentServer(component: Component): undefined | ComponentServer {\n if (!this._componentServers) return undefined;\n const envId = this.envs.getEnvId(component);\n const server = this._componentServers.find(\n (componentServer) =>\n componentServer.context.relatedContexts.includes(envId) || componentServer.context.id === envId\n );\n\n return server;\n }\n\n /**\n * compute entry files for bundling components in a given execution context.\n */\n async computeEntries(context: BundlerContext) {\n const slotEntries = await Promise.all(\n this.runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))\n );\n\n const slotPaths = slotEntries.reduce((acc, current) => {\n acc = acc.concat(current);\n return acc;\n });\n\n return slotPaths;\n }\n\n /**\n * register a new browser runtime environment.\n * @param browserRuntime\n */\n registerTarget(browserRuntime: BrowserRuntime[]) {\n browserRuntime.map((runtime) => {\n return this.runtimeSlot.register(runtime);\n });\n\n return this;\n }\n\n /**\n * component servers.\n */\n private _componentServers: null | ComponentServer[];\n\n private indexByComponent() {}\n\n static slots = [Slot.withType<BrowserRuntime>()];\n\n static runtime = MainRuntime;\n static dependencies = [PubsubAspect, EnvsAspect, GraphqlAspect, DependencyResolverAspect, ComponentAspect];\n\n static defaultConfig = {\n dedicatedEnvDevServers: [],\n };\n\n static async provider(\n [pubsub, envs, graphql, dependencyResolver]: [PubsubMain, EnvsMain, GraphqlMain, DependencyResolverMain],\n config,\n [runtimeSlot]: [BrowserRuntimeSlot]\n ) {\n const devServerService = new DevServerService(pubsub, dependencyResolver, runtimeSlot);\n const bundler = new BundlerMain(config, pubsub, envs, devServerService, runtimeSlot);\n envs.registerService(devServerService);\n\n graphql.register(devServerSchema(bundler));\n\n return b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kB,CAA8D,EACxG5C,MAAM,EACN,CAACI,WAAW,CAAuB,EACnC;IACA,MAAMyC,gBAAgB,GAAG,KAAIC,8BAAgB,EAAC7C,MAAM,EAAE2C,kBAAkB,EAAExC,WAAW,CAAC;IACtF,MAAM2C,OAAO,GAAG,IAAIjD,WAAW,CAACE,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE2C,gBAAgB,EAAEzC,WAAW,CAAC;IACpFF,IAAI,CAAC8C,eAAe,CAACH,gBAAgB,CAAC;IAEtCF,OAAO,CAACF,QAAQ,CAAC,IAAAQ,4BAAe,EAACF,OAAO,CAAC,CAAC;IAE1C,OAAOA,OAAO;EAChB;AACF;AAAC;AAAA,gCAjHYjD,WAAW,WA2FP,CAACoD,eAAI,CAACC,QAAQ,EAAkB,CAAC;AAAA,gCA3FrCrD,WAAW,aA6FLsD,kBAAW;AAAA,gCA7FjBtD,WAAW,kBA8FA,CAACuD,iBAAY,EAAEC,kBAAU,EAAEC,wBAAa,EAAEC,8CAAwB,EAAEC,4BAAe,CAAC;AAAA,gCA9F/F3D,WAAW,mBAgGC;EACrBa,sBAAsB,EAAE;AAC1B,CAAC;AAiBH+C,wBAAa,CAACC,UAAU,CAAC7D,WAAW,CAAC"}
|
package/dist/component-server.js
CHANGED
|
@@ -1,86 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.ComponentServer = void 0;
|
|
11
|
-
|
|
12
9
|
function _defineProperty2() {
|
|
13
10
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
|
|
15
11
|
_defineProperty2 = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
function _envs() {
|
|
23
17
|
const data = require("@teambit/envs");
|
|
24
|
-
|
|
25
18
|
_envs = function () {
|
|
26
19
|
return data;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
return data;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function _devServer() {
|
|
33
24
|
const data = require("./dev-server");
|
|
34
|
-
|
|
35
25
|
_devServer = function () {
|
|
36
26
|
return data;
|
|
37
27
|
};
|
|
38
|
-
|
|
39
28
|
return data;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
function _exceptions() {
|
|
43
31
|
const data = require("./exceptions");
|
|
44
|
-
|
|
45
32
|
_exceptions = function () {
|
|
46
33
|
return data;
|
|
47
34
|
};
|
|
48
|
-
|
|
49
35
|
return data;
|
|
50
36
|
}
|
|
51
|
-
|
|
52
37
|
function _events() {
|
|
53
38
|
const data = require("./events");
|
|
54
|
-
|
|
55
39
|
_events = function () {
|
|
56
40
|
return data;
|
|
57
41
|
};
|
|
58
|
-
|
|
59
42
|
return data;
|
|
60
43
|
}
|
|
61
|
-
|
|
62
44
|
function _bundler() {
|
|
63
45
|
const data = require("./bundler.aspect");
|
|
64
|
-
|
|
65
46
|
_bundler = function () {
|
|
66
47
|
return data;
|
|
67
48
|
};
|
|
68
|
-
|
|
69
49
|
return data;
|
|
70
50
|
}
|
|
71
|
-
|
|
72
51
|
function _selectPort() {
|
|
73
52
|
const data = require("./select-port");
|
|
74
|
-
|
|
75
53
|
_selectPort = function () {
|
|
76
54
|
return data;
|
|
77
55
|
};
|
|
78
|
-
|
|
79
56
|
return data;
|
|
80
57
|
}
|
|
81
|
-
|
|
82
58
|
class ComponentServer {
|
|
83
59
|
// why is this here
|
|
60
|
+
|
|
84
61
|
constructor(
|
|
85
62
|
/**
|
|
86
63
|
* browser runtime slot
|
|
@@ -109,18 +86,15 @@ class ComponentServer {
|
|
|
109
86
|
return new (_events().ComponentsServerStartedEvent)(Date.now(), componentsServer, context, hostname, port);
|
|
110
87
|
});
|
|
111
88
|
}
|
|
112
|
-
|
|
113
89
|
/**
|
|
114
90
|
* determine whether component server contains a component.
|
|
115
91
|
*/
|
|
116
92
|
hasComponent(component) {
|
|
117
93
|
return this.context.components.find(contextComponent => contextComponent.equals(component));
|
|
118
94
|
}
|
|
119
|
-
|
|
120
95
|
get port() {
|
|
121
96
|
return this._port;
|
|
122
97
|
}
|
|
123
|
-
|
|
124
98
|
async listen() {
|
|
125
99
|
const port = await (0, _selectPort().selectPort)(this.portRange);
|
|
126
100
|
this._port = port;
|
|
@@ -131,21 +105,16 @@ class ComponentServer {
|
|
|
131
105
|
this.hostname = hostname;
|
|
132
106
|
this.pubsub.pub(_bundler().BundlerAspect.id, this.createComponentsServerStartedEvent(server, this.context, hostname, port));
|
|
133
107
|
}
|
|
134
|
-
|
|
135
108
|
getHostname(address) {
|
|
136
109
|
if (address === null) throw new (_exceptions().BindError)();
|
|
137
110
|
if (typeof address === 'string') return address;
|
|
138
111
|
let hostname = address.address;
|
|
139
|
-
|
|
140
112
|
if (hostname === '::') {
|
|
141
113
|
hostname = 'localhost';
|
|
142
114
|
}
|
|
143
|
-
|
|
144
115
|
return hostname;
|
|
145
116
|
}
|
|
146
|
-
|
|
147
117
|
onChange() {}
|
|
148
|
-
|
|
149
118
|
/**
|
|
150
119
|
* get the url of the component server.
|
|
151
120
|
*/
|
|
@@ -153,9 +122,7 @@ class ComponentServer {
|
|
|
153
122
|
// tailing `/` is required!
|
|
154
123
|
return `/preview/${this.context.envRuntime.id}/`;
|
|
155
124
|
}
|
|
156
|
-
|
|
157
125
|
}
|
|
158
|
-
|
|
159
126
|
exports.ComponentServer = ComponentServer;
|
|
160
127
|
|
|
161
128
|
//# sourceMappingURL=component-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentServer","constructor","pubsub","context","portRange","devServer","componentsServer","hostname","port","ComponentsServerStartedEvent","Date","now","hasComponent","component","components","find","contextComponent","equals","_port","listen","selectPort","server","address","getHostname","BindError","pub","BundlerAspect","id","createComponentsServerStartedEvent","onChange","url","envRuntime"],"sources":["component-server.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\n\nimport { AddressInfo } from 'net';\n\nimport { DevServer } from './dev-server';\nimport { BindError } from './exceptions';\nimport { ComponentsServerStartedEvent } from './events';\nimport { BundlerAspect } from './bundler.aspect';\nimport { selectPort } from './select-port';\n\nexport class ComponentServer {\n // why is this here\n errors?: Error[];\n constructor(\n /**\n * browser runtime slot\n */\n private pubsub: PubsubMain,\n\n /**\n * components contained in the existing component server.\n */\n readonly context: ExecutionContext,\n\n /**\n * port range of the component server.\n */\n readonly portRange: number[],\n\n /**\n * env dev server.\n */\n readonly devServer: DevServer\n ) {}\n\n hostname: string | undefined;\n\n /**\n * determine whether component server contains a component.\n */\n hasComponent(component: Component) {\n return this.context.components.find((contextComponent) => contextComponent.equals(component));\n }\n\n get port() {\n return this._port;\n }\n\n _port: number;\n async listen() {\n const port = await selectPort(this.portRange);\n this._port = port;\n const server = await this.devServer.listen(port);\n const address = server.address();\n const hostname = this.getHostname(address);\n if (!address) throw new BindError();\n this.hostname = hostname;\n\n this.pubsub.pub(BundlerAspect.id, this.createComponentsServerStartedEvent(server, this.context, hostname, port));\n }\n\n private getHostname(address: string | AddressInfo | null) {\n if (address === null) throw new BindError();\n if (typeof address === 'string') return address;\n\n let hostname = address.address;\n if (hostname === '::') {\n hostname = 'localhost';\n }\n\n return hostname;\n }\n\n private onChange() {}\n\n private createComponentsServerStartedEvent: (\n DevServer,\n ExecutionContext,\n string,\n number\n ) => ComponentsServerStartedEvent = (componentsServer, context, hostname, port) => {\n return new ComponentsServerStartedEvent(Date.now(), componentsServer, context, hostname, port);\n };\n\n /**\n * get the url of the component server.\n */\n get url() {\n // tailing `/` is required!\n return `/preview/${this.context.envRuntime.id}/`;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentServer","constructor","pubsub","context","portRange","devServer","componentsServer","hostname","port","ComponentsServerStartedEvent","Date","now","hasComponent","component","components","find","contextComponent","equals","_port","listen","selectPort","server","address","getHostname","BindError","pub","BundlerAspect","id","createComponentsServerStartedEvent","onChange","url","envRuntime"],"sources":["component-server.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\n\nimport { AddressInfo } from 'net';\n\nimport { DevServer } from './dev-server';\nimport { BindError } from './exceptions';\nimport { ComponentsServerStartedEvent } from './events';\nimport { BundlerAspect } from './bundler.aspect';\nimport { selectPort } from './select-port';\n\nexport class ComponentServer {\n // why is this here\n errors?: Error[];\n constructor(\n /**\n * browser runtime slot\n */\n private pubsub: PubsubMain,\n\n /**\n * components contained in the existing component server.\n */\n readonly context: ExecutionContext,\n\n /**\n * port range of the component server.\n */\n readonly portRange: number[],\n\n /**\n * env dev server.\n */\n readonly devServer: DevServer\n ) {}\n\n hostname: string | undefined;\n\n /**\n * determine whether component server contains a component.\n */\n hasComponent(component: Component) {\n return this.context.components.find((contextComponent) => contextComponent.equals(component));\n }\n\n get port() {\n return this._port;\n }\n\n _port: number;\n async listen() {\n const port = await selectPort(this.portRange);\n this._port = port;\n const server = await this.devServer.listen(port);\n const address = server.address();\n const hostname = this.getHostname(address);\n if (!address) throw new BindError();\n this.hostname = hostname;\n\n this.pubsub.pub(BundlerAspect.id, this.createComponentsServerStartedEvent(server, this.context, hostname, port));\n }\n\n private getHostname(address: string | AddressInfo | null) {\n if (address === null) throw new BindError();\n if (typeof address === 'string') return address;\n\n let hostname = address.address;\n if (hostname === '::') {\n hostname = 'localhost';\n }\n\n return hostname;\n }\n\n private onChange() {}\n\n private createComponentsServerStartedEvent: (\n DevServer,\n ExecutionContext,\n string,\n number\n ) => ComponentsServerStartedEvent = (componentsServer, context, hostname, port) => {\n return new ComponentsServerStartedEvent(Date.now(), componentsServer, context, hostname, port);\n };\n\n /**\n * get the url of the component server.\n */\n get url() {\n // tailing `/` is required!\n return `/preview/${this.context.envRuntime.id}/`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;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;AAEO,MAAMA,eAAe,CAAC;EAC3B;;EAEAC,WAAW;EACT;AACJ;AACA;EACYC,MAAkB;EAE1B;AACJ;AACA;EACaC,OAAyB;EAElC;AACJ;AACA;EACaC,SAAmB;EAE5B;AACJ;AACA;EACaC,SAAoB,EAC7B;IAAA,KAhBQH,MAAkB,GAAlBA,MAAkB;IAAA,KAKjBC,OAAyB,GAAzBA,OAAyB;IAAA,KAKzBC,SAAmB,GAAnBA,SAAmB;IAAA,KAKnBC,SAAoB,GAApBA,SAAoB;IAAA;IAAA;IAAA;IAAA,4EAgDK,CAACC,gBAAgB,EAAEH,OAAO,EAAEI,QAAQ,EAAEC,IAAI,KAAK;MACjF,OAAO,KAAIC,sCAA4B,EAACC,IAAI,CAACC,GAAG,EAAE,EAAEL,gBAAgB,EAAEH,OAAO,EAAEI,QAAQ,EAAEC,IAAI,CAAC;IAChG,CAAC;EAjDE;EAIH;AACF;AACA;EACEI,YAAY,CAACC,SAAoB,EAAE;IACjC,OAAO,IAAI,CAACV,OAAO,CAACW,UAAU,CAACC,IAAI,CAAEC,gBAAgB,IAAKA,gBAAgB,CAACC,MAAM,CAACJ,SAAS,CAAC,CAAC;EAC/F;EAEA,IAAIL,IAAI,GAAG;IACT,OAAO,IAAI,CAACU,KAAK;EACnB;EAGA,MAAMC,MAAM,GAAG;IACb,MAAMX,IAAI,GAAG,MAAM,IAAAY,wBAAU,EAAC,IAAI,CAAChB,SAAS,CAAC;IAC7C,IAAI,CAACc,KAAK,GAAGV,IAAI;IACjB,MAAMa,MAAM,GAAG,MAAM,IAAI,CAAChB,SAAS,CAACc,MAAM,CAACX,IAAI,CAAC;IAChD,MAAMc,OAAO,GAAGD,MAAM,CAACC,OAAO,EAAE;IAChC,MAAMf,QAAQ,GAAG,IAAI,CAACgB,WAAW,CAACD,OAAO,CAAC;IAC1C,IAAI,CAACA,OAAO,EAAE,MAAM,KAAIE,uBAAS,GAAE;IACnC,IAAI,CAACjB,QAAQ,GAAGA,QAAQ;IAExB,IAAI,CAACL,MAAM,CAACuB,GAAG,CAACC,wBAAa,CAACC,EAAE,EAAE,IAAI,CAACC,kCAAkC,CAACP,MAAM,EAAE,IAAI,CAAClB,OAAO,EAAEI,QAAQ,EAAEC,IAAI,CAAC,CAAC;EAClH;EAEQe,WAAW,CAACD,OAAoC,EAAE;IACxD,IAAIA,OAAO,KAAK,IAAI,EAAE,MAAM,KAAIE,uBAAS,GAAE;IAC3C,IAAI,OAAOF,OAAO,KAAK,QAAQ,EAAE,OAAOA,OAAO;IAE/C,IAAIf,QAAQ,GAAGe,OAAO,CAACA,OAAO;IAC9B,IAAIf,QAAQ,KAAK,IAAI,EAAE;MACrBA,QAAQ,GAAG,WAAW;IACxB;IAEA,OAAOA,QAAQ;EACjB;EAEQsB,QAAQ,GAAG,CAAC;EAWpB;AACF;AACA;EACE,IAAIC,GAAG,GAAG;IACR;IACA,OAAQ,YAAW,IAAI,CAAC3B,OAAO,CAAC4B,UAAU,CAACJ,EAAG,GAAE;EAClD;AACF;AAAC"}
|
package/dist/dedup-envs.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.regexp.exec.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.dedupEnvs = dedupEnvs;
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* de-duping dev servers by the amount of type the dev server configuration was overridden by envs.
|
|
16
12
|
* This will split the dev server to groups of dev server that share the same webpack config, and same peer dependencies
|
|
@@ -23,7 +19,6 @@ async function dedupEnvs(contexts, dependencyResolver, dedicatedEnvDevServers) {
|
|
|
23
19
|
const finalGroups = await splitByPeers(idsGroups, dependencyResolver);
|
|
24
20
|
return finalGroups;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
function groupByEnvId(contexts, dedicatedEnvDevServers) {
|
|
28
23
|
const groupedEnvs = {};
|
|
29
24
|
contexts.forEach(context => {
|
|
@@ -34,7 +29,6 @@ function groupByEnvId(contexts, dedicatedEnvDevServers) {
|
|
|
34
29
|
});
|
|
35
30
|
return groupedEnvs;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
async function splitByPeers(idsGroups, dependencyResolver) {
|
|
39
33
|
const newGroupedEnvs = {};
|
|
40
34
|
const promises = Object.values(idsGroups).map(async contexts => {
|
|
@@ -44,19 +38,14 @@ async function splitByPeers(idsGroups, dependencyResolver) {
|
|
|
44
38
|
await Promise.all(promises);
|
|
45
39
|
return newGroupedEnvs;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
41
|
function getEnvId(context, dedicatedServers) {
|
|
49
42
|
var _context$env;
|
|
50
|
-
|
|
51
43
|
const id = context.id.split('@')[0];
|
|
52
|
-
|
|
53
44
|
if (dedicatedServers !== null && dedicatedServers !== void 0 && dedicatedServers.includes(id)) {
|
|
54
45
|
return context.id;
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
return (_context$env = context.env) === null || _context$env === void 0 ? void 0 : _context$env.getDevEnvId(context);
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
async function groupByPeersHash(contexts, dependencyResolver) {
|
|
61
50
|
const peerGroups = {};
|
|
62
51
|
await Promise.all(contexts.map(async context => {
|
|
@@ -65,16 +54,13 @@ async function groupByPeersHash(contexts, dependencyResolver) {
|
|
|
65
54
|
const autoDetectPeersHash = policy.peersAutoDetectPolicy.hashNameVersion();
|
|
66
55
|
const regularPeersHash = policy.variantPolicy.byLifecycleType('peer').hashNameVersion();
|
|
67
56
|
const combinedHash = `${autoDetectPeersHash}:${regularPeersHash}`;
|
|
68
|
-
|
|
69
57
|
if (!peerGroups[combinedHash]) {
|
|
70
58
|
peerGroups[combinedHash] = [];
|
|
71
59
|
}
|
|
72
|
-
|
|
73
60
|
peerGroups[combinedHash].push(context);
|
|
74
61
|
}));
|
|
75
62
|
return indexPeerGroupsById(peerGroups);
|
|
76
63
|
}
|
|
77
|
-
|
|
78
64
|
function indexPeerGroupsById(peerGroups) {
|
|
79
65
|
const result = Object.values(peerGroups).reduce((acc, contexts) => {
|
|
80
66
|
const firstId = contexts[0].id;
|
package/dist/dedup-envs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","finalGroups","splitByPeers","groupedEnvs","forEach","context","envId","getEnvId","push","newGroupedEnvs","promises","Object","values","map","peersGroups","groupByPeersHash","assign","Promise","all","dedicatedServers","id","split","includes","env","getDevEnvId","peerGroups","policy","getComponentEnvPolicyFromEnv","autoDetectPeersHash","peersAutoDetectPolicy","hashNameVersion","regularPeersHash","variantPolicy","byLifecycleType","combinedHash","indexPeerGroupsById","result","reduce","acc","firstId"],"sources":["dedup-envs.ts"],"sourcesContent":["import { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport type { ExecutionContext } from '@teambit/envs';\n\ntype GroupIdContextMap = Record<string, ExecutionContext[]>;\n\n/**\n * de-duping dev servers by the amount of type the dev server configuration was overridden by envs.\n * This will split the dev server to groups of dev server that share the same webpack config, and same peer dependencies\n * @param contexts\n * @param dependencyResolver\n * @param dedicatedEnvDevServers\n */\nexport async function dedupEnvs(\n contexts: ExecutionContext[],\n dependencyResolver: DependencyResolverMain,\n dedicatedEnvDevServers?: string[]\n) {\n const idsGroups = groupByEnvId(contexts, dedicatedEnvDevServers);\n const finalGroups = await splitByPeers(idsGroups, dependencyResolver);\n return finalGroups;\n}\n\nfunction groupByEnvId(contexts: ExecutionContext[], dedicatedEnvDevServers?: string[]) {\n const groupedEnvs: GroupIdContextMap = {};\n\n contexts.forEach((context) => {\n const envId = getEnvId(context, dedicatedEnvDevServers);\n if (!envId) return;\n if (!(envId in groupedEnvs)) groupedEnvs[envId] = [];\n\n groupedEnvs[envId].push(context);\n });\n\n return groupedEnvs;\n}\n\nasync function splitByPeers(idsGroups: GroupIdContextMap, dependencyResolver: DependencyResolverMain) {\n const newGroupedEnvs: GroupIdContextMap = {};\n const promises = Object.values(idsGroups).map(async (contexts) => {\n const peersGroups = await groupByPeersHash(contexts, dependencyResolver);\n Object.assign(newGroupedEnvs, peersGroups);\n });\n await Promise.all(promises);\n return newGroupedEnvs;\n}\n\nfunction getEnvId(context: ExecutionContext, dedicatedServers?: string[]): string | undefined {\n const id = context.id.split('@')[0];\n\n if (dedicatedServers?.includes(id)) {\n return context.id;\n }\n\n return context.env?.getDevEnvId(context);\n}\n\nasync function groupByPeersHash(contexts: ExecutionContext[], dependencyResolver: DependencyResolverMain) {\n const peerGroups: GroupIdContextMap = {};\n\n await Promise.all(\n contexts.map(async (context) => {\n const env = context.env;\n const policy = await dependencyResolver.getComponentEnvPolicyFromEnv(env);\n const autoDetectPeersHash = policy.peersAutoDetectPolicy.hashNameVersion();\n const regularPeersHash = policy.variantPolicy.byLifecycleType('peer').hashNameVersion();\n const combinedHash = `${autoDetectPeersHash}:${regularPeersHash}`;\n if (!peerGroups[combinedHash]) {\n peerGroups[combinedHash] = [];\n }\n peerGroups[combinedHash].push(context);\n })\n );\n return indexPeerGroupsById(peerGroups);\n}\n\nfunction indexPeerGroupsById(peerGroups: GroupIdContextMap) {\n const result: GroupIdContextMap = Object.values(peerGroups).reduce((acc, contexts) => {\n const firstId = contexts[0].id;\n acc[firstId] = contexts;\n return acc;\n }, {});\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","finalGroups","splitByPeers","groupedEnvs","forEach","context","envId","getEnvId","push","newGroupedEnvs","promises","Object","values","map","peersGroups","groupByPeersHash","assign","Promise","all","dedicatedServers","id","split","includes","env","getDevEnvId","peerGroups","policy","getComponentEnvPolicyFromEnv","autoDetectPeersHash","peersAutoDetectPolicy","hashNameVersion","regularPeersHash","variantPolicy","byLifecycleType","combinedHash","indexPeerGroupsById","result","reduce","acc","firstId"],"sources":["dedup-envs.ts"],"sourcesContent":["import { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport type { ExecutionContext } from '@teambit/envs';\n\ntype GroupIdContextMap = Record<string, ExecutionContext[]>;\n\n/**\n * de-duping dev servers by the amount of type the dev server configuration was overridden by envs.\n * This will split the dev server to groups of dev server that share the same webpack config, and same peer dependencies\n * @param contexts\n * @param dependencyResolver\n * @param dedicatedEnvDevServers\n */\nexport async function dedupEnvs(\n contexts: ExecutionContext[],\n dependencyResolver: DependencyResolverMain,\n dedicatedEnvDevServers?: string[]\n) {\n const idsGroups = groupByEnvId(contexts, dedicatedEnvDevServers);\n const finalGroups = await splitByPeers(idsGroups, dependencyResolver);\n return finalGroups;\n}\n\nfunction groupByEnvId(contexts: ExecutionContext[], dedicatedEnvDevServers?: string[]) {\n const groupedEnvs: GroupIdContextMap = {};\n\n contexts.forEach((context) => {\n const envId = getEnvId(context, dedicatedEnvDevServers);\n if (!envId) return;\n if (!(envId in groupedEnvs)) groupedEnvs[envId] = [];\n\n groupedEnvs[envId].push(context);\n });\n\n return groupedEnvs;\n}\n\nasync function splitByPeers(idsGroups: GroupIdContextMap, dependencyResolver: DependencyResolverMain) {\n const newGroupedEnvs: GroupIdContextMap = {};\n const promises = Object.values(idsGroups).map(async (contexts) => {\n const peersGroups = await groupByPeersHash(contexts, dependencyResolver);\n Object.assign(newGroupedEnvs, peersGroups);\n });\n await Promise.all(promises);\n return newGroupedEnvs;\n}\n\nfunction getEnvId(context: ExecutionContext, dedicatedServers?: string[]): string | undefined {\n const id = context.id.split('@')[0];\n\n if (dedicatedServers?.includes(id)) {\n return context.id;\n }\n\n return context.env?.getDevEnvId(context);\n}\n\nasync function groupByPeersHash(contexts: ExecutionContext[], dependencyResolver: DependencyResolverMain) {\n const peerGroups: GroupIdContextMap = {};\n\n await Promise.all(\n contexts.map(async (context) => {\n const env = context.env;\n const policy = await dependencyResolver.getComponentEnvPolicyFromEnv(env);\n const autoDetectPeersHash = policy.peersAutoDetectPolicy.hashNameVersion();\n const regularPeersHash = policy.variantPolicy.byLifecycleType('peer').hashNameVersion();\n const combinedHash = `${autoDetectPeersHash}:${regularPeersHash}`;\n if (!peerGroups[combinedHash]) {\n peerGroups[combinedHash] = [];\n }\n peerGroups[combinedHash].push(context);\n })\n );\n return indexPeerGroupsById(peerGroups);\n}\n\nfunction indexPeerGroupsById(peerGroups: GroupIdContextMap) {\n const result: GroupIdContextMap = Object.values(peerGroups).reduce((acc, contexts) => {\n const firstId = contexts[0].id;\n acc[firstId] = contexts;\n return acc;\n }, {});\n return result;\n}\n"],"mappings":";;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,SAAS,CAC7BC,QAA4B,EAC5BC,kBAA0C,EAC1CC,sBAAiC,EACjC;EACA,MAAMC,SAAS,GAAGC,YAAY,CAACJ,QAAQ,EAAEE,sBAAsB,CAAC;EAChE,MAAMG,WAAW,GAAG,MAAMC,YAAY,CAACH,SAAS,EAAEF,kBAAkB,CAAC;EACrE,OAAOI,WAAW;AACpB;AAEA,SAASD,YAAY,CAACJ,QAA4B,EAAEE,sBAAiC,EAAE;EACrF,MAAMK,WAA8B,GAAG,CAAC,CAAC;E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;EAExC,MAAMR,OAAO,CAACC,GAAG,CACftB,QAAQ,CAACiB,GAAG,CAAC,MAAOR,OAAO,IAAK;IAC9B,MAAMkB,GAAG,GAAGlB,OAAO,CAACkB,GAAG;IACvB,MAAMG,MAAM,GAAG,MAAM7B,kBAAkB,CAAC8B,4BAA4B,CAACJ,GAAG,CAAC;IACzE,MAAMK,mBAAmB,GAAGF,MAAM,CAACG,qBAAqB,CAACC,eAAe,EAAE;IAC1E,MAAMC,gBAAgB,GAAGL,MAAM,CAACM,aAAa,CAACC,eAAe,CAAC,MAAM,CAAC,CAACH,eAAe,EAAE;IACvF,MAAMI,YAAY,GAAI,GAAEN,mBAAoB,IAAGG,gBAAiB,EAAC;IACjE,IAAI,CAACN,UAAU,CAACS,YAAY,CAAC,EAAE;MAC7BT,UAAU,CAACS,YAAY,CAAC,GAAG,EAAE;IAC/B;IACAT,UAAU,CAACS,YAAY,CAAC,CAAC1B,IAAI,CAACH,OAAO,CAAC;EACxC,CAAC,CAAC,CACH;EACD,OAAO8B,mBAAmB,CAACV,UAAU,CAAC;AACxC;AAEA,SAASU,mBAAmB,CAACV,UAA6B,EAAE;EAC1D,MAAMW,MAAyB,GAAGzB,MAAM,CAACC,MAAM,CAACa,UAAU,CAAC,CAACY,MAAM,CAAC,CAACC,GAAG,EAAE1C,QAAQ,KAAK;IACpF,MAAM2C,OAAO,GAAG3C,QAAQ,CAAC,CAAC,CAAC,CAACwB,EAAE;IAC9BkB,GAAG,CAACC,OAAO,CAAC,GAAG3C,QAAQ;IACvB,OAAO0C,GAAG;EACZ,CAAC,EAAE,CAAC,CAAC,CAAC;EACN,OAAOF,MAAM;AACf"}
|
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.devServerSchema = devServerSchema;
|
|
7
|
-
|
|
8
7
|
function _client() {
|
|
9
8
|
const data = require("@apollo/client");
|
|
10
|
-
|
|
11
9
|
_client = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
// TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.
|
|
19
15
|
function devServerSchema(bundler) {
|
|
20
16
|
return {
|
|
@@ -34,14 +30,13 @@ function devServerSchema(bundler) {
|
|
|
34
30
|
// This is a bit of a hack to get the requested id. it assumes the variable name of
|
|
35
31
|
// the gotHost.get query is "id".
|
|
36
32
|
// see it in scopes/component/component/component.graphql.ts
|
|
37
|
-
const requestedId = context.body.variables.id;
|
|
33
|
+
const requestedId = context.body.variables.id;
|
|
34
|
+
// if we ask for specific id with specific version it means we want to fetch if from scope
|
|
38
35
|
// so don't return the server url
|
|
39
36
|
// see https://github.com/teambit/bit/issues/5328
|
|
40
|
-
|
|
41
37
|
if (requestedId && requestedId.includes('@')) {
|
|
42
38
|
return {};
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
const componentServer = bundler.getComponentServer(component);
|
|
46
41
|
if (!componentServer) return {};
|
|
47
42
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["devServerSchema","bundler","typeDefs","gql","resolvers","Component","server","component","args","context","requestedId","body","variables","id","includes","componentServer","getComponentServer","env","envRuntime","url"],"sources":["dev-server.graphql.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport { gql } from '@apollo/client';\n\nimport { BundlerMain } from './bundler.main.runtime';\n\n// TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.\nexport function devServerSchema(bundler: BundlerMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n server: ComponentServer\n }\n\n type ComponentServer {\n env: String\n url: String\n }\n `,\n resolvers: {\n Component: {\n server: (component: Component, args, context) => {\n // This is a bit of a hack to get the requested id. it assumes the variable name of\n // the gotHost.get query is \"id\".\n // see it in scopes/component/component/component.graphql.ts\n const requestedId = context.body.variables.id;\n // if we ask for specific id with specific version it means we want to fetch if from scope\n // so don't return the server url\n // see https://github.com/teambit/bit/issues/5328\n if (requestedId && requestedId.includes('@')) {\n return {};\n }\n const componentServer = bundler.getComponentServer(component);\n if (!componentServer) return {};\n\n return {\n env: componentServer.context.envRuntime.id,\n url: componentServer.url,\n };\n },\n },\n },\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["devServerSchema","bundler","typeDefs","gql","resolvers","Component","server","component","args","context","requestedId","body","variables","id","includes","componentServer","getComponentServer","env","envRuntime","url"],"sources":["dev-server.graphql.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Schema } from '@teambit/graphql';\nimport { gql } from '@apollo/client';\n\nimport { BundlerMain } from './bundler.main.runtime';\n\n// TODO: this has to be refactored to the Preview aspect. with the entire preview logic here.\nexport function devServerSchema(bundler: BundlerMain): Schema {\n return {\n typeDefs: gql`\n extend type Component {\n server: ComponentServer\n }\n\n type ComponentServer {\n env: String\n url: String\n }\n `,\n resolvers: {\n Component: {\n server: (component: Component, args, context) => {\n // This is a bit of a hack to get the requested id. it assumes the variable name of\n // the gotHost.get query is \"id\".\n // see it in scopes/component/component/component.graphql.ts\n const requestedId = context.body.variables.id;\n // if we ask for specific id with specific version it means we want to fetch if from scope\n // so don't return the server url\n // see https://github.com/teambit/bit/issues/5328\n if (requestedId && requestedId.includes('@')) {\n return {};\n }\n const componentServer = bundler.getComponentServer(component);\n if (!componentServer) return {};\n\n return {\n env: componentServer.context.envRuntime.id,\n url: componentServer.url,\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;AACO,SAASA,eAAe,CAACC,OAAoB,EAAU;EAC5D,OAAO;IACLC,QAAQ,EAAE,IAAAC,aAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTC,MAAM,EAAE,CAACC,SAAoB,EAAEC,IAAI,EAAEC,OAAO,KAAK;UAC/C;UACA;UACA;UACA,MAAMC,WAAW,GAAGD,OAAO,CAACE,IAAI,CAACC,SAAS,CAACC,EAAE;UAC7C;UACA;UACA;UACA,IAAIH,WAAW,IAAIA,WAAW,CAACI,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5C,OAAO,CAAC,CAAC;UACX;UACA,MAAMC,eAAe,GAAGd,OAAO,CAACe,kBAAkB,CAACT,SAAS,CAAC;UAC7D,IAAI,CAACQ,eAAe,EAAE,OAAO,CAAC,CAAC;UAE/B,OAAO;YACLE,GAAG,EAAEF,eAAe,CAACN,OAAO,CAACS,UAAU,CAACL,EAAE;YAC1CM,GAAG,EAAEJ,eAAe,CAACI;UACvB,CAAC;QACH;MACF;IACF;EACF,CAAC;AACH"}
|
|
@@ -1,106 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.DevServerService = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _lodash() {
|
|
25
18
|
const data = require("lodash");
|
|
26
|
-
|
|
27
19
|
_lodash = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _react() {
|
|
35
25
|
const data = _interopRequireDefault(require("react"));
|
|
36
|
-
|
|
37
26
|
_react = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _ink() {
|
|
45
32
|
const data = require("ink");
|
|
46
|
-
|
|
47
33
|
_ink = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _cliHighlight() {
|
|
55
39
|
const data = _interopRequireDefault(require("cli-highlight"));
|
|
56
|
-
|
|
57
40
|
_cliHighlight = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _path() {
|
|
65
46
|
const data = require("path");
|
|
66
|
-
|
|
67
47
|
_path = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _componentServer() {
|
|
75
53
|
const data = require("./component-server");
|
|
76
|
-
|
|
77
54
|
_componentServer = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _dedupEnvs() {
|
|
85
60
|
const data = require("./dedup-envs");
|
|
86
|
-
|
|
87
61
|
_dedupEnvs = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
function _getEntry() {
|
|
95
67
|
const data = require("./get-entry");
|
|
96
|
-
|
|
97
68
|
_getEntry = function () {
|
|
98
69
|
return data;
|
|
99
70
|
};
|
|
100
|
-
|
|
101
71
|
return data;
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
class DevServerService {
|
|
105
74
|
constructor(
|
|
106
75
|
/**
|
|
@@ -116,7 +85,6 @@ class DevServerService {
|
|
|
116
85
|
this.runtimeSlot = runtimeSlot;
|
|
117
86
|
(0, _defineProperty2().default)(this, "name", 'dev server');
|
|
118
87
|
}
|
|
119
|
-
|
|
120
88
|
async render(env, context) {
|
|
121
89
|
const descriptor = await this.getDescriptor(env, context);
|
|
122
90
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
@@ -131,7 +99,6 @@ class DevServerService {
|
|
|
131
99
|
ignoreIllegals: true
|
|
132
100
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
133
101
|
}
|
|
134
|
-
|
|
135
102
|
async getDescriptor(environment, context) {
|
|
136
103
|
if (!environment.env.getDevServer || !context) return undefined;
|
|
137
104
|
const mergedContext = await this.buildContext(context[0], []);
|
|
@@ -143,7 +110,9 @@ class DevServerService {
|
|
|
143
110
|
config: devServer.displayConfig ? devServer.displayConfig() : '',
|
|
144
111
|
version: devServer.version ? devServer.version() : '?'
|
|
145
112
|
};
|
|
146
|
-
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// async run(context: ExecutionContext): Promise<ComponentServer[]> {
|
|
147
116
|
// const devServerContext = await this.buildContext(context);
|
|
148
117
|
// const devServer: DevServer = context.env.getDevServer(devServerContext);
|
|
149
118
|
// const port = await selectPort();
|
|
@@ -151,7 +120,6 @@ class DevServerService {
|
|
|
151
120
|
// return new ComponentServer(this.pubsub, context, port, devServer);
|
|
152
121
|
// }
|
|
153
122
|
|
|
154
|
-
|
|
155
123
|
async runOnce(contexts, {
|
|
156
124
|
dedicatedEnvDevServers
|
|
157
125
|
}) {
|
|
@@ -165,22 +133,18 @@ class DevServerService {
|
|
|
165
133
|
}));
|
|
166
134
|
return servers;
|
|
167
135
|
}
|
|
168
|
-
|
|
169
136
|
mergeContext() {}
|
|
170
|
-
|
|
171
137
|
getComponentsFromContexts(contexts) {
|
|
172
138
|
return (0, _lodash().flatten)(contexts.map(context => {
|
|
173
139
|
return context.components;
|
|
174
140
|
}));
|
|
175
141
|
}
|
|
142
|
+
|
|
176
143
|
/**
|
|
177
144
|
* builds the execution context for the dev server.
|
|
178
145
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
146
|
async buildContext(context, additionalContexts = []) {
|
|
182
147
|
var _context$envRuntime$e;
|
|
183
|
-
|
|
184
148
|
context.relatedContexts = additionalContexts.map(ctx => ctx.envDefinition.id);
|
|
185
149
|
context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));
|
|
186
150
|
const peers = await this.dependencyResolver.getPeerDependenciesListFromEnv(context.env);
|
|
@@ -195,9 +159,7 @@ class DevServerService {
|
|
|
195
159
|
aliasHostDependencies: true
|
|
196
160
|
});
|
|
197
161
|
}
|
|
198
|
-
|
|
199
162
|
}
|
|
200
|
-
|
|
201
163
|
exports.DevServerService = DevServerService;
|
|
202
164
|
|
|
203
165
|
//# sourceMappingURL=dev-server.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DevServerService","constructor","pubsub","dependencyResolver","runtimeSlot","render","env","context","descriptor","getDescriptor","id","displayName","version","highlight","config","language","ignoreIllegals","environment","getDevServer","undefined","mergedContext","buildContext","devServer","icon","displayConfig","runOnce","contexts","dedicatedEnvDevServers","groupedEnvs","dedupEnvs","servers","Promise","all","Object","entries","map","contextList","mainContext","find","envDefinition","additionalContexts","filter","devServerContext","envRuntime","ComponentServer","mergeContext","getComponentsFromContexts","flatten","components","relatedContexts","ctx","concat","peers","getPeerDependenciesListFromEnv","hostRootDir","envAspectDefinition","aspectPath","assign","entry","getEntry","rootPath","publicPath","sep","hostDependencies","aliasHostDependencies"],"sources":["dev-server.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { flatten } from 'lodash';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport highlight from 'cli-highlight';\nimport { sep } from 'path';\nimport { BrowserRuntimeSlot } from './bundler.main.runtime';\nimport { ComponentServer } from './component-server';\nimport { dedupEnvs } from './dedup-envs';\nimport { DevServer } from './dev-server';\nimport { DevServerContext } from './dev-server-context';\nimport { getEntry } from './get-entry';\n\nexport type DevServerServiceOptions = { dedicatedEnvDevServers?: string[] };\n\nexport type DevServerDescriptor = {\n /**\n * id of the dev server (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the dev server (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured dev server.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class DevServerService implements EnvService<ComponentServer, DevServerDescriptor> {\n name = 'dev server';\n\n constructor(\n /**\n * browser runtime slot\n */\n private pubsub: PubsubMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n /**\n * browser runtime slot\n */\n private runtimeSlot: BrowserRuntimeSlot\n ) {}\n\n async render(env: EnvDefinition, context: ExecutionContext[]) {\n const descriptor = await this.getDescriptor(env, context);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured dev server: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n dev server config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n async getDescriptor(\n environment: EnvDefinition,\n context?: ExecutionContext[]\n ): Promise<DevServerDescriptor | undefined> {\n if (!environment.env.getDevServer || !context) return undefined;\n const mergedContext = await this.buildContext(context[0], []);\n const devServer: DevServer = environment.env.getDevServer(mergedContext);\n\n return {\n id: devServer.id || '',\n displayName: devServer.displayName || '',\n icon: devServer.icon || '',\n config: devServer.displayConfig ? devServer.displayConfig() : '',\n version: devServer.version ? devServer.version() : '?',\n };\n }\n\n // async run(context: ExecutionContext): Promise<ComponentServer[]> {\n // const devServerContext = await this.buildContext(context);\n // const devServer: DevServer = context.env.getDevServer(devServerContext);\n // const port = await selectPort();\n // // TODO: refactor to replace with a component server instance.\n // return new ComponentServer(this.pubsub, context, port, devServer);\n // }\n\n async runOnce(\n contexts: ExecutionContext[],\n { dedicatedEnvDevServers }: DevServerServiceOptions\n ): Promise<ComponentServer[]> {\n const groupedEnvs = await dedupEnvs(contexts, this.dependencyResolver, dedicatedEnvDevServers);\n\n const servers = await Promise.all(\n Object.entries(groupedEnvs).map(async ([id, contextList]) => {\n const mainContext = contextList.find((context) => context.envDefinition.id === id) || contextList[0];\n const additionalContexts = contextList.filter((context) => context.envDefinition.id !== id);\n\n const devServerContext = await this.buildContext(mainContext, additionalContexts);\n const devServer: DevServer = await devServerContext.envRuntime.env.getDevServer(devServerContext);\n\n return new ComponentServer(this.pubsub, devServerContext, [3300, 3400], devServer);\n })\n );\n\n return servers;\n }\n\n mergeContext() {}\n\n private getComponentsFromContexts(contexts: ExecutionContext[]) {\n return flatten(\n contexts.map((context) => {\n return context.components;\n })\n );\n }\n\n /**\n * builds the execution context for the dev server.\n */\n private async buildContext(\n context: ExecutionContext,\n additionalContexts: ExecutionContext[] = []\n ): Promise<DevServerContext> {\n context.relatedContexts = additionalContexts.map((ctx) => ctx.envDefinition.id);\n context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));\n const peers = await this.dependencyResolver.getPeerDependenciesListFromEnv(context.env);\n const hostRootDir = context.envRuntime.envAspectDefinition?.aspectPath;\n\n return Object.assign(context, {\n entry: await getEntry(context, this.runtimeSlot),\n // don't start with a leading \"/\" because it generates errors on Windows\n rootPath: `preview/${context.envRuntime.id}`,\n publicPath: `${sep}public`,\n hostRootDir,\n hostDependencies: peers,\n aliasHostDependencies: true,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAA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AACD,GAA/D,CAApB;IACA,MAAMgD,WAAW,4BAAG/C,OAAO,CAACoC,UAAR,CAAmBY,mBAAtB,0DAAG,sBAAwCC,UAA5D;IAEA,OAAOvB,MAAM,CAACwB,MAAP,CAAclD,OAAd,EAAuB;MAC5BmD,KAAK,EAAE,MAAM,IAAAC,oBAAA,EAASpD,OAAT,EAAkB,KAAKH,WAAvB,CADe;MAE5B;MACAwD,QAAQ,EAAG,WAAUrD,OAAO,CAACoC,UAAR,CAAmBjC,EAAG,EAHf;MAI5BmD,UAAU,EAAG,GAAEC,WAAI,QAJS;MAK5BR,WAL4B;MAM5BS,gBAAgB,EAAEX,KANU;MAO5BY,qBAAqB,EAAE;IAPK,CAAvB,CAAP;EASD;;AApHuF"}
|
|
1
|
+
{"version":3,"names":["DevServerService","constructor","pubsub","dependencyResolver","runtimeSlot","render","env","context","descriptor","getDescriptor","id","displayName","version","highlight","config","language","ignoreIllegals","environment","getDevServer","undefined","mergedContext","buildContext","devServer","icon","displayConfig","runOnce","contexts","dedicatedEnvDevServers","groupedEnvs","dedupEnvs","servers","Promise","all","Object","entries","map","contextList","mainContext","find","envDefinition","additionalContexts","filter","devServerContext","envRuntime","ComponentServer","mergeContext","getComponentsFromContexts","flatten","components","relatedContexts","ctx","concat","peers","getPeerDependenciesListFromEnv","hostRootDir","envAspectDefinition","aspectPath","assign","entry","getEntry","rootPath","publicPath","sep","hostDependencies","aliasHostDependencies"],"sources":["dev-server.service.tsx"],"sourcesContent":["import { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';\nimport { PubsubMain } from '@teambit/pubsub';\nimport { flatten } from 'lodash';\nimport React from 'react';\nimport { Text, Newline } from 'ink';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport highlight from 'cli-highlight';\nimport { sep } from 'path';\nimport { BrowserRuntimeSlot } from './bundler.main.runtime';\nimport { ComponentServer } from './component-server';\nimport { dedupEnvs } from './dedup-envs';\nimport { DevServer } from './dev-server';\nimport { DevServerContext } from './dev-server-context';\nimport { getEntry } from './get-entry';\n\nexport type DevServerServiceOptions = { dedicatedEnvDevServers?: string[] };\n\nexport type DevServerDescriptor = {\n /**\n * id of the dev server (e.g. jest/mocha)\n */\n id: string;\n\n /**\n * display name of the dev server (e.g. Jest / Mocha)\n */\n displayName: string;\n\n /**\n * icon of the configured dev server.\n */\n icon: string;\n\n /**\n * string containing the config for display.\n */\n config: string;\n\n version?: string;\n};\n\nexport class DevServerService implements EnvService<ComponentServer, DevServerDescriptor> {\n name = 'dev server';\n\n constructor(\n /**\n * browser runtime slot\n */\n private pubsub: PubsubMain,\n\n private dependencyResolver: DependencyResolverMain,\n\n /**\n * browser runtime slot\n */\n private runtimeSlot: BrowserRuntimeSlot\n ) {}\n\n async render(env: EnvDefinition, context: ExecutionContext[]) {\n const descriptor = await this.getDescriptor(env, context);\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured dev server: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text underline color=\"cyan\">\n dev server config:\n </Text>\n <Newline />\n <Text>\n {/* refactor a separate component which highlights for cli */}\n {highlight(descriptor?.config || '', { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n async getDescriptor(\n environment: EnvDefinition,\n context?: ExecutionContext[]\n ): Promise<DevServerDescriptor | undefined> {\n if (!environment.env.getDevServer || !context) return undefined;\n const mergedContext = await this.buildContext(context[0], []);\n const devServer: DevServer = environment.env.getDevServer(mergedContext);\n\n return {\n id: devServer.id || '',\n displayName: devServer.displayName || '',\n icon: devServer.icon || '',\n config: devServer.displayConfig ? devServer.displayConfig() : '',\n version: devServer.version ? devServer.version() : '?',\n };\n }\n\n // async run(context: ExecutionContext): Promise<ComponentServer[]> {\n // const devServerContext = await this.buildContext(context);\n // const devServer: DevServer = context.env.getDevServer(devServerContext);\n // const port = await selectPort();\n // // TODO: refactor to replace with a component server instance.\n // return new ComponentServer(this.pubsub, context, port, devServer);\n // }\n\n async runOnce(\n contexts: ExecutionContext[],\n { dedicatedEnvDevServers }: DevServerServiceOptions\n ): Promise<ComponentServer[]> {\n const groupedEnvs = await dedupEnvs(contexts, this.dependencyResolver, dedicatedEnvDevServers);\n\n const servers = await Promise.all(\n Object.entries(groupedEnvs).map(async ([id, contextList]) => {\n const mainContext = contextList.find((context) => context.envDefinition.id === id) || contextList[0];\n const additionalContexts = contextList.filter((context) => context.envDefinition.id !== id);\n\n const devServerContext = await this.buildContext(mainContext, additionalContexts);\n const devServer: DevServer = await devServerContext.envRuntime.env.getDevServer(devServerContext);\n\n return new ComponentServer(this.pubsub, devServerContext, [3300, 3400], devServer);\n })\n );\n\n return servers;\n }\n\n mergeContext() {}\n\n private getComponentsFromContexts(contexts: ExecutionContext[]) {\n return flatten(\n contexts.map((context) => {\n return context.components;\n })\n );\n }\n\n /**\n * builds the execution context for the dev server.\n */\n private async buildContext(\n context: ExecutionContext,\n additionalContexts: ExecutionContext[] = []\n ): Promise<DevServerContext> {\n context.relatedContexts = additionalContexts.map((ctx) => ctx.envDefinition.id);\n context.components = context.components.concat(this.getComponentsFromContexts(additionalContexts));\n const peers = await this.dependencyResolver.getPeerDependenciesListFromEnv(context.env);\n const hostRootDir = context.envRuntime.envAspectDefinition?.aspectPath;\n\n return Object.assign(context, {\n entry: await getEntry(context, this.runtimeSlot),\n // don't start with a leading \"/\" because it generates errors on Windows\n rootPath: `preview/${context.envRuntime.id}`,\n publicPath: `${sep}public`,\n hostRootDir,\n hostDependencies: peers,\n aliasHostDependencies: true,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA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W,CAAC;MAChD;MACAwD,QAAQ,EAAG,WAAUrD,OAAO,CAACoC,UAAU,CAACjC,EAAG,EAAC;MAC5CmD,UAAU,EAAG,GAAEC,WAAI,QAAO;MAC1BR,WAAW;MACXS,gBAAgB,EAAEX,KAAK;MACvBY,qBAAqB,EAAE;IACzB,CAAC,CAAC;EACJ;AACF;AAAC"}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ComponentsServerStartedEvent = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _pubsub() {
|
|
21
16
|
const data = require("@teambit/pubsub");
|
|
22
|
-
|
|
23
17
|
_pubsub = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
/* eslint-disable max-classes-per-file */
|
|
23
|
+
|
|
31
24
|
class ComponentsServerStartedEventData {
|
|
32
25
|
constructor(componentsServer, context, hostname, port) {
|
|
33
26
|
this.componentsServer = componentsServer;
|
|
@@ -35,9 +28,7 @@ class ComponentsServerStartedEventData {
|
|
|
35
28
|
this.hostname = hostname;
|
|
36
29
|
this.port = port;
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
class ComponentsServerStartedEvent extends _pubsub().BitBaseEvent {
|
|
42
33
|
constructor(timestamp, componentsServer, context, hostname, port) {
|
|
43
34
|
super(ComponentsServerStartedEvent.TYPE, '0.0.1', timestamp, new ComponentsServerStartedEventData(componentsServer, context, hostname, port));
|
|
@@ -47,9 +38,7 @@ class ComponentsServerStartedEvent extends _pubsub().BitBaseEvent {
|
|
|
47
38
|
this.hostname = hostname;
|
|
48
39
|
this.port = port;
|
|
49
40
|
}
|
|
50
|
-
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
exports.ComponentsServerStartedEvent = ComponentsServerStartedEvent;
|
|
54
43
|
(0, _defineProperty2().default)(ComponentsServerStartedEvent, "TYPE", 'components-server-started');
|
|
55
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentsServerStartedEventData","constructor","componentsServer","context","hostname","port","ComponentsServerStartedEvent","BitBaseEvent","timestamp","TYPE"],"sources":["components-server-started-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass ComponentsServerStartedEventData {\n constructor(readonly componentsServer, readonly context, readonly hostname, readonly port) {}\n}\n\nexport class ComponentsServerStartedEvent extends BitBaseEvent<ComponentsServerStartedEventData> {\n static readonly TYPE = 'components-server-started';\n\n constructor(readonly timestamp, readonly componentsServer, readonly context, readonly hostname, readonly port) {\n super(\n ComponentsServerStartedEvent.TYPE,\n '0.0.1',\n timestamp,\n new ComponentsServerStartedEventData(componentsServer, context, hostname, port)\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentsServerStartedEventData","constructor","componentsServer","context","hostname","port","ComponentsServerStartedEvent","BitBaseEvent","timestamp","TYPE"],"sources":["components-server-started-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\n\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass ComponentsServerStartedEventData {\n constructor(readonly componentsServer, readonly context, readonly hostname, readonly port) {}\n}\n\nexport class ComponentsServerStartedEvent extends BitBaseEvent<ComponentsServerStartedEventData> {\n static readonly TYPE = 'components-server-started';\n\n constructor(readonly timestamp, readonly componentsServer, readonly context, readonly hostname, readonly port) {\n super(\n ComponentsServerStartedEvent.TYPE,\n '0.0.1',\n timestamp,\n new ComponentsServerStartedEventData(componentsServer, context, hostname, port)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAFA;;AAIA,MAAMA,gCAAgC,CAAC;EACrCC,WAAW,CAAUC,gBAAgB,EAAWC,OAAO,EAAWC,QAAQ,EAAWC,IAAI,EAAE;IAAA,KAAtEH,gBAAgB,GAAhBA,gBAAgB;IAAA,KAAWC,OAAO,GAAPA,OAAO;IAAA,KAAWC,QAAQ,GAARA,QAAQ;IAAA,KAAWC,IAAI,GAAJA,IAAI;EAAG;AAC9F;AAEO,MAAMC,4BAA4B,SAASC,sBAAY,CAAmC;EAG/FN,WAAW,CAAUO,SAAS,EAAWN,gBAAgB,EAAWC,OAAO,EAAWC,QAAQ,EAAWC,IAAI,EAAE;IAC7G,KAAK,CACHC,4BAA4B,CAACG,IAAI,EACjC,OAAO,EACPD,SAAS,EACT,IAAIR,gCAAgC,CAACE,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,IAAI,CAAC,CAChF;IAAC,KANiBG,SAAS,GAATA,SAAS;IAAA,KAAWN,gBAAgB,GAAhBA,gBAAgB;IAAA,KAAWC,OAAO,GAAPA,OAAO;IAAA,KAAWC,QAAQ,GAARA,QAAQ;IAAA,KAAWC,IAAI,GAAJA,IAAI;EAO7G;AACF;AAAC;AAAA,gCAXYC,4BAA4B,UAChB,2BAA2B"}
|
package/dist/events/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _componentsServerStartedEvent = require("./components-server-started-event");
|
|
8
|
-
|
|
9
7
|
Object.keys(_componentsServerStartedEvent).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _componentsServerStartedEvent[key]) return;
|
package/dist/events/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './components-server-started-event';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './components-server-started-event';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BindError","Error"],"sources":["bind-error.ts"],"sourcesContent":["export class BindError extends Error {}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["BindError","Error"],"sources":["bind-error.ts"],"sourcesContent":["export class BindError extends Error {}\n"],"mappings":";;;;;;AAAO,MAAMA,SAAS,SAASC,KAAK,CAAC;AAAE"}
|
package/dist/exceptions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { BindError } from './bind-error';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { BindError } from './bind-error';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/get-entry.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.promise.js");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.getEntry = getEntry;
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* computes the bundler entry.
|
|
14
11
|
*/
|
package/dist/get-entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getEntry","context","runtimeSlot","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat"],"sources":["get-entry.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport { PathOsBased } from '@teambit/legacy/dist/utils/path';\n\nimport { BrowserRuntimeSlot } from './bundler.main.runtime';\n\nexport type ComponentDir = {\n componentDir?: (\n componentId: ComponentID,\n bitMapOptions?: GetBitMapComponentOptions,\n options?: { relative: boolean }\n ) => PathOsBased | undefined;\n};\n\n/**\n * computes the bundler entry.\n */\nexport async function getEntry(context: ExecutionContext, runtimeSlot: BrowserRuntimeSlot): Promise<string[]> {\n // TODO: refactor this away from here and use computePaths instead\n const slotEntries = await Promise.all(\n runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))\n );\n\n const slotPaths = slotEntries.reduce((acc, current) => {\n acc = acc.concat(current);\n return acc;\n });\n\n return slotPaths;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getEntry","context","runtimeSlot","slotEntries","Promise","all","values","map","browserRuntime","entry","slotPaths","reduce","acc","current","concat"],"sources":["get-entry.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { ExecutionContext } from '@teambit/envs';\nimport { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport { PathOsBased } from '@teambit/legacy/dist/utils/path';\n\nimport { BrowserRuntimeSlot } from './bundler.main.runtime';\n\nexport type ComponentDir = {\n componentDir?: (\n componentId: ComponentID,\n bitMapOptions?: GetBitMapComponentOptions,\n options?: { relative: boolean }\n ) => PathOsBased | undefined;\n};\n\n/**\n * computes the bundler entry.\n */\nexport async function getEntry(context: ExecutionContext, runtimeSlot: BrowserRuntimeSlot): Promise<string[]> {\n // TODO: refactor this away from here and use computePaths instead\n const slotEntries = await Promise.all(\n runtimeSlot.values().map(async (browserRuntime) => browserRuntime.entry(context))\n );\n\n const slotPaths = slotEntries.reduce((acc, current) => {\n acc = acc.concat(current);\n return acc;\n });\n\n return slotPaths;\n}\n"],"mappings":";;;;;;;;AAeA;AACA;AACA;AACO,eAAeA,QAAQ,CAACC,OAAyB,EAAEC,WAA+B,EAAqB;EAC5G;EACA,MAAMC,WAAW,GAAG,MAAMC,OAAO,CAACC,GAAG,CACnCH,WAAW,CAACI,MAAM,EAAE,CAACC,GAAG,CAAC,MAAOC,cAAc,IAAKA,cAAc,CAACC,KAAK,CAACR,OAAO,CAAC,CAAC,CAClF;EAED,MAAMS,SAAS,GAAGP,WAAW,CAACQ,MAAM,CAAC,CAACC,GAAG,EAAEC,OAAO,KAAK;IACrDD,GAAG,GAAGA,GAAG,CAACE,MAAM,CAACD,OAAO,CAAC;IACzB,OAAOD,GAAG;EACZ,CAAC,CAAC;EAEF,OAAOF,SAAS;AAClB"}
|
package/dist/index.js
CHANGED
|
@@ -138,79 +138,56 @@ Object.defineProperty(exports, "Target", {
|
|
|
138
138
|
return _bundlerContext().Target;
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
|
-
|
|
142
141
|
function _devServer() {
|
|
143
142
|
const data = require("./dev-server");
|
|
144
|
-
|
|
145
143
|
_devServer = function () {
|
|
146
144
|
return data;
|
|
147
145
|
};
|
|
148
|
-
|
|
149
146
|
return data;
|
|
150
147
|
}
|
|
151
|
-
|
|
152
148
|
function _devServerContext() {
|
|
153
149
|
const data = require("./dev-server-context");
|
|
154
|
-
|
|
155
150
|
_devServerContext = function () {
|
|
156
151
|
return data;
|
|
157
152
|
};
|
|
158
|
-
|
|
159
153
|
return data;
|
|
160
154
|
}
|
|
161
|
-
|
|
162
155
|
function _bundlerContext() {
|
|
163
156
|
const data = require("./bundler-context");
|
|
164
|
-
|
|
165
157
|
_bundlerContext = function () {
|
|
166
158
|
return data;
|
|
167
159
|
};
|
|
168
|
-
|
|
169
160
|
return data;
|
|
170
161
|
}
|
|
171
|
-
|
|
172
162
|
function _bundler() {
|
|
173
163
|
const data = require("./bundler");
|
|
174
|
-
|
|
175
164
|
_bundler = function () {
|
|
176
165
|
return data;
|
|
177
166
|
};
|
|
178
|
-
|
|
179
167
|
return data;
|
|
180
168
|
}
|
|
181
|
-
|
|
182
169
|
function _bundler2() {
|
|
183
170
|
const data = require("./bundler.aspect");
|
|
184
|
-
|
|
185
171
|
_bundler2 = function () {
|
|
186
172
|
return data;
|
|
187
173
|
};
|
|
188
|
-
|
|
189
174
|
return data;
|
|
190
175
|
}
|
|
191
|
-
|
|
192
176
|
function _getEntry() {
|
|
193
177
|
const data = require("./get-entry");
|
|
194
|
-
|
|
195
178
|
_getEntry = function () {
|
|
196
179
|
return data;
|
|
197
180
|
};
|
|
198
|
-
|
|
199
181
|
return data;
|
|
200
182
|
}
|
|
201
|
-
|
|
202
183
|
function _componentServer() {
|
|
203
184
|
const data = require("./component-server");
|
|
204
|
-
|
|
205
185
|
_componentServer = function () {
|
|
206
186
|
return data;
|
|
207
187
|
};
|
|
208
|
-
|
|
209
188
|
return data;
|
|
210
189
|
}
|
|
211
|
-
|
|
212
190
|
var _events = require("./events");
|
|
213
|
-
|
|
214
191
|
Object.keys(_events).forEach(function (key) {
|
|
215
192
|
if (key === "default" || key === "__esModule") return;
|
|
216
193
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { DevServer } from './dev-server';\nexport { DevServerContext } from './dev-server-context';\nexport {\n BundlerContext,\n Target,\n ModuleTarget,\n HtmlConfig as BundlerHtmlConfig,\n EntryMap as BundlerEntryMap,\n Entry as BundlerEntry,\n MetaData as BundlerContextMetaData,\n} from './bundler-context';\nexport { Bundler, BundlerResult, BundlerMode, Asset, ChunksAssetsMap, EntriesAssetsMap, EntryAssets } from './bundler';\nexport type { BundlerMain } from './bundler.main.runtime';\nexport { BundlerAspect } from './bundler.aspect';\nexport { ComponentDir } from './get-entry';\nexport { ComponentServer } from './component-server';\nexport * from './events';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { DevServer } from './dev-server';\nexport { DevServerContext } from './dev-server-context';\nexport {\n BundlerContext,\n Target,\n ModuleTarget,\n HtmlConfig as BundlerHtmlConfig,\n EntryMap as BundlerEntryMap,\n Entry as BundlerEntry,\n MetaData as BundlerContextMetaData,\n} from './bundler-context';\nexport { Bundler, BundlerResult, BundlerMode, Asset, ChunksAssetsMap, EntriesAssetsMap, EntryAssets } from './bundler';\nexport type { BundlerMain } from './bundler.main.runtime';\nexport { BundlerAspect } from './bundler.aspect';\nexport { ComponentDir } from './get-entry';\nexport { ComponentServer } from './component-server';\nexport * from './events';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AASA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/dist/select-port.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.promise.js");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.selectPort = selectPort;
|
|
9
|
-
|
|
10
8
|
function _toolboxNetwork() {
|
|
11
9
|
const data = require("@teambit/toolbox.network.get-port");
|
|
12
|
-
|
|
13
10
|
_toolboxNetwork = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
/**
|
|
21
16
|
* get an available port between range 3000 to 3200 or from port range
|
|
22
17
|
*/
|
package/dist/select-port.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["selectPort","range","Port","getPortFromRange"],"sources":["select-port.ts"],"sourcesContent":["import { Port } from '@teambit/toolbox.network.get-port';\n\n/**\n * get an available port between range 3000 to 3200 or from port range\n */\nexport async function selectPort(range: number[] | number): Promise<number> {\n return Port.getPortFromRange(range);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["selectPort","range","Port","getPortFromRange"],"sources":["select-port.ts"],"sourcesContent":["import { Port } from '@teambit/toolbox.network.get-port';\n\n/**\n * get an available port between range 3000 to 3200 or from port range\n */\nexport async function selectPort(range: number[] | number): Promise<number> {\n return Port.getPortFromRange(range);\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACO,eAAeA,UAAU,CAACC,KAAwB,EAAmB;EAC1E,OAAOC,sBAAI,CAACC,gBAAgB,CAACF,KAAK,CAAC;AACrC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/bundler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.883",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/compilation/bundler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "bundler",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.883"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"cli-highlight": "2.1.9",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"@babel/runtime": "7.12.18",
|
|
16
16
|
"core-js": "^3.0.0",
|
|
17
17
|
"@teambit/harmony": "0.3.3",
|
|
18
|
-
"@teambit/envs": "0.0.
|
|
19
|
-
"@teambit/builder": "0.0.
|
|
20
|
-
"@teambit/component": "0.0.
|
|
18
|
+
"@teambit/envs": "0.0.883",
|
|
19
|
+
"@teambit/builder": "0.0.883",
|
|
20
|
+
"@teambit/component": "0.0.883",
|
|
21
21
|
"@teambit/cli": "0.0.591",
|
|
22
|
-
"@teambit/dependency-resolver": "0.0.
|
|
23
|
-
"@teambit/graphql": "0.0.
|
|
24
|
-
"@teambit/pubsub": "0.0.
|
|
22
|
+
"@teambit/dependency-resolver": "0.0.883",
|
|
23
|
+
"@teambit/graphql": "0.0.883",
|
|
24
|
+
"@teambit/pubsub": "0.0.883",
|
|
25
25
|
"@teambit/toolbox.network.get-port": "0.0.120"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@0.0.883/dist/bundler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.compilation_bundler@0.0.883/dist/bundler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|