@teambit/merging 1.0.1239 → 1.0.1240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/merge-dependencies.d.ts +48 -0
- package/dist/merge-dependencies.js +138 -0
- package/dist/merge-dependencies.js.map +1 -0
- package/dist/merge-dependencies.spec.d.ts +1 -0
- package/dist/merge-dependencies.spec.js +299 -0
- package/dist/merge-dependencies.spec.js.map +1 -0
- package/dist/merge-status-provider.js +19 -1
- package/dist/merge-status-provider.js.map +1 -1
- package/dist/merging.main.runtime.d.ts +15 -0
- package/dist/merging.main.runtime.js +55 -1
- package/dist/merging.main.runtime.js.map +1 -1
- package/package.json +29 -27
- /package/dist/{preview-1792442853086.js → preview-1792527927744.js} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MergeStrategy } from '@teambit/component.modules.merge-helper';
|
|
2
|
+
import type { ComponentIdList } from '@teambit/component-id';
|
|
3
|
+
import type { ExtensionDataList } from '@teambit/legacy.extension-data';
|
|
4
|
+
import { Dependencies } from '@teambit/legacy.consumer-component';
|
|
5
|
+
declare const COMPONENT_DEPS_FIELDS: readonly ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
6
|
+
declare const PACKAGE_DEPS_FIELDS: readonly ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'];
|
|
7
|
+
type ComponentDepsField = (typeof COMPONENT_DEPS_FIELDS)[number];
|
|
8
|
+
type PackageDepsField = (typeof PACKAGE_DEPS_FIELDS)[number];
|
|
9
|
+
/**
|
|
10
|
+
* the dependency fields shared by a Version object and a ConsumerComponent.
|
|
11
|
+
*/
|
|
12
|
+
export type DependenciesSnapshot = {
|
|
13
|
+
[field in ComponentDepsField]: Dependencies;
|
|
14
|
+
} & {
|
|
15
|
+
[field in PackageDepsField]: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* the dependencies of a Version, with the package names of the component dependencies, same as a component loaded from
|
|
19
|
+
* the scope has them (see ModelComponent.toConsumerComponent). without them, a dependency of a Version and the same
|
|
20
|
+
* dependency of a loaded component are not equal.
|
|
21
|
+
* returns copies, so they can be changed (e.g. set to a component that is snapped) without changing the Version.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDependenciesOfVersion(version: DependenciesSnapshot & {
|
|
24
|
+
extensions: ExtensionDataList;
|
|
25
|
+
}): DependenciesSnapshot;
|
|
26
|
+
/**
|
|
27
|
+
* 3-way merge of the resolved dependencies of a component: base (the common snap), current (the target lane) and
|
|
28
|
+
* other (the merged lane/main).
|
|
29
|
+
*
|
|
30
|
+
* a workspace merge gets the dependencies of the merged component by re-detecting them from the merged files. a bare
|
|
31
|
+
* scope has no node_modules to resolve imports against, so it merges the dependencies that each side resolved when it
|
|
32
|
+
* was snapped instead: a dependency added or removed on one side, or whose version or type (runtime/dev/peer) changed
|
|
33
|
+
* on one side, is taken from that side. it's close to what the detection finds, not identical. e.g. when one side
|
|
34
|
+
* removed an import of a dependency from one file and the other side added an import of it to another file, the
|
|
35
|
+
* dependency is removed, although the merged files still import it.
|
|
36
|
+
*
|
|
37
|
+
* each dependency is keyed by its name, and its field (runtime/dev/peer) is part of what is compared, so a dependency
|
|
38
|
+
* that moved between fields on one side is taken from that side, and it's never added to two fields.
|
|
39
|
+
* when both sides changed the same dependency differently, "theirs" takes other, any other strategy keeps current
|
|
40
|
+
* (in "manual", such a version conflict is reported by the config-merger, which stops the merge before the snap).
|
|
41
|
+
* the returned component dependencies are copies, so they can be changed without changing the inputs.
|
|
42
|
+
*
|
|
43
|
+
* `laneComponentIds` are the components of the current lane. a dependency on one of them gets the lane's version
|
|
44
|
+
* anyway (see MergingMain.setLaneVersionsOfDeps), so its version is not compared. otherwise, the lane snap of it would
|
|
45
|
+
* look like a change on the lane, and a removal of it on the other side would be lost.
|
|
46
|
+
*/
|
|
47
|
+
export declare function mergeDependencies(base: DependenciesSnapshot, current: DependenciesSnapshot, other: DependenciesSnapshot, mergeStrategy?: MergeStrategy, laneComponentIds?: ComponentIdList): DependenciesSnapshot;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDependenciesOfVersion = getDependenciesOfVersion;
|
|
7
|
+
exports.mergeDependencies = mergeDependencies;
|
|
8
|
+
function _lodash() {
|
|
9
|
+
const data = require("lodash");
|
|
10
|
+
_lodash = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _legacy() {
|
|
16
|
+
const data = require("@teambit/legacy.consumer-component");
|
|
17
|
+
_legacy = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _objects() {
|
|
23
|
+
const data = require("@teambit/objects");
|
|
24
|
+
_objects = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
32
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
33
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
34
|
+
const COMPONENT_DEPS_FIELDS = ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
35
|
+
const PACKAGE_DEPS_FIELDS = ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* the dependency fields shared by a Version object and a ConsumerComponent.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* the dependencies of a Version, with the package names of the component dependencies, same as a component loaded from
|
|
43
|
+
* the scope has them (see ModelComponent.toConsumerComponent). without them, a dependency of a Version and the same
|
|
44
|
+
* dependency of a loaded component are not equal.
|
|
45
|
+
* returns copies, so they can be changed (e.g. set to a component that is snapped) without changing the Version.
|
|
46
|
+
*/
|
|
47
|
+
function getDependenciesOfVersion(version) {
|
|
48
|
+
const withPackageNames = deps => new (_legacy().Dependencies)(_objects().ModelComponent.addDepsInfoFromDepsResolver(deps, version.extensions));
|
|
49
|
+
return {
|
|
50
|
+
dependencies: withPackageNames(version.dependencies),
|
|
51
|
+
devDependencies: withPackageNames(version.devDependencies),
|
|
52
|
+
peerDependencies: withPackageNames(version.peerDependencies),
|
|
53
|
+
packageDependencies: _objectSpread({}, version.packageDependencies),
|
|
54
|
+
devPackageDependencies: _objectSpread({}, version.devPackageDependencies),
|
|
55
|
+
peerPackageDependencies: _objectSpread({}, version.peerPackageDependencies)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 3-way merge of the resolved dependencies of a component: base (the common snap), current (the target lane) and
|
|
61
|
+
* other (the merged lane/main).
|
|
62
|
+
*
|
|
63
|
+
* a workspace merge gets the dependencies of the merged component by re-detecting them from the merged files. a bare
|
|
64
|
+
* scope has no node_modules to resolve imports against, so it merges the dependencies that each side resolved when it
|
|
65
|
+
* was snapped instead: a dependency added or removed on one side, or whose version or type (runtime/dev/peer) changed
|
|
66
|
+
* on one side, is taken from that side. it's close to what the detection finds, not identical. e.g. when one side
|
|
67
|
+
* removed an import of a dependency from one file and the other side added an import of it to another file, the
|
|
68
|
+
* dependency is removed, although the merged files still import it.
|
|
69
|
+
*
|
|
70
|
+
* each dependency is keyed by its name, and its field (runtime/dev/peer) is part of what is compared, so a dependency
|
|
71
|
+
* that moved between fields on one side is taken from that side, and it's never added to two fields.
|
|
72
|
+
* when both sides changed the same dependency differently, "theirs" takes other, any other strategy keeps current
|
|
73
|
+
* (in "manual", such a version conflict is reported by the config-merger, which stops the merge before the snap).
|
|
74
|
+
* the returned component dependencies are copies, so they can be changed without changing the inputs.
|
|
75
|
+
*
|
|
76
|
+
* `laneComponentIds` are the components of the current lane. a dependency on one of them gets the lane's version
|
|
77
|
+
* anyway (see MergingMain.setLaneVersionsOfDeps), so its version is not compared. otherwise, the lane snap of it would
|
|
78
|
+
* look like a change on the lane, and a removal of it on the other side would be lost.
|
|
79
|
+
*/
|
|
80
|
+
function mergeDependencies(base, current, other, mergeStrategy, laneComponentIds) {
|
|
81
|
+
const componentDeps = snapshot => new Map(COMPONENT_DEPS_FIELDS.flatMap(field => snapshot[field].get().map(dep => [dep.id.toStringWithoutVersion(), {
|
|
82
|
+
field,
|
|
83
|
+
value: dep
|
|
84
|
+
}])));
|
|
85
|
+
// all the persisted data is compared (e.g. the import paths and the version range), not only the id, so a change of
|
|
86
|
+
// any of them on one side is not lost. (no methods are called, a loaded component has the dependencies as plain objects)
|
|
87
|
+
const isSameDep = (a, b) => (laneComponentIds?.hasWithoutVersion(a.id) ? a.id.isEqualWithoutVersion(b.id) : a.id.isEqual(b.id)) && a.packageName === b.packageName && a.versionRange === b.versionRange && (0, _lodash().isEqual)(a.relativePaths, b.relativePaths);
|
|
88
|
+
const mergedCompDeps = mergeEntries(componentDeps(base), componentDeps(current), componentDeps(other), mergeStrategy, isSameDep);
|
|
89
|
+
const packageDeps = snapshot => new Map(PACKAGE_DEPS_FIELDS.flatMap(field => Object.entries(snapshot[field] || {}).map(([name, version]) => [name, {
|
|
90
|
+
field,
|
|
91
|
+
value: version
|
|
92
|
+
}])));
|
|
93
|
+
const mergedPkgDeps = mergeEntries(packageDeps(base), packageDeps(current), packageDeps(other), mergeStrategy, (a, b) => a === b);
|
|
94
|
+
const compDepsOf = field => new (_legacy().Dependencies)(mergedCompDeps.filter(entry => entry.field === field).map(({
|
|
95
|
+
value
|
|
96
|
+
}) => cloneDependency(value)));
|
|
97
|
+
const pkgDepsOf = field => Object.fromEntries(mergedPkgDeps.filter(entry => entry.field === field).map(({
|
|
98
|
+
key,
|
|
99
|
+
value
|
|
100
|
+
}) => [key, value]));
|
|
101
|
+
return {
|
|
102
|
+
dependencies: compDepsOf('dependencies'),
|
|
103
|
+
devDependencies: compDepsOf('devDependencies'),
|
|
104
|
+
peerDependencies: compDepsOf('peerDependencies'),
|
|
105
|
+
packageDependencies: pkgDepsOf('packageDependencies'),
|
|
106
|
+
devPackageDependencies: pkgDepsOf('devPackageDependencies'),
|
|
107
|
+
peerPackageDependencies: pkgDepsOf('peerPackageDependencies')
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 3-way merge of the entries of each key. an entry is unchanged between two sides when it's in the same field with an
|
|
112
|
+
* equal value. returns the merged entries that exist (not removed).
|
|
113
|
+
*/
|
|
114
|
+
function mergeEntries(base, current, other, mergeStrategy, isEqualValue) {
|
|
115
|
+
return (0, _lodash().union)([...current.keys()], [...other.keys()]).flatMap(key => {
|
|
116
|
+
const merged = mergeValue(base.get(key), current.get(key), other.get(key), mergeStrategy, (a, b) => a.field === b.field && isEqualValue(a.value, b.value));
|
|
117
|
+
return merged ? [_objectSpread({
|
|
118
|
+
key
|
|
119
|
+
}, merged)] : [];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* returns undefined when the merged result is "absent" (removed or never existed).
|
|
125
|
+
*/
|
|
126
|
+
function mergeValue(base, current, other, mergeStrategy, isEqualValue) {
|
|
127
|
+
const equal = (a, b) => a === undefined || b === undefined ? a === b : isEqualValue(a, b);
|
|
128
|
+
if (equal(current, other)) return current;
|
|
129
|
+
if (equal(base, current)) return other; // changed (or removed) on other only
|
|
130
|
+
if (equal(base, other)) return current; // changed (or removed) on current only
|
|
131
|
+
return mergeStrategy === 'theirs' ? other : current;
|
|
132
|
+
}
|
|
133
|
+
function cloneDependency(dep) {
|
|
134
|
+
const clone = _legacy().Dependency.getClone(dep);
|
|
135
|
+
return new (_legacy().Dependency)(clone.id, clone.relativePaths, clone.packageName, clone.versionRange);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=merge-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_lodash","data","require","_legacy","_objects","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","COMPONENT_DEPS_FIELDS","PACKAGE_DEPS_FIELDS","getDependenciesOfVersion","version","withPackageNames","deps","Dependencies","ModelComponent","addDepsInfoFromDepsResolver","extensions","dependencies","devDependencies","peerDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","mergeDependencies","base","current","other","mergeStrategy","laneComponentIds","componentDeps","snapshot","Map","flatMap","field","get","map","dep","id","toStringWithoutVersion","isSameDep","a","b","hasWithoutVersion","isEqualWithoutVersion","isEqual","packageName","versionRange","relativePaths","mergedCompDeps","mergeEntries","packageDeps","entries","name","mergedPkgDeps","compDepsOf","entry","cloneDependency","pkgDepsOf","fromEntries","key","isEqualValue","union","merged","mergeValue","equal","undefined","clone","Dependency","getClone"],"sources":["merge-dependencies.ts"],"sourcesContent":["import type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport { isEqual, union } from 'lodash';\nimport type { ComponentIdList } from '@teambit/component-id';\nimport type { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { Dependencies, Dependency } from '@teambit/legacy.consumer-component';\nimport { ModelComponent } from '@teambit/objects';\n\nconst COMPONENT_DEPS_FIELDS = ['dependencies', 'devDependencies', 'peerDependencies'] as const;\nconst PACKAGE_DEPS_FIELDS = ['packageDependencies', 'devPackageDependencies', 'peerPackageDependencies'] as const;\n\ntype ComponentDepsField = (typeof COMPONENT_DEPS_FIELDS)[number];\ntype PackageDepsField = (typeof PACKAGE_DEPS_FIELDS)[number];\n\n/**\n * the dependency fields shared by a Version object and a ConsumerComponent.\n */\nexport type DependenciesSnapshot = { [field in ComponentDepsField]: Dependencies } & {\n [field in PackageDepsField]: Record<string, string>;\n};\n\n/**\n * the dependencies of a Version, with the package names of the component dependencies, same as a component loaded from\n * the scope has them (see ModelComponent.toConsumerComponent). without them, a dependency of a Version and the same\n * dependency of a loaded component are not equal.\n * returns copies, so they can be changed (e.g. set to a component that is snapped) without changing the Version.\n */\nexport function getDependenciesOfVersion(\n version: DependenciesSnapshot & { extensions: ExtensionDataList }\n): DependenciesSnapshot {\n const withPackageNames = (deps: Dependencies) =>\n new Dependencies(ModelComponent.addDepsInfoFromDepsResolver(deps, version.extensions));\n return {\n dependencies: withPackageNames(version.dependencies),\n devDependencies: withPackageNames(version.devDependencies),\n peerDependencies: withPackageNames(version.peerDependencies),\n packageDependencies: { ...version.packageDependencies },\n devPackageDependencies: { ...version.devPackageDependencies },\n peerPackageDependencies: { ...version.peerPackageDependencies },\n };\n}\n\n/**\n * 3-way merge of the resolved dependencies of a component: base (the common snap), current (the target lane) and\n * other (the merged lane/main).\n *\n * a workspace merge gets the dependencies of the merged component by re-detecting them from the merged files. a bare\n * scope has no node_modules to resolve imports against, so it merges the dependencies that each side resolved when it\n * was snapped instead: a dependency added or removed on one side, or whose version or type (runtime/dev/peer) changed\n * on one side, is taken from that side. it's close to what the detection finds, not identical. e.g. when one side\n * removed an import of a dependency from one file and the other side added an import of it to another file, the\n * dependency is removed, although the merged files still import it.\n *\n * each dependency is keyed by its name, and its field (runtime/dev/peer) is part of what is compared, so a dependency\n * that moved between fields on one side is taken from that side, and it's never added to two fields.\n * when both sides changed the same dependency differently, \"theirs\" takes other, any other strategy keeps current\n * (in \"manual\", such a version conflict is reported by the config-merger, which stops the merge before the snap).\n * the returned component dependencies are copies, so they can be changed without changing the inputs.\n *\n * `laneComponentIds` are the components of the current lane. a dependency on one of them gets the lane's version\n * anyway (see MergingMain.setLaneVersionsOfDeps), so its version is not compared. otherwise, the lane snap of it would\n * look like a change on the lane, and a removal of it on the other side would be lost.\n */\nexport function mergeDependencies(\n base: DependenciesSnapshot,\n current: DependenciesSnapshot,\n other: DependenciesSnapshot,\n mergeStrategy?: MergeStrategy,\n laneComponentIds?: ComponentIdList\n): DependenciesSnapshot {\n const componentDeps = (snapshot: DependenciesSnapshot) =>\n new Map(\n COMPONENT_DEPS_FIELDS.flatMap((field) =>\n snapshot[field].get().map((dep) => [dep.id.toStringWithoutVersion(), { field, value: dep }] as const)\n )\n );\n // all the persisted data is compared (e.g. the import paths and the version range), not only the id, so a change of\n // any of them on one side is not lost. (no methods are called, a loaded component has the dependencies as plain objects)\n const isSameDep = (a: Dependency, b: Dependency) =>\n (laneComponentIds?.hasWithoutVersion(a.id) ? a.id.isEqualWithoutVersion(b.id) : a.id.isEqual(b.id)) &&\n a.packageName === b.packageName &&\n a.versionRange === b.versionRange &&\n isEqual(a.relativePaths, b.relativePaths);\n const mergedCompDeps = mergeEntries(\n componentDeps(base),\n componentDeps(current),\n componentDeps(other),\n mergeStrategy,\n isSameDep\n );\n const packageDeps = (snapshot: DependenciesSnapshot) =>\n new Map(\n PACKAGE_DEPS_FIELDS.flatMap((field) =>\n Object.entries(snapshot[field] || {}).map(([name, version]) => [name, { field, value: version }] as const)\n )\n );\n const mergedPkgDeps = mergeEntries(\n packageDeps(base),\n packageDeps(current),\n packageDeps(other),\n mergeStrategy,\n (a, b) => a === b\n );\n const compDepsOf = (field: ComponentDepsField) =>\n new Dependencies(\n mergedCompDeps.filter((entry) => entry.field === field).map(({ value }) => cloneDependency(value))\n );\n const pkgDepsOf = (field: PackageDepsField) =>\n Object.fromEntries(mergedPkgDeps.filter((entry) => entry.field === field).map(({ key, value }) => [key, value]));\n return {\n dependencies: compDepsOf('dependencies'),\n devDependencies: compDepsOf('devDependencies'),\n peerDependencies: compDepsOf('peerDependencies'),\n packageDependencies: pkgDepsOf('packageDependencies'),\n devPackageDependencies: pkgDepsOf('devPackageDependencies'),\n peerPackageDependencies: pkgDepsOf('peerPackageDependencies'),\n };\n}\n\ntype FieldEntry<Field, Value> = { field: Field; value: Value };\n\n/**\n * 3-way merge of the entries of each key. an entry is unchanged between two sides when it's in the same field with an\n * equal value. returns the merged entries that exist (not removed).\n */\nfunction mergeEntries<Field, Value>(\n base: Map<string, FieldEntry<Field, Value>>,\n current: Map<string, FieldEntry<Field, Value>>,\n other: Map<string, FieldEntry<Field, Value>>,\n mergeStrategy: MergeStrategy | undefined,\n isEqualValue: (a: Value, b: Value) => boolean\n): Array<FieldEntry<Field, Value> & { key: string }> {\n return union([...current.keys()], [...other.keys()]).flatMap((key) => {\n const merged = mergeValue(\n base.get(key),\n current.get(key),\n other.get(key),\n mergeStrategy,\n (a, b) => a.field === b.field && isEqualValue(a.value, b.value)\n );\n return merged ? [{ key, ...merged }] : [];\n });\n}\n\n/**\n * returns undefined when the merged result is \"absent\" (removed or never existed).\n */\nfunction mergeValue<T>(\n base: T | undefined,\n current: T | undefined,\n other: T | undefined,\n mergeStrategy: MergeStrategy | undefined,\n isEqualValue: (a: T, b: T) => boolean\n): T | undefined {\n const equal = (a?: T, b?: T) => (a === undefined || b === undefined ? a === b : isEqualValue(a, b));\n if (equal(current, other)) return current;\n if (equal(base, current)) return other; // changed (or removed) on other only\n if (equal(base, other)) return current; // changed (or removed) on current only\n return mergeStrategy === 'theirs' ? other : current;\n}\n\nfunction cloneDependency(dep: Dependency): Dependency {\n const clone = Dependency.getClone(dep);\n return new Dependency(clone.id, clone.relativePaths, clone.packageName, clone.versionRange);\n}\n"],"mappings":";;;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,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|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _chai() {
|
|
4
|
+
const data = require("chai");
|
|
5
|
+
_chai = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _componentId() {
|
|
11
|
+
const data = require("@teambit/component-id");
|
|
12
|
+
_componentId = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
function _legacy() {
|
|
18
|
+
const data = require("@teambit/legacy.consumer-component");
|
|
19
|
+
_legacy = function () {
|
|
20
|
+
return data;
|
|
21
|
+
};
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
function _legacy2() {
|
|
25
|
+
const data = require("@teambit/legacy.extension-data");
|
|
26
|
+
_legacy2 = function () {
|
|
27
|
+
return data;
|
|
28
|
+
};
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
function _mergeDependencies() {
|
|
32
|
+
const data = require("./merge-dependencies");
|
|
33
|
+
_mergeDependencies = function () {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
39
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
40
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
41
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
42
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
43
|
+
// a component loaded from the scope has its dependencies as plain objects (see Dependencies.getClone())
|
|
44
|
+
const asLoaded = deps => new (_legacy().Dependencies)(deps.map(dep => _legacy().Dependency.getClone(dep)));
|
|
45
|
+
const toDeps = (ids = []) => asLoaded(ids.map(id => {
|
|
46
|
+
const compId = _componentId().ComponentID.fromString(id);
|
|
47
|
+
return new (_legacy().Dependency)(compId, [], `@my-scope/${compId.fullName}`);
|
|
48
|
+
}));
|
|
49
|
+
function snapshot({
|
|
50
|
+
comps,
|
|
51
|
+
devComps,
|
|
52
|
+
pkgs,
|
|
53
|
+
devPkgs
|
|
54
|
+
}) {
|
|
55
|
+
return {
|
|
56
|
+
dependencies: toDeps(comps),
|
|
57
|
+
devDependencies: toDeps(devComps),
|
|
58
|
+
peerDependencies: toDeps(),
|
|
59
|
+
packageDependencies: pkgs || {},
|
|
60
|
+
devPackageDependencies: devPkgs || {},
|
|
61
|
+
peerPackageDependencies: {}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const idsOf = deps => deps.get().map(dep => dep.id.toString());
|
|
65
|
+
describe('mergeDependencies', () => {
|
|
66
|
+
describe('packages', () => {
|
|
67
|
+
const base = snapshot({
|
|
68
|
+
pkgs: {
|
|
69
|
+
lodash: '4.17.20',
|
|
70
|
+
'is-string': '1.0.5',
|
|
71
|
+
chalk: '4.0.0'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// current (the lane) bumped chalk
|
|
75
|
+
const current = snapshot({
|
|
76
|
+
pkgs: {
|
|
77
|
+
lodash: '4.17.20',
|
|
78
|
+
'is-string': '1.0.5',
|
|
79
|
+
chalk: '4.1.0'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// other (main) bumped lodash, removed is-string and added is-number
|
|
83
|
+
const other = snapshot({
|
|
84
|
+
pkgs: {
|
|
85
|
+
lodash: '4.17.21',
|
|
86
|
+
chalk: '4.0.0',
|
|
87
|
+
'is-number': '7.0.0'
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const merged = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual');
|
|
91
|
+
it('should take a version bump of either side', () => {
|
|
92
|
+
(0, _chai().expect)(merged.packageDependencies.lodash).to.equal('4.17.21');
|
|
93
|
+
(0, _chai().expect)(merged.packageDependencies.chalk).to.equal('4.1.0');
|
|
94
|
+
});
|
|
95
|
+
it('should remove a package that was removed on other', () => {
|
|
96
|
+
(0, _chai().expect)(merged.packageDependencies).to.not.have.property('is-string');
|
|
97
|
+
});
|
|
98
|
+
it('should add a package that was added on other', () => {
|
|
99
|
+
(0, _chai().expect)(merged.packageDependencies['is-number']).to.equal('7.0.0');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe('a package that moved from runtime to dev on other', () => {
|
|
103
|
+
const base = snapshot({
|
|
104
|
+
pkgs: {
|
|
105
|
+
chai: '4.0.0'
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const current = snapshot({
|
|
109
|
+
pkgs: {
|
|
110
|
+
chai: '4.0.0'
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const other = snapshot({
|
|
114
|
+
devPkgs: {
|
|
115
|
+
chai: '4.0.0'
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const merged = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual');
|
|
119
|
+
it('should be a dev dependency only', () => {
|
|
120
|
+
(0, _chai().expect)(merged.packageDependencies).to.deep.equal({});
|
|
121
|
+
(0, _chai().expect)(merged.devPackageDependencies).to.deep.equal({
|
|
122
|
+
chai: '4.0.0'
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe('both sides changed the version of the same package differently', () => {
|
|
127
|
+
const base = snapshot({
|
|
128
|
+
pkgs: {
|
|
129
|
+
lodash: '4.17.19'
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const current = snapshot({
|
|
133
|
+
pkgs: {
|
|
134
|
+
lodash: '4.17.20'
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const other = snapshot({
|
|
138
|
+
pkgs: {
|
|
139
|
+
lodash: '4.17.21'
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
it('should keep current unless the strategy is "theirs"', () => {
|
|
143
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').packageDependencies.lodash).to.equal('4.17.20');
|
|
144
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'ours').packageDependencies.lodash).to.equal('4.17.20');
|
|
145
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'theirs').packageDependencies.lodash).to.equal('4.17.21');
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
describe('a package removed on current and changed on other', () => {
|
|
149
|
+
const base = snapshot({
|
|
150
|
+
pkgs: {
|
|
151
|
+
lodash: '4.17.19'
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const current = snapshot({});
|
|
155
|
+
const other = snapshot({
|
|
156
|
+
pkgs: {
|
|
157
|
+
lodash: '4.17.21'
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
it('should keep current (removed) unless the strategy is "theirs"', () => {
|
|
161
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').packageDependencies).to.deep.equal({});
|
|
162
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'theirs').packageDependencies.lodash).to.equal('4.17.21');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('components', () => {
|
|
166
|
+
const base = snapshot({
|
|
167
|
+
comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.1', 'my-scope/old@0.0.1']
|
|
168
|
+
});
|
|
169
|
+
const current = snapshot({
|
|
170
|
+
comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.1', 'my-scope/old@0.0.1']
|
|
171
|
+
});
|
|
172
|
+
const other = snapshot({
|
|
173
|
+
comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.2', 'my-scope/f@0.0.1']
|
|
174
|
+
});
|
|
175
|
+
const merged = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual');
|
|
176
|
+
it('should take the added, removed and updated component dependencies of other', () => {
|
|
177
|
+
(0, _chai().expect)(idsOf(merged.dependencies)).to.have.members(['my-scope/a@0.0.1', 'my-scope/e@0.0.2', 'my-scope/f@0.0.1']);
|
|
178
|
+
});
|
|
179
|
+
it('should keep the package-name of the dependencies', () => {
|
|
180
|
+
const f = merged.dependencies.get().find(dep => dep.id.fullName === 'f');
|
|
181
|
+
(0, _chai().expect)(f?.packageName).to.equal('@my-scope/f');
|
|
182
|
+
});
|
|
183
|
+
it('should return copies of the dependencies of the inputs', () => {
|
|
184
|
+
const e = merged.dependencies.get().find(dep => dep.id.fullName === 'e');
|
|
185
|
+
(0, _chai().expect)(other.dependencies.get()).to.not.include(e);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe('a dependency that moved to another field on one side and changed its version on the other side', () => {
|
|
189
|
+
const base = snapshot({
|
|
190
|
+
comps: ['my-scope/b@0.0.1'],
|
|
191
|
+
pkgs: {
|
|
192
|
+
chai: '4.0.0'
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const current = snapshot({
|
|
196
|
+
comps: ['my-scope/b@0.0.2'],
|
|
197
|
+
pkgs: {
|
|
198
|
+
chai: '4.1.0'
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const other = snapshot({
|
|
202
|
+
devComps: ['my-scope/b@0.0.1'],
|
|
203
|
+
devPkgs: {
|
|
204
|
+
chai: '4.0.0'
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const merged = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual');
|
|
208
|
+
it('should keep it in one field only', () => {
|
|
209
|
+
(0, _chai().expect)(idsOf(merged.dependencies)).to.deep.equal(['my-scope/b@0.0.2']);
|
|
210
|
+
(0, _chai().expect)(idsOf(merged.devDependencies)).to.deep.equal([]);
|
|
211
|
+
(0, _chai().expect)(merged.packageDependencies).to.deep.equal({
|
|
212
|
+
chai: '4.1.0'
|
|
213
|
+
});
|
|
214
|
+
(0, _chai().expect)(merged.devPackageDependencies).to.deep.equal({});
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
describe('a component dependency that other imports from another file too', () => {
|
|
218
|
+
const relativePath = sourceRelativePath => ({
|
|
219
|
+
sourceRelativePath,
|
|
220
|
+
destinationRelativePath: 'index.ts',
|
|
221
|
+
importSpecifiers: []
|
|
222
|
+
});
|
|
223
|
+
const depWithPaths = paths => asLoaded([new (_legacy().Dependency)(_componentId().ComponentID.fromString('my-scope/b@0.0.1'), paths.map(relativePath), '@my-scope/b')]);
|
|
224
|
+
const base = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
225
|
+
dependencies: depWithPaths(['a.ts'])
|
|
226
|
+
});
|
|
227
|
+
const current = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
228
|
+
dependencies: depWithPaths(['a.ts'])
|
|
229
|
+
});
|
|
230
|
+
const other = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
231
|
+
dependencies: depWithPaths(['a.ts', 'b.ts'])
|
|
232
|
+
});
|
|
233
|
+
it('should take the import paths of other', () => {
|
|
234
|
+
const [merged] = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').dependencies.get();
|
|
235
|
+
(0, _chai().expect)(merged.relativePaths.map(paths => paths.sourceRelativePath)).to.deep.equal(['a.ts', 'b.ts']);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
describe('a peer component dependency whose version range changed on other only', () => {
|
|
239
|
+
const peerWithRange = range => asLoaded([new (_legacy().Dependency)(_componentId().ComponentID.fromString('my-scope/b@1.0.0'), [], '@my-scope/b', range)]);
|
|
240
|
+
const base = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
241
|
+
peerDependencies: peerWithRange('^1.0.0')
|
|
242
|
+
});
|
|
243
|
+
const current = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
244
|
+
peerDependencies: peerWithRange('^1.0.0')
|
|
245
|
+
});
|
|
246
|
+
const other = _objectSpread(_objectSpread({}, snapshot({})), {}, {
|
|
247
|
+
peerDependencies: peerWithRange('^1.0.0 || ^2.0.0')
|
|
248
|
+
});
|
|
249
|
+
it('should take the version range of other', () => {
|
|
250
|
+
const [merged] = (0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').peerDependencies.get();
|
|
251
|
+
(0, _chai().expect)(merged.versionRange).to.equal('^1.0.0 || ^2.0.0');
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
describe('a dependency on a lane component that other removed', () => {
|
|
255
|
+
// b was snapped on the lane, so current has the lane snap of it. other removed the dependency.
|
|
256
|
+
const base = snapshot({
|
|
257
|
+
comps: ['my-scope/b@0.0.1']
|
|
258
|
+
});
|
|
259
|
+
const current = snapshot({
|
|
260
|
+
comps: [`my-scope/b@${'a'.repeat(40)}`]
|
|
261
|
+
});
|
|
262
|
+
const other = snapshot({});
|
|
263
|
+
it('should be removed when b is on the lane, as only its version changed on current', () => {
|
|
264
|
+
const laneIds = _componentId().ComponentIdList.fromArray([_componentId().ComponentID.fromString(`my-scope/b@${'a'.repeat(40)}`)]);
|
|
265
|
+
(0, _chai().expect)(idsOf((0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual', laneIds).dependencies)).to.deep.equal([]);
|
|
266
|
+
});
|
|
267
|
+
it('should be kept when b is not on the lane, as both sides changed it', () => {
|
|
268
|
+
(0, _chai().expect)((0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').dependencies.get()).to.have.lengthOf(1);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
describe('a component dependency that other removed, with base and other from Versions', () => {
|
|
272
|
+
// a Version has the package names in the dependency-resolver data only, a component loaded from the scope (current)
|
|
273
|
+
// has them on the dependencies as well
|
|
274
|
+
const asVersion = deps => {
|
|
275
|
+
const depsData = deps.dependencies.get().map(dep => ({
|
|
276
|
+
id: dep.id.toString(),
|
|
277
|
+
packageName: dep.packageName
|
|
278
|
+
}));
|
|
279
|
+
return (0, _mergeDependencies().getDependenciesOfVersion)(_objectSpread(_objectSpread({}, deps), {}, {
|
|
280
|
+
dependencies: asLoaded(deps.dependencies.get().map(dep => new (_legacy().Dependency)(dep.id, dep.relativePaths))),
|
|
281
|
+
extensions: _legacy2().ExtensionDataList.fromArray([new (_legacy2().ExtensionDataEntry)(undefined, undefined, 'teambit.dependencies/dependency-resolver', undefined, {
|
|
282
|
+
dependencies: depsData
|
|
283
|
+
})])
|
|
284
|
+
}));
|
|
285
|
+
};
|
|
286
|
+
const base = asVersion(snapshot({
|
|
287
|
+
comps: ['my-scope/b@0.0.1']
|
|
288
|
+
}));
|
|
289
|
+
const current = snapshot({
|
|
290
|
+
comps: ['my-scope/b@0.0.1']
|
|
291
|
+
});
|
|
292
|
+
const other = asVersion(snapshot({}));
|
|
293
|
+
it('should be removed', () => {
|
|
294
|
+
(0, _chai().expect)(idsOf((0, _mergeDependencies().mergeDependencies)(base, current, other, 'manual').dependencies)).to.deep.equal([]);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
//# sourceMappingURL=merge-dependencies.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_componentId","_legacy","_legacy2","_mergeDependencies","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","asLoaded","deps","Dependencies","map","dep","Dependency","getClone","toDeps","ids","id","compId","ComponentID","fromString","fullName","snapshot","comps","devComps","pkgs","devPkgs","dependencies","devDependencies","peerDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","idsOf","get","toString","describe","base","lodash","chalk","current","other","merged","mergeDependencies","it","expect","to","equal","not","have","property","chai","deep","members","f","find","packageName","include","relativePath","sourceRelativePath","destinationRelativePath","importSpecifiers","depWithPaths","paths","relativePaths","peerWithRange","range","versionRange","repeat","laneIds","ComponentIdList","fromArray","lengthOf","asVersion","depsData","getDependenciesOfVersion","extensions","ExtensionDataList","ExtensionDataEntry","undefined"],"sources":["merge-dependencies.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { Dependencies, Dependency } from '@teambit/legacy.consumer-component';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy.extension-data';\nimport type { DependenciesSnapshot } from './merge-dependencies';\nimport { getDependenciesOfVersion, mergeDependencies } from './merge-dependencies';\n\ntype SnapshotInput = {\n comps?: string[]; // runtime component deps, e.g. \"my-scope/b@0.0.1\"\n devComps?: string[];\n pkgs?: Record<string, string>;\n devPkgs?: Record<string, string>;\n};\n\n// a component loaded from the scope has its dependencies as plain objects (see Dependencies.getClone())\nconst asLoaded = (deps: Dependency[]) => new Dependencies(deps.map((dep) => Dependency.getClone(dep) as Dependency));\n\nconst toDeps = (ids: string[] = []) =>\n asLoaded(\n ids.map((id) => {\n const compId = ComponentID.fromString(id);\n return new Dependency(compId, [], `@my-scope/${compId.fullName}`);\n })\n );\n\nfunction snapshot({ comps, devComps, pkgs, devPkgs }: SnapshotInput): DependenciesSnapshot {\n return {\n dependencies: toDeps(comps),\n devDependencies: toDeps(devComps),\n peerDependencies: toDeps(),\n packageDependencies: pkgs || {},\n devPackageDependencies: devPkgs || {},\n peerPackageDependencies: {},\n };\n}\n\nconst idsOf = (deps: Dependencies) => deps.get().map((dep) => dep.id.toString());\n\ndescribe('mergeDependencies', () => {\n describe('packages', () => {\n const base = snapshot({ pkgs: { lodash: '4.17.20', 'is-string': '1.0.5', chalk: '4.0.0' } });\n // current (the lane) bumped chalk\n const current = snapshot({ pkgs: { lodash: '4.17.20', 'is-string': '1.0.5', chalk: '4.1.0' } });\n // other (main) bumped lodash, removed is-string and added is-number\n const other = snapshot({ pkgs: { lodash: '4.17.21', chalk: '4.0.0', 'is-number': '7.0.0' } });\n const merged = mergeDependencies(base, current, other, 'manual');\n it('should take a version bump of either side', () => {\n expect(merged.packageDependencies.lodash).to.equal('4.17.21');\n expect(merged.packageDependencies.chalk).to.equal('4.1.0');\n });\n it('should remove a package that was removed on other', () => {\n expect(merged.packageDependencies).to.not.have.property('is-string');\n });\n it('should add a package that was added on other', () => {\n expect(merged.packageDependencies['is-number']).to.equal('7.0.0');\n });\n });\n describe('a package that moved from runtime to dev on other', () => {\n const base = snapshot({ pkgs: { chai: '4.0.0' } });\n const current = snapshot({ pkgs: { chai: '4.0.0' } });\n const other = snapshot({ devPkgs: { chai: '4.0.0' } });\n const merged = mergeDependencies(base, current, other, 'manual');\n it('should be a dev dependency only', () => {\n expect(merged.packageDependencies).to.deep.equal({});\n expect(merged.devPackageDependencies).to.deep.equal({ chai: '4.0.0' });\n });\n });\n describe('both sides changed the version of the same package differently', () => {\n const base = snapshot({ pkgs: { lodash: '4.17.19' } });\n const current = snapshot({ pkgs: { lodash: '4.17.20' } });\n const other = snapshot({ pkgs: { lodash: '4.17.21' } });\n it('should keep current unless the strategy is \"theirs\"', () => {\n expect(mergeDependencies(base, current, other, 'manual').packageDependencies.lodash).to.equal('4.17.20');\n expect(mergeDependencies(base, current, other, 'ours').packageDependencies.lodash).to.equal('4.17.20');\n expect(mergeDependencies(base, current, other, 'theirs').packageDependencies.lodash).to.equal('4.17.21');\n });\n });\n describe('a package removed on current and changed on other', () => {\n const base = snapshot({ pkgs: { lodash: '4.17.19' } });\n const current = snapshot({});\n const other = snapshot({ pkgs: { lodash: '4.17.21' } });\n it('should keep current (removed) unless the strategy is \"theirs\"', () => {\n expect(mergeDependencies(base, current, other, 'manual').packageDependencies).to.deep.equal({});\n expect(mergeDependencies(base, current, other, 'theirs').packageDependencies.lodash).to.equal('4.17.21');\n });\n });\n describe('components', () => {\n const base = snapshot({ comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.1', 'my-scope/old@0.0.1'] });\n const current = snapshot({ comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.1', 'my-scope/old@0.0.1'] });\n const other = snapshot({ comps: ['my-scope/a@0.0.1', 'my-scope/e@0.0.2', 'my-scope/f@0.0.1'] });\n const merged = mergeDependencies(base, current, other, 'manual');\n it('should take the added, removed and updated component dependencies of other', () => {\n expect(idsOf(merged.dependencies)).to.have.members(['my-scope/a@0.0.1', 'my-scope/e@0.0.2', 'my-scope/f@0.0.1']);\n });\n it('should keep the package-name of the dependencies', () => {\n const f = merged.dependencies.get().find((dep) => dep.id.fullName === 'f');\n expect(f?.packageName).to.equal('@my-scope/f');\n });\n it('should return copies of the dependencies of the inputs', () => {\n const e = merged.dependencies.get().find((dep) => dep.id.fullName === 'e');\n expect(other.dependencies.get()).to.not.include(e);\n });\n });\n describe('a dependency that moved to another field on one side and changed its version on the other side', () => {\n const base = snapshot({ comps: ['my-scope/b@0.0.1'], pkgs: { chai: '4.0.0' } });\n const current = snapshot({ comps: ['my-scope/b@0.0.2'], pkgs: { chai: '4.1.0' } });\n const other = snapshot({ devComps: ['my-scope/b@0.0.1'], devPkgs: { chai: '4.0.0' } });\n const merged = mergeDependencies(base, current, other, 'manual');\n it('should keep it in one field only', () => {\n expect(idsOf(merged.dependencies)).to.deep.equal(['my-scope/b@0.0.2']);\n expect(idsOf(merged.devDependencies)).to.deep.equal([]);\n expect(merged.packageDependencies).to.deep.equal({ chai: '4.1.0' });\n expect(merged.devPackageDependencies).to.deep.equal({});\n });\n });\n describe('a component dependency that other imports from another file too', () => {\n const relativePath = (sourceRelativePath: string) => ({\n sourceRelativePath,\n destinationRelativePath: 'index.ts',\n importSpecifiers: [],\n });\n const depWithPaths = (paths: string[]) =>\n asLoaded([new Dependency(ComponentID.fromString('my-scope/b@0.0.1'), paths.map(relativePath), '@my-scope/b')]);\n const base = { ...snapshot({}), dependencies: depWithPaths(['a.ts']) };\n const current = { ...snapshot({}), dependencies: depWithPaths(['a.ts']) };\n const other = { ...snapshot({}), dependencies: depWithPaths(['a.ts', 'b.ts']) };\n it('should take the import paths of other', () => {\n const [merged] = mergeDependencies(base, current, other, 'manual').dependencies.get();\n expect(merged.relativePaths.map((paths) => paths.sourceRelativePath)).to.deep.equal(['a.ts', 'b.ts']);\n });\n });\n describe('a peer component dependency whose version range changed on other only', () => {\n const peerWithRange = (range: string) =>\n asLoaded([new Dependency(ComponentID.fromString('my-scope/b@1.0.0'), [], '@my-scope/b', range)]);\n const base = { ...snapshot({}), peerDependencies: peerWithRange('^1.0.0') };\n const current = { ...snapshot({}), peerDependencies: peerWithRange('^1.0.0') };\n const other = { ...snapshot({}), peerDependencies: peerWithRange('^1.0.0 || ^2.0.0') };\n it('should take the version range of other', () => {\n const [merged] = mergeDependencies(base, current, other, 'manual').peerDependencies.get();\n expect(merged.versionRange).to.equal('^1.0.0 || ^2.0.0');\n });\n });\n describe('a dependency on a lane component that other removed', () => {\n // b was snapped on the lane, so current has the lane snap of it. other removed the dependency.\n const base = snapshot({ comps: ['my-scope/b@0.0.1'] });\n const current = snapshot({ comps: [`my-scope/b@${'a'.repeat(40)}`] });\n const other = snapshot({});\n it('should be removed when b is on the lane, as only its version changed on current', () => {\n const laneIds = ComponentIdList.fromArray([ComponentID.fromString(`my-scope/b@${'a'.repeat(40)}`)]);\n expect(idsOf(mergeDependencies(base, current, other, 'manual', laneIds).dependencies)).to.deep.equal([]);\n });\n it('should be kept when b is not on the lane, as both sides changed it', () => {\n expect(mergeDependencies(base, current, other, 'manual').dependencies.get()).to.have.lengthOf(1);\n });\n });\n describe('a component dependency that other removed, with base and other from Versions', () => {\n // a Version has the package names in the dependency-resolver data only, a component loaded from the scope (current)\n // has them on the dependencies as well\n const asVersion = (deps: DependenciesSnapshot) => {\n const depsData = deps.dependencies.get().map((dep) => ({ id: dep.id.toString(), packageName: dep.packageName }));\n return getDependenciesOfVersion({\n ...deps,\n dependencies: asLoaded(deps.dependencies.get().map((dep) => new Dependency(dep.id, dep.relativePaths))),\n extensions: ExtensionDataList.fromArray([\n new ExtensionDataEntry(undefined, undefined, 'teambit.dependencies/dependency-resolver', undefined, {\n dependencies: depsData,\n }),\n ]),\n });\n };\n const base = asVersion(snapshot({ comps: ['my-scope/b@0.0.1'] }));\n const current = snapshot({ comps: ['my-scope/b@0.0.1'] });\n const other = asVersion(snapshot({}));\n it('should be removed', () => {\n expect(idsOf(mergeDependencies(base, current, other, 'manual').dependencies)).to.deep.equal([]);\n });\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,aAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA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AAmB,EAAE,MAAM;MAC5B,IAAAC,cAAM,EAACZ,KAAK,CAAC,IAAAU,sCAAiB,EAACN,IAAI,EAAEG,OAAO,EAAEC,KAAK,EAAE,QAAQ,CAAC,CAACd,YAAY,CAAC,CAAC,CAACmB,EAAE,CAACM,IAAI,CAACL,KAAK,CAAC,EAAE,CAAC;IACjG,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -74,6 +74,13 @@ function _builder() {
|
|
|
74
74
|
};
|
|
75
75
|
return data;
|
|
76
76
|
}
|
|
77
|
+
function _mergeDependencies() {
|
|
78
|
+
const data = require("./merge-dependencies");
|
|
79
|
+
_mergeDependencies = function () {
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
82
|
+
return data;
|
|
83
|
+
}
|
|
77
84
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
78
85
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
79
86
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -185,13 +192,24 @@ other: ${otherLaneHead.toString()}`);
|
|
|
185
192
|
currentLabel,
|
|
186
193
|
baseComponent
|
|
187
194
|
});
|
|
195
|
+
// a workspace re-detects the dependencies from the merged files. a bare scope can't, it merges the resolved ones.
|
|
196
|
+
const getDependenciesMergeResult = () => {
|
|
197
|
+
if (this.workspace) return undefined;
|
|
198
|
+
// "theirs" with a file conflict takes all the files of other (see applyModifiedVersion), so the dependencies too
|
|
199
|
+
if (mergeResults.hasConflicts && this.options.mergeStrategy === _componentModules().MergeOptions.theirs) {
|
|
200
|
+
return (0, _mergeDependencies().getDependenciesOfVersion)(otherComponent);
|
|
201
|
+
}
|
|
202
|
+
return (0, _mergeDependencies().mergeDependencies)((0, _mergeDependencies().getDependenciesOfVersion)(baseComponent), currentComponent, (0, _mergeDependencies().getDependenciesOfVersion)(otherComponent), this.options.mergeStrategy, this.currentLane?.toComponentIdsIncludeUpdateDependents());
|
|
203
|
+
};
|
|
204
|
+
const dependenciesMergeResult = getDependenciesMergeResult();
|
|
188
205
|
return {
|
|
189
206
|
currentComponent,
|
|
190
207
|
id,
|
|
191
208
|
mergeResults,
|
|
192
209
|
divergeData,
|
|
193
210
|
configMergeResult,
|
|
194
|
-
dataMergeResult
|
|
211
|
+
dataMergeResult,
|
|
212
|
+
dependenciesMergeResult
|
|
195
213
|
};
|
|
196
214
|
}
|
|
197
215
|
mergeExtensionsData(currentExtensions, baseExtensions, otherExtensions) {
|