@teambit/component-compare 1.0.107 → 1.0.108
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/component-compare.aspect.ts +7 -0
- package/component-compare.graphql.ts +77 -0
- package/component-compare.main.runtime.ts +230 -0
- package/diff-cmd.ts +30 -0
- package/dist/component-compare-aspects.section.d.ts +4 -4
- package/dist/component-compare-changelog.section.d.ts +4 -4
- package/dist/component-compare.compositions.d.ts +2 -2
- package/dist/component-compare.graphql.d.ts +3 -3
- package/dist/component-compare.main.runtime.d.ts +4 -4
- package/dist/component-compare.section.d.ts +3 -3
- package/dist/component-compare.ui.runtime.d.ts +19 -19
- package/dist/component-compare.ui.runtime.js +9 -16
- package/dist/component-compare.ui.runtime.js.map +1 -1
- package/dist/{preview-1703590665075.js → preview-1703647408454.js} +2 -2
- package/index.ts +6 -0
- package/package.json +22 -29
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
import { ComponentCompareMain, ComponentCompareResult } from './component-compare.main.runtime';
|
|
3
|
+
|
|
4
|
+
export function componentCompareSchema(componentCompareMain: ComponentCompareMain) {
|
|
5
|
+
return {
|
|
6
|
+
typeDefs: gql`
|
|
7
|
+
type FileCompareResult {
|
|
8
|
+
fileName: String!
|
|
9
|
+
baseContent: String!
|
|
10
|
+
compareContent: String!
|
|
11
|
+
status: String
|
|
12
|
+
diffOutput: String
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type FieldCompareResult {
|
|
16
|
+
fieldName: String!
|
|
17
|
+
diffOutput: String
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ComponentCompareResult {
|
|
21
|
+
# unique id for graphql - baseId + compareId
|
|
22
|
+
id: String!
|
|
23
|
+
code(fileName: String): [FileCompareResult!]!
|
|
24
|
+
aspects(aspectName: String): [FieldCompareResult!]!
|
|
25
|
+
tests(fileName: String): [FileCompareResult!]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
extend type ComponentHost {
|
|
29
|
+
compareComponent(baseId: String!, compareId: String!): ComponentCompareResult
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
resolvers: {
|
|
33
|
+
ComponentHost: {
|
|
34
|
+
compareComponent: async (_, { baseId, compareId }: { baseId: string; compareId: string }) => {
|
|
35
|
+
return componentCompareMain.compare(baseId, compareId);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
ComponentCompareResult: {
|
|
39
|
+
id: (result: ComponentCompareResult) => result.id,
|
|
40
|
+
code: (result: ComponentCompareResult, { fileName }: { fileName?: string }) => {
|
|
41
|
+
if (fileName) {
|
|
42
|
+
return result.code
|
|
43
|
+
.filter((codeFile) => codeFile.filePath === fileName)
|
|
44
|
+
.map((c) => ({ ...c, fileName: c.filePath, baseContent: c.fromContent, compareContent: c.toContent }));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result.code.map((c) => ({
|
|
48
|
+
...c,
|
|
49
|
+
fileName: c.filePath,
|
|
50
|
+
baseContent: c.fromContent,
|
|
51
|
+
compareContent: c.toContent,
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
tests: (result: ComponentCompareResult, { fileName }: { fileName?: string }) => {
|
|
55
|
+
if (fileName) {
|
|
56
|
+
return result.tests
|
|
57
|
+
.filter((testFile) => testFile.filePath === fileName)
|
|
58
|
+
.map((c) => ({ ...c, fileName: c.filePath, baseContent: c.fromContent, compareContent: c.toContent }));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return result.tests.map((c) => ({
|
|
62
|
+
...c,
|
|
63
|
+
fileName: c.filePath,
|
|
64
|
+
baseContent: c.fromContent,
|
|
65
|
+
compareContent: c.toContent,
|
|
66
|
+
}));
|
|
67
|
+
},
|
|
68
|
+
aspects: (result: ComponentCompareResult, { fieldName }: { fieldName?: string }) => {
|
|
69
|
+
if (fieldName) {
|
|
70
|
+
return result.fields.filter((field) => field.fieldName === fieldName);
|
|
71
|
+
}
|
|
72
|
+
return result.fields;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
|
|
2
|
+
import { BitError } from '@teambit/bit-error';
|
|
3
|
+
import { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';
|
|
4
|
+
import { ComponentID } from '@teambit/component-id';
|
|
5
|
+
import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
|
|
6
|
+
import hasWildcard from '@teambit/legacy/dist/utils/string/has-wildcard';
|
|
7
|
+
import { ScopeMain, ScopeAspect } from '@teambit/scope';
|
|
8
|
+
import { GraphqlAspect, GraphqlMain } from '@teambit/graphql';
|
|
9
|
+
import BuilderAspect from '@teambit/builder';
|
|
10
|
+
import GeneralError from '@teambit/legacy/dist/error/general-error';
|
|
11
|
+
import DependencyResolverAspect, {
|
|
12
|
+
DependencyList,
|
|
13
|
+
DependencyResolverMain,
|
|
14
|
+
SerializedDependency,
|
|
15
|
+
} from '@teambit/dependency-resolver';
|
|
16
|
+
import { LoggerAspect, LoggerMain, Logger } from '@teambit/logger';
|
|
17
|
+
import componentsDiff, {
|
|
18
|
+
diffBetweenVersionsObjects,
|
|
19
|
+
DiffResults,
|
|
20
|
+
FieldsDiff,
|
|
21
|
+
FileDiff,
|
|
22
|
+
} from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
23
|
+
import { TesterMain, TesterAspect } from '@teambit/tester';
|
|
24
|
+
import ComponentAspect, { Component, ComponentMain } from '@teambit/component';
|
|
25
|
+
import { componentCompareSchema } from './component-compare.graphql';
|
|
26
|
+
import { ComponentCompareAspect } from './component-compare.aspect';
|
|
27
|
+
import { DiffCmd } from './diff-cmd';
|
|
28
|
+
|
|
29
|
+
export type ComponentCompareResult = {
|
|
30
|
+
id: string;
|
|
31
|
+
code: FileDiff[];
|
|
32
|
+
fields: FieldsDiff[];
|
|
33
|
+
tests: FileDiff[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type ConfigDiff = {
|
|
37
|
+
version?: string;
|
|
38
|
+
dependencies?: string[];
|
|
39
|
+
aspects?: Record<string, any>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export class ComponentCompareMain {
|
|
43
|
+
constructor(
|
|
44
|
+
private componentAspect: ComponentMain,
|
|
45
|
+
private scope: ScopeMain,
|
|
46
|
+
private logger: Logger,
|
|
47
|
+
private tester: TesterMain,
|
|
48
|
+
private depResolver: DependencyResolverMain,
|
|
49
|
+
private workspace?: Workspace
|
|
50
|
+
) {}
|
|
51
|
+
|
|
52
|
+
async compare(baseIdStr: string, compareIdStr: string): Promise<ComponentCompareResult> {
|
|
53
|
+
const host = this.componentAspect.getHost();
|
|
54
|
+
const [baseCompId, compareCompId] = await host.resolveMultipleComponentIds([baseIdStr, compareIdStr]);
|
|
55
|
+
const modelComponent = await this.scope.legacyScope.getModelComponentIfExist(compareCompId);
|
|
56
|
+
|
|
57
|
+
if (!modelComponent) {
|
|
58
|
+
throw new GeneralError(`component ${compareCompId.toString()} doesn't have any version yet`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const baseVersion = baseCompId.version as string;
|
|
62
|
+
const compareVersion = compareCompId.version as string;
|
|
63
|
+
|
|
64
|
+
const repository = this.scope.legacyScope.objects;
|
|
65
|
+
const baseVersionObject = await modelComponent.loadVersion(baseVersion, repository);
|
|
66
|
+
const compareVersionObject = await modelComponent.loadVersion(compareVersion, repository);
|
|
67
|
+
|
|
68
|
+
const diff: DiffResults = await diffBetweenVersionsObjects(
|
|
69
|
+
modelComponent,
|
|
70
|
+
baseVersionObject,
|
|
71
|
+
compareVersionObject,
|
|
72
|
+
baseVersion,
|
|
73
|
+
compareVersion,
|
|
74
|
+
this.scope.legacyScope,
|
|
75
|
+
{}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const baseComponent = await host.get(baseCompId);
|
|
79
|
+
const compareComponent = await host.get(compareCompId);
|
|
80
|
+
|
|
81
|
+
const baseTestFiles =
|
|
82
|
+
(baseComponent && (await this.tester.getTestFiles(baseComponent).map((file) => file.relative))) || [];
|
|
83
|
+
const compareTestFiles =
|
|
84
|
+
(compareComponent && (await this.tester.getTestFiles(compareComponent).map((file) => file.relative))) || [];
|
|
85
|
+
|
|
86
|
+
const allTestFiles = [...baseTestFiles, ...compareTestFiles];
|
|
87
|
+
|
|
88
|
+
const testFilesDiff = (diff.filesDiff || []).filter(
|
|
89
|
+
(fileDiff: FileDiff) => allTestFiles.includes(fileDiff.filePath) && fileDiff.status !== 'UNCHANGED'
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const compareResult = {
|
|
93
|
+
id: `${baseCompId}-${compareCompId}`,
|
|
94
|
+
code: diff.filesDiff || [],
|
|
95
|
+
fields: diff.fieldsDiff || [],
|
|
96
|
+
tests: testFilesDiff,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return compareResult;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async diffByCLIValues(values: string[], verbose: boolean, table: boolean): Promise<any> {
|
|
103
|
+
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
104
|
+
const consumer = this.workspace.consumer;
|
|
105
|
+
const { bitIds, version, toVersion } = await this.parseValues(values);
|
|
106
|
+
if (!bitIds || !bitIds.length) {
|
|
107
|
+
throw new BitError('there are no modified components to diff');
|
|
108
|
+
}
|
|
109
|
+
const diffResults = await componentsDiff(consumer, bitIds, version, toVersion, {
|
|
110
|
+
verbose,
|
|
111
|
+
formatDepsAsTable: table,
|
|
112
|
+
});
|
|
113
|
+
await consumer.onDestroy('diff');
|
|
114
|
+
return diffResults;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async getConfigForDiffById(id: string): Promise<ConfigDiff> {
|
|
118
|
+
const workspace = this.workspace;
|
|
119
|
+
if (!workspace) throw new OutsideWorkspaceError();
|
|
120
|
+
const componentId = await workspace.resolveComponentId(id);
|
|
121
|
+
const component = await workspace.scope.get(componentId, false);
|
|
122
|
+
if (!component) throw new Error(`getConfigForDiff: unable to find component ${id} in local scope`);
|
|
123
|
+
return this.getConfigForDiffByCompObject(component);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async getConfigForDiffByCompObject(component: Component) {
|
|
127
|
+
const depData = await this.depResolver.getDependencies(component);
|
|
128
|
+
const serializedToString = (dep: SerializedDependency) => {
|
|
129
|
+
const idWithoutVersion = dep.__type === 'package' ? dep.id : dep.id.split('@')[0];
|
|
130
|
+
return `${idWithoutVersion}@${dep.version} (${dep.lifecycle}) ${dep.source ? `(${dep.source})` : ''}`;
|
|
131
|
+
};
|
|
132
|
+
const serializeAndSort = (deps: DependencyList) => {
|
|
133
|
+
const serialized = deps.serialize().map(serializedToString);
|
|
134
|
+
return serialized.sort();
|
|
135
|
+
};
|
|
136
|
+
const serializeAspect = (comp: Component) => {
|
|
137
|
+
const aspects = comp.state.aspects.withoutEntries([BuilderAspect.id, DependencyResolverAspect.id]);
|
|
138
|
+
// return aspects.serialize();
|
|
139
|
+
return aspects.toLegacy().sortById().toConfigObject();
|
|
140
|
+
};
|
|
141
|
+
return {
|
|
142
|
+
version: component.id.version,
|
|
143
|
+
dependencies: serializeAndSort(depData),
|
|
144
|
+
aspects: serializeAspect(component),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private async parseValues(
|
|
149
|
+
values: string[]
|
|
150
|
+
): Promise<{ bitIds: ComponentID[]; version?: string; toVersion?: string }> {
|
|
151
|
+
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
152
|
+
// option #1: bit diff
|
|
153
|
+
// no arguments
|
|
154
|
+
if (!values.length) {
|
|
155
|
+
const componentIds = await this.workspace.listTagPendingIds();
|
|
156
|
+
return { bitIds: componentIds.map((id) => id) };
|
|
157
|
+
}
|
|
158
|
+
const firstValue = values[0];
|
|
159
|
+
const lastValue = values[values.length - 1];
|
|
160
|
+
const oneBeforeLastValue = values[values.length - 2];
|
|
161
|
+
const isLastItemVersion = ComponentID.isValidVersion(lastValue);
|
|
162
|
+
const isOneBeforeLastItemVersion = ComponentID.isValidVersion(oneBeforeLastValue);
|
|
163
|
+
// option #2: bit diff [ids...]
|
|
164
|
+
// all arguments are ids
|
|
165
|
+
if (!isLastItemVersion) {
|
|
166
|
+
return { bitIds: this.getBitIdsForDiff(values) };
|
|
167
|
+
}
|
|
168
|
+
// option #3: bit diff [id] [version]
|
|
169
|
+
// last argument is a version, first argument is id
|
|
170
|
+
if (!isOneBeforeLastItemVersion) {
|
|
171
|
+
if (values.length !== 2) {
|
|
172
|
+
throw new BitError(
|
|
173
|
+
`bit diff [id] [version] syntax was used, however, ${values.length} arguments were given instead of 2`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return { bitIds: this.getBitIdsForDiff([firstValue]), version: lastValue };
|
|
177
|
+
}
|
|
178
|
+
// option #4: bit diff [id] [version] [to_version]
|
|
179
|
+
// last argument and one before the last are versions, first argument is id
|
|
180
|
+
if (values.length !== 3) {
|
|
181
|
+
throw new BitError(
|
|
182
|
+
`bit diff [id] [version] [to_version] syntax was used, however, ${values.length} arguments were given instead of 3`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
return { bitIds: this.getBitIdsForDiff([firstValue]), version: oneBeforeLastValue, toVersion: lastValue };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private getBitIdsForDiff(ids: string[]): ComponentID[] {
|
|
189
|
+
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
190
|
+
const consumer = this.workspace.consumer;
|
|
191
|
+
if (hasWildcard(ids)) {
|
|
192
|
+
const componentsList = new ComponentsList(consumer);
|
|
193
|
+
return componentsList.listComponentsByIdsWithWildcard(ids);
|
|
194
|
+
}
|
|
195
|
+
return ids.map((id) => consumer.getParsedId(id));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static slots = [];
|
|
199
|
+
static dependencies = [
|
|
200
|
+
GraphqlAspect,
|
|
201
|
+
ComponentAspect,
|
|
202
|
+
ScopeAspect,
|
|
203
|
+
LoggerAspect,
|
|
204
|
+
CLIAspect,
|
|
205
|
+
WorkspaceAspect,
|
|
206
|
+
TesterAspect,
|
|
207
|
+
DependencyResolverAspect,
|
|
208
|
+
];
|
|
209
|
+
static runtime = MainRuntime;
|
|
210
|
+
static async provider([graphql, component, scope, loggerMain, cli, workspace, tester, depResolver]: [
|
|
211
|
+
GraphqlMain,
|
|
212
|
+
ComponentMain,
|
|
213
|
+
ScopeMain,
|
|
214
|
+
LoggerMain,
|
|
215
|
+
CLIMain,
|
|
216
|
+
Workspace,
|
|
217
|
+
TesterMain,
|
|
218
|
+
DependencyResolverMain
|
|
219
|
+
]) {
|
|
220
|
+
const logger = loggerMain.createLogger(ComponentCompareAspect.id);
|
|
221
|
+
const componentCompareMain = new ComponentCompareMain(component, scope, logger, tester, depResolver, workspace);
|
|
222
|
+
cli.register(new DiffCmd(componentCompareMain));
|
|
223
|
+
graphql.register(componentCompareSchema(componentCompareMain));
|
|
224
|
+
return componentCompareMain;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
ComponentCompareAspect.addRuntime(ComponentCompareMain);
|
|
229
|
+
|
|
230
|
+
export default ComponentCompareMain;
|
package/diff-cmd.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { WILDCARD_HELP } from '@teambit/legacy/dist/constants';
|
|
3
|
+
import { DiffResults, outputDiffResults } from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
4
|
+
import { ComponentCompareMain } from './component-compare.main.runtime';
|
|
5
|
+
|
|
6
|
+
export class DiffCmd implements Command {
|
|
7
|
+
name = 'diff [values...]';
|
|
8
|
+
group = 'development';
|
|
9
|
+
description =
|
|
10
|
+
"show the diff between the components' current source files and config, and their latest snapshot or tag";
|
|
11
|
+
helpUrl = 'docs/components/merging-changes#compare-component-snaps';
|
|
12
|
+
extendedDescription = `bit diff => compare all modified components to their model version
|
|
13
|
+
bit diff [ids...] => compare the specified components against their modified states
|
|
14
|
+
bit diff [id] [version] => compare component's current files and configs to the specified version of the component
|
|
15
|
+
bit diff [id] [version] [to_version] => compare component's files and configs between the specified version and the to_version provided
|
|
16
|
+
${WILDCARD_HELP('diff')}`;
|
|
17
|
+
alias = '';
|
|
18
|
+
options = [
|
|
19
|
+
['v', 'verbose', 'show a more verbose output where possible'],
|
|
20
|
+
['t', 'table', 'show tables instead of plain text for dependencies diff'],
|
|
21
|
+
] as CommandOptions;
|
|
22
|
+
loader = true;
|
|
23
|
+
|
|
24
|
+
constructor(private componentCompareMain: ComponentCompareMain) {}
|
|
25
|
+
|
|
26
|
+
async report([values = []]: [string[]], { verbose = false, table = false }: { verbose?: boolean; table: boolean }) {
|
|
27
|
+
const diffResults: DiffResults[] = await this.componentCompareMain.diffByCLIValues(values, verbose, table);
|
|
28
|
+
return outputDiffResults(diffResults);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
3
3
|
import { ChangeType } from '@teambit/component.ui.component-compare.models.component-compare-change-type';
|
|
4
4
|
import { Section } from '@teambit/component';
|
|
@@ -9,16 +9,16 @@ export declare class AspectsCompareSection implements TabItem, Section {
|
|
|
9
9
|
navigationLink: {
|
|
10
10
|
href: string;
|
|
11
11
|
displayName: string;
|
|
12
|
-
children:
|
|
12
|
+
children: JSX.Element;
|
|
13
13
|
};
|
|
14
14
|
props: {
|
|
15
15
|
href: string;
|
|
16
16
|
displayName: string;
|
|
17
|
-
children:
|
|
17
|
+
children: JSX.Element;
|
|
18
18
|
};
|
|
19
19
|
route: {
|
|
20
20
|
path: string;
|
|
21
|
-
element:
|
|
21
|
+
element: JSX.Element;
|
|
22
22
|
};
|
|
23
23
|
order: number;
|
|
24
24
|
widget: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
3
|
import { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
4
4
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
@@ -7,17 +7,17 @@ export declare class CompareChangelogSection implements Section, TabItem {
|
|
|
7
7
|
constructor(compareUI: ComponentCompareUI);
|
|
8
8
|
navigationLink: {
|
|
9
9
|
href: string;
|
|
10
|
-
children:
|
|
10
|
+
children: JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
13
|
props: {
|
|
14
14
|
href: string;
|
|
15
|
-
children:
|
|
15
|
+
children: JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
route: {
|
|
19
19
|
path: string;
|
|
20
|
-
element:
|
|
20
|
+
element: JSX.Element;
|
|
21
21
|
};
|
|
22
22
|
order: number;
|
|
23
23
|
widget: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Logo: () =>
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Logo: () => JSX.Element;
|
|
@@ -11,7 +11,7 @@ export declare function componentCompareSchema(componentCompareMain: ComponentCo
|
|
|
11
11
|
ComponentCompareResult: {
|
|
12
12
|
id: (result: ComponentCompareResult) => string;
|
|
13
13
|
code: (result: ComponentCompareResult, { fileName }: {
|
|
14
|
-
fileName?: string
|
|
14
|
+
fileName?: string;
|
|
15
15
|
}) => {
|
|
16
16
|
fileName: string;
|
|
17
17
|
baseContent: string;
|
|
@@ -23,7 +23,7 @@ export declare function componentCompareSchema(componentCompareMain: ComponentCo
|
|
|
23
23
|
toContent: string;
|
|
24
24
|
}[];
|
|
25
25
|
tests: (result: ComponentCompareResult, { fileName }: {
|
|
26
|
-
fileName?: string
|
|
26
|
+
fileName?: string;
|
|
27
27
|
}) => {
|
|
28
28
|
fileName: string;
|
|
29
29
|
baseContent: string;
|
|
@@ -35,7 +35,7 @@ export declare function componentCompareSchema(componentCompareMain: ComponentCo
|
|
|
35
35
|
toContent: string;
|
|
36
36
|
}[];
|
|
37
37
|
aspects: (result: ComponentCompareResult, { fieldName }: {
|
|
38
|
-
fieldName?: string
|
|
38
|
+
fieldName?: string;
|
|
39
39
|
}) => import("@teambit/legacy/dist/consumer/component-ops/components-diff").FieldsDiff[];
|
|
40
40
|
};
|
|
41
41
|
};
|
|
@@ -7,13 +7,13 @@ import { LoggerMain, Logger } from '@teambit/logger';
|
|
|
7
7
|
import { FieldsDiff, FileDiff } from '@teambit/legacy/dist/consumer/component-ops/components-diff';
|
|
8
8
|
import { TesterMain } from '@teambit/tester';
|
|
9
9
|
import { Component, ComponentMain } from '@teambit/component';
|
|
10
|
-
export
|
|
10
|
+
export type ComponentCompareResult = {
|
|
11
11
|
id: string;
|
|
12
12
|
code: FileDiff[];
|
|
13
13
|
fields: FieldsDiff[];
|
|
14
14
|
tests: FileDiff[];
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
type ConfigDiff = {
|
|
17
17
|
version?: string;
|
|
18
18
|
dependencies?: string[];
|
|
19
19
|
aspects?: Record<string, any>;
|
|
@@ -25,7 +25,7 @@ export declare class ComponentCompareMain {
|
|
|
25
25
|
private tester;
|
|
26
26
|
private depResolver;
|
|
27
27
|
private workspace?;
|
|
28
|
-
constructor(componentAspect: ComponentMain, scope: ScopeMain, logger: Logger, tester: TesterMain, depResolver: DependencyResolverMain, workspace?: Workspace
|
|
28
|
+
constructor(componentAspect: ComponentMain, scope: ScopeMain, logger: Logger, tester: TesterMain, depResolver: DependencyResolverMain, workspace?: Workspace);
|
|
29
29
|
compare(baseIdStr: string, compareIdStr: string): Promise<ComponentCompareResult>;
|
|
30
30
|
diffByCLIValues(values: string[], verbose: boolean, table: boolean): Promise<any>;
|
|
31
31
|
getConfigForDiffById(id: string): Promise<ConfigDiff>;
|
|
@@ -36,7 +36,7 @@ export declare class ComponentCompareMain {
|
|
|
36
36
|
}>;
|
|
37
37
|
private parseValues;
|
|
38
38
|
private getBitIdsForDiff;
|
|
39
|
-
static slots:
|
|
39
|
+
static slots: any[];
|
|
40
40
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
41
41
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
42
42
|
static provider([graphql, component, scope, loggerMain, cli, workspace, tester, depResolver]: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { Section } from '@teambit/component';
|
|
3
3
|
import { ComponentCompareUI } from './component-compare.ui.runtime';
|
|
4
4
|
export declare class ComponentCompareSection implements Section {
|
|
@@ -7,11 +7,11 @@ export declare class ComponentCompareSection implements Section {
|
|
|
7
7
|
navigationLink: {
|
|
8
8
|
href: string;
|
|
9
9
|
displayName: string;
|
|
10
|
-
children:
|
|
10
|
+
children: JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
route: {
|
|
13
13
|
path: string;
|
|
14
|
-
element:
|
|
14
|
+
element: JSX.Element;
|
|
15
15
|
};
|
|
16
16
|
order: number;
|
|
17
17
|
}
|
|
@@ -4,8 +4,8 @@ import { Harmony, SlotRegistry } from '@teambit/harmony';
|
|
|
4
4
|
import { ComponentUI } from '@teambit/component';
|
|
5
5
|
import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
6
6
|
import { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type ComponentCompareNav = Array<TabItem>;
|
|
8
|
+
export type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;
|
|
9
9
|
export declare class ComponentCompareUI {
|
|
10
10
|
private host;
|
|
11
11
|
private navSlot;
|
|
@@ -15,9 +15,9 @@ export declare class ComponentCompareUI {
|
|
|
15
15
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
16
16
|
static slots: (((registerFn: () => string) => SlotRegistry<ComponentCompareNavSlot>) | ((registerFn: () => string) => SlotRegistry<RouteSlot>))[];
|
|
17
17
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
18
|
-
getComponentComparePage: (props?: ComponentCompareProps) =>
|
|
19
|
-
getAspectsComparePage: () =>
|
|
20
|
-
getChangelogComparePage: () =>
|
|
18
|
+
getComponentComparePage: (props?: ComponentCompareProps) => JSX.Element;
|
|
19
|
+
getAspectsComparePage: () => JSX.Element;
|
|
20
|
+
getChangelogComparePage: () => JSX.Element;
|
|
21
21
|
registerNavigation(nav: TabItem | Array<TabItem>): this;
|
|
22
22
|
registerRoutes(routes: RouteProps[]): this;
|
|
23
23
|
get routes(): Map<string, RouteProps | RouteProps[]>;
|
|
@@ -25,22 +25,22 @@ export declare class ComponentCompareUI {
|
|
|
25
25
|
get tabs(): {
|
|
26
26
|
id: string;
|
|
27
27
|
element: React.ReactNode;
|
|
28
|
-
order?: number
|
|
29
|
-
displayName?: string
|
|
30
|
-
props?:
|
|
31
|
-
replace?: boolean
|
|
32
|
-
external?: boolean
|
|
28
|
+
order?: number;
|
|
29
|
+
displayName?: string;
|
|
30
|
+
props?: {
|
|
31
|
+
replace?: boolean;
|
|
32
|
+
external?: boolean;
|
|
33
33
|
} & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
34
|
-
activeClassName?: string
|
|
35
|
-
activeStyle?: React.CSSProperties
|
|
36
|
-
exact?: boolean
|
|
37
|
-
strict?: boolean
|
|
38
|
-
isActive?: (
|
|
34
|
+
activeClassName?: string;
|
|
35
|
+
activeStyle?: React.CSSProperties;
|
|
36
|
+
exact?: boolean;
|
|
37
|
+
strict?: boolean;
|
|
38
|
+
isActive?: () => boolean;
|
|
39
39
|
} & {
|
|
40
|
-
displayName?: string
|
|
41
|
-
}
|
|
42
|
-
widget?: boolean
|
|
43
|
-
changeType?: import("@teambit/component.ui.component-compare.models.component-compare-change-type").ChangeType
|
|
40
|
+
displayName?: string;
|
|
41
|
+
};
|
|
42
|
+
widget?: boolean;
|
|
43
|
+
changeType?: import("@teambit/component.ui.component-compare.models.component-compare-change-type").ChangeType;
|
|
44
44
|
}[];
|
|
45
45
|
static provider([componentUi]: [ComponentUI], _: any, [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot], harmony: Harmony): Promise<ComponentCompareUI>;
|
|
46
46
|
}
|
|
@@ -102,14 +102,14 @@ class ComponentCompareUI {
|
|
|
102
102
|
this.routeSlot = routeSlot;
|
|
103
103
|
this.compUI = compUI;
|
|
104
104
|
_defineProperty(this, "getComponentComparePage", props => {
|
|
105
|
-
const tabs =
|
|
106
|
-
const routes =
|
|
107
|
-
const host =
|
|
105
|
+
const tabs = props?.tabs || (() => (0, _lodash().default)(this.navSlot.values()));
|
|
106
|
+
const routes = props?.routes || (() => (0, _lodash().default)(this.routeSlot.values()));
|
|
107
|
+
const host = props?.host || this.host;
|
|
108
108
|
return /*#__PURE__*/_react().default.createElement(_componentUiComponentCompare().ComponentCompare, _extends({}, props || {}, {
|
|
109
109
|
tabs: tabs,
|
|
110
110
|
routes: routes,
|
|
111
111
|
host: host,
|
|
112
|
-
isFullScreen:
|
|
112
|
+
isFullScreen: props?.isFullScreen ?? true
|
|
113
113
|
}));
|
|
114
114
|
});
|
|
115
115
|
_defineProperty(this, "getAspectsComparePage", () => {
|
|
@@ -141,24 +141,17 @@ class ComponentCompareUI {
|
|
|
141
141
|
}
|
|
142
142
|
get tabs() {
|
|
143
143
|
const getElement = (routeProps, href) => {
|
|
144
|
-
var _routeProps$find;
|
|
145
144
|
if (routeProps.length === 1) return routeProps[0].element;
|
|
146
145
|
if (!href) return undefined;
|
|
147
|
-
return
|
|
148
|
-
var _route$path;
|
|
149
|
-
return (_route$path = route.path) === null || _route$path === void 0 ? void 0 : _route$path.startsWith(href);
|
|
150
|
-
})) === null || _routeProps$find === void 0 ? void 0 : _routeProps$find.element;
|
|
146
|
+
return routeProps.find(route => route.path?.startsWith(href))?.element;
|
|
151
147
|
};
|
|
152
148
|
return (0, _lodash().default)(this.navSlot.toArray().map(([id, navProps]) => {
|
|
153
149
|
const maybeRoutesForId = this.routes.get(id);
|
|
154
150
|
const routesForId = maybeRoutesForId && (Array.isArray(maybeRoutesForId) ? [...maybeRoutesForId] : [maybeRoutesForId]) || [];
|
|
155
|
-
return navProps.map(navProp => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
element: getElement(routesForId, navProp === null || navProp === void 0 || (_navProp$props = navProp.props) === null || _navProp$props === void 0 ? void 0 : _navProp$props.href)
|
|
160
|
-
});
|
|
161
|
-
});
|
|
151
|
+
return navProps.map(navProp => _objectSpread(_objectSpread({}, navProp), {}, {
|
|
152
|
+
id: navProp?.id || id,
|
|
153
|
+
element: getElement(routesForId, navProp?.props?.href)
|
|
154
|
+
}));
|
|
162
155
|
}));
|
|
163
156
|
}
|
|
164
157
|
static async provider([componentUi], _, [navSlot, routeSlot], harmony) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_harmony","_component","_componentUiComponentCompare","_ui","_componentUiComponentCompare2","_componentUiComponentCompareCompareAspects","_componentCompareAspects","_componentCompare","_componentCompare2","_componentCompareChangelog","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_extends","assign","bind","target","i","source","key","prototype","hasOwnProperty","call","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","ComponentCompareUI","constructor","host","navSlot","routeSlot","compUI","props","tabs","flatten","values","routes","createElement","ComponentCompare","isFullScreen","ComponentCompareAspects","ComponentCompareChangelog","registerNavigation","nav","Array","isArray","register","registerRoutes","map","navLinks","getElement","routeProps","href","_routeProps$find","element","undefined","find","route","_route$path","path","startsWith","toArray","id","navProps","maybeRoutesForId","get","routesForId","navProp","_navProp$props","provider","componentUi","_","harmony","config","componentCompareUI","componentCompareSection","ComponentCompareSection","registerRoute","registerWidget","navigationLink","order","aspectCompareSection","AspectsCompareSection","compareChangelog","CompareChangelogSection","exports","UIRuntime","Slot","withType","ComponentAspect","ComponentCompareAspect","addRuntime"],"sources":["component-compare.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport flatten from 'lodash.flatten';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare';\nimport { UIRuntime } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { ComponentCompareChangelog } from '@teambit/component.ui.component-compare.changelog';\nimport { ComponentCompareAspects } from '@teambit/component.ui.component-compare.compare-aspects.compare-aspects';\nimport { AspectsCompareSection } from './component-compare-aspects.section';\nimport { ComponentCompareAspect } from './component-compare.aspect';\nimport { ComponentCompareSection } from './component-compare.section';\nimport { CompareChangelogSection } from './component-compare-changelog.section';\n\nexport type ComponentCompareNav = Array<TabItem>;\nexport type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;\nexport class ComponentCompareUI {\n constructor(\n private host: string,\n private navSlot: ComponentCompareNavSlot,\n private routeSlot: RouteSlot,\n private compUI: ComponentUI\n ) {}\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<ComponentCompareNavSlot>(), Slot.withType<RouteSlot>()];\n\n static dependencies = [ComponentAspect];\n\n getComponentComparePage = (props?: ComponentCompareProps) => {\n const tabs = props?.tabs || (() => flatten(this.navSlot.values()));\n const routes = props?.routes || (() => flatten(this.routeSlot.values()));\n const host = props?.host || this.host;\n\n return (\n <ComponentCompare\n {...(props || {})}\n tabs={tabs}\n routes={routes}\n host={host}\n isFullScreen={props?.isFullScreen ?? true}\n />\n );\n };\n\n getAspectsComparePage = () => {\n return <ComponentCompareAspects host={this.host} />;\n };\n\n getChangelogComparePage = () => {\n return <ComponentCompareChangelog />;\n };\n\n registerNavigation(nav: TabItem | Array<TabItem>) {\n if (Array.isArray(nav)) {\n this.navSlot.register(nav);\n } else {\n this.navSlot.register([nav]);\n }\n return this;\n }\n\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\n }\n\n get routes() {\n return this.routeSlot.map;\n }\n\n get navLinks() {\n return this.navSlot.map;\n }\n\n get tabs() {\n const getElement = (routeProps: RouteProps[], href?: string) => {\n if (routeProps.length === 1) return routeProps[0].element;\n if (!href) return undefined;\n return routeProps.find((route) => route.path?.startsWith(href))?.element;\n };\n\n return flatten(\n this.navSlot.toArray().map(([id, navProps]) => {\n const maybeRoutesForId = this.routes.get(id);\n const routesForId =\n (maybeRoutesForId && (Array.isArray(maybeRoutesForId) ? [...maybeRoutesForId] : [maybeRoutesForId])) || [];\n\n return navProps.map((navProp) => ({\n ...navProp,\n id: navProp?.id || id,\n element: getElement(routesForId, navProp?.props?.href),\n }));\n })\n );\n }\n\n static async provider(\n [componentUi]: [ComponentUI],\n _,\n [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n const componentCompareUI = new ComponentCompareUI(host, navSlot, routeSlot, componentUi);\n const componentCompareSection = new ComponentCompareSection(componentCompareUI);\n componentUi.registerRoute([componentCompareSection.route]);\n componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);\n const aspectCompareSection = new AspectsCompareSection(componentCompareUI);\n const compareChangelog = new CompareChangelogSection(componentCompareUI);\n\n componentCompareUI.registerNavigation([aspectCompareSection, compareChangelog]);\n\n componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);\n return componentCompareUI;\n }\n}\n\nComponentCompareAspect.addRuntime(ComponentCompareUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,6BAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,4BAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,IAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,GAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAQ,8BAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,6BAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,2CAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,0CAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,yBAAA;EA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5C,IAAI,GAAGP,MAAM,CAACoD,MAAM,CAACR,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACtD,MAAMS,kBAAkB,GAAG,IAAIhD,kBAAkB,CAACE,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEwC,WAAW,CAAC;IACxF,MAAMK,uBAAuB,GAAG,KAAIC,4CAAuB,EAACF,kBAAkB,CAAC;IAC/EJ,WAAW,CAACO,aAAa,CAAC,CAACF,uBAAuB,CAAClB,KAAK,CAAC,CAAC;IAC1Da,WAAW,CAACQ,cAAc,CAACH,uBAAuB,CAACI,cAAc,EAAEJ,uBAAuB,CAACK,KAAK,CAAC;IACjG,MAAMC,oBAAoB,GAAG,KAAIC,gDAAqB,EAACR,kBAAkB,CAAC;IAC1E,MAAMS,gBAAgB,GAAG,KAAIC,oDAAuB,EAACV,kBAAkB,CAAC;IAExEA,kBAAkB,CAAChC,kBAAkB,CAAC,CAACuC,oBAAoB,EAAEE,gBAAgB,CAAC,CAAC;IAE/ET,kBAAkB,CAAC3B,cAAc,CAAC,CAACkC,oBAAoB,CAACxB,KAAK,EAAE0B,gBAAgB,CAAC1B,KAAK,CAAC,CAAC;IACvF,OAAOiB,kBAAkB;EAC3B;AACF;AAACW,OAAA,CAAA3D,kBAAA,GAAAA,kBAAA;AAAAxB,eAAA,CAtGYwB,kBAAkB,aAQZ4D,eAAS;AAAApF,eAAA,CARfwB,kBAAkB,WAUd,CAAC6D,eAAI,CAACC,QAAQ,CAA0B,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAAtF,eAAA,CAV1EwB,kBAAkB,kBAYP,CAAC+D,oBAAe,CAAC;AA4FzCC,0CAAsB,CAACC,UAAU,CAACjE,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"names":["_react","data","_interopRequireDefault","require","_lodash","_harmony","_component","_componentUiComponentCompare","_ui","_componentUiComponentCompare2","_componentUiComponentCompareCompareAspects","_componentCompareAspects","_componentCompare","_componentCompare2","_componentCompareChangelog","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_extends","assign","bind","target","i","source","key","prototype","hasOwnProperty","call","value","_toPropertyKey","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","Number","ComponentCompareUI","constructor","host","navSlot","routeSlot","compUI","props","tabs","flatten","values","routes","createElement","ComponentCompare","isFullScreen","ComponentCompareAspects","ComponentCompareChangelog","registerNavigation","nav","Array","isArray","register","registerRoutes","map","navLinks","getElement","routeProps","href","element","undefined","find","route","path","startsWith","toArray","id","navProps","maybeRoutesForId","get","routesForId","navProp","provider","componentUi","_","harmony","config","componentCompareUI","componentCompareSection","ComponentCompareSection","registerRoute","registerWidget","navigationLink","order","aspectCompareSection","AspectsCompareSection","compareChangelog","CompareChangelogSection","exports","UIRuntime","Slot","withType","ComponentAspect","ComponentCompareAspect","addRuntime"],"sources":["component-compare.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { RouteProps } from 'react-router-dom';\nimport flatten from 'lodash.flatten';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport ComponentAspect, { ComponentUI } from '@teambit/component';\nimport { ComponentCompare } from '@teambit/component.ui.component-compare.component-compare';\nimport { UIRuntime } from '@teambit/ui';\nimport { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { ComponentCompareProps, TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { ComponentCompareChangelog } from '@teambit/component.ui.component-compare.changelog';\nimport { ComponentCompareAspects } from '@teambit/component.ui.component-compare.compare-aspects.compare-aspects';\nimport { AspectsCompareSection } from './component-compare-aspects.section';\nimport { ComponentCompareAspect } from './component-compare.aspect';\nimport { ComponentCompareSection } from './component-compare.section';\nimport { CompareChangelogSection } from './component-compare-changelog.section';\n\nexport type ComponentCompareNav = Array<TabItem>;\nexport type ComponentCompareNavSlot = SlotRegistry<ComponentCompareNav>;\nexport class ComponentCompareUI {\n constructor(\n private host: string,\n private navSlot: ComponentCompareNavSlot,\n private routeSlot: RouteSlot,\n private compUI: ComponentUI\n ) {}\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<ComponentCompareNavSlot>(), Slot.withType<RouteSlot>()];\n\n static dependencies = [ComponentAspect];\n\n getComponentComparePage = (props?: ComponentCompareProps) => {\n const tabs = props?.tabs || (() => flatten(this.navSlot.values()));\n const routes = props?.routes || (() => flatten(this.routeSlot.values()));\n const host = props?.host || this.host;\n\n return (\n <ComponentCompare\n {...(props || {})}\n tabs={tabs}\n routes={routes}\n host={host}\n isFullScreen={props?.isFullScreen ?? true}\n />\n );\n };\n\n getAspectsComparePage = () => {\n return <ComponentCompareAspects host={this.host} />;\n };\n\n getChangelogComparePage = () => {\n return <ComponentCompareChangelog />;\n };\n\n registerNavigation(nav: TabItem | Array<TabItem>) {\n if (Array.isArray(nav)) {\n this.navSlot.register(nav);\n } else {\n this.navSlot.register([nav]);\n }\n return this;\n }\n\n registerRoutes(routes: RouteProps[]) {\n this.routeSlot.register(routes);\n return this;\n }\n\n get routes() {\n return this.routeSlot.map;\n }\n\n get navLinks() {\n return this.navSlot.map;\n }\n\n get tabs() {\n const getElement = (routeProps: RouteProps[], href?: string) => {\n if (routeProps.length === 1) return routeProps[0].element;\n if (!href) return undefined;\n return routeProps.find((route) => route.path?.startsWith(href))?.element;\n };\n\n return flatten(\n this.navSlot.toArray().map(([id, navProps]) => {\n const maybeRoutesForId = this.routes.get(id);\n const routesForId =\n (maybeRoutesForId && (Array.isArray(maybeRoutesForId) ? [...maybeRoutesForId] : [maybeRoutesForId])) || [];\n\n return navProps.map((navProp) => ({\n ...navProp,\n id: navProp?.id || id,\n element: getElement(routesForId, navProp?.props?.href),\n }));\n })\n );\n }\n\n static async provider(\n [componentUi]: [ComponentUI],\n _,\n [navSlot, routeSlot]: [ComponentCompareNavSlot, RouteSlot],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n const componentCompareUI = new ComponentCompareUI(host, navSlot, routeSlot, componentUi);\n const componentCompareSection = new ComponentCompareSection(componentCompareUI);\n componentUi.registerRoute([componentCompareSection.route]);\n componentUi.registerWidget(componentCompareSection.navigationLink, componentCompareSection.order);\n const aspectCompareSection = new AspectsCompareSection(componentCompareUI);\n const compareChangelog = new CompareChangelogSection(componentCompareUI);\n\n componentCompareUI.registerNavigation([aspectCompareSection, compareChangelog]);\n\n componentCompareUI.registerRoutes([aspectCompareSection.route, compareChangelog.route]);\n return componentCompareUI;\n }\n}\n\nComponentCompareAspect.addRuntime(ComponentCompareUI);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,6BAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,4BAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,IAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,GAAA,YAAAA,CAAA;IAAA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ACtD,MAAMQ,kBAAkB,GAAG,IAAI7C,kBAAkB,CAACE,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEqC,WAAW,CAAC;IACxF,MAAMK,uBAAuB,GAAG,KAAIC,4CAAuB,EAACF,kBAAkB,CAAC;IAC/EJ,WAAW,CAACO,aAAa,CAAC,CAACF,uBAAuB,CAAChB,KAAK,CAAC,CAAC;IAC1DW,WAAW,CAACQ,cAAc,CAACH,uBAAuB,CAACI,cAAc,EAAEJ,uBAAuB,CAACK,KAAK,CAAC;IACjG,MAAMC,oBAAoB,GAAG,KAAIC,gDAAqB,EAACR,kBAAkB,CAAC;IAC1E,MAAMS,gBAAgB,GAAG,KAAIC,oDAAuB,EAACV,kBAAkB,CAAC;IAExEA,kBAAkB,CAAC7B,kBAAkB,CAAC,CAACoC,oBAAoB,EAAEE,gBAAgB,CAAC,CAAC;IAE/ET,kBAAkB,CAACxB,cAAc,CAAC,CAAC+B,oBAAoB,CAACtB,KAAK,EAAEwB,gBAAgB,CAACxB,KAAK,CAAC,CAAC;IACvF,OAAOe,kBAAkB;EAC3B;AACF;AAACW,OAAA,CAAAxD,kBAAA,GAAAA,kBAAA;AAAAxB,eAAA,CAtGYwB,kBAAkB,aAQZyD,eAAS;AAAAjF,eAAA,CARfwB,kBAAkB,WAUd,CAAC0D,eAAI,CAACC,QAAQ,CAA0B,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,CAAC;AAAAnF,eAAA,CAV1EwB,kBAAkB,kBAYP,CAAC4D,oBAAe,CAAC;AA4FzCC,0CAAsB,CAACC,UAAU,CAAC9D,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@1.0.108/dist/component-compare.compositions.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component-compare@1.0.108/dist/component-compare.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/index.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentCompareAspect } from './component-compare.aspect';
|
|
2
|
+
|
|
3
|
+
export type { ComponentCompareMain } from './component-compare.main.runtime';
|
|
4
|
+
export type { ComponentCompareUI, ComponentCompareNavSlot } from './component-compare.ui.runtime';
|
|
5
|
+
export { ComponentCompareAspect };
|
|
6
|
+
export default ComponentCompareAspect;
|
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-compare",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.108",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component-compare",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-compare",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.108"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"graphql-tag": "2.12.1",
|
|
13
13
|
"lodash.flatten": "4.4.0",
|
|
14
|
-
"core-js": "^3.0.0",
|
|
15
|
-
"@babel/runtime": "7.20.0",
|
|
16
14
|
"@teambit/component.ui.component-compare.models.component-compare-change-type": "0.0.7",
|
|
17
15
|
"@teambit/component.ui.component-compare.models.component-compare-props": "0.0.101",
|
|
18
16
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.502",
|
|
@@ -23,31 +21,29 @@
|
|
|
23
21
|
"@teambit/component.ui.component-compare.compare-aspects.compare-aspects": "0.0.145",
|
|
24
22
|
"@teambit/component.ui.component-compare.component-compare": "0.0.171",
|
|
25
23
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.506",
|
|
26
|
-
"@teambit/component": "1.0.
|
|
27
|
-
"@teambit/builder": "1.0.
|
|
28
|
-
"@teambit/cli": "0.0.
|
|
29
|
-
"@teambit/dependency-resolver": "1.0.
|
|
30
|
-
"@teambit/graphql": "1.0.
|
|
31
|
-
"@teambit/logger": "0.0.
|
|
32
|
-
"@teambit/scope": "1.0.
|
|
33
|
-
"@teambit/tester": "1.0.
|
|
34
|
-
"@teambit/workspace": "1.0.
|
|
35
|
-
"@teambit/ui": "1.0.
|
|
24
|
+
"@teambit/component": "1.0.108",
|
|
25
|
+
"@teambit/builder": "1.0.108",
|
|
26
|
+
"@teambit/cli": "0.0.840",
|
|
27
|
+
"@teambit/dependency-resolver": "1.0.108",
|
|
28
|
+
"@teambit/graphql": "1.0.108",
|
|
29
|
+
"@teambit/logger": "0.0.933",
|
|
30
|
+
"@teambit/scope": "1.0.108",
|
|
31
|
+
"@teambit/tester": "1.0.108",
|
|
32
|
+
"@teambit/workspace": "1.0.108",
|
|
33
|
+
"@teambit/ui": "1.0.108"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
|
-
"@types/react": "^17.0.8",
|
|
39
36
|
"@types/lodash.flatten": "4.4.6",
|
|
40
37
|
"@types/mocha": "9.1.0",
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"@
|
|
44
|
-
"@types/testing-library__jest-dom": "5.9.5"
|
|
38
|
+
"@types/jest": "^29.2.2",
|
|
39
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
40
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.13"
|
|
45
41
|
},
|
|
46
42
|
"peerDependencies": {
|
|
47
|
-
"react
|
|
48
|
-
"
|
|
49
|
-
"react": "^
|
|
50
|
-
"
|
|
43
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
44
|
+
"react-router-dom": "^6.8.1",
|
|
45
|
+
"@types/react": "^18.2.12",
|
|
46
|
+
"@teambit/legacy": "1.0.624"
|
|
51
47
|
},
|
|
52
48
|
"license": "Apache-2.0",
|
|
53
49
|
"optionalDependencies": {},
|
|
@@ -61,7 +57,7 @@
|
|
|
61
57
|
},
|
|
62
58
|
"private": false,
|
|
63
59
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
60
|
+
"node": ">=16.0.0"
|
|
65
61
|
},
|
|
66
62
|
"repository": {
|
|
67
63
|
"type": "git",
|
|
@@ -70,12 +66,9 @@
|
|
|
70
66
|
"keywords": [
|
|
71
67
|
"bit",
|
|
72
68
|
"bit-aspect",
|
|
69
|
+
"bit-core-aspect",
|
|
73
70
|
"components",
|
|
74
71
|
"collaboration",
|
|
75
|
-
"web"
|
|
76
|
-
"react",
|
|
77
|
-
"react-components",
|
|
78
|
-
"angular",
|
|
79
|
-
"angular-components"
|
|
72
|
+
"web"
|
|
80
73
|
]
|
|
81
74
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|