@teambit/component-writer 1.0.1174 → 1.0.1176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_compiler","_install","_logger","_workspace","_bitError","_fsExtra","_interopRequireDefault","_lodash","_pMapSeries","path","_interopRequireWildcard","_mover","_legacy","_legacy2","_component","_configMerger","_componentWriter","_componentWriter2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","ComponentWriterMain","constructor","installer","compiler","workspace","logger","mover","configMerge","consumer","writeMany","opts","components","length","debug","writeComponentsFiles","results","finalizeWrite","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","skipUpdatingBitMap","writeBitMap","reasonForBitmapChange","installationError","compilationError","workspaceConfigUpdateResult","writeDeps","writeDependencies","shouldUpdateWorkspaceConfig","updateDepsInWorkspaceConfig","mergeStrategy","externalPackageManagerIsUsed","writeDependenciesToPackageJson","skipDependencyInstallation","installPackagesGracefully","map","id","skipWriteConfigFiles","compileGracefully","componentIds","installOpts","dedupe","updateExisting","import","writeConfigFiles","dependenciesGraph","scope","getDependenciesGraphByComponentIds","install","undefined","err","consoleFailure","message","error","compileOnWorkspace","skipWritingToFs","dataToPersist","DataToPersist","forEach","component","merge","addBasePath","getPath","persistAllToFS","writeComponentsParams","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfEqual","fixDirsIfNested","relocateOccupiedDirs","Promise","all","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","componentConfigPath","join","rootDir","COMPONENT_CONFIG_FILE_NAME","componentConfigExist","fs","pathExists","writeConfig","resetConfig","config","mapSeries","allDirs","c","duplicatedDirs","filter","dir","d","uniqDuplicates","uniq","compDir","hasDuplication","compWriter","ownerName","includes","split","startsWith","incrementPathRecursively","push","parentsOfOthersComps","find","existingRootDirs","bitMap","getAllRootDirs","parentsOfOthersCompsDirs","allPaths","newPath","existingParent","existingChildren","replace","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","composeRelativeComponentPath","getComponentIfExist","ignoreVersion","writeToEmptyDir","throwErrorWhenDirectoryNotEmpty","componentMap","BitError","relativeWrittenPath","writtenPath","absoluteWrittenPath","toAbsolutePath","absoluteWriteToPath","moveExistingComponent","shouldSkipDirConflictCheck","componentDirRelative","componentDir","pathExistsSync","compInTheSameDir","getComponentIdByRootPath","toString","isDir","isDirEmptySync","throwForExistingDir","takenDirs","Set","currentDir","unavailableReason","getDirUnavailableReason","num","candidate","consoleWarning","add","usedByComponent","isEqualWithoutVersion","provider","loggerMain","configMerger","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","ConfigMergerAspect","MainRuntime","addRuntime","_default","p","incrementPath","str","number"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { CompilerMain } from '@teambit/compiler';\nimport { CompilerAspect } from '@teambit/compiler';\nimport type { InstallMain } from '@teambit/install';\nimport { InstallAspect } from '@teambit/install';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport fs from 'fs-extra';\nimport { uniq } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport * as path from 'path';\nimport type { MoverMain } from '@teambit/mover';\nimport { MoverAspect } from '@teambit/mover';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { PathLinuxRelative } from '@teambit/legacy.utils';\nimport { isDir, isDirEmptySync, pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport { COMPONENT_CONFIG_FILE_NAME } from '@teambit/legacy.constants';\nimport { DataToPersist } from '@teambit/component.sources';\nimport type { ConfigMergerMain, WorkspaceConfigUpdateResult } from '@teambit/config-merger';\nimport { ConfigMergerAspect } from '@teambit/config-merger';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { ComponentWriterProps } from './component-writer';\nimport ComponentWriter from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n components: ConsumerComponent[];\n writeToPath?: string;\n throwForExistingDir?: boolean;\n // when the target dir is occupied, import into an available empty dir (e.g. \"foo\" => \"foo_1\") instead of failing.\n writeToEmptyDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n skipWritingToFs?: boolean;\n skipUpdatingBitMap?: boolean;\n skipWriteConfigFiles?: boolean;\n reasonForBitmapChange?: string; // optional. will be written in the bitmap-history-metadata\n shouldUpdateWorkspaceConfig?: boolean; // whether it should update dependencies policy (or leave conflicts) in workspace.jsonc\n mergeStrategy?: MergeStrategy; // needed for workspace.jsonc conflicts\n writeDeps?: 'package.json' | 'workspace.jsonc';\n}\n\nexport type ComponentWriterResults = {\n installationError?: Error;\n compilationError?: Error;\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n};\n\nexport class ComponentWriterMain {\n constructor(\n private installer: InstallMain,\n private compiler: CompilerMain,\n private workspace: Workspace,\n private logger: Logger,\n private mover: MoverMain,\n private configMerge: ConfigMergerMain\n ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n if (!opts.components.length) return {};\n this.logger.debug('writeMany, started');\n await this.writeComponentsFiles(opts);\n const results = await this.finalizeWrite(opts);\n this.logger.debug('writeMany, completed!');\n return results;\n }\n\n /**\n * Per-batch half of {@link writeMany}: populate, persist, and update .bitmap.\n * Callers batching very large imports call this per chunk, then {@link finalizeWrite} once.\n */\n async writeComponentsFiles(opts: ManyComponentsWriterParams): Promise<void> {\n if (!opts.components.length) return;\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n if (!opts.skipUpdatingBitMap) await this.consumer.writeBitMap(opts.reasonForBitmapChange);\n }\n\n /**\n * Workspace-wide finalization pair to {@link writeComponentsFiles}: workspace.jsonc update,\n * dep install, compile. Runs once per import, not per batch.\n */\n async finalizeWrite(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n if (!opts.components.length) return {};\n let installationError: Error | undefined;\n let compilationError: Error | undefined;\n let workspaceConfigUpdateResult: WorkspaceConfigUpdateResult | undefined;\n if (opts.writeDeps) {\n await this.workspace.writeDependencies(opts.writeDeps);\n }\n if (opts.shouldUpdateWorkspaceConfig) {\n workspaceConfigUpdateResult = await this.configMerge.updateDepsInWorkspaceConfig(\n opts.components,\n opts.mergeStrategy\n );\n }\n if (this.workspace.externalPackageManagerIsUsed()) {\n await this.installer.writeDependenciesToPackageJson();\n } else if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully(\n opts.components.map(({ id }) => id),\n opts.skipWriteConfigFiles\n );\n // no point to compile if the installation is not running. the environment is not ready.\n compilationError = await this.compileGracefully();\n }\n return { installationError, compilationError, workspaceConfigUpdateResult };\n }\n\n private async installPackagesGracefully(\n componentIds: ComponentID[],\n skipWriteConfigFiles = false\n ): Promise<Error | undefined> {\n this.logger.debug('installPackagesGracefully, start installing packages');\n try {\n const installOpts = {\n dedupe: true,\n updateExisting: false,\n import: false,\n writeConfigFiles: !skipWriteConfigFiles,\n dependenciesGraph: await this.workspace.scope.getDependenciesGraphByComponentIds(componentIds),\n };\n await this.installer.install(undefined, installOpts);\n this.logger.debug('installPackagesGracefully, completed installing packages successfully');\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`installation failed with the following error: ${err.message}`);\n this.logger.error('installPackagesGracefully, package-installer found an error', err);\n return err;\n }\n }\n private async compileGracefully(): Promise<Error | undefined> {\n try {\n await this.compiler.compileOnWorkspace();\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`compilation failed with the following error: ${err.message}`);\n this.logger.error('compileGracefully, compiler found an error', err);\n return err;\n }\n }\n private async persistComponentsData(opts: ManyComponentsWriterParams) {\n if (opts.skipWritingToFs) return;\n const dataToPersist = new DataToPersist();\n opts.components.forEach((component) => dataToPersist.merge(component.dataToPersist));\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n }\n private async populateComponentsFilesToWrite(opts: ManyComponentsWriterParams) {\n const writeComponentsParams = opts.components.map((component) =>\n this.getWriteParamsOfOneComponent(component, opts)\n );\n const componentWriterInstances = writeComponentsParams.map((writeParams) => new ComponentWriter(writeParams));\n this.fixDirsIfEqual(componentWriterInstances);\n this.fixDirsIfNested(componentWriterInstances);\n // must run after the fixDirs* passes above, which may still move writeToPath onto an occupied dir.\n this.relocateOccupiedDirs(componentWriterInstances, opts);\n // add componentMap entries into .bitmap before starting the process because steps like writing package-json\n // rely on .bitmap to determine whether a dependency exists and what's its origin\n await Promise.all(\n componentWriterInstances.map(async (componentWriter: ComponentWriter) => {\n componentWriter.existingComponentMap =\n componentWriter.existingComponentMap ||\n (await componentWriter.addComponentToBitMap(componentWriter.writeToPath));\n const componentConfigPath = path.join(\n this.workspace.path,\n componentWriter.existingComponentMap.rootDir,\n COMPONENT_CONFIG_FILE_NAME\n );\n const componentConfigExist = await fs.pathExists(componentConfigPath);\n componentWriter.writeConfig = componentWriter.writeConfig || componentConfigExist;\n })\n );\n if (opts.resetConfig) {\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n delete componentWriter.existingComponentMap?.config;\n });\n }\n await mapSeries(componentWriterInstances, (componentWriter: ComponentWriter) =>\n componentWriter.populateComponentsFilesToWrite()\n );\n }\n\n /**\n * this started to be an issue once same-name different-scope is supported.\n * by default, the component-dir consist of the scope-name part of the scope-id, without the owner part.\n * as a result, it's possible that multiple components have the same name, same scope-name but different owner.\n * e.g. org1.ui/button and org2.ui/button. the component-dir for both is \"ui/button\".\n * in this case, we try to prefix the component-dir with the owner-name and if not possible, just increment it (ui/button_1)\n */\n private fixDirsIfEqual(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n const duplicatedDirs = allDirs.filter((dir) => allDirs.filter((d) => d === dir).length > 1);\n if (!duplicatedDirs.length) return;\n const uniqDuplicates = uniq(duplicatedDirs);\n uniqDuplicates.forEach((compDir) => {\n const hasDuplication = componentWriterInstances.filter((compWriter) => compWriter.writeToPath === compDir);\n hasDuplication.forEach((compWriter) => {\n const ownerName = compWriter.component.id.scope?.includes('.')\n ? compWriter.component.id.scope.split('.')[0]\n : undefined;\n if (ownerName && !compDir.startsWith(ownerName) && !allDirs.includes(`${ownerName}/${compDir}`)) {\n compWriter.writeToPath = `${ownerName}/${compDir}`;\n } else {\n compWriter.writeToPath = incrementPathRecursively(compWriter.writeToPath, allDirs);\n }\n allDirs.push(compWriter.writeToPath);\n });\n });\n }\n\n /**\n * e.g. [bar, bar/foo] => [bar_1, bar/foo]\n * otherwise, the bar/foo component will be saved inside \"bar\" component.\n * in case bar_1 is taken, increment to bar_2 until the name is available.\n */\n private fixDirsIfNested(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n\n // get all components that their root-dir is a parent of other components root-dir.\n const parentsOfOthersComps = componentWriterInstances.filter(({ writeToPath }) =>\n allDirs.find((d) => d.startsWith(`${writeToPath}/`))\n );\n const existingRootDirs = this.workspace.bitMap.getAllRootDirs();\n const parentsOfOthersCompsDirs = parentsOfOthersComps.map((c) => c.writeToPath);\n const allPaths: PathLinuxRelative[] = [...existingRootDirs, ...parentsOfOthersCompsDirs];\n\n // this is when writing multiple components and some of them are parents of the others.\n // change the paths of all these parents root-dir to not collide with the children root-dir\n parentsOfOthersComps.forEach((componentWriter) => {\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementPathRecursively(componentWriter.writeToPath, allPaths);\n componentWriter.writeToPath = newPath;\n });\n\n // this part is when a component's rootDir we about to write is a children of an existing rootDir.\n // e.g. we're now writing \"foo\", when an existing component has \"foo/bar\" as the rootDir.\n // in this case, we change \"foo\" to be \"foo_1\".\n componentWriterInstances.forEach((componentWriter) => {\n const existingParent = existingRootDirs.find((d) => d.startsWith(`${componentWriter.writeToPath}/`));\n if (!existingParent) return;\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementPathRecursively(componentWriter.writeToPath, allPaths);\n componentWriter.writeToPath = newPath;\n });\n\n // this part if when for example an existing rootDir is \"comp1\" and currently written component is \"comp1/foo\".\n // obviously we don't want to change existing dirs. we change the \"comp1/foo\" to be \"comp1_1/foo\".\n componentWriterInstances.forEach((componentWriter) => {\n const existingChildren = existingRootDirs.find((d) => componentWriter.writeToPath.startsWith(`${d}/`));\n if (!existingChildren) return;\n // we increment the existing one, because it is used to replace the base-path of the current component\n const newPath = incrementPathRecursively(existingChildren, allPaths);\n componentWriter.writeToPath = componentWriter.writeToPath.replace(existingChildren, newPath);\n });\n }\n\n private getWriteParamsOfOneComponent(\n component: ConsumerComponent,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n const componentRootDir: PathLinuxRelative = opts.writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(opts.writeToPath)))\n : this.consumer.composeRelativeComponentPath(component.id);\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const existingComponentMap = this.consumer?.bitMap.getComponentIfExist(component.id, { ignoreVersion: true });\n // with --write-to-empty-dir, dir-conflict resolution is deferred to relocateOccupiedDirs() so it runs after the\n // fixDirs* passes (which may still adjust writeToPath); otherwise fail here when the target dir is occupied.\n if (this.consumer && !opts.writeToEmptyDir) {\n this.throwErrorWhenDirectoryNotEmpty(componentRootDir, existingComponentMap, opts);\n }\n return {\n workspace: this.workspace,\n bitMap: this.consumer.bitMap,\n component,\n writeToPath: componentRootDir,\n writeConfig: opts.writeConfig,\n skipUpdatingBitMap: opts.skipUpdatingBitMap,\n existingComponentMap: existingComponentMap ?? undefined,\n };\n }\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (opts.writeToPath && this.consumer) {\n opts.components.forEach((component) => {\n const componentMap = component.componentMap as ComponentMap;\n if (!componentMap.rootDir) {\n throw new BitError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(opts.writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n /**\n * true when the directory-conflict check can be skipped: either nothing is written to the filesystem, or the\n * target directory already belongs to this exact component (so overriding it in place is safe).\n */\n private shouldSkipDirConflictCheck(\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ): boolean {\n if (opts.skipWritingToFs) return true;\n if (!componentMap) return false;\n // no writeToPath: it goes to the default directory. an existing componentMap means the component is not new.\n if (!opts.writeToPath) return true;\n // writeToPath specified and that directory is already used for that component. compare against the\n // normalized componentDirRelative (not the raw opts.writeToPath, which may be absolute/OS-specific).\n return componentMap.rootDir === componentDirRelative;\n }\n\n private throwErrorWhenDirectoryNotEmpty(\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n if (this.shouldSkipDirConflictCheck(componentDirRelative, componentMap, opts)) return;\n\n const componentDir = this.consumer.toAbsolutePath(componentDirRelative);\n if (!fs.pathExistsSync(componentDir)) return;\n if (!componentMap) {\n const compInTheSameDir = this.consumer.bitMap.getComponentIdByRootPath(componentDirRelative);\n if (compInTheSameDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is already used by ${compInTheSameDir.toString()}.\neither use --path to specify a different directory or modify \"defaultDirectory\" prop in the workspace.jsonc file to \"{scopeId}/{name}\"`\n );\n }\n }\n if (!isDir(componentDir)) {\n throw new BitError(`unable to import to ${componentDir} because it's a file`);\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n\n /**\n * final `writeToPath` resolution for the `--write-to-empty-dir` import flag, mainly for non-interactive clients\n * (such as the IDE) that can't prompt for `--override`. runs after fixDirsIfEqual()/fixDirsIfNested() - which may\n * still move dirs using string-only collision checks - so the flag's guarantee holds against the final paths:\n * every relocated component lands in a directory that is empty (or non-existent) and unclaimed in .bitmap.\n * when a target is occupied (by foreign files, or a dir/rootDir owned by another component), it's relocated by\n * suffixing \"_N\" (e.g. \"renderers/class\" => \"renderers/class_1\"). a dir already owned by this component is left\n * as-is (its files are overridden, same as the default import behavior).\n */\n private relocateOccupiedDirs(componentWriterInstances: ComponentWriter[], opts: ManyComponentsWriterParams) {\n if (!opts.writeToEmptyDir) return;\n // track dirs already claimed in .bitmap and by other components in this batch, so two relocations never collide.\n const takenDirs = new Set<string>([\n ...this.workspace.bitMap.getAllRootDirs(),\n ...componentWriterInstances.map((componentWriter) => componentWriter.writeToPath),\n ]);\n componentWriterInstances.forEach((componentWriter) => {\n const currentDir = componentWriter.writeToPath;\n const componentMap = componentWriter.existingComponentMap;\n if (this.shouldSkipDirConflictCheck(currentDir, componentMap, opts)) return;\n const unavailableReason = this.getDirUnavailableReason(currentDir, componentMap);\n if (!unavailableReason) return;\n\n let num = 1;\n let candidate = `${currentDir}_${num}`;\n while (takenDirs.has(candidate) || this.getDirUnavailableReason(candidate, componentMap)) {\n num += 1;\n candidate = `${currentDir}_${num}`;\n }\n this.logger.consoleWarning(\n `unable to import into \"${currentDir}\" (${unavailableReason}), importing into \"${candidate}\" instead`\n );\n componentWriter.writeToPath = candidate;\n takenDirs.add(candidate);\n });\n }\n\n /**\n * returns a human-readable reason why the given directory can't be used for import, or undefined when it's\n * available. a directory is available when it doesn't exist yet, or it's an empty directory that is not already\n * used by another component in the .bitmap file.\n */\n private getDirUnavailableReason(\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined\n ): string | undefined {\n // a rootDir may be claimed in .bitmap even when its directory was deleted from the filesystem, so check\n // .bitmap ownership regardless of whether the directory currently exists on disk. it's only ok to reuse the\n // rootDir when it's claimed by the same component we're importing (comparing without version).\n const usedByComponent = this.consumer.bitMap.getComponentIdByRootPath(componentDirRelative);\n if (usedByComponent && !(componentMap && usedByComponent.isEqualWithoutVersion(componentMap.id))) {\n return `it is already used by ${usedByComponent.toString()}`;\n }\n const componentDir = this.consumer.toAbsolutePath(componentDirRelative);\n if (!fs.pathExistsSync(componentDir)) return undefined;\n if (!isDir(componentDir)) return 'it is a file';\n if (!isDirEmptySync(componentDir)) return 'the directory is not empty';\n return undefined;\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect, ConfigMergerAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover, configMerger]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain,\n ConfigMergerMain,\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover, configMerger);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n\nexport function incrementPathRecursively(p: string, allPaths: string[]) {\n const incrementPath = (str: string, number: number) => `${str}_${number}`;\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAQ,sBAAA,CAAAP,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,QAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,OAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,YAAA;EAAA,MAAAV,IAAA,GAAAQ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ACE,YAAY,CAACC,yCAAqB,CAAC3H,EAAE,CAAC;IAChE,OAAO,IAAIpC,mBAAmB,CAACgD,OAAO,EAAE7C,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEuJ,YAAY,CAAC;EAC3F;AACF;AAACG,OAAA,CAAAhK,mBAAA,GAAAA,mBAAA;AAAAZ,eAAA,CA1XYY,mBAAmB,WA4Wf,EAAE;AAAAZ,eAAA,CA5WNY,mBAAmB,kBA6WR,CAACiK,wBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,4BAAe,EAAEC,oBAAW,EAAEC,kCAAkB,CAAC;AAAAlL,eAAA,CA7W1GY,mBAAmB,aA8WbuK,kBAAW;AAc9BR,yCAAqB,CAACS,UAAU,CAACxK,mBAAmB,CAAC;AAAC,IAAAyK,QAAA,GAAAT,OAAA,CAAArL,OAAA,GAEvCqB,mBAAmB;AAE3B,SAASwG,wBAAwBA,CAACkE,CAAS,EAAE1D,QAAkB,EAAE;EACtE,MAAM2D,aAAa,GAAGA,CAACC,GAAW,EAAEC,MAAc,KAAK,GAAGD,GAAG,IAAIC,MAAM,EAAE;EACzE,IAAIxB,GAAG,GAAG,CAAC;EACX,IAAIpC,OAAO,GAAG0D,aAAa,CAACD,CAAC,EAAErB,GAAG,CAAC;EACnC,OAAOrC,QAAQ,CAACX,QAAQ,CAACY,OAAO,CAAC,EAAE;IACjCA,OAAO,GAAG0D,aAAa,CAACD,CAAC,EAAGrB,GAAG,IAAI,CAAE,CAAC;EACxC;EACA,OAAOpC,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_compiler","_install","_logger","_workspace","_bitError","_fsExtra","_interopRequireDefault","_lodash","_pMapSeries","path","_interopRequireWildcard","_mover","_legacy","_legacy2","_workspaceRoot","_legacy3","_component","_configMerger","_componentWriter","_componentWriter2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","ComponentWriterMain","constructor","installer","compiler","workspace","logger","mover","configMerge","consumer","writeMany","opts","components","length","debug","writeComponentsFiles","results","finalizeWrite","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","skipUpdatingBitMap","writeBitMap","reasonForBitmapChange","installationError","compilationError","workspaceConfigUpdateResult","writeDeps","writeDependencies","shouldUpdateWorkspaceConfig","updateDepsInWorkspaceConfig","mergeStrategy","externalPackageManagerIsUsed","writeDependenciesToPackageJson","skipDependencyInstallation","installPackagesGracefully","map","id","skipWriteConfigFiles","compileGracefully","componentIds","installOpts","dedupe","updateExisting","import","writeConfigFiles","dependenciesGraph","scope","getDependenciesGraphByComponentIds","install","undefined","err","consoleFailure","message","error","compileOnWorkspace","skipWritingToFs","dataToPersist","DataToPersist","forEach","component","merge","addBasePath","getPath","persistAllToFS","writeComponentsParams","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfEqual","fixDirsIfNested","relocateOccupiedDirs","Promise","all","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","componentConfigPath","join","rootDir","COMPONENT_CONFIG_FILE_NAME","componentConfigExist","fs","pathExists","writeConfig","resetConfig","config","mapSeries","allDirs","c","duplicatedDirs","filter","dir","d","uniqDuplicates","uniq","compDir","hasDuplication","compWriter","ownerName","includes","split","startsWith","incrementPathRecursively","push","parentsOfOthersComps","find","existingRootDirs","bitMap","getAllRootDirs","parentsOfOthersCompsDirs","allPaths","newPath","existingParent","existingChildren","replace","getWriteToPath","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","WORKSPACE_ROOT_DIR","composeRelativeComponentPath","getComponentIfExist","ignoreVersion","throwForNonWorkspaceRootComponent","throwForSymlinksInTheWay","writeToEmptyDir","throwErrorWhenDirectoryNotEmpty","writeToPathPerId","toStringWithoutVersion","componentMap","BitError","relativeWrittenPath","writtenPath","absoluteWrittenPath","toAbsolutePath","absoluteWriteToPath","toString","moveExistingComponent","shouldSkipDirConflictCheck","componentDirRelative","filesThatWouldLand","nestedRootDirs","getNestedRootDirs","files","file","relativePath","relative","isWorkspaceMapFile","isOwnedByNestedComponent","pathsInTheWay","Set","landing","existsSync","segments","_","index","add","slice","pathInTheWay","stat","lstatIfExists","isSymbolicLink","isWorkspaceRootComponent","extensions","throwForOccupiedWorkspaceRoot","throwForExistingDir","isFreshWorkspace","generatedByInit","WORKSPACE_JSONC","filesToOverwrite","absolutePath","isFile","readFileSync","contents","shown","rest","componentDir","pathExistsSync","compInTheSameDir","getComponentIdByRootPath","isDir","isDirEmptySync","takenDirs","currentDir","unavailableReason","getDirUnavailableReason","num","candidate","consoleWarning","usedByComponent","isEqualWithoutVersion","provider","loggerMain","configMerger","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","ConfigMergerAspect","MainRuntime","addRuntime","_default","p","incrementPath","str","number","lstatSync","code"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport type { ComponentID } from '@teambit/component-id';\nimport type { CompilerMain } from '@teambit/compiler';\nimport { CompilerAspect } from '@teambit/compiler';\nimport type { InstallMain } from '@teambit/install';\nimport { InstallAspect } from '@teambit/install';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport fs from 'fs-extra';\nimport { uniq } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport * as path from 'path';\nimport type { MoverMain } from '@teambit/mover';\nimport { MoverAspect } from '@teambit/mover';\nimport type { ConsumerComponent } from '@teambit/legacy.consumer-component';\nimport type { PathLinuxRelative } from '@teambit/legacy.utils';\nimport { isDir, isDirEmptySync, pathNormalizeToLinux } from '@teambit/legacy.utils';\nimport type { ComponentMap } from '@teambit/legacy.bit-map';\nimport { isWorkspaceMapFile, WORKSPACE_ROOT_DIR } from '@teambit/legacy.bit-map';\nimport { isWorkspaceRootComponent } from '@teambit/workspace-root';\nimport { COMPONENT_CONFIG_FILE_NAME, WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport { DataToPersist } from '@teambit/component.sources';\nimport type { ConfigMergerMain, WorkspaceConfigUpdateResult } from '@teambit/config-merger';\nimport { ConfigMergerAspect } from '@teambit/config-merger';\nimport type { MergeStrategy } from '@teambit/component.modules.merge-helper';\nimport type { Consumer } from '@teambit/legacy.consumer';\nimport type { ComponentWriterProps } from './component-writer';\nimport ComponentWriter, { isOwnedByNestedComponent } from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n components: ConsumerComponent[];\n writeToPath?: string;\n /**\n * a directory per component, keyed by the id without its version, for writing a set of components\n * that each go to its own place - as \"--path\" does for a whole batch. a component the map does not\n * name falls back to writeToPath, and then to the default directory.\n */\n writeToPathPerId?: Record<string, string>;\n throwForExistingDir?: boolean;\n // when the target dir is occupied, import into an available empty dir (e.g. \"foo\" => \"foo_1\") instead of failing.\n writeToEmptyDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n skipWritingToFs?: boolean;\n skipUpdatingBitMap?: boolean;\n skipWriteConfigFiles?: boolean;\n reasonForBitmapChange?: string; // optional. will be written in the bitmap-history-metadata\n shouldUpdateWorkspaceConfig?: boolean; // whether it should update dependencies policy (or leave conflicts) in workspace.jsonc\n mergeStrategy?: MergeStrategy; // needed for workspace.jsonc conflicts\n writeDeps?: 'package.json' | 'workspace.jsonc';\n}\n\nexport type ComponentWriterResults = {\n installationError?: Error;\n compilationError?: Error;\n workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;\n};\n\nexport class ComponentWriterMain {\n constructor(\n private installer: InstallMain,\n private compiler: CompilerMain,\n private workspace: Workspace,\n private logger: Logger,\n private mover: MoverMain,\n private configMerge: ConfigMergerMain\n ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n if (!opts.components.length) return {};\n this.logger.debug('writeMany, started');\n await this.writeComponentsFiles(opts);\n const results = await this.finalizeWrite(opts);\n this.logger.debug('writeMany, completed!');\n return results;\n }\n\n /**\n * Per-batch half of {@link writeMany}: populate, persist, and update .bitmap.\n * Callers batching very large imports call this per chunk, then {@link finalizeWrite} once.\n */\n async writeComponentsFiles(opts: ManyComponentsWriterParams): Promise<void> {\n if (!opts.components.length) return;\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n if (!opts.skipUpdatingBitMap) await this.consumer.writeBitMap(opts.reasonForBitmapChange);\n }\n\n /**\n * Workspace-wide finalization pair to {@link writeComponentsFiles}: workspace.jsonc update,\n * dep install, compile. Runs once per import, not per batch.\n */\n async finalizeWrite(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n if (!opts.components.length) return {};\n let installationError: Error | undefined;\n let compilationError: Error | undefined;\n let workspaceConfigUpdateResult: WorkspaceConfigUpdateResult | undefined;\n if (opts.writeDeps) {\n await this.workspace.writeDependencies(opts.writeDeps);\n }\n if (opts.shouldUpdateWorkspaceConfig) {\n workspaceConfigUpdateResult = await this.configMerge.updateDepsInWorkspaceConfig(\n opts.components,\n opts.mergeStrategy\n );\n }\n if (this.workspace.externalPackageManagerIsUsed()) {\n await this.installer.writeDependenciesToPackageJson();\n } else if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully(\n opts.components.map(({ id }) => id),\n opts.skipWriteConfigFiles\n );\n // no point to compile if the installation is not running. the environment is not ready.\n compilationError = await this.compileGracefully();\n }\n return { installationError, compilationError, workspaceConfigUpdateResult };\n }\n\n private async installPackagesGracefully(\n componentIds: ComponentID[],\n skipWriteConfigFiles = false\n ): Promise<Error | undefined> {\n this.logger.debug('installPackagesGracefully, start installing packages');\n try {\n const installOpts = {\n dedupe: true,\n updateExisting: false,\n import: false,\n writeConfigFiles: !skipWriteConfigFiles,\n dependenciesGraph: await this.workspace.scope.getDependenciesGraphByComponentIds(componentIds),\n };\n await this.installer.install(undefined, installOpts);\n this.logger.debug('installPackagesGracefully, completed installing packages successfully');\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`installation failed with the following error: ${err.message}`);\n this.logger.error('installPackagesGracefully, package-installer found an error', err);\n return err;\n }\n }\n private async compileGracefully(): Promise<Error | undefined> {\n try {\n await this.compiler.compileOnWorkspace();\n return undefined;\n } catch (err: any) {\n this.logger.consoleFailure(`compilation failed with the following error: ${err.message}`);\n this.logger.error('compileGracefully, compiler found an error', err);\n return err;\n }\n }\n private async persistComponentsData(opts: ManyComponentsWriterParams) {\n if (opts.skipWritingToFs) return;\n const dataToPersist = new DataToPersist();\n opts.components.forEach((component) => dataToPersist.merge(component.dataToPersist));\n dataToPersist.addBasePath(this.consumer.getPath());\n await dataToPersist.persistAllToFS();\n }\n private async populateComponentsFilesToWrite(opts: ManyComponentsWriterParams) {\n const writeComponentsParams = opts.components.map((component) =>\n this.getWriteParamsOfOneComponent(component, opts)\n );\n const componentWriterInstances = writeComponentsParams.map((writeParams) => new ComponentWriter(writeParams));\n this.fixDirsIfEqual(componentWriterInstances);\n this.fixDirsIfNested(componentWriterInstances);\n // must run after the fixDirs* passes above, which may still move writeToPath onto an occupied dir.\n this.relocateOccupiedDirs(componentWriterInstances, opts);\n // add componentMap entries into .bitmap before starting the process because steps like writing package-json\n // rely on .bitmap to determine whether a dependency exists and what's its origin\n await Promise.all(\n componentWriterInstances.map(async (componentWriter: ComponentWriter) => {\n componentWriter.existingComponentMap =\n componentWriter.existingComponentMap ||\n (await componentWriter.addComponentToBitMap(componentWriter.writeToPath));\n const componentConfigPath = path.join(\n this.workspace.path,\n componentWriter.existingComponentMap.rootDir,\n COMPONENT_CONFIG_FILE_NAME\n );\n const componentConfigExist = await fs.pathExists(componentConfigPath);\n componentWriter.writeConfig = componentWriter.writeConfig || componentConfigExist;\n })\n );\n if (opts.resetConfig) {\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n delete componentWriter.existingComponentMap?.config;\n });\n }\n await mapSeries(componentWriterInstances, (componentWriter: ComponentWriter) =>\n componentWriter.populateComponentsFilesToWrite()\n );\n }\n\n /**\n * this started to be an issue once same-name different-scope is supported.\n * by default, the component-dir consist of the scope-name part of the scope-id, without the owner part.\n * as a result, it's possible that multiple components have the same name, same scope-name but different owner.\n * e.g. org1.ui/button and org2.ui/button. the component-dir for both is \"ui/button\".\n * in this case, we try to prefix the component-dir with the owner-name and if not possible, just increment it (ui/button_1)\n */\n private fixDirsIfEqual(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n const duplicatedDirs = allDirs.filter((dir) => allDirs.filter((d) => d === dir).length > 1);\n if (!duplicatedDirs.length) return;\n const uniqDuplicates = uniq(duplicatedDirs);\n uniqDuplicates.forEach((compDir) => {\n const hasDuplication = componentWriterInstances.filter((compWriter) => compWriter.writeToPath === compDir);\n hasDuplication.forEach((compWriter) => {\n const ownerName = compWriter.component.id.scope?.includes('.')\n ? compWriter.component.id.scope.split('.')[0]\n : undefined;\n if (ownerName && !compDir.startsWith(ownerName) && !allDirs.includes(`${ownerName}/${compDir}`)) {\n compWriter.writeToPath = `${ownerName}/${compDir}`;\n } else {\n compWriter.writeToPath = incrementPathRecursively(compWriter.writeToPath, allDirs);\n }\n allDirs.push(compWriter.writeToPath);\n });\n });\n }\n\n /**\n * e.g. [bar, bar/foo] => [bar_1, bar/foo]\n * otherwise, the bar/foo component will be saved inside \"bar\" component.\n * in case bar_1 is taken, increment to bar_2 until the name is available.\n */\n private fixDirsIfNested(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n\n // get all components that their root-dir is a parent of other components root-dir.\n const parentsOfOthersComps = componentWriterInstances.filter(({ writeToPath }) =>\n allDirs.find((d) => d.startsWith(`${writeToPath}/`))\n );\n const existingRootDirs = this.workspace.bitMap.getAllRootDirs();\n const parentsOfOthersCompsDirs = parentsOfOthersComps.map((c) => c.writeToPath);\n const allPaths: PathLinuxRelative[] = [...existingRootDirs, ...parentsOfOthersCompsDirs];\n\n // this is when writing multiple components and some of them are parents of the others.\n // change the paths of all these parents root-dir to not collide with the children root-dir\n parentsOfOthersComps.forEach((componentWriter) => {\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementPathRecursively(componentWriter.writeToPath, allPaths);\n componentWriter.writeToPath = newPath;\n });\n\n // this part is when a component's rootDir we about to write is a children of an existing rootDir.\n // e.g. we're now writing \"foo\", when an existing component has \"foo/bar\" as the rootDir.\n // in this case, we change \"foo\" to be \"foo_1\".\n componentWriterInstances.forEach((componentWriter) => {\n const existingParent = existingRootDirs.find((d) => d.startsWith(`${componentWriter.writeToPath}/`));\n if (!existingParent) return;\n if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.\n const newPath = incrementPathRecursively(componentWriter.writeToPath, allPaths);\n componentWriter.writeToPath = newPath;\n });\n\n // this part if when for example an existing rootDir is \"comp1\" and currently written component is \"comp1/foo\".\n // obviously we don't want to change existing dirs. we change the \"comp1/foo\" to be \"comp1_1/foo\".\n componentWriterInstances.forEach((componentWriter) => {\n const existingChildren = existingRootDirs.find((d) => componentWriter.writeToPath.startsWith(`${d}/`));\n if (!existingChildren) return;\n // we increment the existing one, because it is used to replace the base-path of the current component\n const newPath = incrementPathRecursively(existingChildren, allPaths);\n componentWriter.writeToPath = componentWriter.writeToPath.replace(existingChildren, newPath);\n });\n }\n\n private getWriteParamsOfOneComponent(\n component: ConsumerComponent,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n // \"--path .\" resolves to an empty relative path. normalize it to \".\" so it is a real rootDir\n // rather than a falsy one that later turns into an undefined path segment.\n const writeToPath = this.getWriteToPath(component, opts);\n const componentRootDir: PathLinuxRelative = writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(writeToPath))) || WORKSPACE_ROOT_DIR\n : this.consumer.composeRelativeComponentPath(component.id);\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const existingComponentMap = this.consumer?.bitMap.getComponentIfExist(component.id, { ignoreVersion: true });\n // a component already tracked at the root is written there whatever path was derived above, e.g. by\n // a checkout or a re-import, so the guards of the root run for it as well\n if (componentRootDir === WORKSPACE_ROOT_DIR || existingComponentMap?.rootDir === WORKSPACE_ROOT_DIR) {\n this.throwForNonWorkspaceRootComponent(component);\n // the symlink rule is about where a write lands, and --track-only writes nothing (skipWritingToFs)\n if (!opts.skipWritingToFs) this.throwForSymlinksInTheWay(component, opts.writeConfig);\n }\n // with --write-to-empty-dir, dir-conflict resolution is deferred to relocateOccupiedDirs() so it runs after the\n // fixDirs* passes (which may still adjust writeToPath); otherwise fail here when the target dir is occupied.\n // the workspace root is never relocated (see relocateOccupiedDirs), so its own check runs either way.\n if (this.consumer && (!opts.writeToEmptyDir || componentRootDir === WORKSPACE_ROOT_DIR)) {\n this.throwErrorWhenDirectoryNotEmpty(component, componentRootDir, existingComponentMap, opts);\n }\n return {\n workspace: this.workspace,\n bitMap: this.consumer.bitMap,\n component,\n writeToPath: componentRootDir,\n writeConfig: opts.writeConfig,\n skipUpdatingBitMap: opts.skipUpdatingBitMap,\n existingComponentMap: existingComponentMap ?? undefined,\n };\n }\n /**\n * where this component was asked to go, if anywhere: its own entry in writeToPathPerId, else the\n * writeToPath of the whole batch.\n */\n private getWriteToPath(component: ConsumerComponent, opts: ManyComponentsWriterParams): string | undefined {\n return opts.writeToPathPerId?.[component.id.toStringWithoutVersion()] || opts.writeToPath;\n }\n\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (this.consumer) {\n opts.components.forEach((component) => {\n const writeToPath = this.getWriteToPath(component, opts);\n if (!writeToPath) return;\n const componentMap = component.componentMap as ComponentMap;\n if (!componentMap.rootDir) {\n throw new BitError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n // a component tracked at the workspace root is the workspace. moving it schedules the removal\n // of the directory it leaves, which there is the workspace tree (see moveExistingComponent)\n if (componentMap.rootDir === WORKSPACE_ROOT_DIR) {\n throw new BitError(\n `unable to write \"${component.id.toString()}\" to \"${writeToPath}\", it is tracked at the workspace root, which is the workspace itself.\nrun \"bit remove ${component.id.toStringWithoutVersion()}\" first if the workspace should stop tracking its root`\n );\n }\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n /**\n * true when the directory-conflict check can be skipped: either nothing is written to the filesystem, or the\n * target directory already belongs to this exact component (so overriding it in place is safe).\n */\n private shouldSkipDirConflictCheck(\n component: ConsumerComponent,\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ): boolean {\n if (opts.skipWritingToFs) return true;\n if (!componentMap) return false;\n // no writeToPath: it goes to the default directory. an existing componentMap means the component is not new.\n if (!this.getWriteToPath(component, opts)) return true;\n // writeToPath specified and that directory is already used for that component. compare against the\n // normalized componentDirRelative (not the raw opts.writeToPath, which may be absolute/OS-specific).\n return componentMap.rootDir === componentDirRelative;\n }\n\n /**\n * a workspace-root component's files land in the workspace tree itself, where a path may be a\n * symbolic link the user made - a directory on the way, or the destination itself. a write through\n * it would land the file wherever the link points, so every existing path on the way to an incoming\n * file has to be real. this is about where the write goes, not what it replaces, so --override does\n * not waive it (it waives the conflict check, which is the other place the destination is looked at).\n */\n /**\n * the incoming files a write would actually land at the workspace root. a component nested in the\n * root owns its own directory, and populateFilesToWriteToComponentDir leaves those files alone - so\n * the checks below must not reject an import over a path it would never touch. an older version of\n * the root, snapped before that component was extracted out of it, still carries them.\n */\n private filesThatWouldLand(component: ConsumerComponent) {\n const nestedRootDirs = this.consumer.bitMap.getNestedRootDirs(WORKSPACE_ROOT_DIR);\n return component.files.filter((file) => {\n const relativePath = pathNormalizeToLinux(file.relative);\n // the live map is never written from a versioned copy either, so a workspace whose own .bitmap\n // is a symbolic link must not fail an import over a file that would not be touched\n if (isWorkspaceMapFile(relativePath)) return false;\n return !isOwnedByNestedComponent(relativePath, nestedRootDirs);\n });\n }\n\n private throwForSymlinksInTheWay(component: ConsumerComponent, writeConfig?: boolean) {\n const pathsInTheWay = new Set<string>();\n const landing = this.filesThatWouldLand(component).map((file) => pathNormalizeToLinux(file.relative));\n // the config file is generated rather than versioned, so it is not among the component's files -\n // it still lands at the root, and this rule is about where a write goes. the flag the caller\n // passed does not settle whether it lands: the writer turns config writing on by itself when a\n // config file is already at the rootDir (see populateComponentsFilesToWrite), which a symlink\n // pointing at an existing file reads as. it is looked up the same way, so a broken one - which\n // the writer would not write through either - does not fail the write for nothing.\n if (writeConfig || fs.existsSync(this.consumer.toAbsolutePath(COMPONENT_CONFIG_FILE_NAME))) {\n landing.push(COMPONENT_CONFIG_FILE_NAME);\n }\n landing.forEach((relativePath) => {\n const segments = relativePath.split('/');\n segments.forEach((_, index) => pathsInTheWay.add(segments.slice(0, index + 1).join('/')));\n });\n pathsInTheWay.forEach((pathInTheWay) => {\n const stat = lstatIfExists(this.consumer.toAbsolutePath(pathInTheWay));\n if (!stat?.isSymbolicLink()) return;\n throw new BitError(\n `unable to write \"${component.id.toString()}\" to the workspace root, \"${pathInTheWay}\" is a symbolic link and the files would be written through it`\n );\n });\n }\n\n /**\n * only a workspace-root component may be written to \".\". any other component written there would own\n * every unclaimed file in the workspace from the next scan on, and drop out of install and link. a\n * workspace-root component is told by the marker its versions carry (see WorkspaceRootData) - a\n * .bitmap among its files is not enough, a component snapped before maps were excluded from\n * component scans may carry one.\n */\n private throwForNonWorkspaceRootComponent(component: ConsumerComponent) {\n if (isWorkspaceRootComponent(component.extensions)) return;\n throw new BitError(\n `unable to import \"${component.id.toString()}\" to the workspace root, it is not a workspace-root component. use --path to write it to a directory`\n );\n }\n\n /**\n * the workspace root is never empty - it holds .bit, .bitmap and workspace.jsonc - so \"not empty\"\n * says nothing about a conflict there. the target is only reachable for a workspace-root component.\n * restoring a git-free workspace from its scope starts from `bit init`, and the root files are meant\n * to land on top of the ones it generated. every other existing file at the root is the user's own,\n * whether or not the workspace tracks components yet, so overwriting it takes --override like any\n * other occupied directory. a file identical to its incoming copy is not overwritten in any sense\n * that matters, and this is what lets the files `bit init` generates (agent instructions, mcp config)\n * meet their own versioned copies. workspace.jsonc is the exception: the freshly initialized one is\n * meant to be replaced by the versioned one - and only while the map is still empty, which is what\n * `bit init` leaves behind. once the workspace tracks a component the file is the user's own like\n * any other, whichever component that is: the exemption is about what `bit init` just wrote, not\n * about who owns the root.\n */\n private throwForOccupiedWorkspaceRoot(component: ConsumerComponent, opts: ManyComponentsWriterParams) {\n if (!opts.throwForExistingDir) return;\n const isFreshWorkspace = !this.consumer.bitMap.components.length;\n const generatedByInit = isFreshWorkspace ? [WORKSPACE_JSONC] : [];\n const filesToOverwrite = this.filesThatWouldLand(component)\n .filter((file) => {\n const relativePath = pathNormalizeToLinux(file.relative);\n if (generatedByInit.includes(relativePath)) return false;\n const absolutePath = this.consumer.toAbsolutePath(relativePath);\n // lstat rather than exists: a symlink in the way, dangling or not, is a conflict and not a path\n // to write through, and so is a directory. only a regular file is compared with the incoming copy.\n const stat = lstatIfExists(absolutePath);\n if (!stat) return false;\n if (!stat.isFile()) return true;\n // compared byte for byte through latin1, which maps each byte to one character. Buffer.equals is\n // avoided because its signature differs between @types/node majors, and an aspect build type-checks\n // this file with whichever version its capsule resolves.\n return fs.readFileSync(absolutePath, 'latin1') !== file.contents.toString('latin1');\n })\n .map((file) => pathNormalizeToLinux(file.relative));\n if (!filesToOverwrite.length) return;\n const shown = filesToOverwrite.slice(0, 10).join(', ');\n const rest = filesToOverwrite.length > 10 ? ` and ${filesToOverwrite.length - 10} more` : '';\n throw new BitError(\n `unable to import \"${component.id.toString()}\" to the workspace root, it would overwrite ${shown}${rest}.\nuse --override to overwrite them`\n );\n }\n\n private throwErrorWhenDirectoryNotEmpty(\n component: ConsumerComponent,\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n if (this.shouldSkipDirConflictCheck(component, componentDirRelative, componentMap, opts)) return;\n\n const componentDir = this.consumer.toAbsolutePath(componentDirRelative);\n if (!fs.pathExistsSync(componentDir)) return;\n if (!componentMap) {\n const compInTheSameDir = this.consumer.bitMap.getComponentIdByRootPath(componentDirRelative);\n if (compInTheSameDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is already used by ${compInTheSameDir.toString()}.\neither use --path to specify a different directory or modify \"defaultDirectory\" prop in the workspace.jsonc file to \"{scopeId}/{name}\"`\n );\n }\n }\n if (!isDir(componentDir)) {\n throw new BitError(`unable to import to ${componentDir} because it's a file`);\n }\n if (componentDirRelative === WORKSPACE_ROOT_DIR) {\n this.throwForOccupiedWorkspaceRoot(component, opts);\n return;\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n\n /**\n * final `writeToPath` resolution for the `--write-to-empty-dir` import flag, mainly for non-interactive clients\n * (such as the IDE) that can't prompt for `--override`. runs after fixDirsIfEqual()/fixDirsIfNested() - which may\n * still move dirs using string-only collision checks - so the flag's guarantee holds against the final paths:\n * every relocated component lands in a directory that is empty (or non-existent) and unclaimed in .bitmap.\n * when a target is occupied (by foreign files, or a dir/rootDir owned by another component), it's relocated by\n * suffixing \"_N\" (e.g. \"renderers/class\" => \"renderers/class_1\"). a dir already owned by this component is left\n * as-is (its files are overridden, same as the default import behavior).\n */\n private relocateOccupiedDirs(componentWriterInstances: ComponentWriter[], opts: ManyComponentsWriterParams) {\n if (!opts.writeToEmptyDir) return;\n // track dirs already claimed in .bitmap and by other components in this batch, so two relocations never collide.\n const takenDirs = new Set<string>([\n ...this.workspace.bitMap.getAllRootDirs(),\n ...componentWriterInstances.map((componentWriter) => componentWriter.writeToPath),\n ]);\n componentWriterInstances.forEach((componentWriter) => {\n const currentDir = componentWriter.writeToPath;\n const componentMap = componentWriter.existingComponentMap;\n // the workspace root is a target only for a workspace-root component, and \"._1\" is not the\n // workspace root. its conflicts are handled by throwForOccupiedWorkspaceRoot.\n if (currentDir === WORKSPACE_ROOT_DIR) return;\n if (this.shouldSkipDirConflictCheck(componentWriter.component, currentDir, componentMap, opts)) return;\n const unavailableReason = this.getDirUnavailableReason(currentDir, componentMap);\n if (!unavailableReason) return;\n\n let num = 1;\n let candidate = `${currentDir}_${num}`;\n while (takenDirs.has(candidate) || this.getDirUnavailableReason(candidate, componentMap)) {\n num += 1;\n candidate = `${currentDir}_${num}`;\n }\n this.logger.consoleWarning(\n `unable to import into \"${currentDir}\" (${unavailableReason}), importing into \"${candidate}\" instead`\n );\n componentWriter.writeToPath = candidate;\n takenDirs.add(candidate);\n });\n }\n\n /**\n * returns a human-readable reason why the given directory can't be used for import, or undefined when it's\n * available. a directory is available when it doesn't exist yet, or it's an empty directory that is not already\n * used by another component in the .bitmap file.\n */\n private getDirUnavailableReason(\n componentDirRelative: PathLinuxRelative,\n componentMap: ComponentMap | null | undefined\n ): string | undefined {\n // a rootDir may be claimed in .bitmap even when its directory was deleted from the filesystem, so check\n // .bitmap ownership regardless of whether the directory currently exists on disk. it's only ok to reuse the\n // rootDir when it's claimed by the same component we're importing (comparing without version).\n const usedByComponent = this.consumer.bitMap.getComponentIdByRootPath(componentDirRelative);\n if (usedByComponent && !(componentMap && usedByComponent.isEqualWithoutVersion(componentMap.id))) {\n return `it is already used by ${usedByComponent.toString()}`;\n }\n const componentDir = this.consumer.toAbsolutePath(componentDirRelative);\n if (!fs.pathExistsSync(componentDir)) return undefined;\n if (!isDir(componentDir)) return 'it is a file';\n if (!isDirEmptySync(componentDir)) return 'the directory is not empty';\n return undefined;\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect, ConfigMergerAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover, configMerger]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain,\n ConfigMergerMain,\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover, configMerger);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n\nexport function incrementPathRecursively(p: string, allPaths: string[]) {\n const incrementPath = (str: string, number: number) => `${str}_${number}`;\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n}\n\nfunction lstatIfExists(absolutePath: string): fs.Stats | undefined {\n try {\n return fs.lstatSync(absolutePath);\n } catch (err: any) {\n if (err.code === 'ENOENT') return undefined;\n throw err;\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;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