@teambit/merging 0.0.255 → 0.0.256

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.
@@ -54,5 +54,6 @@ export declare class ConfigMerger {
54
54
  private isIdInWorkspace;
55
55
  private isEnv;
56
56
  private getConfig;
57
+ private getPolicy;
57
58
  }
58
59
  export {};
@@ -311,10 +311,11 @@ ${'>'.repeat(7)} ${this.otherLabel}
311
311
  baseExt
312
312
  } = params;
313
313
  const currentConfig = this.getConfig(currentExt);
314
+ const currentPolicy = this.getPolicy(currentConfig);
314
315
  const otherConfig = this.getConfig(otherExt);
316
+ const otherPolicy = this.getPolicy(otherConfig);
315
317
  const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;
316
- // const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };
317
-
318
+ const basePolicy = baseConfig ? this.getPolicy(baseConfig) : undefined;
318
319
  const mergedPolicy = {
319
320
  dependencies: [],
320
321
  devDependencies: [],
@@ -328,9 +329,21 @@ ${'>'.repeat(7)} ${this.otherLabel}
328
329
  let isMerged = false;
329
330
  let hasConflict = false;
330
331
  const conflictIndicator = 'CONFLICT::';
331
- const nonPolicyConfigToMerged = {};
332
- const nonPolicyConfigConflict = {};
332
+ const lifecycleToDepType = {
333
+ runtime: 'dependencies',
334
+ dev: 'devDependencies',
335
+ peer: 'peerDependencies'
336
+ };
333
337
  const handleConfigMerge = () => {
338
+ const addVariantPolicyEntryToPolicy = dep => {
339
+ const depType = lifecycleToDepType[dep.lifecycleType];
340
+ mergedPolicy[depType].push({
341
+ name: dep.dependencyId,
342
+ version: dep.value.version,
343
+ force: dep.force
344
+ });
345
+ isMerged = true;
346
+ };
334
347
  if (this.areConfigsEqual(currentConfig, otherConfig)) {
335
348
  return;
336
349
  }
@@ -341,25 +354,11 @@ ${'>'.repeat(7)} ${this.otherLabel}
341
354
  if (currentConfig === '-' || otherConfig === '-') {
342
355
  throw new Error('not implemented. Is it possible to have it as minus?');
343
356
  }
344
- const allKeys = (0, _lodash().uniq)([...Object.keys(currentConfig), ...Object.keys(otherConfig)]);
345
- const otherKeys = allKeys.filter(key => key !== 'policy');
346
357
  if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {
347
358
  // was changed on other
348
- otherKeys.forEach(key => {
349
- if (otherConfig[key]) {
350
- nonPolicyConfigToMerged[key] = otherConfig[key];
351
- }
352
- });
353
- if (otherConfig.policy) {
354
- ['dependencies', 'devDependencies', 'peerDependencies'].forEach(depType => {
355
- if (!otherConfig.policy[depType]) return;
356
- Object.keys(otherConfig.policy[depType]).forEach(depName => {
357
- mergedPolicy[depType].push({
358
- name: depName,
359
- version: otherConfig.policy[depType][depName],
360
- force: true
361
- });
362
- });
359
+ if (otherPolicy.length) {
360
+ otherPolicy.forEach(dep => {
361
+ addVariantPolicyEntryToPolicy(dep);
363
362
  });
364
363
  }
365
364
  isMerged = true;
@@ -367,76 +366,48 @@ ${'>'.repeat(7)} ${this.otherLabel}
367
366
  }
368
367
 
369
368
  // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.
370
- // we have to differentiate between a conflict in the policy, which might be merged with conflict with dependencies data.
371
- // and a conflict with other fields of config.
372
- otherKeys.forEach(key => {
373
- if (JSON.stringify(currentConfig[key]) === JSON.stringify(otherConfig[key])) {
369
+ if (!currentConfig.policy && !otherConfig.policy) return;
370
+ const currentAndOtherConfig = (0, _lodash().uniqBy)(currentPolicy.concat(otherPolicy), d => d.dependencyId);
371
+ currentAndOtherConfig.forEach(dep => {
372
+ const depType = lifecycleToDepType[dep.lifecycleType];
373
+ const currentDep = currentPolicy.find(d => d.dependencyId === dep.dependencyId);
374
+ const otherDep = otherPolicy.find(d => d.dependencyId === dep.dependencyId);
375
+ const baseDep = basePolicy === null || basePolicy === void 0 ? void 0 : basePolicy.find(d => d.dependencyId === dep.dependencyId);
376
+ if (!otherDep) {
374
377
  return;
375
378
  }
376
- if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(otherConfig[key])) {
377
- // was changed on current
379
+ if (!currentDep) {
380
+ // only on other
381
+ addVariantPolicyEntryToPolicy(otherDep);
378
382
  return;
379
383
  }
380
- if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(currentConfig[key])) {
381
- // was changed on other
382
- nonPolicyConfigToMerged[key] = otherConfig[key];
384
+ const currentVer = currentDep.value.version;
385
+ const otherVer = otherDep.value.version;
386
+ if (currentVer === otherVer) {
383
387
  return;
384
388
  }
385
- // conflict
386
- nonPolicyConfigConflict[key] = {
387
- current: currentConfig[key],
388
- other: otherConfig[key]
389
- };
390
- });
391
- if (!currentConfig.policy && !otherConfig.policy) return;
392
- ['dependencies', 'devDependencies', 'peerDependencies'].forEach(depType => {
393
- var _currentConfig$policy, _otherConfig$policy;
394
- const currentPolicy = (_currentConfig$policy = currentConfig.policy) === null || _currentConfig$policy === void 0 ? void 0 : _currentConfig$policy[depType];
395
- const otherPolicy = (_otherConfig$policy = otherConfig.policy) === null || _otherConfig$policy === void 0 ? void 0 : _otherConfig$policy[depType];
396
- const allPolicyKeys = (0, _lodash().uniq)(Object.keys(currentPolicy || {}).concat(Object.keys(otherPolicy || {})));
397
- if (!allPolicyKeys.length) return;
398
- allPolicyKeys.forEach(pkgName => {
399
- var _baseConfig$policy, _baseConfig$policy$de;
400
- const currentVal = currentPolicy === null || currentPolicy === void 0 ? void 0 : currentPolicy[pkgName];
401
- const otherVal = otherPolicy === null || otherPolicy === void 0 ? void 0 : otherPolicy[pkgName];
402
- const baseVal = baseConfig !== '-' && (baseConfig === null || baseConfig === void 0 ? void 0 : (_baseConfig$policy = baseConfig.policy) === null || _baseConfig$policy === void 0 ? void 0 : (_baseConfig$policy$de = _baseConfig$policy[depType]) === null || _baseConfig$policy$de === void 0 ? void 0 : _baseConfig$policy$de[pkgName]);
403
- if (this.isEnv(pkgName)) {
404
- // ignore the envs
405
- return;
406
- }
407
- if (currentVal === otherVal) {
408
- // mergedPolicy[depType][pkgName] = currentVal;
409
- return;
410
- }
411
- if (baseVal === otherVal) {
412
- // mergedPolicy[depType][pkgName] = currentVal;
413
- return;
414
- }
415
- if (baseVal === currentVal) {
416
- mergedPolicy[depType].push({
417
- name: pkgName,
418
- version: otherVal,
419
- force: true
420
- });
421
- isMerged = true;
422
- return;
423
- }
424
- // either no baseVal, or baseVal is also different from both: other and local. that's a conflict.
425
- hasConflict = true;
426
- conflictedPolicy[depType].push({
427
- name: pkgName,
428
- version: `${conflictIndicator}${currentVal}::${otherVal}::`,
429
- force: true
430
- });
389
+ const baseVer = baseDep === null || baseDep === void 0 ? void 0 : baseDep.value.version;
390
+ if (baseVer && baseVer === otherVer) {
391
+ return;
392
+ }
393
+ // @todo: needs to ignore if it's in the workspace somehow.
394
+ // if (currentDep.__type === 'component' && this.isIdInWorkspace(currentId)) {
395
+ // // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.
396
+ // return;
397
+ // }
398
+ if (baseVer && baseVer === currentVer) {
399
+ addVariantPolicyEntryToPolicy(otherDep);
400
+ return;
401
+ }
402
+ hasConflict = true;
403
+ conflictedPolicy[depType].push({
404
+ name: currentDep.dependencyId,
405
+ version: `${conflictIndicator}${currentVer}::${otherVer}::`,
406
+ force: currentDep.force
431
407
  });
432
408
  });
433
409
  };
434
410
  handleConfigMerge();
435
- const lifecycleToDepType = {
436
- runtime: 'dependencies',
437
- dev: 'devDependencies',
438
- peer: 'peerDependencies'
439
- };
440
411
  const hasConfigForDep = (depType, depName) => mergedPolicy[depType].find(d => d.name === depName);
441
412
  const getDepIdAsPkgName = dep => {
442
413
  if (dep.__type !== 'component') {
@@ -570,9 +541,9 @@ ${'>'.repeat(7)} ${this.otherLabel}`;
570
541
  conflictLines.unshift(`"${params.id}": {`);
571
542
  conflictStr = conflictLines.join('\n');
572
543
  }
573
- const config = isMerged ? _objectSpread(_objectSpread({}, nonPolicyConfigToMerged), {}, {
544
+ const config = isMerged ? {
574
545
  policy: mergedPolicy
575
- }) : undefined;
546
+ } : undefined;
576
547
  return {
577
548
  id: params.id,
578
549
  mergedConfig: config,
@@ -589,6 +560,10 @@ ${'>'.repeat(7)} ${this.otherLabel}`;
589
560
  if (ext.rawConfig === '-') return ext.rawConfig;
590
561
  return (0, _lodash().omit)(ext.rawConfig, ['__specific']);
591
562
  }
563
+ getPolicy(config) {
564
+ if (!config.policy) return [];
565
+ return _dependencyResolver().VariantPolicy.fromConfigObject(config.policy).entries;
566
+ }
592
567
  }
593
568
  exports.ConfigMerger = ConfigMerger;
594
569
 
@@ -1 +1 @@
1
- {"version":3,"names":["ConfigMerger","constructor","compIdStr","workspaceIds","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","merge","populateEnvs","results","map","currentExt","id","stringId","handledExtIds","includes","push","baseExt","findExtension","otherExt","mergePerStrategy","basicConflictGenerator","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","data","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","version","extensionId","rawConfig","otherEnvAspect","baseEnvAspect","mergeStrategyParams","baseConfig","isIdInWorkspace","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","mergeStrategyConfigParams","conflict","repeat","formatConfig","conf","confStr","confStrSplit","split","shift","pop","join","params","DependencyResolverAspect","mergedPolicy","dependencies","devDependencies","peerDependencies","conflictedPolicy","isMerged","hasConflict","conflictIndicator","nonPolicyConfigToMerged","nonPolicyConfigConflict","handleConfigMerge","allKeys","uniq","Object","keys","otherKeys","filter","key","forEach","policy","depType","depName","name","force","current","other","currentPolicy","otherPolicy","allPolicyKeys","concat","length","pkgName","currentVal","otherVal","baseVal","isEnv","lifecycleToDepType","runtime","dev","peer","hasConfigForDep","find","d","getDepIdAsPkgName","dep","__type","packageName","addSerializedDepToPolicy","lifecycle","getAutoDeps","source","idWithoutVersion","existingPolicy","p","dependencyId","getPolicyVer","value","semver","valid","startsWith","currentData","otherData","currentAndOtherData","uniqBy","baseData","depData","currentDep","otherDep","currentId","currentVer","otherVer","baseDep","baseVer","isRange","satisfies","conflictStr","mergedConfigSplit","conflictLines","line","unshift","Boolean","c","toStringWithoutVersion","omit"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { DependencyResolverAspect, isRange, SerializedDependency } from '@teambit/dependency-resolver';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { compact, omit, uniq, uniqBy } from 'lodash';\nimport { ConfigMergeResult } from './config-merge-result';\n\ntype GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string };\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: string;\n};\ntype MergeStrategyParamsWithRemoved = {\n id: string;\n currentConfig: GenericConfigOrRemoved;\n otherConfig: GenericConfigOrRemoved;\n baseConfig?: GenericConfigOrRemoved;\n};\ntype MergeStrategyParams = {\n id: string;\n currentExt: ExtensionDataEntry;\n otherExt: ExtensionDataEntry;\n baseExt?: ExtensionDataEntry;\n};\n\n/**\n * perform 3-way merge of component configuration (aspects).\n * normally this is needed when merging one lane into another. the component may have different aspects config in each lane.\n * the baseAspects are the aspects of the component in the diversion point (the common ancestor of the two lanes).\n * the currentAspects are the aspects of the component in the current lane.\n * the otherAspects are the aspects of the component in the other lane. this is the lane we merge into the current lane.\n *\n * the basic merging strategy is a simple comparison between the aspect-configs, if they're different, we have a conflict.\n * we have two special cases:\n *\n * 1. dependency-resolver: we do a deeper check for the policy, we compare each dependency separately. also, we take\n * into account not only the config, but also the data. this is needed because some dependencies are automatically\n * added by Bit (from the import statements in the code) and they're not in the config. the final config has the deps\n * from both sources, the config and the data. The way we know to differentiate between them is by the \"force\" prop.\n * the config has always force: true.\n *\n * 2. envs: if we don't treat it specially, the user will need to make the change not only in the envs aspect, but also\n * in the deps-resolver (because the env is added as a devDependency) and also in the aspect itself (because\n * teambit.envs/env has only the id and not the version). to make it simpler, we ignore the envs in the deps-resolver\n * we ignore the individual aspect that is the env itself. we only show teambit.envs/env and we put the env id and\n * version. later, when the component is loaded, we split the id and the version and put them in the correct places.\n * see workspace.componentExtension / adjustEnvsOnConfigMerge for more details.\n */\nexport class ConfigMerger {\n private currentEnv: EnvData;\n private otherEnv: EnvData;\n private baseEnv?: EnvData;\n private handledExtIds: string[] = [];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string\n ) {}\n\n merge(): ConfigMergeResult {\n this.populateEnvs();\n const results = this.currentAspects.map((currentExt) => {\n const id = currentExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n const otherExt = this.otherAspects.findExtension(id, true);\n if (otherExt) {\n // try to 3-way-merge\n return this.mergePerStrategy({ id, currentExt, otherExt, baseExt });\n }\n // exist in current but not in other\n if (baseExt) {\n // was removed on other\n return this.basicConflictGenerator({ id, currentConfig: this.getConfig(currentExt), otherConfig: '-' });\n }\n // exist in current but not in other and base, so it got created on current. nothing to do.\n return null;\n });\n const otherAspectsNotHandledResults = this.otherAspects.map((otherExt) => {\n const id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return this.basicConflictGenerator({ id, currentConfig: '-', otherConfig: this.getConfig(otherExt) });\n }\n // exist in other but not in current and base, so it got created on other.\n return { id, mergedConfig: this.getConfig(otherExt) };\n });\n const envResult = this.envStrategy();\n return new ConfigMergeResult(this.compIdStr, compact([...results, ...otherAspectsNotHandledResults, envResult]));\n }\n\n private populateEnvs() {\n // populate ids\n const getEnvId = (ext: ExtensionDataList) => {\n const envsAspect = ext.findCoreExtension(EnvsAspect.id);\n if (!envsAspect) throw new Error(`unable to find ${EnvsAspect.id} aspect for ${this.compIdStr}`);\n const env = envsAspect.config.env || envsAspect.data.id;\n if (!env)\n throw new Error(`unable to find env for ${this.compIdStr}, the config and data of ${EnvsAspect.id} are empty}`);\n return env;\n };\n const currentEnv = getEnvId(this.currentAspects);\n this.currentEnv = { id: currentEnv };\n const otherEnv = getEnvId(this.otherAspects);\n this.otherEnv = { id: otherEnv };\n const baseEnv = this.baseAspects ? getEnvId(this.baseAspects) : undefined;\n if (baseEnv) this.baseEnv = { id: baseEnv };\n\n // populate version\n const currentEnvAspect = this.currentAspects.findExtension(currentEnv, true);\n if (currentEnvAspect) {\n this.handledExtIds.push(currentEnvAspect.stringId);\n this.currentEnv.version = currentEnvAspect.extensionId?.version;\n this.currentEnv.config = currentEnvAspect.rawConfig;\n }\n const otherEnvAspect = this.otherAspects.findExtension(otherEnv, true);\n if (otherEnvAspect) {\n this.handledExtIds.push(otherEnvAspect.stringId);\n this.otherEnv.version = otherEnvAspect.extensionId?.version;\n this.otherEnv.config = otherEnvAspect.rawConfig;\n }\n if (this.baseEnv) {\n const baseEnvAspect = this.baseAspects.findExtension(baseEnv, true);\n if (baseEnvAspect) {\n this.baseEnv.version = baseEnvAspect.extensionId?.version;\n this.baseEnv.config = baseEnvAspect.rawConfig;\n }\n }\n }\n\n private envStrategy(): MergeStrategyResult | null {\n const mergeStrategyParams: MergeStrategyParamsWithRemoved = {\n id: EnvsAspect.id,\n currentConfig: {\n env: this.currentEnv.version ? `${this.currentEnv.id}@${this.currentEnv.version}` : this.currentEnv.id,\n },\n otherConfig: { env: this.otherEnv.version ? `${this.otherEnv.id}@${this.otherEnv.version}` : this.otherEnv.id },\n };\n if (this.baseEnv) {\n mergeStrategyParams.baseConfig = {\n env: this.baseEnv?.version ? `${this.baseEnv.id}@${this.baseEnv.version}` : this.baseEnv?.id,\n };\n }\n if (this.currentEnv.id === this.otherEnv.id && this.currentEnv.version === this.otherEnv.version) {\n return null;\n }\n if (this.isIdInWorkspace(this.currentEnv.id)) {\n // the env currently used is part of the workspace, that's what the user needs. don't try to resolve anything.\n return null;\n }\n return this.basicConfigMerge(mergeStrategyParams);\n }\n\n private areConfigsEqual(configA: GenericConfigOrRemoved, configB: GenericConfigOrRemoved) {\n return JSON.stringify(configA) === JSON.stringify(configB);\n }\n\n private mergePerStrategy(mergeStrategyParams: MergeStrategyParams): MergeStrategyResult | null {\n const { id, currentExt, otherExt, baseExt } = mergeStrategyParams;\n const depResolverResult = this.depResolverStrategy(mergeStrategyParams);\n if (depResolverResult) {\n return depResolverResult;\n }\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n\n return this.basicConfigMerge({ id, currentConfig, otherConfig, baseConfig });\n }\n\n private basicConfigMerge(mergeStrategyParams: MergeStrategyParamsWithRemoved) {\n const { id, currentConfig, otherConfig, baseConfig } = mergeStrategyParams;\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n return { id, mergedConfig: otherConfig };\n }\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };\n return this.basicConflictGenerator(mergeStrategyConfigParams);\n }\n\n private basicConflictGenerator({\n id,\n currentConfig,\n otherConfig,\n }: MergeStrategyParamsWithRemoved): MergeStrategyResult {\n // uncomment to debug\n // console.log('basicConflictGenerator', this.compIdStr, id, 'currentConfig', currentConfig, 'otherConfig', otherConfig);\n let conflict: string;\n if (currentConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n=======\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else if (otherConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n=======\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else {\n const formatConfig = (conf: GenericConfigOrRemoved) => {\n const confStr = JSON.stringify(conf, undefined, 2);\n const confStrSplit = confStr.split('\\n');\n confStrSplit.shift(); // remove first {\n confStrSplit.pop(); // remove last }\n return confStrSplit.join('\\n');\n };\n conflict = `\"${id}\": {\n${'<'.repeat(7)} ${this.currentLabel}\n${formatConfig(currentConfig)}\n=======\n${formatConfig(otherConfig)}\n${'>'.repeat(7)} ${this.otherLabel}\n}`;\n }\n\n return { id, conflict };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n const { currentExt, otherExt, baseExt } = params;\n\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n // const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let isMerged = false;\n let hasConflict = false;\n const conflictIndicator = 'CONFLICT::';\n const nonPolicyConfigToMerged = {};\n const nonPolicyConfigConflict = {};\n const handleConfigMerge = () => {\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return;\n }\n if (currentConfig === '-' || otherConfig === '-') {\n throw new Error('not implemented. Is it possible to have it as minus?');\n }\n const allKeys = uniq([...Object.keys(currentConfig), ...Object.keys(otherConfig)]);\n const otherKeys = allKeys.filter((key) => key !== 'policy');\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n otherKeys.forEach((key) => {\n if (otherConfig[key]) {\n nonPolicyConfigToMerged[key] = otherConfig[key];\n }\n });\n if (otherConfig.policy) {\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!otherConfig.policy[depType]) return;\n Object.keys(otherConfig.policy[depType]).forEach((depName) => {\n mergedPolicy[depType].push({\n name: depName,\n version: otherConfig.policy[depType][depName],\n force: true,\n });\n });\n });\n }\n isMerged = true;\n return;\n }\n\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n // we have to differentiate between a conflict in the policy, which might be merged with conflict with dependencies data.\n // and a conflict with other fields of config.\n otherKeys.forEach((key) => {\n if (JSON.stringify(currentConfig[key]) === JSON.stringify(otherConfig[key])) {\n return;\n }\n if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(otherConfig[key])) {\n // was changed on current\n return;\n }\n if (baseConfig && JSON.stringify(baseConfig[key]) === JSON.stringify(currentConfig[key])) {\n // was changed on other\n nonPolicyConfigToMerged[key] = otherConfig[key];\n return;\n }\n // conflict\n nonPolicyConfigConflict[key] = { current: currentConfig[key], other: otherConfig[key] };\n });\n\n if (!currentConfig.policy && !otherConfig.policy) return;\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n const currentPolicy = currentConfig.policy?.[depType];\n const otherPolicy = otherConfig.policy?.[depType];\n const allPolicyKeys = uniq(Object.keys(currentPolicy || {}).concat(Object.keys(otherPolicy || {})));\n if (!allPolicyKeys.length) return;\n\n allPolicyKeys.forEach((pkgName) => {\n const currentVal = currentPolicy?.[pkgName];\n const otherVal = otherPolicy?.[pkgName];\n const baseVal = baseConfig !== '-' && baseConfig?.policy?.[depType]?.[pkgName];\n if (this.isEnv(pkgName)) {\n // ignore the envs\n return;\n }\n if (currentVal === otherVal) {\n // mergedPolicy[depType][pkgName] = currentVal;\n return;\n }\n if (baseVal === otherVal) {\n // mergedPolicy[depType][pkgName] = currentVal;\n return;\n }\n if (baseVal === currentVal) {\n mergedPolicy[depType].push({\n name: pkgName,\n version: otherVal,\n force: true,\n });\n isMerged = true;\n return;\n }\n // either no baseVal, or baseVal is also different from both: other and local. that's a conflict.\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: pkgName,\n version: `${conflictIndicator}${currentVal}::${otherVal}::`,\n force: true,\n });\n });\n });\n };\n\n handleConfigMerge();\n\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const hasConfigForDep = (depType: string, depName: string) => mergedPolicy[depType].find((d) => d.name === depName);\n const getDepIdAsPkgName = (dep: SerializedDependencyWithPolicy) => {\n if (dep.__type !== 'component') {\n return dep.id;\n }\n // @ts-ignore\n return dep.packageName;\n };\n\n const addSerializedDepToPolicy = (dep: SerializedDependencyWithPolicy) => {\n const depType = lifecycleToDepType[dep.lifecycle];\n\n if (hasConfigForDep(depType, dep.id)) {\n return; // there is already config for it.\n }\n mergedPolicy[depType].push({\n name: getDepIdAsPkgName(dep),\n version: dep.policy || dep.version,\n force: false,\n });\n isMerged = true;\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const data = ext.findCoreExtension(DependencyResolverAspect.id)?.data.dependencies;\n if (!data) return [];\n const policy = ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n return data\n .filter((d) => d.source === 'auto')\n .map((d) => {\n const idWithoutVersion = d.__type === 'package' ? d.id : d.id.split('@')[0];\n const existingPolicy = policy.find((p) => p.dependencyId === idWithoutVersion);\n const getPolicyVer = () => {\n if (d.__type === 'package') return undefined; // for packages, the policy is already the version\n if (existingPolicy) return existingPolicy.value.version; // currently it's missing, will be implemented by @Gilad\n if (!semver.valid(d.version)) return d.version; // could be a hash\n // default to `^` or ~ if starts with zero, until we save the policy from the workspace during tag/snap.\n return d.version.startsWith('0.') ? `~${d.version}` : `^${d.version}`;\n };\n return {\n ...d,\n id: idWithoutVersion,\n policy: getPolicyVer(),\n };\n });\n };\n\n const currentData = getAutoDeps(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentData.concat(otherData), (d) => d.id);\n const baseData = getAutoDeps(this.baseAspects);\n\n // uncomment to debug\n // console.log('\\n\\n**************', this.compIdStr, '**************');\n // console.log('currentData', currentData.length, '\\n', currentData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', otherData.length, '\\n', otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', baseData.length, '\\n', baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('** END **\\n\\n');\n\n currentAndOtherData.forEach((depData) => {\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n const currentId = currentDep.id;\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseDep = baseData.find((d) => d.id === currentId);\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n if (currentDep.__type === 'component' && this.isIdInWorkspace(currentId)) {\n // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.\n return;\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n // either no baseVal, or baseVal is also different from both: other and local. that's probably a conflict.\n const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n // try to resolve according to semver\n if (\n currentDep.policy &&\n otherDep.policy &&\n isRange(currentDep.policy, currentDep.id) &&\n isRange(otherDep.policy, otherDep.id)\n ) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n }\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: getDepIdAsPkgName(currentDep),\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: false,\n });\n });\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!mergedPolicy[depType].length) delete mergedPolicy[depType];\n if (!conflictedPolicy[depType].length) delete conflictedPolicy[depType];\n });\n\n let conflictStr: string | undefined;\n if (hasConflict) {\n const mergedConfigSplit = JSON.stringify({ policy: conflictedPolicy }, undefined, 2).split('\\n');\n const conflictLines = mergedConfigSplit.map((line) => {\n if (!line.includes(conflictIndicator)) return line;\n const [, currentVal, otherVal] = line.split('::');\n return `${'<'.repeat(7)} ${this.currentLabel}\n \"version\": \"${currentVal}\",\n=======\n \"version\": \"${otherVal}\",\n${'>'.repeat(7)} ${this.otherLabel}`;\n });\n // replace the first line with line with the id\n conflictLines.shift();\n conflictLines.unshift(`\"${params.id}\": {`);\n conflictStr = conflictLines.join('\\n');\n }\n const config = isMerged ? { ...nonPolicyConfigToMerged, policy: mergedPolicy } : undefined;\n\n return { id: params.id, mergedConfig: config, conflict: conflictStr };\n }\n\n private isIdInWorkspace(id: string): boolean {\n return Boolean(this.workspaceIds.find((c) => c.toStringWithoutVersion() === id));\n }\n\n private isEnv(id: string) {\n return id === this.currentEnv.id || id === this.otherEnv.id;\n }\n\n private getConfig(ext: ExtensionDataEntry) {\n if (ext.rawConfig === '-') return ext.rawConfig;\n return omit(ext.rawConfig, ['__specific']);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;E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AC"}
1
+ {"version":3,"names":["ConfigMerger","constructor","compIdStr","workspaceIds","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","merge","populateEnvs","results","map","currentExt","id","stringId","handledExtIds","includes","push","baseExt","findExtension","otherExt","mergePerStrategy","basicConflictGenerator","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","data","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","version","extensionId","rawConfig","otherEnvAspect","baseEnvAspect","mergeStrategyParams","baseConfig","isIdInWorkspace","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","mergeStrategyConfigParams","conflict","repeat","formatConfig","conf","confStr","confStrSplit","split","shift","pop","join","params","DependencyResolverAspect","currentPolicy","getPolicy","otherPolicy","basePolicy","mergedPolicy","dependencies","devDependencies","peerDependencies","conflictedPolicy","isMerged","hasConflict","conflictIndicator","lifecycleToDepType","runtime","dev","peer","handleConfigMerge","addVariantPolicyEntryToPolicy","dep","depType","lifecycleType","name","dependencyId","value","force","length","forEach","policy","currentAndOtherConfig","uniqBy","concat","d","currentDep","find","otherDep","baseDep","currentVer","otherVer","baseVer","hasConfigForDep","depName","getDepIdAsPkgName","__type","packageName","addSerializedDepToPolicy","lifecycle","getAutoDeps","filter","source","idWithoutVersion","existingPolicy","p","getPolicyVer","semver","valid","startsWith","currentData","otherData","currentAndOtherData","baseData","depData","isEnv","currentId","isRange","satisfies","conflictStr","mergedConfigSplit","conflictLines","line","currentVal","otherVal","unshift","Boolean","c","toStringWithoutVersion","omit","VariantPolicy","fromConfigObject","entries"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport {\n DependencyResolverAspect,\n isRange,\n SerializedDependency,\n VariantPolicy,\n VariantPolicyEntry,\n} from '@teambit/dependency-resolver';\nimport { EnvsAspect } from '@teambit/envs';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { compact, omit, uniqBy } from 'lodash';\nimport { ConfigMergeResult } from './config-merge-result';\n\ntype GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string };\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: string;\n};\ntype MergeStrategyParamsWithRemoved = {\n id: string;\n currentConfig: GenericConfigOrRemoved;\n otherConfig: GenericConfigOrRemoved;\n baseConfig?: GenericConfigOrRemoved;\n};\ntype MergeStrategyParams = {\n id: string;\n currentExt: ExtensionDataEntry;\n otherExt: ExtensionDataEntry;\n baseExt?: ExtensionDataEntry;\n};\n\n/**\n * perform 3-way merge of component configuration (aspects).\n * normally this is needed when merging one lane into another. the component may have different aspects config in each lane.\n * the baseAspects are the aspects of the component in the diversion point (the common ancestor of the two lanes).\n * the currentAspects are the aspects of the component in the current lane.\n * the otherAspects are the aspects of the component in the other lane. this is the lane we merge into the current lane.\n *\n * the basic merging strategy is a simple comparison between the aspect-configs, if they're different, we have a conflict.\n * we have two special cases:\n *\n * 1. dependency-resolver: we do a deeper check for the policy, we compare each dependency separately. also, we take\n * into account not only the config, but also the data. this is needed because some dependencies are automatically\n * added by Bit (from the import statements in the code) and they're not in the config. the final config has the deps\n * from both sources, the config and the data. The way we know to differentiate between them is by the \"force\" prop.\n * the config has always force: true.\n *\n * 2. envs: if we don't treat it specially, the user will need to make the change not only in the envs aspect, but also\n * in the deps-resolver (because the env is added as a devDependency) and also in the aspect itself (because\n * teambit.envs/env has only the id and not the version). to make it simpler, we ignore the envs in the deps-resolver\n * we ignore the individual aspect that is the env itself. we only show teambit.envs/env and we put the env id and\n * version. later, when the component is loaded, we split the id and the version and put them in the correct places.\n * see workspace.componentExtension / adjustEnvsOnConfigMerge for more details.\n */\nexport class ConfigMerger {\n private currentEnv: EnvData;\n private otherEnv: EnvData;\n private baseEnv?: EnvData;\n private handledExtIds: string[] = [];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string\n ) {}\n\n merge(): ConfigMergeResult {\n this.populateEnvs();\n const results = this.currentAspects.map((currentExt) => {\n const id = currentExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n const otherExt = this.otherAspects.findExtension(id, true);\n if (otherExt) {\n // try to 3-way-merge\n return this.mergePerStrategy({ id, currentExt, otherExt, baseExt });\n }\n // exist in current but not in other\n if (baseExt) {\n // was removed on other\n return this.basicConflictGenerator({ id, currentConfig: this.getConfig(currentExt), otherConfig: '-' });\n }\n // exist in current but not in other and base, so it got created on current. nothing to do.\n return null;\n });\n const otherAspectsNotHandledResults = this.otherAspects.map((otherExt) => {\n const id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return this.basicConflictGenerator({ id, currentConfig: '-', otherConfig: this.getConfig(otherExt) });\n }\n // exist in other but not in current and base, so it got created on other.\n return { id, mergedConfig: this.getConfig(otherExt) };\n });\n const envResult = this.envStrategy();\n return new ConfigMergeResult(this.compIdStr, compact([...results, ...otherAspectsNotHandledResults, envResult]));\n }\n\n private populateEnvs() {\n // populate ids\n const getEnvId = (ext: ExtensionDataList) => {\n const envsAspect = ext.findCoreExtension(EnvsAspect.id);\n if (!envsAspect) throw new Error(`unable to find ${EnvsAspect.id} aspect for ${this.compIdStr}`);\n const env = envsAspect.config.env || envsAspect.data.id;\n if (!env)\n throw new Error(`unable to find env for ${this.compIdStr}, the config and data of ${EnvsAspect.id} are empty}`);\n return env;\n };\n const currentEnv = getEnvId(this.currentAspects);\n this.currentEnv = { id: currentEnv };\n const otherEnv = getEnvId(this.otherAspects);\n this.otherEnv = { id: otherEnv };\n const baseEnv = this.baseAspects ? getEnvId(this.baseAspects) : undefined;\n if (baseEnv) this.baseEnv = { id: baseEnv };\n\n // populate version\n const currentEnvAspect = this.currentAspects.findExtension(currentEnv, true);\n if (currentEnvAspect) {\n this.handledExtIds.push(currentEnvAspect.stringId);\n this.currentEnv.version = currentEnvAspect.extensionId?.version;\n this.currentEnv.config = currentEnvAspect.rawConfig;\n }\n const otherEnvAspect = this.otherAspects.findExtension(otherEnv, true);\n if (otherEnvAspect) {\n this.handledExtIds.push(otherEnvAspect.stringId);\n this.otherEnv.version = otherEnvAspect.extensionId?.version;\n this.otherEnv.config = otherEnvAspect.rawConfig;\n }\n if (this.baseEnv) {\n const baseEnvAspect = this.baseAspects.findExtension(baseEnv, true);\n if (baseEnvAspect) {\n this.baseEnv.version = baseEnvAspect.extensionId?.version;\n this.baseEnv.config = baseEnvAspect.rawConfig;\n }\n }\n }\n\n private envStrategy(): MergeStrategyResult | null {\n const mergeStrategyParams: MergeStrategyParamsWithRemoved = {\n id: EnvsAspect.id,\n currentConfig: {\n env: this.currentEnv.version ? `${this.currentEnv.id}@${this.currentEnv.version}` : this.currentEnv.id,\n },\n otherConfig: { env: this.otherEnv.version ? `${this.otherEnv.id}@${this.otherEnv.version}` : this.otherEnv.id },\n };\n if (this.baseEnv) {\n mergeStrategyParams.baseConfig = {\n env: this.baseEnv?.version ? `${this.baseEnv.id}@${this.baseEnv.version}` : this.baseEnv?.id,\n };\n }\n if (this.currentEnv.id === this.otherEnv.id && this.currentEnv.version === this.otherEnv.version) {\n return null;\n }\n if (this.isIdInWorkspace(this.currentEnv.id)) {\n // the env currently used is part of the workspace, that's what the user needs. don't try to resolve anything.\n return null;\n }\n return this.basicConfigMerge(mergeStrategyParams);\n }\n\n private areConfigsEqual(configA: GenericConfigOrRemoved, configB: GenericConfigOrRemoved) {\n return JSON.stringify(configA) === JSON.stringify(configB);\n }\n\n private mergePerStrategy(mergeStrategyParams: MergeStrategyParams): MergeStrategyResult | null {\n const { id, currentExt, otherExt, baseExt } = mergeStrategyParams;\n const depResolverResult = this.depResolverStrategy(mergeStrategyParams);\n if (depResolverResult) {\n return depResolverResult;\n }\n const currentConfig = this.getConfig(currentExt);\n const otherConfig = this.getConfig(otherExt);\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n\n return this.basicConfigMerge({ id, currentConfig, otherConfig, baseConfig });\n }\n\n private basicConfigMerge(mergeStrategyParams: MergeStrategyParamsWithRemoved) {\n const { id, currentConfig, otherConfig, baseConfig } = mergeStrategyParams;\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return null;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n return { id, mergedConfig: otherConfig };\n }\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n const mergeStrategyConfigParams = { id, currentConfig, otherConfig, baseConfig };\n return this.basicConflictGenerator(mergeStrategyConfigParams);\n }\n\n private basicConflictGenerator({\n id,\n currentConfig,\n otherConfig,\n }: MergeStrategyParamsWithRemoved): MergeStrategyResult {\n // uncomment to debug\n // console.log('basicConflictGenerator', this.compIdStr, id, 'currentConfig', currentConfig, 'otherConfig', otherConfig);\n let conflict: string;\n if (currentConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n=======\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else if (otherConfig === '-') {\n conflict = `${'<'.repeat(7)} ${this.currentLabel}\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n=======\n${'>'.repeat(7)} ${this.otherLabel}`;\n } else {\n const formatConfig = (conf: GenericConfigOrRemoved) => {\n const confStr = JSON.stringify(conf, undefined, 2);\n const confStrSplit = confStr.split('\\n');\n confStrSplit.shift(); // remove first {\n confStrSplit.pop(); // remove last }\n return confStrSplit.join('\\n');\n };\n conflict = `\"${id}\": {\n${'<'.repeat(7)} ${this.currentLabel}\n${formatConfig(currentConfig)}\n=======\n${formatConfig(otherConfig)}\n${'>'.repeat(7)} ${this.otherLabel}\n}`;\n }\n\n return { id, conflict };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n const { currentExt, otherExt, baseExt } = params;\n\n const currentConfig = this.getConfig(currentExt);\n const currentPolicy = this.getPolicy(currentConfig);\n const otherConfig = this.getConfig(otherExt);\n const otherPolicy = this.getPolicy(otherConfig);\n\n const baseConfig = baseExt ? this.getConfig(baseExt) : undefined;\n const basePolicy = baseConfig ? this.getPolicy(baseConfig) : undefined;\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let isMerged = false;\n let hasConflict = false;\n const conflictIndicator = 'CONFLICT::';\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const handleConfigMerge = () => {\n const addVariantPolicyEntryToPolicy = (dep: VariantPolicyEntry) => {\n const depType = lifecycleToDepType[dep.lifecycleType];\n mergedPolicy[depType].push({\n name: dep.dependencyId,\n version: dep.value.version,\n force: dep.force,\n });\n isMerged = true;\n };\n\n if (this.areConfigsEqual(currentConfig, otherConfig)) {\n return;\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, otherConfig)) {\n // was changed on current\n return;\n }\n if (currentConfig === '-' || otherConfig === '-') {\n throw new Error('not implemented. Is it possible to have it as minus?');\n }\n if (baseConfig && this.areConfigsEqual(baseConfig, currentConfig)) {\n // was changed on other\n if (otherPolicy.length) {\n otherPolicy.forEach((dep) => {\n addVariantPolicyEntryToPolicy(dep);\n });\n }\n isMerged = true;\n return;\n }\n\n // either no baseConfig, or baseConfig is also different from both: other and local. that's a conflict.\n if (!currentConfig.policy && !otherConfig.policy) return;\n const currentAndOtherConfig = uniqBy(currentPolicy.concat(otherPolicy), (d) => d.dependencyId);\n currentAndOtherConfig.forEach((dep) => {\n const depType = lifecycleToDepType[dep.lifecycleType];\n const currentDep = currentPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const otherDep = otherPolicy.find((d) => d.dependencyId === dep.dependencyId);\n const baseDep = basePolicy?.find((d) => d.dependencyId === dep.dependencyId);\n\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const currentVer = currentDep.value.version;\n const otherVer = otherDep.value.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.value.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n // @todo: needs to ignore if it's in the workspace somehow.\n // if (currentDep.__type === 'component' && this.isIdInWorkspace(currentId)) {\n // // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.\n // return;\n // }\n if (baseVer && baseVer === currentVer) {\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: currentDep.dependencyId,\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: currentDep.force,\n });\n });\n };\n\n handleConfigMerge();\n\n const hasConfigForDep = (depType: string, depName: string) => mergedPolicy[depType].find((d) => d.name === depName);\n const getDepIdAsPkgName = (dep: SerializedDependencyWithPolicy) => {\n if (dep.__type !== 'component') {\n return dep.id;\n }\n // @ts-ignore\n return dep.packageName;\n };\n\n const addSerializedDepToPolicy = (dep: SerializedDependencyWithPolicy) => {\n const depType = lifecycleToDepType[dep.lifecycle];\n\n if (hasConfigForDep(depType, dep.id)) {\n return; // there is already config for it.\n }\n mergedPolicy[depType].push({\n name: getDepIdAsPkgName(dep),\n version: dep.policy || dep.version,\n force: false,\n });\n isMerged = true;\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const data = ext.findCoreExtension(DependencyResolverAspect.id)?.data.dependencies;\n if (!data) return [];\n const policy = ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n return data\n .filter((d) => d.source === 'auto')\n .map((d) => {\n const idWithoutVersion = d.__type === 'package' ? d.id : d.id.split('@')[0];\n const existingPolicy = policy.find((p) => p.dependencyId === idWithoutVersion);\n const getPolicyVer = () => {\n if (d.__type === 'package') return undefined; // for packages, the policy is already the version\n if (existingPolicy) return existingPolicy.value.version; // currently it's missing, will be implemented by @Gilad\n if (!semver.valid(d.version)) return d.version; // could be a hash\n // default to `^` or ~ if starts with zero, until we save the policy from the workspace during tag/snap.\n return d.version.startsWith('0.') ? `~${d.version}` : `^${d.version}`;\n };\n return {\n ...d,\n id: idWithoutVersion,\n policy: getPolicyVer(),\n };\n });\n };\n\n const currentData = getAutoDeps(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentData.concat(otherData), (d) => d.id);\n const baseData = getAutoDeps(this.baseAspects);\n\n // uncomment to debug\n // console.log('\\n\\n**************', this.compIdStr, '**************');\n // console.log('currentData', currentData.length, '\\n', currentData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', otherData.length, '\\n', otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('otherData', baseData.length, '\\n', baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n'));\n // console.log('** END **\\n\\n');\n\n currentAndOtherData.forEach((depData) => {\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n const currentId = currentDep.id;\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseDep = baseData.find((d) => d.id === currentId);\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n if (currentDep.__type === 'component' && this.isIdInWorkspace(currentId)) {\n // dependencies that exist in the workspace, should be ignored. they'll be resolved later to the version in the ws.\n return;\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n // either no baseVal, or baseVal is also different from both: other and local. that's probably a conflict.\n const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n // try to resolve according to semver\n if (\n currentDep.policy &&\n otherDep.policy &&\n isRange(currentDep.policy, currentDep.id) &&\n isRange(otherDep.policy, otherDep.id)\n ) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n addSerializedDepToPolicy(otherDep);\n return;\n }\n }\n hasConflict = true;\n conflictedPolicy[depType].push({\n name: getDepIdAsPkgName(currentDep),\n version: `${conflictIndicator}${currentVer}::${otherVer}::`,\n force: false,\n });\n });\n\n ['dependencies', 'devDependencies', 'peerDependencies'].forEach((depType) => {\n if (!mergedPolicy[depType].length) delete mergedPolicy[depType];\n if (!conflictedPolicy[depType].length) delete conflictedPolicy[depType];\n });\n\n let conflictStr: string | undefined;\n if (hasConflict) {\n const mergedConfigSplit = JSON.stringify({ policy: conflictedPolicy }, undefined, 2).split('\\n');\n const conflictLines = mergedConfigSplit.map((line) => {\n if (!line.includes(conflictIndicator)) return line;\n const [, currentVal, otherVal] = line.split('::');\n return `${'<'.repeat(7)} ${this.currentLabel}\n \"version\": \"${currentVal}\",\n=======\n \"version\": \"${otherVal}\",\n${'>'.repeat(7)} ${this.otherLabel}`;\n });\n // replace the first line with line with the id\n conflictLines.shift();\n conflictLines.unshift(`\"${params.id}\": {`);\n conflictStr = conflictLines.join('\\n');\n }\n const config = isMerged ? { policy: mergedPolicy } : undefined;\n\n return { id: params.id, mergedConfig: config, conflict: conflictStr };\n }\n\n private isIdInWorkspace(id: string): boolean {\n return Boolean(this.workspaceIds.find((c) => c.toStringWithoutVersion() === id));\n }\n\n private isEnv(id: string) {\n return id === this.currentEnv.id || id === this.otherEnv.id;\n }\n\n private getConfig(ext: ExtensionDataEntry) {\n if (ext.rawConfig === '-') return ext.rawConfig;\n return omit(ext.rawConfig, ['__specific']);\n }\n\n private getPolicy(config): VariantPolicyEntry[] {\n if (!config.policy) return [];\n return VariantPolicy.fromConfigObject(config.policy).entries;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0D;AAAA;AA0B1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,CAAC;EAKxBC,WAAW,CACDC,SAAiB,EACjBC,YAA2B,EAC3BC,cAAiC,EACjCC,WAA8B,EAC9BC,YAA+B,EAC/BC,YAAoB,EACpBC,UAAkB,EAC1B;IAAA,KAPQN,SAAiB,GAAjBA,SAAiB;IAAA,KACjBC,YAA2B,GAA3BA,YAA2B;IAAA,KAC3BC,cAAiC,GAAjCA,cAAiC;IAAA,KACjCC,WAA8B,GAA9BA,WAA8B;IAAA,KAC9BC,YAA+B,GAA/BA,YAA+B;IAAA,KAC/BC,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,UAAkB,GAAlBA,UAAkB;IAAA;IAAA;IAAA;IAAA,uDARM,EAAE;EASjC;EAEHC,KAAK,GAAsB;IACzB,IAA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4D,MAAM,CAAC5D,EAAE;MAAEc,YAAY,EAAEY,MAAM;MAAEwB,QAAQ,EAAE6E;IAAY,CAAC;EACvE;EAEQvF,eAAe,CAACxC,EAAU,EAAW;IAC3C,OAAOsI,OAAO,CAAC,IAAI,CAACjJ,YAAY,CAAC0G,IAAI,CAAEwC,CAAC,IAAKA,CAAC,CAACC,sBAAsB,EAAE,KAAKxI,EAAE,CAAC,CAAC;EAClF;EAEQ2H,KAAK,CAAC3H,EAAU,EAAE;IACxB,OAAOA,EAAE,KAAK,IAAI,CAAC4B,UAAU,CAAC5B,EAAE,IAAIA,EAAE,KAAK,IAAI,CAAC6B,QAAQ,CAAC7B,EAAE;EAC7D;EAEQW,SAAS,CAACS,GAAuB,EAAE;IACzC,IAAIA,GAAG,CAACe,SAAS,KAAK,GAAG,EAAE,OAAOf,GAAG,CAACe,SAAS;IAC/C,OAAO,IAAAsG,cAAI,EAACrH,GAAG,CAACe,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;EAC5C;EAEQ4B,SAAS,CAACrC,MAAM,EAAwB;IAC9C,IAAI,CAACA,MAAM,CAAC+D,MAAM,EAAE,OAAO,EAAE;IAC7B,OAAOiD,mCAAa,CAACC,gBAAgB,CAACjH,MAAM,CAAC+D,MAAM,CAAC,CAACmD,OAAO;EAC9D;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/merging",
3
- "version": "0.0.255",
3
+ "version": "0.0.256",
4
4
  "homepage": "https://bit.dev/teambit/component/merging",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "merging",
9
- "version": "0.0.255"
9
+ "version": "0.0.256"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -19,16 +19,16 @@
19
19
  "@babel/runtime": "7.20.0",
20
20
  "@teambit/harmony": "0.4.6",
21
21
  "@teambit/component-id": "0.0.425",
22
- "@teambit/dependency-resolver": "0.0.940",
23
- "@teambit/envs": "0.0.940",
22
+ "@teambit/dependency-resolver": "0.0.941",
23
+ "@teambit/envs": "0.0.941",
24
24
  "@teambit/bit-error": "0.0.402",
25
- "@teambit/cli": "0.0.630",
26
- "@teambit/checkout": "0.0.109",
27
- "@teambit/install": "0.0.78",
28
- "@teambit/lane-id": "0.0.148",
29
- "@teambit/logger": "0.0.723",
30
- "@teambit/snapping": "0.0.255",
31
- "@teambit/workspace": "0.0.940"
25
+ "@teambit/cli": "0.0.631",
26
+ "@teambit/checkout": "0.0.110",
27
+ "@teambit/install": "0.0.79",
28
+ "@teambit/lane-id": "0.0.149",
29
+ "@teambit/logger": "0.0.724",
30
+ "@teambit/snapping": "0.0.256",
31
+ "@teambit/workspace": "0.0.941"
32
32
  },
33
33
  "devDependencies": {
34
34
  "chai": "4.3.0",
@@ -44,7 +44,7 @@
44
44
  "@types/testing-library__jest-dom": "5.9.5"
45
45
  },
46
46
  "peerDependencies": {
47
- "@teambit/legacy": "1.0.411",
47
+ "@teambit/legacy": "1.0.412",
48
48
  "react": "^16.8.0 || ^17.0.0",
49
49
  "react-dom": "^16.8.0 || ^17.0.0"
50
50
  },