@teambit/snapping 1.0.186 → 1.0.188

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.
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="4" failures="0" errors="0" skipped="1">
3
- <testsuite name="teambit.component/snapping@1.0.186" tests="4" failures="0" errors="0" skipped="1">
4
- <testcase classname="dist/snapping.spec.js" name="tag should throw an ComponentsHaveIssues error" time="0.038"/>
3
+ <testsuite name="teambit.component/snapping@1.0.188" tests="4" failures="0" errors="0" skipped="1">
4
+ <testcase classname="dist/snapping.spec.js" name="tag should throw an ComponentsHaveIssues error" time="0.032"/>
5
5
  <testcase classname="dist/snapping.spec.js" name="should not throw an error if the config was set to ignore MissingPackagesDependenciesOnFs error">
6
6
  <skipped/>
7
7
  </testcase>
8
- <testcase classname="dist/snapping.spec.js" name="should add the new dev dep" time="0.002"/>
8
+ <testcase classname="dist/snapping.spec.js" name="should add the new dev dep" time="0.013"/>
9
9
  <testcase classname="dist/snapping.spec.js" name="should remove the specified dependency" time="0.001"/>
10
10
  </testsuite>
11
11
  </testsuites>
@@ -7,7 +7,7 @@ import { FileData } from './snap-from-scope.cmd';
7
7
  import type { SnappingMain, SnapDataParsed } from './snapping.main.runtime';
