@teambit/workspace 0.0.537 → 0.0.539
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/build-graph-from-fs.ts +160 -0
- package/dist/build-graph-from-fs.d.ts +26 -0
- package/dist/build-graph-from-fs.js +254 -0
- package/dist/build-graph-from-fs.js.map +1 -0
- package/dist/workspace.d.ts +4 -1
- package/dist/workspace.js +52 -25
- package/dist/workspace.js.map +1 -1
- package/package-tar/teambit-workspace-0.0.539.tgz +0 -0
- package/package.json +47 -45
- package/workspace.ts +41 -16
- package/package-tar/teambit-workspace-0.0.537.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.539",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/workspace/workspace",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.workspace",
|
|
8
8
|
"name": "workspace",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.539"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"lodash.compact": "3.0.1",
|
|
13
|
+
"lodash": "4.17.21",
|
|
14
|
+
"p-map-series": "2.1.0",
|
|
12
15
|
"chalk": "2.4.2",
|
|
13
16
|
"ink": "3.0.8",
|
|
14
17
|
"semver": "7.3.4",
|
|
15
18
|
"@teambit/harmony": "0.2.11",
|
|
16
19
|
"graphql-tag": "2.12.1",
|
|
17
20
|
"fs-extra": "10.0.0",
|
|
18
|
-
"lodash": "4.17.21",
|
|
19
|
-
"p-map-series": "2.1.0",
|
|
20
21
|
"react-router-dom": "5.2.0",
|
|
21
22
|
"detect-indent": "5.0.0",
|
|
22
23
|
"detect-newline": "3.1.0",
|
|
@@ -32,60 +33,61 @@
|
|
|
32
33
|
"@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
|
|
33
34
|
"@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
|
|
34
35
|
"@teambit/base-ui.graph.tree.recursive-tree": "1.0.0",
|
|
36
|
+
"@teambit/bit-error": "0.0.366",
|
|
37
|
+
"@teambit/legacy-bit-id": "0.0.369",
|
|
38
|
+
"@teambit/logger": "0.0.461",
|
|
39
|
+
"@teambit/scope": "0.0.539",
|
|
35
40
|
"@teambit/cli": "0.0.380",
|
|
36
|
-
"@teambit/isolator": "0.0.
|
|
41
|
+
"@teambit/isolator": "0.0.539",
|
|
37
42
|
"@teambit/component-tree": "0.0.366",
|
|
38
|
-
"@teambit/component.ui.component-status-resolver": "0.0.
|
|
39
|
-
"@teambit/harmony.modules.resolved-component": "0.0.
|
|
40
|
-
"@teambit/dependency-resolver": "0.0.
|
|
41
|
-
"@teambit/
|
|
42
|
-
"@teambit/
|
|
43
|
-
"@teambit/
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/
|
|
48
|
-
"@teambit/
|
|
49
|
-
"@teambit/
|
|
50
|
-
"@teambit/ui": "0.0.537",
|
|
51
|
-
"@teambit/variants": "0.0.461",
|
|
52
|
-
"@teambit/legacy-bit-id": "0.0.369",
|
|
53
|
-
"@teambit/bit-error": "0.0.366",
|
|
43
|
+
"@teambit/component.ui.component-status-resolver": "0.0.459",
|
|
44
|
+
"@teambit/harmony.modules.resolved-component": "0.0.453",
|
|
45
|
+
"@teambit/dependency-resolver": "0.0.539",
|
|
46
|
+
"@teambit/compiler": "0.0.539",
|
|
47
|
+
"@teambit/component": "0.0.539",
|
|
48
|
+
"@teambit/graphql": "0.0.539",
|
|
49
|
+
"@teambit/aspect-loader": "0.0.539",
|
|
50
|
+
"@teambit/bundler": "0.0.539",
|
|
51
|
+
"@teambit/envs": "0.0.539",
|
|
52
|
+
"@teambit/pubsub": "0.0.539",
|
|
53
|
+
"@teambit/ui": "0.0.539",
|
|
54
|
+
"@teambit/variants": "0.0.463",
|
|
54
55
|
"@teambit/component-issues": "0.0.15",
|
|
55
56
|
"@teambit/config": "0.0.391",
|
|
56
|
-
"@teambit/harmony.modules.requireable-component": "0.0.
|
|
57
|
-
"@teambit/workspace.modules.match-pattern": "0.0.
|
|
58
|
-
"@teambit/command-bar": "0.0.
|
|
57
|
+
"@teambit/harmony.modules.requireable-component": "0.0.453",
|
|
58
|
+
"@teambit/workspace.modules.match-pattern": "0.0.455",
|
|
59
|
+
"@teambit/command-bar": "0.0.539",
|
|
59
60
|
"@teambit/design.ui.surfaces.menu.link-item": "0.0.374",
|
|
60
|
-
"@teambit/graph": "0.0.
|
|
61
|
-
"@teambit/react-router": "0.0.
|
|
62
|
-
"@teambit/sidebar": "0.0.
|
|
63
|
-
"@teambit/ui-foundation.ui.main-dropdown": "0.0.
|
|
64
|
-
"@teambit/ui-foundation.ui.menu": "0.0.
|
|
65
|
-
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.
|
|
66
|
-
"@teambit/toolbox.time.time-format": "0.0.
|
|
61
|
+
"@teambit/graph": "0.0.539",
|
|
62
|
+
"@teambit/react-router": "0.0.539",
|
|
63
|
+
"@teambit/sidebar": "0.0.539",
|
|
64
|
+
"@teambit/ui-foundation.ui.main-dropdown": "0.0.455",
|
|
65
|
+
"@teambit/ui-foundation.ui.menu": "0.0.455",
|
|
66
|
+
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.457",
|
|
67
|
+
"@teambit/toolbox.time.time-format": "0.0.452",
|
|
67
68
|
"@teambit/component-id": "0.0.370",
|
|
68
|
-
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.
|
|
69
|
-
"@teambit/deprecation": "0.0.
|
|
70
|
-
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.
|
|
71
|
-
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.
|
|
72
|
-
"@teambit/ui-foundation.ui.corner": "0.0.
|
|
73
|
-
"@teambit/ui-foundation.ui.notifications.notification-context": "0.0.
|
|
74
|
-
"@teambit/ui-foundation.ui.top-bar": "0.0.
|
|
69
|
+
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.456",
|
|
70
|
+
"@teambit/deprecation": "0.0.539",
|
|
71
|
+
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.455",
|
|
72
|
+
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.160",
|
|
73
|
+
"@teambit/ui-foundation.ui.corner": "0.0.462",
|
|
74
|
+
"@teambit/ui-foundation.ui.notifications.notification-context": "0.0.456",
|
|
75
|
+
"@teambit/ui-foundation.ui.top-bar": "0.0.457",
|
|
75
76
|
"@teambit/design.ui.styles.ellipsis": "0.0.346",
|
|
76
77
|
"@teambit/design.ui.styles.muted-italic": "0.0.35",
|
|
77
|
-
"@teambit/ui-foundation.ui.full-loader": "0.0.
|
|
78
|
-
"@teambit/ui-foundation.ui.side-bar": "0.0.
|
|
79
|
-
"@teambit/ui-foundation.ui.tree.drawer": "0.0.
|
|
80
|
-
"@teambit/explorer.ui.gallery.component-grid": "0.0.
|
|
81
|
-
"@teambit/workspace.ui.empty-workspace": "0.0.
|
|
82
|
-
"@teambit/workspace.ui.workspace-component-card": "0.0.
|
|
78
|
+
"@teambit/ui-foundation.ui.full-loader": "0.0.455",
|
|
79
|
+
"@teambit/ui-foundation.ui.side-bar": "0.0.459",
|
|
80
|
+
"@teambit/ui-foundation.ui.tree.drawer": "0.0.455",
|
|
81
|
+
"@teambit/explorer.ui.gallery.component-grid": "0.0.455",
|
|
82
|
+
"@teambit/workspace.ui.empty-workspace": "0.0.457",
|
|
83
|
+
"@teambit/workspace.ui.workspace-component-card": "0.0.458"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
86
|
+
"@types/lodash.compact": "3.0.6",
|
|
87
|
+
"@types/lodash": "4.14.165",
|
|
85
88
|
"@types/react": "^17.0.8",
|
|
86
89
|
"@types/semver": "7.3.4",
|
|
87
90
|
"@types/fs-extra": "9.0.7",
|
|
88
|
-
"@types/lodash": "4.14.165",
|
|
89
91
|
"@types/react-router-dom": "5.1.7",
|
|
90
92
|
"@types/pluralize": "0.0.29",
|
|
91
93
|
"@types/classnames": "2.2.11",
|
package/workspace.ts
CHANGED
|
@@ -55,7 +55,6 @@ import { ComponentNotFound } from '@teambit/legacy/dist/scope/exceptions';
|
|
|
55
55
|
import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
|
|
56
56
|
import { NoComponentDir } from '@teambit/legacy/dist/consumer/component/exceptions/no-component-dir';
|
|
57
57
|
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
|
|
58
|
-
import { buildOneGraphForComponents } from '@teambit/legacy/dist/scope/graph/components-graph';
|
|
59
58
|
import { pathIsInside } from '@teambit/legacy/dist/utils';
|
|
60
59
|
import componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';
|
|
61
60
|
import { PathOsBased, PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';
|
|
@@ -89,6 +88,7 @@ import {
|
|
|
89
88
|
} from './workspace.provider';
|
|
90
89
|
import { WorkspaceComponentLoader } from './workspace-component/workspace-component-loader';
|
|
91
90
|
import { IncorrectEnvAspect } from './exceptions/incorrect-env-aspect';
|
|
91
|
+
import { GraphFromFsBuilder, ShouldIgnoreFunc } from './build-graph-from-fs';
|
|
92
92
|
|
|
93
93
|
export type EjectConfResult = {
|
|
94
94
|
configPath: string;
|
|
@@ -392,7 +392,7 @@ export class Workspace implements ComponentFactory {
|
|
|
392
392
|
|
|
393
393
|
const legacyIds = ids.map((id) => id._legacy);
|
|
394
394
|
|
|
395
|
-
const legacyGraph = await buildOneGraphForComponents(legacyIds
|
|
395
|
+
const legacyGraph = await this.buildOneGraphForComponents(legacyIds);
|
|
396
396
|
return legacyGraph;
|
|
397
397
|
}
|
|
398
398
|
|
|
@@ -608,7 +608,7 @@ export class Workspace implements ComponentFactory {
|
|
|
608
608
|
* @param forCapsule
|
|
609
609
|
*/
|
|
610
610
|
async importAndGetMany(ids: Array<ComponentID>, forCapsule = false): Promise<Component[]> {
|
|
611
|
-
await this.scope.import(ids);
|
|
611
|
+
await this.scope.import(ids, { reFetchUnBuiltVersion: shouldReFetchUnBuiltVersion() });
|
|
612
612
|
return this.componentLoader.getMany(ids, forCapsule);
|
|
613
613
|
}
|
|
614
614
|
|
|
@@ -894,7 +894,7 @@ export class Workspace implements ComponentFactory {
|
|
|
894
894
|
return componentConfigFile;
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
async
|
|
897
|
+
async getAspectsGraphWithoutCore(components: Component[], isAspect?: ShouldIgnoreFunc) {
|
|
898
898
|
const ids = components.map((component) => component.id._legacy);
|
|
899
899
|
const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();
|
|
900
900
|
const coreAspectsComponentIds = coreAspectsStringIds.map((id) => BitId.parse(id, true));
|
|
@@ -917,7 +917,7 @@ export class Workspace implements ComponentFactory {
|
|
|
917
917
|
// This come to solve a circular loop when an env aspect use an aspect (as regular dep) and the aspect use the env aspect as its env
|
|
918
918
|
// TODO: @gilad it causes many issues we need to find a better solution. removed for now.
|
|
919
919
|
const ignoredIds = coreAspectsBitIds.concat([]);
|
|
920
|
-
return buildOneGraphForComponents(ids,
|
|
920
|
+
return this.buildOneGraphForComponents(ids, BitIds.fromArray(ignoredIds), isAspect);
|
|
921
921
|
}
|
|
922
922
|
|
|
923
923
|
/**
|
|
@@ -932,14 +932,10 @@ export class Workspace implements ComponentFactory {
|
|
|
932
932
|
const idsWithoutCore: string[] = difference(notLoadedIds, coreAspectsStringIds);
|
|
933
933
|
const componentIds = await this.resolveMultipleComponentIds(idsWithoutCore);
|
|
934
934
|
const components = await this.importAndGetAspects(componentIds);
|
|
935
|
-
const graph = await this.getGraphWithoutCore(components);
|
|
936
|
-
const allIdsP = graph.nodes().map(async (id) => {
|
|
937
|
-
return this.resolveComponentId(id);
|
|
938
|
-
});
|
|
939
|
-
const allIds = await Promise.all(allIdsP);
|
|
940
|
-
const allComponents = await this.getMany(allIds as ComponentID[]);
|
|
941
935
|
|
|
942
|
-
const
|
|
936
|
+
const isAspect = async (bitId: BitId) => {
|
|
937
|
+
const id = await this.resolveComponentId(bitId);
|
|
938
|
+
const component = await this.get(id);
|
|
943
939
|
let data = component.config.extensions.findExtension(EnvsAspect.id)?.data;
|
|
944
940
|
if (!data) {
|
|
945
941
|
// TODO: remove this once we re-export old components used to store the data here
|
|
@@ -959,11 +955,13 @@ export class Workspace implements ComponentFactory {
|
|
|
959
955
|
}
|
|
960
956
|
}
|
|
961
957
|
return data.type === 'aspect';
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
const graph = await this.getAspectsGraphWithoutCore(components, isAspect);
|
|
961
|
+
const idsStr = graph.nodes();
|
|
962
|
+
const compIds = await this.resolveMultipleComponentIds(idsStr);
|
|
963
|
+
const aspects = await this.getMany(compIds);
|
|
965
964
|
const { workspaceComps, scopeComps } = await this.groupComponentsByWorkspaceAndScope(aspects);
|
|
966
|
-
// load the scope first because we might need it for custom envs that extend external aspects
|
|
967
965
|
const scopeIds = scopeComps.map((aspect) => aspect.id.toString());
|
|
968
966
|
const workspaceAspects = await this.requireComponents(workspaceComps);
|
|
969
967
|
const workspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(
|
|
@@ -978,6 +976,20 @@ export class Workspace implements ComponentFactory {
|
|
|
978
976
|
await this.aspectLoader.loadExtensionsByManifests(allManifests, throwOnError);
|
|
979
977
|
}
|
|
980
978
|
|
|
979
|
+
/**
|
|
980
|
+
* Note - this gets called from Harmony only.
|
|
981
|
+
* returns one graph that includes all dependencies types. each edge has a label of the dependency
|
|
982
|
+
* type. the nodes content is the Component object.
|
|
983
|
+
*/
|
|
984
|
+
async buildOneGraphForComponents(
|
|
985
|
+
ids: BitId[],
|
|
986
|
+
ignoreIds?: BitIds,
|
|
987
|
+
shouldIgnoreFunc?: ShouldIgnoreFunc
|
|
988
|
+
): Promise<LegacyGraph> {
|
|
989
|
+
const graphFromFsBuilder = new GraphFromFsBuilder(this, this.logger, ignoreIds, shouldIgnoreFunc);
|
|
990
|
+
return graphFromFsBuilder.buildGraph(ids);
|
|
991
|
+
}
|
|
992
|
+
|
|
981
993
|
async resolveAspects(runtimeName?: string, componentIds?: ComponentID[]): Promise<AspectDefinition[]> {
|
|
982
994
|
let missingPaths = false;
|
|
983
995
|
const stringIds: string[] = [];
|
|
@@ -1468,4 +1480,17 @@ your workspace.jsonc has this component-id set. you might want to remove/change
|
|
|
1468
1480
|
}
|
|
1469
1481
|
}
|
|
1470
1482
|
|
|
1483
|
+
/**
|
|
1484
|
+
* this is a super hacky way to do it. problem is that loadAspect is running as onStart hook, where we don't
|
|
1485
|
+
* have the CLI fully loaded yet, so we can't get the command from the CLI aspect, we have to retrieve it from
|
|
1486
|
+
* process.argv.
|
|
1487
|
+
* in general, we don't want every command to try again and again fetching un-built versions. otherwise, every time
|
|
1488
|
+
* Bit loads (even bit --help), it'll fetch them and slow down everything.
|
|
1489
|
+
* instead, long-running commands and those that need the artifacts from the Version objects, should try to re-fetch.
|
|
1490
|
+
*/
|
|
1491
|
+
function shouldReFetchUnBuiltVersion() {
|
|
1492
|
+
const commandsToReFetch = ['build', 'show', 'start', 'tag', 'install', 'link', 'import'];
|
|
1493
|
+
return commandsToReFetch.includes(process.argv[2]);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1471
1496
|
export default Workspace;
|
|
Binary file
|