@teambit/snapping 1.0.161 → 1.0.162

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.
@@ -41,7 +41,11 @@ export declare class SnapFromScopeCmd implements Command {
41
41
  private: boolean;
42
42
  constructor(snapping: SnappingMain, logger: Logger);
43
43
  report([data]: [string], options: SnapFromScopeOptions): Promise<string>;
44
- json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, ignoreBuildErrors, rebuildDepsGraph, forceDeploy, }: SnapFromScopeOptions): Promise<import("./snapping.main.runtime").SnapFromScopeResults>;
44
+ json([data]: [string], { push, message, lane, ignoreIssues, build, skipTests, disableSnapPipeline, ignoreBuildErrors, rebuildDepsGraph, forceDeploy, }: SnapFromScopeOptions): Promise<{
45
+ exportedIds: string[] | undefined;
46
+ snappedIds: string[];
47
+ snappedComponents: import("@teambit/legacy/dist/consumer/component").default[];
48
+ }>;
45
49
  private parseData;
46
50
  }
47
51
  export {};
@@ -26,6 +26,8 @@ function _bitError() {
26
26
  return data;
27
27
  }
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
+ 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; }
30
+ 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; }
29
31
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
30
32
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
31
33
  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); }
@@ -102,7 +104,10 @@ to ignore multiple issues, separate them by a comma and wrap with quotes. to ign
102
104
  ignoreBuildErrors,
103
105
  rebuildDepsGraph
104
106
  });
105
- return results;
107
+ return _objectSpread(_objectSpread({}, results), {}, {
108
+ exportedIds: results.exportedIds?.map(id => id.toString()),
109
+ snappedIds: results.snappedIds.map(id => id.toString())
110
+ });
106
111
  }
