@teambit/snapping 1.0.336 → 1.0.338
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/artifacts/__bit_junit.xml +3 -3
- package/artifacts/schema.json +705 -647
- package/dist/snapping.main.runtime.d.ts +6 -4
- package/dist/snapping.main.runtime.js +22 -35
- package/dist/snapping.main.runtime.js.map +1 -1
- package/dist/snapping.spec.js +1 -8
- package/dist/snapping.spec.js.map +1 -1
- package/package.json +24 -23
- package/dist/components-have-issues.d.ts +0 -5
- package/dist/components-have-issues.js +0 -69
- package/dist/components-have-issues.js.map +0 -1
- /package/dist/{preview-1721013596376.js → preview-1721186478884.js} +0 -0
|
@@ -23,6 +23,7 @@ import { BasicTagParams, BasicTagSnapParams } from './tag-model-component';
|
|
|
23
23
|
import { TagDataPerCompRaw } from './tag-from-scope.cmd';
|
|
24
24
|
import { SnapDataPerCompRaw, FileData } from './snap-from-scope.cmd';
|
|
25
25
|
import { untagResult } from './reset-component';
|
|
26
|
+
import { ApplicationMain } from '@teambit/application';
|
|
26
27
|
export type TagDataPerComp = {
|
|
27
28
|
componentId: ComponentID;
|
|
28
29
|
dependencies: ComponentID[];
|
|
@@ -78,8 +79,9 @@ export declare class SnappingMain {
|
|
|
78
79
|
private builder;
|
|
79
80
|
private importer;
|
|
80
81
|
private deps;
|
|
82
|
+
private application;
|
|
81
83
|
private objectsRepo;
|
|
82
|
-
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain);
|
|
84
|
+
constructor(workspace: Workspace, logger: Logger, issues: IssuesMain, insights: InsightsMain, dependencyResolver: DependencyResolverMain, scope: ScopeMain, exporter: ExportMain, builder: BuilderMain, importer: ImporterMain, deps: DependenciesMain, application: ApplicationMain);
|
|
83
85
|
/**
|
|
84
86
|
* tag the given component ids or all modified/new components if "all" param is set.
|
|
85
87
|
* tag is a similar operation as a snap, which saves the changes into the local scope, but it also creates an alias
|
|
@@ -161,7 +163,6 @@ export declare class SnappingMain {
|
|
|
161
163
|
_getObjectsToEnrichComp(consumerComponent: ConsumerComponent, modifiedLog?: Log): Promise<BitObject[]>;
|
|
162
164
|
private transformArtifactsFromVinylToSource;
|
|
163
165
|
private loadComponentsForTagOrSnap;
|
|
164
|
-
private throwForComponentIssues;
|
|
165
166
|
private throwForPendingImport;
|
|
166
167
|
private throwForLegacyDependenciesInsideHarmony;
|
|
167
168
|
/**
|
|
@@ -183,7 +184,7 @@ export declare class SnappingMain {
|
|
|
183
184
|
static slots: never[];
|
|
184
185
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
185
186
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
186
|
-
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps,]: [
|
|
187
|
+
static provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application,]: [
|
|
187
188
|
Workspace,
|
|
188
189
|
CLIMain,
|
|
189
190
|
LoggerMain,
|
|
@@ -195,7 +196,8 @@ export declare class SnappingMain {
|
|
|
195
196
|
BuilderMain,
|
|
196
197
|
ImporterMain,
|
|
197
198
|
GlobalConfigMain,
|
|
198
|
-
DependenciesMain
|
|
199
|
+
DependenciesMain,
|
|
200
|
+
ApplicationMain
|
|
199
201
|
]): Promise<SnappingMain>;
|
|
200
202
|
}
|
|
201
203
|
export default SnappingMain;
|
|
@@ -256,13 +256,6 @@ function _tagCmd() {
|
|
|
256
256
|
};
|
|
257
257
|
return data;
|
|
258
258
|
}
|
|
259
|
-
function _componentsHaveIssues() {
|
|
260
|
-
const data = require("./components-have-issues");
|
|
261
|
-
_componentsHaveIssues = function () {
|
|
262
|
-
return data;
|
|
263
|
-
};
|
|
264
|
-
return data;
|
|
265
|
-
}
|
|
266
259
|
function _resetCmd() {
|
|
267
260
|
const data = _interopRequireDefault(require("./reset-cmd"));
|
|
268
261
|
_resetCmd = function () {
|
|
@@ -319,6 +312,13 @@ function _resetComponent() {
|
|
|
319
312
|
};
|
|
320
313
|
return data;
|
|
321
314
|
}
|
|
315
|
+
function _application() {
|
|
316
|
+
const data = require("@teambit/application");
|
|
317
|
+
_application = function () {
|
|
318
|
+
return data;
|
|
319
|
+
};
|
|
320
|
+
return data;
|
|
321
|
+
}
|
|
322
322
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
323
323
|
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; }
|
|
324
324
|
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; }
|
|
@@ -326,7 +326,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
326
326
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
327
327
|
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); }
|
|
328
328
|
class SnappingMain {
|
|
329
|
-
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps) {
|
|
329
|
+
constructor(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application) {
|
|
330
330
|
this.workspace = workspace;
|
|
331
331
|
this.logger = logger;
|
|
332
332
|
this.issues = issues;
|
|
@@ -337,6 +337,7 @@ class SnappingMain {
|
|
|
337
337
|
this.builder = builder;
|
|
338
338
|
this.importer = importer;
|
|
339
339
|
this.deps = deps;
|
|
340
|
+
this.application = application;
|
|
340
341
|
_defineProperty(this, "objectsRepo", void 0);
|
|
341
342
|
this.objectsRepo = this.scope?.legacyScope?.objects;
|
|
342
343
|
}
|
|
@@ -905,19 +906,22 @@ in case you're unsure about the pattern syntax, use "bit pattern [--help]"`);
|
|
|
905
906
|
const componentsToCheck = components.filter(c => !c.isDeleted());
|
|
906
907
|
const consumerComponents = componentsToCheck.map(c => c.state._consumer);
|
|
907
908
|
await this.throwForLegacyDependenciesInsideHarmony(consumerComponents);
|
|
908
|
-
await this.throwForComponentIssues(componentsToCheck, ignoreIssues);
|
|
909
|
+
await this.builder.throwForComponentIssues(componentsToCheck, ignoreIssues);
|
|
909
910
|
this.throwForPendingImport(consumerComponents);
|
|
910
911
|
}
|
|
911
912
|
async throwForDepsFromAnotherLaneForComp(component, allIds, lane, throwForMissingObjects = false) {
|
|
913
|
+
const depsFromModel = component.componentFromModel?.getAllDependencies();
|
|
914
|
+
const depsFromModelIds = depsFromModel ? _componentId().ComponentIdList.fromArray(depsFromModel.map(d => d.id)) : new (_componentId().ComponentIdList)();
|
|
912
915
|
const deps = component.getAllDependencies();
|
|
913
916
|
const missingDeps = [];
|
|
914
917
|
await Promise.all(deps.map(async dep => {
|
|
915
918
|
if (!this.scope.isExported(dep.id) || !dep.id.hasVersion()) return;
|
|
916
919
|
if ((0, _componentVersion().isTag)(dep.id.version)) return;
|
|
917
920
|
if (allIds.hasWithoutVersion(dep.id)) return; // it's tagged/snapped now.
|
|
921
|
+
if (depsFromModelIds.has(dep.id)) return; // this dep is not new, it was already snapped/tagged with it before.
|
|
918
922
|
let isPartOfHistory;
|
|
919
923
|
try {
|
|
920
|
-
isPartOfHistory = lane ?
|
|
924
|
+
isPartOfHistory = lane ? await this.scope.legacyScope.isPartOfLaneHistoryOrMain(dep.id, lane) : await this.scope.legacyScope.isPartOfMainHistory(dep.id);
|
|
921
925
|
} catch (err) {
|
|
922
926
|
if (throwForMissingObjects) throw err;
|
|
923
927
|
if (err instanceof _exceptions().VersionNotFound || err instanceof _exceptions().ComponentNotFound || err instanceof _exceptions().HeadNotFound || err instanceof _exceptions().ParentNotFound) {
|
|
@@ -1132,33 +1136,16 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1132
1136
|
return artifacts;
|
|
1133
1137
|
}
|
|
1134
1138
|
async loadComponentsForTagOrSnap(ids, shouldClearCacheFirst = true) {
|
|
1139
|
+
const idsWithoutVersions = ids.map(id => id.changeVersion(undefined));
|
|
1140
|
+
const appIds = await this.application.loadAllAppsAsAspects(idsWithoutVersions);
|
|
1135
1141
|
if (shouldClearCacheFirst) {
|
|
1136
1142
|
await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();
|
|
1137
1143
|
// don't clear only the cache of these ids. we need also the auto-tag. so it's safer to just clear all.
|
|
1138
1144
|
this.workspace.clearAllComponentsCache();
|
|
1145
|
+
} else {
|
|
1146
|
+
appIds.forEach(id => this.workspace.clearComponentCache(id));
|
|
1139
1147
|
}
|
|
1140
|
-
return this.workspace.getMany(
|
|
1141
|
-
}
|
|
1142
|
-
async throwForComponentIssues(components, ignoreIssues) {
|
|
1143
|
-
if (ignoreIssues === '*') {
|
|
1144
|
-
// ignore all issues
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
const issuesToIgnoreFromFlag = ignoreIssues?.split(',').map(issue => issue.trim()) || [];
|
|
1148
|
-
const issuesToIgnoreFromConfig = this.issues.getIssuesToIgnoreGlobally();
|
|
1149
|
-
const issuesToIgnore = [...issuesToIgnoreFromFlag, ...issuesToIgnoreFromConfig];
|
|
1150
|
-
await this.issues.triggerAddComponentIssues(components, issuesToIgnore);
|
|
1151
|
-
this.issues.removeIgnoredIssuesFromComponents(components, issuesToIgnore);
|
|
1152
|
-
const legacyComponents = components.map(c => c.state._consumer);
|
|
1153
|
-
const componentsWithBlockingIssues = legacyComponents.filter(component => component.issues?.shouldBlockTagging());
|
|
1154
|
-
if (componentsWithBlockingIssues.length) {
|
|
1155
|
-
throw new (_componentsHaveIssues().ComponentsHaveIssues)(componentsWithBlockingIssues);
|
|
1156
|
-
}
|
|
1157
|
-
const workspaceIssues = this.workspace.getWorkspaceIssues();
|
|
1158
|
-
if (workspaceIssues.length) {
|
|
1159
|
-
const issuesStr = workspaceIssues.map(issueErr => issueErr.message).join('\n');
|
|
1160
|
-
throw new (_bitError().BitError)(`the workspace has the following issues:\n${issuesStr}`);
|
|
1161
|
-
}
|
|
1148
|
+
return this.workspace.getMany(idsWithoutVersions);
|
|
1162
1149
|
}
|
|
1163
1150
|
throwForPendingImport(components) {
|
|
1164
1151
|
const componentsMissingFromScope = components.filter(c => !c.componentFromModel && this.scope.isExported(c.id)).map(c => c.id.toString());
|
|
@@ -1341,9 +1328,9 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1341
1328
|
warnings
|
|
1342
1329
|
};
|
|
1343
1330
|
}
|
|
1344
|
-
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps]) {
|
|
1331
|
+
static async provider([workspace, cli, loggerMain, issues, insights, dependencyResolver, scope, exporter, builder, importer, globalConfig, deps, application]) {
|
|
1345
1332
|
const logger = loggerMain.createLogger(_snapping().SnappingAspect.id);
|
|
1346
|
-
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps);
|
|
1333
|
+
const snapping = new SnappingMain(workspace, logger, issues, insights, dependencyResolver, scope, exporter, builder, importer, deps, application);
|
|
1347
1334
|
const snapCmd = new (_snapCmd().SnapCmd)(snapping, logger, globalConfig);
|
|
1348
1335
|
const tagCmd = new (_tagCmd().TagCmd)(snapping, logger, globalConfig);
|
|
1349
1336
|
const tagFromScopeCmd = new (_tagFromScope().TagFromScopeCmd)(snapping, logger);
|
|
@@ -1356,7 +1343,7 @@ another option, in case this dependency is not in main yet is to remove all refe
|
|
|
1356
1343
|
}
|
|
1357
1344
|
exports.SnappingMain = SnappingMain;
|
|
1358
1345
|
_defineProperty(SnappingMain, "slots", []);
|
|
1359
|
-
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect]);
|
|
1346
|
+
_defineProperty(SnappingMain, "dependencies", [_workspace().WorkspaceAspect, _cli().CLIAspect, _logger().LoggerAspect, _issues().IssuesAspect, _insights().InsightsAspect, _dependencyResolver().DependencyResolverAspect, _scope().ScopeAspect, _export().ExportAspect, _builder().BuilderAspect, _importer().ImporterAspect, _globalConfig().GlobalConfigAspect, _dependencies().DependenciesAspect, _application().ApplicationAspect]);
|
|
1360
1347
|
_defineProperty(SnappingMain, "runtime", _cli().MainRuntime);
|
|
1361
1348
|
_snapping().SnappingAspect.addRuntime(SnappingMain);
|
|
1362
1349
|
var _default = exports.default = SnappingMain;
|