8
8
  export type CompData = {
9
9
  componentId: ComponentID;
10
- dependencies: ComponentID[];
10
+ dependencies: string[];
11
11
  aspects: Record<string, any> | undefined;
12
12
  message: string | undefined;
13
13
  files: FileData[] | undefined;
@@ -120,6 +120,7 @@ async function generateCompFromScope(scope, compData, snapping) {
120
120
  }
121
121
  async function addDeps(component, snapData, scope, deps, depsResolver) {
122
122
  const newDeps = snapData.newDependencies || [];
123
+ const updateDeps = snapData.dependencies || [];
123
124
  const compIdsData = newDeps.filter(dep => dep.isComponent);
124
125
  const compIdsDataParsed = compIdsData.map(data => _objectSpread(_objectSpread({}, data), {}, {
125
126
  id: _componentId().ComponentID.fromString(data.id)
@@ -146,26 +147,39 @@ async function addDeps(component, snapData, scope, deps, depsResolver) {
146
147
  const getPkgObj = type => {
147
148
  return toPackageObj(packageDeps.filter(dep => dep.type === type));
148
149
  };
149
- const filterRemovedPkgs = pkgs => {
150
+ const manipulateCurrentPkgs = pkgs => {
150
151
  snapData.removeDependencies?.forEach(pkg => {
151
152
  delete pkgs[pkg];
152
153
  });
154
+ Object.keys(pkgs).forEach(pkg => {
155
+ const found = updateDeps.find(d => d.startsWith(`${pkg}@`));
156
+ if (found) {
157
+ pkgs[pkg] = found.replace(`${pkg}@`, '');
158
+ }
159
+ });
153
160
  return pkgs;
154
161
  };
155
- const filterRemovedDeps = currentCompDeps => {
156
- return currentCompDeps.filter(dep => !snapData.removeDependencies?.includes(dep.id.toStringWithoutVersion()));
162
+ const manipulateCurrentDeps = currentCompDeps => {
163
+ const afterRemoval = currentCompDeps.filter(dep => !snapData.removeDependencies?.includes(dep.id.toStringWithoutVersion()));
164
+ afterRemoval.forEach(dep => {
165
+ const found = updateDeps.find(d => d.startsWith(`${dep.id.toStringWithoutVersion()}@`));
166
+ if (found) {
167
+ dep.id = dep.id.changeVersion(found.replace(`${dep.id.toStringWithoutVersion()}@`, ''));
168
+ }
169
+ });
170
+ return afterRemoval;
157
171
  };
158
172
  const consumerComponent = component.state._consumer;
159
173
  const dependenciesData = {
160
174
  allDependencies: {
161
- dependencies: [...compDeps, ...filterRemovedDeps(consumerComponent.dependencies.get())],
162
- devDependencies: [...compDevDeps, ...filterRemovedDeps(consumerComponent.devDependencies.get())],
163
- peerDependencies: [...compPeerDeps, ...filterRemovedDeps(consumerComponent.peerDependencies.get())]
175
+ dependencies: [...compDeps, ...manipulateCurrentDeps(consumerComponent.dependencies.get())],
176
+ devDependencies: [...compDevDeps, ...manipulateCurrentDeps(consumerComponent.devDependencies.get())],
177
+ peerDependencies: [...compPeerDeps, ...manipulateCurrentDeps(consumerComponent.peerDependencies.get())]
164
178
  },
165
179
  allPackagesDependencies: {
166
- packageDependencies: _objectSpread(_objectSpread({}, filterRemovedPkgs(consumerComponent.packageDependencies)), getPkgObj('runtime')),
167
- devPackageDependencies: _objectSpread(_objectSpread({}, filterRemovedPkgs(consumerComponent.devPackageDependencies)), getPkgObj('dev')),
168
- peerPackageDependencies: _objectSpread(_objectSpread({}, filterRemovedPkgs(consumerComponent.peerPackageDependencies)), getPkgObj('peer'))
180
+ packageDependencies: _objectSpread(_objectSpread({}, manipulateCurrentPkgs(consumerComponent.packageDependencies)), getPkgObj('runtime')),
181
+ devPackageDependencies: _objectSpread(_objectSpread({}, manipulateCurrentPkgs(consumerComponent.devPackageDependencies)), getPkgObj('dev')),
182
+ peerPackageDependencies: _objectSpread(_objectSpread({}, manipulateCurrentPkgs(consumerComponent.peerPackageDependencies)), getPkgObj('peer'))
169
183
  }
170
184
  };
171
185
 
@@ -1 +1 @@
1
- {"version":3,"names":["_componentId","data","require","_component","_interopRequireDefault","_dependencies","_sources","_componentOverrides","_config","_componentSchema","_dependencyResolver","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","generateCompFromScope","scope","compData","snapping","files","Error","map","file","SourceFile","base","path","contents","Buffer","from","content","test","id","componentId","extensions","ExtensionDataList","fromConfigObject","aspects","consumerComponent","ConsumerComponent","mainFile","name","fullName","schema","CURRENT_SCHEMA","overrides","ComponentOverrides","loadNewFromScope","defaultScope","log","message","date","Date","now","toString","username","email","_addFlattenedDependenciesToComponents","version","filesBitObject","legacyScope","sources","consumerComponentToVersion","modelComponent","findOrAddComponent","hash","objects","writeObjectsToTheFS","f","component","getManyByLegacy","addDeps","snapData","deps","depsResolver","newDeps","newDependencies","compIdsData","dep","isComponent","compIdsDataParsed","ComponentID","fromString","compIds","changeVersion","comps","getMany","toDependency","depId","comp","find","c","isEqualWithoutVersion","pkgName","getPackageName","Dependency","compDeps","type","compDevDeps","compPeerDeps","packageDeps","toPackageObj","pkgs","reduce","acc","curr","getPkgObj","filterRemovedPkgs","removeDependencies","pkg","filterRemovedDeps","currentCompDeps","includes","toStringWithoutVersion","state","_consumer","dependenciesData","allDependencies","dependencies","get","devDependencies","peerDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","loadDependenciesFromScope","dependenciesListSerialized","extractDepsFromLegacy","serialize","extId","DependencyResolverAspect","existingExtension","config","findExtension","assign"],"sources":["generate-comp-from-scope.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Dependency } from '@teambit/legacy/dist/consumer/component/dependencies';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { ScopeMain } from '@teambit/scope';\nimport ComponentOverrides from '@teambit/legacy/dist/consumer/config/component-overrides';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { Component } from '@teambit/component';\nimport { CURRENT_SCHEMA } from '@teambit/legacy/dist/consumer/component/component-schema';\nimport { DependenciesMain } from '@teambit/dependencies';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { FileData } from './snap-from-scope.cmd';\nimport type { SnappingMain, SnapDataParsed } from './snapping.main.runtime';\n\nexport type CompData = {\n componentId: ComponentID;\n dependencies: ComponentID[];\n aspects: Record<string, any> | undefined;\n message: string | undefined;\n files: FileData[] | undefined;\n mainFile?: string;\n};\n\n/**\n * normally new components are created from a workspace. the files are in the filesystem and the ConsumerComponent\n * object is created from the files.\n * here, we need to create the ConsumerComponent object \"on the fly\". we don't have workspace, only scope. the files\n * are in-memory (we got them from snap-from-scope command).\n * the way how it is done is by creating a minimal ConsumerComponent object, then convert `Version` object from it,\n * write the version and files into the scope as objects, so then it's possible to load Component object using the\n * ConsumerComponent.\n */\nexport async function generateCompFromScope(\n scope: ScopeMain,\n compData: CompData,\n snapping: SnappingMain\n): Promise<Component> {\n if (!compData.files) throw new Error('generateComp: files are missing');\n const files = compData.files.map((file) => {\n return new SourceFile({ base: '.', path: file.path, contents: Buffer.from(file.content), test: false });\n });\n const id = compData.componentId;\n const extensions = ExtensionDataList.fromConfigObject(compData.aspects || {});\n\n const consumerComponent = new ConsumerComponent({\n mainFile: compData.mainFile || 'index.ts',\n name: compData.componentId.fullName,\n scope: compData.componentId.scope,\n files,\n schema: CURRENT_SCHEMA,\n overrides: await ComponentOverrides.loadNewFromScope(id, files, extensions),\n defaultScope: compData.componentId.scope,\n extensions,\n // the dummy data here are not important. this Version object will be discarded later.\n log: {\n message: compData.message || '',\n date: Date.now().toString(),\n username: '',\n email: '',\n },\n });\n // this is needed, otherwise in case of updating envs/aspects, the version-validator throws\n // an error saying \"the extension ${extensionId.toString()} is missing from the flattenedDependencies\"\n await snapping._addFlattenedDependenciesToComponents([consumerComponent]);\n\n const { version, files: filesBitObject } = await scope.legacyScope.sources.consumerComponentToVersion(\n consumerComponent\n );\n const modelComponent = scope.legacyScope.sources.findOrAddComponent(consumerComponent);\n consumerComponent.version = version.hash().toString();\n await scope.legacyScope.objects.writeObjectsToTheFS([version, modelComponent, ...filesBitObject.map((f) => f.file)]);\n const component = await scope.getManyByLegacy([consumerComponent]);\n\n return component[0];\n}\n\nexport async function addDeps(\n component: Component,\n snapData: SnapDataParsed,\n scope: ScopeMain,\n deps: DependenciesMain,\n depsResolver: DependencyResolverMain\n) {\n const newDeps = snapData.newDependencies || [];\n const compIdsData = newDeps.filter((dep) => dep.isComponent);\n const compIdsDataParsed = compIdsData.map((data) => ({\n ...data,\n id: ComponentID.fromString(data.id),\n }));\n const compIds = compIdsDataParsed.map((dep) => (dep.version ? dep.id.changeVersion(dep.version) : dep.id));\n const comps = await scope.getMany(compIds);\n const toDependency = (depId: ComponentID) => {\n const comp = comps.find((c) => c.id.isEqualWithoutVersion(depId));\n if (!comp) throw new Error(`unable to find the specified dependency ${depId.toString()} in the scope`);\n const pkgName = depsResolver.getPackageName(comp);\n return new Dependency(comp.id, [], pkgName);\n };\n const compDeps = compIdsDataParsed.filter((c) => c.type === 'runtime').map((dep) => toDependency(dep.id));\n const compDevDeps = compIdsDataParsed.filter((c) => c.type === 'dev').map((dep) => toDependency(dep.id));\n const compPeerDeps = compIdsDataParsed.filter((c) => c.type === 'peer').map((dep) => toDependency(dep.id));\n const packageDeps = newDeps.filter((dep) => !dep.isComponent);\n const toPackageObj = (pkgs: Array<{ id: string; version?: string }>) => {\n return pkgs.reduce((acc, curr) => {\n if (!curr.version) throw new Error(`please specify a version for the package dependency: \"${curr.id}\"`);\n acc[curr.id] = curr.version;\n return acc;\n }, {});\n };\n const getPkgObj = (type: 'runtime' | 'dev' | 'peer') => {\n return toPackageObj(packageDeps.filter((dep) => dep.type === type));\n };\n const filterRemovedPkgs = (pkgs: Record<string, string>) => {\n snapData.removeDependencies?.forEach((pkg) => {\n delete pkgs[pkg];\n });\n return pkgs;\n };\n const filterRemovedDeps = (currentCompDeps: Dependency[]) => {\n return currentCompDeps.filter((dep) => !snapData.removeDependencies?.includes(dep.id.toStringWithoutVersion()));\n };\n\n const consumerComponent = component.state._consumer as ConsumerComponent;\n\n const dependenciesData = {\n allDependencies: {\n dependencies: [...compDeps, ...filterRemovedDeps(consumerComponent.dependencies.get())],\n devDependencies: [...compDevDeps, ...filterRemovedDeps(consumerComponent.devDependencies.get())],\n peerDependencies: [...compPeerDeps, ...filterRemovedDeps(consumerComponent.peerDependencies.get())],\n },\n allPackagesDependencies: {\n packageDependencies: { ...filterRemovedPkgs(consumerComponent.packageDependencies), ...getPkgObj('runtime') },\n devPackageDependencies: { ...filterRemovedPkgs(consumerComponent.devPackageDependencies), ...getPkgObj('dev') },\n peerPackageDependencies: {\n ...filterRemovedPkgs(consumerComponent.peerPackageDependencies),\n ...getPkgObj('peer'),\n },\n },\n };\n\n // add the dependencies to the legacy ConsumerComponent object\n // it takes care of both: given dependencies (from the cli) and the overrides, which are coming from the env.\n await deps.loadDependenciesFromScope(consumerComponent, dependenciesData);\n\n // add the dependencies data to the dependency-resolver aspect\n const dependenciesListSerialized = (await depsResolver.extractDepsFromLegacy(component)).serialize();\n const extId = DependencyResolverAspect.id;\n const data = { dependencies: dependenciesListSerialized };\n const existingExtension = component.config.extensions.findExtension(extId);\n if (!existingExtension) throw new Error('unable to find DependencyResolver extension');\n Object.assign(existingExtension.data, data);\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,oBAAA;EAAA,MAAAN,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAK,mBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,iBAAA;EAAA,MAAAR,IAAA,GAAAC,OAAA;EAAAO,gBAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,O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,iBAAiB,CAACqF,mBAAmB,CAAC,GAAKjB,SAAS,CAAC,SAAS,CAAC,CAAE;MAC7GkB,sBAAsB,EAAAjI,aAAA,CAAAA,aAAA,KAAOgH,iBAAiB,CAACrE,iBAAiB,CAACsF,sBAAsB,CAAC,GAAKlB,SAAS,CAAC,KAAK,CAAC,CAAE;MAC/GmB,uBAAuB,EAAAlI,aAAA,CAAAA,aAAA,KAClBgH,iBAAiB,CAACrE,iBAAiB,CAACuF,uBAAuB,CAAC,GAC5DnB,SAAS,CAAC,MAAM,CAAC;IAExB;EACF,CAAC;;EAED;EACA;EACA,MAAMjC,IAAI,CAACqD,yBAAyB,CAACxF,iBAAiB,EAAE8E,gBAAgB,CAAC;;EAEzE;EACA,MAAMW,0BAA0B,GAAG,CAAC,MAAMrD,YAAY,CAACsD,qBAAqB,CAAC3D,SAAS,CAAC,EAAE4D,SAAS,CAAC,CAAC;EACpG,MAAMC,KAAK,GAAGC,8CAAwB,CAACnG,EAAE;EACzC,MAAM/D,IAAI,GAAG;IAAEqJ,YAAY,EAAES;EAA2B,CAAC;EACzD,MAAMK,iBAAiB,GAAG/D,SAAS,CAACgE,MAAM,CAACnG,UAAU,CAACoG,aAAa,CAACJ,KAAK,CAAC;EAC1E,IAAI,CAACE,iBAAiB,EAAE,MAAM,IAAI/G,KAAK,CAAC,6CAA6C,CAAC;EACtFnC,MAAM,CAACqJ,MAAM,CAACH,iBAAiB,CAACnK,IAAI,EAAEA,IAAI,CAAC;AAC7C"}
1
+ {"version":3,"names":["_componentId","data","require","_component","_interopRequireDefault","_dependencies","_sources","_componentOverrides","_config","_componentSchema","_dependencyResolver","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","generateCompFromScope","scope","compData","snapping","files","Error","map","file","SourceFile","base","path","contents","Buffer","from","content","test","id","componentId","extensions","ExtensionDataList","fromConfigObject","aspects","consumerComponent","ConsumerComponent","mainFile","name","fullName","schema","CURRENT_SCHEMA","overrides","ComponentOverrides","loadNewFromScope","defaultScope","log","message","date","Date","now","toString","username","email","_addFlattenedDependenciesToComponents","version","filesBitObject","legacyScope","sources","consumerComponentToVersion","modelComponent","findOrAddComponent","hash","objects","writeObjectsToTheFS","f","component","getManyByLegacy","addDeps","snapData","deps","depsResolver","newDeps","newDependencies","updateDeps","dependencies","compIdsData","dep","isComponent","compIdsDataParsed","ComponentID","fromString","compIds","changeVersion","comps","getMany","toDependency","depId","comp","find","c","isEqualWithoutVersion","pkgName","getPackageName","Dependency","compDeps","type","compDevDeps","compPeerDeps","packageDeps","toPackageObj","pkgs","reduce","acc","curr","getPkgObj","manipulateCurrentPkgs","removeDependencies","pkg","found","d","startsWith","replace","manipulateCurrentDeps","currentCompDeps","afterRemoval","includes","toStringWithoutVersion","state","_consumer","dependenciesData","allDependencies","get","devDependencies","peerDependencies","allPackagesDependencies","packageDependencies","devPackageDependencies","peerPackageDependencies","loadDependenciesFromScope","dependenciesListSerialized","extractDepsFromLegacy","serialize","extId","DependencyResolverAspect","existingExtension","config","findExtension","assign"],"sources":["generate-comp-from-scope.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport { Dependency } from '@teambit/legacy/dist/consumer/component/dependencies';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { ScopeMain } from '@teambit/scope';\nimport ComponentOverrides from '@teambit/legacy/dist/consumer/config/component-overrides';\nimport { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';\nimport { Component } from '@teambit/component';\nimport { CURRENT_SCHEMA } from '@teambit/legacy/dist/consumer/component/component-schema';\nimport { DependenciesMain } from '@teambit/dependencies';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { FileData } from './snap-from-scope.cmd';\nimport type { SnappingMain, SnapDataParsed } from './snapping.main.runtime';\n\nexport type CompData = {\n componentId: ComponentID;\n dependencies: string[];\n aspects: Record<string, any> | undefined;\n message: string | undefined;\n files: FileData[] | undefined;\n mainFile?: string;\n};\n\n/**\n * normally new components are created from a workspace. the files are in the filesystem and the ConsumerComponent\n * object is created from the files.\n * here, we need to create the ConsumerComponent object \"on the fly\". we don't have workspace, only scope. the files\n * are in-memory (we got them from snap-from-scope command).\n * the way how it is done is by creating a minimal ConsumerComponent object, then convert `Version` object from it,\n * write the version and files into the scope as objects, so then it's possible to load Component object using the\n * ConsumerComponent.\n */\nexport async function generateCompFromScope(\n scope: ScopeMain,\n compData: CompData,\n snapping: SnappingMain\n): Promise<Component> {\n if (!compData.files) throw new Error('generateComp: files are missing');\n const files = compData.files.map((file) => {\n return new SourceFile({ base: '.', path: file.path, contents: Buffer.from(file.content), test: false });\n });\n const id = compData.componentId;\n const extensions = ExtensionDataList.fromConfigObject(compData.aspects || {});\n\n const consumerComponent = new ConsumerComponent({\n mainFile: compData.mainFile || 'index.ts',\n name: compData.componentId.fullName,\n scope: compData.componentId.scope,\n files,\n schema: CURRENT_SCHEMA,\n overrides: await ComponentOverrides.loadNewFromScope(id, files, extensions),\n defaultScope: compData.componentId.scope,\n extensions,\n // the dummy data here are not important. this Version object will be discarded later.\n log: {\n message: compData.message || '',\n date: Date.now().toString(),\n username: '',\n email: '',\n },\n });\n // this is needed, otherwise in case of updating envs/aspects, the version-validator throws\n // an error saying \"the extension ${extensionId.toString()} is missing from the flattenedDependencies\"\n await snapping._addFlattenedDependenciesToComponents([consumerComponent]);\n\n const { version, files: filesBitObject } = await scope.legacyScope.sources.consumerComponentToVersion(\n consumerComponent\n );\n const modelComponent = scope.legacyScope.sources.findOrAddComponent(consumerComponent);\n consumerComponent.version = version.hash().toString();\n await scope.legacyScope.objects.writeObjectsToTheFS([version, modelComponent, ...filesBitObject.map((f) => f.file)]);\n const component = await scope.getManyByLegacy([consumerComponent]);\n\n return component[0];\n}\n\nexport async function addDeps(\n component: Component,\n snapData: SnapDataParsed,\n scope: ScopeMain,\n deps: DependenciesMain,\n depsResolver: DependencyResolverMain\n) {\n const newDeps = snapData.newDependencies || [];\n const updateDeps = snapData.dependencies || [];\n const compIdsData = newDeps.filter((dep) => dep.isComponent);\n const compIdsDataParsed = compIdsData.map((data) => ({\n ...data,\n id: ComponentID.fromString(data.id),\n }));\n const compIds = compIdsDataParsed.map((dep) => (dep.version ? dep.id.changeVersion(dep.version) : dep.id));\n const comps = await scope.getMany(compIds);\n const toDependency = (depId: ComponentID) => {\n const comp = comps.find((c) => c.id.isEqualWithoutVersion(depId));\n if (!comp) throw new Error(`unable to find the specified dependency ${depId.toString()} in the scope`);\n const pkgName = depsResolver.getPackageName(comp);\n return new Dependency(comp.id, [], pkgName);\n };\n const compDeps = compIdsDataParsed.filter((c) => c.type === 'runtime').map((dep) => toDependency(dep.id));\n const compDevDeps = compIdsDataParsed.filter((c) => c.type === 'dev').map((dep) => toDependency(dep.id));\n const compPeerDeps = compIdsDataParsed.filter((c) => c.type === 'peer').map((dep) => toDependency(dep.id));\n const packageDeps = newDeps.filter((dep) => !dep.isComponent);\n const toPackageObj = (pkgs: Array<{ id: string; version?: string }>) => {\n return pkgs.reduce((acc, curr) => {\n if (!curr.version) throw new Error(`please specify a version for the package dependency: \"${curr.id}\"`);\n acc[curr.id] = curr.version;\n return acc;\n }, {});\n };\n const getPkgObj = (type: 'runtime' | 'dev' | 'peer') => {\n return toPackageObj(packageDeps.filter((dep) => dep.type === type));\n };\n const manipulateCurrentPkgs = (pkgs: Record<string, string>) => {\n snapData.removeDependencies?.forEach((pkg) => {\n delete pkgs[pkg];\n });\n Object.keys(pkgs).forEach((pkg) => {\n const found = updateDeps.find((d) => d.startsWith(`${pkg}@`));\n if (found) {\n pkgs[pkg] = found.replace(`${pkg}@`, '');\n }\n });\n return pkgs;\n };\n const manipulateCurrentDeps = (currentCompDeps: Dependency[]) => {\n const afterRemoval = currentCompDeps.filter(\n (dep) => !snapData.removeDependencies?.includes(dep.id.toStringWithoutVersion())\n );\n afterRemoval.forEach((dep) => {\n const found = updateDeps.find((d) => d.startsWith(`${dep.id.toStringWithoutVersion()}@`));\n if (found) {\n dep.id = dep.id.changeVersion(found.replace(`${dep.id.toStringWithoutVersion()}@`, ''));\n }\n });\n return afterRemoval;\n };\n\n const consumerComponent = component.state._consumer as ConsumerComponent;\n\n const dependenciesData = {\n allDependencies: {\n dependencies: [...compDeps, ...manipulateCurrentDeps(consumerComponent.dependencies.get())],\n devDependencies: [...compDevDeps, ...manipulateCurrentDeps(consumerComponent.devDependencies.get())],\n peerDependencies: [...compPeerDeps, ...manipulateCurrentDeps(consumerComponent.peerDependencies.get())],\n },\n allPackagesDependencies: {\n packageDependencies: { ...manipulateCurrentPkgs(consumerComponent.packageDependencies), ...getPkgObj('runtime') },\n devPackageDependencies: {\n ...manipulateCurrentPkgs(consumerComponent.devPackageDependencies),\n ...getPkgObj('dev'),\n },\n peerPackageDependencies: {\n ...manipulateCurrentPkgs(consumerComponent.peerPackageDependencies),\n ...getPkgObj('peer'),\n },\n },\n };\n\n // add the dependencies to the legacy ConsumerComponent object\n // it takes care of both: given dependencies (from the cli) and the overrides, which are coming from the env.\n await deps.loadDependenciesFromScope(consumerComponent, dependenciesData);\n\n // add the dependencies data to the dependency-resolver aspect\n const dependenciesListSerialized = (await depsResolver.extractDepsFromLegacy(component)).serialize();\n const extId = DependencyResolverAspect.id;\n const data = { dependencies: dependenciesListSerialized };\n const existingExtension = component.config.extensions.findExtension(extId);\n if (!existingExtension) throw new Error('unable to find DependencyResolver extension');\n Object.assign(existingExtension.data, data);\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA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AM,IAAIrH,KAAK,CAAC,6CAA6C,CAAC;EACtFnC,MAAM,CAAC2J,MAAM,CAACH,iBAAiB,CAACzK,IAAI,EAAEA,IAAI,CAAC;AAC7C"}
@@ -39,7 +39,7 @@ class SnapFromScopeCmd {
39
39
  the input data is a stringified JSON of an array of the following object.
40
40
  {
41
41
  componentId: string; // ids always have scope, so it's safe to parse them from string
42
- dependencies?: string[]; // dependencies component-ids to update their versions, e.g. [teambit.compilation/compiler@1.0.0, teambit.defender/tester@1.0.0]
42
+ dependencies?: string[]; // dependencies include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]
43
43
  aspects?: Record<string,any> // e.g. { "teambit.react/react": {}, "teambit.envs/envs": { "env": "teambit.react/react" } }
44
44
  message?: string; // tag-message.
45
45
  files?: Array<{path: string, content: string}>; // replace content of specified source-files. the content is base64 encoded.
@@ -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","updateDependents","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","map","id","toString","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","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 removeDependencies?: string[];\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n updateDependents?: 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 component-ids to update their versions, e.g. [teambit.compilation/compiler@1.0.0, teambit.defender/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 removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\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 [\n '',\n 'update-dependents',\n 'EXPERIMENTAL. when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\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 updateDependents,\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 if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\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 updateDependents,\n });\n\n return {\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,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,IAAIiE,UAAmB;IACvB,IAAI;MACFA,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACnE,IAAI,CAAC;IAC/B,CAAC,CAAC,OAAOoE,GAAQ,EAAE;MACjB,MAAM,IAAIC,KAAK,CAAE,gDAA+CD,GAAG,CAACrB,OAAQ,EAAC,CAAC;IAChF;IACA,IAAI,CAACuB,KAAK,CAACC,OAAO,CAACN,UAAU,CAAC,EAAE;MAC9B,MAAM,IAAII,KAAK,CAAC,4BAA4B,CAAC;IAC/C;IACAJ,UAAU,CAACO,OAAO,CAAEC,QAAQ,IAAK;MAC/B,IAAI,CAACA,QAAQ,CAACC,WAAW,EAAE,MAAM,IAAIL,KAAK,CAAC,6CAA6C,CAAC;MACzFI,QAAQ,CAACE,KAAK,EAAEH,OAAO,CAAEI,IAAI,IAAK;QAChC,IAAI,CAACA,IAAI,CAACC,IAAI,EAAE,MAAM,IAAIR,KAAK,CAAC,iCAAiC,CAAC;QAClE,IAAIO,IAAI,CAACE,OAAO,EAAE;UAChBF,IAAI,CAACE,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACJ,IAAI,CAACE,OAAO,EAAE,QAAQ,CAAC,CAACd,QAAQ,CAAC,CAAC;QAC/D;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAOC,UAAU;EACnB;AACF;AAACgB,OAAA,CAAArD,gBAAA,GAAAA,gBAAA"}
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","updateDependents","disableTagAndSnapPipelines","BitError","snapDataPerCompRaw","parseData","snapFromScope","map","id","toString","dataParsed","JSON","parse","err","Error","Array","isArray","forEach","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 removeDependencies?: string[];\n};\n\ntype SnapFromScopeOptions = {\n push?: boolean;\n lane?: string;\n ignoreIssues?: string;\n disableSnapPipeline?: boolean;\n forceDeploy?: boolean;\n updateDependents?: 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 include versions. for components use component-id. e.g. [teambit.compilation/compiler@1.0.0, lodash@4.17.21]\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 removeDependencies?: string[]; // component-id (for components) or package-name (for packages) to remove from the dependencies.\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 [\n '',\n 'update-dependents',\n 'EXPERIMENTAL. when snapped on a lane, mark it as update-dependents so it will be skipped from the workspace',\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 updateDependents,\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 if (updateDependents && !lane) {\n throw new BitError('update-dependents flag is only available when snapping from a lane');\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 updateDependents,\n });\n\n return {\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,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
35
  componentId: ComponentID;
36
- dependencies: ComponentID[];
36
+ dependencies: string[];
37
37
  aspects?: Record<string, any>;
38
38
  message?: string;
39
39
  files?: FileData[];
@@ -574,15 +574,10 @@ if you're willing to lose the history from the head to the specified version, us
574
574
  this.scope.legacyScope.scopeImporter.shouldOnlyFetchFromCurrentLane = true;
575
575
  }
576
576
  const laneCompIds = lane?.toComponentIds();
577
- const resolveDepVer = dep => {
578
- if (dep.hasVersion()) return dep;
579
- const fromLane = laneCompIds?.searchWithoutVersion(dep);
580
- return fromLane || dep;
581
- };
582
577
  const snapDataPerComp = snapDataPerCompRaw.map(snapData => {
583
578
  return {
584
579
  componentId: _componentId().ComponentID.fromString(snapData.componentId),
585
- dependencies: snapData.dependencies?.map(id => _componentId().ComponentID.fromString(id)).map(resolveDepVer) || [],
580
+ dependencies: snapData.dependencies || [],
586
581
  aspects: snapData.aspects,
587
582
  message: snapData.message,
588
583
  files: snapData.files,
@@ -629,20 +624,16 @@ if you're willing to lose the history from the head to the specified version, us
629
624
  deps.forEach(dep => {
630
625
  const fromLane = laneCompIds.searchWithoutVersion(dep.componentId);
631
626
  if (fromLane) {
632
- snapData.dependencies.push(fromLane);
627
+ snapData.dependencies.push(fromLane.toString());
633
628
  }
634
629
  });
635
630
  });
636
631
  }
637
632
  const components = [...existingComponents, ...newComponents];
638
633
  // for new components these are not needed. coz when generating them we already add the aspects and the files.
639
- // the dependencies are calculated later and they're provided by "newDependencies" prop (not "dependencies").
640
634
  await Promise.all(existingComponents.map(async comp => {
641
635
  const snapData = getSnapData(comp.id);
642
636
  if (snapData.aspects) await this.scope.addAspectsFromConfigObject(comp, snapData.aspects);
643
- if (snapData.dependencies.length) {
644
- await this.updateDependenciesVersionsOfComponent(comp, snapData.dependencies, componentIds);
645
- }
646
637
  if (snapData.files?.length) {
647
638
  await this.updateSourceFiles(comp, snapData.files);
648
639
  }
@@ -666,7 +657,11 @@ if you're willing to lose the history from the head to the specified version, us
666
657
  const results = await (0, _tagModelComponent().tagModelComponent)(_objectSpread(_objectSpread({}, params), {}, {
667
658
  scope: this.scope,
668
659
  consumerComponents,
669
- tagDataPerComp: snapDataPerComp,
660
+ tagDataPerComp: snapDataPerComp.map(s => ({
661
+ componentId: s.componentId,
662
+ message: s.message,
663
+ dependencies: []
664
+ })),
670
665
  snapping: this,
671
666
  builder: this.builder,
672
667
  dependencyResolver: this.dependencyResolver,