@teambit/export 1.0.1196 → 1.0.1197
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.
|
@@ -111,7 +111,10 @@ async function exportManyBareScope(scope, objectList) {
|
|
|
111
111
|
* save objects into the scope.
|
|
112
112
|
*/
|
|
113
113
|
async function saveObjects(scope, objectList) {
|
|
114
|
-
const
|
|
114
|
+
const {
|
|
115
|
+
bitObjectList,
|
|
116
|
+
rawSources
|
|
117
|
+
} = await objectList.toBitObjectsWithRawSources();
|
|
115
118
|
const objectsNotRequireMerge = bitObjectList.getObjectsNotRequireMerge();
|
|
116
119
|
// components and lanes can't be just added, they need to be carefully merged.
|
|
117
120
|
const {
|
|
@@ -125,7 +128,7 @@ async function saveObjects(scope, objectList) {
|
|
|
125
128
|
const versionsHistory = await updateVersionHistory(scope, mergedComponents, versionObjects);
|
|
126
129
|
const allObjects = [...mergedComponents, ...mergedLanes, ...objectsNotRequireMerge, ...versionsHistory, ...mergedLaneHistories];
|
|
127
130
|
scope.objects.validateObjects(true, allObjects);
|
|
128
|
-
await scope.objects.writeObjectsToTheFS(allObjects);
|
|
131
|
+
await scope.objects.writeObjectsToTheFS(allObjects, rawSources);
|
|
129
132
|
_legacy().logger.debug(`export-scope-components.saveObjects, ${allObjects.length} objects were written successfully to the filesystem`);
|
|
130
133
|
return mergedIds;
|
|
131
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_lodash","_componentId","_legacy","_scope","_legacy2","_objects","_scope2","_legacy3","_toolboxPromise","_harmonyModules","e","__esModule","default","exportManyBareScope","scope","objectList","logger","debugAndAddBreadCrumb","objects","length","mergedIds","saveObjects","scopeComponentsImporter","scopeImporter","importManyFromOriginalScopes","bitObjectList","toBitObjects","objectsNotRequireMerge","getObjectsNotRequireMerge","mergedComponentsResults","mergedLanes","mergedLaneHistories","mergeObjects","mergedComponents","map","_","mergedComponent","versionObjects","filter","o","Version","versionsHistory","updateVersionHistory","allObjects","validateObjects","writeObjectsToTheFS","debug","versionsWithComponentId","obj","origin","id","versionsWithOrigin","versionWithoutOrigin","partition","v","versionHistoryOfVersionsWithOrigin","_updateVersionHistoryForVersionsWithOrigin","versionHistoryOfVersionsWithoutOrigin","_updateVersionHistoryForVersionsWithoutOrigin","mutatedVersionObjects","squashed","unrelated","Promise","all","modelComp","updateRebasedVersionHistory","versionsHistoryNoNull","compact","compId","toString","join","componentVersionMap","Map","forEach","version","component","find","c","name","error","hash","versions","get","set","pMapPool","undefined","concurrency","concurrentComponentsLimit","throwForMissingDeps","components","getComponents","lanesObjects","getLanes","getVersions","lanesHistory","getLaneHistories","mergeResults","errors","sources","mergeComponents","mergeAllLanesResults","mapSeries","laneObject","mergeLane","lanesErrors","r","mergeErrors","flat","componentsNeedUpdate","result","ComponentNeedsUpdate","componentsWithConflicts","MergeConflict","idsAndVersions","isDeleted","idsAndVersionsWithConflicts","sortBy","property","idsOfNeedUpdateComps","lane","clearObjectsFromCache","MergeConflictOnRemote","throwForMissingLocalDependencies","mergedVersions","mergedLanesComponents","getMergedIds","toBitId","changeVersion","ComponentIdList","uniqFromArray","laneHistory","existingLaneHistory","load","merge","lanes","compsWithHeads","toBitIds","toComponentIdWithHead","originComp","getOriginCompWithVer","compObj","toComponentId","isEqualWithoutVersion","tag","getTagOfRefIfExists","Ref","from","depsIds","getAllFlattenedDependencies","depId","existingModelComponent","getModelComponentIfExist","ComponentNotFound","versionRef","getRef","Error","objectExist","getCache","has","isEqual","validateRemotes","remotes","clientId","isResumingExport","loader","start","remote","action","ExportValidate","err","errorAndAddBreadCrumb","removePendingDirs","persistRemotes","manyObjectsPerRemote","persistedRemotes","objectsPerRemote","maxRetries","succeed","lastErrMsg","i","exportedIds","ExportPersist","message","PersistFailed","push","resumeExport","exportId","scopeRemotes","getScopeRemotes","remotesObj","resolve","remotesForPersist","pushedRemotes","RemovePendingDir","askRemotesAboutPendingDir","question","answers","present","absent","unknown","failed","remoteName","actionName","answer","readAnswer","tolerateActionNotFound","ActionNotFound","concurrentFetchLimit","probePendingExport","PendingDirStatus","exists","deletePendingExport","existed"],"sources":["export-scope-components.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { compact, partition, property, sortBy } from 'lodash';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { logger } from '@teambit/legacy.logger';\nimport type { Remotes, Remote } from '@teambit/scope.remotes';\nimport { getScopeRemotes } from '@teambit/scope.remotes';\nimport type { MergeResult, Scope } from '@teambit/legacy.scope';\nimport {\n PersistFailed,\n ComponentNeedsUpdate,\n ComponentNotFound,\n MergeConflict,\n MergeConflictOnRemote,\n ActionNotFound,\n} from '@teambit/legacy.scope';\nimport type { Lane, ModelComponent, VersionHistory, LaneHistory, BitObjectList, ObjectList } from '@teambit/objects';\nimport { Version, Ref } from '@teambit/objects';\nimport type { PendingDirStatusResult, RemovePendingDirResult } from '@teambit/scope.remote-actions';\nimport { ExportPersist, ExportValidate, RemovePendingDir, PendingDirStatus } from '@teambit/scope.remote-actions';\nimport { loader } from '@teambit/legacy.loader';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit, concurrentFetchLimit } from '@teambit/harmony.modules.concurrency';\n\n/**\n * ** Legacy and \"bit sign\" Only **\n *\n * @TODO there is no real difference between bare scope and a working directory scope - let's adjust terminology to avoid confusions in the future\n * saves a component into the objects directory of the remote scope, then, resolves its\n * dependencies, saves them as well. Finally runs the build process if needed on an isolated\n * environment.\n */\nexport async function exportManyBareScope(scope: Scope, objectList: ObjectList): Promise<ComponentIdList> {\n logger.debugAndAddBreadCrumb('exportManyBareScope', `started with ${objectList.objects.length} objects`);\n const mergedIds = await saveObjects(scope, objectList);\n logger.debugAndAddBreadCrumb('exportManyBareScope', 'will try to importMany in case there are missing dependencies');\n const scopeComponentsImporter = scope.scopeImporter;\n await scopeComponentsImporter.importManyFromOriginalScopes(mergedIds); // resolve dependencies\n logger.debugAndAddBreadCrumb('exportManyBareScope', 'successfully ran importMany');\n\n return mergedIds;\n}\n\ntype RemotesForPersist = {\n remote: Remote;\n exportedIds?: string[];\n};\n\n/**\n * save objects into the scope.\n */\nexport async function saveObjects(scope: Scope, objectList: ObjectList): Promise<ComponentIdList> {\n const bitObjectList = await objectList.toBitObjects();\n const objectsNotRequireMerge = bitObjectList.getObjectsNotRequireMerge();\n // components and lanes can't be just added, they need to be carefully merged.\n const { mergedIds, mergedComponentsResults, mergedLanes, mergedLaneHistories } = await mergeObjects(\n scope,\n bitObjectList\n );\n const mergedComponents = mergedComponentsResults.map((_) => _.mergedComponent);\n const versionObjects = objectsNotRequireMerge.filter((o) => o instanceof Version) as Version[];\n const versionsHistory = await updateVersionHistory(scope, mergedComponents, versionObjects);\n const allObjects = [\n ...mergedComponents,\n ...mergedLanes,\n ...objectsNotRequireMerge,\n ...versionsHistory,\n ...mergedLaneHistories,\n ];\n scope.objects.validateObjects(true, allObjects);\n await scope.objects.writeObjectsToTheFS(allObjects);\n logger.debug(\n `export-scope-components.saveObjects, ${allObjects.length} objects were written successfully to the filesystem`\n );\n\n return mergedIds;\n}\n\n/**\n * Previously, the VersionHistory was populated during fetch. However, we want the fetch operation to be more efficient\n * so we move this logic to the export operation.\n * Before version 0.2.22, the Version object didn't have any info about the component-id, so we do update only for\n * rebase. For versions that tagged by > 0.2.22, we have the \"origin.id\" and we know to what component this version\n * belongs to.\n */\nasync function updateVersionHistory(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionObjects: Version[]\n): Promise<VersionHistory[]> {\n if (!mergedComponents.length) {\n // this is important for bit-sign to not try to update VersionHistory and then error due to missing components\n logger.debug('updateVersionHistory, no components were merged, no need to update VersionHistory');\n return [];\n }\n logger.debug(\n `updateVersionHistory, total components: ${mergedComponents.length}, total versions: ${versionObjects.length}`\n );\n\n const versionsWithComponentId = versionObjects.filter((obj) => obj.origin?.id);\n\n const [versionsWithOrigin, versionWithoutOrigin] = partition(versionsWithComponentId, (v) => v.origin?.id);\n\n const versionHistoryOfVersionsWithOrigin = await _updateVersionHistoryForVersionsWithOrigin(\n scope,\n mergedComponents,\n versionsWithOrigin\n );\n\n const versionHistoryOfVersionsWithoutOrigin = await _updateVersionHistoryForVersionsWithoutOrigin(\n scope,\n mergedComponents,\n versionWithoutOrigin\n );\n\n return [...versionHistoryOfVersionsWithOrigin, ...versionHistoryOfVersionsWithoutOrigin];\n}\n\n/**\n * In case of rebase (squash / unrelated) where the version history is changed, make the necessary changes in the\n * VersionHistory.\n * Because previously (bit-version < 0.2.22) we only knew about this from the Version object, and the Version object\n * didn't have any info about what the component-id is, we have to iterate all model-components, grab their\n * version-history and check whether the version-hash is inside their VersionHistory.\n * it's not ideal performance wise. however, in most cases, this rebase is about squashing, and when squashing, it's\n * done for the entire lane, so all components need to be updated regardless.\n */\nasync function _updateVersionHistoryForVersionsWithoutOrigin(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionWithoutOrigin: Version[]\n): Promise<VersionHistory[]> {\n const mutatedVersionObjects = versionWithoutOrigin.filter((v) => v.squashed || v.unrelated);\n if (!mutatedVersionObjects.length) return [];\n logger.debug(`_updateVersionHistoryForVersionsWithoutOrigin, found ${mutatedVersionObjects.length} mutated version`);\n const versionsHistory = await Promise.all(\n mergedComponents.map(async (modelComp) =>\n modelComp.updateRebasedVersionHistory(scope.objects, mutatedVersionObjects)\n )\n );\n const versionsHistoryNoNull = compact(versionsHistory);\n logger.debug(`_updateVersionHistoryForVersionsWithoutOrigin, found ${\n versionsHistoryNoNull.length\n } versionsHistory to update\n${versionsHistoryNoNull.map((v) => v.compId.toString()).join(', ')}`);\n\n return versionsHistoryNoNull;\n}\n\nasync function _updateVersionHistoryForVersionsWithOrigin(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionObjects: Version[]\n): Promise<VersionHistory[]> {\n if (!versionObjects.length) return [];\n logger.debug(`_updateVersionHistoryForVersionsWithOrigin, found ${versionObjects.length} versions with origin`);\n const componentVersionMap = new Map<ModelComponent, Version[]>();\n versionObjects.forEach((version) => {\n const component = mergedComponents.find(\n (c) => c.scope === version.origin?.id.scope && c.name === version.origin?.id.name\n );\n if (!component) {\n logger.error(`updateVersionHistoryIfNeeded, unable to find component for version ${version.hash().toString()}`);\n return;\n }\n const versions = componentVersionMap.get(component) || [];\n componentVersionMap.set(component, [...versions, version]);\n });\n\n const versionsHistory = await pMapPool(\n mergedComponents,\n async (modelComp) => {\n const versions = componentVersionMap.get(modelComp);\n if (!versions || !versions.length) return undefined;\n return modelComp.updateVersionHistory(scope.objects, versions);\n },\n { concurrency: concurrentComponentsLimit() }\n );\n\n return compact(versionsHistory);\n}\n\ntype MergeObjectsResult = {\n mergedIds: ComponentIdList;\n mergedComponentsResults: MergeResult[];\n mergedLanes: Lane[];\n mergedLaneHistories: LaneHistory[];\n};\n\n/**\n * merge components into the scope.\n *\n * a component might have multiple versions that some where merged and some were not.\n * the BitIds returned here includes the versions that were merged. so it could contain multiple\n * ids of the same component with different versions\n */\nexport async function mergeObjects(\n scope: Scope,\n bitObjectList: BitObjectList,\n throwForMissingDeps = false\n): Promise<MergeObjectsResult> {\n const components = bitObjectList.getComponents();\n const lanesObjects = bitObjectList.getLanes();\n const versions = bitObjectList.getVersions();\n const lanesHistory = bitObjectList.getLaneHistories();\n logger.debug(\n `export-scope-components.mergeObjects, Going to merge ${components.length} components, ${lanesObjects.length} lanes, ${versions.length} versions, ${lanesHistory.length} lane histories`\n );\n const { mergeResults, errors } = lanesObjects.length\n ? { mergeResults: [], errors: [] } // for lanes, no need to merge component objects, the lane is merged later.\n : await scope.sources.mergeComponents(components, versions);\n\n const mergeAllLanesResults = await mapSeries(lanesObjects, (laneObject) =>\n scope.sources.mergeLane(laneObject, false, versions, components)\n );\n const lanesErrors = mergeAllLanesResults.map((r) => r.mergeErrors).flat();\n const componentsNeedUpdate = [\n ...errors.filter((result) => result instanceof ComponentNeedsUpdate),\n ...lanesErrors,\n ] as ComponentNeedsUpdate[];\n const componentsWithConflicts = errors.filter((result) => result instanceof MergeConflict) as MergeConflict[];\n if (componentsWithConflicts.length || componentsNeedUpdate.length) {\n const idsAndVersions = componentsWithConflicts.map((c) => ({\n id: c.id,\n versions: c.versions,\n isDeleted: c.isDeleted,\n }));\n const idsAndVersionsWithConflicts = sortBy(idsAndVersions, property('id'));\n const idsOfNeedUpdateComps = sortBy(\n componentsNeedUpdate.map((c) => ({ id: c.id, lane: c.lane, isDeleted: c.isDeleted })),\n property('id')\n );\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new MergeConflictOnRemote(idsAndVersionsWithConflicts, idsOfNeedUpdateComps);\n }\n if (throwForMissingDeps) await throwForMissingLocalDependencies(scope, versions, components, lanesObjects);\n const mergedComponents = mergeResults.filter(({ mergedVersions }) => mergedVersions.length);\n const mergedLanesComponents = mergeAllLanesResults\n .map((r) => r.mergeResults)\n .flat()\n .filter(({ mergedVersions }) => mergedVersions.length);\n const mergedComponentsResults = [...mergedComponents, ...mergedLanesComponents];\n const getMergedIds = ({ mergedComponent, mergedVersions }): ComponentID[] =>\n mergedVersions.map((version) => mergedComponent.toBitId().changeVersion(version));\n const mergedIds = ComponentIdList.uniqFromArray(mergedComponentsResults.map(getMergedIds).flat());\n const mergedLanes = mergeAllLanesResults.map((r) => r.mergeLane);\n\n const mergedLaneHistories = await mapSeries(lanesHistory, async (laneHistory) => {\n const existingLaneHistory = (await scope.objects.load(laneHistory.hash())) as LaneHistory | undefined;\n if (existingLaneHistory) {\n existingLaneHistory.merge(laneHistory);\n return existingLaneHistory;\n }\n return laneHistory;\n });\n\n return { mergedIds, mergedComponentsResults, mergedLanes, mergedLaneHistories };\n}\n\n/**\n * make sure that all local objects were actually transferred into the remote.\n * this gets called as part of the export-validate step. it doesn't check for dependencies from\n * other scopes, as they'll be retrieved later by the fetch-missing-deps step.\n * we can't wait for that step to validate local dependencies because it happens after persisting,\n * and we don't want to persist when local dependencies were not exported.\n */\nasync function throwForMissingLocalDependencies(\n scope: Scope,\n versions: Version[],\n components: ModelComponent[],\n lanes: Lane[]\n) {\n const compsWithHeads = lanes.length\n ? lanes.map((lane) => lane.toBitIds()).flat()\n : components.map((c) => c.toComponentIdWithHead());\n\n await Promise.all(\n versions.map(async (version) => {\n const originComp = compsWithHeads.find((id) => version.hash().toString() === id.version);\n if (!originComp) {\n // coz if an older version has a missing dep, then, it's fine. (it can easily happen when exporting lane, which\n // all old versions are exported)\n return;\n }\n const getOriginCompWithVer = () => {\n const compObj = components.find((c) => c.toComponentId().isEqualWithoutVersion(originComp));\n if (!compObj) return originComp;\n const tag = compObj.getTagOfRefIfExists(Ref.from(originComp.version as string));\n if (tag) return originComp.changeVersion(tag);\n return originComp;\n };\n const depsIds = version.getAllFlattenedDependencies();\n await Promise.all(\n depsIds.map(async (depId) => {\n if (depId.scope !== scope.name) return;\n const existingModelComponent =\n (await scope.getModelComponentIfExist(depId)) ||\n components.find((c) => c.toComponentId().isEqualWithoutVersion(depId));\n if (!existingModelComponent) {\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new ComponentNotFound(depId.toString(), getOriginCompWithVer().toString());\n }\n const versionRef = existingModelComponent.getRef(depId.version as string);\n if (!versionRef) throw new Error(`unable to find Ref/Hash of ${depId.toString()}`);\n const objectExist =\n scope.objects.getCache(versionRef) ||\n (await scope.objects.has(versionRef)) ||\n versions.find((v) => v.hash().isEqual(versionRef));\n if (!objectExist) {\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new ComponentNotFound(depId.toString(), getOriginCompWithVer().toString());\n }\n })\n );\n })\n );\n}\n\nexport async function validateRemotes(remotes: Remote[], clientId: string, isResumingExport = true) {\n loader.start('verifying that objects can be merged on the remotes...');\n try {\n await Promise.all(\n remotes.map((remote) =>\n remote.action(ExportValidate.name, {\n clientId,\n isResumingExport: true,\n })\n )\n );\n } catch (err: any) {\n logger.errorAndAddBreadCrumb('validateRemotes', 'failed validating remotes', {}, err);\n if (!isResumingExport) {\n // when resuming export, we don't want to delete the pending-objects because some scopes\n // have them persisted and some not. we want to persist to all failing scopes.\n await removePendingDirs(remotes, clientId);\n }\n throw err;\n }\n}\n\nexport async function persistRemotes(manyObjectsPerRemote: RemotesForPersist[], clientId: string) {\n const persistedRemotes: string[] = [];\n await mapSeries(manyObjectsPerRemote, async (objectsPerRemote: RemotesForPersist) => {\n const { remote } = objectsPerRemote;\n loader.start(`persisting data on the remote \"${remote.name}\"...`);\n const maxRetries = 3;\n let succeed = false;\n let lastErrMsg = '';\n for (let i = 0; i < maxRetries; i += 1) {\n try {\n // eslint-disable-next-line no-await-in-loop\n const exportedIds: string[] = await remote.action(ExportPersist.name, { clientId });\n objectsPerRemote.exportedIds = exportedIds;\n succeed = true;\n break;\n } catch (err: any) {\n lastErrMsg = err.message;\n logger.errorAndAddBreadCrumb(\n 'persistRemotes',\n `failed on remote ${remote.name}, attempt ${i + 1} out of ${maxRetries}`,\n {},\n err\n );\n }\n }\n if (!succeed) {\n throw new PersistFailed([remote.name], { [remote.name]: lastErrMsg });\n }\n logger.debugAndAddBreadCrumb('persistRemotes', `successfully pushed all ids to the bare-scope ${remote.name}`);\n persistedRemotes.push(remote.name);\n });\n}\n\nexport async function resumeExport(scope: Scope, exportId: string, remotes: string[]): Promise<string[]> {\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n const remotesObj = await Promise.all(remotes.map((r) => scopeRemotes.resolve(r)));\n const remotesForPersist: RemotesForPersist[] = remotesObj.map((remote) => ({ remote }));\n await validateRemotes(remotesObj, exportId);\n await persistRemotes(remotesForPersist, exportId);\n return compact(remotesForPersist.map((r) => r.exportedIds).flat());\n}\n\nexport async function removePendingDirs(pushedRemotes: Remote[], clientId: string) {\n await Promise.all(pushedRemotes.map((remote) => remote.action(RemovePendingDir.name, { clientId })));\n}\n\nexport type PendingDirScopes = {\n /**\n * holds the pending objects of this export-id. for a deletion: it held them, and they are now gone\n */\n present: string[];\n /**\n * doesn't hold them - it persisted them already, or it never took part in this export. for a\n * deletion: there was nothing to remove\n */\n absent: string[];\n /**\n * runs a server too old to report either way. for a deletion: the removal itself succeeded, but the\n * remote didn't say whether anything was there\n */\n unknown: string[];\n failed: { [scopeName: string]: string };\n};\n\ntype PendingDirQuestion = {\n actionName: string;\n /** pulls the yes/no answer out of the remote's response. anything but a boolean means \"unknown\" */\n readAnswer: (result: any) => unknown;\n /** an older server rejects an action name it doesn't have. treat that as \"unknown\", not a failure */\n tolerateActionNotFound?: boolean;\n};\n\n/**\n * ask every given scope one yes/no question about the pending-dir of an export-id, and sort the\n * scopes by their answer. both the probe and the deletion are this same fan-out, so they share it -\n * in particular the compatibility rule, which must not drift between them: a server that doesn't\n * report the flag is not saying \"false\", it is saying nothing.\n *\n * one unreachable or unauthorized scope shouldn't stop the rest, so errors are collected per scope\n * instead of aborting on the first one.\n */\nasync function askRemotesAboutPendingDir(\n scope: Scope,\n exportId: string,\n remotes: string[],\n question: PendingDirQuestion\n): Promise<PendingDirScopes> {\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n const answers: PendingDirScopes = { present: [], absent: [], unknown: [], failed: {} };\n await pMapPool(\n remotes,\n async (remoteName) => {\n try {\n const remote = await scopeRemotes.resolve(remoteName);\n const result = await remote.action<{ clientId: string }, unknown>(question.actionName, { clientId: exportId });\n const answer = question.readAnswer(result);\n if (typeof answer !== 'boolean') answers.unknown.push(remoteName);\n else if (answer) answers.present.push(remoteName);\n else answers.absent.push(remoteName);\n } catch (err: any) {\n if (question.tolerateActionNotFound && err instanceof ActionNotFound) {\n logger.debug(`askRemotesAboutPendingDir, the remote ${remoteName} doesn't support ${question.actionName}`);\n answers.unknown.push(remoteName);\n return;\n }\n logger.errorAndAddBreadCrumb(\n 'askRemotesAboutPendingDir',\n `${question.actionName} failed on the remote ${remoteName} for the export-id \"${exportId}\"`,\n {},\n err\n );\n answers.failed[remoteName] = err.message;\n }\n },\n { concurrency: concurrentFetchLimit() }\n );\n return answers;\n}\n\n/**\n * ask each scope whether it still holds the pending objects of the given export-id, without touching\n * them. this is the safety check in front of `deletePendingExport`: `ExportPersist` drops the\n * pending-dir the moment it persisted, so a scope answering \"absent\" while others answer \"present\" is\n * the signature of an export that already persisted in part. deleting the rest of it would leave the\n * persisted scopes depending on objects that were never exported.\n *\n * \"absent\" alone is not proof of that - the scope may simply have had no part in the export - so this\n * only classifies, it doesn't decide. the caller presents the split and lets a human judge.\n */\nexport async function probePendingExport(scope: Scope, exportId: string, remotes: string[]): Promise<PendingDirScopes> {\n return askRemotesAboutPendingDir(scope, exportId, remotes, {\n actionName: PendingDirStatus.name,\n readAnswer: (result: PendingDirStatusResult) => result?.exists,\n // an older server has no such action. it can't answer the probe, but it can still delete\n tolerateActionNotFound: true,\n });\n}\n\n/**\n * the opposite of `resumeExport`. instead of completing a stuck export, throw its objects away, which\n * frees the export-queue of these scopes (see `ExportValidate.waitIfNeeded`, where a stale pending-dir\n * blocks everyone else with a server-is-busy error).\n *\n * destructive and unrecoverable - run `probePendingExport` first.\n */\nexport async function deletePendingExport(\n scope: Scope,\n exportId: string,\n remotes: string[]\n): Promise<PendingDirScopes> {\n return askRemotesAboutPendingDir(scope, exportId, remotes, {\n actionName: RemovePendingDir.name,\n readAnswer: (result: RemovePendingDirResult) => result?.existed,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EA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AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeY,kBAAkBA,CAAClM,KAAY,EAAE4K,QAAgB,EAAEzB,OAAiB,EAA6B;EACrH,OAAOiC,yBAAyB,CAACpL,KAAK,EAAE4K,QAAQ,EAAEzB,OAAO,EAAE;IACzDyC,UAAU,EAAEO,0BAAgB,CAACnI,IAAI;IACjC8H,UAAU,EAAG/F,MAA8B,IAAKA,MAAM,EAAEqG,MAAM;IAC9D;IACAL,sBAAsB,EAAE;EAC1B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeM,mBAAmBA,CACvCrM,KAAY,EACZ4K,QAAgB,EAChBzB,OAAiB,EACU;EAC3B,OAAOiC,yBAAyB,CAACpL,KAAK,EAAE4K,QAAQ,EAAEzB,OAAO,EAAE;IACzDyC,UAAU,EAAET,0BAAgB,CAACnH,IAAI;IACjC8H,UAAU,EAAG/F,MAA8B,IAAKA,MAAM,EAAEuG;EAC1D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_lodash","_componentId","_legacy","_scope","_legacy2","_objects","_scope2","_legacy3","_toolboxPromise","_harmonyModules","e","__esModule","default","exportManyBareScope","scope","objectList","logger","debugAndAddBreadCrumb","objects","length","mergedIds","saveObjects","scopeComponentsImporter","scopeImporter","importManyFromOriginalScopes","bitObjectList","rawSources","toBitObjectsWithRawSources","objectsNotRequireMerge","getObjectsNotRequireMerge","mergedComponentsResults","mergedLanes","mergedLaneHistories","mergeObjects","mergedComponents","map","_","mergedComponent","versionObjects","filter","o","Version","versionsHistory","updateVersionHistory","allObjects","validateObjects","writeObjectsToTheFS","debug","versionsWithComponentId","obj","origin","id","versionsWithOrigin","versionWithoutOrigin","partition","v","versionHistoryOfVersionsWithOrigin","_updateVersionHistoryForVersionsWithOrigin","versionHistoryOfVersionsWithoutOrigin","_updateVersionHistoryForVersionsWithoutOrigin","mutatedVersionObjects","squashed","unrelated","Promise","all","modelComp","updateRebasedVersionHistory","versionsHistoryNoNull","compact","compId","toString","join","componentVersionMap","Map","forEach","version","component","find","c","name","error","hash","versions","get","set","pMapPool","undefined","concurrency","concurrentComponentsLimit","throwForMissingDeps","components","getComponents","lanesObjects","getLanes","getVersions","lanesHistory","getLaneHistories","mergeResults","errors","sources","mergeComponents","mergeAllLanesResults","mapSeries","laneObject","mergeLane","lanesErrors","r","mergeErrors","flat","componentsNeedUpdate","result","ComponentNeedsUpdate","componentsWithConflicts","MergeConflict","idsAndVersions","isDeleted","idsAndVersionsWithConflicts","sortBy","property","idsOfNeedUpdateComps","lane","clearObjectsFromCache","MergeConflictOnRemote","throwForMissingLocalDependencies","mergedVersions","mergedLanesComponents","getMergedIds","toBitId","changeVersion","ComponentIdList","uniqFromArray","laneHistory","existingLaneHistory","load","merge","lanes","compsWithHeads","toBitIds","toComponentIdWithHead","originComp","getOriginCompWithVer","compObj","toComponentId","isEqualWithoutVersion","tag","getTagOfRefIfExists","Ref","from","depsIds","getAllFlattenedDependencies","depId","existingModelComponent","getModelComponentIfExist","ComponentNotFound","versionRef","getRef","Error","objectExist","getCache","has","isEqual","validateRemotes","remotes","clientId","isResumingExport","loader","start","remote","action","ExportValidate","err","errorAndAddBreadCrumb","removePendingDirs","persistRemotes","manyObjectsPerRemote","persistedRemotes","objectsPerRemote","maxRetries","succeed","lastErrMsg","i","exportedIds","ExportPersist","message","PersistFailed","push","resumeExport","exportId","scopeRemotes","getScopeRemotes","remotesObj","resolve","remotesForPersist","pushedRemotes","RemovePendingDir","askRemotesAboutPendingDir","question","answers","present","absent","unknown","failed","remoteName","actionName","answer","readAnswer","tolerateActionNotFound","ActionNotFound","concurrentFetchLimit","probePendingExport","PendingDirStatus","exists","deletePendingExport","existed"],"sources":["export-scope-components.ts"],"sourcesContent":["import mapSeries from 'p-map-series';\nimport { compact, partition, property, sortBy } from 'lodash';\nimport type { ComponentID } from '@teambit/component-id';\nimport { ComponentIdList } from '@teambit/component-id';\nimport { logger } from '@teambit/legacy.logger';\nimport type { Remotes, Remote } from '@teambit/scope.remotes';\nimport { getScopeRemotes } from '@teambit/scope.remotes';\nimport type { MergeResult, Scope } from '@teambit/legacy.scope';\nimport {\n PersistFailed,\n ComponentNeedsUpdate,\n ComponentNotFound,\n MergeConflict,\n MergeConflictOnRemote,\n ActionNotFound,\n} from '@teambit/legacy.scope';\nimport type { Lane, ModelComponent, VersionHistory, LaneHistory, BitObjectList, ObjectList } from '@teambit/objects';\nimport { Version, Ref } from '@teambit/objects';\nimport type { PendingDirStatusResult, RemovePendingDirResult } from '@teambit/scope.remote-actions';\nimport { ExportPersist, ExportValidate, RemovePendingDir, PendingDirStatus } from '@teambit/scope.remote-actions';\nimport { loader } from '@teambit/legacy.loader';\nimport { pMapPool } from '@teambit/toolbox.promise.map-pool';\nimport { concurrentComponentsLimit, concurrentFetchLimit } from '@teambit/harmony.modules.concurrency';\n\n/**\n * ** Legacy and \"bit sign\" Only **\n *\n * @TODO there is no real difference between bare scope and a working directory scope - let's adjust terminology to avoid confusions in the future\n * saves a component into the objects directory of the remote scope, then, resolves its\n * dependencies, saves them as well. Finally runs the build process if needed on an isolated\n * environment.\n */\nexport async function exportManyBareScope(scope: Scope, objectList: ObjectList): Promise<ComponentIdList> {\n logger.debugAndAddBreadCrumb('exportManyBareScope', `started with ${objectList.objects.length} objects`);\n const mergedIds = await saveObjects(scope, objectList);\n logger.debugAndAddBreadCrumb('exportManyBareScope', 'will try to importMany in case there are missing dependencies');\n const scopeComponentsImporter = scope.scopeImporter;\n await scopeComponentsImporter.importManyFromOriginalScopes(mergedIds); // resolve dependencies\n logger.debugAndAddBreadCrumb('exportManyBareScope', 'successfully ran importMany');\n\n return mergedIds;\n}\n\ntype RemotesForPersist = {\n remote: Remote;\n exportedIds?: string[];\n};\n\n/**\n * save objects into the scope.\n */\nexport async function saveObjects(scope: Scope, objectList: ObjectList): Promise<ComponentIdList> {\n const { bitObjectList, rawSources } = await objectList.toBitObjectsWithRawSources();\n const objectsNotRequireMerge = bitObjectList.getObjectsNotRequireMerge();\n // components and lanes can't be just added, they need to be carefully merged.\n const { mergedIds, mergedComponentsResults, mergedLanes, mergedLaneHistories } = await mergeObjects(\n scope,\n bitObjectList\n );\n const mergedComponents = mergedComponentsResults.map((_) => _.mergedComponent);\n const versionObjects = objectsNotRequireMerge.filter((o) => o instanceof Version) as Version[];\n const versionsHistory = await updateVersionHistory(scope, mergedComponents, versionObjects);\n const allObjects = [\n ...mergedComponents,\n ...mergedLanes,\n ...objectsNotRequireMerge,\n ...versionsHistory,\n ...mergedLaneHistories,\n ];\n scope.objects.validateObjects(true, allObjects);\n await scope.objects.writeObjectsToTheFS(allObjects, rawSources);\n logger.debug(\n `export-scope-components.saveObjects, ${allObjects.length} objects were written successfully to the filesystem`\n );\n\n return mergedIds;\n}\n\n/**\n * Previously, the VersionHistory was populated during fetch. However, we want the fetch operation to be more efficient\n * so we move this logic to the export operation.\n * Before version 0.2.22, the Version object didn't have any info about the component-id, so we do update only for\n * rebase. For versions that tagged by > 0.2.22, we have the \"origin.id\" and we know to what component this version\n * belongs to.\n */\nasync function updateVersionHistory(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionObjects: Version[]\n): Promise<VersionHistory[]> {\n if (!mergedComponents.length) {\n // this is important for bit-sign to not try to update VersionHistory and then error due to missing components\n logger.debug('updateVersionHistory, no components were merged, no need to update VersionHistory');\n return [];\n }\n logger.debug(\n `updateVersionHistory, total components: ${mergedComponents.length}, total versions: ${versionObjects.length}`\n );\n\n const versionsWithComponentId = versionObjects.filter((obj) => obj.origin?.id);\n\n const [versionsWithOrigin, versionWithoutOrigin] = partition(versionsWithComponentId, (v) => v.origin?.id);\n\n const versionHistoryOfVersionsWithOrigin = await _updateVersionHistoryForVersionsWithOrigin(\n scope,\n mergedComponents,\n versionsWithOrigin\n );\n\n const versionHistoryOfVersionsWithoutOrigin = await _updateVersionHistoryForVersionsWithoutOrigin(\n scope,\n mergedComponents,\n versionWithoutOrigin\n );\n\n return [...versionHistoryOfVersionsWithOrigin, ...versionHistoryOfVersionsWithoutOrigin];\n}\n\n/**\n * In case of rebase (squash / unrelated) where the version history is changed, make the necessary changes in the\n * VersionHistory.\n * Because previously (bit-version < 0.2.22) we only knew about this from the Version object, and the Version object\n * didn't have any info about what the component-id is, we have to iterate all model-components, grab their\n * version-history and check whether the version-hash is inside their VersionHistory.\n * it's not ideal performance wise. however, in most cases, this rebase is about squashing, and when squashing, it's\n * done for the entire lane, so all components need to be updated regardless.\n */\nasync function _updateVersionHistoryForVersionsWithoutOrigin(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionWithoutOrigin: Version[]\n): Promise<VersionHistory[]> {\n const mutatedVersionObjects = versionWithoutOrigin.filter((v) => v.squashed || v.unrelated);\n if (!mutatedVersionObjects.length) return [];\n logger.debug(`_updateVersionHistoryForVersionsWithoutOrigin, found ${mutatedVersionObjects.length} mutated version`);\n const versionsHistory = await Promise.all(\n mergedComponents.map(async (modelComp) =>\n modelComp.updateRebasedVersionHistory(scope.objects, mutatedVersionObjects)\n )\n );\n const versionsHistoryNoNull = compact(versionsHistory);\n logger.debug(`_updateVersionHistoryForVersionsWithoutOrigin, found ${\n versionsHistoryNoNull.length\n } versionsHistory to update\n${versionsHistoryNoNull.map((v) => v.compId.toString()).join(', ')}`);\n\n return versionsHistoryNoNull;\n}\n\nasync function _updateVersionHistoryForVersionsWithOrigin(\n scope: Scope,\n mergedComponents: ModelComponent[],\n versionObjects: Version[]\n): Promise<VersionHistory[]> {\n if (!versionObjects.length) return [];\n logger.debug(`_updateVersionHistoryForVersionsWithOrigin, found ${versionObjects.length} versions with origin`);\n const componentVersionMap = new Map<ModelComponent, Version[]>();\n versionObjects.forEach((version) => {\n const component = mergedComponents.find(\n (c) => c.scope === version.origin?.id.scope && c.name === version.origin?.id.name\n );\n if (!component) {\n logger.error(`updateVersionHistoryIfNeeded, unable to find component for version ${version.hash().toString()}`);\n return;\n }\n const versions = componentVersionMap.get(component) || [];\n componentVersionMap.set(component, [...versions, version]);\n });\n\n const versionsHistory = await pMapPool(\n mergedComponents,\n async (modelComp) => {\n const versions = componentVersionMap.get(modelComp);\n if (!versions || !versions.length) return undefined;\n return modelComp.updateVersionHistory(scope.objects, versions);\n },\n { concurrency: concurrentComponentsLimit() }\n );\n\n return compact(versionsHistory);\n}\n\ntype MergeObjectsResult = {\n mergedIds: ComponentIdList;\n mergedComponentsResults: MergeResult[];\n mergedLanes: Lane[];\n mergedLaneHistories: LaneHistory[];\n};\n\n/**\n * merge components into the scope.\n *\n * a component might have multiple versions that some where merged and some were not.\n * the BitIds returned here includes the versions that were merged. so it could contain multiple\n * ids of the same component with different versions\n */\nexport async function mergeObjects(\n scope: Scope,\n bitObjectList: BitObjectList,\n throwForMissingDeps = false\n): Promise<MergeObjectsResult> {\n const components = bitObjectList.getComponents();\n const lanesObjects = bitObjectList.getLanes();\n const versions = bitObjectList.getVersions();\n const lanesHistory = bitObjectList.getLaneHistories();\n logger.debug(\n `export-scope-components.mergeObjects, Going to merge ${components.length} components, ${lanesObjects.length} lanes, ${versions.length} versions, ${lanesHistory.length} lane histories`\n );\n const { mergeResults, errors } = lanesObjects.length\n ? { mergeResults: [], errors: [] } // for lanes, no need to merge component objects, the lane is merged later.\n : await scope.sources.mergeComponents(components, versions);\n\n const mergeAllLanesResults = await mapSeries(lanesObjects, (laneObject) =>\n scope.sources.mergeLane(laneObject, false, versions, components)\n );\n const lanesErrors = mergeAllLanesResults.map((r) => r.mergeErrors).flat();\n const componentsNeedUpdate = [\n ...errors.filter((result) => result instanceof ComponentNeedsUpdate),\n ...lanesErrors,\n ] as ComponentNeedsUpdate[];\n const componentsWithConflicts = errors.filter((result) => result instanceof MergeConflict) as MergeConflict[];\n if (componentsWithConflicts.length || componentsNeedUpdate.length) {\n const idsAndVersions = componentsWithConflicts.map((c) => ({\n id: c.id,\n versions: c.versions,\n isDeleted: c.isDeleted,\n }));\n const idsAndVersionsWithConflicts = sortBy(idsAndVersions, property('id'));\n const idsOfNeedUpdateComps = sortBy(\n componentsNeedUpdate.map((c) => ({ id: c.id, lane: c.lane, isDeleted: c.isDeleted })),\n property('id')\n );\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new MergeConflictOnRemote(idsAndVersionsWithConflicts, idsOfNeedUpdateComps);\n }\n if (throwForMissingDeps) await throwForMissingLocalDependencies(scope, versions, components, lanesObjects);\n const mergedComponents = mergeResults.filter(({ mergedVersions }) => mergedVersions.length);\n const mergedLanesComponents = mergeAllLanesResults\n .map((r) => r.mergeResults)\n .flat()\n .filter(({ mergedVersions }) => mergedVersions.length);\n const mergedComponentsResults = [...mergedComponents, ...mergedLanesComponents];\n const getMergedIds = ({ mergedComponent, mergedVersions }): ComponentID[] =>\n mergedVersions.map((version) => mergedComponent.toBitId().changeVersion(version));\n const mergedIds = ComponentIdList.uniqFromArray(mergedComponentsResults.map(getMergedIds).flat());\n const mergedLanes = mergeAllLanesResults.map((r) => r.mergeLane);\n\n const mergedLaneHistories = await mapSeries(lanesHistory, async (laneHistory) => {\n const existingLaneHistory = (await scope.objects.load(laneHistory.hash())) as LaneHistory | undefined;\n if (existingLaneHistory) {\n existingLaneHistory.merge(laneHistory);\n return existingLaneHistory;\n }\n return laneHistory;\n });\n\n return { mergedIds, mergedComponentsResults, mergedLanes, mergedLaneHistories };\n}\n\n/**\n * make sure that all local objects were actually transferred into the remote.\n * this gets called as part of the export-validate step. it doesn't check for dependencies from\n * other scopes, as they'll be retrieved later by the fetch-missing-deps step.\n * we can't wait for that step to validate local dependencies because it happens after persisting,\n * and we don't want to persist when local dependencies were not exported.\n */\nasync function throwForMissingLocalDependencies(\n scope: Scope,\n versions: Version[],\n components: ModelComponent[],\n lanes: Lane[]\n) {\n const compsWithHeads = lanes.length\n ? lanes.map((lane) => lane.toBitIds()).flat()\n : components.map((c) => c.toComponentIdWithHead());\n\n await Promise.all(\n versions.map(async (version) => {\n const originComp = compsWithHeads.find((id) => version.hash().toString() === id.version);\n if (!originComp) {\n // coz if an older version has a missing dep, then, it's fine. (it can easily happen when exporting lane, which\n // all old versions are exported)\n return;\n }\n const getOriginCompWithVer = () => {\n const compObj = components.find((c) => c.toComponentId().isEqualWithoutVersion(originComp));\n if (!compObj) return originComp;\n const tag = compObj.getTagOfRefIfExists(Ref.from(originComp.version as string));\n if (tag) return originComp.changeVersion(tag);\n return originComp;\n };\n const depsIds = version.getAllFlattenedDependencies();\n await Promise.all(\n depsIds.map(async (depId) => {\n if (depId.scope !== scope.name) return;\n const existingModelComponent =\n (await scope.getModelComponentIfExist(depId)) ||\n components.find((c) => c.toComponentId().isEqualWithoutVersion(depId));\n if (!existingModelComponent) {\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new ComponentNotFound(depId.toString(), getOriginCompWithVer().toString());\n }\n const versionRef = existingModelComponent.getRef(depId.version as string);\n if (!versionRef) throw new Error(`unable to find Ref/Hash of ${depId.toString()}`);\n const objectExist =\n scope.objects.getCache(versionRef) ||\n (await scope.objects.has(versionRef)) ||\n versions.find((v) => v.hash().isEqual(versionRef));\n if (!objectExist) {\n scope.objects.clearObjectsFromCache(); // just in case this error is caught. we don't want to persist anything by mistake.\n throw new ComponentNotFound(depId.toString(), getOriginCompWithVer().toString());\n }\n })\n );\n })\n );\n}\n\nexport async function validateRemotes(remotes: Remote[], clientId: string, isResumingExport = true) {\n loader.start('verifying that objects can be merged on the remotes...');\n try {\n await Promise.all(\n remotes.map((remote) =>\n remote.action(ExportValidate.name, {\n clientId,\n isResumingExport: true,\n })\n )\n );\n } catch (err: any) {\n logger.errorAndAddBreadCrumb('validateRemotes', 'failed validating remotes', {}, err);\n if (!isResumingExport) {\n // when resuming export, we don't want to delete the pending-objects because some scopes\n // have them persisted and some not. we want to persist to all failing scopes.\n await removePendingDirs(remotes, clientId);\n }\n throw err;\n }\n}\n\nexport async function persistRemotes(manyObjectsPerRemote: RemotesForPersist[], clientId: string) {\n const persistedRemotes: string[] = [];\n await mapSeries(manyObjectsPerRemote, async (objectsPerRemote: RemotesForPersist) => {\n const { remote } = objectsPerRemote;\n loader.start(`persisting data on the remote \"${remote.name}\"...`);\n const maxRetries = 3;\n let succeed = false;\n let lastErrMsg = '';\n for (let i = 0; i < maxRetries; i += 1) {\n try {\n // eslint-disable-next-line no-await-in-loop\n const exportedIds: string[] = await remote.action(ExportPersist.name, { clientId });\n objectsPerRemote.exportedIds = exportedIds;\n succeed = true;\n break;\n } catch (err: any) {\n lastErrMsg = err.message;\n logger.errorAndAddBreadCrumb(\n 'persistRemotes',\n `failed on remote ${remote.name}, attempt ${i + 1} out of ${maxRetries}`,\n {},\n err\n );\n }\n }\n if (!succeed) {\n throw new PersistFailed([remote.name], { [remote.name]: lastErrMsg });\n }\n logger.debugAndAddBreadCrumb('persistRemotes', `successfully pushed all ids to the bare-scope ${remote.name}`);\n persistedRemotes.push(remote.name);\n });\n}\n\nexport async function resumeExport(scope: Scope, exportId: string, remotes: string[]): Promise<string[]> {\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n const remotesObj = await Promise.all(remotes.map((r) => scopeRemotes.resolve(r)));\n const remotesForPersist: RemotesForPersist[] = remotesObj.map((remote) => ({ remote }));\n await validateRemotes(remotesObj, exportId);\n await persistRemotes(remotesForPersist, exportId);\n return compact(remotesForPersist.map((r) => r.exportedIds).flat());\n}\n\nexport async function removePendingDirs(pushedRemotes: Remote[], clientId: string) {\n await Promise.all(pushedRemotes.map((remote) => remote.action(RemovePendingDir.name, { clientId })));\n}\n\nexport type PendingDirScopes = {\n /**\n * holds the pending objects of this export-id. for a deletion: it held them, and they are now gone\n */\n present: string[];\n /**\n * doesn't hold them - it persisted them already, or it never took part in this export. for a\n * deletion: there was nothing to remove\n */\n absent: string[];\n /**\n * runs a server too old to report either way. for a deletion: the removal itself succeeded, but the\n * remote didn't say whether anything was there\n */\n unknown: string[];\n failed: { [scopeName: string]: string };\n};\n\ntype PendingDirQuestion = {\n actionName: string;\n /** pulls the yes/no answer out of the remote's response. anything but a boolean means \"unknown\" */\n readAnswer: (result: any) => unknown;\n /** an older server rejects an action name it doesn't have. treat that as \"unknown\", not a failure */\n tolerateActionNotFound?: boolean;\n};\n\n/**\n * ask every given scope one yes/no question about the pending-dir of an export-id, and sort the\n * scopes by their answer. both the probe and the deletion are this same fan-out, so they share it -\n * in particular the compatibility rule, which must not drift between them: a server that doesn't\n * report the flag is not saying \"false\", it is saying nothing.\n *\n * one unreachable or unauthorized scope shouldn't stop the rest, so errors are collected per scope\n * instead of aborting on the first one.\n */\nasync function askRemotesAboutPendingDir(\n scope: Scope,\n exportId: string,\n remotes: string[],\n question: PendingDirQuestion\n): Promise<PendingDirScopes> {\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n const answers: PendingDirScopes = { present: [], absent: [], unknown: [], failed: {} };\n await pMapPool(\n remotes,\n async (remoteName) => {\n try {\n const remote = await scopeRemotes.resolve(remoteName);\n const result = await remote.action<{ clientId: string }, unknown>(question.actionName, { clientId: exportId });\n const answer = question.readAnswer(result);\n if (typeof answer !== 'boolean') answers.unknown.push(remoteName);\n else if (answer) answers.present.push(remoteName);\n else answers.absent.push(remoteName);\n } catch (err: any) {\n if (question.tolerateActionNotFound && err instanceof ActionNotFound) {\n logger.debug(`askRemotesAboutPendingDir, the remote ${remoteName} doesn't support ${question.actionName}`);\n answers.unknown.push(remoteName);\n return;\n }\n logger.errorAndAddBreadCrumb(\n 'askRemotesAboutPendingDir',\n `${question.actionName} failed on the remote ${remoteName} for the export-id \"${exportId}\"`,\n {},\n err\n );\n answers.failed[remoteName] = err.message;\n }\n },\n { concurrency: concurrentFetchLimit() }\n );\n return answers;\n}\n\n/**\n * ask each scope whether it still holds the pending objects of the given export-id, without touching\n * them. this is the safety check in front of `deletePendingExport`: `ExportPersist` drops the\n * pending-dir the moment it persisted, so a scope answering \"absent\" while others answer \"present\" is\n * the signature of an export that already persisted in part. deleting the rest of it would leave the\n * persisted scopes depending on objects that were never exported.\n *\n * \"absent\" alone is not proof of that - the scope may simply have had no part in the export - so this\n * only classifies, it doesn't decide. the caller presents the split and lets a human judge.\n */\nexport async function probePendingExport(scope: Scope, exportId: string, remotes: string[]): Promise<PendingDirScopes> {\n return askRemotesAboutPendingDir(scope, exportId, remotes, {\n actionName: PendingDirStatus.name,\n readAnswer: (result: PendingDirStatusResult) => result?.exists,\n // an older server has no such action. it can't answer the probe, but it can still delete\n tolerateActionNotFound: true,\n });\n}\n\n/**\n * the opposite of `resumeExport`. instead of completing a stuck export, throw its objects away, which\n * frees the export-queue of these scopes (see `ExportValidate.waitIfNeeded`, where a stale pending-dir\n * blocks everyone else with a server-is-busy error).\n *\n * destructive and unrecoverable - run `probePendingExport` first.\n */\nexport async function deletePendingExport(\n scope: Scope,\n exportId: string,\n remotes: string[]\n): Promise<PendingDirScopes> {\n return askRemotesAboutPendingDir(scope, exportId, remotes, {\n actionName: RemovePendingDir.name,\n readAnswer: (result: RemovePendingDirResult) => result?.existed,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,OAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAA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AAE;IACzDyC,UAAU,EAAEO,0BAAgB,CAACnI,IAAI;IACjC8H,UAAU,EAAG/F,MAA8B,IAAKA,MAAM,EAAEqG,MAAM;IAC9D;IACAL,sBAAsB,EAAE;EAC1B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeM,mBAAmBA,CACvCtM,KAAY,EACZ6K,QAAgB,EAChBzB,OAAiB,EACU;EAC3B,OAAOiC,yBAAyB,CAACrL,KAAK,EAAE6K,QAAQ,EAAEzB,OAAO,EAAE;IACzDyC,UAAU,EAAET,0BAAgB,CAACnH,IAAI;IACjC8H,UAAU,EAAG/F,MAA8B,IAAKA,MAAM,EAAEuG;EAC1D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -625,8 +625,9 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
625
625
|
bitIds.throwForDuplicationIgnoreVersion();
|
|
626
626
|
const remote = await resolveRemote(remoteNameStr);
|
|
627
627
|
const idsToChangeLocally = _componentId().ComponentIdList.fromArray(bitIds.filter(id => !scope.isExported(id)));
|
|
628
|
-
const
|
|
628
|
+
const exportedModelComponents = [];
|
|
629
629
|
const objectList = new (_objects().ObjectList)();
|
|
630
|
+
const allObjectItems = [];
|
|
630
631
|
const objectListPerName = {};
|
|
631
632
|
const modelComponents = await (0, _pMapSeries().default)(bitIds, id => scope.getModelComponent(id));
|
|
632
633
|
// super important! otherwise, the processModelComponent() changes objects in memory, while the key remains the same
|
|
@@ -678,29 +679,22 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
678
679
|
const idFromWorkspace = this.workspace?.getIdIfExist(modelComponent.toComponentId());
|
|
679
680
|
modelComponent.clearStateData();
|
|
680
681
|
const objectItems = await modelComponent.collectVersionsObjects(scope.objects, refs.map(ref => ref.toString()), throwForMissingArtifacts, idFromWorkspace);
|
|
681
|
-
|
|
682
|
-
const componentAndObject = {
|
|
683
|
-
component: modelComponent,
|
|
684
|
-
objects: objectsList.getAll()
|
|
685
|
-
};
|
|
686
|
-
await this.convertToCorrectScope(scope, componentAndObject, remoteNameStr, bitIds, ids);
|
|
682
|
+
this.convertToCorrectScope(modelComponent, remoteNameStr, ids);
|
|
687
683
|
const remoteObj = {
|
|
688
684
|
url: remote.host,
|
|
689
685
|
name: remote.name,
|
|
690
686
|
date: Date.now().toString()
|
|
691
687
|
};
|
|
692
688
|
modelComponent.addScopeListItem(remoteObj);
|
|
693
|
-
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
};
|
|
700
|
-
const objectsBuffer = await Promise.all(componentAndObject.objects.map(async obj => bitObjectToObjectItem(obj)));
|
|
701
|
-
const allObjectsData = [componentData, ...objectsBuffer];
|
|
689
|
+
exportedModelComponents.push(modelComponent);
|
|
690
|
+
const componentData = await bitObjectToObjectItem(modelComponent);
|
|
691
|
+
// the version objects and their files/artifacts are not modified during export, so their raw (already
|
|
692
|
+
// compressed) buffers are sent as is. parsing and re-compressing them is very costly for components with
|
|
693
|
+
// many files (e.g. tens of thousands of bundled pages).
|
|
694
|
+
const allObjectsData = [componentData, ...objectItems];
|
|
702
695
|
objectListPerName[modelComponent.name] = new (_objects().ObjectList)(allObjectsData);
|
|
703
|
-
|
|
696
|
+
// not `push(...allObjectsData)`, a component can have more objects than the max number of function arguments.
|
|
697
|
+
allObjectsData.forEach(objectItem => allObjectItems.push(objectItem));
|
|
704
698
|
};
|
|
705
699
|
|
|
706
700
|
// The lean-lane filter (drop main-origin refs belonging to foreign components) is now
|
|
@@ -711,6 +705,7 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
711
705
|
}) => refs.length > 0);
|
|
712
706
|
// don't use Promise.all, otherwise, it'll throw "JavaScript heap out of memory" on a large set of data
|
|
713
707
|
await (0, _pMapSeries().default)(refsToExportPerComponent, processModelComponent);
|
|
708
|
+
objectList.addIfNotExist(allObjectItems);
|
|
714
709
|
if (lane) {
|
|
715
710
|
const laneHistory = await scope.lanes.getOrCreateLaneHistory(lane);
|
|
716
711
|
const laneHistoryData = await bitObjectToObjectItem(laneHistory);
|
|
@@ -723,7 +718,7 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
723
718
|
objectList,
|
|
724
719
|
objectListPerName,
|
|
725
720
|
idsToChangeLocally,
|
|
726
|
-
|
|
721
|
+
modelComponents: exportedModelComponents
|
|
727
722
|
};
|
|
728
723
|
};
|
|
729
724
|
const manyObjectsPerRemote = laneObject ? [await getUpdatedObjectsToExport(laneObject.scope, ids, laneObject)] : await (0, _pMapSeries().default)(Object.keys(idsGroupedByScope), scopeName => getUpdatedObjectsToExport(scopeName, idsGroupedByScope[scopeName], laneObject));
|
|
@@ -763,11 +758,14 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
763
758
|
const {
|
|
764
759
|
remote,
|
|
765
760
|
idsToChangeLocally,
|
|
766
|
-
|
|
761
|
+
modelComponents,
|
|
767
762
|
exportedIds
|
|
768
763
|
} = objectsPerRemote;
|
|
769
764
|
const remoteNameStr = remote.name;
|
|
770
|
-
|
|
765
|
+
|
|
766
|
+
// only the model-components were changed (scope-list, scope-name). the versions and their files already exist
|
|
767
|
+
// locally untouched, re-adding them would re-write all of them to the filesystem.
|
|
768
|
+
modelComponents.forEach(modelComponent => scope.objects.add(modelComponent));
|
|
771
769
|
|
|
772
770
|
// update lanes
|
|
773
771
|
if (lane) {
|
|
@@ -781,9 +779,7 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
781
779
|
// all exported from main
|
|
782
780
|
const remoteLaneId = _laneId().LaneId.from(_laneId().DEFAULT_LANE, remoteNameStr);
|
|
783
781
|
await scope.objects.remoteLanes.loadRemoteLane(remoteLaneId);
|
|
784
|
-
await Promise.all(
|
|
785
|
-
component
|
|
786
|
-
}) => {
|
|
782
|
+
await Promise.all(modelComponents.map(async component => {
|
|
787
783
|
await scope.objects.remoteLanes.addEntry(remoteLaneId, component.toComponentId(), component.getHead());
|
|
788
784
|
}));
|
|
789
785
|
}
|
|
@@ -922,17 +918,10 @@ if the scope name is wrong and you've already snapped/tagged, run "bit reset" to
|
|
|
922
918
|
*
|
|
923
919
|
* This is the Harmony version of "convertToCorrectScope". No more codemod and no more hash changes.
|
|
924
920
|
*/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
if (shouldChangeScope) {
|
|
930
|
-
const idWithFutureScope = ids.searchWithoutScopeAndVersion(componentsObjects.component.toComponentId());
|
|
931
|
-
componentsObjects.component.scope = idWithFutureScope?.scope || remoteScope;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
// return true if one of the versions has changed or the component itself
|
|
935
|
-
return hasComponentChanged;
|
|
921
|
+
convertToCorrectScope(modelComponent, remoteScope, ids) {
|
|
922
|
+
if (modelComponent.scope) return;
|
|
923
|
+
const idWithFutureScope = ids.searchWithoutScopeAndVersion(modelComponent.toComponentId());
|
|
924
|
+
modelComponent.scope = idWithFutureScope?.scope || remoteScope;
|
|
936
925
|
}
|
|
937
926
|
async getComponentsToExport(ids = [], includeNonStaged) {
|
|
938
927
|
const consumer = this.workspace.consumer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_crypto","data","_interopRequireDefault","require","_fsExtra","_harmonyModules","_cli","_scope","_bitError","_legacy","_componentId","_componentVersion","_legacy2","_legacy3","_legacy4","_remove","_legacy5","_workspace","_logger","_lodash","_pMapSeries","_laneId","_scope2","_legacyBitId","_eject","_scope3","_workspaceModules","_dependencyResolver","_exportScopeComponents","_lastExport","_objects","_legacy6","_component","_export","_exportCmd","_resumeExportCmd","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","BEFORE_EXPORT","BEFORE_EXPORTS","BEFORE_LOADING_COMPONENTS","ExportMain","constructor","workspace","remove","depResolver","logger","eject","export","params","nonExistOnBitMap","newIdsOnRemote","missingScope","exported","removedIds","exportedLanes","rippleJobs","exportComponents","ejectResults","clearCache","ejectExportedComponents","exportResults","componentsIds","rippleJobUrls","getRippleJobUrls","Scope","onPostExport","catch","err","error","lane","writeLastExport","scope","path","timestamp","Date","toISOString","name","undefined","exportedComponents","map","id","toStringWithoutVersion","job","getCloudDomain","replace","_ref","ids","includeNonStaged","headOnly","originDirectly","OutsideWorkspaceError","consumer","idsToExport","laneObject","getComponentsToExport","forkLaneNewScope","updatedIds","ComponentIdList","BitError","readmeComponent","_throwForUnsnappedLaneReadme","forkedFrom","isNew","toString","isOnMain","updatedLocally","pushToScopes","exportHeadsOnly","filterOutExistingVersions","Boolean","allVersions","updateLanesAfterExport","getRemovedStagedBitIds","workspaceIds","listIds","laneUpdateDependents","updateDependents","fromArray","hasWithoutVersion","_updateIdsOnBitMap","bitMap","linkToNodeModulesByIds","removeFromStagedConfig","legacyScope","stagedSnaps","deleteFile","fs","getLastMergedPath","Analytics","setExtraData","onDestroy","exportMany","resumeExportId","throwForMissingArtifacts","includeParents","exportOrigin","debug","scopeRemotes","getScopeRemotes","groupByScopeName","idList","reduce","acc","current","scopeName","Error","idsGroupedByScope","resolveRemote","resolve","ScopeNotFoundOrDenied","Http","getToken","bitError","cause","validateTargetScopeForLanes","newIds","isExported","newIdsGrouped","mapSeries","list","remote","InvalidScopeNameFromRemote","listItem","addMainHeadIfPossible","allHashes","modelComponent","head","find","h","hash","objects","has","getVersionsToExport","getCompHeadIncludeUpdateDependents","toComponentId","headVersion","loadVersion","parents","fromWorkspace","getIdIfExist","populateLocalAndRemoteHeads","localTagsOrHashes","getLocalHashes","laneHead","isEqual","getAllVersionHashes","repo","addReferencedSnapsIfPossible","refsPerComponent","headPerCompIdStr","Map","entry","refs","headRef","ref","set","anySquashed","values","some","squashed","headEntry","getAllFlattenedDependencies","depId","version","isSnap","depComp","get","depRef","getRef","depVersion","subRefs","refsWithOptions","existingSubRefs","hasMultiple","groupedByScopeString","join","getUpdatedObjectsToExport","remoteNameStr","bitIds","throwForDuplicationIgnoreVersion","idsToChangeLocally","componentsAndObjects","objectList","ObjectList","objectListPerName","modelComponents","getModelComponent","clearObjectsFromCache","refsToPotentialExportPerComponent","getRefsToExportPerComp","allHashesAsStr","flat","existingOnRemote","scopeImporter","checkWhatHashesExistOnRemote","refsToExportPerComponent","filteredOutRefs","refsToExport","existing","includes","compact","bitObjectToObjectItem","obj","buffer","compress","type","getType","processModelComponent","idFromWorkspace","clearStateData","objectItems","collectVersionsObjects","objectsList","toBitObjects","componentAndObject","component","getAll","convertToCorrectScope","remoteObj","url","host","date","now","addScopeListItem","componentBuffer","componentData","objectsBuffer","Promise","all","allObjectsData","addIfNotExist","laneHistory","lanes","getOrCreateLaneHistory","laneHistoryData","laneData","manyObjectsPerRemote","pushAllToCentralHub","transformToOneObjectListWithScopeData","http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","pushResults","pushToCentralHub","origin","failedScopes","successIds","errors","metadata","PersistFailed","exportedBitIds","ComponentID","fromString","exportedIds","objectPerRemote","idsPerScope","jobs","updateLocalObjects","objectsPerRemote","componentObject","sources","put","add","remoteLanes","syncWithLaneObject","remoteLaneId","LaneId","from","DEFAULT_LANE","loadRemoteLane","addEntry","getHead","persist","idsWithRemoteScope","changeVersion","idsWithRemoteScopeUniq","uniqFromArray","sort","hasWithoutScopeAndVersion","warnCancelExport","consoleWarning","process","on","centralHubResults","remotes","validateRemotes","persistRemotes","shouldPushToCentralHub","pushToRemotesCarefully","addScopesInvolvedToError","setStatusLine","results","removeListener","objPerRemote","addScopeName","mergeObjectList","force","ejectErr","c","msg","clientId","crypto","randomBytes","pushRemotesPendingDir","pushOptions","pushedRemotes","count","pushMany","warn","removePendingDirs","hubRemotes","m","isHub","componentsObjects","remoteScope","exportingIds","shouldFork","shouldChangeScope","hasComponentChanged","idWithFutureScope","searchWithoutScopeAndVersion","componentsList","ComponentsList","idsHaveWildcard","hasWildcard","throwForLocalOnlyIfNeeded","localOnlyComponents","listLocalOnly","localOnlyExportPending","isUserTryingToExportLanes","componentsToExport","getLaneCompIdsToExport","loaderMsg","filtered","exportPendingComponents","listNonNewComponentsIds","listExportPendingComponentsIds","filterComponentsByWildcard","parsedIds","getParsedId","parsedId","getComponentIdIfExist","ignoreVersion","MissingBitMapComponent","getMany","currentLaneId","getCurrentLaneId","loadLane","componentsToExportWithoutRemoved","removedStagedBitIds","removedStaged","getRemovedStaged","provider","cli","loggerMain","createLogger","ExportAspect","exportMain","register","ResumeExportCmd","ExportCmd","exports","MainRuntime","CLIAspect","ScopeAspect","WorkspaceAspect","RemoveAspect","DependencyResolverAspect","LoggerAspect","EjectAspect","addRuntime","componentsId","resultId","updateComponentId","hasVersion","isValid","getComponent","getComponentHead","currentLane","isCurrentLane","setCurrentLane","toLaneId","scopeJson","removeLaneFromNew","isOnLane","scopeNames","message","_default"],"sources":["export.main.runtime.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs-extra';\nimport type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport { BitError } from '@teambit/bit-error';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { isSnap } from '@teambit/component-version';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, getCloudDomain } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { BitMap } from '@teambit/legacy.bit-map';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport type { ListScopeResult } from '@teambit/legacy.component-list';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport { hasWildcard } from '@teambit/legacy.utils';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport type { Remotes, Remote } from '@teambit/scope.remotes';\nimport { getScopeRemotes, ScopeNotFoundOrDenied } from '@teambit/scope.remotes';\nimport { InvalidScopeNameFromRemote } from '@teambit/legacy-bit-id';\nimport type { EjectMain, EjectResults } from '@teambit/eject';\nimport { EjectAspect } from '@teambit/eject';\nimport type { ExportOrigin } from '@teambit/scope.network';\nimport { Http } from '@teambit/scope.network';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { persistRemotes, validateRemotes, removePendingDirs } from './export-scope-components';\nimport { writeLastExport } from './last-export';\nimport type { Lane, ModelComponent, ObjectItem, LaneReadmeComponent, BitObject, Ref, Version } from '@teambit/objects';\nimport { ObjectList } from '@teambit/objects';\nimport { Scope, PersistFailed } from '@teambit/legacy.scope';\nimport { getAllVersionHashes } from '@teambit/component.snap-distance';\nimport { ExportAspect } from './export.aspect';\nimport { ExportCmd } from './export-cmd';\nimport { ResumeExportCmd } from './resume-export-cmd';\n\nexport type OnExportIdTransformer = (id: ComponentID) => ComponentID;\n\nconst BEFORE_EXPORT = 'exporting component';\nconst BEFORE_EXPORTS = 'exporting components';\nconst BEFORE_LOADING_COMPONENTS = 'loading components';\n\ntype ModelComponentAndObjects = { component: ModelComponent; objects: BitObject[] };\ntype ObjectListPerName = { [name: string]: ObjectList };\nexport type ObjectsPerRemote = {\n remote: Remote;\n objectList: ObjectList;\n exportedIds?: string[];\n};\nexport type PushToScopesResult = {\n exported: ComponentIdList;\n updatedLocally: ComponentIdList;\n newIdsOnRemote: ComponentID[];\n rippleJobs: string[];\n};\nexport type PushToScopesParams = {\n scope: Scope;\n ids: ComponentIdList;\n laneObject?: Lane;\n allVersions?: boolean;\n originDirectly?: boolean;\n resumeExportId?: string | undefined;\n throwForMissingArtifacts?: boolean;\n isOnMain?: boolean;\n exportHeadsOnly?: boolean;\n includeParents?: boolean;\n filterOutExistingVersions?: boolean;\n exportOrigin?: ExportOrigin;\n};\ntype ObjectsPerRemoteExtended = ObjectsPerRemote & {\n objectListPerName: ObjectListPerName;\n idsToChangeLocally: ComponentIdList;\n componentsAndObjects: ModelComponentAndObjects[];\n};\n\ntype ExportParams = {\n ids?: string[];\n eject?: boolean;\n allVersions?: boolean;\n originDirectly?: boolean;\n includeNonStaged?: boolean;\n resumeExportId?: string | undefined;\n headOnly?: boolean;\n ignoreMissingArtifacts?: boolean;\n forkLaneNewScope?: boolean;\n};\n\nexport interface ExportResult {\n nonExistOnBitMap: ComponentID[];\n newIdsOnRemote: ComponentID[];\n removedIds: ComponentIdList;\n missingScope: ComponentID[];\n componentsIds: ComponentID[];\n exportedLanes: Lane[];\n rippleJobs: string[];\n rippleJobUrls: string[];\n ejectResults: EjectResults | undefined;\n}\n\nexport class ExportMain {\n constructor(\n private workspace: Workspace,\n private remove: RemoveMain,\n private depResolver: DependencyResolverMain,\n private logger: Logger,\n private eject: EjectMain\n ) {}\n\n async export(params: ExportParams = {}): Promise<ExportResult> {\n const { nonExistOnBitMap, newIdsOnRemote, missingScope, exported, removedIds, exportedLanes, rippleJobs } =\n await this.exportComponents(params);\n let ejectResults: EjectResults | undefined;\n await this.workspace.clearCache(); // needed when one process executes multiple commands, such as in \"bit test\" or \"bit cli\"\n if (params.eject) ejectResults = await this.ejectExportedComponents(exported);\n const exportResults: ExportResult = {\n componentsIds: exported,\n newIdsOnRemote,\n nonExistOnBitMap,\n removedIds,\n missingScope,\n ejectResults,\n exportedLanes,\n rippleJobs,\n rippleJobUrls: this.getRippleJobUrls(exportedLanes, rippleJobs),\n };\n if (Scope.onPostExport) {\n await Scope.onPostExport(exported, exportedLanes).catch((err) => {\n this.logger.error('fatal: onPostExport encountered an error (this error does not stop the process)', err);\n });\n }\n\n if (rippleJobs.length) {\n const lane = exportedLanes[0];\n await writeLastExport(this.workspace.scope.path, {\n timestamp: new Date().toISOString(),\n rippleJobs,\n lane: lane ? { scope: lane.scope, name: lane.name } : undefined,\n exportedComponents: exported.map((id) => id.toStringWithoutVersion()),\n }).catch((err) => {\n this.logger.error('failed to write last-export.json (this error does not stop the process)', err);\n });\n }\n\n return exportResults;\n }\n\n private getRippleJobUrls(exportedLanes: Lane[], rippleJobs: string[]): string[] {\n const lane = exportedLanes.length ? exportedLanes?.[0] : undefined;\n const rippleJobUrls = lane\n ? rippleJobs.map(\n (job) =>\n `https://${getCloudDomain()}/${lane.scope.replace('.', '/')}/~lane/${lane.name}/~ripple-ci/job/${job}`\n )\n : rippleJobs.map((job) => `https://${getCloudDomain()}/ripple-ci/job/${job}`);\n return rippleJobUrls;\n }\n\n private async exportComponents({\n ids,\n includeNonStaged,\n headOnly,\n originDirectly,\n ...params\n }: ExportParams): Promise<{\n updatedIds: ComponentID[];\n nonExistOnBitMap: ComponentID[];\n removedIds: ComponentIdList;\n missingScope: ComponentID[];\n exported: ComponentID[];\n exportedLanes: Lane[];\n newIdsOnRemote: ComponentID[];\n rippleJobs: string[];\n }> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n // `--fork-lane-new-scope`: after the `calculateRemote` fix, divergence baseline is the\n // forked-from head, so components inherited unchanged from the original lane (e.g. comp2\n // when only comp1 was snapped on the fork) are not staged. The fork still needs to push\n // them — the new scope has no copy and would reject the lane object as referencing a\n // missing component. Include non-staged to bring them into `idsToExport`; the laneHead\n // push in `getVersionsToExport` then supplies their refs (divergence is empty for them).\n const { idsToExport, missingScope, laneObject } = await this.getComponentsToExport(\n ids,\n includeNonStaged || headOnly || params.forkLaneNewScope\n );\n\n if (!idsToExport.length && !laneObject) {\n return {\n updatedIds: [],\n nonExistOnBitMap: [],\n removedIds: new ComponentIdList(),\n missingScope,\n exported: [],\n newIdsOnRemote: [],\n exportedLanes: [],\n rippleJobs: [],\n };\n }\n if (!idsToExport.length && laneObject && params.forkLaneNewScope) {\n throw new BitError(`the forked lane \"${laneObject.name}\" has no changes, to export all its components, please use \"--all\" flag\nif the export fails with missing objects/versions/components, run \"bit fetch --lanes <lane-name> --all-history\", to make sure you have the full history locally`);\n }\n\n // validate lane readme component and ensure it has been snapped\n if (laneObject?.readmeComponent) {\n _throwForUnsnappedLaneReadme(laneObject);\n }\n\n if (\n !params.forkLaneNewScope &&\n laneObject?.forkedFrom &&\n laneObject.isNew &&\n laneObject.forkedFrom.scope !== laneObject.scope\n ) {\n throw new BitError(`error: the current lane ${laneObject\n .id()\n .toString()} was forked from ${laneObject.forkedFrom.toString()}\nand is about to export to a different scope (${laneObject.scope}) than the original lane (${\n laneObject.forkedFrom.scope\n }).\non large lanes with long history graph, it results in exporting lots of objects to the new scope, some of them might be missing locally.\nif you can use the same scope as the original name, change it now by running \"bit lane change-scope ${\n laneObject.name\n } ${laneObject.forkedFrom.scope}\".\notherwise, re-run the export with \"--fork-lane-new-scope\" flag.\nif the export fails with missing objects/versions/components, run \"bit fetch --lanes <lane-name> --all-history\", to make sure you have the full history locally`);\n }\n const isOnMain = consumer.isOnMain();\n const { exported, updatedLocally, newIdsOnRemote, rippleJobs } = await this.pushToScopes({\n ...params,\n exportHeadsOnly: headOnly,\n scope: consumer.scope,\n ids: idsToExport,\n laneObject,\n originDirectly,\n isOnMain,\n filterOutExistingVersions: Boolean(!params.allVersions && laneObject),\n });\n if (laneObject) await updateLanesAfterExport(consumer, laneObject);\n const removedIds = await this.getRemovedStagedBitIds();\n const workspaceIds = this.workspace.listIds();\n // hidden updateDependents have no bitmap row by design — exclude them from the\n // \"files are not tracked\" warning that would otherwise fire on every cascade export.\n const laneUpdateDependents = laneObject?.updateDependents\n ? ComponentIdList.fromArray(laneObject.updateDependents)\n : undefined;\n const nonExistOnBitMap = exported.filter(\n (id) =>\n !workspaceIds.hasWithoutVersion(id) &&\n !removedIds.hasWithoutVersion(id) &&\n !laneUpdateDependents?.hasWithoutVersion(id)\n );\n const updatedIds = _updateIdsOnBitMap(consumer.bitMap, updatedLocally);\n // re-generate the package.json, this way, it has the correct data in the componentId prop.\n await linkToNodeModulesByIds(this.workspace, updatedIds, true);\n await this.workspace.removeFromStagedConfig(exported);\n // ideally we should delete the staged-snaps only for the exported snaps. however, it's not easy, and it's ok to\n // delete them all because this file is mainly an optimization for the import process.\n await this.workspace.scope.legacyScope.stagedSnaps.deleteFile();\n await fs.remove(this.workspace.scope.getLastMergedPath());\n Analytics.setExtraData('num_components', exported.length);\n // it is important to have consumer.onDestroy() before running the eject operation, we want the\n // export and eject operations to function independently. we don't want to lose the changes to\n // .bitmap file done by the export action in case the eject action has failed.\n await consumer.onDestroy('export');\n return {\n updatedIds,\n nonExistOnBitMap,\n removedIds,\n missingScope,\n exported,\n newIdsOnRemote,\n exportedLanes: laneObject ? [laneObject] : [],\n rippleJobs,\n };\n }\n\n /**\n * @deprecated use `pushToScopes` instead\n */\n async exportMany(params: PushToScopesParams): Promise<PushToScopesResult> {\n return this.pushToScopes(params);\n }\n\n /**\n * the export process uses four steps. read more about it here: https://github.com/teambit/bit/pull/3371\n */\n async pushToScopes({\n scope,\n ids, // when exporting a lane, the ids are the lane component ids\n laneObject,\n allVersions,\n originDirectly,\n resumeExportId,\n throwForMissingArtifacts,\n isOnMain = true,\n exportHeadsOnly, // relevant when exporting from bare-scope, especially when re-exporting existing versions, the normal calculation based on getDivergeData won't work\n includeParents, // relevant when exportHeadsOnly is used. sometimes the parents head are needed as well\n filterOutExistingVersions, // go to the remote and check whether the version exists there. if so, don't export it\n exportOrigin = 'export',\n }: PushToScopesParams): Promise<PushToScopesResult> {\n this.logger.debug(`scope.exportMany, ids: ${ids.toString()}`);\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n\n const groupByScopeName = (idList: ComponentIdList): { [scopeName: string]: ComponentIdList } => {\n return idList.reduce((acc, current) => {\n const scopeName = current.scope;\n if (!scopeName) {\n throw new Error(`toGroupByScopeName() expect ids to have a scope name, got ${current.toString()}`);\n }\n if (acc[scopeName]) acc[scopeName].push(current);\n else acc[scopeName] = new ComponentIdList(current);\n return acc;\n }, {});\n };\n\n const idsGroupedByScope = groupByScopeName(ids);\n\n const resolveRemote = async (scopeName: string): Promise<Remote> => {\n try {\n return await scopeRemotes.resolve(scopeName);\n } catch (err) {\n if (err instanceof ScopeNotFoundOrDenied && Http.getToken()) {\n const bitError = new BitError(\n `unable to export to the remote scope \"${scopeName}\". the scope may not exist, or you don't have access to it.\nif the scope name is wrong and you've already snapped/tagged, run \"bit reset\" to undo, then run \"bit scope rename ${scopeName} <new-scope>\" and snap/tag again`\n );\n (bitError as Error).cause = err;\n throw bitError;\n }\n throw err;\n }\n };\n\n /**\n * when a component is exported for the first time, and the lane-scope is not the same as the component-scope, it's\n * important to validate that there is no such component in the original scope. otherwise, later, it'll be impossible\n * to merge the lane because these two components don't have any snap in common.\n */\n const validateTargetScopeForLanes = async () => {\n if (!laneObject) {\n return;\n }\n const newIds = ComponentIdList.fromArray(ids.filter((id) => !scope.isExported(id)));\n const newIdsGrouped = groupByScopeName(newIds);\n await mapSeries(Object.keys(newIdsGrouped), async (scopeName) => {\n if (scopeName === laneObject.scope) {\n // this validation is redundant if the lane-component is in the same scope as the lane-object\n return;\n }\n // this check guards against a same-named component already existing in the target scope\n // (which would make the eventual lane-merge impossible — two components, same id, no shared\n // snap history). if the scope doesn't exist on the hub yet, or the user lacks access to it,\n // there's nothing there to conflict with, so skip the check. malformed scope names\n // (InvalidScopeName) are intentionally still raised — those are a genuine user error.\n let list: ListScopeResult[];\n try {\n const remote = await scopeRemotes.resolve(scopeName);\n list = await remote.list();\n } catch (err) {\n if (err instanceof ScopeNotFoundOrDenied || err instanceof InvalidScopeNameFromRemote) {\n return;\n }\n throw err;\n }\n const listIds = ComponentIdList.fromArray(list.map((listItem) => listItem.id));\n newIdsGrouped[scopeName].forEach((id) => {\n if (listIds.hasWithoutVersion(id)) {\n throw new Error(`unable to export a lane with a new component \"${id.toString()}\", which has the default-scope \"${scopeName}\".\n this scope already has a component with the same name. as such, it'll be impossible to merge the lane later because these two components are different`);\n }\n });\n });\n };\n\n /**\n * by default, when exporting a lane, it traverse from the Lane's head and therefore it may skip the main head.\n * later, if for some reason the original component was deleted in its scope, the head object will be missing.\n */\n const addMainHeadIfPossible = async (allHashes: Ref[], modelComponent: ModelComponent) => {\n const head = modelComponent.head;\n if (!head) return;\n if (allHashes.find((h) => h.hash === head.hash)) return; // head is already in the list\n if (!(await scope.objects.has(head))) return; // it should not happen. but if it does, we don't want to block the export\n allHashes.push(head);\n };\n\n const getVersionsToExport = async (modelComponent: ModelComponent): Promise<Ref[]> => {\n if (exportHeadsOnly) {\n const head =\n laneObject?.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId()) || modelComponent.head;\n if (!head) {\n throw new Error(\n `getVersionsToExport should export the head only, but the head of ${modelComponent.id()} is missing`\n );\n }\n if (includeParents) {\n const headVersion = await modelComponent.loadVersion(head.toString(), scope.objects);\n return [head, ...headVersion.parents];\n }\n return [head];\n }\n const fromWorkspace = this.workspace?.getIdIfExist(modelComponent.toComponentId());\n // populate lane-aware heads so divergence is computed against the LANE remote head —\n // hidden updateDependents have no bitmap row, so without this their cascade snap is\n // missed and the export silently sends 0 versions, triggering a remote merge error.\n if (laneObject) await modelComponent.populateLocalAndRemoteHeads(scope.objects, laneObject);\n const localTagsOrHashes = await modelComponent.getLocalHashes(scope.objects, fromWorkspace, laneObject);\n if (laneObject) {\n // Ensure the lane's recorded head for this component is always part of the export refs.\n // Required for cross-scope forks (lane head == forkedFrom baseline → divergence returns []\n // for components inherited unchanged from the original lane). Without this, those\n // components would be exported with zero refs and the new scope would reference an\n // unresolvable hash. The filter in `filterLeanLaneRefs` already keeps lane-head refs.\n const laneHead = laneObject.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId());\n if (laneHead && !localTagsOrHashes.find((r) => r.isEqual(laneHead))) {\n localTagsOrHashes.push(laneHead);\n }\n }\n if (!allVersions) {\n return localTagsOrHashes;\n }\n\n const allHashes = await getAllVersionHashes({ modelComponent, repo: scope.objects });\n await addMainHeadIfPossible(allHashes, modelComponent);\n return allHashes;\n };\n\n /**\n * a component head may reference — via its flattened dependencies — a non-head snap of another\n * component in the same export set. this happens when a component keeps pinning an older snap of\n * a dependency that has since advanced (e.g. the component was soft-removed on the lane, so it\n * never gets re-snapped), and the squash of a lane-merge dropped that snap from the dependency's\n * own parent chain. no history traversal selects it (and a heads-only export selects only heads\n * to begin with), so without it the remote dependency-integrity check\n * (throwForMissingLocalDependencies) rejects the export. add any such snap that exists locally so\n * it is shipped alongside the selected refs. snaps missing locally were fetched during the\n * lane-merge, see MergeLanesMain.importMissingReferencedDeps().\n * flattened (not only direct) deps are walked to mirror exactly what the remote check validates.\n * this is cheap by design and a no-op for ordinary exports: only heads are inspected (the remote\n * check validates only versions that are heads, and they're loaded later by the export anyway),\n * only snaps are considered (tags are never squashed out of history), and a ref is added only\n * when the dependency's head carries the `squashed` marker — i.e. only after a squashing\n * lane-merge, the sole flow that removes snaps from a component's history.\n */\n const addReferencedSnapsIfPossible = async (\n refsPerComponent: Array<{ modelComponent: ModelComponent; refs: Ref[] }>\n ) => {\n const headPerCompIdStr = new Map<\n string,\n { entry: { modelComponent: ModelComponent; refs: Ref[] }; headVersion: Version }\n >();\n await mapSeries(refsPerComponent, async (entry) => {\n const { modelComponent, refs } = entry;\n const headRef =\n laneObject?.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId()) || modelComponent.head;\n if (!headRef) return;\n if (!refs.find((ref) => ref.isEqual(headRef))) return; // the head is not part of this export\n const headVersion = await modelComponent.loadVersion(headRef.toString(), scope.objects, false);\n if (!headVersion) return;\n headPerCompIdStr.set(modelComponent.toComponentId().toStringWithoutVersion(), { entry, headVersion });\n });\n const anySquashed = [...headPerCompIdStr.values()].some(({ headVersion }) => headVersion.squashed);\n if (!anySquashed) return; // no squash in this export set — no snap could have been dropped\n await mapSeries([...headPerCompIdStr.values()], async ({ entry: headEntry, headVersion }) => {\n await mapSeries(headVersion.getAllFlattenedDependencies(), async (depId) => {\n // the remote check validates only same-scope deps (it skips `depId.scope !== scope.name`),\n // so same-scope is all that needs shipping. also filters out most of the flattened list.\n if (depId.scope !== headEntry.modelComponent.scope) return;\n if (!depId.version || !isSnap(depId.version)) return;\n const depComp = headPerCompIdStr.get(depId.toStringWithoutVersion());\n if (!depComp) return; // the referenced component is not part of this export set\n if (!depComp.headVersion.squashed) return; // dep history is intact — the pinned snap is on-chain\n const depRef = depComp.entry.modelComponent.getRef(depId.version);\n if (!depRef) return;\n if (depComp.entry.refs.find((ref) => ref.isEqual(depRef))) return; // already included\n if (!(await scope.objects.has(depRef))) return; // can only ship what exists locally\n // the objects this version references (file sources, flattened-edges) get collected along\n // with it, so they must be present locally as well. if they're not, don't add the ref —\n // exporting it would fail on the missing objects, and the remote may have this version\n // already anyway (in which case the export succeeds without shipping it).\n const depVersion = await depComp.entry.modelComponent.loadVersion(depRef.toString(), scope.objects, false);\n if (!depVersion) return;\n const subRefs = depVersion.refsWithOptions(false, false);\n // hasMultiple bounds the I/O concurrency, unlike a Promise.all of has() calls\n const existingSubRefs = await scope.objects.hasMultiple(subRefs);\n if (existingSubRefs.length !== subRefs.length) return;\n depComp.entry.refs.push(depRef);\n });\n });\n };\n\n await validateTargetScopeForLanes();\n const groupedByScopeString = Object.keys(idsGroupedByScope)\n .map((scopeName) => `scope \"${scopeName}\": ${idsGroupedByScope[scopeName].toString()}`)\n .join(', ');\n this.logger.debug(`export-scope-components, export to the following scopes ${groupedByScopeString}`);\n\n const getUpdatedObjectsToExport = async (\n remoteNameStr: string,\n bitIds: ComponentIdList,\n lane?: Lane\n ): Promise<ObjectsPerRemoteExtended> => {\n bitIds.throwForDuplicationIgnoreVersion();\n const remote: Remote = await resolveRemote(remoteNameStr);\n const idsToChangeLocally = ComponentIdList.fromArray(bitIds.filter((id) => !scope.isExported(id)));\n const componentsAndObjects: ModelComponentAndObjects[] = [];\n const objectList = new ObjectList();\n const objectListPerName: ObjectListPerName = {};\n\n const modelComponents = await mapSeries(bitIds, (id) => scope.getModelComponent(id));\n // super important! otherwise, the processModelComponent() changes objects in memory, while the key remains the same\n scope.objects.clearObjectsFromCache();\n\n const refsToPotentialExportPerComponent = await mapSeries(modelComponents, async (modelComponent) => {\n const refs = await getVersionsToExport(modelComponent);\n return { modelComponent, refs };\n });\n\n await addReferencedSnapsIfPossible(refsToPotentialExportPerComponent);\n\n const getRefsToExportPerComp = async () => {\n if (!filterOutExistingVersions) {\n return refsToPotentialExportPerComponent;\n }\n const allHashesAsStr = refsToPotentialExportPerComponent\n .map((r) => r.refs)\n .flat()\n .map((ref) => ref.toString());\n const existingOnRemote = await scope.scopeImporter.checkWhatHashesExistOnRemote(remoteNameStr, allHashesAsStr);\n // for lanes, some snaps might be already on the remote, and the reason they're staged is due to a previous merge.\n const refsToExportPerComponent = refsToPotentialExportPerComponent.map(({ modelComponent, refs }) => {\n const filteredOutRefs: string[] = [];\n const refsToExport = refs.filter((ref) => {\n const existing = existingOnRemote.includes(ref.toString());\n if (existing) filteredOutRefs.push(ref.toString());\n return !existing;\n });\n if (filteredOutRefs.length)\n this.logger.debug(\n `export-scope-components, the following refs were filtered out from ${modelComponent\n .id()\n .toString()} because they already exist on the remote:\\n${filteredOutRefs.join('\\n')}`\n );\n\n return refsToExport.length ? { modelComponent, refs: refsToExport } : null;\n });\n\n return compact(refsToExportPerComponent);\n };\n\n const bitObjectToObjectItem = async (obj: BitObject): Promise<ObjectItem> => {\n return {\n ref: obj.hash(),\n buffer: await obj.compress(),\n type: obj.getType(),\n };\n };\n\n const processModelComponent = async ({\n modelComponent,\n refs,\n }: {\n modelComponent: ModelComponent;\n refs: Ref[];\n }) => {\n const idFromWorkspace = this.workspace?.getIdIfExist(modelComponent.toComponentId());\n modelComponent.clearStateData();\n const objectItems = await modelComponent.collectVersionsObjects(\n scope.objects,\n refs.map((ref) => ref.toString()),\n throwForMissingArtifacts,\n idFromWorkspace\n );\n const objectsList = await new ObjectList(objectItems).toBitObjects();\n const componentAndObject = { component: modelComponent, objects: objectsList.getAll() };\n await this.convertToCorrectScope(scope, componentAndObject, remoteNameStr, bitIds, ids);\n const remoteObj = { url: remote.host, name: remote.name, date: Date.now().toString() };\n modelComponent.addScopeListItem(remoteObj);\n componentsAndObjects.push(componentAndObject);\n const componentBuffer = await modelComponent.compress();\n const componentData = { ref: modelComponent.hash(), buffer: componentBuffer, type: modelComponent.getType() };\n const objectsBuffer = await Promise.all(\n componentAndObject.objects.map(async (obj) => bitObjectToObjectItem(obj))\n );\n const allObjectsData = [componentData, ...objectsBuffer];\n objectListPerName[modelComponent.name] = new ObjectList(allObjectsData);\n objectList.addIfNotExist(allObjectsData);\n };\n\n // The lean-lane filter (drop main-origin refs belonging to foreign components) is now\n // applied inside `getVersionsToExport` via `ModelComponent.getLocalHashes(...lane)`, so\n // refsPerComp is already filtered. We just drop empty entries.\n const refsToExportPerComponent = (await getRefsToExportPerComp()).filter(({ refs }) => refs.length > 0);\n // don't use Promise.all, otherwise, it'll throw \"JavaScript heap out of memory\" on a large set of data\n await mapSeries(refsToExportPerComponent, processModelComponent);\n if (lane) {\n const laneHistory = await scope.lanes.getOrCreateLaneHistory(lane);\n const laneHistoryData = await bitObjectToObjectItem(laneHistory);\n objectList.addIfNotExist([laneHistoryData]);\n const laneData = await bitObjectToObjectItem(lane);\n objectList.addIfNotExist([laneData]);\n }\n\n return { remote, objectList, objectListPerName, idsToChangeLocally, componentsAndObjects };\n };\n\n const manyObjectsPerRemote = laneObject\n ? [await getUpdatedObjectsToExport(laneObject.scope, ids, laneObject)]\n : await mapSeries(Object.keys(idsGroupedByScope), (scopeName) =>\n getUpdatedObjectsToExport(scopeName, idsGroupedByScope[scopeName], laneObject)\n );\n\n const pushAllToCentralHub = async () => {\n const objectList = this.transformToOneObjectListWithScopeData(manyObjectsPerRemote);\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n const pushResults = await http.pushToCentralHub(objectList, { origin: exportOrigin });\n const { failedScopes, successIds, errors, metadata } = pushResults;\n if (failedScopes.length) {\n throw new PersistFailed(failedScopes, errors);\n }\n const exportedBitIds = successIds.map((id) => ComponentID.fromString(id));\n if (manyObjectsPerRemote.length === 1) {\n // when on a lane, it's always exported to the lane. and the ids can be from different scopes, so having the\n // filter below, will remove these components from the output of bit-export at the end.\n manyObjectsPerRemote[0].exportedIds = exportedBitIds.map((id) => id.toString());\n } else {\n manyObjectsPerRemote.forEach((objectPerRemote) => {\n const idsPerScope = exportedBitIds.filter((id) => id.scope === objectPerRemote.remote.name);\n // it's possible that idsPerScope is an empty array, in case the objects were exported already before\n objectPerRemote.exportedIds = idsPerScope.map((id) => id.toString());\n });\n }\n return { rippleJobs: metadata?.jobs };\n };\n\n const updateLocalObjects = async (\n lane?: Lane\n ): Promise<\n Array<{ exported: ComponentIdList; updatedLocally: ComponentIdList; newIdsOnRemote: ComponentID[] }>\n > => {\n return mapSeries(manyObjectsPerRemote, async (objectsPerRemote: ObjectsPerRemoteExtended) => {\n const { remote, idsToChangeLocally, componentsAndObjects, exportedIds } = objectsPerRemote;\n const remoteNameStr = remote.name;\n\n componentsAndObjects.forEach((componentObject) => scope.sources.put(componentObject));\n\n // update lanes\n if (lane) {\n if (idsToChangeLocally.length) {\n // otherwise, we don't want to update scope-name of components in the lane object\n scope.objects.add(lane);\n }\n await scope.objects.remoteLanes.syncWithLaneObject(remoteNameStr, lane);\n }\n\n if (isOnMain && !lane) {\n // all exported from main\n const remoteLaneId = LaneId.from(DEFAULT_LANE, remoteNameStr);\n await scope.objects.remoteLanes.loadRemoteLane(remoteLaneId);\n await Promise.all(\n componentsAndObjects.map(async ({ component }) => {\n await scope.objects.remoteLanes.addEntry(remoteLaneId, component.toComponentId(), component.getHead());\n })\n );\n }\n\n await scope.objects.persist();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const newIdsOnRemote = exportedIds!.map((id) => ComponentID.fromString(id));\n // remove version. exported component might have multiple versions exported\n const idsWithRemoteScope: ComponentID[] = newIdsOnRemote.map((id) => id.changeVersion(undefined));\n const idsWithRemoteScopeUniq = ComponentIdList.uniqFromArray(idsWithRemoteScope).sort();\n return {\n newIdsOnRemote,\n exported: idsWithRemoteScopeUniq,\n updatedLocally: ComponentIdList.fromArray(\n idsWithRemoteScopeUniq.filter((id) => idsToChangeLocally.hasWithoutScopeAndVersion(id))\n ),\n };\n });\n };\n\n const warnCancelExport = () => {\n this.logger.consoleWarning(\n `unable to cancel the export process at this point because the communication with the remote already started`\n );\n };\n process.on('SIGINT', warnCancelExport);\n let centralHubResults;\n try {\n if (resumeExportId) {\n const remotes = manyObjectsPerRemote.map((o) => o.remote);\n await validateRemotes(remotes, resumeExportId);\n await persistRemotes(manyObjectsPerRemote, resumeExportId);\n } else if (this.shouldPushToCentralHub(manyObjectsPerRemote, scopeRemotes, originDirectly)) {\n centralHubResults = await pushAllToCentralHub();\n } else {\n // await pushToRemotes();\n await this.pushToRemotesCarefully(manyObjectsPerRemote, resumeExportId);\n }\n } catch (err: any) {\n throw addScopesInvolvedToError(\n err,\n manyObjectsPerRemote.map((o) => o.remote.name)\n );\n }\n\n this.logger.setStatusLine('updating data locally...');\n const results = await updateLocalObjects(laneObject);\n process.removeListener('SIGINT', warnCancelExport);\n return {\n newIdsOnRemote: results.map((r) => r.newIdsOnRemote).flat(),\n exported: ComponentIdList.uniqFromArray(results.map((r) => r.exported).flat()),\n updatedLocally: ComponentIdList.uniqFromArray(results.map((r) => r.updatedLocally).flat()),\n rippleJobs: centralHubResults?.rippleJobs || [],\n };\n }\n\n private transformToOneObjectListWithScopeData(objectsPerRemote: ObjectsPerRemote[]): ObjectList {\n const objectList = new ObjectList();\n objectsPerRemote.forEach((objPerRemote) => {\n objPerRemote.objectList.addScopeName(objPerRemote.remote.name);\n objectList.mergeObjectList(objPerRemote.objectList);\n });\n return objectList;\n }\n\n private async ejectExportedComponents(componentsIds: ComponentID[]): Promise<EjectResults> {\n const consumer: Consumer = this.workspace.consumer;\n let ejectResults: EjectResults;\n try {\n ejectResults = await this.eject.eject(componentsIds, { force: true });\n } catch (err: any) {\n const ejectErr = `The components ${componentsIds.map((c) => c.toString()).join(', ')} were exported successfully.\n However, the eject operation has failed due to an error: ${err.msg || err}`;\n this.logger.error(ejectErr, err);\n throw new Error(ejectErr);\n }\n // run the consumer.onDestroy() again, to write the changes done by the eject action to .bitmap\n await consumer.onDestroy('export (eject)');\n return ejectResults;\n }\n\n async pushToRemotesCarefully(manyObjectsPerRemote: ObjectsPerRemote[], resumeExportId?: string) {\n const remotes = manyObjectsPerRemote.map((o) => o.remote);\n // The clientId is both the pending-dir name AND the cross-client export lock: `export-validate`'s\n // waitIfNeeded queue sorts pending-dir names and lets only the first proceed to validate+persist.\n // A pure `Date.now()` is not collision-safe — two exports to the same remote within the same\n // millisecond (e.g. concurrent CI runners pushing the same lane) get the same clientId, share one\n // pending-dir, collapse the queue to a single entry, and both validate against the pre-persist\n // state, silently losing one runner's update. A random suffix keeps the timestamp prefix (so the\n // sorted queue still roughly preserves arrival order) while making a same-millisecond collision\n // vanishingly unlikely (64 bits of randomness). Use node's built-in `crypto` rather than a\n // component helper so this core aspect doesn't gain a new component dependency.\n const clientId = resumeExportId || `${Date.now()}-${crypto.randomBytes(8).toString('hex')}`;\n await this.pushRemotesPendingDir(clientId, manyObjectsPerRemote, resumeExportId);\n await validateRemotes(remotes, clientId, Boolean(resumeExportId));\n // Intentionally no cleanup on `persistRemotes` failure: pending dirs are the substrate for\n // `bit export --resume <clientId>` AND act as a cross-client lock via `export-validate`'s\n // waitIfNeeded queue (sorted by clientId). In a multi-scope persist with a partial-success\n // failure (scopeA persisted, scopeB exhausted retries), removing the pending dirs would let\n // another client race in against an inconsistent partial-commit state and would also strand\n // the original user with no objects to resume from. Leave them in place; the user's recovery\n // is `--resume` (or, on the server side, an explicit pending-dir cleanup tool).\n await persistRemotes(manyObjectsPerRemote, clientId);\n }\n\n private async pushRemotesPendingDir(\n clientId: string,\n manyObjectsPerRemote: ObjectsPerRemote[],\n resumeExportId?: string\n ): Promise<void> {\n if (resumeExportId) {\n this.logger.debug('pushRemotesPendingDir - skip as the resumeExportId was passed');\n // no need to transfer the objects, they're already on the server. also, since this clientId\n // exists already on the remote pending-dir, it'll cause a collision.\n return;\n }\n const pushOptions = { clientId };\n const pushedRemotes: Remote[] = [];\n await mapSeries(manyObjectsPerRemote, async (objectsPerRemote: ObjectsPerRemote) => {\n const { remote, objectList } = objectsPerRemote;\n this.logger.setStatusLine(`transferring ${objectList.count()} objects to the remote \"${remote.name}\"...`);\n try {\n await remote.pushMany(objectList, pushOptions, {});\n this.logger.debug(\n 'pushRemotesPendingDir, successfully pushed all objects to the pending-dir directory on the remote'\n );\n pushedRemotes.push(remote);\n } catch (err: any) {\n this.logger.warn('exportMany, failed pushing objects to the remote');\n await removePendingDirs(pushedRemotes, clientId);\n throw err;\n }\n });\n }\n\n shouldPushToCentralHub(\n manyObjectsPerRemote: ObjectsPerRemote[],\n scopeRemotes: Remotes,\n originDirectly = false\n ): boolean {\n if (originDirectly) return false;\n const hubRemotes = manyObjectsPerRemote.filter((m) => scopeRemotes.isHub(m.remote.name));\n if (!hubRemotes.length) return false;\n if (hubRemotes.length === manyObjectsPerRemote.length) return true; // all are hub\n // @todo: maybe create a flag \"no-central\" to support this workflow\n throw new BitError(\n `some of your components are configured to be exported to a local scope and some to the bit.cloud hub. this is not supported`\n );\n }\n\n /**\n * Component and dependencies id changes:\n * When exporting components with dependencies to a bare-scope, some of the dependencies may be created locally and as\n * a result their scope-name is null. Before the bare-scope gets the components, convert these scope names\n * to the bare-scope name.\n *\n * This is the Harmony version of \"convertToCorrectScope\". No more codemod and no more hash changes.\n */\n private async convertToCorrectScope(\n scope: Scope,\n componentsObjects: ModelComponentAndObjects,\n remoteScope: string,\n exportingIds: ComponentIdList,\n ids: ComponentIdList,\n shouldFork = false // not in used currently, but might be needed soon\n ): Promise<boolean> {\n const shouldChangeScope = shouldFork\n ? remoteScope !== componentsObjects.component.scope\n : !componentsObjects.component.scope;\n const hasComponentChanged = shouldChangeScope;\n if (shouldChangeScope) {\n const idWithFutureScope = ids.searchWithoutScopeAndVersion(componentsObjects.component.toComponentId());\n componentsObjects.component.scope = idWithFutureScope?.scope || remoteScope;\n }\n\n // return true if one of the versions has changed or the component itself\n return hasComponentChanged;\n }\n\n private async getComponentsToExport(\n ids: string[] = [],\n includeNonStaged?: boolean\n ): Promise<{\n idsToExport: ComponentIdList;\n missingScope: ComponentID[];\n laneObject?: Lane;\n }> {\n const consumer = this.workspace.consumer;\n const componentsList = new ComponentsList(this.workspace);\n const idsHaveWildcard = hasWildcard(ids);\n const throwForLocalOnlyIfNeeded = async (\n bitIds: ComponentIdList\n ): Promise<{ idsToExport: ComponentIdList; missingScope: ComponentID[] }> => {\n const localOnlyComponents = this.workspace.listLocalOnly();\n const localOnlyExportPending = bitIds.filter((id) => localOnlyComponents.hasWithoutScopeAndVersion(id));\n if (localOnlyExportPending.length) {\n throw new BitError(`unable to export the following components as they are local only:\n(either bit-reset them or run \"bit local-only unset\" to make them non local only)\n${localOnlyExportPending.map((c) => c.toString()).join('\\n')}`);\n }\n return { idsToExport: ComponentIdList.fromArray(bitIds), missingScope: [] };\n };\n if (isUserTryingToExportLanes(consumer)) {\n if (ids.length) {\n throw new BitError(`when checked out to a lane, all its components are exported. please omit the ids`);\n }\n const { componentsToExport, laneObject } = await this.getLaneCompIdsToExport(consumer, includeNonStaged);\n const loaderMsg = componentsToExport.length > 1 ? BEFORE_EXPORTS : BEFORE_EXPORT;\n this.logger.setStatusLine(loaderMsg);\n const filtered = await throwForLocalOnlyIfNeeded(componentsToExport);\n return { ...filtered, laneObject };\n }\n if (!ids.length || idsHaveWildcard) {\n this.logger.setStatusLine(BEFORE_LOADING_COMPONENTS);\n const exportPendingComponents: ComponentIdList = includeNonStaged\n ? await componentsList.listNonNewComponentsIds()\n : await componentsList.listExportPendingComponentsIds();\n const componentsToExport = idsHaveWildcard\n ? ComponentsList.filterComponentsByWildcard(exportPendingComponents, ids)\n : exportPendingComponents;\n const loaderMsg = componentsToExport.length > 1 ? BEFORE_EXPORTS : BEFORE_EXPORT;\n this.logger.setStatusLine(loaderMsg);\n return throwForLocalOnlyIfNeeded(componentsToExport);\n }\n this.logger.setStatusLine(BEFORE_EXPORT); // show single export\n const parsedIds = await Promise.all(ids.map((id) => getParsedId(consumer, id)));\n // an id that is not in the workspace should fail the export. (workspace.getMany below would\n // have loaded it from the scope instead of throwing)\n parsedIds.forEach((parsedId) => {\n if (!consumer.bitMap.getComponentIdIfExist(parsedId, { ignoreVersion: true })) {\n throw new MissingBitMapComponent(parsedId.toString());\n }\n });\n // load the components for fixing any out-of-sync issues.\n await this.workspace.getMany(parsedIds);\n\n return throwForLocalOnlyIfNeeded(ComponentIdList.fromArray(parsedIds));\n }\n\n private async getLaneCompIdsToExport(\n consumer: Consumer,\n includeNonStaged?: boolean\n ): Promise<{ componentsToExport: ComponentIdList; laneObject: Lane }> {\n const currentLaneId = consumer.getCurrentLaneId();\n const laneObject = await consumer.scope.loadLane(currentLaneId);\n if (!laneObject) {\n throw new Error(`fatal: unable to load the current lane object (${currentLaneId.toString()})`);\n }\n this.logger.setStatusLine(BEFORE_LOADING_COMPONENTS);\n const componentsList = new ComponentsList(this.workspace);\n const componentsToExportWithoutRemoved = includeNonStaged\n ? await componentsList.listNonNewComponentsIds()\n : await componentsList.listExportPendingComponentsIds(laneObject);\n const removedStagedBitIds = await this.getRemovedStagedBitIds();\n const componentsToExport = ComponentIdList.uniqFromArray([\n ...componentsToExportWithoutRemoved,\n ...removedStagedBitIds,\n ]);\n return { componentsToExport, laneObject };\n }\n\n private async getRemovedStagedBitIds(): Promise<ComponentIdList> {\n const removedStaged = await this.remove.getRemovedStaged();\n return ComponentIdList.fromArray(removedStaged.map((id) => id.changeVersion(undefined)));\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n ScopeAspect,\n WorkspaceAspect,\n RemoveAspect,\n DependencyResolverAspect,\n LoggerAspect,\n EjectAspect,\n ];\n static async provider([cli, scope, workspace, remove, depResolver, loggerMain, eject]: [\n CLIMain,\n ScopeMain,\n Workspace,\n RemoveMain,\n DependencyResolverMain,\n LoggerMain,\n EjectMain,\n ]) {\n const logger = loggerMain.createLogger(ExportAspect.id);\n const exportMain = new ExportMain(workspace, remove, depResolver, logger, eject);\n cli.register(new ResumeExportCmd(scope, logger), new ExportCmd(exportMain));\n return exportMain;\n }\n}\n\nExportAspect.addRuntime(ExportMain);\n\n/**\n * the componentsIds passed here are the ones that didn't have scope-name before, and now they have.\n * so if the bitMap.updateComponentId returns bitId without scope-name is because it couldn't find it there\n */\nfunction _updateIdsOnBitMap(bitMap: BitMap, componentsIds: ComponentIdList): ComponentID[] {\n const updatedIds: ComponentID[] = [];\n componentsIds.forEach((componentsId) => {\n const resultId = bitMap.updateComponentId(componentsId, true);\n if (resultId.hasVersion()) updatedIds.push(resultId);\n });\n return updatedIds;\n}\n\nasync function getParsedId(consumer: Consumer, id: string): Promise<ComponentID> {\n // reason why not calling `consumer.getParsedId()` only is because a component might not be on\n // .bitmap and only in the scope. we support this case and enable to export\n try {\n return consumer.getParsedId(id);\n } catch {\n return consumer.scope.getParsedId(id);\n }\n}\n\nfunction _throwForUnsnappedLaneReadme(lane: Lane) {\n const readmeComponent = lane.readmeComponent as LaneReadmeComponent;\n\n const isValid =\n readmeComponent?.head &&\n lane.getComponent(readmeComponent.id) &&\n lane.getComponentHead(readmeComponent.id)?.isEqual(readmeComponent?.head);\n\n if (!isValid) {\n throw new BitError(\n `${lane?.name} has a readme component ${readmeComponent.id} that hasn't been snapped on the lane.\n Please run either snap -a or snap ${readmeComponent.id} to snap the component on the lane before exporting it.`\n );\n }\n}\n\nasync function updateLanesAfterExport(consumer: Consumer, lane: Lane) {\n const currentLane = consumer.getCurrentLaneId();\n const isCurrentLane = lane.name === currentLane.name;\n if (!isCurrentLane) {\n throw new Error(\n `updateLanesAfterExport should get called only with current lane, got ${lane.name}, current ${currentLane.name}`\n );\n }\n consumer.setCurrentLane(lane.toLaneId(), true);\n consumer.scope.scopeJson.removeLaneFromNew(lane.name);\n lane.isNew = false;\n}\n\nexport function isUserTryingToExportLanes(consumer: Consumer) {\n return consumer.isOnLane();\n}\n\n/**\n * a failed export leaves the objects in the pending-objects dir of every scope it was pushed to, but the\n * error tells only about the scope that failed (e.g. server-is-busy, which is thrown per scope). without\n * the full list, cleaning up a stuck export means guessing which other scopes hold the same pending dir.\n * only the client knows all the scopes of the export, so add them to the error.\n */\nfunction addScopesInvolvedToError(err: any, scopeNames: string[]): any {\n // guard against a non-error being thrown, in which case setting \"message\" would throw and hide the original error\n if (!scopeNames.length || typeof err?.message !== 'string') return err;\n err.message = `${err.message}\nthe following scopes were used for this export: ${scopeNames.join(', ')}`;\n return err;\n}\n\nexport default ExportMain;\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAA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sBAAsBA,CAACpB,QAAkB,EAAEtB,IAAU,EAAE;EACpE,MAAM8V,WAAW,GAAGxU,QAAQ,CAACwS,gBAAgB,CAAC,CAAC;EAC/C,MAAMiC,aAAa,GAAG/V,IAAI,CAACO,IAAI,KAAKuV,WAAW,CAACvV,IAAI;EACpD,IAAI,CAACwV,aAAa,EAAE;IAClB,MAAM,IAAInR,KAAK,CACb,wEAAwE5E,IAAI,CAACO,IAAI,aAAauV,WAAW,CAACvV,IAAI,EAChH,CAAC;EACH;EACAe,QAAQ,CAAC0U,cAAc,CAAChW,IAAI,CAACiW,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC;EAC9C3U,QAAQ,CAACpB,KAAK,CAACgW,SAAS,CAACC,iBAAiB,CAACnW,IAAI,CAACO,IAAI,CAAC;EACrDP,IAAI,CAACiC,KAAK,GAAG,KAAK;AACpB;AAEO,SAAS4Q,yBAAyBA,CAACvR,QAAkB,EAAE;EAC5D,OAAOA,QAAQ,CAAC8U,QAAQ,CAAC,CAAC;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS/F,wBAAwBA,CAACvQ,GAAQ,EAAEuW,UAAoB,EAAO;EACrE;EACA,IAAI,CAACA,UAAU,CAAC7Z,MAAM,IAAI,OAAOsD,GAAG,EAAEwW,OAAO,KAAK,QAAQ,EAAE,OAAOxW,GAAG;EACtEA,GAAG,CAACwW,OAAO,GAAG,GAAGxW,GAAG,CAACwW,OAAO;AAC9B,kDAAkDD,UAAU,CAACnN,IAAI,CAAC,IAAI,CAAC,EAAE;EACvE,OAAOpJ,GAAG;AACZ;AAAC,IAAAyW,QAAA,GAAA1B,OAAA,CAAApZ,OAAA,GAEc0C,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_crypto","data","_interopRequireDefault","require","_fsExtra","_harmonyModules","_cli","_scope","_bitError","_legacy","_componentId","_componentVersion","_legacy2","_legacy3","_legacy4","_remove","_legacy5","_workspace","_logger","_lodash","_pMapSeries","_laneId","_scope2","_legacyBitId","_eject","_scope3","_workspaceModules","_dependencyResolver","_exportScopeComponents","_lastExport","_objects","_legacy6","_component","_export","_exportCmd","_resumeExportCmd","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_objectWithoutProperties","i","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","call","hasOwnProperty","_toPropertyKey","value","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","BEFORE_EXPORT","BEFORE_EXPORTS","BEFORE_LOADING_COMPONENTS","ExportMain","constructor","workspace","remove","depResolver","logger","eject","export","params","nonExistOnBitMap","newIdsOnRemote","missingScope","exported","removedIds","exportedLanes","rippleJobs","exportComponents","ejectResults","clearCache","ejectExportedComponents","exportResults","componentsIds","rippleJobUrls","getRippleJobUrls","Scope","onPostExport","catch","err","error","lane","writeLastExport","scope","path","timestamp","Date","toISOString","name","undefined","exportedComponents","map","id","toStringWithoutVersion","job","getCloudDomain","replace","_ref","ids","includeNonStaged","headOnly","originDirectly","OutsideWorkspaceError","consumer","idsToExport","laneObject","getComponentsToExport","forkLaneNewScope","updatedIds","ComponentIdList","BitError","readmeComponent","_throwForUnsnappedLaneReadme","forkedFrom","isNew","toString","isOnMain","updatedLocally","pushToScopes","exportHeadsOnly","filterOutExistingVersions","Boolean","allVersions","updateLanesAfterExport","getRemovedStagedBitIds","workspaceIds","listIds","laneUpdateDependents","updateDependents","fromArray","hasWithoutVersion","_updateIdsOnBitMap","bitMap","linkToNodeModulesByIds","removeFromStagedConfig","legacyScope","stagedSnaps","deleteFile","fs","getLastMergedPath","Analytics","setExtraData","onDestroy","exportMany","resumeExportId","throwForMissingArtifacts","includeParents","exportOrigin","debug","scopeRemotes","getScopeRemotes","groupByScopeName","idList","reduce","acc","current","scopeName","Error","idsGroupedByScope","resolveRemote","resolve","ScopeNotFoundOrDenied","Http","getToken","bitError","cause","validateTargetScopeForLanes","newIds","isExported","newIdsGrouped","mapSeries","list","remote","InvalidScopeNameFromRemote","listItem","addMainHeadIfPossible","allHashes","modelComponent","head","find","h","hash","objects","has","getVersionsToExport","getCompHeadIncludeUpdateDependents","toComponentId","headVersion","loadVersion","parents","fromWorkspace","getIdIfExist","populateLocalAndRemoteHeads","localTagsOrHashes","getLocalHashes","laneHead","isEqual","getAllVersionHashes","repo","addReferencedSnapsIfPossible","refsPerComponent","headPerCompIdStr","Map","entry","refs","headRef","ref","set","anySquashed","values","some","squashed","headEntry","getAllFlattenedDependencies","depId","version","isSnap","depComp","get","depRef","getRef","depVersion","subRefs","refsWithOptions","existingSubRefs","hasMultiple","groupedByScopeString","join","getUpdatedObjectsToExport","remoteNameStr","bitIds","throwForDuplicationIgnoreVersion","idsToChangeLocally","exportedModelComponents","objectList","ObjectList","allObjectItems","objectListPerName","modelComponents","getModelComponent","clearObjectsFromCache","refsToPotentialExportPerComponent","getRefsToExportPerComp","allHashesAsStr","flat","existingOnRemote","scopeImporter","checkWhatHashesExistOnRemote","refsToExportPerComponent","filteredOutRefs","refsToExport","existing","includes","compact","bitObjectToObjectItem","obj","buffer","compress","type","getType","processModelComponent","idFromWorkspace","clearStateData","objectItems","collectVersionsObjects","convertToCorrectScope","remoteObj","url","host","date","now","addScopeListItem","componentData","allObjectsData","objectItem","addIfNotExist","laneHistory","lanes","getOrCreateLaneHistory","laneHistoryData","laneData","manyObjectsPerRemote","pushAllToCentralHub","transformToOneObjectListWithScopeData","http","connect","CENTRAL_BIT_HUB_URL","CENTRAL_BIT_HUB_NAME","pushResults","pushToCentralHub","origin","failedScopes","successIds","errors","metadata","PersistFailed","exportedBitIds","ComponentID","fromString","exportedIds","objectPerRemote","idsPerScope","jobs","updateLocalObjects","objectsPerRemote","add","remoteLanes","syncWithLaneObject","remoteLaneId","LaneId","from","DEFAULT_LANE","loadRemoteLane","Promise","all","component","addEntry","getHead","persist","idsWithRemoteScope","changeVersion","idsWithRemoteScopeUniq","uniqFromArray","sort","hasWithoutScopeAndVersion","warnCancelExport","consoleWarning","process","on","centralHubResults","remotes","validateRemotes","persistRemotes","shouldPushToCentralHub","pushToRemotesCarefully","addScopesInvolvedToError","setStatusLine","results","removeListener","objPerRemote","addScopeName","mergeObjectList","force","ejectErr","c","msg","clientId","crypto","randomBytes","pushRemotesPendingDir","pushOptions","pushedRemotes","count","pushMany","warn","removePendingDirs","hubRemotes","m","isHub","remoteScope","idWithFutureScope","searchWithoutScopeAndVersion","componentsList","ComponentsList","idsHaveWildcard","hasWildcard","throwForLocalOnlyIfNeeded","localOnlyComponents","listLocalOnly","localOnlyExportPending","isUserTryingToExportLanes","componentsToExport","getLaneCompIdsToExport","loaderMsg","filtered","exportPendingComponents","listNonNewComponentsIds","listExportPendingComponentsIds","filterComponentsByWildcard","parsedIds","getParsedId","parsedId","getComponentIdIfExist","ignoreVersion","MissingBitMapComponent","getMany","currentLaneId","getCurrentLaneId","loadLane","componentsToExportWithoutRemoved","removedStagedBitIds","removedStaged","getRemovedStaged","provider","cli","loggerMain","createLogger","ExportAspect","exportMain","register","ResumeExportCmd","ExportCmd","exports","MainRuntime","CLIAspect","ScopeAspect","WorkspaceAspect","RemoveAspect","DependencyResolverAspect","LoggerAspect","EjectAspect","addRuntime","componentsId","resultId","updateComponentId","hasVersion","isValid","getComponent","getComponentHead","currentLane","isCurrentLane","setCurrentLane","toLaneId","scopeJson","removeLaneFromNew","isOnLane","scopeNames","message","_default"],"sources":["export.main.runtime.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs-extra';\nimport type { CLIMain } from '@teambit/cli';\nimport { MainRuntime } from '@teambit/harmony.modules.runtimes';\nimport { CLIAspect } from '@teambit/cli';\nimport type { ScopeMain } from '@teambit/scope';\nimport { ScopeAspect } from '@teambit/scope';\nimport { BitError } from '@teambit/bit-error';\nimport { Analytics } from '@teambit/legacy.analytics';\nimport { ComponentID, ComponentIdList } from '@teambit/component-id';\nimport { isSnap } from '@teambit/component-version';\nimport { CENTRAL_BIT_HUB_NAME, CENTRAL_BIT_HUB_URL, getCloudDomain } from '@teambit/legacy.constants';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { BitMap } from '@teambit/legacy.bit-map';\nimport { MissingBitMapComponent } from '@teambit/legacy.bit-map';\nimport type { ListScopeResult } from '@teambit/legacy.component-list';\nimport { ComponentsList } from '@teambit/legacy.component-list';\nimport type { RemoveMain } from '@teambit/remove';\nimport { RemoveAspect } from '@teambit/remove';\nimport { hasWildcard } from '@teambit/legacy.utils';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect, OutsideWorkspaceError } from '@teambit/workspace';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport { compact } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport { LaneId, DEFAULT_LANE } from '@teambit/lane-id';\nimport type { Remotes, Remote } from '@teambit/scope.remotes';\nimport { getScopeRemotes, ScopeNotFoundOrDenied } from '@teambit/scope.remotes';\nimport { InvalidScopeNameFromRemote } from '@teambit/legacy-bit-id';\nimport type { EjectMain, EjectResults } from '@teambit/eject';\nimport { EjectAspect } from '@teambit/eject';\nimport type { ExportOrigin } from '@teambit/scope.network';\nimport { Http } from '@teambit/scope.network';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport type { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport { DependencyResolverAspect } from '@teambit/dependency-resolver';\nimport { persistRemotes, validateRemotes, removePendingDirs } from './export-scope-components';\nimport { writeLastExport } from './last-export';\nimport type { Lane, ModelComponent, ObjectItem, LaneReadmeComponent, BitObject, Ref, Version } from '@teambit/objects';\nimport { ObjectList } from '@teambit/objects';\nimport { Scope, PersistFailed } from '@teambit/legacy.scope';\nimport { getAllVersionHashes } from '@teambit/component.snap-distance';\nimport { ExportAspect } from './export.aspect';\nimport { ExportCmd } from './export-cmd';\nimport { ResumeExportCmd } from './resume-export-cmd';\n\nexport type OnExportIdTransformer = (id: ComponentID) => ComponentID;\n\nconst BEFORE_EXPORT = 'exporting component';\nconst BEFORE_EXPORTS = 'exporting components';\nconst BEFORE_LOADING_COMPONENTS = 'loading components';\n\ntype ObjectListPerName = { [name: string]: ObjectList };\nexport type ObjectsPerRemote = {\n remote: Remote;\n objectList: ObjectList;\n exportedIds?: string[];\n};\nexport type PushToScopesResult = {\n exported: ComponentIdList;\n updatedLocally: ComponentIdList;\n newIdsOnRemote: ComponentID[];\n rippleJobs: string[];\n};\nexport type PushToScopesParams = {\n scope: Scope;\n ids: ComponentIdList;\n laneObject?: Lane;\n allVersions?: boolean;\n originDirectly?: boolean;\n resumeExportId?: string | undefined;\n throwForMissingArtifacts?: boolean;\n isOnMain?: boolean;\n exportHeadsOnly?: boolean;\n includeParents?: boolean;\n filterOutExistingVersions?: boolean;\n exportOrigin?: ExportOrigin;\n};\ntype ObjectsPerRemoteExtended = ObjectsPerRemote & {\n objectListPerName: ObjectListPerName;\n idsToChangeLocally: ComponentIdList;\n modelComponents: ModelComponent[];\n};\n\ntype ExportParams = {\n ids?: string[];\n eject?: boolean;\n allVersions?: boolean;\n originDirectly?: boolean;\n includeNonStaged?: boolean;\n resumeExportId?: string | undefined;\n headOnly?: boolean;\n ignoreMissingArtifacts?: boolean;\n forkLaneNewScope?: boolean;\n};\n\nexport interface ExportResult {\n nonExistOnBitMap: ComponentID[];\n newIdsOnRemote: ComponentID[];\n removedIds: ComponentIdList;\n missingScope: ComponentID[];\n componentsIds: ComponentID[];\n exportedLanes: Lane[];\n rippleJobs: string[];\n rippleJobUrls: string[];\n ejectResults: EjectResults | undefined;\n}\n\nexport class ExportMain {\n constructor(\n private workspace: Workspace,\n private remove: RemoveMain,\n private depResolver: DependencyResolverMain,\n private logger: Logger,\n private eject: EjectMain\n ) {}\n\n async export(params: ExportParams = {}): Promise<ExportResult> {\n const { nonExistOnBitMap, newIdsOnRemote, missingScope, exported, removedIds, exportedLanes, rippleJobs } =\n await this.exportComponents(params);\n let ejectResults: EjectResults | undefined;\n await this.workspace.clearCache(); // needed when one process executes multiple commands, such as in \"bit test\" or \"bit cli\"\n if (params.eject) ejectResults = await this.ejectExportedComponents(exported);\n const exportResults: ExportResult = {\n componentsIds: exported,\n newIdsOnRemote,\n nonExistOnBitMap,\n removedIds,\n missingScope,\n ejectResults,\n exportedLanes,\n rippleJobs,\n rippleJobUrls: this.getRippleJobUrls(exportedLanes, rippleJobs),\n };\n if (Scope.onPostExport) {\n await Scope.onPostExport(exported, exportedLanes).catch((err) => {\n this.logger.error('fatal: onPostExport encountered an error (this error does not stop the process)', err);\n });\n }\n\n if (rippleJobs.length) {\n const lane = exportedLanes[0];\n await writeLastExport(this.workspace.scope.path, {\n timestamp: new Date().toISOString(),\n rippleJobs,\n lane: lane ? { scope: lane.scope, name: lane.name } : undefined,\n exportedComponents: exported.map((id) => id.toStringWithoutVersion()),\n }).catch((err) => {\n this.logger.error('failed to write last-export.json (this error does not stop the process)', err);\n });\n }\n\n return exportResults;\n }\n\n private getRippleJobUrls(exportedLanes: Lane[], rippleJobs: string[]): string[] {\n const lane = exportedLanes.length ? exportedLanes?.[0] : undefined;\n const rippleJobUrls = lane\n ? rippleJobs.map(\n (job) =>\n `https://${getCloudDomain()}/${lane.scope.replace('.', '/')}/~lane/${lane.name}/~ripple-ci/job/${job}`\n )\n : rippleJobs.map((job) => `https://${getCloudDomain()}/ripple-ci/job/${job}`);\n return rippleJobUrls;\n }\n\n private async exportComponents({\n ids,\n includeNonStaged,\n headOnly,\n originDirectly,\n ...params\n }: ExportParams): Promise<{\n updatedIds: ComponentID[];\n nonExistOnBitMap: ComponentID[];\n removedIds: ComponentIdList;\n missingScope: ComponentID[];\n exported: ComponentID[];\n exportedLanes: Lane[];\n newIdsOnRemote: ComponentID[];\n rippleJobs: string[];\n }> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n const consumer: Consumer = this.workspace.consumer;\n // `--fork-lane-new-scope`: after the `calculateRemote` fix, divergence baseline is the\n // forked-from head, so components inherited unchanged from the original lane (e.g. comp2\n // when only comp1 was snapped on the fork) are not staged. The fork still needs to push\n // them — the new scope has no copy and would reject the lane object as referencing a\n // missing component. Include non-staged to bring them into `idsToExport`; the laneHead\n // push in `getVersionsToExport` then supplies their refs (divergence is empty for them).\n const { idsToExport, missingScope, laneObject } = await this.getComponentsToExport(\n ids,\n includeNonStaged || headOnly || params.forkLaneNewScope\n );\n\n if (!idsToExport.length && !laneObject) {\n return {\n updatedIds: [],\n nonExistOnBitMap: [],\n removedIds: new ComponentIdList(),\n missingScope,\n exported: [],\n newIdsOnRemote: [],\n exportedLanes: [],\n rippleJobs: [],\n };\n }\n if (!idsToExport.length && laneObject && params.forkLaneNewScope) {\n throw new BitError(`the forked lane \"${laneObject.name}\" has no changes, to export all its components, please use \"--all\" flag\nif the export fails with missing objects/versions/components, run \"bit fetch --lanes <lane-name> --all-history\", to make sure you have the full history locally`);\n }\n\n // validate lane readme component and ensure it has been snapped\n if (laneObject?.readmeComponent) {\n _throwForUnsnappedLaneReadme(laneObject);\n }\n\n if (\n !params.forkLaneNewScope &&\n laneObject?.forkedFrom &&\n laneObject.isNew &&\n laneObject.forkedFrom.scope !== laneObject.scope\n ) {\n throw new BitError(`error: the current lane ${laneObject\n .id()\n .toString()} was forked from ${laneObject.forkedFrom.toString()}\nand is about to export to a different scope (${laneObject.scope}) than the original lane (${\n laneObject.forkedFrom.scope\n }).\non large lanes with long history graph, it results in exporting lots of objects to the new scope, some of them might be missing locally.\nif you can use the same scope as the original name, change it now by running \"bit lane change-scope ${\n laneObject.name\n } ${laneObject.forkedFrom.scope}\".\notherwise, re-run the export with \"--fork-lane-new-scope\" flag.\nif the export fails with missing objects/versions/components, run \"bit fetch --lanes <lane-name> --all-history\", to make sure you have the full history locally`);\n }\n const isOnMain = consumer.isOnMain();\n const { exported, updatedLocally, newIdsOnRemote, rippleJobs } = await this.pushToScopes({\n ...params,\n exportHeadsOnly: headOnly,\n scope: consumer.scope,\n ids: idsToExport,\n laneObject,\n originDirectly,\n isOnMain,\n filterOutExistingVersions: Boolean(!params.allVersions && laneObject),\n });\n if (laneObject) await updateLanesAfterExport(consumer, laneObject);\n const removedIds = await this.getRemovedStagedBitIds();\n const workspaceIds = this.workspace.listIds();\n // hidden updateDependents have no bitmap row by design — exclude them from the\n // \"files are not tracked\" warning that would otherwise fire on every cascade export.\n const laneUpdateDependents = laneObject?.updateDependents\n ? ComponentIdList.fromArray(laneObject.updateDependents)\n : undefined;\n const nonExistOnBitMap = exported.filter(\n (id) =>\n !workspaceIds.hasWithoutVersion(id) &&\n !removedIds.hasWithoutVersion(id) &&\n !laneUpdateDependents?.hasWithoutVersion(id)\n );\n const updatedIds = _updateIdsOnBitMap(consumer.bitMap, updatedLocally);\n // re-generate the package.json, this way, it has the correct data in the componentId prop.\n await linkToNodeModulesByIds(this.workspace, updatedIds, true);\n await this.workspace.removeFromStagedConfig(exported);\n // ideally we should delete the staged-snaps only for the exported snaps. however, it's not easy, and it's ok to\n // delete them all because this file is mainly an optimization for the import process.\n await this.workspace.scope.legacyScope.stagedSnaps.deleteFile();\n await fs.remove(this.workspace.scope.getLastMergedPath());\n Analytics.setExtraData('num_components', exported.length);\n // it is important to have consumer.onDestroy() before running the eject operation, we want the\n // export and eject operations to function independently. we don't want to lose the changes to\n // .bitmap file done by the export action in case the eject action has failed.\n await consumer.onDestroy('export');\n return {\n updatedIds,\n nonExistOnBitMap,\n removedIds,\n missingScope,\n exported,\n newIdsOnRemote,\n exportedLanes: laneObject ? [laneObject] : [],\n rippleJobs,\n };\n }\n\n /**\n * @deprecated use `pushToScopes` instead\n */\n async exportMany(params: PushToScopesParams): Promise<PushToScopesResult> {\n return this.pushToScopes(params);\n }\n\n /**\n * the export process uses four steps. read more about it here: https://github.com/teambit/bit/pull/3371\n */\n async pushToScopes({\n scope,\n ids, // when exporting a lane, the ids are the lane component ids\n laneObject,\n allVersions,\n originDirectly,\n resumeExportId,\n throwForMissingArtifacts,\n isOnMain = true,\n exportHeadsOnly, // relevant when exporting from bare-scope, especially when re-exporting existing versions, the normal calculation based on getDivergeData won't work\n includeParents, // relevant when exportHeadsOnly is used. sometimes the parents head are needed as well\n filterOutExistingVersions, // go to the remote and check whether the version exists there. if so, don't export it\n exportOrigin = 'export',\n }: PushToScopesParams): Promise<PushToScopesResult> {\n this.logger.debug(`scope.exportMany, ids: ${ids.toString()}`);\n const scopeRemotes: Remotes = await getScopeRemotes(scope);\n\n const groupByScopeName = (idList: ComponentIdList): { [scopeName: string]: ComponentIdList } => {\n return idList.reduce((acc, current) => {\n const scopeName = current.scope;\n if (!scopeName) {\n throw new Error(`toGroupByScopeName() expect ids to have a scope name, got ${current.toString()}`);\n }\n if (acc[scopeName]) acc[scopeName].push(current);\n else acc[scopeName] = new ComponentIdList(current);\n return acc;\n }, {});\n };\n\n const idsGroupedByScope = groupByScopeName(ids);\n\n const resolveRemote = async (scopeName: string): Promise<Remote> => {\n try {\n return await scopeRemotes.resolve(scopeName);\n } catch (err) {\n if (err instanceof ScopeNotFoundOrDenied && Http.getToken()) {\n const bitError = new BitError(\n `unable to export to the remote scope \"${scopeName}\". the scope may not exist, or you don't have access to it.\nif the scope name is wrong and you've already snapped/tagged, run \"bit reset\" to undo, then run \"bit scope rename ${scopeName} <new-scope>\" and snap/tag again`\n );\n (bitError as Error).cause = err;\n throw bitError;\n }\n throw err;\n }\n };\n\n /**\n * when a component is exported for the first time, and the lane-scope is not the same as the component-scope, it's\n * important to validate that there is no such component in the original scope. otherwise, later, it'll be impossible\n * to merge the lane because these two components don't have any snap in common.\n */\n const validateTargetScopeForLanes = async () => {\n if (!laneObject) {\n return;\n }\n const newIds = ComponentIdList.fromArray(ids.filter((id) => !scope.isExported(id)));\n const newIdsGrouped = groupByScopeName(newIds);\n await mapSeries(Object.keys(newIdsGrouped), async (scopeName) => {\n if (scopeName === laneObject.scope) {\n // this validation is redundant if the lane-component is in the same scope as the lane-object\n return;\n }\n // this check guards against a same-named component already existing in the target scope\n // (which would make the eventual lane-merge impossible — two components, same id, no shared\n // snap history). if the scope doesn't exist on the hub yet, or the user lacks access to it,\n // there's nothing there to conflict with, so skip the check. malformed scope names\n // (InvalidScopeName) are intentionally still raised — those are a genuine user error.\n let list: ListScopeResult[];\n try {\n const remote = await scopeRemotes.resolve(scopeName);\n list = await remote.list();\n } catch (err) {\n if (err instanceof ScopeNotFoundOrDenied || err instanceof InvalidScopeNameFromRemote) {\n return;\n }\n throw err;\n }\n const listIds = ComponentIdList.fromArray(list.map((listItem) => listItem.id));\n newIdsGrouped[scopeName].forEach((id) => {\n if (listIds.hasWithoutVersion(id)) {\n throw new Error(`unable to export a lane with a new component \"${id.toString()}\", which has the default-scope \"${scopeName}\".\n this scope already has a component with the same name. as such, it'll be impossible to merge the lane later because these two components are different`);\n }\n });\n });\n };\n\n /**\n * by default, when exporting a lane, it traverse from the Lane's head and therefore it may skip the main head.\n * later, if for some reason the original component was deleted in its scope, the head object will be missing.\n */\n const addMainHeadIfPossible = async (allHashes: Ref[], modelComponent: ModelComponent) => {\n const head = modelComponent.head;\n if (!head) return;\n if (allHashes.find((h) => h.hash === head.hash)) return; // head is already in the list\n if (!(await scope.objects.has(head))) return; // it should not happen. but if it does, we don't want to block the export\n allHashes.push(head);\n };\n\n const getVersionsToExport = async (modelComponent: ModelComponent): Promise<Ref[]> => {\n if (exportHeadsOnly) {\n const head =\n laneObject?.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId()) || modelComponent.head;\n if (!head) {\n throw new Error(\n `getVersionsToExport should export the head only, but the head of ${modelComponent.id()} is missing`\n );\n }\n if (includeParents) {\n const headVersion = await modelComponent.loadVersion(head.toString(), scope.objects);\n return [head, ...headVersion.parents];\n }\n return [head];\n }\n const fromWorkspace = this.workspace?.getIdIfExist(modelComponent.toComponentId());\n // populate lane-aware heads so divergence is computed against the LANE remote head —\n // hidden updateDependents have no bitmap row, so without this their cascade snap is\n // missed and the export silently sends 0 versions, triggering a remote merge error.\n if (laneObject) await modelComponent.populateLocalAndRemoteHeads(scope.objects, laneObject);\n const localTagsOrHashes = await modelComponent.getLocalHashes(scope.objects, fromWorkspace, laneObject);\n if (laneObject) {\n // Ensure the lane's recorded head for this component is always part of the export refs.\n // Required for cross-scope forks (lane head == forkedFrom baseline → divergence returns []\n // for components inherited unchanged from the original lane). Without this, those\n // components would be exported with zero refs and the new scope would reference an\n // unresolvable hash. The filter in `filterLeanLaneRefs` already keeps lane-head refs.\n const laneHead = laneObject.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId());\n if (laneHead && !localTagsOrHashes.find((r) => r.isEqual(laneHead))) {\n localTagsOrHashes.push(laneHead);\n }\n }\n if (!allVersions) {\n return localTagsOrHashes;\n }\n\n const allHashes = await getAllVersionHashes({ modelComponent, repo: scope.objects });\n await addMainHeadIfPossible(allHashes, modelComponent);\n return allHashes;\n };\n\n /**\n * a component head may reference — via its flattened dependencies — a non-head snap of another\n * component in the same export set. this happens when a component keeps pinning an older snap of\n * a dependency that has since advanced (e.g. the component was soft-removed on the lane, so it\n * never gets re-snapped), and the squash of a lane-merge dropped that snap from the dependency's\n * own parent chain. no history traversal selects it (and a heads-only export selects only heads\n * to begin with), so without it the remote dependency-integrity check\n * (throwForMissingLocalDependencies) rejects the export. add any such snap that exists locally so\n * it is shipped alongside the selected refs. snaps missing locally were fetched during the\n * lane-merge, see MergeLanesMain.importMissingReferencedDeps().\n * flattened (not only direct) deps are walked to mirror exactly what the remote check validates.\n * this is cheap by design and a no-op for ordinary exports: only heads are inspected (the remote\n * check validates only versions that are heads, and they're loaded later by the export anyway),\n * only snaps are considered (tags are never squashed out of history), and a ref is added only\n * when the dependency's head carries the `squashed` marker — i.e. only after a squashing\n * lane-merge, the sole flow that removes snaps from a component's history.\n */\n const addReferencedSnapsIfPossible = async (\n refsPerComponent: Array<{ modelComponent: ModelComponent; refs: Ref[] }>\n ) => {\n const headPerCompIdStr = new Map<\n string,\n { entry: { modelComponent: ModelComponent; refs: Ref[] }; headVersion: Version }\n >();\n await mapSeries(refsPerComponent, async (entry) => {\n const { modelComponent, refs } = entry;\n const headRef =\n laneObject?.getCompHeadIncludeUpdateDependents(modelComponent.toComponentId()) || modelComponent.head;\n if (!headRef) return;\n if (!refs.find((ref) => ref.isEqual(headRef))) return; // the head is not part of this export\n const headVersion = await modelComponent.loadVersion(headRef.toString(), scope.objects, false);\n if (!headVersion) return;\n headPerCompIdStr.set(modelComponent.toComponentId().toStringWithoutVersion(), { entry, headVersion });\n });\n const anySquashed = [...headPerCompIdStr.values()].some(({ headVersion }) => headVersion.squashed);\n if (!anySquashed) return; // no squash in this export set — no snap could have been dropped\n await mapSeries([...headPerCompIdStr.values()], async ({ entry: headEntry, headVersion }) => {\n await mapSeries(headVersion.getAllFlattenedDependencies(), async (depId) => {\n // the remote check validates only same-scope deps (it skips `depId.scope !== scope.name`),\n // so same-scope is all that needs shipping. also filters out most of the flattened list.\n if (depId.scope !== headEntry.modelComponent.scope) return;\n if (!depId.version || !isSnap(depId.version)) return;\n const depComp = headPerCompIdStr.get(depId.toStringWithoutVersion());\n if (!depComp) return; // the referenced component is not part of this export set\n if (!depComp.headVersion.squashed) return; // dep history is intact — the pinned snap is on-chain\n const depRef = depComp.entry.modelComponent.getRef(depId.version);\n if (!depRef) return;\n if (depComp.entry.refs.find((ref) => ref.isEqual(depRef))) return; // already included\n if (!(await scope.objects.has(depRef))) return; // can only ship what exists locally\n // the objects this version references (file sources, flattened-edges) get collected along\n // with it, so they must be present locally as well. if they're not, don't add the ref —\n // exporting it would fail on the missing objects, and the remote may have this version\n // already anyway (in which case the export succeeds without shipping it).\n const depVersion = await depComp.entry.modelComponent.loadVersion(depRef.toString(), scope.objects, false);\n if (!depVersion) return;\n const subRefs = depVersion.refsWithOptions(false, false);\n // hasMultiple bounds the I/O concurrency, unlike a Promise.all of has() calls\n const existingSubRefs = await scope.objects.hasMultiple(subRefs);\n if (existingSubRefs.length !== subRefs.length) return;\n depComp.entry.refs.push(depRef);\n });\n });\n };\n\n await validateTargetScopeForLanes();\n const groupedByScopeString = Object.keys(idsGroupedByScope)\n .map((scopeName) => `scope \"${scopeName}\": ${idsGroupedByScope[scopeName].toString()}`)\n .join(', ');\n this.logger.debug(`export-scope-components, export to the following scopes ${groupedByScopeString}`);\n\n const getUpdatedObjectsToExport = async (\n remoteNameStr: string,\n bitIds: ComponentIdList,\n lane?: Lane\n ): Promise<ObjectsPerRemoteExtended> => {\n bitIds.throwForDuplicationIgnoreVersion();\n const remote: Remote = await resolveRemote(remoteNameStr);\n const idsToChangeLocally = ComponentIdList.fromArray(bitIds.filter((id) => !scope.isExported(id)));\n const exportedModelComponents: ModelComponent[] = [];\n const objectList = new ObjectList();\n const allObjectItems: ObjectItem[] = [];\n const objectListPerName: ObjectListPerName = {};\n\n const modelComponents = await mapSeries(bitIds, (id) => scope.getModelComponent(id));\n // super important! otherwise, the processModelComponent() changes objects in memory, while the key remains the same\n scope.objects.clearObjectsFromCache();\n\n const refsToPotentialExportPerComponent = await mapSeries(modelComponents, async (modelComponent) => {\n const refs = await getVersionsToExport(modelComponent);\n return { modelComponent, refs };\n });\n\n await addReferencedSnapsIfPossible(refsToPotentialExportPerComponent);\n\n const getRefsToExportPerComp = async () => {\n if (!filterOutExistingVersions) {\n return refsToPotentialExportPerComponent;\n }\n const allHashesAsStr = refsToPotentialExportPerComponent\n .map((r) => r.refs)\n .flat()\n .map((ref) => ref.toString());\n const existingOnRemote = await scope.scopeImporter.checkWhatHashesExistOnRemote(remoteNameStr, allHashesAsStr);\n // for lanes, some snaps might be already on the remote, and the reason they're staged is due to a previous merge.\n const refsToExportPerComponent = refsToPotentialExportPerComponent.map(({ modelComponent, refs }) => {\n const filteredOutRefs: string[] = [];\n const refsToExport = refs.filter((ref) => {\n const existing = existingOnRemote.includes(ref.toString());\n if (existing) filteredOutRefs.push(ref.toString());\n return !existing;\n });\n if (filteredOutRefs.length)\n this.logger.debug(\n `export-scope-components, the following refs were filtered out from ${modelComponent\n .id()\n .toString()} because they already exist on the remote:\\n${filteredOutRefs.join('\\n')}`\n );\n\n return refsToExport.length ? { modelComponent, refs: refsToExport } : null;\n });\n\n return compact(refsToExportPerComponent);\n };\n\n const bitObjectToObjectItem = async (obj: BitObject): Promise<ObjectItem> => {\n return {\n ref: obj.hash(),\n buffer: await obj.compress(),\n type: obj.getType(),\n };\n };\n\n const processModelComponent = async ({\n modelComponent,\n refs,\n }: {\n modelComponent: ModelComponent;\n refs: Ref[];\n }) => {\n const idFromWorkspace = this.workspace?.getIdIfExist(modelComponent.toComponentId());\n modelComponent.clearStateData();\n const objectItems = await modelComponent.collectVersionsObjects(\n scope.objects,\n refs.map((ref) => ref.toString()),\n throwForMissingArtifacts,\n idFromWorkspace\n );\n this.convertToCorrectScope(modelComponent, remoteNameStr, ids);\n const remoteObj = { url: remote.host, name: remote.name, date: Date.now().toString() };\n modelComponent.addScopeListItem(remoteObj);\n exportedModelComponents.push(modelComponent);\n const componentData = await bitObjectToObjectItem(modelComponent);\n // the version objects and their files/artifacts are not modified during export, so their raw (already\n // compressed) buffers are sent as is. parsing and re-compressing them is very costly for components with\n // many files (e.g. tens of thousands of bundled pages).\n const allObjectsData = [componentData, ...objectItems];\n objectListPerName[modelComponent.name] = new ObjectList(allObjectsData);\n // not `push(...allObjectsData)`, a component can have more objects than the max number of function arguments.\n allObjectsData.forEach((objectItem) => allObjectItems.push(objectItem));\n };\n\n // The lean-lane filter (drop main-origin refs belonging to foreign components) is now\n // applied inside `getVersionsToExport` via `ModelComponent.getLocalHashes(...lane)`, so\n // refsPerComp is already filtered. We just drop empty entries.\n const refsToExportPerComponent = (await getRefsToExportPerComp()).filter(({ refs }) => refs.length > 0);\n // don't use Promise.all, otherwise, it'll throw \"JavaScript heap out of memory\" on a large set of data\n await mapSeries(refsToExportPerComponent, processModelComponent);\n objectList.addIfNotExist(allObjectItems);\n if (lane) {\n const laneHistory = await scope.lanes.getOrCreateLaneHistory(lane);\n const laneHistoryData = await bitObjectToObjectItem(laneHistory);\n objectList.addIfNotExist([laneHistoryData]);\n const laneData = await bitObjectToObjectItem(lane);\n objectList.addIfNotExist([laneData]);\n }\n\n return { remote, objectList, objectListPerName, idsToChangeLocally, modelComponents: exportedModelComponents };\n };\n\n const manyObjectsPerRemote = laneObject\n ? [await getUpdatedObjectsToExport(laneObject.scope, ids, laneObject)]\n : await mapSeries(Object.keys(idsGroupedByScope), (scopeName) =>\n getUpdatedObjectsToExport(scopeName, idsGroupedByScope[scopeName], laneObject)\n );\n\n const pushAllToCentralHub = async () => {\n const objectList = this.transformToOneObjectListWithScopeData(manyObjectsPerRemote);\n const http = await Http.connect(CENTRAL_BIT_HUB_URL, CENTRAL_BIT_HUB_NAME);\n const pushResults = await http.pushToCentralHub(objectList, { origin: exportOrigin });\n const { failedScopes, successIds, errors, metadata } = pushResults;\n if (failedScopes.length) {\n throw new PersistFailed(failedScopes, errors);\n }\n const exportedBitIds = successIds.map((id) => ComponentID.fromString(id));\n if (manyObjectsPerRemote.length === 1) {\n // when on a lane, it's always exported to the lane. and the ids can be from different scopes, so having the\n // filter below, will remove these components from the output of bit-export at the end.\n manyObjectsPerRemote[0].exportedIds = exportedBitIds.map((id) => id.toString());\n } else {\n manyObjectsPerRemote.forEach((objectPerRemote) => {\n const idsPerScope = exportedBitIds.filter((id) => id.scope === objectPerRemote.remote.name);\n // it's possible that idsPerScope is an empty array, in case the objects were exported already before\n objectPerRemote.exportedIds = idsPerScope.map((id) => id.toString());\n });\n }\n return { rippleJobs: metadata?.jobs };\n };\n\n const updateLocalObjects = async (\n lane?: Lane\n ): Promise<\n Array<{ exported: ComponentIdList; updatedLocally: ComponentIdList; newIdsOnRemote: ComponentID[] }>\n > => {\n return mapSeries(manyObjectsPerRemote, async (objectsPerRemote: ObjectsPerRemoteExtended) => {\n const { remote, idsToChangeLocally, modelComponents, exportedIds } = objectsPerRemote;\n const remoteNameStr = remote.name;\n\n // only the model-components were changed (scope-list, scope-name). the versions and their files already exist\n // locally untouched, re-adding them would re-write all of them to the filesystem.\n modelComponents.forEach((modelComponent) => scope.objects.add(modelComponent));\n\n // update lanes\n if (lane) {\n if (idsToChangeLocally.length) {\n // otherwise, we don't want to update scope-name of components in the lane object\n scope.objects.add(lane);\n }\n await scope.objects.remoteLanes.syncWithLaneObject(remoteNameStr, lane);\n }\n\n if (isOnMain && !lane) {\n // all exported from main\n const remoteLaneId = LaneId.from(DEFAULT_LANE, remoteNameStr);\n await scope.objects.remoteLanes.loadRemoteLane(remoteLaneId);\n await Promise.all(\n modelComponents.map(async (component) => {\n await scope.objects.remoteLanes.addEntry(remoteLaneId, component.toComponentId(), component.getHead());\n })\n );\n }\n\n await scope.objects.persist();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const newIdsOnRemote = exportedIds!.map((id) => ComponentID.fromString(id));\n // remove version. exported component might have multiple versions exported\n const idsWithRemoteScope: ComponentID[] = newIdsOnRemote.map((id) => id.changeVersion(undefined));\n const idsWithRemoteScopeUniq = ComponentIdList.uniqFromArray(idsWithRemoteScope).sort();\n return {\n newIdsOnRemote,\n exported: idsWithRemoteScopeUniq,\n updatedLocally: ComponentIdList.fromArray(\n idsWithRemoteScopeUniq.filter((id) => idsToChangeLocally.hasWithoutScopeAndVersion(id))\n ),\n };\n });\n };\n\n const warnCancelExport = () => {\n this.logger.consoleWarning(\n `unable to cancel the export process at this point because the communication with the remote already started`\n );\n };\n process.on('SIGINT', warnCancelExport);\n let centralHubResults;\n try {\n if (resumeExportId) {\n const remotes = manyObjectsPerRemote.map((o) => o.remote);\n await validateRemotes(remotes, resumeExportId);\n await persistRemotes(manyObjectsPerRemote, resumeExportId);\n } else if (this.shouldPushToCentralHub(manyObjectsPerRemote, scopeRemotes, originDirectly)) {\n centralHubResults = await pushAllToCentralHub();\n } else {\n // await pushToRemotes();\n await this.pushToRemotesCarefully(manyObjectsPerRemote, resumeExportId);\n }\n } catch (err: any) {\n throw addScopesInvolvedToError(\n err,\n manyObjectsPerRemote.map((o) => o.remote.name)\n );\n }\n\n this.logger.setStatusLine('updating data locally...');\n const results = await updateLocalObjects(laneObject);\n process.removeListener('SIGINT', warnCancelExport);\n return {\n newIdsOnRemote: results.map((r) => r.newIdsOnRemote).flat(),\n exported: ComponentIdList.uniqFromArray(results.map((r) => r.exported).flat()),\n updatedLocally: ComponentIdList.uniqFromArray(results.map((r) => r.updatedLocally).flat()),\n rippleJobs: centralHubResults?.rippleJobs || [],\n };\n }\n\n private transformToOneObjectListWithScopeData(objectsPerRemote: ObjectsPerRemote[]): ObjectList {\n const objectList = new ObjectList();\n objectsPerRemote.forEach((objPerRemote) => {\n objPerRemote.objectList.addScopeName(objPerRemote.remote.name);\n objectList.mergeObjectList(objPerRemote.objectList);\n });\n return objectList;\n }\n\n private async ejectExportedComponents(componentsIds: ComponentID[]): Promise<EjectResults> {\n const consumer: Consumer = this.workspace.consumer;\n let ejectResults: EjectResults;\n try {\n ejectResults = await this.eject.eject(componentsIds, { force: true });\n } catch (err: any) {\n const ejectErr = `The components ${componentsIds.map((c) => c.toString()).join(', ')} were exported successfully.\n However, the eject operation has failed due to an error: ${err.msg || err}`;\n this.logger.error(ejectErr, err);\n throw new Error(ejectErr);\n }\n // run the consumer.onDestroy() again, to write the changes done by the eject action to .bitmap\n await consumer.onDestroy('export (eject)');\n return ejectResults;\n }\n\n async pushToRemotesCarefully(manyObjectsPerRemote: ObjectsPerRemote[], resumeExportId?: string) {\n const remotes = manyObjectsPerRemote.map((o) => o.remote);\n // The clientId is both the pending-dir name AND the cross-client export lock: `export-validate`'s\n // waitIfNeeded queue sorts pending-dir names and lets only the first proceed to validate+persist.\n // A pure `Date.now()` is not collision-safe — two exports to the same remote within the same\n // millisecond (e.g. concurrent CI runners pushing the same lane) get the same clientId, share one\n // pending-dir, collapse the queue to a single entry, and both validate against the pre-persist\n // state, silently losing one runner's update. A random suffix keeps the timestamp prefix (so the\n // sorted queue still roughly preserves arrival order) while making a same-millisecond collision\n // vanishingly unlikely (64 bits of randomness). Use node's built-in `crypto` rather than a\n // component helper so this core aspect doesn't gain a new component dependency.\n const clientId = resumeExportId || `${Date.now()}-${crypto.randomBytes(8).toString('hex')}`;\n await this.pushRemotesPendingDir(clientId, manyObjectsPerRemote, resumeExportId);\n await validateRemotes(remotes, clientId, Boolean(resumeExportId));\n // Intentionally no cleanup on `persistRemotes` failure: pending dirs are the substrate for\n // `bit export --resume <clientId>` AND act as a cross-client lock via `export-validate`'s\n // waitIfNeeded queue (sorted by clientId). In a multi-scope persist with a partial-success\n // failure (scopeA persisted, scopeB exhausted retries), removing the pending dirs would let\n // another client race in against an inconsistent partial-commit state and would also strand\n // the original user with no objects to resume from. Leave them in place; the user's recovery\n // is `--resume` (or, on the server side, an explicit pending-dir cleanup tool).\n await persistRemotes(manyObjectsPerRemote, clientId);\n }\n\n private async pushRemotesPendingDir(\n clientId: string,\n manyObjectsPerRemote: ObjectsPerRemote[],\n resumeExportId?: string\n ): Promise<void> {\n if (resumeExportId) {\n this.logger.debug('pushRemotesPendingDir - skip as the resumeExportId was passed');\n // no need to transfer the objects, they're already on the server. also, since this clientId\n // exists already on the remote pending-dir, it'll cause a collision.\n return;\n }\n const pushOptions = { clientId };\n const pushedRemotes: Remote[] = [];\n await mapSeries(manyObjectsPerRemote, async (objectsPerRemote: ObjectsPerRemote) => {\n const { remote, objectList } = objectsPerRemote;\n this.logger.setStatusLine(`transferring ${objectList.count()} objects to the remote \"${remote.name}\"...`);\n try {\n await remote.pushMany(objectList, pushOptions, {});\n this.logger.debug(\n 'pushRemotesPendingDir, successfully pushed all objects to the pending-dir directory on the remote'\n );\n pushedRemotes.push(remote);\n } catch (err: any) {\n this.logger.warn('exportMany, failed pushing objects to the remote');\n await removePendingDirs(pushedRemotes, clientId);\n throw err;\n }\n });\n }\n\n shouldPushToCentralHub(\n manyObjectsPerRemote: ObjectsPerRemote[],\n scopeRemotes: Remotes,\n originDirectly = false\n ): boolean {\n if (originDirectly) return false;\n const hubRemotes = manyObjectsPerRemote.filter((m) => scopeRemotes.isHub(m.remote.name));\n if (!hubRemotes.length) return false;\n if (hubRemotes.length === manyObjectsPerRemote.length) return true; // all are hub\n // @todo: maybe create a flag \"no-central\" to support this workflow\n throw new BitError(\n `some of your components are configured to be exported to a local scope and some to the bit.cloud hub. this is not supported`\n );\n }\n\n /**\n * Component and dependencies id changes:\n * When exporting components with dependencies to a bare-scope, some of the dependencies may be created locally and as\n * a result their scope-name is null. Before the bare-scope gets the components, convert these scope names\n * to the bare-scope name.\n *\n * This is the Harmony version of \"convertToCorrectScope\". No more codemod and no more hash changes.\n */\n private convertToCorrectScope(modelComponent: ModelComponent, remoteScope: string, ids: ComponentIdList): void {\n if (modelComponent.scope) return;\n const idWithFutureScope = ids.searchWithoutScopeAndVersion(modelComponent.toComponentId());\n modelComponent.scope = idWithFutureScope?.scope || remoteScope;\n }\n\n private async getComponentsToExport(\n ids: string[] = [],\n includeNonStaged?: boolean\n ): Promise<{\n idsToExport: ComponentIdList;\n missingScope: ComponentID[];\n laneObject?: Lane;\n }> {\n const consumer = this.workspace.consumer;\n const componentsList = new ComponentsList(this.workspace);\n const idsHaveWildcard = hasWildcard(ids);\n const throwForLocalOnlyIfNeeded = async (\n bitIds: ComponentIdList\n ): Promise<{ idsToExport: ComponentIdList; missingScope: ComponentID[] }> => {\n const localOnlyComponents = this.workspace.listLocalOnly();\n const localOnlyExportPending = bitIds.filter((id) => localOnlyComponents.hasWithoutScopeAndVersion(id));\n if (localOnlyExportPending.length) {\n throw new BitError(`unable to export the following components as they are local only:\n(either bit-reset them or run \"bit local-only unset\" to make them non local only)\n${localOnlyExportPending.map((c) => c.toString()).join('\\n')}`);\n }\n return { idsToExport: ComponentIdList.fromArray(bitIds), missingScope: [] };\n };\n if (isUserTryingToExportLanes(consumer)) {\n if (ids.length) {\n throw new BitError(`when checked out to a lane, all its components are exported. please omit the ids`);\n }\n const { componentsToExport, laneObject } = await this.getLaneCompIdsToExport(consumer, includeNonStaged);\n const loaderMsg = componentsToExport.length > 1 ? BEFORE_EXPORTS : BEFORE_EXPORT;\n this.logger.setStatusLine(loaderMsg);\n const filtered = await throwForLocalOnlyIfNeeded(componentsToExport);\n return { ...filtered, laneObject };\n }\n if (!ids.length || idsHaveWildcard) {\n this.logger.setStatusLine(BEFORE_LOADING_COMPONENTS);\n const exportPendingComponents: ComponentIdList = includeNonStaged\n ? await componentsList.listNonNewComponentsIds()\n : await componentsList.listExportPendingComponentsIds();\n const componentsToExport = idsHaveWildcard\n ? ComponentsList.filterComponentsByWildcard(exportPendingComponents, ids)\n : exportPendingComponents;\n const loaderMsg = componentsToExport.length > 1 ? BEFORE_EXPORTS : BEFORE_EXPORT;\n this.logger.setStatusLine(loaderMsg);\n return throwForLocalOnlyIfNeeded(componentsToExport);\n }\n this.logger.setStatusLine(BEFORE_EXPORT); // show single export\n const parsedIds = await Promise.all(ids.map((id) => getParsedId(consumer, id)));\n // an id that is not in the workspace should fail the export. (workspace.getMany below would\n // have loaded it from the scope instead of throwing)\n parsedIds.forEach((parsedId) => {\n if (!consumer.bitMap.getComponentIdIfExist(parsedId, { ignoreVersion: true })) {\n throw new MissingBitMapComponent(parsedId.toString());\n }\n });\n // load the components for fixing any out-of-sync issues.\n await this.workspace.getMany(parsedIds);\n\n return throwForLocalOnlyIfNeeded(ComponentIdList.fromArray(parsedIds));\n }\n\n private async getLaneCompIdsToExport(\n consumer: Consumer,\n includeNonStaged?: boolean\n ): Promise<{ componentsToExport: ComponentIdList; laneObject: Lane }> {\n const currentLaneId = consumer.getCurrentLaneId();\n const laneObject = await consumer.scope.loadLane(currentLaneId);\n if (!laneObject) {\n throw new Error(`fatal: unable to load the current lane object (${currentLaneId.toString()})`);\n }\n this.logger.setStatusLine(BEFORE_LOADING_COMPONENTS);\n const componentsList = new ComponentsList(this.workspace);\n const componentsToExportWithoutRemoved = includeNonStaged\n ? await componentsList.listNonNewComponentsIds()\n : await componentsList.listExportPendingComponentsIds(laneObject);\n const removedStagedBitIds = await this.getRemovedStagedBitIds();\n const componentsToExport = ComponentIdList.uniqFromArray([\n ...componentsToExportWithoutRemoved,\n ...removedStagedBitIds,\n ]);\n return { componentsToExport, laneObject };\n }\n\n private async getRemovedStagedBitIds(): Promise<ComponentIdList> {\n const removedStaged = await this.remove.getRemovedStaged();\n return ComponentIdList.fromArray(removedStaged.map((id) => id.changeVersion(undefined)));\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n CLIAspect,\n ScopeAspect,\n WorkspaceAspect,\n RemoveAspect,\n DependencyResolverAspect,\n LoggerAspect,\n EjectAspect,\n ];\n static async provider([cli, scope, workspace, remove, depResolver, loggerMain, eject]: [\n CLIMain,\n ScopeMain,\n Workspace,\n RemoveMain,\n DependencyResolverMain,\n LoggerMain,\n EjectMain,\n ]) {\n const logger = loggerMain.createLogger(ExportAspect.id);\n const exportMain = new ExportMain(workspace, remove, depResolver, logger, eject);\n cli.register(new ResumeExportCmd(scope, logger), new ExportCmd(exportMain));\n return exportMain;\n }\n}\n\nExportAspect.addRuntime(ExportMain);\n\n/**\n * the componentsIds passed here are the ones that didn't have scope-name before, and now they have.\n * so if the bitMap.updateComponentId returns bitId without scope-name is because it couldn't find it there\n */\nfunction _updateIdsOnBitMap(bitMap: BitMap, componentsIds: ComponentIdList): ComponentID[] {\n const updatedIds: ComponentID[] = [];\n componentsIds.forEach((componentsId) => {\n const resultId = bitMap.updateComponentId(componentsId, true);\n if (resultId.hasVersion()) updatedIds.push(resultId);\n });\n return updatedIds;\n}\n\nasync function getParsedId(consumer: Consumer, id: string): Promise<ComponentID> {\n // reason why not calling `consumer.getParsedId()` only is because a component might not be on\n // .bitmap and only in the scope. we support this case and enable to export\n try {\n return consumer.getParsedId(id);\n } catch {\n return consumer.scope.getParsedId(id);\n }\n}\n\nfunction _throwForUnsnappedLaneReadme(lane: Lane) {\n const readmeComponent = lane.readmeComponent as LaneReadmeComponent;\n\n const isValid =\n readmeComponent?.head &&\n lane.getComponent(readmeComponent.id) &&\n lane.getComponentHead(readmeComponent.id)?.isEqual(readmeComponent?.head);\n\n if (!isValid) {\n throw new BitError(\n `${lane?.name} has a readme component ${readmeComponent.id} that hasn't been snapped on the lane.\n Please run either snap -a or snap ${readmeComponent.id} to snap the component on the lane before exporting it.`\n );\n }\n}\n\nasync function updateLanesAfterExport(consumer: Consumer, lane: Lane) {\n const currentLane = consumer.getCurrentLaneId();\n const isCurrentLane = lane.name === currentLane.name;\n if (!isCurrentLane) {\n throw new Error(\n `updateLanesAfterExport should get called only with current lane, got ${lane.name}, current ${currentLane.name}`\n );\n }\n consumer.setCurrentLane(lane.toLaneId(), true);\n consumer.scope.scopeJson.removeLaneFromNew(lane.name);\n lane.isNew = false;\n}\n\nexport function isUserTryingToExportLanes(consumer: Consumer) {\n return consumer.isOnLane();\n}\n\n/**\n * a failed export leaves the objects in the pending-objects dir of every scope it was pushed to, but the\n * error tells only about the scope that failed (e.g. server-is-busy, which is thrown per scope). without\n * the full list, cleaning up a stuck export means guessing which other scopes hold the same pending dir.\n * only the client knows all the scopes of the export, so add them to the error.\n */\nfunction addScopesInvolvedToError(err: any, scopeNames: string[]): any {\n // guard against a non-error being thrown, in which case setting \"message\" would throw and hide the original error\n if (!scopeNames.length || typeof err?.message !== 'string') return err;\n err.message = `${err.message}\nthe following scopes were used for this export: ${scopeNames.join(', ')}`;\n return err;\n}\n\nexport default ExportMain;\n"],"mappings":";;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA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,IAAI,CAACA,UAAU,CAACjZ,MAAM,IAAI,OAAOsD,GAAG,EAAE4V,OAAO,KAAK,QAAQ,EAAE,OAAO5V,GAAG;EACtEA,GAAG,CAAC4V,OAAO,GAAG,GAAG5V,GAAG,CAAC4V,OAAO;AAC9B,kDAAkDD,UAAU,CAACvM,IAAI,CAAC,IAAI,CAAC,EAAE;EACvE,OAAOpJ,GAAG;AACZ;AAAC,IAAA6V,QAAA,GAAA1B,OAAA,CAAAxY,OAAA,GAEc0C,UAAU","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.scope_export@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.scope_export@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.scope_export@1.0.1197/dist/export.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.scope_export@1.0.1197/dist/export.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/export",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1197",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/scope/export",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.scope",
|
|
8
8
|
"name": "export",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1197"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -15,38 +15,38 @@
|
|
|
15
15
|
"p-map-series": "2.1.0",
|
|
16
16
|
"fs-extra": "10.0.0",
|
|
17
17
|
"yesno": "0.4.0",
|
|
18
|
-
"@teambit/cli": "0.0.1404",
|
|
19
18
|
"@teambit/component-id": "1.2.4",
|
|
20
19
|
"@teambit/legacy.constants": "0.0.46",
|
|
21
20
|
"@teambit/harmony.modules.concurrency": "0.0.47",
|
|
22
21
|
"@teambit/legacy.loader": "0.0.32",
|
|
23
22
|
"@teambit/legacy.logger": "0.0.63",
|
|
24
|
-
"@teambit/legacy.scope": "0.0.173",
|
|
25
|
-
"@teambit/scope.remote-actions": "0.0.173",
|
|
26
|
-
"@teambit/scope.remotes": "0.0.173",
|
|
27
23
|
"@teambit/toolbox.promise.map-pool": "0.0.21",
|
|
28
24
|
"@teambit/harmony": "0.4.12",
|
|
29
25
|
"@teambit/bit-error": "0.0.404",
|
|
30
26
|
"@teambit/component-version": "1.0.4",
|
|
31
|
-
"@teambit/component.snap-distance": "0.0.174",
|
|
32
27
|
"@teambit/harmony.modules.runtimes": "0.0.1",
|
|
33
28
|
"@teambit/lane-id": "0.0.312",
|
|
34
29
|
"@teambit/legacy-bit-id": "1.1.3",
|
|
35
30
|
"@teambit/legacy.analytics": "0.0.110",
|
|
36
|
-
"@teambit/legacy.bit-map": "0.0.230",
|
|
37
|
-
"@teambit/legacy.component-list": "0.0.227",
|
|
38
|
-
"@teambit/legacy.consumer": "0.0.173",
|
|
39
31
|
"@teambit/legacy.utils": "0.0.52",
|
|
40
32
|
"@teambit/logger": "0.0.1494",
|
|
41
|
-
"@teambit/
|
|
42
|
-
"@teambit/
|
|
43
|
-
"@teambit/legacy.scope
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
47
|
-
"@teambit/
|
|
48
|
-
"@teambit/
|
|
49
|
-
"@teambit/
|
|
33
|
+
"@teambit/cli": "0.0.1405",
|
|
34
|
+
"@teambit/eject": "1.0.1197",
|
|
35
|
+
"@teambit/legacy.scope": "0.0.174",
|
|
36
|
+
"@teambit/objects": "0.0.704",
|
|
37
|
+
"@teambit/scope.remote-actions": "0.0.174",
|
|
38
|
+
"@teambit/scope.remotes": "0.0.174",
|
|
39
|
+
"@teambit/component.snap-distance": "0.0.175",
|
|
40
|
+
"@teambit/dependency-resolver": "1.0.1197",
|
|
41
|
+
"@teambit/legacy.bit-map": "0.0.231",
|
|
42
|
+
"@teambit/legacy.component-list": "0.0.228",
|
|
43
|
+
"@teambit/legacy.consumer": "0.0.174",
|
|
44
|
+
"@teambit/remove": "1.0.1197",
|
|
45
|
+
"@teambit/scope.network": "0.0.174",
|
|
46
|
+
"@teambit/scope": "1.0.1197",
|
|
47
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.407",
|
|
48
|
+
"@teambit/workspace": "1.0.1197",
|
|
49
|
+
"@teambit/legacy.scope-api": "0.0.229"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/lodash": "4.14.165",
|