@teambit/workspace 0.0.520 → 0.0.524
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/on-component-events.d.ts +2 -1
- package/dist/tag-cmd.js +1 -1
- package/dist/tag-cmd.js.map +1 -1
- package/dist/watch/watcher.d.ts +2 -0
- package/dist/watch/watcher.js +5 -5
- package/dist/watch/watcher.js.map +1 -1
- package/dist/workspace.d.ts +2 -1
- package/dist/workspace.js +14 -5
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.main.runtime.d.ts +2 -2
- package/on-component-events.ts +5 -1
- package/package-tar/teambit-workspace-0.0.524.tgz +0 -0
- package/package.json +51 -51
- package/tag-cmd.ts +1 -1
- package/watch/watcher.ts +8 -6
- package/workspace.ts +19 -6
- package/package-tar/teambit-workspace-0.0.520.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/workspace",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.524",
|
|
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.524"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
@@ -32,54 +32,54 @@
|
|
|
32
32
|
"@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
|
|
33
33
|
"@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
|
|
34
34
|
"@teambit/base-ui.graph.tree.recursive-tree": "1.0.0",
|
|
35
|
-
"@teambit/cli": "0.0.
|
|
36
|
-
"@teambit/isolator": "0.0.
|
|
37
|
-
"@teambit/component-tree": "0.0.
|
|
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/logger": "0.0.
|
|
42
|
-
"@teambit/
|
|
43
|
-
"@teambit/
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/
|
|
48
|
-
"@teambit/
|
|
49
|
-
"@teambit/
|
|
50
|
-
"@teambit/
|
|
51
|
-
"@teambit/
|
|
52
|
-
"@teambit/bit-
|
|
53
|
-
"@teambit/
|
|
54
|
-
"@teambit/
|
|
55
|
-
"@teambit/
|
|
56
|
-
"@teambit/
|
|
57
|
-
"@teambit/
|
|
58
|
-
"@teambit/
|
|
59
|
-
"@teambit/
|
|
60
|
-
"@teambit/
|
|
61
|
-
"@teambit/
|
|
62
|
-
"@teambit/
|
|
63
|
-
"@teambit/ui-foundation.ui.
|
|
64
|
-
"@teambit/ui-foundation.ui.
|
|
65
|
-
"@teambit/
|
|
66
|
-
"@teambit/
|
|
67
|
-
"@teambit/component-id": "0.0.
|
|
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.
|
|
75
|
-
"@teambit/design.ui.styles.ellipsis": "0.0.
|
|
76
|
-
"@teambit/design.ui.styles.muted-italic": "0.0.
|
|
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.
|
|
35
|
+
"@teambit/cli": "0.0.380",
|
|
36
|
+
"@teambit/isolator": "0.0.524",
|
|
37
|
+
"@teambit/component-tree": "0.0.366",
|
|
38
|
+
"@teambit/component.ui.component-status-resolver": "0.0.450",
|
|
39
|
+
"@teambit/harmony.modules.resolved-component": "0.0.444",
|
|
40
|
+
"@teambit/dependency-resolver": "0.0.524",
|
|
41
|
+
"@teambit/logger": "0.0.450",
|
|
42
|
+
"@teambit/compiler": "0.0.524",
|
|
43
|
+
"@teambit/component": "0.0.524",
|
|
44
|
+
"@teambit/graphql": "0.0.524",
|
|
45
|
+
"@teambit/aspect-loader": "0.0.524",
|
|
46
|
+
"@teambit/bundler": "0.0.524",
|
|
47
|
+
"@teambit/envs": "0.0.524",
|
|
48
|
+
"@teambit/pubsub": "0.0.524",
|
|
49
|
+
"@teambit/scope": "0.0.524",
|
|
50
|
+
"@teambit/ui": "0.0.524",
|
|
51
|
+
"@teambit/variants": "0.0.452",
|
|
52
|
+
"@teambit/legacy-bit-id": "0.0.369",
|
|
53
|
+
"@teambit/bit-error": "0.0.366",
|
|
54
|
+
"@teambit/component-issues": "0.0.15",
|
|
55
|
+
"@teambit/config": "0.0.391",
|
|
56
|
+
"@teambit/harmony.modules.requireable-component": "0.0.444",
|
|
57
|
+
"@teambit/workspace.modules.match-pattern": "0.0.446",
|
|
58
|
+
"@teambit/command-bar": "0.0.524",
|
|
59
|
+
"@teambit/design.ui.surfaces.menu.link-item": "0.0.374",
|
|
60
|
+
"@teambit/graph": "0.0.524",
|
|
61
|
+
"@teambit/react-router": "0.0.524",
|
|
62
|
+
"@teambit/sidebar": "0.0.524",
|
|
63
|
+
"@teambit/ui-foundation.ui.main-dropdown": "0.0.446",
|
|
64
|
+
"@teambit/ui-foundation.ui.menu": "0.0.446",
|
|
65
|
+
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.448",
|
|
66
|
+
"@teambit/toolbox.time.time-format": "0.0.443",
|
|
67
|
+
"@teambit/component-id": "0.0.370",
|
|
68
|
+
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.447",
|
|
69
|
+
"@teambit/deprecation": "0.0.524",
|
|
70
|
+
"@teambit/ui-foundation.ui.constants.z-indexes": "0.0.446",
|
|
71
|
+
"@teambit/ui-foundation.ui.buttons.collapser": "0.0.151",
|
|
72
|
+
"@teambit/ui-foundation.ui.corner": "0.0.453",
|
|
73
|
+
"@teambit/ui-foundation.ui.notifications.notification-context": "0.0.447",
|
|
74
|
+
"@teambit/ui-foundation.ui.top-bar": "0.0.448",
|
|
75
|
+
"@teambit/design.ui.styles.ellipsis": "0.0.346",
|
|
76
|
+
"@teambit/design.ui.styles.muted-italic": "0.0.35",
|
|
77
|
+
"@teambit/ui-foundation.ui.full-loader": "0.0.446",
|
|
78
|
+
"@teambit/ui-foundation.ui.side-bar": "0.0.450",
|
|
79
|
+
"@teambit/ui-foundation.ui.tree.drawer": "0.0.446",
|
|
80
|
+
"@teambit/explorer.ui.gallery.component-grid": "0.0.446",
|
|
81
|
+
"@teambit/workspace.ui.empty-workspace": "0.0.448",
|
|
82
|
+
"@teambit/workspace.ui.workspace-component-card": "0.0.449"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/react": "^17.0.8",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
102
102
|
"react": "^16.8.0 || ^17.0.0"
|
|
103
103
|
},
|
|
104
|
-
"license": "
|
|
104
|
+
"license": "Apache-2.0",
|
|
105
105
|
"bit": {
|
|
106
106
|
"bindingPrefix": "@teambit",
|
|
107
107
|
"env": {},
|
package/tag-cmd.ts
CHANGED
|
@@ -40,7 +40,7 @@ ${WILDCARD_HELP('tag')}`;
|
|
|
40
40
|
['I', 'ignore-newest-version', 'ignore existing of newer versions (default = false)'],
|
|
41
41
|
['', 'skip-tests', 'skip running component tests during tag process'],
|
|
42
42
|
['', 'skip-auto-tag', 'skip auto tagging dependents'],
|
|
43
|
-
['', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],
|
|
43
|
+
['b', 'build', 'EXPERIMENTAL. not needed for now. run the pipeline build and complete the tag'],
|
|
44
44
|
['', 'soft', 'do not persist. only keep note of the changes to be made'],
|
|
45
45
|
['', 'persist', 'persist the changes generated by --soft tag'],
|
|
46
46
|
['', 'disable-deploy-pipeline', 'DEPRECATED. use --disable-tag-pipeline instead'],
|
package/watch/watcher.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { ChildProcess } from 'child_process';
|
|
|
14
14
|
import chokidar, { FSWatcher } from 'chokidar';
|
|
15
15
|
import ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';
|
|
16
16
|
import { PathLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';
|
|
17
|
+
import { CompilationInitiator } from '@teambit/compiler';
|
|
17
18
|
import { WorkspaceAspect } from '../';
|
|
18
19
|
import { OnComponentChangeEvent, OnComponentAddEvent, OnComponentRemovedEvent } from '../events';
|
|
19
20
|
import { Workspace } from '../workspace';
|
|
@@ -40,7 +41,7 @@ export class Watcher {
|
|
|
40
41
|
return this.workspace.consumer;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
async watchAll(opts?: { msgs; verbose?: boolean }) {
|
|
44
|
+
async watchAll(opts?: { msgs; verbose?: boolean; initiator?: CompilationInitiator }) {
|
|
44
45
|
// TODO: run build in the beginning of process (it's work like this in other envs)
|
|
45
46
|
const _verbose = opts?.verbose || false;
|
|
46
47
|
await this.createWatcher();
|
|
@@ -58,7 +59,7 @@ export class Watcher {
|
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
59
60
|
watcher.on('change', async (filePath) => {
|
|
60
61
|
const startTime = new Date().getTime();
|
|
61
|
-
const buildResults = (await this.handleChange(filePath)) || [];
|
|
62
|
+
const buildResults = (await this.handleChange(filePath, opts?.initiator)) || [];
|
|
62
63
|
const duration = new Date().getTime() - startTime;
|
|
63
64
|
opts?.msgs?.onChange(filePath, buildResults, _verbose, duration);
|
|
64
65
|
});
|
|
@@ -81,7 +82,7 @@ export class Watcher {
|
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
private async handleChange(filePath: string): Promise<OnComponentEventResult[]> {
|
|
85
|
+
private async handleChange(filePath: string, initiator?: CompilationInitiator): Promise<OnComponentEventResult[]> {
|
|
85
86
|
try {
|
|
86
87
|
if (filePath.endsWith(BIT_MAP)) {
|
|
87
88
|
const buildResults = await this.handleBitmapChanges();
|
|
@@ -94,7 +95,7 @@ export class Watcher {
|
|
|
94
95
|
return this.completeWatch();
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
const buildResults = await this.executeWatchOperationsOnComponent(componentId);
|
|
98
|
+
const buildResults = await this.executeWatchOperationsOnComponent(componentId, true, initiator);
|
|
98
99
|
this.completeWatch();
|
|
99
100
|
return buildResults;
|
|
100
101
|
} catch (err: any) {
|
|
@@ -137,7 +138,8 @@ export class Watcher {
|
|
|
137
138
|
|
|
138
139
|
private async executeWatchOperationsOnComponent(
|
|
139
140
|
componentId: ComponentID,
|
|
140
|
-
isChange = true
|
|
141
|
+
isChange = true,
|
|
142
|
+
initiator?: CompilationInitiator
|
|
141
143
|
): Promise<OnComponentEventResult[]> {
|
|
142
144
|
if (this.isComponentWatchedExternally(componentId)) {
|
|
143
145
|
// update capsule, once done, it automatically triggers the external watcher
|
|
@@ -157,7 +159,7 @@ export class Watcher {
|
|
|
157
159
|
let buildResults: OnComponentEventResult[];
|
|
158
160
|
try {
|
|
159
161
|
buildResults = isChange
|
|
160
|
-
? await this.workspace.triggerOnComponentChange(componentId)
|
|
162
|
+
? await this.workspace.triggerOnComponentChange(componentId, initiator)
|
|
161
163
|
: await this.workspace.triggerOnComponentAdd(componentId);
|
|
162
164
|
} catch (err: any) {
|
|
163
165
|
// do not exist the watch process on errors, just print them
|
package/workspace.ts
CHANGED
|
@@ -61,10 +61,11 @@ import componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-i
|
|
|
61
61
|
import { PathOsBased, PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';
|
|
62
62
|
import { BitError } from '@teambit/bit-error';
|
|
63
63
|
import fs from 'fs-extra';
|
|
64
|
-
import { slice, uniqBy, difference } from 'lodash';
|
|
64
|
+
import { slice, uniqBy, difference, compact } from 'lodash';
|
|
65
65
|
import path from 'path';
|
|
66
66
|
import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
|
|
67
67
|
import type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
|
|
68
|
+
import { CompilationInitiator } from '@teambit/compiler';
|
|
68
69
|
import { ComponentConfigFile } from './component-config-file';
|
|
69
70
|
import { DependencyTypeNotSupportedInPolicy } from './exceptions';
|
|
70
71
|
import {
|
|
@@ -467,7 +468,7 @@ export class Workspace implements ComponentFactory {
|
|
|
467
468
|
this.componentList = new ComponentsList(this.consumer);
|
|
468
469
|
}
|
|
469
470
|
|
|
470
|
-
async triggerOnComponentChange(id: ComponentID): Promise<OnComponentEventResult[]> {
|
|
471
|
+
async triggerOnComponentChange(id: ComponentID, initiator?: CompilationInitiator): Promise<OnComponentEventResult[]> {
|
|
471
472
|
const component = await this.get(id);
|
|
472
473
|
// if a new file was added, upon component-load, its .bitmap entry is updated to include the
|
|
473
474
|
// new file. write these changes to the .bitmap file so then other processes have access to
|
|
@@ -476,7 +477,7 @@ export class Workspace implements ComponentFactory {
|
|
|
476
477
|
const onChangeEntries = this.onComponentChangeSlot.toArray(); // e.g. [ [ 'teambit.bit/compiler', [Function: bound onComponentChange] ] ]
|
|
477
478
|
const results: Array<{ extensionId: string; results: SerializableResults }> = [];
|
|
478
479
|
await mapSeries(onChangeEntries, async ([extension, onChangeFunc]) => {
|
|
479
|
-
const onChangeResult = await onChangeFunc(component);
|
|
480
|
+
const onChangeResult = await onChangeFunc(component, initiator);
|
|
480
481
|
results.push({ extensionId: extension, results: onChangeResult });
|
|
481
482
|
});
|
|
482
483
|
|
|
@@ -930,10 +931,17 @@ export class Workspace implements ComponentFactory {
|
|
|
930
931
|
const { workspaceComps, scopeComps } = await this.groupComponentsByWorkspaceAndScope(aspects);
|
|
931
932
|
// load the scope first because we might need it for custom envs that extend external aspects
|
|
932
933
|
const scopeIds = scopeComps.map((aspect) => aspect.id.toString());
|
|
933
|
-
await this.scope.loadAspects(scopeIds, throwOnError);
|
|
934
|
-
|
|
935
934
|
const workspaceAspects = await this.requireComponents(workspaceComps);
|
|
936
|
-
await this.aspectLoader.
|
|
935
|
+
const workspaceManifests = await this.aspectLoader.getManifestsFromRequireableExtensions(
|
|
936
|
+
workspaceAspects,
|
|
937
|
+
throwOnError
|
|
938
|
+
);
|
|
939
|
+
const manifestsIds = workspaceManifests.map((m) => m.id);
|
|
940
|
+
|
|
941
|
+
const scopeManifests = await this.scope.getManifestsGraphRecursively(scopeIds, compact(manifestsIds), throwOnError);
|
|
942
|
+
|
|
943
|
+
const allManifests = [...scopeManifests, ...workspaceManifests];
|
|
944
|
+
await this.aspectLoader.loadExtensionsByManifests(allManifests, throwOnError);
|
|
937
945
|
}
|
|
938
946
|
|
|
939
947
|
async resolveAspects(runtimeName?: string, componentIds?: ComponentID[]): Promise<AspectDefinition[]> {
|
|
@@ -1075,6 +1083,11 @@ export class Workspace implements ComponentFactory {
|
|
|
1075
1083
|
}
|
|
1076
1084
|
|
|
1077
1085
|
const requireFunc = async () => {
|
|
1086
|
+
const plugins = this.aspectLoader.getPlugins(component, localPath);
|
|
1087
|
+
if (plugins.has()) {
|
|
1088
|
+
return plugins.load(MainRuntime.name);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1078
1091
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
1079
1092
|
const aspect = require(localPath);
|
|
1080
1093
|
// require aspect runtimes
|
|
Binary file
|