@teambit/workspace 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/aspects-merger.ts +319 -0
- package/bit-map.ts +277 -0
- package/build-graph-from-fs.ts +188 -0
- package/build-graph-ids-from-fs.ts +216 -0
- package/capsule.cmd.ts +217 -0
- package/constants.ts +1 -0
- package/dist/aspects-merger.js +13 -22
- package/dist/aspects-merger.js.map +1 -1
- package/dist/bit-map.d.ts +1 -1
- package/dist/build-graph-from-fs.d.ts +2 -2
- package/dist/build-graph-from-fs.js +1 -2
- package/dist/build-graph-from-fs.js.map +1 -1
- package/dist/build-graph-ids-from-fs.js +1 -1
- package/dist/build-graph-ids-from-fs.js.map +1 -1
- package/dist/capsule.cmd.d.ts +2 -2
- package/dist/capsule.cmd.js +1 -2
- package/dist/capsule.cmd.js.map +1 -1
- package/dist/component-config-file/component-config-file.d.ts +2 -2
- package/dist/component-tree.widget.d.ts +2 -2
- package/dist/eject-conf.cmd.d.ts +2 -2
- package/dist/envs-subcommands/envs-replace.cmd.d.ts +1 -1
- package/dist/envs-subcommands/envs-set.cmd.d.ts +1 -1
- package/dist/envs-subcommands/envs-unset.cmd.d.ts +1 -1
- package/dist/envs-subcommands/envs-update.cmd.d.ts +1 -1
- package/dist/filter.d.ts +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/merge-conflict-file.d.ts +1 -1
- package/dist/merge-conflict-file.js +1 -2
- package/dist/merge-conflict-file.js.map +1 -1
- package/dist/on-component-events.d.ts +6 -6
- package/dist/{preview-1703590665075.js → preview-1703647408454.js} +2 -2
- package/dist/scope-subcommands/scope-set.cmd.d.ts +1 -1
- package/dist/ui/workspace/use-workspace.d.ts +8 -8
- package/dist/ui/workspace/use-workspace.js +7 -18
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/ui/workspace/workspace-model.d.ts +3 -3
- package/dist/ui/workspace/workspace-overview/workspace-overview.d.ts +2 -2
- package/dist/ui/workspace/workspace-overview/workspace-overview.js +1 -2
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-provider.d.ts +3 -3
- package/dist/ui/workspace/workspace.d.ts +3 -3
- package/dist/workspace-aspects-loader.d.ts +3 -3
- package/dist/workspace-aspects-loader.js +7 -11
- package/dist/workspace-aspects-loader.js.map +1 -1
- package/dist/workspace-component/comp-files.d.ts +3 -3
- package/dist/workspace-component/component-status.d.ts +3 -3
- package/dist/workspace-component/workspace-component-loader.d.ts +5 -5
- package/dist/workspace-component/workspace-component-loader.js +11 -12
- package/dist/workspace-component/workspace-component-loader.js.map +1 -1
- package/dist/workspace.composition.d.ts +2 -2
- package/dist/workspace.d.ts +6 -6
- package/dist/workspace.graphql.d.ts +2 -2
- package/dist/workspace.graphql.js +2 -4
- package/dist/workspace.graphql.js.map +1 -1
- package/dist/workspace.js +16 -23
- package/dist/workspace.js.map +1 -1
- package/dist/workspace.provider.d.ts +12 -12
- package/dist/workspace.provider.js +8 -11
- package/dist/workspace.provider.js.map +1 -1
- package/dist/workspace.ui.drawer.d.ts +1 -1
- package/dist/workspace.ui.drawer.js +5 -6
- package/dist/workspace.ui.drawer.js.map +1 -1
- package/dist/workspace.ui.runtime.d.ts +1 -1
- package/dist/workspace.ui.runtime.js +2 -8
- package/dist/workspace.ui.runtime.js.map +1 -1
- package/eject-conf.cmd.ts +57 -0
- package/filter.ts +139 -0
- package/index.ts +22 -0
- package/merge-conflict-file.ts +129 -0
- package/on-component-events.ts +24 -0
- package/package.json +39 -46
- package/pattern.cmd.ts +53 -0
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- package/types.ts +71 -0
- package/use.cmd.ts +25 -0
- package/workspace-aspects-loader.ts +885 -0
- package/workspace-section.ts +14 -0
- package/workspace.aspect.ts +9 -0
- package/workspace.graphql.ts +133 -0
- package/workspace.main.runtime.ts +56 -0
- package/workspace.provider.ts +282 -0
- package/workspace.ts +2014 -0
- package/workspace.ui-root.ts +65 -0
package/dist/workspace.js
CHANGED
|
@@ -709,12 +709,11 @@ class Workspace {
|
|
|
709
709
|
}
|
|
710
710
|
const flattenedBitIdCompIdMap = {};
|
|
711
711
|
const getCurrentVersionAsTagIfPossible = () => {
|
|
712
|
-
var _component$tags$byHas;
|
|
713
712
|
const currentVer = component.id.version;
|
|
714
713
|
if (!currentVer) return undefined;
|
|
715
714
|
const isCurrentVerAHash = (0, _componentVersion().isHash)(currentVer);
|
|
716
715
|
if (!isCurrentVerAHash) return currentVer;
|
|
717
|
-
const tag =
|
|
716
|
+
const tag = component.tags.byHash(currentVer)?.version.raw;
|
|
718
717
|
return tag || currentVer;
|
|
719
718
|
};
|
|
720
719
|
const currentVersion = getCurrentVersionAsTagIfPossible();
|
|
@@ -983,7 +982,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
|
|
|
983
982
|
} catch (err) {
|
|
984
983
|
if (err instanceof _legacyBitId().InvalidScopeName || err instanceof _scopeNotFoundOrDenied().ScopeNotFoundOrDenied || err instanceof _laneNotFound().LaneNotFound || err instanceof _legacyBitId().InvalidScopeNameFromRemote) {
|
|
985
984
|
const bitMapLaneId = this.bitMap.getExportedLaneId();
|
|
986
|
-
if (bitMapLaneId
|
|
985
|
+
if (bitMapLaneId?.isEqual(currentLaneId)) {
|
|
987
986
|
throw err; // we know the lane is not new, so the error is legit
|
|
988
987
|
}
|
|
989
988
|
// the lane could be a local lane so no need to throw an error in such case
|
|
@@ -1129,7 +1128,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
|
|
|
1129
1128
|
throw new (_bitError().BitError)(`unable to find components that using "${env}" env.
|
|
1130
1129
|
the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
1131
1130
|
}
|
|
1132
|
-
return
|
|
1131
|
+
return foundEnv?.components || [];
|
|
1133
1132
|
}
|
|
1134
1133
|
async getMany(ids, loadOpts) {
|
|
1135
1134
|
const {
|
|
@@ -1389,8 +1388,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1389
1388
|
}
|
|
1390
1389
|
async getUnmergedComponent(componentId) {
|
|
1391
1390
|
const unmerged = this.scope.legacyScope.objects.unmergedComponents.getEntry(componentId.fullName);
|
|
1392
|
-
if (unmerged
|
|
1393
|
-
return this.scope.get(componentId.changeVersion(unmerged
|
|
1391
|
+
if (unmerged?.head) {
|
|
1392
|
+
return this.scope.get(componentId.changeVersion(unmerged?.head.toString()));
|
|
1394
1393
|
}
|
|
1395
1394
|
return undefined;
|
|
1396
1395
|
}
|
|
@@ -1437,7 +1436,6 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1437
1436
|
return newComponentIds;
|
|
1438
1437
|
}
|
|
1439
1438
|
async setDefaultScope(scopeName) {
|
|
1440
|
-
var _config$workspaceConf, _config$workspaceConf2;
|
|
1441
1439
|
if (this.defaultScope === scopeName) {
|
|
1442
1440
|
throw new Error(`the default-scope is already set as "${scopeName}", nothing to change`);
|
|
1443
1441
|
}
|
|
@@ -1445,7 +1443,7 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1445
1443
|
throw new (_legacyBitId().InvalidScopeName)(scopeName);
|
|
1446
1444
|
}
|
|
1447
1445
|
const config = this.harmony.get('teambit.harmony/config');
|
|
1448
|
-
|
|
1446
|
+
config.workspaceConfig?.setExtension(_workspace().WorkspaceAspect.id, {
|
|
1449
1447
|
defaultScope: scopeName
|
|
1450
1448
|
}, {
|
|
1451
1449
|
mergeIntoExisting: true,
|
|
@@ -1454,9 +1452,9 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1454
1452
|
// fix also comps using the old default-scope
|
|
1455
1453
|
this.bitMap.updateDefaultScope(this.config.defaultScope, scopeName);
|
|
1456
1454
|
this.config.defaultScope = scopeName;
|
|
1457
|
-
await
|
|
1455
|
+
await config.workspaceConfig?.write({
|
|
1458
1456
|
dir: _path2().default.dirname(config.workspaceConfig.path)
|
|
1459
|
-
})
|
|
1457
|
+
});
|
|
1460
1458
|
await this.bitMap.write('scope-set');
|
|
1461
1459
|
}
|
|
1462
1460
|
async addSpecificComponentConfig(id, aspectId, config = {}, {
|
|
@@ -1495,22 +1493,19 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1495
1493
|
async getAspectIdFromConfig(componentId, aspectIdStr, ignoreAspectVersion = false) {
|
|
1496
1494
|
const config = await this.getExtensionsFromScopeAndSpecific(componentId);
|
|
1497
1495
|
const aspectEntry = config.findExtension(aspectIdStr, ignoreAspectVersion);
|
|
1498
|
-
return aspectEntry
|
|
1496
|
+
return aspectEntry?.id.toString();
|
|
1499
1497
|
}
|
|
1500
1498
|
async getSpecificComponentConfig(id, aspectId) {
|
|
1501
|
-
var _this$bitMap$getBitma;
|
|
1502
1499
|
const componentConfigFile = await this.componentConfigFile(id);
|
|
1503
1500
|
if (componentConfigFile) {
|
|
1504
|
-
|
|
1505
|
-
return (_componentConfigFile$ = componentConfigFile.aspects.get(aspectId)) === null || _componentConfigFile$ === void 0 ? void 0 : _componentConfigFile$.config;
|
|
1501
|
+
return componentConfigFile.aspects.get(aspectId)?.config;
|
|
1506
1502
|
}
|
|
1507
|
-
return
|
|
1503
|
+
return this.bitMap.getBitmapEntry(id, {
|
|
1508
1504
|
ignoreVersion: true
|
|
1509
|
-
}).config
|
|
1505
|
+
}).config?.[aspectId];
|
|
1510
1506
|
}
|
|
1511
1507
|
isVendorComponentByComponentDir(relativeComponentDir) {
|
|
1512
|
-
|
|
1513
|
-
const vendorDir = ((_this$config$vendor = this.config.vendor) === null || _this$config$vendor === void 0 ? void 0 : _this$config$vendor.directory) || DEFAULT_VENDOR_DIR;
|
|
1508
|
+
const vendorDir = this.config.vendor?.directory || DEFAULT_VENDOR_DIR;
|
|
1514
1509
|
if ((0, _utils().pathIsInside)(relativeComponentDir, vendorDir)) {
|
|
1515
1510
|
return true;
|
|
1516
1511
|
}
|
|
@@ -1832,7 +1827,6 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1832
1827
|
* (inside envs/envs it's set without a version).
|
|
1833
1828
|
*/
|
|
1834
1829
|
async resolveEnvIdWithPotentialVersionForConfig(envId) {
|
|
1835
|
-
var _found$extensionId;
|
|
1836
1830
|
const isCore = this.aspectLoader.isCoreAspect(envId.toStringWithoutVersion());
|
|
1837
1831
|
const existsOnWorkspace = await this.hasId(envId);
|
|
1838
1832
|
if (isCore || existsOnWorkspace) {
|
|
@@ -1844,8 +1838,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1844
1838
|
return envId.toString();
|
|
1845
1839
|
}
|
|
1846
1840
|
const extensions = this.harmony.get('teambit.harmony/config').extensions;
|
|
1847
|
-
const found = extensions
|
|
1848
|
-
if (found &&
|
|
1841
|
+
const found = extensions?.findExtension(envId.toString(), true);
|
|
1842
|
+
if (found && found.extensionId?.version) {
|
|
1849
1843
|
return found.extensionId.toString();
|
|
1850
1844
|
}
|
|
1851
1845
|
const comps = await this.importAndGetMany([envId], `to get the env ${envId.toString()}`);
|
|
@@ -1859,9 +1853,8 @@ the following envs are used in this workspace: ${availableEnvs.join(', ')}`);
|
|
|
1859
1853
|
const changed = [];
|
|
1860
1854
|
const unchanged = [];
|
|
1861
1855
|
await Promise.all(ids.map(async id => {
|
|
1862
|
-
var _extensions$findCoreE;
|
|
1863
1856
|
const extensions = await this.getExtensionsFromScopeAndSpecific(id);
|
|
1864
|
-
const envsAspect =
|
|
1857
|
+
const envsAspect = extensions.findCoreExtension(_envs().EnvsAspect.id)?.rawConfig;
|
|
1865
1858
|
const currentEnv = envsAspect && envsAspect !== _config().REMOVE_EXTENSION_SPECIAL_SIGN ? envsAspect.env : null;
|
|
1866
1859
|
if (!currentEnv) {
|
|
1867
1860
|
unchanged.push(id);
|