@teambit/merging 0.0.473 → 0.0.475

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.
@@ -1,20 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.regexp.exec.js");
6
- require("core-js/modules/es.string.replace.js");
7
3
  Object.defineProperty(exports, "__esModule", {
8
4
  value: true
9
5
  });
10
6
  exports.ConfigMergeResult = void 0;
11
- function _defineProperty2() {
12
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- _defineProperty2 = function () {
14
- return data;
15
- };
16
- return data;
17
- }
18
7
  function _dependencyResolver() {
19
8
  const data = require("@teambit/dependency-resolver");
20
9
  _dependencyResolver = function () {
@@ -37,7 +26,10 @@ function _configMerger() {
37
26
  return data;
38
27
  }
39
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
32
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
41
33
  const DEP_RESOLVER_VERSION_INDENTATION = 8;
42
34
  const CONFLICT_MARKER_INDENTATION = 7;
43
35
  class ConfigMergeResult {
@@ -1 +1 @@
1
- {"version":3,"names":["_dependencyResolver","data","require","_lodash","_configMerger","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","DEP_RESOLVER_VERSION_INDENTATION","CONFLICT_MARKER_INDENTATION","ConfigMergeResult","constructor","compIdStr","currentLabel","otherLabel","results","hasConflicts","some","result","conflict","generateMergeConflictFile","resultsWithConflict","allConflicts","compact","map","generateConflictStringPerAspect","configMergeFormatted","c","formatConflict","conflictStr","concatenateConflicts","getSuccessfullyMergedConfig","resultsWithMergedConfig","mergedConfig","reduce","acc","curr","currObject","id","getDepsResolverResult","find","DependencyResolverAspect","undefined","depsResolverConfigGenerator","basicConflictGenerator","mergedConfigSplit","JSON","stringify","policy","split","conflictLines","line","includes","conflictIndicator","currentVal","otherVal","repeat","shift","unshift","join","conflictObj","currentConfig","otherConfig","formatConfig","conf","confStr","confStrSplit","pop","replace","conflicts","conflictsWithComma","index","endsWith","conflictSplit","lastLineWithClosingBrace","lastIndexOf","exports"],"sources":["config-merge-result.ts"],"sourcesContent":["import { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { compact } from 'lodash';\nimport { MergeStrategyResult, conflictIndicator, GenericConfigOrRemoved } from './config-merger';\n\nconst DEP_RESOLVER_VERSION_INDENTATION = 8;\nconst CONFLICT_MARKER_INDENTATION = 7;\n\nexport class ConfigMergeResult {\n constructor(\n readonly compIdStr: string,\n private currentLabel: string,\n private otherLabel: string,\n private results: MergeStrategyResult[]\n ) {}\n hasConflicts(): boolean {\n return this.results.some((result) => result.conflict);\n }\n generateMergeConflictFile(): string | null {\n const resultsWithConflict = this.results.filter((result) => result.conflict);\n if (!resultsWithConflict.length) return null;\n const allConflicts = compact(resultsWithConflict.map((result) => this.generateConflictStringPerAspect(result)));\n const configMergeFormatted = allConflicts.map((c) => this.formatConflict(c));\n const conflictStr = `{\n${this.concatenateConflicts(configMergeFormatted)}\n}`;\n return conflictStr;\n }\n getSuccessfullyMergedConfig(): Record<string, any> {\n const resultsWithMergedConfig = this.results.filter((result) => result.mergedConfig);\n return resultsWithMergedConfig.reduce((acc, curr) => {\n const currObject = { [curr.id]: curr.mergedConfig };\n return { ...acc, ...currObject };\n }, {});\n }\n\n getDepsResolverResult(): MergeStrategyResult | undefined {\n return this.results.find((result) => result.id === DependencyResolverAspect.id);\n }\n\n private generateConflictStringPerAspect(result: MergeStrategyResult): string | undefined {\n if (!result.conflict) return undefined;\n if (result.id === DependencyResolverAspect.id) {\n return this.depsResolverConfigGenerator(result.conflict);\n }\n return this.basicConflictGenerator(result.id, result.conflict);\n }\n\n private depsResolverConfigGenerator(conflict: Record<string, any>): string {\n const mergedConfigSplit = JSON.stringify({ policy: conflict }, 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(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n${' '.repeat(DEP_RESOLVER_VERSION_INDENTATION)}\"version\": \"${currentVal}\",\n=======\n${' '.repeat(DEP_RESOLVER_VERSION_INDENTATION)}\"version\": \"${otherVal}\",\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}`;\n });\n // replace the first line with line with the id\n conflictLines.shift();\n conflictLines.unshift(`\"${DependencyResolverAspect.id}\": {`);\n return conflictLines.join('\\n');\n }\n\n private basicConflictGenerator(id: string, conflictObj: Record<string, any>): string {\n const { currentConfig, otherConfig } = conflictObj;\n let conflict: string;\n if (currentConfig === '-') {\n conflict = `${'<'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n\"${id}\": \"-\"\n=======\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}`;\n } else if (otherConfig === '-') {\n conflict = `${'<'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n\"${id}\": ${JSON.stringify(currentConfig, undefined, 2)}\n=======\n\"${id}\": \"-\"\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${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(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n${formatConfig(currentConfig)}\n=======\n${formatConfig(otherConfig)}\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}\n}`;\n }\n\n return conflict;\n }\n\n private formatConflict(conflict: string) {\n return (\n conflict\n .split('\\n')\n // add 2 spaces before each line\n .map((line) => ` ${line}`)\n // remove the white spaces before the conflict indicators\n .map((line) => line.replace(/ *(<<<<<<<|>>>>>>>|=======)/g, '$1'))\n .join('\\n')\n );\n }\n\n private concatenateConflicts(conflicts: string[]) {\n const conflictsWithComma = conflicts.map((conflict, index) => {\n if (index === conflicts.length - 1) return conflict; // last element in the array, no need to add a comma\n if (conflict.endsWith('}')) return `${conflict},`; // ends normally with a closing brace, add a comma.\n // if it doesn't end with a closing brace, it means it ends with a conflict indicator.\n // the comma should be added after the last line with a closing brace.\n const conflictSplit = conflict.split('\\n');\n // find the last line with '}' and add a comma after it\n const lastLineWithClosingBrace = conflictSplit.lastIndexOf(' }');\n conflictSplit[lastLineWithClosingBrace] += ',';\n return conflictSplit.join('\\n');\n });\n return conflictsWithComma.join('\\n');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiG,SAAAI,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,M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gB,EAAE;IACvC,OACEA,QAAQ,CACL8B,KAAK,CAAC,IAAI;IACX;IAAA,CACCzB,GAAG,CAAE2B,IAAI,IAAM,KAAIA,IAAK,EAAC;IAC1B;IAAA,CACC3B,GAAG,CAAE2B,IAAI,IAAKA,IAAI,CAACiB,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC,CACjET,IAAI,CAAC,IAAI,CAAC;EAEjB;EAEQ7B,oBAAoBA,CAACuC,SAAmB,EAAE;IAChD,MAAMC,kBAAkB,GAAGD,SAAS,CAAC7C,GAAG,CAAC,CAACL,QAAQ,EAAEoD,KAAK,KAAK;MAC5D,IAAIA,KAAK,KAAKF,SAAS,CAACtE,MAAM,GAAG,CAAC,EAAE,OAAOoB,QAAQ,CAAC,CAAC;MACrD,IAAIA,QAAQ,CAACqD,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAQ,GAAErD,QAAS,GAAE,CAAC,CAAC;MACnD;MACA;MACA,MAAMsD,aAAa,GAAGtD,QAAQ,CAAC8B,KAAK,CAAC,IAAI,CAAC;MAC1C;MACA,MAAMyB,wBAAwB,GAAGD,aAAa,CAACE,WAAW,CAAC,KAAK,CAAC;MACjEF,aAAa,CAACC,wBAAwB,CAAC,IAAI,GAAG;MAC9C,OAAOD,aAAa,CAACd,IAAI,CAAC,IAAI,CAAC;IACjC,CAAC,CAAC;IACF,OAAOW,kBAAkB,CAACX,IAAI,CAAC,IAAI,CAAC;EACtC;AACF;AAACiB,OAAA,CAAAlE,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_dependencyResolver","data","require","_lodash","_configMerger","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","DEP_RESOLVER_VERSION_INDENTATION","CONFLICT_MARKER_INDENTATION","ConfigMergeResult","constructor","compIdStr","currentLabel","otherLabel","results","hasConflicts","some","result","conflict","generateMergeConflictFile","resultsWithConflict","allConflicts","compact","map","generateConflictStringPerAspect","configMergeFormatted","c","formatConflict","conflictStr","concatenateConflicts","getSuccessfullyMergedConfig","resultsWithMergedConfig","mergedConfig","reduce","acc","curr","currObject","id","getDepsResolverResult","find","DependencyResolverAspect","depsResolverConfigGenerator","basicConflictGenerator","mergedConfigSplit","JSON","stringify","policy","split","conflictLines","line","includes","conflictIndicator","currentVal","otherVal","repeat","shift","unshift","join","conflictObj","currentConfig","otherConfig","formatConfig","conf","confStr","confStrSplit","pop","replace","conflicts","conflictsWithComma","index","endsWith","conflictSplit","lastLineWithClosingBrace","lastIndexOf","exports"],"sources":["config-merge-result.ts"],"sourcesContent":["import { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { compact } from 'lodash';\nimport { MergeStrategyResult, conflictIndicator, GenericConfigOrRemoved } from './config-merger';\n\nconst DEP_RESOLVER_VERSION_INDENTATION = 8;\nconst CONFLICT_MARKER_INDENTATION = 7;\n\nexport class ConfigMergeResult {\n constructor(\n readonly compIdStr: string,\n private currentLabel: string,\n private otherLabel: string,\n private results: MergeStrategyResult[]\n ) {}\n hasConflicts(): boolean {\n return this.results.some((result) => result.conflict);\n }\n generateMergeConflictFile(): string | null {\n const resultsWithConflict = this.results.filter((result) => result.conflict);\n if (!resultsWithConflict.length) return null;\n const allConflicts = compact(resultsWithConflict.map((result) => this.generateConflictStringPerAspect(result)));\n const configMergeFormatted = allConflicts.map((c) => this.formatConflict(c));\n const conflictStr = `{\n${this.concatenateConflicts(configMergeFormatted)}\n}`;\n return conflictStr;\n }\n getSuccessfullyMergedConfig(): Record<string, any> {\n const resultsWithMergedConfig = this.results.filter((result) => result.mergedConfig);\n return resultsWithMergedConfig.reduce((acc, curr) => {\n const currObject = { [curr.id]: curr.mergedConfig };\n return { ...acc, ...currObject };\n }, {});\n }\n\n getDepsResolverResult(): MergeStrategyResult | undefined {\n return this.results.find((result) => result.id === DependencyResolverAspect.id);\n }\n\n private generateConflictStringPerAspect(result: MergeStrategyResult): string | undefined {\n if (!result.conflict) return undefined;\n if (result.id === DependencyResolverAspect.id) {\n return this.depsResolverConfigGenerator(result.conflict);\n }\n return this.basicConflictGenerator(result.id, result.conflict);\n }\n\n private depsResolverConfigGenerator(conflict: Record<string, any>): string {\n const mergedConfigSplit = JSON.stringify({ policy: conflict }, 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(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n${' '.repeat(DEP_RESOLVER_VERSION_INDENTATION)}\"version\": \"${currentVal}\",\n=======\n${' '.repeat(DEP_RESOLVER_VERSION_INDENTATION)}\"version\": \"${otherVal}\",\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}`;\n });\n // replace the first line with line with the id\n conflictLines.shift();\n conflictLines.unshift(`\"${DependencyResolverAspect.id}\": {`);\n return conflictLines.join('\\n');\n }\n\n private basicConflictGenerator(id: string, conflictObj: Record<string, any>): string {\n const { currentConfig, otherConfig } = conflictObj;\n let conflict: string;\n if (currentConfig === '-') {\n conflict = `${'<'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n\"${id}\": \"-\"\n=======\n\"${id}\": ${JSON.stringify(otherConfig, undefined, 2)}\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}`;\n } else if (otherConfig === '-') {\n conflict = `${'<'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n\"${id}\": ${JSON.stringify(currentConfig, undefined, 2)}\n=======\n\"${id}\": \"-\"\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${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(CONFLICT_MARKER_INDENTATION)} ${this.currentLabel}\n${formatConfig(currentConfig)}\n=======\n${formatConfig(otherConfig)}\n${'>'.repeat(CONFLICT_MARKER_INDENTATION)} ${this.otherLabel}\n}`;\n }\n\n return conflict;\n }\n\n private formatConflict(conflict: string) {\n return (\n conflict\n .split('\\n')\n // add 2 spaces before each line\n .map((line) => ` ${line}`)\n // remove the white spaces before the conflict indicators\n .map((line) => line.replace(/ *(<<<<<<<|>>>>>>>|=======)/g, '$1'))\n .join('\\n')\n );\n }\n\n private concatenateConflicts(conflicts: string[]) {\n const conflictsWithComma = conflicts.map((conflict, index) => {\n if (index === conflicts.length - 1) return conflict; // last element in the array, no need to add a comma\n if (conflict.endsWith('}')) return `${conflict},`; // ends normally with a closing brace, add a comma.\n // if it doesn't end with a closing brace, it means it ends with a conflict indicator.\n // the comma should be added after the last line with a closing brace.\n const conflictSplit = conflict.split('\\n');\n // find the last line with '}' and add a comma after it\n const lastLineWithClosingBrace = conflictSplit.lastIndexOf(' }');\n conflictSplit[lastLineWithClosingBrace] += ',';\n return conflictSplit.join('\\n');\n });\n return conflictsWithComma.join('\\n');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,oBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,mBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,I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,CACL6B,KAAK,CAAC,IAAI;IACX;IAAA,CACCxB,GAAG,CAAE0B,IAAI,IAAM,KAAIA,IAAK,EAAC;IAC1B;IAAA,CACC1B,GAAG,CAAE0B,IAAI,IAAKA,IAAI,CAACiB,OAAO,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC,CACjET,IAAI,CAAC,IAAI,CAAC;EAEjB;EAEQ5B,oBAAoBA,CAACsC,SAAmB,EAAE;IAChD,MAAMC,kBAAkB,GAAGD,SAAS,CAAC5C,GAAG,CAAC,CAACL,QAAQ,EAAEmD,KAAK,KAAK;MAC5D,IAAIA,KAAK,KAAKF,SAAS,CAACtF,MAAM,GAAG,CAAC,EAAE,OAAOqC,QAAQ,CAAC,CAAC;MACrD,IAAIA,QAAQ,CAACoD,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAQ,GAAEpD,QAAS,GAAE,CAAC,CAAC;MACnD;MACA;MACA,MAAMqD,aAAa,GAAGrD,QAAQ,CAAC6B,KAAK,CAAC,IAAI,CAAC;MAC1C;MACA,MAAMyB,wBAAwB,GAAGD,aAAa,CAACE,WAAW,CAAC,KAAK,CAAC;MACjEF,aAAa,CAACC,wBAAwB,CAAC,IAAI,GAAG;MAC9C,OAAOD,aAAa,CAACd,IAAI,CAAC,IAAI,CAAC;IACjC,CAAC,CAAC;IACF,OAAOW,kBAAkB,CAACX,IAAI,CAAC,IAAI,CAAC;EACtC;AACF;AAACiB,OAAA,CAAAjE,iBAAA,GAAAA,iBAAA"}
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.regexp.exec.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.conflictIndicator = exports.ConfigMerger = void 0;
10
- function _defineProperty2() {
11
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- _defineProperty2 = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
7
  function _semver() {
18
8
  const data = _interopRequireDefault(require("semver"));
19
9
  _semver = function () {
@@ -56,8 +46,12 @@ function _configMergeResult() {
56
46
  };
57
47
  return data;
58
48
  }
49
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
50
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
60
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
52
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
54
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
61
55
  const conflictIndicator = 'CONFLICT::';
62
56
  exports.conflictIndicator = conflictIndicator;
63
57
  /**
@@ -93,11 +87,11 @@ class ConfigMerger {
93
87
  this.currentLabel = currentLabel;
94
88
  this.otherLabel = otherLabel;
95
89
  this.logger = logger;
96
- (0, _defineProperty2().default)(this, "currentEnv", void 0);
97
- (0, _defineProperty2().default)(this, "otherEnv", void 0);
98
- (0, _defineProperty2().default)(this, "baseEnv", void 0);
99
- (0, _defineProperty2().default)(this, "handledExtIds", []);
100
- (0, _defineProperty2().default)(this, "otherLaneIdsStr", void 0);
90
+ _defineProperty(this, "currentEnv", void 0);
91
+ _defineProperty(this, "otherEnv", void 0);
92
+ _defineProperty(this, "baseEnv", void 0);
93
+ _defineProperty(this, "handledExtIds", []);
94
+ _defineProperty(this, "otherLaneIdsStr", void 0);
101
95
  this.otherLaneIdsStr = (otherLane === null || otherLane === void 0 ? void 0 : otherLane.toBitIds().map(id => id.toString())) || [];
102
96
  }
103
97
  merge() {
@@ -1 +1 @@
1
- {"version":3,"names":["_semver","data","_interopRequireDefault","require","_componentVersion","_dependencyResolver","_envs","_lodash","_configMergeResult","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","conflictIndicator","exports","ConfigMerger","constructor","compIdStr","workspaceIds","otherLane","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","logger","otherLaneIdsStr","toBitIds","map","id","toString","merge","debug","populateEnvs","results","currentExt","stringId","handledExtIds","includes","baseExt","findExtension","otherExt","mergePerStrategy","conflict","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","extensionId","hasVersion","idFromWorkspace","getIdFromWorkspace","toStringWithoutVersion","existingExt","_legacy","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","currentEnv","otherEnv","baseEnv","undefined","currentEnvAspect","_currentEnvAspect$ext","version","otherEnvAspect","_otherEnvAspect$exten","baseEnvAspect","_baseEnvAspect$extens","mergeStrategyParams","_this$baseEnv","_this$baseEnv2","baseConfig","isIdInWorkspaceOrOtherLane","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","params","DependencyResolverAspect","trace","currentPolicy","getPolicy","otherPolicy","basePolicy","getAllDeps","_ext$findCoreExtensio","_ext$findCoreExtensio2","dependencies","policy","d","idWithoutVersion","__type","split","existingPolicy","find","p","dependencyId","getPolicyVer","value","getDataPolicy","_ext$findCoreExtensio3","getAutoDeps","allDeps","currentAutoData","currentAllData","currentDataPolicy","otherData","currentAndOtherData","uniqBy","concat","currentAndOtherComponentsData","c","baseData","getCompIdStrByPkgNameFromData","pkgName","found","packageName","getFromCurrentDataByPackageName","getFromCurrentDataPolicyByPackageName","mergedPolicy","devDependencies","peerDependencies","conflictedPolicy","hasConflict","lifecycleToDepType","runtime","dev","peer","handleConfigMerge","addVariantPolicyEntryToPolicy","dep","fromCurrentData","force","isHash","semver","satisfies","fromCurrentDataPolicy","depType","lifecycleType","name","currentAndOtherConfig","currentDep","otherDep","baseDep","currentVer","otherVer","baseVer","hasConfigForDep","depName","getDepIdAsPkgName","addSerializedDepToPolicy","lifecycle","join","depData","isEnv","currentId","versionOnOtherLane","Boolean","rawConfig","omit","VariantPolicy","fromConfigObject","entries"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { Logger } from '@teambit/logger';\nimport { isHash } from '@teambit/component-version';\nimport {\n DependencyResolverAspect,\n SerializedDependency,\n VariantPolicy,\n VariantPolicyEntry,\n} from '@teambit/dependency-resolver';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\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\nexport type GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string; packageName?: string };\n\nexport const conflictIndicator = 'CONFLICT::';\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: Record<string, any>;\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 private otherLaneIdsStr: string[];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n otherLane: Lane | undefined,\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string,\n private logger: Logger\n ) {\n this.otherLaneIdsStr = otherLane?.toBitIds().map((id) => id.toString()) || [];\n }\n\n merge(): ConfigMergeResult {\n this.logger.debug(`\\n************** start config-merger for ${this.compIdStr} **************`);\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 { id, conflict: { 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 let id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n if (otherExt.extensionId && otherExt.extensionId.hasVersion()) {\n // avoid using the id from the other lane if it exits in the workspace. prefer the id from the workspace.\n const idFromWorkspace = this.getIdFromWorkspace(otherExt.extensionId.toStringWithoutVersion());\n if (idFromWorkspace) {\n const existingExt = this.currentAspects.findExtension(otherExt.extensionId.toStringWithoutVersion(), true);\n if (existingExt) return null; // the aspect is set currently, no need to add it again.\n id = idFromWorkspace._legacy.toString();\n }\n }\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return { id, conflict: { 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 this.logger.debug(`*** end config-merger for ${this.compIdStr} ***\\n`);\n return new ConfigMergeResult(\n this.compIdStr,\n this.currentLabel,\n this.otherLabel,\n compact([...results, ...otherAspectsNotHandledResults, ...envResult])\n );\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 = this.getConfig(currentEnvAspect);\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 = this.getConfig(otherEnvAspect);\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 = this.getConfig(baseEnvAspect);\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.isIdInWorkspaceOrOtherLane(this.currentEnv.id, this.otherEnv.version)) {\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\n if (depResolverResult) {\n // if (depResolverResult.mergedConfig || depResolverResult?.conflict) console.log(\"\\n\\nDepResolverResult\", this.compIdStr, '\\n', JSON.stringify(depResolverResult, undefined, 2))\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 return { id, conflict: { currentConfig, otherConfig, baseConfig } };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n this.logger.trace(`start depResolverStrategy for ${this.compIdStr}`);\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 getAllDeps = (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.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 return d.version;\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 const getDataPolicy = (ext: ExtensionDataList): VariantPolicyEntry[] => {\n return ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const allDeps = getAllDeps(ext);\n return allDeps.filter((d) => d.source === 'auto');\n };\n\n const currentAutoData = getAutoDeps(this.currentAspects);\n const currentAllData = getAllDeps(this.currentAspects);\n const currentDataPolicy = getDataPolicy(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentAutoData.concat(otherData), (d) => d.id);\n const currentAndOtherComponentsData = currentAndOtherData.filter((c) => c.__type === 'component');\n const baseData = getAutoDeps(this.baseAspects);\n\n const getCompIdStrByPkgNameFromData = (pkgName: string): string | undefined => {\n const found = currentAndOtherComponentsData.find((d) => d.packageName === pkgName);\n return found?.id;\n };\n\n const getFromCurrentDataByPackageName = (pkgName: string) => {\n return currentAllData.find((d) => {\n if (d.__type === 'package') return d.id === pkgName;\n return d.packageName === pkgName;\n });\n };\n\n const getFromCurrentDataPolicyByPackageName = (pkgName: string) => {\n return currentDataPolicy.find((d) => d.dependencyId === pkgName);\n };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let hasConflict = false;\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const handleConfigMerge = () => {\n const addVariantPolicyEntryToPolicy = (dep: VariantPolicyEntry) => {\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, dep.value.version)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n const fromCurrentData = getFromCurrentDataByPackageName(dep.dependencyId);\n if (fromCurrentData && !dep.force) {\n if (fromCurrentData.version === dep.value.version) return;\n if (\n !isHash(fromCurrentData.version) &&\n !isHash(dep.value.version) &&\n semver.satisfies(fromCurrentData.version, dep.value.version)\n ) {\n return;\n }\n }\n const fromCurrentDataPolicy = getFromCurrentDataPolicyByPackageName(dep.dependencyId);\n if (fromCurrentDataPolicy && fromCurrentDataPolicy.value.version === dep.value.version) {\n // that's a bug. if it's in the data.policy, it should be in data.dependencies.\n return;\n }\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 };\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 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 if (baseVer && baseVer === currentVer) {\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, otherVer)) {\n // no need to add if the id exists in the workspace (regardless the version)\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 if (dep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(dep.id, dep.version)) {\n return;\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 };\n\n this.logger.debug(\n `currentData, ${currentAllData.length}\\n${currentAllData\n .map((d) => `${d.__type} ${d.id} ${d.version}`)\n .join('\\n')}`\n );\n this.logger.debug(\n `otherData, ${otherData.length}\\n${otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n this.logger.debug(\n `baseData, ${baseData.length}\\n${baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n\n // eslint-disable-next-line complexity\n currentAndOtherData.forEach((depData) => {\n this.logger.trace(`depData.id, ${depData.id}`);\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentAllData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n const baseDep = baseData.find((d) => d.id === depData.id);\n\n this.logger.trace(`currentDep`, currentDep);\n this.logger.trace(`otherDep`, otherDep);\n this.logger.trace(`baseDep`, baseDep);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n if (baseDep) {\n // exists in other and base, so it was removed from current\n return;\n }\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n\n if (currentDep.policy && otherDep.policy) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n return;\n }\n }\n\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n const currentId = currentDep.id;\n if (currentDep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(currentId, otherDep.version)) {\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 const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\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 const config = Object.keys(mergedPolicy).length ? { policy: mergedPolicy } : undefined;\n const conflict = hasConflict ? conflictedPolicy : undefined;\n\n this.logger.debug('final mergedConfig', config);\n this.logger.debug('final conflict', conflict);\n\n return { id: params.id, mergedConfig: config, conflict };\n }\n\n private isIdInWorkspaceOrOtherLane(id: string, versionOnOtherLane?: string): boolean {\n return Boolean(this.getIdFromWorkspace(id)) || this.otherLaneIdsStr.includes(`${id}@${versionOnOtherLane}`);\n }\n\n private getIdFromWorkspace(id: string): ComponentID | undefined {\n return 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): GenericConfigOrRemoved {\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.fromConf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AAM,CAAC,CAAC0E,OAAO;EAC9D;AACF;AAACnK,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["_semver","data","_interopRequireDefault","require","_componentVersion","_dependencyResolver","_envs","_lodash","_configMergeResult","obj","__esModule","default","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","conflictIndicator","exports","ConfigMerger","constructor","compIdStr","workspaceIds","otherLane","currentAspects","baseAspects","otherAspects","currentLabel","otherLabel","logger","otherLaneIdsStr","toBitIds","map","id","toString","merge","debug","populateEnvs","results","currentExt","stringId","handledExtIds","includes","baseExt","findExtension","otherExt","mergePerStrategy","conflict","currentConfig","getConfig","otherConfig","otherAspectsNotHandledResults","extensionId","hasVersion","idFromWorkspace","getIdFromWorkspace","toStringWithoutVersion","existingExt","_legacy","mergedConfig","envResult","envStrategy","ConfigMergeResult","compact","getEnvId","ext","envsAspect","findCoreExtension","EnvsAspect","Error","env","config","currentEnv","otherEnv","baseEnv","currentEnvAspect","_currentEnvAspect$ext","version","otherEnvAspect","_otherEnvAspect$exten","baseEnvAspect","_baseEnvAspect$extens","mergeStrategyParams","_this$baseEnv","_this$baseEnv2","baseConfig","isIdInWorkspaceOrOtherLane","basicConfigMerge","areConfigsEqual","configA","configB","JSON","stringify","depResolverResult","depResolverStrategy","params","DependencyResolverAspect","trace","currentPolicy","getPolicy","otherPolicy","basePolicy","getAllDeps","_ext$findCoreExtensio","_ext$findCoreExtensio2","dependencies","policy","d","idWithoutVersion","__type","split","existingPolicy","find","p","dependencyId","getPolicyVer","getDataPolicy","_ext$findCoreExtensio3","getAutoDeps","allDeps","currentAutoData","currentAllData","currentDataPolicy","otherData","currentAndOtherData","uniqBy","concat","currentAndOtherComponentsData","c","baseData","getCompIdStrByPkgNameFromData","pkgName","found","packageName","getFromCurrentDataByPackageName","getFromCurrentDataPolicyByPackageName","mergedPolicy","devDependencies","peerDependencies","conflictedPolicy","hasConflict","lifecycleToDepType","runtime","dev","peer","handleConfigMerge","addVariantPolicyEntryToPolicy","dep","fromCurrentData","force","isHash","semver","satisfies","fromCurrentDataPolicy","depType","lifecycleType","name","currentAndOtherConfig","currentDep","otherDep","baseDep","currentVer","otherVer","baseVer","hasConfigForDep","depName","getDepIdAsPkgName","addSerializedDepToPolicy","lifecycle","join","depData","isEnv","currentId","versionOnOtherLane","Boolean","rawConfig","omit","VariantPolicy","fromConfigObject","entries"],"sources":["config-merger.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport semver from 'semver';\nimport { Logger } from '@teambit/logger';\nimport { isHash } from '@teambit/component-version';\nimport {\n DependencyResolverAspect,\n SerializedDependency,\n VariantPolicy,\n VariantPolicyEntry,\n} from '@teambit/dependency-resolver';\nimport { Lane } from '@teambit/legacy/dist/scope/models';\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\nexport type GenericConfigOrRemoved = Record<string, any> | '-';\n\ntype EnvData = { id: string; version?: string; config?: GenericConfigOrRemoved };\n\ntype SerializedDependencyWithPolicy = SerializedDependency & { policy?: string; packageName?: string };\n\nexport const conflictIndicator = 'CONFLICT::';\n\nexport type MergeStrategyResult = {\n id: string;\n mergedConfig?: GenericConfigOrRemoved;\n conflict?: Record<string, any>;\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 private otherLaneIdsStr: string[];\n constructor(\n private compIdStr: string,\n private workspaceIds: ComponentID[],\n otherLane: Lane | undefined,\n private currentAspects: ExtensionDataList,\n private baseAspects: ExtensionDataList,\n private otherAspects: ExtensionDataList,\n private currentLabel: string,\n private otherLabel: string,\n private logger: Logger\n ) {\n this.otherLaneIdsStr = otherLane?.toBitIds().map((id) => id.toString()) || [];\n }\n\n merge(): ConfigMergeResult {\n this.logger.debug(`\\n************** start config-merger for ${this.compIdStr} **************`);\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 { id, conflict: { 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 let id = otherExt.stringId;\n if (this.handledExtIds.includes(id)) return null;\n this.handledExtIds.push(id);\n if (otherExt.extensionId && otherExt.extensionId.hasVersion()) {\n // avoid using the id from the other lane if it exits in the workspace. prefer the id from the workspace.\n const idFromWorkspace = this.getIdFromWorkspace(otherExt.extensionId.toStringWithoutVersion());\n if (idFromWorkspace) {\n const existingExt = this.currentAspects.findExtension(otherExt.extensionId.toStringWithoutVersion(), true);\n if (existingExt) return null; // the aspect is set currently, no need to add it again.\n id = idFromWorkspace._legacy.toString();\n }\n }\n const baseExt = this.baseAspects.findExtension(id, true);\n if (baseExt) {\n // was removed on current\n return { id, conflict: { 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 this.logger.debug(`*** end config-merger for ${this.compIdStr} ***\\n`);\n return new ConfigMergeResult(\n this.compIdStr,\n this.currentLabel,\n this.otherLabel,\n compact([...results, ...otherAspectsNotHandledResults, ...envResult])\n );\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 = this.getConfig(currentEnvAspect);\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 = this.getConfig(otherEnvAspect);\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 = this.getConfig(baseEnvAspect);\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.isIdInWorkspaceOrOtherLane(this.currentEnv.id, this.otherEnv.version)) {\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\n if (depResolverResult) {\n // if (depResolverResult.mergedConfig || depResolverResult?.conflict) console.log(\"\\n\\nDepResolverResult\", this.compIdStr, '\\n', JSON.stringify(depResolverResult, undefined, 2))\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 return { id, conflict: { currentConfig, otherConfig, baseConfig } };\n }\n\n private depResolverStrategy(params: MergeStrategyParams): MergeStrategyResult | undefined {\n if (params.id !== DependencyResolverAspect.id) return undefined;\n this.logger.trace(`start depResolverStrategy for ${this.compIdStr}`);\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 getAllDeps = (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.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 return d.version;\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 const getDataPolicy = (ext: ExtensionDataList): VariantPolicyEntry[] => {\n return ext.findCoreExtension(DependencyResolverAspect.id)?.data.policy || [];\n };\n\n const getAutoDeps = (ext: ExtensionDataList): SerializedDependencyWithPolicy[] => {\n const allDeps = getAllDeps(ext);\n return allDeps.filter((d) => d.source === 'auto');\n };\n\n const currentAutoData = getAutoDeps(this.currentAspects);\n const currentAllData = getAllDeps(this.currentAspects);\n const currentDataPolicy = getDataPolicy(this.currentAspects);\n const otherData = getAutoDeps(this.otherAspects);\n const currentAndOtherData = uniqBy(currentAutoData.concat(otherData), (d) => d.id);\n const currentAndOtherComponentsData = currentAndOtherData.filter((c) => c.__type === 'component');\n const baseData = getAutoDeps(this.baseAspects);\n\n const getCompIdStrByPkgNameFromData = (pkgName: string): string | undefined => {\n const found = currentAndOtherComponentsData.find((d) => d.packageName === pkgName);\n return found?.id;\n };\n\n const getFromCurrentDataByPackageName = (pkgName: string) => {\n return currentAllData.find((d) => {\n if (d.__type === 'package') return d.id === pkgName;\n return d.packageName === pkgName;\n });\n };\n\n const getFromCurrentDataPolicyByPackageName = (pkgName: string) => {\n return currentDataPolicy.find((d) => d.dependencyId === pkgName);\n };\n\n const mergedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n const conflictedPolicy = {\n dependencies: [],\n devDependencies: [],\n peerDependencies: [],\n };\n let hasConflict = false;\n const lifecycleToDepType = {\n runtime: 'dependencies',\n dev: 'devDependencies',\n peer: 'peerDependencies',\n };\n const handleConfigMerge = () => {\n const addVariantPolicyEntryToPolicy = (dep: VariantPolicyEntry) => {\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, dep.value.version)) {\n // no need to add if the id exists in the workspace (regardless the version)\n return;\n }\n const fromCurrentData = getFromCurrentDataByPackageName(dep.dependencyId);\n if (fromCurrentData && !dep.force) {\n if (fromCurrentData.version === dep.value.version) return;\n if (\n !isHash(fromCurrentData.version) &&\n !isHash(dep.value.version) &&\n semver.satisfies(fromCurrentData.version, dep.value.version)\n ) {\n return;\n }\n }\n const fromCurrentDataPolicy = getFromCurrentDataPolicyByPackageName(dep.dependencyId);\n if (fromCurrentDataPolicy && fromCurrentDataPolicy.value.version === dep.value.version) {\n // that's a bug. if it's in the data.policy, it should be in data.dependencies.\n return;\n }\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 };\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 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 if (baseVer && baseVer === currentVer) {\n addVariantPolicyEntryToPolicy(otherDep);\n return;\n }\n const compIdStr = getCompIdStrByPkgNameFromData(dep.dependencyId);\n if (compIdStr && this.isIdInWorkspaceOrOtherLane(compIdStr, otherVer)) {\n // no need to add if the id exists in the workspace (regardless the version)\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 if (dep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(dep.id, dep.version)) {\n return;\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 };\n\n this.logger.debug(\n `currentData, ${currentAllData.length}\\n${currentAllData\n .map((d) => `${d.__type} ${d.id} ${d.version}`)\n .join('\\n')}`\n );\n this.logger.debug(\n `otherData, ${otherData.length}\\n${otherData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n this.logger.debug(\n `baseData, ${baseData.length}\\n${baseData.map((d) => `${d.__type} ${d.id} ${d.version}`).join('\\n')}`\n );\n\n // eslint-disable-next-line complexity\n currentAndOtherData.forEach((depData) => {\n this.logger.trace(`depData.id, ${depData.id}`);\n if (this.isEnv(depData.id)) {\n // ignore the envs\n return;\n }\n const currentDep = currentAllData.find((d) => d.id === depData.id);\n const otherDep = otherData.find((d) => d.id === depData.id);\n const baseDep = baseData.find((d) => d.id === depData.id);\n\n this.logger.trace(`currentDep`, currentDep);\n this.logger.trace(`otherDep`, otherDep);\n this.logger.trace(`baseDep`, baseDep);\n if (!otherDep) {\n return;\n }\n if (!currentDep) {\n if (baseDep) {\n // exists in other and base, so it was removed from current\n return;\n }\n // only on other\n addSerializedDepToPolicy(otherDep);\n return;\n }\n\n if (currentDep.policy && otherDep.policy) {\n if (semver.satisfies(currentDep.version, otherDep.policy)) {\n return;\n }\n if (semver.satisfies(otherDep.version, currentDep.policy)) {\n return;\n }\n }\n\n const currentVer = currentDep.policy || currentDep.version;\n const otherVer = otherDep.policy || otherDep.version;\n if (currentVer === otherVer) {\n return;\n }\n const baseVer = baseDep?.policy || baseDep?.version;\n if (baseVer && baseVer === otherVer) {\n return;\n }\n const currentId = currentDep.id;\n if (currentDep.__type === 'component' && this.isIdInWorkspaceOrOtherLane(currentId, otherDep.version)) {\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 const depType = lifecycleToDepType[currentDep.lifecycle];\n if (hasConfigForDep(depType, currentDep.id)) {\n return; // there is already config for it.\n }\n if (baseVer && baseVer === currentVer) {\n addSerializedDepToPolicy(otherDep);\n return;\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 const config = Object.keys(mergedPolicy).length ? { policy: mergedPolicy } : undefined;\n const conflict = hasConflict ? conflictedPolicy : undefined;\n\n this.logger.debug('final mergedConfig', config);\n this.logger.debug('final conflict', conflict);\n\n return { id: params.id, mergedConfig: config, conflict };\n }\n\n private isIdInWorkspaceOrOtherLane(id: string, versionOnOtherLane?: string): boolean {\n return Boolean(this.getIdFromWorkspace(id)) || this.otherLaneIdsStr.includes(`${id}@${versionOnOtherLane}`);\n }\n\n private getIdFromWorkspace(id: string): ComponentID | undefined {\n return 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): GenericConfigOrRemoved {\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,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,KAAA,YAAAA,CAAA;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AO,IAAAC,cAAI,EAAC/G,GAAG,CAAC8G,SAAS,EAAE,CAAC,YAAY,CAAC,CAAC;EAC5C;EAEQ5E,SAASA,CAAC5B,MAAM,EAAwB;IAC9C,IAAI,CAACA,MAAM,CAACmC,MAAM,EAAE,OAAO,EAAE;IAC7B,OAAOuE,mCAAa,CAACC,gBAAgB,CAAC3G,MAAM,CAACmC,MAAM,CAAC,CAACyE,OAAO;EAC9D;AACF;AAACjK,OAAA,CAAAC,YAAA,GAAAA,YAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MergingAspect } from './merging.aspect';
2
2
  export { mergeReport, applyVersionReport, conflictSummaryReport, installationErrorOutput, compilationErrorOutput, getRemovedOutput, getAddedOutput, } from './merge-cmd';
3
- export type { MergingMain, ComponentMergeStatus, ApplyVersionResults } from './merging.main.runtime';
3
+ export type { MergingMain, ComponentMergeStatus, ApplyVersionResults, FailedComponents } from './merging.main.runtime';
4
4
  export { ConfigMergeResult } from './config-merge-result';
5
5
  export default MergingAspect;
6
6
  export { MergingAspect };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_merging","data","require","_mergeCmd","_configMergeResult","_default","MergingAspect","exports","default"],"sources":["index.ts"],"sourcesContent":["import { MergingAspect } from './merging.aspect';\n\nexport {\n mergeReport,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n} from './merge-cmd';\nexport type { MergingMain, ComponentMergeStatus, ApplyVersionResults } from './merging.main.runtime';\nexport { ConfigMergeResult } from './config-merge-result';\nexport default MergingAspect;\nexport { MergingAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,IAAAI,QAAA,GAC3CC,wBAAa;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_merging","data","require","_mergeCmd","_configMergeResult","_default","MergingAspect","exports","default"],"sources":["index.ts"],"sourcesContent":["import { MergingAspect } from './merging.aspect';\n\nexport {\n mergeReport,\n applyVersionReport,\n conflictSummaryReport,\n installationErrorOutput,\n compilationErrorOutput,\n getRemovedOutput,\n getAddedOutput,\n} from './merge-cmd';\nexport type { MergingMain, ComponentMergeStatus, ApplyVersionResults, FailedComponents } from './merging.main.runtime';\nexport { ConfigMergeResult } from './config-merge-result';\nexport default MergingAspect;\nexport { MergingAspect };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,IAAAI,QAAA,GAC3CC,wBAAa;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
package/dist/merge-cmd.js CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
@@ -14,13 +11,6 @@ exports.getAddedOutput = getAddedOutput;
14
11
  exports.getRemovedOutput = getRemovedOutput;
15
12
  exports.installationErrorOutput = installationErrorOutput;
16
13
  exports.mergeReport = mergeReport;
17
- function _defineProperty2() {
18
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
- _defineProperty2 = function () {
20
- return data;
21
- };
22
- return data;
23
- }
24
14
  function _chalk() {
25
15
  const data = _interopRequireDefault(require("chalk"));
26
16
  _chalk = function () {
@@ -63,21 +53,25 @@ function _bitError() {
63
53
  };
64
54
  return data;
65
55
  }
56
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
57
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
58
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
59
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
66
60
  class MergeCmd {
67
61
  constructor(merging) {
68
62
  this.merging = merging;
69
- (0, _defineProperty2().default)(this, "name", 'merge [ids...]');
70
- (0, _defineProperty2().default)(this, "description", 'merge changes of the remote head into local - auto-snaps all merged components');
71
- (0, _defineProperty2().default)(this, "helpUrl", 'reference/components/merging-changes');
72
- (0, _defineProperty2().default)(this, "group", 'development');
73
- (0, _defineProperty2().default)(this, "extendedDescription", `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local
63
+ _defineProperty(this, "name", 'merge [ids...]');
64
+ _defineProperty(this, "description", 'merge changes of the remote head into local - auto-snaps all merged components');
65
+ _defineProperty(this, "helpUrl", 'reference/components/merging-changes');
66
+ _defineProperty(this, "group", 'development');
67
+ _defineProperty(this, "extendedDescription", `merge changes of the remote head into local when they are diverged. when on a lane, merge the remote head of the lane into the local
74
68
  and creates snaps for merged components that have diverged, on the lane.
75
69
  if no ids are specified, all pending-merge components will be merged. (run "bit status" to list them).
76
70
  optionally use '--abort' to revert the last merge. to revert a lane merge, use "bit lane merge-abort" command.
77
71
  ${(0, _constants().WILDCARD_HELP)('merge')}`);
78
- (0, _defineProperty2().default)(this, "alias", '');
79
- (0, _defineProperty2().default)(this, "options", [['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'], ['', 'theirs', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version'], ['', 'manual', 'DEPRECATED. use --auto-merge-resolve'], ['', 'auto-merge-resolve <merge-strategy>', 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]'], ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'], ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'], ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'], ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'], ['', 'verbose', 'show details of components that were not merged successfully'], ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'], ['m', 'message <message>', 'override the default message for the auto snap']]);
80
- (0, _defineProperty2().default)(this, "loader", true);
72
+ _defineProperty(this, "alias", '');
73
+ _defineProperty(this, "options", [['', 'ours', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, keep the local modification'], ['', 'theirs', 'DEPRECATED. use --auto-merge-resolve. in case of a conflict, override the local modification with the specified version'], ['', 'manual', 'DEPRECATED. use --auto-merge-resolve'], ['', 'auto-merge-resolve <merge-strategy>', 'in case of a conflict, resolve according to the strategy: [ours, theirs, manual]'], ['', 'abort', 'in case of an unresolved merge, revert to pre-merge state'], ['', 'resolve', 'mark an unresolved merge as resolved and create a new snap with the changes'], ['', 'no-snap', 'do not auto snap even if the merge completed without conflicts'], ['', 'build', 'in case of snap during the merge, run the build-pipeline (similar to bit snap --build)'], ['', 'verbose', 'show details of components that were not merged successfully'], ['x', 'skip-dependency-installation', 'do not install new dependencies resulting from the merge'], ['m', 'message <message>', 'override the default message for the auto snap']]);
74
+ _defineProperty(this, "loader", true);
81
75
  }
82
76
  async report([ids = []], {
83
77
  ours = false,
@@ -205,7 +199,7 @@ ${mergeSnapError.message}
205
199
  const body = (0, _lodash().compact)(failedComponents.map(failedComponent => {
206
200
  if (!verbose && failedComponent.unchangedLegitimately) return null;
207
201
  const color = failedComponent.unchangedLegitimately ? 'white' : 'red';
208
- return `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default[color](failedComponent.failureMessage)}`;
202
+ return `${_chalk().default.bold(failedComponent.id.toString())} - ${_chalk().default[color](failedComponent.unchangedMessage)}`;
209
203
  })).join('\n');
210
204
  if (!body) {
211
205
  return `${_chalk().default.bold(`\nmerge skipped legitimately for ${failedComponents.length} component(s)`)}