@teambit/bundler 1.0.614 → 1.0.616
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/dedup-envs.js
CHANGED
@@ -43,6 +43,11 @@ function getEnvId(context, dedicatedServers) {
|
|
43
43
|
if (dedicatedServers?.includes(id)) {
|
44
44
|
return context.id;
|
45
45
|
}
|
46
|
+
|
47
|
+
// Happen for envs that are not implementing preview
|
48
|
+
if (!context.env?.getDevEnvId) {
|
49
|
+
return undefined;
|
50
|
+
}
|
46
51
|
return context.env?.getDevEnvId(context);
|
47
52
|
}
|
48
53
|
async function groupByPeersHash(contexts, dependencyResolver) {
|
package/dist/dedup-envs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","hasRootComponents","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","peersHash","byLifecycleType","hashNameVersion","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 hasRootComponents = dependencyResolver.hasRootComponents();\n // Do not split envs by peers if root components is enabled as it should be already handled by the package manager\n // this will improve the performance of the dev server when root components is enabled\n const finalGroups = hasRootComponents ? idsGroups : 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, { envId: context.id });\n const peersHash = policy.byLifecycleType('peer').hashNameVersion();\n if (!peerGroups[peersHash]) {\n peerGroups[peersHash] = [];\n }\n peerGroups[peersHash].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,SAASA,CAC7BC,QAA4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5F,MAAMC,EAAE,GAAGf,OAAO,CAACe,EAAE,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAEnC,IAAIF,gBAAgB,EAAEG,QAAQ,CAACF,EAAE,CAAC,EAAE;IAClC,OAAOf,OAAO,CAACe,EAAE;EACnB;EAEA,
|
1
|
+
{"version":3,"names":["dedupEnvs","contexts","dependencyResolver","dedicatedEnvDevServers","idsGroups","groupByEnvId","hasRootComponents","finalGroups","splitByPeers","groupedEnvs","forEach","context","envId","getEnvId","push","newGroupedEnvs","promises","Object","values","map","peersGroups","groupByPeersHash","assign","Promise","all","dedicatedServers","id","split","includes","env","getDevEnvId","undefined","peerGroups","policy","getComponentEnvPolicyFromEnv","peersHash","byLifecycleType","hashNameVersion","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 hasRootComponents = dependencyResolver.hasRootComponents();\n // Do not split envs by peers if root components is enabled as it should be already handled by the package manager\n // this will improve the performance of the dev server when root components is enabled\n const finalGroups = hasRootComponents ? idsGroups : 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 // Happen for envs that are not implementing preview\n if (!context.env?.getDevEnvId) {\n return undefined;\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, { envId: context.id });\n const peersHash = policy.byLifecycleType('peer').hashNameVersion();\n if (!peerGroups[peersHash]) {\n peerGroups[peersHash] = [];\n }\n peerGroups[peersHash].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,SAASA,CAC7BC,QAA4B,EAC5BC,kBAA0C,EAC1CC,sBAAiC,EACjC;EACA,MAAMC,SAAS,GAAGC,YAAY,CAACJ,QAAQ,EAAEE,sBAAsB,CAAC;EAChE,MAAMG,iBAAiB,GAAGJ,kBAAkB,CAACI,iBAAiB,CAAC,CAAC;EAChE;EACA;EACA,MAAMC,WAAW,GAAG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home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_bundler@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_bundler@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_bundler@1.0.616/dist/bundler.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_bundler@1.0.616/dist/bundler.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/bundler",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.616",
|
4
4
|
"homepage": "https://bit.cloud/teambit/compilation/bundler",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"componentId": {
|
7
7
|
"scope": "teambit.compilation",
|
8
8
|
"name": "bundler",
|
9
|
-
"version": "1.0.
|
9
|
+
"version": "1.0.616"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"chalk": "4.1.2",
|
@@ -14,13 +14,13 @@
|
|
14
14
|
"lodash": "4.17.21",
|
15
15
|
"p-map-series": "2.1.0",
|
16
16
|
"@teambit/harmony": "0.4.7",
|
17
|
-
"@teambit/envs": "1.0.
|
18
|
-
"@teambit/builder": "1.0.
|
19
|
-
"@teambit/component": "1.0.
|
20
|
-
"@teambit/cli": "0.0.
|
21
|
-
"@teambit/dependency-resolver": "1.0.
|
22
|
-
"@teambit/graphql": "1.0.
|
23
|
-
"@teambit/pubsub": "1.0.
|
17
|
+
"@teambit/envs": "1.0.616",
|
18
|
+
"@teambit/builder": "1.0.616",
|
19
|
+
"@teambit/component": "1.0.616",
|
20
|
+
"@teambit/cli": "0.0.1193",
|
21
|
+
"@teambit/dependency-resolver": "1.0.616",
|
22
|
+
"@teambit/graphql": "1.0.616",
|
23
|
+
"@teambit/pubsub": "1.0.616",
|
24
24
|
"@teambit/legacy.bit-map": "0.0.106",
|
25
25
|
"@teambit/toolbox.path.path": "0.0.8",
|
26
26
|
"@teambit/toolbox.network.get-port": "1.0.10"
|