107
112
  parseData(data) {
108
113
  let dataParsed;
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","SnapFromScopeCmd","constructor","snapping","logger","keys","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","length","push","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","dataItem","componentId","files","file","path","content","Buffer","from","toString","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // dependencies to update their versions, e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n });\n\n return results;\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\n\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA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D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOhB,UAAU;EACnB;AACF;AAACiB,OAAA,CAAAlD,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_componentIssues","_bitError","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","SnapFromScopeCmd","constructor","snapping","logger","IssuesClasses","join","report","options","results","json","snappedIds","exportedIds","snappedOutput","chalk","bold","exportedOutput","message","lane","ignoreIssues","build","skipTests","disableSnapPipeline","ignoreBuildErrors","rebuildDepsGraph","forceDeploy","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","map","id","toString","dataParsed","JSON","parse","err","Error","Array","isArray","dataItem","componentId","files","file","path","content","Buffer","from","exports"],"sources":["snap-from-scope.cmd.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Command, CommandOptions } from '@teambit/cli';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { SnappingMain } from './snapping.main.runtime';\nimport { BasicTagSnapParams } from './tag-model-component';\n\nexport type FileData = { path: string; content: string; delete?: boolean };\n\nexport type SnapDataPerCompRaw = {\n componentId: string;\n dependencies?: string[];\n aspects?: Record<string, any>;\n message?: string;\n files?: FileData[];\n isNew?: boolean;\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n} & BasicTagSnapParams;\n\nexport class SnapFromScopeCmd implements Command {\n name = '_snap <data>';\n description = 'snap components from a bare-scope';\n extendedDescription = `this command should be running from a new bare scope, it first imports the components it needs and then processes the snap.\nthe input data is a stringified JSON of an array of the following object.\n{\n componentId: string; // ids always have scope, so it's safe to parse them from string\n dependencies?: string[]; // dependencies to update their versions, e.g. [teambit/compiler@1.0.0, teambit/tester@1.0.0]\n aspects?: Record<string,any> // e.g. { \"teambit.react/react\": {}, \"teambit.envs/envs\": { \"env\": \"teambit.react/react\" } }\n message?: string; // tag-message.\n files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.\n isNew?: boolean; // if it's new, it'll be generated from the given files. otherwise, it'll be fetched from the scope and updated.\n mainFile?: string; // relevant when isNew is true. default to \"index.ts\".\n newDependencies?: Array<{ // new dependencies (components and packages) to add.\n id: string; // component-id or package-name. e.g. \"teambit.react/react\" or \"lodash\".\n version?: string; // version of the package. e.g. \"2.0.3\". for packages, it is mandatory.\n isComponent?: boolean; // default true. if false, it's a package dependency\n type?: 'runtime' | 'dev' | 'peer'; // default \"runtime\".\n }>;\n}\nan example of the final data: '[{\"componentId\":\"ci.remote2/comp-b\",\"message\": \"first snap\"}]'\n`;\n alias = '';\n options = [\n ['', 'push', 'export the updated objects to the original scopes once done'],\n ['m', 'message <message>', 'log message describing the latest changes'],\n ['', 'lane <lane-id>', 'fetch the components from the given lane'],\n ['', 'build', 'run the build pipeline'],\n ['', 'skip-tests', 'skip running component tests during snap process'],\n ['', 'disable-snap-pipeline', 'skip the snap pipeline'],\n ['', 'force-deploy', 'DEPRECATED. use --ignore-build-error instead'],\n ['', 'ignore-build-errors', 'run the snap pipeline although the build pipeline failed'],\n ['', 'rebuild-deps-graph', 'do not reuse the saved dependencies graph, instead build it from scratch'],\n [\n 'i',\n 'ignore-issues [issues]',\n `ignore component issues (shown in \"bit status\" as \"issues found\"), issues to ignore:\n[${Object.keys(IssuesClasses).join(', ')}]\nto ignore multiple issues, separate them by a comma and wrap with quotes. to ignore all issues, specify \"*\".`,\n ],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n private = true;\n\n constructor(private snapping: SnappingMain, private logger: Logger) {}\n\n async report([data]: [string], options: SnapFromScopeOptions) {\n const results = await this.json([data], options);\n\n const { snappedIds, exportedIds } = results;\n\n const snappedOutput = `${chalk.bold('snapped components')}\\n${snappedIds.join('\\n')}`;\n const exportedOutput =\n exportedIds && exportedIds.length ? `\\n\\n${chalk.bold('exported components')}\\n${exportedIds.join('\\n')}` : '';\n\n return `${snappedOutput}${exportedOutput}`;\n }\n async json(\n [data]: [string],\n {\n push = false,\n message = '',\n lane,\n ignoreIssues,\n build = false,\n skipTests = false,\n disableSnapPipeline = false,\n ignoreBuildErrors = false,\n rebuildDepsGraph,\n forceDeploy = false,\n }: SnapFromScopeOptions\n ) {\n const disableTagAndSnapPipelines = disableSnapPipeline;\n if (forceDeploy) {\n ignoreBuildErrors = true;\n }\n if (disableTagAndSnapPipelines && ignoreBuildErrors) {\n throw new BitError('you can use either ignore-build-errors or disable-snap-pipeline, but not both');\n }\n\n const snapDataPerCompRaw = this.parseData(data);\n\n const results = await this.snapping.snapFromScope(snapDataPerCompRaw, {\n push,\n message,\n lane,\n ignoreIssues,\n build,\n skipTests,\n disableTagAndSnapPipelines,\n ignoreBuildErrors,\n rebuildDepsGraph,\n });\n\n return {\n ...results,\n exportedIds: results.exportedIds?.map((id) => id.toString()),\n snappedIds: results.snappedIds.map((id) => id.toString()),\n };\n }\n private parseData(data: string): SnapDataPerCompRaw[] {\n let dataParsed: unknown;\n try {\n dataParsed = JSON.parse(data);\n } catch (err: any) {\n throw new Error(`failed parsing the data entered as JSON. err ${err.message}`);\n }\n if (!Array.isArray(dataParsed)) {\n throw new Error('expect data to be an array');\n }\n dataParsed.forEach((dataItem) => {\n if (!dataItem.componentId) throw new Error('expect data item to have \"componentId\" prop');\n dataItem.files?.forEach((file) => {\n if (!file.path) throw new Error('expect file to have \"path\" prop');\n if (file.content) {\n file.content = Buffer.from(file.content, 'base64').toString();\n }\n });\n });\n\n return dataParsed;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAC,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA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  import { ReleaseType } from 'semver';
5
5
  import { ComponentID, ComponentIdList } from '@teambit/component-id';
6
- import { Consumer } from '@teambit/legacy/dist/consumer';
7
6
  import { Logger, LoggerMain } from '@teambit/logger';
8
7
  import ConsumerComponent from '@teambit/legacy/dist/consumer/component/consumer-component';
9
8
  import { InsightsMain } from '@teambit/insights';
@@ -52,8 +51,9 @@ export type SnapResults = BasicTagResults & {
52
51
  laneName: string | null;
53
52
  };
54
53
  export type SnapFromScopeResults = {
55
- snappedIds: string[];
56
- exportedIds?: string[];
54
+ snappedIds: ComponentID[];
55
+ exportedIds?: ComponentID[];
56
+ snappedComponents: ConsumerComponent[];
57
57
  };
58
58
  export type TagResults = BasicTagResults & {
59
59
  taggedComponents: ConsumerComponent[];
@@ -146,12 +146,14 @@ export declare class SnappingMain {
146
146
  _addFlattenedDepsGraphToComponents(components: ConsumerComponent[]): Promise<void>;
147
147
  _updateComponentsByTagResult(components: ConsumerComponent[], tagResult: LegacyOnTagResult[]): void;
148
148
  _getPublishedPackages(components: ConsumerComponent[]): string[];
149
- _addCompToObjects({ source, consumer, lane, shouldValidateVersion, }: {
149
+ _addCompToObjects({ source, lane, shouldValidateVersion, }: {
150
150
  source: ConsumerComponent;
151
- consumer: Consumer;
152
151
  lane: Lane | null;
153
152
  shouldValidateVersion?: boolean;
154
- }): Promise<ModelComponent>;
153
+ }): Promise<{
154
+ component: ModelComponent;
155
+ version: Version;
156
+ }>;
155
157
  _addCompFromScopeToObjects(source: ConsumerComponent, lane: Lane | null): Promise<{
156
158
  component: ModelComponent;
157
159
  version: Version;
@@ -409,9 +409,9 @@ class SnappingMain {
409
409
  warnings
410
410
  } = await this.getComponentsToTag(unmodified, exactVersion, persist, ids, snapped, unmerged);
411
411
  if (!bitIds.length) return null;
412
- const legacyBitIds = _componentId().ComponentIdList.fromArray(bitIds);
413
- this.logger.debug(`tagging the following components: ${legacyBitIds.toString()}`);
414
- const components = await this.loadComponentsForTagOrSnap(legacyBitIds, !soft);
412
+ const compIds = _componentId().ComponentIdList.fromArray(bitIds);
413
+ this.logger.debug(`tagging the following components: ${compIds.toString()}`);
414
+ const components = await this.loadComponentsForTagOrSnap(compIds, !soft);
415
415
  const consumerComponents = components.map(c => c.state._consumer);
416
416
  await this.throwForVariousIssues(components, ignoreIssues);
417
417
  const {
@@ -426,7 +426,7 @@ class SnappingMain {
426
426
  snapping: this,
427
427
  builder: this.builder,
428
428
  consumerComponents,
429
- ids: legacyBitIds,
429
+ ids: compIds,
430
430
  message,
431
431
  editor,
432
432
  exactVersion: validExactVersion,
@@ -667,10 +667,11 @@ if you're willing to lose the history from the head to the specified version, us
667
667
  // (see the e2e - "snap on a lane when the component is new to the lane and the scope")
668
668
  exportHeadsOnly: true
669
669
  });
670
- exportedIds = exported.map(e => e.toString());
670
+ exportedIds = exported;
671
671
  }
672
672
  return {
673
- snappedIds: taggedComponents.map(comp => comp.id.toString()),
673
+ snappedComponents: taggedComponents,
674
+ snappedIds: taggedComponents.map(comp => comp.id),
674
675
  exportedIds
675
676
  };
676
677
  }
@@ -1009,7 +1010,6 @@ another option, in case this dependency is not in main yet is to remove all refe
1009
1010
  }
1010
1011
  async _addCompToObjects({
1011
1012
  source,
1012
- consumer,
1013
1013
  lane,
1014
1014
  shouldValidateVersion = false
1015
1015
  }) {
@@ -1017,7 +1017,7 @@ another option, in case this dependency is not in main yet is to remove all refe
1017
1017
  component,
1018
1018
  version
1019
1019
  } = await this._addCompFromScopeToObjects(source, lane);
1020
- const unmergedComponent = consumer.scope.objects.unmergedComponents.getEntry(component.toComponentId());
1020
+ const unmergedComponent = this.scope.legacyScope.objects.unmergedComponents.getEntry(component.toComponentId());
1021
1021
  if (unmergedComponent) {
1022
1022
  if (unmergedComponent.unrelated) {
1023
1023
  this.logger.debug(`sources.addSource, unmerged component "${component.name}". adding an unrelated entry ${unmergedComponent.head.hash}`);
@@ -1046,10 +1046,13 @@ another option, in case this dependency is not in main yet is to remove all refe
1046
1046
  this.logger.debug(`sources.addSource, unmerged component "${component.name}". adding a parent ${unmergedComponent.head.hash}`);
1047
1047
  version.log.message = version.log.message || _unmergedComponents().default.buildSnapMessage(unmergedComponent);
1048
1048
  }
1049
- consumer.scope.objects.unmergedComponents.removeComponent(component.toComponentId());
1049
+ this.scope.legacyScope.objects.unmergedComponents.removeComponent(component.toComponentId());
1050
1050
  }
1051
1051
  if (shouldValidateVersion) version.validate();
1052
- return component;
1052
+ return {
1053
+ component,
1054
+ version
1055
+ };
1053
1056
  }
1054
1057
  async _addCompFromScopeToObjects(source, lane) {
1055
1058
  const objectRepo = this.objectsRepo;
@@ -1115,13 +1118,12 @@ another option, in case this dependency is not in main yet is to remove all refe
1115
1118
  return artifacts;
1116
1119
  }
1117
1120
  async loadComponentsForTagOrSnap(ids, shouldClearCacheFirst = true) {
1118
- const compIds = await this.workspace.resolveMultipleComponentIds(ids);
1119
1121
  if (shouldClearCacheFirst) {
1120
1122
  await this.workspace.consumer.componentFsCache.deleteAllDependenciesDataCache();
1121
1123
  // don't clear only the cache of these ids. we need also the auto-tag. so it's safer to just clear all.
1122
1124
  this.workspace.clearAllComponentsCache();
1123
1125
  }
1124
- return this.workspace.getMany(compIds.map(id => id.changeVersion(undefined)));
1126
+ return this.workspace.getMany(ids.map(id => id.changeVersion(undefined)));
1125
1127
  }
1126
1128
  async throwForComponentIssues(components, ignoreIssues) {
1127
1129
  if (ignoreIssues === '*') {