@teambit/component-writer 1.0.1243 → 1.0.1245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-writer.main.runtime.d.ts +8 -0
- package/dist/component-writer.main.runtime.js +10 -8
- package/dist/component-writer.main.runtime.js.map +1 -1
- package/dist/component-writer.spec.js +14 -27
- package/dist/component-writer.spec.js.map +1 -1
- package/package.json +16 -17
- /package/dist/{preview-1792708253611.js → preview-1792789778104.js} +0 -0
|
@@ -4,6 +4,7 @@ import type { Logger, LoggerMain } from '@teambit/logger';
|
|
|
4
4
|
import type { Workspace } from '@teambit/workspace';
|
|
5
5
|
import type { MoverMain } from '@teambit/mover';
|
|
6
6
|
import type { ConsumerComponent } from '@teambit/legacy.consumer-component';
|
|
7
|
+
import type { ExtensionDataList } from '@teambit/legacy.extension-data';
|
|
7
8
|
import type { ConfigMergerMain, WorkspaceConfigUpdateResult } from '@teambit/config-merger';
|
|
8
9
|
import type { MergeStrategy } from '@teambit/component.modules.merge-helper';
|
|
9
10
|
import type { Consumer } from '@teambit/legacy.consumer';
|
|
@@ -35,6 +36,7 @@ export type ComponentWriterResults = {
|
|
|
35
36
|
compilationError?: Error;
|
|
36
37
|
workspaceConfigUpdateResult?: WorkspaceConfigUpdateResult;
|
|
37
38
|
};
|
|
39
|
+
type WorkspaceRootDetector = (extensions: ExtensionDataList) => boolean;
|
|
38
40
|
export declare class ComponentWriterMain {
|
|
39
41
|
private installer;
|
|
40
42
|
private compiler;
|
|
@@ -42,7 +44,13 @@ export declare class ComponentWriterMain {
|
|
|
42
44
|
private logger;
|
|
43
45
|
private mover;
|
|
44
46
|
private configMerge;
|
|
47
|
+
private workspaceRootDetector?;
|
|
45
48
|
constructor(installer: InstallMain, compiler: CompilerMain, workspace: Workspace, logger: Logger, mover: MoverMain, configMerge: ConfigMergerMain);
|
|
49
|
+
/**
|
|
50
|
+
* workspace-root tells which components are workspace roots. it registers the check rather than being
|
|
51
|
+
* imported here, because it depends on component-writer (through the importer).
|
|
52
|
+
*/
|
|
53
|
+
registerWorkspaceRootDetector(detector: WorkspaceRootDetector): void;
|
|
46
54
|
get consumer(): Consumer;
|
|
47
55
|
writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults>;
|
|
48
56
|
/**
|
|
@@ -95,13 +95,6 @@ function _legacy2() {
|
|
|
95
95
|
};
|
|
96
96
|
return data;
|
|
97
97
|
}
|
|
98
|
-
function _workspaceRoot() {
|
|
99
|
-
const data = require("@teambit/workspace-root");
|
|
100
|
-
_workspaceRoot = function () {
|
|
101
|
-
return data;
|
|
102
|
-
};
|
|
103
|
-
return data;
|
|
104
|
-
}
|
|
105
98
|
function _legacy3() {
|
|
106
99
|
const data = require("@teambit/legacy.constants");
|
|
107
100
|
_legacy3 = function () {
|
|
@@ -157,6 +150,15 @@ class ComponentWriterMain {
|
|
|
157
150
|
this.logger = logger;
|
|
158
151
|
this.mover = mover;
|
|
159
152
|
this.configMerge = configMerge;
|
|
153
|
+
_defineProperty(this, "workspaceRootDetector", void 0);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* workspace-root tells which components are workspace roots. it registers the check rather than being
|
|
158
|
+
* imported here, because it depends on component-writer (through the importer).
|
|
159
|
+
*/
|
|
160
|
+
registerWorkspaceRootDetector(detector) {
|
|
161
|
+
this.workspaceRootDetector = detector;
|
|
160
162
|
}
|
|
161
163
|
get consumer() {
|
|
162
164
|
return this.workspace.consumer;
|
|
@@ -500,7 +502,7 @@ run "bit remove ${component.id.toStringWithoutVersion()}" first if the workspace
|
|
|
500
502
|
* component scans may carry one.
|
|
501
503
|
*/
|
|
502
504
|
throwForNonWorkspaceRootComponent(component) {
|
|
503
|
-
if (
|
|
505
|
+
if (this.workspaceRootDetector?.(component.extensions)) return;
|
|
504
506
|
throw new (_bitError().BitError)(`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`);
|
|
505
507
|
}
|
|
506
508
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_harmonyModules","data","require","_compiler","_install","_logger","_workspace","_bitError","_fsExtra","_interopRequireDefault","_lodash","_pMapSeries","path","_interopRequireWildcard","_mover","_legacy","_legacy2","_workspaceRoot","_legacy3","_component","_configMerger","_componentWriter","_toolboxPath","_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","getOwnerName","startsWith","includes","incrementPathRecursively","push","getDefaultDir","avoidOtherComponents","defaultDir","composeRelativeComponentPath","usedByComponent","bitMap","getComponentIdByRootPath","isEqualWithoutVersion","ownerDir","isNestedWithTrackedDir","keys","getAllTrackDirs","some","getDirUnavailableReason","consoleWarning","toString","toStringWithoutVersion","parentsOfOthersComps","find","existingRootDirs","getAllRootDirs","parentsOfOthersCompsDirs","allPaths","newPath","existingParent","existingChildren","replace","getWriteToPath","getComponentIfExist","ignoreVersion","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","WORKSPACE_ROOT_DIR","throwForNonWorkspaceRootComponent","throwForSymlinksInTheWay","writeToEmptyDir","throwErrorWhenDirectoryNotEmpty","writeToPathPerId","componentMap","BitError","relativeWrittenPath","writtenPath","absoluteWrittenPath","toAbsolutePath","absoluteWriteToPath","moveExistingComponent","shouldSkipDirConflictCheck","componentDirRelative","filesThatWouldLand","nestedRootDirs","getNestedRootDirs","files","file","relativePath","relative","isWorkspaceMapFile","isOwnedByNestedComponent","pathsInTheWay","Set","landing","existsSync","segments","split","_","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","isDir","isDirEmptySync","takenDirs","currentDir","unavailableReason","num","candidate","provider","loggerMain","configMerger","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","ConfigMergerAspect","MainRuntime","addRuntime","_default","lstatSync","code"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/harmony.modules.runtimes';\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 { incrementPathRecursively } from '@teambit/toolbox.path.path';\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 = getOwnerName(compWriter.component);\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 * the dir from the \"defaultDirectory\" template. when `avoidOtherComponents` is set, it handles the same issue as\n * fixDirsIfEqual, for a component that is already in the workspace rather than in this batch.\n * e.g. org1.ui/button is in \"ui/button\" and org2.ui/button is imported now. it goes to \"org2/ui/button\", unless that\n * dir is taken as well, in which case the default dir stays and the conflict check reports it.\n */\n private getDefaultDir(component: ConsumerComponent, avoidOtherComponents: boolean): PathLinuxRelative {\n const defaultDir = this.consumer.composeRelativeComponentPath(component.id);\n if (!avoidOtherComponents) return defaultDir;\n const usedByComponent = this.consumer.bitMap.getComponentIdByRootPath(defaultDir);\n if (!usedByComponent || usedByComponent.isEqualWithoutVersion(component.id)) return defaultDir;\n const ownerName = getOwnerName(component);\n if (!ownerName || defaultDir.startsWith(`${ownerName}/`)) return defaultDir;\n const ownerDir = `${ownerName}/${defaultDir}`;\n // a dir nested in a tracked rootDir (or containing one) would be moved later by fixDirsIfNested, past this check\n const isNestedWithTrackedDir = Object.keys(this.consumer.bitMap.getAllTrackDirs()).some(\n (rootDir) => rootDir.startsWith(`${ownerDir}/`) || ownerDir.startsWith(`${rootDir}/`)\n );\n if (isNestedWithTrackedDir || this.getDirUnavailableReason(ownerDir, undefined)) return defaultDir;\n this.logger.consoleWarning(\n `\"${defaultDir}\" is already used by ${usedByComponent.toString()}, importing ${component.id.toStringWithoutVersion()} into \"${ownerDir}\" instead`\n );\n return ownerDir;\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 // 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 const componentRootDir: PathLinuxRelative = writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(writeToPath))) || WORKSPACE_ROOT_DIR\n : // a component already in .bitmap keeps its dir, and nothing is written with skipWritingToFs\n this.getDefaultDir(component, !existingComponentMap && !opts.skipWritingToFs);\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, --write-to-empty-dir to import into the next available 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, or --write-to-empty-dir to import into the next available directory`\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\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\n/**\n * the owner part of the scope-id, e.g. \"org1\" of \"org1.ui\". undefined when the scope has no owner.\n */\nfunction getOwnerName(component: ConsumerComponent): string | undefined {\n const scope = component.id.scope;\n return scope?.includes('.') ? scope.split('.')[0] : undefined;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,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;E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0BAAc,EAAEC,sBAAY,EAAEC,4BAAe,EAAEC,oBAAW,EAAEC,kCAAkB,CAAC;AAAAlO,eAAA,CArhB1GY,mBAAmB,aAshBbuN,6BAAW;AAc9BR,yCAAqB,CAACS,UAAU,CAACxN,mBAAmB,CAAC;AAAC,IAAAyN,QAAA,GAAAT,OAAA,CAAArO,OAAA,GAEvCqB,mBAAmB;AAElC,SAASiL,aAAaA,CAACU,YAAoB,EAAwB;EACjE,IAAI;IACF,OAAOxG,kBAAE,CAACuI,SAAS,CAAC/B,YAAY,CAAC;EACnC,CAAC,CAAC,OAAOzI,GAAQ,EAAE;IACjB,IAAIA,GAAG,CAACyK,IAAI,KAAK,QAAQ,EAAE,OAAO1K,SAAS;IAC3C,MAAMC,GAAG;EACX;AACF;;AAEA;AACA;AACA;AACA,SAASmD,YAAYA,CAAC1C,SAA4B,EAAsB;EACtE,MAAMb,KAAK,GAAGa,SAAS,CAACvB,EAAE,CAACU,KAAK;EAChC,OAAOA,KAAK,EAAEyD,QAAQ,CAAC,GAAG,CAAC,GAAGzD,KAAK,CAAC4H,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAGzH,SAAS;AAC/D","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_harmonyModules","data","require","_compiler","_install","_logger","_workspace","_bitError","_fsExtra","_interopRequireDefault","_lodash","_pMapSeries","path","_interopRequireWildcard","_mover","_legacy","_legacy2","_legacy3","_component","_configMerger","_componentWriter","_toolboxPath","_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","registerWorkspaceRootDetector","detector","workspaceRootDetector","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","getOwnerName","startsWith","includes","incrementPathRecursively","push","getDefaultDir","avoidOtherComponents","defaultDir","composeRelativeComponentPath","usedByComponent","bitMap","getComponentIdByRootPath","isEqualWithoutVersion","ownerDir","isNestedWithTrackedDir","keys","getAllTrackDirs","some","getDirUnavailableReason","consoleWarning","toString","toStringWithoutVersion","parentsOfOthersComps","find","existingRootDirs","getAllRootDirs","parentsOfOthersCompsDirs","allPaths","newPath","existingParent","existingChildren","replace","getWriteToPath","getComponentIfExist","ignoreVersion","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","WORKSPACE_ROOT_DIR","throwForNonWorkspaceRootComponent","throwForSymlinksInTheWay","writeToEmptyDir","throwErrorWhenDirectoryNotEmpty","writeToPathPerId","componentMap","BitError","relativeWrittenPath","writtenPath","absoluteWrittenPath","toAbsolutePath","absoluteWriteToPath","moveExistingComponent","shouldSkipDirConflictCheck","componentDirRelative","filesThatWouldLand","nestedRootDirs","getNestedRootDirs","files","file","relativePath","relative","isWorkspaceMapFile","isOwnedByNestedComponent","pathsInTheWay","Set","landing","existsSync","segments","split","_","index","add","slice","pathInTheWay","stat","lstatIfExists","isSymbolicLink","extensions","throwForOccupiedWorkspaceRoot","throwForExistingDir","isFreshWorkspace","generatedByInit","WORKSPACE_JSONC","filesToOverwrite","absolutePath","isFile","readFileSync","contents","shown","rest","componentDir","pathExistsSync","compInTheSameDir","isDir","isDirEmptySync","takenDirs","currentDir","unavailableReason","num","candidate","provider","loggerMain","configMerger","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","ConfigMergerAspect","MainRuntime","addRuntime","_default","lstatSync","code"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/harmony.modules.runtimes';\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 { ExtensionDataList } from '@teambit/legacy.extension-data';\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 { 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 { incrementPathRecursively } from '@teambit/toolbox.path.path';\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\ntype WorkspaceRootDetector = (extensions: ExtensionDataList) => boolean;\n\nexport class ComponentWriterMain {\n private workspaceRootDetector?: WorkspaceRootDetector;\n\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 /**\n * workspace-root tells which components are workspace roots. it registers the check rather than being\n * imported here, because it depends on component-writer (through the importer).\n */\n registerWorkspaceRootDetector(detector: WorkspaceRootDetector) {\n this.workspaceRootDetector = detector;\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 = getOwnerName(compWriter.component);\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 * the dir from the \"defaultDirectory\" template. when `avoidOtherComponents` is set, it handles the same issue as\n * fixDirsIfEqual, for a component that is already in the workspace rather than in this batch.\n * e.g. org1.ui/button is in \"ui/button\" and org2.ui/button is imported now. it goes to \"org2/ui/button\", unless that\n * dir is taken as well, in which case the default dir stays and the conflict check reports it.\n */\n private getDefaultDir(component: ConsumerComponent, avoidOtherComponents: boolean): PathLinuxRelative {\n const defaultDir = this.consumer.composeRelativeComponentPath(component.id);\n if (!avoidOtherComponents) return defaultDir;\n const usedByComponent = this.consumer.bitMap.getComponentIdByRootPath(defaultDir);\n if (!usedByComponent || usedByComponent.isEqualWithoutVersion(component.id)) return defaultDir;\n const ownerName = getOwnerName(component);\n if (!ownerName || defaultDir.startsWith(`${ownerName}/`)) return defaultDir;\n const ownerDir = `${ownerName}/${defaultDir}`;\n // a dir nested in a tracked rootDir (or containing one) would be moved later by fixDirsIfNested, past this check\n const isNestedWithTrackedDir = Object.keys(this.consumer.bitMap.getAllTrackDirs()).some(\n (rootDir) => rootDir.startsWith(`${ownerDir}/`) || ownerDir.startsWith(`${rootDir}/`)\n );\n if (isNestedWithTrackedDir || this.getDirUnavailableReason(ownerDir, undefined)) return defaultDir;\n this.logger.consoleWarning(\n `\"${defaultDir}\" is already used by ${usedByComponent.toString()}, importing ${component.id.toStringWithoutVersion()} into \"${ownerDir}\" instead`\n );\n return ownerDir;\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 // 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 const componentRootDir: PathLinuxRelative = writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(writeToPath))) || WORKSPACE_ROOT_DIR\n : // a component already in .bitmap keeps its dir, and nothing is written with skipWritingToFs\n this.getDefaultDir(component, !existingComponentMap && !opts.skipWritingToFs);\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 (this.workspaceRootDetector?.(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, --write-to-empty-dir to import into the next available 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, or --write-to-empty-dir to import into the next available directory`\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\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\n/**\n * the owner part of the scope-id, e.g. \"org1\" of \"org1.ui\". undefined when the scope has no owner.\n */\nfunction getOwnerName(component: ConsumerComponent): string | undefined {\n const scope = component.id.scope;\n return scope?.includes('.') ? scope.split('.')[0] : undefined;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,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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E,CAACsI,SAAS,CAAC/B,YAAY,CAAC;EACnC,CAAC,CAAC,OAAOxI,GAAQ,EAAE;IACjB,IAAIA,GAAG,CAACwK,IAAI,KAAK,QAAQ,EAAE,OAAOzK,SAAS;IAC3C,MAAMC,GAAG;EACX;AACF;;AAEA;AACA;AACA;AACA,SAASmD,YAAYA,CAAC1C,SAA4B,EAAsB;EACtE,MAAMb,KAAK,GAAGa,SAAS,CAACvB,EAAE,CAACU,KAAK;EAChC,OAAOA,KAAK,EAAEyD,QAAQ,CAAC,GAAG,CAAC,GAAGzD,KAAK,CAAC4H,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAGzH,SAAS;AAC/D","ignoreList":[]}
|
|
@@ -49,13 +49,6 @@ function _legacy3() {
|
|
|
49
49
|
};
|
|
50
50
|
return data;
|
|
51
51
|
}
|
|
52
|
-
function _workspaceRoot() {
|
|
53
|
-
const data = require("@teambit/workspace-root");
|
|
54
|
-
_workspaceRoot = function () {
|
|
55
|
-
return data;
|
|
56
|
-
};
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
52
|
function _componentWriter() {
|
|
60
53
|
const data = _interopRequireWildcard(require("./component-writer"));
|
|
61
54
|
_componentWriter = function () {
|
|
@@ -315,33 +308,27 @@ describe('the conflict check at the workspace root', () => {
|
|
|
315
308
|
});
|
|
316
309
|
});
|
|
317
310
|
describe('the guard on what may be written to the workspace root', () => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
*/
|
|
322
|
-
const componentWith = extensions => ({
|
|
311
|
+
// workspace-root's own spec covers the marker; a stub detector stands in for it here
|
|
312
|
+
const extensions = _legacy3().ExtensionDataList.fromArray([]);
|
|
313
|
+
const component = {
|
|
323
314
|
id: {
|
|
324
315
|
toString: () => 'my-scope/comp1'
|
|
325
316
|
},
|
|
326
317
|
extensions
|
|
327
|
-
}
|
|
328
|
-
|
|
318
|
+
};
|
|
319
|
+
const writerWith = detector => {
|
|
329
320
|
const main = Object.create(_componentWriterMain().ComponentWriterMain.prototype);
|
|
330
|
-
|
|
321
|
+
if (detector) main.registerWorkspaceRootDetector(detector);
|
|
322
|
+
return main;
|
|
323
|
+
};
|
|
324
|
+
it('should refuse a component the detector does not take for a workspace root', () => {
|
|
325
|
+
(0, _chai().expect)(() => writerWith(() => false).throwForNonWorkspaceRootComponent(component)).to.throw('not a workspace-root component');
|
|
331
326
|
});
|
|
332
|
-
it('should accept a component
|
|
333
|
-
|
|
334
|
-
isRoot: true
|
|
335
|
-
})]);
|
|
336
|
-
const main = Object.create(_componentWriterMain().ComponentWriterMain.prototype);
|
|
337
|
-
(0, _chai().expect)(() => main.throwForNonWorkspaceRootComponent(componentWith(extensions))).to.not.throw();
|
|
327
|
+
it('should accept a component the detector takes for a workspace root', () => {
|
|
328
|
+
(0, _chai().expect)(() => writerWith(exts => exts === extensions).throwForNonWorkspaceRootComponent(component)).to.not.throw();
|
|
338
329
|
});
|
|
339
|
-
it('should refuse
|
|
340
|
-
|
|
341
|
-
root: 'my-scope/ws-root@0.0.1'
|
|
342
|
-
})]);
|
|
343
|
-
const main = Object.create(_componentWriterMain().ComponentWriterMain.prototype);
|
|
344
|
-
(0, _chai().expect)(() => main.throwForNonWorkspaceRootComponent(componentWith(extensions))).to.throw('not a workspace-root component');
|
|
330
|
+
it('should refuse any component when no detector is registered', () => {
|
|
331
|
+
(0, _chai().expect)(() => writerWith().throwForNonWorkspaceRootComponent(component)).to.throw('not a workspace-root component');
|
|
345
332
|
});
|
|
346
333
|
});
|
|
347
334
|
describe('writing the workspace-root component in the same batch as a component nested in it', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","_fsExtra","_interopRequireDefault","_os","_path","_legacy","_legacy2","_legacy3","_workspaceRoot","_componentWriter","_interopRequireWildcard","_componentWriterMain","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","describe","nested","it","expect","isOwnedByNestedComponent","to","be","true","false","writerFor","files","nestedRootDirs","writeToPath","written","writer","create","ComponentWriter","prototype","assign","override","writeConfig","deleteBitDirContent","bitMap","getNestedRootDirs","component","map","relative","dataToPersist","addFile","file","push","license","undefined","populateFilesToWriteToComponentDir","deep","equal","runtimeFor","workspacePath","main","ComponentWriterMain","value","components","toAbsolutePath","relativePath","path","join","componentFor","id","toString","beforeEach","fs","mkdtemp","os","tmpdir","afterEach","remove","ensureDir","symlink","throwForSymlinksInTheWay","not","throw","target","outsideFile","writeFile","runtimeTracking","rootCarrying","content","contents","Buffer","from","outputFile","WORKSPACE_JSONC","throwForOccupiedWorkspaceRoot","throwForExistingDir","isEqualWithoutVersion","componentWith","extensions","throwForNonWorkspaceRootComponent","ExtensionDataList","fromArray","ExtensionDataEntry","WorkspaceRootAspect","isRoot","root","runFixDirs","writeToPaths","existingRootDirs","getAllRootDirs","writers","scope","fixDirsIfNested","WORKSPACE_ROOT_DIR","shouldSkip","opts","rootDir","dir","toStringWithoutVersion","shouldSkipDirConflictCheck","writeToPathPerId","skipWritingToFs","skipUpdatingBitMap","existingComponentMap","getRootDir","consumer","isLegacy","basename","updatePaths","populateComponentsFilesToWrite","idOf","split","other","componentOf","composeRelativeComponentPath","scopeId","name","pop","rootDirs","warnings","getComponentIdByRootPath","getAllTrackDirs","consoleWarning","msg","getDefaultDir","have","string"],"sources":["component-writer.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport path from 'path';\nimport { WORKSPACE_ROOT_DIR } from '@teambit/legacy.bit-map';\nimport { WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy.extension-data';\nimport { WorkspaceRootAspect } from '@teambit/workspace-root';\nimport ComponentWriter, { isOwnedByNestedComponent } from './component-writer';\nimport { ComponentWriterMain } from './component-writer.main.runtime';\n\ndescribe('isOwnedByNestedComponent', () => {\n const nested = ['packages/comp1', 'packages/comp2'];\n it('should claim a file inside a nested component', () => {\n expect(isOwnedByNestedComponent('packages/comp1/index.js', nested)).to.be.true;\n });\n it('should claim a file deeper inside a nested component', () => {\n expect(isOwnedByNestedComponent('packages/comp1/src/util.js', nested)).to.be.true;\n });\n it('should leave a file the root owns', () => {\n expect(isOwnedByNestedComponent('packages/readme.md', nested)).to.be.false;\n expect(isOwnedByNestedComponent('workspace.jsonc', nested)).to.be.false;\n });\n it('should not claim a directory that merely shares a prefix with a nested one', () => {\n expect(isOwnedByNestedComponent('packages/comp10/index.js', nested)).to.be.false;\n });\n it('should claim the nested root-dir itself, a file cannot sit where the directory is', () => {\n // an older root carries it as a plain file, from before the component was extracted there.\n // writing it over the directory fails the checkout with EISDIR - see isOwnedByNestedComponent\n expect(isOwnedByNestedComponent('packages/comp1', nested)).to.be.true;\n });\n it('should not claim a sibling whose name merely starts with a nested one', () => {\n expect(isOwnedByNestedComponent('packages/comp10', nested)).to.be.false;\n });\n it('should claim nothing when no component is nested, the ordinary case', () => {\n expect(isOwnedByNestedComponent('packages/comp1/index.js', [])).to.be.false;\n });\n});\n\ndescribe('populateFilesToWriteToComponentDir', () => {\n /**\n * the method only reads these fields off the writer. building it through the constructor would\n * need a consumer and a scope, which say nothing about the file-set it produces.\n */\n function writerFor(files: string[], nestedRootDirs: string[], writeToPath = '.') {\n const written: string[] = [];\n const writer = Object.create(ComponentWriter.prototype);\n Object.assign(writer, {\n writeToPath,\n override: true,\n writeConfig: false,\n deleteBitDirContent: false,\n bitMap: { getNestedRootDirs: () => nestedRootDirs },\n component: {\n files: files.map((relative) => ({ relative })),\n dataToPersist: { addFile: (file: any) => written.push(file.relative) },\n license: undefined,\n },\n });\n return { writer, written };\n }\n\n it('should not write over the source of a component nested in the root, an old version still carries it', async () => {\n // the root was snapped before comp1 was extracted out of it, so that version holds comp1's files\n const { writer, written } = writerFor(\n ['workspace.jsonc', 'packages/comp1/index.js', 'readme.md'],\n ['packages/comp1']\n );\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc', 'readme.md']);\n });\n\n it('should write every file when nothing is nested', async () => {\n const { writer, written } = writerFor(['workspace.jsonc', 'packages/comp1/index.js'], []);\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc', 'packages/comp1/index.js']);\n });\n\n it('should keep skipping the live .bitmap, which is never written from a versioned copy', async () => {\n const { writer, written } = writerFor(['.bitmap', 'workspace.jsonc'], []);\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc']);\n });\n\n it('should skip it for an ordinary component too, no component but the root ever tracks one', async () => {\n // the scan drops a `.bitmap` at any other component's root (see getScanIgnorePatterns), so what a\n // component versions is what a write lands\n const { writer, written } = writerFor(['.bitmap', 'index.js'], [], 'comp1');\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['index.js']);\n });\n});\n\ndescribe('the workspace-root import preflight checks', () => {\n /**\n * the checks read the incoming files, the nested root-dirs and the paths on disk. going through\n * writeMany would need a workspace and a scope, which say nothing about which paths they look at.\n */\n function runtimeFor(nestedRootDirs: string[], workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n // `consumer` is a getter on the class, so it is defined rather than assigned\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: { getNestedRootDirs: () => nestedRootDirs, components: [] },\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n return main;\n }\n const componentFor = (files: string[]) =>\n ({ id: { toString: () => 'my-scope/ws-root' }, files: files.map((relative) => ({ relative })) }) as any;\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-preflight-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should ignore a symlink inside a nested component, the write never goes through it', async () => {\n // an older root version still carries comp1's files, but the writer leaves that directory alone\n await fs.ensureDir(path.join(workspacePath, 'packages'));\n await fs.symlink(os.tmpdir(), path.join(workspacePath, 'packages/comp1'));\n const main = runtimeFor(['packages/comp1'], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['packages/comp1/index.js']))).to.not.throw();\n });\n\n it('should ignore the live .bitmap, which the write does not land either', async () => {\n // a workspace whose own .bitmap is a symbolic link must not fail an import over a file the writer\n // skips anyway (see isWorkspaceMapFile)\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, '.bitmap'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['.bitmap', 'README.md']))).to.not.throw();\n });\n\n it('should refuse a symlinked component.json when the config file is written', async () => {\n // it is generated rather than versioned, so it is not among the component's files - it still\n // lands at the root, and the writer forces override on it\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), true)).to.throw('is a symbolic link');\n });\n\n it('should refuse it even when the caller asked for no config file, the writer turns it on itself', async () => {\n // a config file already at the rootDir makes the writer write one whatever the caller passed\n // (see populateComponentsFilesToWrite), and a symlink pointing at an existing file is read as\n // one. so the flag does not settle whether a write lands here.\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), false)).to.throw('is a symbolic link');\n });\n\n it('should leave a broken symlink alone, the writer does not write through it either', async () => {\n // it resolves to nothing, so the writer does not read it as an existing config file and no\n // config is written. failing the whole import over it would be for nothing.\n await fs.symlink(path.join(workspacePath, 'missing'), path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), false)).to.not.throw();\n });\n\n it('should still refuse a symlink on the way to a file the root does own', async () => {\n await fs.symlink(os.tmpdir(), path.join(workspacePath, 'docs'));\n const main = runtimeFor(['packages/comp1'], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['docs/readme.md']))).to.throw('is a symbolic link');\n });\n\n it('should refuse a symlink at the file itself, not only above it', async () => {\n const outsideFile = path.join(workspacePath, 'theirs.md');\n await fs.writeFile(outsideFile, 'theirs\\n');\n await fs.symlink(outsideFile, path.join(workspacePath, 'README.md'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']))).to.throw('is a symbolic link');\n });\n\n it('should refuse a dangling symlink, whose target does not exist, rather than write through it', async () => {\n // a stat would say there is nothing there and let the write create the target; the check lstats\n await fs.symlink(path.join(workspacePath, 'missing-target'), path.join(workspacePath, 'README.md'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']))).to.throw('is a symbolic link');\n });\n});\n\ndescribe('the conflict check at the workspace root', () => {\n /** the same harness as above, with a say in what the map already tracks */\n function runtimeTracking(components: any[], workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: { getNestedRootDirs: () => [], components },\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n return main;\n }\n const rootCarrying = (relative: string, content: string) =>\n ({\n id: { toString: () => 'my-scope/ws-root' },\n files: [{ relative, contents: Buffer.from(content) }],\n }) as any;\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-root-conflict-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should replace the workspace.jsonc \"bit init\" generated, while nothing is tracked yet', async () => {\n await fs.outputFile(path.join(workspacePath, WORKSPACE_JSONC), 'generated by bit init\\n');\n const main = runtimeTracking([], workspacePath);\n expect(() =>\n main.throwForOccupiedWorkspaceRoot(rootCarrying(WORKSPACE_JSONC, 'the versioned one\\n'), {\n throwForExistingDir: true,\n })\n ).to.not.throw();\n });\n\n it('should protect the workspace.jsonc of a workspace that already tracks something', async () => {\n // past `bit init` the file is the user's own, like every other file at the root, so replacing it\n // takes --override. a map holding one component is not a freshly initialized workspace, whichever\n // component it is - the exemption is about what `bit init` just wrote, not about who owns the root\n await fs.outputFile(path.join(workspacePath, WORKSPACE_JSONC), 'the user edited this\\n');\n const main = runtimeTracking([{ id: { isEqualWithoutVersion: () => true } }], workspacePath);\n expect(() =>\n main.throwForOccupiedWorkspaceRoot(rootCarrying(WORKSPACE_JSONC, 'the versioned one\\n'), {\n throwForExistingDir: true,\n })\n ).to.throw(WORKSPACE_JSONC);\n });\n});\n\ndescribe('the guard on what may be written to the workspace root', () => {\n /**\n * it runs in the same branch as the symlink preflight, which an e2e case covers on the real\n * \"--path .\" path - so what is left to check is the rule itself, on the marker a version carries.\n */\n const componentWith = (extensions: ExtensionDataList) =>\n ({ id: { toString: () => 'my-scope/comp1' }, extensions }) as any;\n\n it('should refuse an ordinary component, only a workspace-root component may own \".\"', () => {\n const main = Object.create(ComponentWriterMain.prototype);\n expect(() => main.throwForNonWorkspaceRootComponent(componentWith(ExtensionDataList.fromArray([])))).to.throw(\n 'not a workspace-root component'\n );\n });\n\n it('should accept a component whose version carries the root marker', () => {\n const extensions = ExtensionDataList.fromArray([\n new ExtensionDataEntry(undefined, undefined, WorkspaceRootAspect.id, undefined, { isRoot: true }),\n ]);\n const main = Object.create(ComponentWriterMain.prototype);\n expect(() => main.throwForNonWorkspaceRootComponent(componentWith(extensions))).to.not.throw();\n });\n\n it('should refuse a member, which points at its root rather than being one', () => {\n const extensions = ExtensionDataList.fromArray([\n new ExtensionDataEntry(undefined, undefined, WorkspaceRootAspect.id, undefined, {\n root: 'my-scope/ws-root@0.0.1',\n }),\n ]);\n const main = Object.create(ComponentWriterMain.prototype);\n expect(() => main.throwForNonWorkspaceRootComponent(componentWith(extensions))).to.throw(\n 'not a workspace-root component'\n );\n });\n});\n\ndescribe('writing the workspace-root component in the same batch as a component nested in it', () => {\n /**\n * the batch goes through fixDirsIfNested, which moves a component aside when another one is to be\n * written inside it. the root must come out of it untouched: it owns \".\" by definition, and the\n * components below it are the normal case rather than a collision.\n */\n function runFixDirs(writeToPaths: string[], existingRootDirs: string[] = []) {\n const main = Object.create(ComponentWriterMain.prototype);\n Object.defineProperty(main, 'workspace', { value: { bitMap: { getAllRootDirs: () => existingRootDirs } } });\n const writers = writeToPaths.map((writeToPath) => ({\n writeToPath,\n component: { id: { scope: 'my-org.my-scope' } },\n }));\n main.fixDirsIfNested(writers);\n return writers.map((writer) => writer.writeToPath);\n }\n\n it('should leave both where they were asked to go', () => {\n expect(runFixDirs([WORKSPACE_ROOT_DIR, 'packages/comp1'])).to.deep.equal([WORKSPACE_ROOT_DIR, 'packages/comp1']);\n });\n\n it('should leave the root alone when the workspace already tracks a component inside it', () => {\n expect(runFixDirs([WORKSPACE_ROOT_DIR], ['packages/comp1'])).to.deep.equal([WORKSPACE_ROOT_DIR]);\n });\n\n it('should leave a component alone when the workspace already tracks the root', () => {\n expect(runFixDirs(['packages/comp1'], [WORKSPACE_ROOT_DIR])).to.deep.equal(['packages/comp1']);\n });\n\n it('should still move an ordinary component that another one is written inside of', () => {\n // the rule the root is untouched by, so the cases above are not passing on an inert branch\n expect(runFixDirs(['bar', 'bar/foo'])).to.deep.equal(['bar_1', 'bar/foo']);\n });\n});\n\ndescribe('deciding whether the directory-conflict check applies to a component', () => {\n /**\n * the decision turns on whether *this* component was asked to go somewhere, which is not the same\n * question as the directory it ends up at: without --path that directory is the default one, and\n * with --path-per-id the batch-level path answers for the wrong component. so it is resolved the\n * same way the write itself resolves it.\n */\n function shouldSkip(opts: Record<string, any>, rootDir?: string, dir = 'some-dir') {\n const main = Object.create(ComponentWriterMain.prototype);\n const component = { id: { toStringWithoutVersion: () => 'my-scope/comp1' } };\n return main.shouldSkipDirConflictCheck(component, dir, rootDir === undefined ? undefined : { rootDir }, opts);\n }\n\n it('should check a component asked for a directory it does not already own', () => {\n expect(shouldSkip({ writeToPath: 'some-dir' }, 'other-dir')).to.be.false;\n });\n\n it('should skip a component asked for the directory it holds today, it overrides itself in place', () => {\n expect(shouldSkip({ writeToPath: 'some-dir' }, 'some-dir')).to.be.true;\n });\n\n it('should skip a tracked component that was asked for nothing, it goes to its default directory', () => {\n expect(shouldSkip({}, 'other-dir')).to.be.true;\n });\n\n it('should take the path asked for this component, not the one asked for the batch', () => {\n expect(shouldSkip({ writeToPathPerId: { 'my-scope/comp1': 'some-dir' } }, 'other-dir')).to.be.false;\n });\n\n it('should check a component that is not tracked yet, whatever was asked for it', () => {\n expect(shouldSkip({})).to.be.false;\n });\n\n it('should skip everything when nothing is written to the filesystem at all', () => {\n expect(shouldSkip({ skipWritingToFs: true, writeToPath: 'some-dir' }, 'other-dir')).to.be.true;\n });\n\n it('should treat a component already tracked at the workspace root as any other tracked directory', () => {\n // re-importing a tracked component updates the files it owns, and the root is not an exception\n // to that. what needs --override is a component arriving at a root someone else's files are at,\n // which has no map entry yet - the !componentMap branch of throwErrorWhenDirectoryNotEmpty is\n // where that is decided, and this skip never reaches past it.\n expect(shouldSkip({}, WORKSPACE_ROOT_DIR, WORKSPACE_ROOT_DIR)).to.be.true;\n expect(shouldSkip({ writeToPath: WORKSPACE_ROOT_DIR }, WORKSPACE_ROOT_DIR, WORKSPACE_ROOT_DIR)).to.be.true;\n });\n});\n\ndescribe('the destination of an already tracked workspace-root component', () => {\n it('should be the workspace root, whatever path the caller derived without --path', async () => {\n const writer = Object.create(ComponentWriter.prototype);\n Object.assign(writer, {\n // what composeRelativeComponentPath returns when no --path is given\n writeToPath: 'my-scope/ws-root',\n override: true,\n writeConfig: false,\n skipUpdatingBitMap: true,\n existingComponentMap: { rootDir: WORKSPACE_ROOT_DIR, getRootDir: () => WORKSPACE_ROOT_DIR },\n bitMap: { getNestedRootDirs: () => [] },\n consumer: undefined,\n component: {\n id: { toString: () => 'my-scope/ws-root' },\n isLegacy: false,\n files: [{ relative: 'README.md', basename: 'README.md', path: 'README.md', updatePaths: () => {} }],\n },\n });\n await writer.populateComponentsFilesToWrite();\n expect(writer.writeToPath).to.equal(WORKSPACE_ROOT_DIR);\n });\n});\n\ndescribe('the default dir of a component whose dir is used by a component of another owner', () => {\n const idOf = (id: string) => ({\n scope: id.split('/')[0],\n toString: () => id,\n toStringWithoutVersion: () => id,\n isEqualWithoutVersion: (other: { toString: () => string }) => other.toString() === id,\n });\n const componentOf = (id: string) => ({ id: idOf(id) }) as any;\n /** the default \"defaultDirectory\" template, {scope}/{name}, which omits the owner */\n const composeRelativeComponentPath = (id: { toString: () => string }) => {\n const [scopeId, ...name] = id.toString().split('/');\n return [scopeId.split('.').pop(), ...name].join('/');\n };\n function runtimeTracking(rootDirs: Record<string, string>, workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n const warnings: string[] = [];\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: {\n getComponentIdByRootPath: (rootDir: string) => (rootDirs[rootDir] ? idOf(rootDirs[rootDir]) : undefined),\n getAllTrackDirs: () => rootDirs,\n },\n composeRelativeComponentPath,\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n Object.defineProperty(main, 'logger', { value: { consoleWarning: (msg: string) => warnings.push(msg) } });\n return { main, warnings };\n }\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-default-dir-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should prefix the dir with the owner name and warn about it', () => {\n const { main, warnings } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('org2/ui/button');\n expect(warnings[0]).to.have.string('org1.ui/button');\n });\n it('should keep the default dir when it is free', () => {\n const { main } = runtimeTracking({}, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when it is used by the same component', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org2.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the owner dir is not empty, so the conflict check reports it', async () => {\n await fs.outputFile(path.join(workspacePath, 'org2/ui/button/index.js'), '');\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the owner dir is nested in a tracked dir, which would move it unchecked', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button', 'org2/ui': 'org2.misc/ui' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the scope has no owner', () => {\n const { main } = runtimeTracking({ 'my-scope/button': 'other-scope/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('my-scope/button'), true)).to.equal('my-scope/button');\n });\n it('should not look for another dir when asked not to, e.g. the component is already in .bitmap', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), false)).to.equal('ui/button');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,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CAAC;EACFjC,EAAE,CAAC,0GAA0G,EAAE,MAAM;IACnH,MAAM;MAAEoC;IAAK,CAAC,GAAG0B,eAAe,CAAC;MAAE,WAAW,EAAE,gBAAgB;MAAE,SAAS,EAAE;IAAe,CAAC,EAAE3B,aAAa,CAAC;IAC7G,IAAAlC,cAAM,EAACmC,IAAI,CAACoF,aAAa,CAACX,WAAW,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC1G,EAAE,CAAC8B,KAAK,CAAC,WAAW,CAAC;EACvF,CAAC,CAAC;EACFjC,EAAE,CAAC,yDAAyD,EAAE,MAAM;IAClE,MAAM;MAAEoC;IAAK,CAAC,GAAG0B,eAAe,CAAC;MAAE,iBAAiB,EAAE;IAAqB,CAAC,EAAE3B,aAAa,CAAC;IAC5F,IAAAlC,cAAM,EAACmC,IAAI,CAACoF,aAAa,CAACX,WAAW,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC1G,EAAE,CAAC8B,KAAK,CAAC,iBAAiB,CAAC;EAC9F,CAAC,CAAC;EACFjC,EAAE,CAAC,6FAA6F,EAAE,MAAM;IACtG,MAAM;MAAEoC;IAAK,CAAC,GAAG0B,eAAe,CAAC;MAAE,WAAW,EAAE;IAAiB,CAAC,EAAE3B,aAAa,CAAC;IAClF,IAAAlC,cAAM,EAACmC,IAAI,CAACoF,aAAa,CAACX,WAAW,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC1G,EAAE,CAAC8B,KAAK,CAAC,WAAW,CAAC;EACxF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_fsExtra","_interopRequireDefault","_os","_path","_legacy","_legacy2","_legacy3","_componentWriter","_interopRequireWildcard","_componentWriterMain","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","describe","nested","it","expect","isOwnedByNestedComponent","to","be","true","false","writerFor","files","nestedRootDirs","writeToPath","written","writer","create","ComponentWriter","prototype","assign","override","writeConfig","deleteBitDirContent","bitMap","getNestedRootDirs","component","map","relative","dataToPersist","addFile","file","push","license","undefined","populateFilesToWriteToComponentDir","deep","equal","runtimeFor","workspacePath","main","ComponentWriterMain","value","components","toAbsolutePath","relativePath","path","join","componentFor","id","toString","beforeEach","fs","mkdtemp","os","tmpdir","afterEach","remove","ensureDir","symlink","throwForSymlinksInTheWay","not","throw","target","outsideFile","writeFile","runtimeTracking","rootCarrying","content","contents","Buffer","from","outputFile","WORKSPACE_JSONC","throwForOccupiedWorkspaceRoot","throwForExistingDir","isEqualWithoutVersion","extensions","ExtensionDataList","fromArray","writerWith","detector","registerWorkspaceRootDetector","throwForNonWorkspaceRootComponent","exts","runFixDirs","writeToPaths","existingRootDirs","getAllRootDirs","writers","scope","fixDirsIfNested","WORKSPACE_ROOT_DIR","shouldSkip","opts","rootDir","dir","toStringWithoutVersion","shouldSkipDirConflictCheck","writeToPathPerId","skipWritingToFs","skipUpdatingBitMap","existingComponentMap","getRootDir","consumer","isLegacy","basename","updatePaths","populateComponentsFilesToWrite","idOf","split","other","componentOf","composeRelativeComponentPath","scopeId","name","pop","rootDirs","warnings","getComponentIdByRootPath","getAllTrackDirs","consoleWarning","msg","getDefaultDir","have","string"],"sources":["component-writer.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport path from 'path';\nimport { WORKSPACE_ROOT_DIR } from '@teambit/legacy.bit-map';\nimport { WORKSPACE_JSONC } from '@teambit/legacy.constants';\nimport { ExtensionDataList } from '@teambit/legacy.extension-data';\nimport ComponentWriter, { isOwnedByNestedComponent } from './component-writer';\nimport { ComponentWriterMain } from './component-writer.main.runtime';\n\ndescribe('isOwnedByNestedComponent', () => {\n const nested = ['packages/comp1', 'packages/comp2'];\n it('should claim a file inside a nested component', () => {\n expect(isOwnedByNestedComponent('packages/comp1/index.js', nested)).to.be.true;\n });\n it('should claim a file deeper inside a nested component', () => {\n expect(isOwnedByNestedComponent('packages/comp1/src/util.js', nested)).to.be.true;\n });\n it('should leave a file the root owns', () => {\n expect(isOwnedByNestedComponent('packages/readme.md', nested)).to.be.false;\n expect(isOwnedByNestedComponent('workspace.jsonc', nested)).to.be.false;\n });\n it('should not claim a directory that merely shares a prefix with a nested one', () => {\n expect(isOwnedByNestedComponent('packages/comp10/index.js', nested)).to.be.false;\n });\n it('should claim the nested root-dir itself, a file cannot sit where the directory is', () => {\n // an older root carries it as a plain file, from before the component was extracted there.\n // writing it over the directory fails the checkout with EISDIR - see isOwnedByNestedComponent\n expect(isOwnedByNestedComponent('packages/comp1', nested)).to.be.true;\n });\n it('should not claim a sibling whose name merely starts with a nested one', () => {\n expect(isOwnedByNestedComponent('packages/comp10', nested)).to.be.false;\n });\n it('should claim nothing when no component is nested, the ordinary case', () => {\n expect(isOwnedByNestedComponent('packages/comp1/index.js', [])).to.be.false;\n });\n});\n\ndescribe('populateFilesToWriteToComponentDir', () => {\n /**\n * the method only reads these fields off the writer. building it through the constructor would\n * need a consumer and a scope, which say nothing about the file-set it produces.\n */\n function writerFor(files: string[], nestedRootDirs: string[], writeToPath = '.') {\n const written: string[] = [];\n const writer = Object.create(ComponentWriter.prototype);\n Object.assign(writer, {\n writeToPath,\n override: true,\n writeConfig: false,\n deleteBitDirContent: false,\n bitMap: { getNestedRootDirs: () => nestedRootDirs },\n component: {\n files: files.map((relative) => ({ relative })),\n dataToPersist: { addFile: (file: any) => written.push(file.relative) },\n license: undefined,\n },\n });\n return { writer, written };\n }\n\n it('should not write over the source of a component nested in the root, an old version still carries it', async () => {\n // the root was snapped before comp1 was extracted out of it, so that version holds comp1's files\n const { writer, written } = writerFor(\n ['workspace.jsonc', 'packages/comp1/index.js', 'readme.md'],\n ['packages/comp1']\n );\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc', 'readme.md']);\n });\n\n it('should write every file when nothing is nested', async () => {\n const { writer, written } = writerFor(['workspace.jsonc', 'packages/comp1/index.js'], []);\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc', 'packages/comp1/index.js']);\n });\n\n it('should keep skipping the live .bitmap, which is never written from a versioned copy', async () => {\n const { writer, written } = writerFor(['.bitmap', 'workspace.jsonc'], []);\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['workspace.jsonc']);\n });\n\n it('should skip it for an ordinary component too, no component but the root ever tracks one', async () => {\n // the scan drops a `.bitmap` at any other component's root (see getScanIgnorePatterns), so what a\n // component versions is what a write lands\n const { writer, written } = writerFor(['.bitmap', 'index.js'], [], 'comp1');\n await writer.populateFilesToWriteToComponentDir();\n expect(written).to.deep.equal(['index.js']);\n });\n});\n\ndescribe('the workspace-root import preflight checks', () => {\n /**\n * the checks read the incoming files, the nested root-dirs and the paths on disk. going through\n * writeMany would need a workspace and a scope, which say nothing about which paths they look at.\n */\n function runtimeFor(nestedRootDirs: string[], workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n // `consumer` is a getter on the class, so it is defined rather than assigned\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: { getNestedRootDirs: () => nestedRootDirs, components: [] },\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n return main;\n }\n const componentFor = (files: string[]) =>\n ({ id: { toString: () => 'my-scope/ws-root' }, files: files.map((relative) => ({ relative })) }) as any;\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-preflight-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should ignore a symlink inside a nested component, the write never goes through it', async () => {\n // an older root version still carries comp1's files, but the writer leaves that directory alone\n await fs.ensureDir(path.join(workspacePath, 'packages'));\n await fs.symlink(os.tmpdir(), path.join(workspacePath, 'packages/comp1'));\n const main = runtimeFor(['packages/comp1'], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['packages/comp1/index.js']))).to.not.throw();\n });\n\n it('should ignore the live .bitmap, which the write does not land either', async () => {\n // a workspace whose own .bitmap is a symbolic link must not fail an import over a file the writer\n // skips anyway (see isWorkspaceMapFile)\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, '.bitmap'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['.bitmap', 'README.md']))).to.not.throw();\n });\n\n it('should refuse a symlinked component.json when the config file is written', async () => {\n // it is generated rather than versioned, so it is not among the component's files - it still\n // lands at the root, and the writer forces override on it\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), true)).to.throw('is a symbolic link');\n });\n\n it('should refuse it even when the caller asked for no config file, the writer turns it on itself', async () => {\n // a config file already at the rootDir makes the writer write one whatever the caller passed\n // (see populateComponentsFilesToWrite), and a symlink pointing at an existing file is read as\n // one. so the flag does not settle whether a write lands here.\n const target = path.join(workspacePath, 'elsewhere');\n await fs.ensureDir(target);\n await fs.symlink(target, path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), false)).to.throw('is a symbolic link');\n });\n\n it('should leave a broken symlink alone, the writer does not write through it either', async () => {\n // it resolves to nothing, so the writer does not read it as an existing config file and no\n // config is written. failing the whole import over it would be for nothing.\n await fs.symlink(path.join(workspacePath, 'missing'), path.join(workspacePath, 'component.json'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']), false)).to.not.throw();\n });\n\n it('should still refuse a symlink on the way to a file the root does own', async () => {\n await fs.symlink(os.tmpdir(), path.join(workspacePath, 'docs'));\n const main = runtimeFor(['packages/comp1'], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['docs/readme.md']))).to.throw('is a symbolic link');\n });\n\n it('should refuse a symlink at the file itself, not only above it', async () => {\n const outsideFile = path.join(workspacePath, 'theirs.md');\n await fs.writeFile(outsideFile, 'theirs\\n');\n await fs.symlink(outsideFile, path.join(workspacePath, 'README.md'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']))).to.throw('is a symbolic link');\n });\n\n it('should refuse a dangling symlink, whose target does not exist, rather than write through it', async () => {\n // a stat would say there is nothing there and let the write create the target; the check lstats\n await fs.symlink(path.join(workspacePath, 'missing-target'), path.join(workspacePath, 'README.md'));\n const main = runtimeFor([], workspacePath);\n expect(() => main.throwForSymlinksInTheWay(componentFor(['README.md']))).to.throw('is a symbolic link');\n });\n});\n\ndescribe('the conflict check at the workspace root', () => {\n /** the same harness as above, with a say in what the map already tracks */\n function runtimeTracking(components: any[], workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: { getNestedRootDirs: () => [], components },\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n return main;\n }\n const rootCarrying = (relative: string, content: string) =>\n ({\n id: { toString: () => 'my-scope/ws-root' },\n files: [{ relative, contents: Buffer.from(content) }],\n }) as any;\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-root-conflict-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should replace the workspace.jsonc \"bit init\" generated, while nothing is tracked yet', async () => {\n await fs.outputFile(path.join(workspacePath, WORKSPACE_JSONC), 'generated by bit init\\n');\n const main = runtimeTracking([], workspacePath);\n expect(() =>\n main.throwForOccupiedWorkspaceRoot(rootCarrying(WORKSPACE_JSONC, 'the versioned one\\n'), {\n throwForExistingDir: true,\n })\n ).to.not.throw();\n });\n\n it('should protect the workspace.jsonc of a workspace that already tracks something', async () => {\n // past `bit init` the file is the user's own, like every other file at the root, so replacing it\n // takes --override. a map holding one component is not a freshly initialized workspace, whichever\n // component it is - the exemption is about what `bit init` just wrote, not about who owns the root\n await fs.outputFile(path.join(workspacePath, WORKSPACE_JSONC), 'the user edited this\\n');\n const main = runtimeTracking([{ id: { isEqualWithoutVersion: () => true } }], workspacePath);\n expect(() =>\n main.throwForOccupiedWorkspaceRoot(rootCarrying(WORKSPACE_JSONC, 'the versioned one\\n'), {\n throwForExistingDir: true,\n })\n ).to.throw(WORKSPACE_JSONC);\n });\n});\n\ndescribe('the guard on what may be written to the workspace root', () => {\n // workspace-root's own spec covers the marker; a stub detector stands in for it here\n const extensions = ExtensionDataList.fromArray([]);\n const component = { id: { toString: () => 'my-scope/comp1' }, extensions } as any;\n const writerWith = (detector?: (exts: ExtensionDataList) => boolean) => {\n const main = Object.create(ComponentWriterMain.prototype);\n if (detector) main.registerWorkspaceRootDetector(detector);\n return main;\n };\n\n it('should refuse a component the detector does not take for a workspace root', () => {\n expect(() => writerWith(() => false).throwForNonWorkspaceRootComponent(component)).to.throw(\n 'not a workspace-root component'\n );\n });\n\n it('should accept a component the detector takes for a workspace root', () => {\n expect(() => writerWith((exts) => exts === extensions).throwForNonWorkspaceRootComponent(component)).to.not.throw();\n });\n\n it('should refuse any component when no detector is registered', () => {\n expect(() => writerWith().throwForNonWorkspaceRootComponent(component)).to.throw('not a workspace-root component');\n });\n});\n\ndescribe('writing the workspace-root component in the same batch as a component nested in it', () => {\n /**\n * the batch goes through fixDirsIfNested, which moves a component aside when another one is to be\n * written inside it. the root must come out of it untouched: it owns \".\" by definition, and the\n * components below it are the normal case rather than a collision.\n */\n function runFixDirs(writeToPaths: string[], existingRootDirs: string[] = []) {\n const main = Object.create(ComponentWriterMain.prototype);\n Object.defineProperty(main, 'workspace', { value: { bitMap: { getAllRootDirs: () => existingRootDirs } } });\n const writers = writeToPaths.map((writeToPath) => ({\n writeToPath,\n component: { id: { scope: 'my-org.my-scope' } },\n }));\n main.fixDirsIfNested(writers);\n return writers.map((writer) => writer.writeToPath);\n }\n\n it('should leave both where they were asked to go', () => {\n expect(runFixDirs([WORKSPACE_ROOT_DIR, 'packages/comp1'])).to.deep.equal([WORKSPACE_ROOT_DIR, 'packages/comp1']);\n });\n\n it('should leave the root alone when the workspace already tracks a component inside it', () => {\n expect(runFixDirs([WORKSPACE_ROOT_DIR], ['packages/comp1'])).to.deep.equal([WORKSPACE_ROOT_DIR]);\n });\n\n it('should leave a component alone when the workspace already tracks the root', () => {\n expect(runFixDirs(['packages/comp1'], [WORKSPACE_ROOT_DIR])).to.deep.equal(['packages/comp1']);\n });\n\n it('should still move an ordinary component that another one is written inside of', () => {\n // the rule the root is untouched by, so the cases above are not passing on an inert branch\n expect(runFixDirs(['bar', 'bar/foo'])).to.deep.equal(['bar_1', 'bar/foo']);\n });\n});\n\ndescribe('deciding whether the directory-conflict check applies to a component', () => {\n /**\n * the decision turns on whether *this* component was asked to go somewhere, which is not the same\n * question as the directory it ends up at: without --path that directory is the default one, and\n * with --path-per-id the batch-level path answers for the wrong component. so it is resolved the\n * same way the write itself resolves it.\n */\n function shouldSkip(opts: Record<string, any>, rootDir?: string, dir = 'some-dir') {\n const main = Object.create(ComponentWriterMain.prototype);\n const component = { id: { toStringWithoutVersion: () => 'my-scope/comp1' } };\n return main.shouldSkipDirConflictCheck(component, dir, rootDir === undefined ? undefined : { rootDir }, opts);\n }\n\n it('should check a component asked for a directory it does not already own', () => {\n expect(shouldSkip({ writeToPath: 'some-dir' }, 'other-dir')).to.be.false;\n });\n\n it('should skip a component asked for the directory it holds today, it overrides itself in place', () => {\n expect(shouldSkip({ writeToPath: 'some-dir' }, 'some-dir')).to.be.true;\n });\n\n it('should skip a tracked component that was asked for nothing, it goes to its default directory', () => {\n expect(shouldSkip({}, 'other-dir')).to.be.true;\n });\n\n it('should take the path asked for this component, not the one asked for the batch', () => {\n expect(shouldSkip({ writeToPathPerId: { 'my-scope/comp1': 'some-dir' } }, 'other-dir')).to.be.false;\n });\n\n it('should check a component that is not tracked yet, whatever was asked for it', () => {\n expect(shouldSkip({})).to.be.false;\n });\n\n it('should skip everything when nothing is written to the filesystem at all', () => {\n expect(shouldSkip({ skipWritingToFs: true, writeToPath: 'some-dir' }, 'other-dir')).to.be.true;\n });\n\n it('should treat a component already tracked at the workspace root as any other tracked directory', () => {\n // re-importing a tracked component updates the files it owns, and the root is not an exception\n // to that. what needs --override is a component arriving at a root someone else's files are at,\n // which has no map entry yet - the !componentMap branch of throwErrorWhenDirectoryNotEmpty is\n // where that is decided, and this skip never reaches past it.\n expect(shouldSkip({}, WORKSPACE_ROOT_DIR, WORKSPACE_ROOT_DIR)).to.be.true;\n expect(shouldSkip({ writeToPath: WORKSPACE_ROOT_DIR }, WORKSPACE_ROOT_DIR, WORKSPACE_ROOT_DIR)).to.be.true;\n });\n});\n\ndescribe('the destination of an already tracked workspace-root component', () => {\n it('should be the workspace root, whatever path the caller derived without --path', async () => {\n const writer = Object.create(ComponentWriter.prototype);\n Object.assign(writer, {\n // what composeRelativeComponentPath returns when no --path is given\n writeToPath: 'my-scope/ws-root',\n override: true,\n writeConfig: false,\n skipUpdatingBitMap: true,\n existingComponentMap: { rootDir: WORKSPACE_ROOT_DIR, getRootDir: () => WORKSPACE_ROOT_DIR },\n bitMap: { getNestedRootDirs: () => [] },\n consumer: undefined,\n component: {\n id: { toString: () => 'my-scope/ws-root' },\n isLegacy: false,\n files: [{ relative: 'README.md', basename: 'README.md', path: 'README.md', updatePaths: () => {} }],\n },\n });\n await writer.populateComponentsFilesToWrite();\n expect(writer.writeToPath).to.equal(WORKSPACE_ROOT_DIR);\n });\n});\n\ndescribe('the default dir of a component whose dir is used by a component of another owner', () => {\n const idOf = (id: string) => ({\n scope: id.split('/')[0],\n toString: () => id,\n toStringWithoutVersion: () => id,\n isEqualWithoutVersion: (other: { toString: () => string }) => other.toString() === id,\n });\n const componentOf = (id: string) => ({ id: idOf(id) }) as any;\n /** the default \"defaultDirectory\" template, {scope}/{name}, which omits the owner */\n const composeRelativeComponentPath = (id: { toString: () => string }) => {\n const [scopeId, ...name] = id.toString().split('/');\n return [scopeId.split('.').pop(), ...name].join('/');\n };\n function runtimeTracking(rootDirs: Record<string, string>, workspacePath: string) {\n const main = Object.create(ComponentWriterMain.prototype);\n const warnings: string[] = [];\n Object.defineProperty(main, 'consumer', {\n value: {\n bitMap: {\n getComponentIdByRootPath: (rootDir: string) => (rootDirs[rootDir] ? idOf(rootDirs[rootDir]) : undefined),\n getAllTrackDirs: () => rootDirs,\n },\n composeRelativeComponentPath,\n toAbsolutePath: (relativePath: string) => path.join(workspacePath, relativePath),\n },\n });\n Object.defineProperty(main, 'logger', { value: { consoleWarning: (msg: string) => warnings.push(msg) } });\n return { main, warnings };\n }\n\n let workspacePath: string;\n beforeEach(async () => {\n workspacePath = await fs.mkdtemp(path.join(os.tmpdir(), 'bit-default-dir-'));\n });\n afterEach(async () => {\n await fs.remove(workspacePath);\n });\n\n it('should prefix the dir with the owner name and warn about it', () => {\n const { main, warnings } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('org2/ui/button');\n expect(warnings[0]).to.have.string('org1.ui/button');\n });\n it('should keep the default dir when it is free', () => {\n const { main } = runtimeTracking({}, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when it is used by the same component', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org2.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the owner dir is not empty, so the conflict check reports it', async () => {\n await fs.outputFile(path.join(workspacePath, 'org2/ui/button/index.js'), '');\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the owner dir is nested in a tracked dir, which would move it unchecked', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button', 'org2/ui': 'org2.misc/ui' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), true)).to.equal('ui/button');\n });\n it('should keep the default dir when the scope has no owner', () => {\n const { main } = runtimeTracking({ 'my-scope/button': 'other-scope/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('my-scope/button'), true)).to.equal('my-scope/button');\n });\n it('should not look for another dir when asked not to, e.g. the component is already in .bitmap', () => {\n const { main } = runtimeTracking({ 'ui/button': 'org1.ui/button' }, workspacePath);\n expect(main.getDefaultDir(componentOf('org2.ui/button'), false)).to.equal('ui/button');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,IAAA;EAAA,MAAAJ,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAG,GAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EA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,gBAAgB,CAAC,EAAE,KAAK,CAAC,CAAC,CAACzG,EAAE,CAAC8B,KAAK,CAAC,WAAW,CAAC;EACxF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component-writer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1245",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component-writer",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component-writer",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1245"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"fs-extra": "10.0.0",
|
|
@@ -21,26 +21,25 @@
|
|
|
21
21
|
"@teambit/logger": "0.0.1500",
|
|
22
22
|
"@teambit/toolbox.path.path": "0.0.26",
|
|
23
23
|
"@teambit/component-version": "1.0.4",
|
|
24
|
-
"@teambit/compiler": "1.0.
|
|
25
|
-
"@teambit/component.modules.merge-helper": "0.0.
|
|
26
|
-
"@teambit/component.sources": "0.0.
|
|
27
|
-
"@teambit/config-merger": "0.0.
|
|
28
|
-
"@teambit/install": "1.0.
|
|
29
|
-
"@teambit/legacy.bit-map": "0.0.
|
|
30
|
-
"@teambit/legacy.consumer-component": "0.0.
|
|
31
|
-
"@teambit/legacy.consumer": "0.0.
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/
|
|
34
|
-
"@teambit/workspace": "1.0.
|
|
35
|
-
"@teambit/legacy.scope": "0.0.
|
|
36
|
-
"@teambit/objects": "0.0.
|
|
24
|
+
"@teambit/compiler": "1.0.1245",
|
|
25
|
+
"@teambit/component.modules.merge-helper": "0.0.134",
|
|
26
|
+
"@teambit/component.sources": "0.0.242",
|
|
27
|
+
"@teambit/config-merger": "0.0.1112",
|
|
28
|
+
"@teambit/install": "1.0.1245",
|
|
29
|
+
"@teambit/legacy.bit-map": "0.0.247",
|
|
30
|
+
"@teambit/legacy.consumer-component": "0.0.191",
|
|
31
|
+
"@teambit/legacy.consumer": "0.0.190",
|
|
32
|
+
"@teambit/legacy.extension-data": "0.0.192",
|
|
33
|
+
"@teambit/mover": "1.0.1245",
|
|
34
|
+
"@teambit/workspace": "1.0.1245",
|
|
35
|
+
"@teambit/legacy.scope": "0.0.190",
|
|
36
|
+
"@teambit/objects": "0.0.724"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/fs-extra": "9.0.7",
|
|
40
40
|
"@types/lodash": "4.14.165",
|
|
41
41
|
"@types/mocha": "9.1.0",
|
|
42
|
-
"@teambit/harmony.envs.core-aspect-env": "2.1.2"
|
|
43
|
-
"@teambit/legacy.extension-data": "0.0.191"
|
|
42
|
+
"@teambit/harmony.envs.core-aspect-env": "2.1.2"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"chai": "5.2.1"
|
|
File without changes
|