@teambit/component-writer 1.0.14 → 1.0.15

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.
@@ -5,6 +5,7 @@ import BitMap from '@teambit/legacy/dist/consumer/bit-map/bit-map';
5
5
  import ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';
6
6
  import Component from '@teambit/legacy/dist/consumer/component/consumer-component';
7
7
  import Consumer from '@teambit/legacy/dist/consumer/consumer';
8
+ import { Workspace } from '@teambit/workspace';
8
9
  export declare type ComponentWriterProps = {
9
10
  component: Component;
10
11
  writeToPath: PathLinuxRelative;
@@ -12,7 +13,7 @@ export declare type ComponentWriterProps = {
12
13
  writePackageJson?: boolean;
13
14
  override?: boolean;
14
15
  isolated?: boolean;
15
- consumer: Consumer | undefined;
16
+ workspace: Workspace;
16
17
  scope?: Scope | undefined;
17
18
  bitMap: BitMap;
18
19
  ignoreBitDependencies?: boolean | BitIds;
@@ -28,13 +29,14 @@ export default class ComponentWriter {
28
29
  override: boolean;
29
30
  isolated?: boolean;
30
31
  consumer: Consumer | undefined;
32
+ workspace: Workspace;
31
33
  scope?: Scope | undefined;
32
34
  bitMap: BitMap;
33
35
  ignoreBitDependencies: boolean | BitIds;
34
36
  deleteBitDirContent: boolean | undefined;
35
37
  existingComponentMap: ComponentMap | undefined;
36
38
  skipUpdatingBitMap?: boolean;
37
- constructor({ component, writeToPath, writeConfig, writePackageJson, override, isolated, consumer, scope, bitMap, ignoreBitDependencies, deleteBitDirContent, existingComponentMap, skipUpdatingBitMap, }: ComponentWriterProps);
39
+ constructor({ component, writeToPath, writeConfig, writePackageJson, override, isolated, workspace, scope, bitMap, ignoreBitDependencies, deleteBitDirContent, existingComponentMap, skipUpdatingBitMap, }: ComponentWriterProps);
38
40
  /**
39
41
  * write the component to the filesystem and update .bitmap with the details.
40
42
  *
@@ -47,7 +49,7 @@ export default class ComponentWriter {
47
49
  populateComponentsFilesToWrite(): Promise<Component>;
48
50
  private throwForImportingLegacyIntoHarmony;
49
51
  populateFilesToWriteToComponentDir(): Promise<void>;
50
- addComponentToBitMap(rootDir: string | undefined): Promise<ComponentMap>;
52
+ addComponentToBitMap(rootDir: string): Promise<ComponentMap>;
51
53
  private replaceSnapWithTagIfNeeded;
52
54
  _updateComponentRootPathAccordingToBitMap(): void;
53
55
  _updateFilesBasePaths(): void;
@@ -88,8 +88,8 @@ class ComponentWriter {
88
88
  writePackageJson = true,
89
89
  override = true,
90
90
  isolated = false,
91
- consumer,
92
- scope = consumer === null || consumer === void 0 ? void 0 : consumer.scope,
91
+ workspace,
92
+ scope = (_workspace$consumer => (_workspace$consumer = workspace.consumer) === null || _workspace$consumer === void 0 ? void 0 : _workspace$consumer.scope)(),
93
93
  bitMap,
94
94
  ignoreBitDependencies = true,
95
95
  deleteBitDirContent,
@@ -105,6 +105,7 @@ class ComponentWriter {
105
105
  _defineProperty(this, "isolated", void 0);
106
106
  _defineProperty(this, "consumer", void 0);
107
107
  // when using capsule, the consumer is not defined
108
+ _defineProperty(this, "workspace", void 0);
108
109
  _defineProperty(this, "scope", void 0);
109
110
  _defineProperty(this, "bitMap", void 0);
110
111
  _defineProperty(this, "ignoreBitDependencies", void 0);
@@ -117,7 +118,8 @@ class ComponentWriter {
117
118
  this.writePackageJson = writePackageJson;
118
119
  this.override = override;
119
120
  this.isolated = isolated;
120
- this.consumer = consumer;
121
+ this.workspace = workspace;
122
+ this.consumer = workspace.consumer;
121
123
  this.scope = scope;
122
124
  this.bitMap = bitMap;
123
125
  this.ignoreBitDependencies = ignoreBitDependencies;
@@ -194,9 +196,12 @@ class ComponentWriter {
194
196
  test: file.test
195
197
  };
196
198
  });
199
+ const componentId = await this.replaceSnapWithTagIfNeeded();
200
+ const defaultScope = componentId.hasScope() ? undefined : await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentId.name);
197
201
  return this.bitMap.addComponent({
198
202
  componentId: await this.replaceSnapWithTagIfNeeded(),
199
203
  files: filesForBitMap,
204
+ defaultScope,
200
205
  mainFile: (0, _path2().pathNormalizeToLinux)(this.component.mainFile),
201
206
  rootDir
202
207
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","path","_interopRequireWildcard","_showDoctorError","_logger","_componentNodeModulesPath","_path2","_dataToPersist","_removePath","_componentVersion","_objects","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentWriter","constructor","component","writeToPath","writeConfig","writePackageJson","override","isolated","consumer","scope","bitMap","ignoreBitDependencies","deleteBitDirContent","existingComponentMap","skipUpdatingBitMap","write","Error","populateComponentsFilesToWrite","dataToPersist","addBasePath","getPath","persistAllToFS","files","length","ShowDoctorError","id","toString","throwForImportingLegacyIntoHarmony","DataToPersist","_updateFilesBasePaths","componentMap","addComponentToBitMap","_updateComponentRootPathAccordingToBitMap","rootDir","populateFilesToWriteToComponentDir","isLegacy","removePath","RemovePath","forEach","file","map","addFile","license","contents","updatePaths","newBase","filesForBitMap","name","basename","relativePath","pathNormalizeToLinux","relative","test","addComponent","componentId","replaceSnapWithTagIfNeeded","mainFile","_this$scope","version","isHash","compFromModel","getModelComponentIfExist","tag","getTagOfRefIfExists","Ref","from","changeVersion","getRootDir","writtenPath","_cleanOldNestedComponent","oldLocation","join","logger","debugAndAddBreadCrumb","fs","remove","_removeNodeModulesLinksFromDependents","removeComponent","directDependentIds","getAuthoredAndImportedDependentsIdsOf","Promise","all","dependentId","dependentComponentMap","getComponent","relativeLinkPath","getNodeModulesPathOfComponent","nodeModulesLinkAbs","toAbsolutePath","debug","resolve","exports"],"sources":["component-writer.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport * as path from 'path';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport ShowDoctorError from '@teambit/legacy/dist/error/show-doctor-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport getNodeModulesPathOfComponent from '@teambit/legacy/dist/utils/bit/component-node-modules-path';\nimport { PathLinuxRelative, pathNormalizeToLinux } from '@teambit/legacy/dist/utils/path';\nimport BitMap from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport { isHash } from '@teambit/component-version';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\n\nexport type ComponentWriterProps = {\n component: Component;\n writeToPath: PathLinuxRelative;\n writeConfig?: boolean;\n writePackageJson?: boolean;\n override?: boolean;\n isolated?: boolean;\n consumer: Consumer | undefined;\n scope?: Scope | undefined;\n bitMap: BitMap;\n ignoreBitDependencies?: boolean | BitIds;\n deleteBitDirContent?: boolean;\n existingComponentMap?: ComponentMap;\n skipUpdatingBitMap?: boolean;\n};\n\nexport default class ComponentWriter {\n component: Component;\n writeToPath: PathLinuxRelative;\n writeConfig?: boolean;\n writePackageJson?: boolean;\n override: boolean; // default to true\n isolated?: boolean;\n consumer: Consumer | undefined; // when using capsule, the consumer is not defined\n scope?: Scope | undefined;\n bitMap: BitMap;\n ignoreBitDependencies: boolean | BitIds;\n deleteBitDirContent: boolean | undefined;\n existingComponentMap: ComponentMap | undefined;\n skipUpdatingBitMap?: boolean;\n\n constructor({\n component,\n writeToPath,\n writeConfig = false,\n writePackageJson = true,\n override = true,\n isolated = false,\n consumer,\n scope = consumer?.scope,\n bitMap,\n ignoreBitDependencies = true,\n deleteBitDirContent,\n existingComponentMap,\n skipUpdatingBitMap,\n }: ComponentWriterProps) {\n this.component = component;\n this.writeToPath = writeToPath;\n this.writeConfig = writeConfig;\n this.writePackageJson = writePackageJson;\n this.override = override;\n this.isolated = isolated;\n this.consumer = consumer;\n this.scope = scope;\n this.bitMap = bitMap;\n this.ignoreBitDependencies = ignoreBitDependencies;\n this.deleteBitDirContent = deleteBitDirContent;\n this.existingComponentMap = existingComponentMap;\n this.skipUpdatingBitMap = skipUpdatingBitMap;\n }\n\n /**\n * write the component to the filesystem and update .bitmap with the details.\n *\n * bitMap gets updated before writing the files to the filesystem, because as part of writing the\n * package-json file, the componentMap is needed to be stored with the updated version.\n *\n * when a component is not new, write the files according to the paths in .bitmap.\n */\n async write(): Promise<Component> {\n if (!this.consumer) throw new Error('ComponentWriter.write expect to have a consumer');\n await this.populateComponentsFilesToWrite();\n this.component.dataToPersist.addBasePath(this.consumer.getPath());\n await this.component.dataToPersist.persistAllToFS();\n return this.component;\n }\n\n async populateComponentsFilesToWrite(): Promise<Component> {\n if (this.isolated) throw new Error('for isolation, please use this.populateComponentsFilesToWriteForCapsule()');\n if (!this.component.files || !this.component.files.length) {\n throw new ShowDoctorError(`Component ${this.component.id.toString()} is invalid as it has no files`);\n }\n this.throwForImportingLegacyIntoHarmony();\n this.component.dataToPersist = new DataToPersist();\n this._updateFilesBasePaths();\n this.component.componentMap = this.existingComponentMap || (await this.addComponentToBitMap(this.writeToPath));\n this.deleteBitDirContent = false;\n this._updateComponentRootPathAccordingToBitMap();\n if (!this.skipUpdatingBitMap) {\n this.component.componentMap = await this.addComponentToBitMap(this.component.componentMap.rootDir);\n }\n this.writePackageJson = false;\n await this.populateFilesToWriteToComponentDir();\n return this.component;\n }\n\n private throwForImportingLegacyIntoHarmony() {\n if (this.component.isLegacy && this.consumer) {\n throw new Error(\n `unable to write component \"${this.component.id.toString()}\", it is a legacy component and this workspace is Harmony`\n );\n }\n }\n\n async populateFilesToWriteToComponentDir() {\n if (this.deleteBitDirContent) {\n this.component.dataToPersist.removePath(new RemovePath(this.writeToPath));\n }\n this.component.files.forEach((file) => (file.override = this.override));\n this.component.files.map((file) => this.component.dataToPersist.addFile(file));\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.component.license && this.component.license.contents) {\n this.component.license.updatePaths({ newBase: this.writeToPath });\n // $FlowFixMe this.component.license is set\n this.component.license.override = this.override;\n // $FlowFixMe this.component.license is set\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.component.dataToPersist.addFile(this.component.license);\n }\n }\n\n async addComponentToBitMap(rootDir: string | undefined): Promise<ComponentMap> {\n if (rootDir === '.') {\n throw new Error('addComponentToBitMap: rootDir cannot be \".\"');\n }\n const filesForBitMap = this.component.files.map((file) => {\n return { name: file.basename, relativePath: pathNormalizeToLinux(file.relative), test: file.test };\n });\n\n return this.bitMap.addComponent({\n componentId: await this.replaceSnapWithTagIfNeeded(),\n files: filesForBitMap,\n mainFile: pathNormalizeToLinux(this.component.mainFile),\n rootDir,\n });\n }\n\n private async replaceSnapWithTagIfNeeded(): Promise<BitId> {\n const version = this.component.id.version;\n if (!version || !isHash(version)) {\n return this.component.id;\n }\n const compFromModel = await this.scope?.getModelComponentIfExist(this.component.id);\n const tag = compFromModel?.getTagOfRefIfExists(Ref.from(version));\n if (tag) return this.component.id.changeVersion(tag);\n return this.component.id;\n }\n\n _updateComponentRootPathAccordingToBitMap() {\n // @ts-ignore this.component.componentMap is set\n this.writeToPath = this.component.componentMap.getRootDir();\n this.component.writtenPath = this.writeToPath;\n this._updateFilesBasePaths();\n }\n\n _updateFilesBasePaths() {\n const newBase = this.writeToPath || '.';\n this.component.files.forEach((file) => file.updatePaths({ newBase }));\n }\n\n async _cleanOldNestedComponent() {\n if (!this.consumer) throw new Error('ComponentWriter._cleanOldNestedComponent expect to have a consumer');\n // @ts-ignore this function gets called when it was previously NESTED, so the rootDir is set\n const oldLocation = path.join(this.consumer.getPath(), this.component.componentMap.rootDir);\n logger.debugAndAddBreadCrumb(\n 'component-writer._cleanOldNestedComponent',\n 'deleting the old directory of a component at {oldLocation}',\n { oldLocation }\n );\n await fs.remove(oldLocation);\n await this._removeNodeModulesLinksFromDependents();\n this.bitMap.removeComponent(this.component.id);\n }\n\n async _removeNodeModulesLinksFromDependents() {\n if (!this.consumer) {\n throw new Error('ComponentWriter._removeNodeModulesLinksFromDependents expect to have a consumer');\n }\n const directDependentIds = await this.consumer.getAuthoredAndImportedDependentsIdsOf([this.component]);\n await Promise.all(\n directDependentIds.map((dependentId) => {\n const dependentComponentMap = this.consumer ? this.consumer.bitMap.getComponent(dependentId) : null;\n const relativeLinkPath = this.consumer ? getNodeModulesPathOfComponent(this.component) : null;\n const nodeModulesLinkAbs =\n this.consumer && dependentComponentMap && relativeLinkPath\n ? this.consumer.toAbsolutePath(path.join(dependentComponentMap.getRootDir(), relativeLinkPath))\n : null;\n if (nodeModulesLinkAbs) {\n logger.debug(`deleting an obsolete link to node_modules at ${nodeModulesLinkAbs}`);\n }\n return nodeModulesLinkAbs ? fs.remove(nodeModulesLinkAbs) : Promise.resolve();\n })\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,iBAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,gBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA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AAO,CAAC,CAAC;IAC/E,CAAC,CACH,CAAC;EACH;AACF;AAACC,OAAA,CAAA5H,OAAA,GAAAiC,eAAA"}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","path","_interopRequireWildcard","_showDoctorError","_logger","_componentNodeModulesPath","_path2","_dataToPersist","_removePath","_componentVersion","_objects","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_defineProperty","value","_toPropertyKey","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentWriter","constructor","component","writeToPath","writeConfig","writePackageJson","override","isolated","workspace","scope","_workspace$consumer","consumer","bitMap","ignoreBitDependencies","deleteBitDirContent","existingComponentMap","skipUpdatingBitMap","write","Error","populateComponentsFilesToWrite","dataToPersist","addBasePath","getPath","persistAllToFS","files","length","ShowDoctorError","id","toString","throwForImportingLegacyIntoHarmony","DataToPersist","_updateFilesBasePaths","componentMap","addComponentToBitMap","_updateComponentRootPathAccordingToBitMap","rootDir","populateFilesToWriteToComponentDir","isLegacy","removePath","RemovePath","forEach","file","map","addFile","license","contents","updatePaths","newBase","filesForBitMap","name","basename","relativePath","pathNormalizeToLinux","relative","test","componentId","replaceSnapWithTagIfNeeded","defaultScope","hasScope","componentDefaultScopeFromComponentDirAndName","addComponent","mainFile","_this$scope","version","isHash","compFromModel","getModelComponentIfExist","tag","getTagOfRefIfExists","Ref","from","changeVersion","getRootDir","writtenPath","_cleanOldNestedComponent","oldLocation","join","logger","debugAndAddBreadCrumb","fs","remove","_removeNodeModulesLinksFromDependents","removeComponent","directDependentIds","getAuthoredAndImportedDependentsIdsOf","Promise","all","dependentId","dependentComponentMap","getComponent","relativeLinkPath","getNodeModulesPathOfComponent","nodeModulesLinkAbs","toAbsolutePath","debug","resolve","exports"],"sources":["component-writer.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport * as path from 'path';\nimport { BitId, BitIds } from '@teambit/legacy/dist/bit-id';\nimport ShowDoctorError from '@teambit/legacy/dist/error/show-doctor-error';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { Scope } from '@teambit/legacy/dist/scope';\nimport getNodeModulesPathOfComponent from '@teambit/legacy/dist/utils/bit/component-node-modules-path';\nimport { PathLinuxRelative, pathNormalizeToLinux } from '@teambit/legacy/dist/utils/path';\nimport BitMap from '@teambit/legacy/dist/consumer/bit-map/bit-map';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport Component from '@teambit/legacy/dist/consumer/component/consumer-component';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport RemovePath from '@teambit/legacy/dist/consumer/component/sources/remove-path';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport { isHash } from '@teambit/component-version';\nimport { Ref } from '@teambit/legacy/dist/scope/objects';\nimport { Workspace } from '@teambit/workspace';\n\nexport type ComponentWriterProps = {\n component: Component;\n writeToPath: PathLinuxRelative;\n writeConfig?: boolean;\n writePackageJson?: boolean;\n override?: boolean;\n isolated?: boolean;\n workspace: Workspace;\n scope?: Scope | undefined;\n bitMap: BitMap;\n ignoreBitDependencies?: boolean | BitIds;\n deleteBitDirContent?: boolean;\n existingComponentMap?: ComponentMap;\n skipUpdatingBitMap?: boolean;\n};\n\nexport default class ComponentWriter {\n component: Component;\n writeToPath: PathLinuxRelative;\n writeConfig?: boolean;\n writePackageJson?: boolean;\n override: boolean; // default to true\n isolated?: boolean;\n consumer: Consumer | undefined; // when using capsule, the consumer is not defined\n workspace: Workspace;\n scope?: Scope | undefined;\n bitMap: BitMap;\n ignoreBitDependencies: boolean | BitIds;\n deleteBitDirContent: boolean | undefined;\n existingComponentMap: ComponentMap | undefined;\n skipUpdatingBitMap?: boolean;\n\n constructor({\n component,\n writeToPath,\n writeConfig = false,\n writePackageJson = true,\n override = true,\n isolated = false,\n workspace,\n scope = workspace.consumer?.scope,\n bitMap,\n ignoreBitDependencies = true,\n deleteBitDirContent,\n existingComponentMap,\n skipUpdatingBitMap,\n }: ComponentWriterProps) {\n this.component = component;\n this.writeToPath = writeToPath;\n this.writeConfig = writeConfig;\n this.writePackageJson = writePackageJson;\n this.override = override;\n this.isolated = isolated;\n this.workspace = workspace;\n this.consumer = workspace.consumer;\n this.scope = scope;\n this.bitMap = bitMap;\n this.ignoreBitDependencies = ignoreBitDependencies;\n this.deleteBitDirContent = deleteBitDirContent;\n this.existingComponentMap = existingComponentMap;\n this.skipUpdatingBitMap = skipUpdatingBitMap;\n }\n\n /**\n * write the component to the filesystem and update .bitmap with the details.\n *\n * bitMap gets updated before writing the files to the filesystem, because as part of writing the\n * package-json file, the componentMap is needed to be stored with the updated version.\n *\n * when a component is not new, write the files according to the paths in .bitmap.\n */\n async write(): Promise<Component> {\n if (!this.consumer) throw new Error('ComponentWriter.write expect to have a consumer');\n await this.populateComponentsFilesToWrite();\n this.component.dataToPersist.addBasePath(this.consumer.getPath());\n await this.component.dataToPersist.persistAllToFS();\n return this.component;\n }\n\n async populateComponentsFilesToWrite(): Promise<Component> {\n if (this.isolated) throw new Error('for isolation, please use this.populateComponentsFilesToWriteForCapsule()');\n if (!this.component.files || !this.component.files.length) {\n throw new ShowDoctorError(`Component ${this.component.id.toString()} is invalid as it has no files`);\n }\n this.throwForImportingLegacyIntoHarmony();\n this.component.dataToPersist = new DataToPersist();\n this._updateFilesBasePaths();\n this.component.componentMap = this.existingComponentMap || (await this.addComponentToBitMap(this.writeToPath));\n this.deleteBitDirContent = false;\n this._updateComponentRootPathAccordingToBitMap();\n if (!this.skipUpdatingBitMap) {\n this.component.componentMap = await this.addComponentToBitMap(this.component.componentMap.rootDir);\n }\n this.writePackageJson = false;\n await this.populateFilesToWriteToComponentDir();\n return this.component;\n }\n\n private throwForImportingLegacyIntoHarmony() {\n if (this.component.isLegacy && this.consumer) {\n throw new Error(\n `unable to write component \"${this.component.id.toString()}\", it is a legacy component and this workspace is Harmony`\n );\n }\n }\n\n async populateFilesToWriteToComponentDir() {\n if (this.deleteBitDirContent) {\n this.component.dataToPersist.removePath(new RemovePath(this.writeToPath));\n }\n this.component.files.forEach((file) => (file.override = this.override));\n this.component.files.map((file) => this.component.dataToPersist.addFile(file));\n\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n if (this.component.license && this.component.license.contents) {\n this.component.license.updatePaths({ newBase: this.writeToPath });\n // $FlowFixMe this.component.license is set\n this.component.license.override = this.override;\n // $FlowFixMe this.component.license is set\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n this.component.dataToPersist.addFile(this.component.license);\n }\n }\n\n async addComponentToBitMap(rootDir: string): Promise<ComponentMap> {\n if (rootDir === '.') {\n throw new Error('addComponentToBitMap: rootDir cannot be \".\"');\n }\n const filesForBitMap = this.component.files.map((file) => {\n return { name: file.basename, relativePath: pathNormalizeToLinux(file.relative), test: file.test };\n });\n\n const componentId = await this.replaceSnapWithTagIfNeeded();\n const defaultScope = componentId.hasScope()\n ? undefined\n : await this.workspace.componentDefaultScopeFromComponentDirAndName(rootDir, componentId.name);\n return this.bitMap.addComponent({\n componentId: await this.replaceSnapWithTagIfNeeded(),\n files: filesForBitMap,\n defaultScope,\n mainFile: pathNormalizeToLinux(this.component.mainFile),\n rootDir,\n });\n }\n\n private async replaceSnapWithTagIfNeeded(): Promise<BitId> {\n const version = this.component.id.version;\n if (!version || !isHash(version)) {\n return this.component.id;\n }\n const compFromModel = await this.scope?.getModelComponentIfExist(this.component.id);\n const tag = compFromModel?.getTagOfRefIfExists(Ref.from(version));\n if (tag) return this.component.id.changeVersion(tag);\n return this.component.id;\n }\n\n _updateComponentRootPathAccordingToBitMap() {\n // @ts-ignore this.component.componentMap is set\n this.writeToPath = this.component.componentMap.getRootDir();\n this.component.writtenPath = this.writeToPath;\n this._updateFilesBasePaths();\n }\n\n _updateFilesBasePaths() {\n const newBase = this.writeToPath || '.';\n this.component.files.forEach((file) => file.updatePaths({ newBase }));\n }\n\n async _cleanOldNestedComponent() {\n if (!this.consumer) throw new Error('ComponentWriter._cleanOldNestedComponent expect to have a consumer');\n // @ts-ignore this function gets called when it was previously NESTED, so the rootDir is set\n const oldLocation = path.join(this.consumer.getPath(), this.component.componentMap.rootDir);\n logger.debugAndAddBreadCrumb(\n 'component-writer._cleanOldNestedComponent',\n 'deleting the old directory of a component at {oldLocation}',\n { oldLocation }\n );\n await fs.remove(oldLocation);\n await this._removeNodeModulesLinksFromDependents();\n this.bitMap.removeComponent(this.component.id);\n }\n\n async _removeNodeModulesLinksFromDependents() {\n if (!this.consumer) {\n throw new Error('ComponentWriter._removeNodeModulesLinksFromDependents expect to have a consumer');\n }\n const directDependentIds = await this.consumer.getAuthoredAndImportedDependentsIdsOf([this.component]);\n await Promise.all(\n directDependentIds.map((dependentId) => {\n const dependentComponentMap = this.consumer ? this.consumer.bitMap.getComponent(dependentId) : null;\n const relativeLinkPath = this.consumer ? getNodeModulesPathOfComponent(this.component) : null;\n const nodeModulesLinkAbs =\n this.consumer && dependentComponentMap && relativeLinkPath\n ? this.consumer.toAbsolutePath(path.join(dependentComponentMap.getRootDir(), relativeLinkPath))\n : null;\n if (nodeModulesLinkAbs) {\n logger.debug(`deleting an obsolete link to node_modules at ${nodeModulesLinkAbs}`);\n }\n return nodeModulesLinkAbs ? fs.remove(nodeModulesLinkAbs) : Promise.resolve();\n })\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAA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YAAY,CAACF,WAAW,CAAC,GAAG,IAAI;MACnG,MAAMG,gBAAgB,GAAG,IAAI,CAAC/E,QAAQ,GAAG,IAAAgF,mCAA6B,EAAC,IAAI,CAACzF,SAAS,CAAC,GAAG,IAAI;MAC7F,MAAM0F,kBAAkB,GACtB,IAAI,CAACjF,QAAQ,IAAI6E,qBAAqB,IAAIE,gBAAgB,GACtD,IAAI,CAAC/E,QAAQ,CAACkF,cAAc,CAAC/I,IAAI,CAAD,CAAC,CAAC8H,IAAI,CAACY,qBAAqB,CAAChB,UAAU,CAAC,CAAC,EAAEkB,gBAAgB,CAAC,CAAC,GAC7F,IAAI;MACV,IAAIE,kBAAkB,EAAE;QACtBf,iBAAM,CAACiB,KAAK,CAAE,gDAA+CF,kBAAmB,EAAC,CAAC;MACpF;MACA,OAAOA,kBAAkB,GAAGb,kBAAE,CAACC,MAAM,CAACY,kBAAkB,CAAC,GAAGP,OAAO,CAACU,OAAO,CAAC,CAAC;IAC/E,CAAC,CACH,CAAC;EACH;AACF;AAACC,OAAA,CAAAjI,OAAA,GAAAiC,eAAA"}
@@ -33,6 +33,15 @@ export declare class ComponentWriterMain {
33
33
  private compileGracefully;
34
34
  private persistComponentsData;
35
35
  private populateComponentsFilesToWrite;
36
+ /**
37
+ * this started to be an issue once same-name different-scope is supported.
38
+ * by default, the component-dir consist of the scope-name part of the scope-id, without the owner part.
39
+ * as a result, it's possible that multiple components have the same name, same scope-name but different owner.
40
+ * e.g. org1.ui/button and org2.ui/button. the component-dir for both is "ui/button".
41
+ * in this case, we try to prefix the component-dir with the owner-name and if not possible, just increment it (ui/button_1)
42
+ */
43
+ private fixDirsIfEqual;
44
+ private incrementPathRecursively;
36
45
  /**
37
46
  * e.g. [bar, bar/foo] => [bar_1, bar/foo]
38
47
  * otherwise, the bar/foo component will be saved inside "bar" component.
@@ -53,6 +53,13 @@ function _fsExtra() {
53
53
  };
54
54
  return data;
55
55
  }
56
+ function _lodash() {
57
+ const data = require("lodash");
58
+ _lodash = function () {
59
+ return data;
60
+ };
61
+ return data;
62
+ }
56
63
  function _pMapSeries() {
57
64
  const data = _interopRequireDefault(require("p-map-series"));
58
65
  _pMapSeries = function () {
@@ -200,6 +207,7 @@ class ComponentWriterMain {
200
207
  async populateComponentsFilesToWrite(opts) {
201
208
  const writeComponentsParams = opts.components.map(component => this.getWriteParamsOfOneComponent(component, opts));
202
209
  const componentWriterInstances = writeComponentsParams.map(writeParams => new (_componentWriter().default)(writeParams));
210
+ this.fixDirsIfEqual(componentWriterInstances);
203
211
  this.fixDirsIfNested(componentWriterInstances);
204
212
  // add componentMap entries into .bitmap before starting the process because steps like writing package-json
205
213
  // rely on .bitmap to determine whether a dependency exists and what's its origin
@@ -214,6 +222,43 @@ class ComponentWriterMain {
214
222
  }
215
223
  await (0, _pMapSeries().default)(componentWriterInstances, componentWriter => componentWriter.populateComponentsFilesToWrite());
216
224
  }
225
+
226
+ /**
227
+ * this started to be an issue once same-name different-scope is supported.
228
+ * by default, the component-dir consist of the scope-name part of the scope-id, without the owner part.
229
+ * as a result, it's possible that multiple components have the same name, same scope-name but different owner.
230
+ * e.g. org1.ui/button and org2.ui/button. the component-dir for both is "ui/button".
231
+ * in this case, we try to prefix the component-dir with the owner-name and if not possible, just increment it (ui/button_1)
232
+ */
233
+ fixDirsIfEqual(componentWriterInstances) {
234
+ const allDirs = componentWriterInstances.map(c => c.writeToPath);
235
+ const duplicatedDirs = allDirs.filter(dir => allDirs.filter(d => d === dir).length > 1);
236
+ if (!duplicatedDirs.length) return;
237
+ const uniqDuplicates = (0, _lodash().uniq)(duplicatedDirs);
238
+ uniqDuplicates.forEach(compDir => {
239
+ const hasDuplication = componentWriterInstances.filter(compWriter => compWriter.writeToPath === compDir);
240
+ hasDuplication.forEach(compWriter => {
241
+ var _compWriter$component;
242
+ const ownerName = (_compWriter$component = compWriter.component.id.scope) !== null && _compWriter$component !== void 0 && _compWriter$component.includes('.') ? compWriter.component.id.scope.split('.')[0] : undefined;
243
+ if (ownerName && !compDir.startsWith(ownerName) && !allDirs.includes(`${ownerName}/${compDir}`)) {
244
+ compWriter.writeToPath = `${ownerName}/${compDir}`;
245
+ } else {
246
+ compWriter.writeToPath = this.incrementPathRecursively(compWriter.writeToPath, allDirs);
247
+ }
248
+ allDirs.push(compWriter.writeToPath);
249
+ });
250
+ });
251
+ }
252
+ incrementPathRecursively(p, allPaths) {
253
+ const incrementPath = (str, number) => `${str}_${number}`;
254
+ let num = 1;
255
+ let newPath = incrementPath(p, num);
256
+ while (allPaths.includes(newPath)) {
257
+ newPath = incrementPath(p, num += 1);
258
+ }
259
+ return newPath;
260
+ }
261
+
217
262
  /**
218
263
  * e.g. [bar, bar/foo] => [bar_1, bar/foo]
219
264
  * otherwise, the bar/foo component will be saved inside "bar" component.
@@ -227,23 +272,14 @@ class ComponentWriterMain {
227
272
  writeToPath
228
273
  }) => allDirs.find(d => d.startsWith(`${writeToPath}/`)));
229
274
  const existingRootDirs = Object.keys(this.consumer.bitMap.getAllTrackDirs());
230
- const incrementPath = (p, number) => `${p}_${number}`;
231
275
  const parentsOfOthersCompsDirs = parentsOfOthersComps.map(c => c.writeToPath);
232
276
  const allPaths = [...existingRootDirs, ...parentsOfOthersCompsDirs];
233
- const incrementRecursively = p => {
234
- let num = 1;
235
- let newPath = incrementPath(p, num);
236
- while (allPaths.includes(newPath)) {
237
- newPath = incrementPath(p, num += 1);
238
- }
239
- return newPath;
240
- };
241
277
 
242
278
  // this is when writing multiple components and some of them are parents of the others.
243
279
  // change the paths of all these parents root-dir to not collide with the children root-dir
244
280
  parentsOfOthersComps.forEach(componentWriter => {
245
281
  if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.
246
- const newPath = incrementRecursively(componentWriter.writeToPath);
282
+ const newPath = this.incrementPathRecursively(componentWriter.writeToPath, allPaths);
247
283
  componentWriter.writeToPath = newPath;
248
284
  });
249
285
 
@@ -254,7 +290,7 @@ class ComponentWriterMain {
254
290
  const existingParent = existingRootDirs.find(d => d.startsWith(`${componentWriter.writeToPath}/`));
255
291
  if (!existingParent) return;
256
292
  if (existingRootDirs.includes(componentWriter.writeToPath)) return; // component already exists.
257
- const newPath = incrementRecursively(componentWriter.writeToPath);
293
+ const newPath = this.incrementPathRecursively(componentWriter.writeToPath, allPaths);
258
294
  componentWriter.writeToPath = newPath;
259
295
  });
260
296
 
@@ -264,7 +300,7 @@ class ComponentWriterMain {
264
300
  const existingChildren = existingRootDirs.find(d => componentWriter.writeToPath.startsWith(`${d}/`));
265
301
  if (!existingChildren) return;
266
302
  // we increment the existing one, because it is used to replace the base-path of the current component
267
- const newPath = incrementRecursively(existingChildren);
303
+ const newPath = this.incrementPathRecursively(existingChildren, allPaths);
268
304
  componentWriter.writeToPath = componentWriter.writeToPath.replace(existingChildren, newPath);
269
305
  });
270
306
  }
@@ -284,7 +320,7 @@ class ComponentWriterMain {
284
320
  };
285
321
  };
286
322
  return _objectSpread({
287
- consumer: this.consumer,
323
+ workspace: this.workspace,
288
324
  bitMap: this.consumer.bitMap,
289
325
  component,
290
326
  writeToPath: componentRootDir,
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_compiler","_install","_interopRequireDefault","_logger","_workspace","_bitError","_fsExtra","_pMapSeries","path","_interopRequireWildcard","_mover","_generalError","_utils","_path2","_dataToPersist","_componentWriter","_componentWriter2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","e","r","t","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentWriterMain","constructor","installer","compiler","workspace","logger","mover","consumer","writeMany","opts","debug","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","skipUpdatingBitMap","writeBitMap","installationError","compilationError","skipDependencyInstallation","installPackagesGracefully","compileGracefully","installOpts","dedupe","updateExisting","import","install","err","consoleFailure","message","error","compileOnWorkspace","_this$consumer","skipWritingToFs","dataToPersist","DataToPersist","components","component","merge","componentsConfig","config","hasChanged","_this$consumer2","jsonFiles","toVinyl","getPath","addManyFiles","addBasePath","persistAllToFS","writeComponentsParams","map","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfNested","Promise","all","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","resetConfig","_componentWriter$exis","mapSeries","allDirs","c","parentsOfOthersComps","find","d","startsWith","existingRootDirs","bitMap","getAllTrackDirs","incrementPath","p","number","parentsOfOthersCompsDirs","allPaths","incrementRecursively","num","newPath","includes","existingParent","existingChildren","replace","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","composeRelativeComponentPath","id","getParams","componentMap","getComponentIfExist","ignoreVersion","throwErrorWhenDirectoryNotEmpty","toAbsolutePath","writeConfig","rootDir","GeneralError","relativeWrittenPath","writtenPath","absoluteWrittenPath","absoluteWriteToPath","moveExistingComponent","componentDir","fs","pathExistsSync","isDir","BitError","isDirEmptySync","throwForExistingDir","provider","loggerMain","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","MainRuntime","addRuntime","_default"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport InstallAspect, { InstallMain } from '@teambit/install';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { BitError } from '@teambit/bit-error';\nimport fs from 'fs-extra';\nimport mapSeries from 'p-map-series';\nimport * as path from 'path';\nimport MoverAspect, { MoverMain } from '@teambit/mover';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { isDir, isDirEmptySync } from '@teambit/legacy/dist/utils';\nimport { PathLinuxRelative, pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport ComponentWriter, { ComponentWriterProps } from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n components: ConsumerComponent[];\n writeToPath?: string;\n throwForExistingDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n skipWritingToFs?: boolean;\n skipUpdatingBitMap?: boolean;\n}\n\nexport type ComponentWriterResults = { installationError?: Error; compilationError?: Error };\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 ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n this.logger.debug('writeMany, started');\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n if (!opts.skipUpdatingBitMap) await this.consumer.writeBitMap();\n let installationError: Error | undefined;\n let compilationError: Error | undefined;\n if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully();\n // no point to compile if the installation is not running. the environment is not ready.\n compilationError = await this.compileGracefully();\n }\n this.logger.debug('writeMany, completed!');\n return { installationError, compilationError };\n }\n\n private async installPackagesGracefully(): 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 };\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 const componentsConfig = this.consumer?.config?.componentsConfig;\n if (componentsConfig?.hasChanged) {\n const jsonFiles = await this.consumer?.config.toVinyl(this.consumer.getPath());\n if (jsonFiles) {\n dataToPersist.addManyFiles(jsonFiles);\n }\n }\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.fixDirsIfNested(componentWriterInstances);\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 })\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 * 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 = Object.keys(this.consumer.bitMap.getAllTrackDirs());\n const incrementPath = (p: string, number: number) => `${p}_${number}`;\n const parentsOfOthersCompsDirs = parentsOfOthersComps.map((c) => c.writeToPath);\n const allPaths: PathLinuxRelative[] = [...existingRootDirs, ...parentsOfOthersCompsDirs];\n const incrementRecursively = (p: string) => {\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n };\n\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 = incrementRecursively(componentWriter.writeToPath);\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 = incrementRecursively(componentWriter.writeToPath);\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 = incrementRecursively(existingChildren);\n componentWriter.writeToPath = componentWriter.writeToPath.replace(existingChildren, newPath);\n });\n }\n\n private getWriteParamsOfOneComponent(\n component: ConsumerComponent,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n const componentRootDir: PathLinuxRelative = opts.writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(opts.writeToPath)))\n : this.consumer.composeRelativeComponentPath(component.id);\n const getParams = () => {\n if (!this.consumer) {\n return {};\n }\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const componentMap = this.consumer.bitMap.getComponentIfExist(component.id, {\n ignoreVersion: true,\n });\n this.throwErrorWhenDirectoryNotEmpty(this.consumer.toAbsolutePath(componentRootDir), componentMap, opts);\n return {\n existingComponentMap: componentMap,\n };\n };\n return {\n consumer: this.consumer,\n bitMap: this.consumer.bitMap,\n component,\n writeToPath: componentRootDir,\n writeConfig: opts.writeConfig,\n skipUpdatingBitMap: opts.skipUpdatingBitMap,\n ...getParams(),\n };\n }\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (opts.writeToPath && this.consumer) {\n opts.components.forEach((component) => {\n const componentMap = component.componentMap as ComponentMap;\n if (!componentMap.rootDir) {\n throw new GeneralError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(opts.writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n private throwErrorWhenDirectoryNotEmpty(\n componentDir: PathOsBasedAbsolute,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n if (opts.skipWritingToFs) return;\n // if not writeToPath specified, it goes to the default directory. When componentMap exists, the\n // component is not new, and it's ok to override the existing directory.\n if (!opts.writeToPath && componentMap) return;\n // if writeToPath specified and that directory is already used for that component, it's ok to override\n if (opts.writeToPath && componentMap && componentMap.rootDir && componentMap.rootDir === opts.writeToPath) return;\n\n if (fs.pathExistsSync(componentDir)) {\n if (!isDir(componentDir)) {\n throw new BitError(`unable to import to ${componentDir} because it's a file`);\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAA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GAAAA,mBAAA;AAAAnB,eAAA,CA7OYmB,mBAAmB,WAgOf,EAAE;AAAAnB,eAAA,CAhONmB,mBAAmB,kBAiOR,CAACqH,kBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,gBAAW,CAAC;AAAA5I,eAAA,CAjOtFmB,mBAAmB,aAkOb0H,kBAAW;AAa9BP,yCAAqB,CAACQ,UAAU,CAAC3H,mBAAmB,CAAC;AAAC,IAAA4H,QAAA,GAEvC5H,mBAAmB;AAAAoH,OAAA,CAAArK,OAAA,GAAA6K,QAAA"}
1
+ {"version":3,"names":["_cli","data","require","_compiler","_install","_interopRequireDefault","_logger","_workspace","_bitError","_fsExtra","_lodash","_pMapSeries","path","_interopRequireWildcard","_mover","_generalError","_utils","_path2","_dataToPersist","_componentWriter","_componentWriter2","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","e","r","t","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","ComponentWriterMain","constructor","installer","compiler","workspace","logger","mover","consumer","writeMany","opts","debug","populateComponentsFilesToWrite","moveComponentsIfNeeded","persistComponentsData","skipUpdatingBitMap","writeBitMap","installationError","compilationError","skipDependencyInstallation","installPackagesGracefully","compileGracefully","installOpts","dedupe","updateExisting","import","install","err","consoleFailure","message","error","compileOnWorkspace","_this$consumer","skipWritingToFs","dataToPersist","DataToPersist","components","component","merge","componentsConfig","config","hasChanged","_this$consumer2","jsonFiles","toVinyl","getPath","addManyFiles","addBasePath","persistAllToFS","writeComponentsParams","map","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfEqual","fixDirsIfNested","Promise","all","componentWriter","existingComponentMap","addComponentToBitMap","writeToPath","resetConfig","_componentWriter$exis","mapSeries","allDirs","c","duplicatedDirs","dir","d","uniqDuplicates","uniq","compDir","hasDuplication","compWriter","_compWriter$component","ownerName","id","scope","includes","split","startsWith","incrementPathRecursively","p","allPaths","incrementPath","str","number","num","newPath","parentsOfOthersComps","find","existingRootDirs","bitMap","getAllTrackDirs","parentsOfOthersCompsDirs","existingParent","existingChildren","replace","componentRootDir","pathNormalizeToLinux","getPathRelativeToConsumer","resolve","composeRelativeComponentPath","getParams","componentMap","getComponentIfExist","ignoreVersion","throwErrorWhenDirectoryNotEmpty","toAbsolutePath","writeConfig","rootDir","GeneralError","relativeWrittenPath","writtenPath","absoluteWrittenPath","absoluteWriteToPath","moveExistingComponent","componentDir","fs","pathExistsSync","isDir","BitError","isDirEmptySync","throwForExistingDir","provider","loggerMain","createLogger","ComponentWriterAspect","exports","InstallAspect","CompilerAspect","LoggerAspect","WorkspaceAspect","MoverAspect","MainRuntime","addRuntime","_default"],"sources":["component-writer.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport InstallAspect, { InstallMain } from '@teambit/install';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport WorkspaceAspect, { Workspace } 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 MoverAspect, { MoverMain } from '@teambit/mover';\nimport ConsumerComponent from '@teambit/legacy/dist/consumer/component';\nimport GeneralError from '@teambit/legacy/dist/error/general-error';\nimport { isDir, isDirEmptySync } from '@teambit/legacy/dist/utils';\nimport { PathLinuxRelative, pathNormalizeToLinux, PathOsBasedAbsolute } from '@teambit/legacy/dist/utils/path';\nimport ComponentMap from '@teambit/legacy/dist/consumer/bit-map/component-map';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport Consumer from '@teambit/legacy/dist/consumer/consumer';\nimport ComponentWriter, { ComponentWriterProps } from './component-writer';\nimport { ComponentWriterAspect } from './component-writer.aspect';\n\nexport interface ManyComponentsWriterParams {\n components: ConsumerComponent[];\n writeToPath?: string;\n throwForExistingDir?: boolean;\n writeConfig?: boolean;\n skipDependencyInstallation?: boolean;\n verbose?: boolean;\n resetConfig?: boolean;\n skipWritingToFs?: boolean;\n skipUpdatingBitMap?: boolean;\n}\n\nexport type ComponentWriterResults = { installationError?: Error; compilationError?: Error };\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 ) {}\n\n get consumer(): Consumer {\n return this.workspace.consumer;\n }\n\n async writeMany(opts: ManyComponentsWriterParams): Promise<ComponentWriterResults> {\n this.logger.debug('writeMany, started');\n await this.populateComponentsFilesToWrite(opts);\n this.moveComponentsIfNeeded(opts);\n await this.persistComponentsData(opts);\n if (!opts.skipUpdatingBitMap) await this.consumer.writeBitMap();\n let installationError: Error | undefined;\n let compilationError: Error | undefined;\n if (!opts.skipDependencyInstallation) {\n installationError = await this.installPackagesGracefully();\n // no point to compile if the installation is not running. the environment is not ready.\n compilationError = await this.compileGracefully();\n }\n this.logger.debug('writeMany, completed!');\n return { installationError, compilationError };\n }\n\n private async installPackagesGracefully(): 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 };\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 const componentsConfig = this.consumer?.config?.componentsConfig;\n if (componentsConfig?.hasChanged) {\n const jsonFiles = await this.consumer?.config.toVinyl(this.consumer.getPath());\n if (jsonFiles) {\n dataToPersist.addManyFiles(jsonFiles);\n }\n }\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 // 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 })\n );\n if (opts.resetConfig) {\n componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n delete componentWriter.existingComponentMap?.config;\n });\n }\n await mapSeries(componentWriterInstances, (componentWriter: ComponentWriter) =>\n componentWriter.populateComponentsFilesToWrite()\n );\n }\n\n /**\n * this started to be an issue once same-name different-scope is supported.\n * by default, the component-dir consist of the scope-name part of the scope-id, without the owner part.\n * as a result, it's possible that multiple components have the same name, same scope-name but different owner.\n * e.g. org1.ui/button and org2.ui/button. the component-dir for both is \"ui/button\".\n * in this case, we try to prefix the component-dir with the owner-name and if not possible, just increment it (ui/button_1)\n */\n private fixDirsIfEqual(componentWriterInstances: ComponentWriter[]) {\n const allDirs = componentWriterInstances.map((c) => c.writeToPath);\n const duplicatedDirs = allDirs.filter((dir) => allDirs.filter((d) => d === dir).length > 1);\n if (!duplicatedDirs.length) return;\n const uniqDuplicates = uniq(duplicatedDirs);\n uniqDuplicates.forEach((compDir) => {\n const hasDuplication = componentWriterInstances.filter((compWriter) => compWriter.writeToPath === compDir);\n hasDuplication.forEach((compWriter) => {\n const ownerName = compWriter.component.id.scope?.includes('.')\n ? compWriter.component.id.scope.split('.')[0]\n : undefined;\n if (ownerName && !compDir.startsWith(ownerName) && !allDirs.includes(`${ownerName}/${compDir}`)) {\n compWriter.writeToPath = `${ownerName}/${compDir}`;\n } else {\n compWriter.writeToPath = this.incrementPathRecursively(compWriter.writeToPath, allDirs);\n }\n allDirs.push(compWriter.writeToPath);\n });\n });\n }\n\n private incrementPathRecursively(p: string, allPaths: string[]) {\n const incrementPath = (str: string, number: number) => `${str}_${number}`;\n let num = 1;\n let newPath = incrementPath(p, num);\n while (allPaths.includes(newPath)) {\n newPath = incrementPath(p, (num += 1));\n }\n return newPath;\n }\n\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 = Object.keys(this.consumer.bitMap.getAllTrackDirs());\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 = this.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 = this.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 = this.incrementPathRecursively(existingChildren, allPaths);\n componentWriter.writeToPath = componentWriter.writeToPath.replace(existingChildren, newPath);\n });\n }\n\n private getWriteParamsOfOneComponent(\n component: ConsumerComponent,\n opts: ManyComponentsWriterParams\n ): ComponentWriterProps {\n const componentRootDir: PathLinuxRelative = opts.writeToPath\n ? pathNormalizeToLinux(this.consumer.getPathRelativeToConsumer(path.resolve(opts.writeToPath)))\n : this.consumer.composeRelativeComponentPath(component.id);\n const getParams = () => {\n if (!this.consumer) {\n return {};\n }\n // components can't be saved with multiple versions, so we can ignore the version to find the component in bit.map\n const componentMap = this.consumer.bitMap.getComponentIfExist(component.id, {\n ignoreVersion: true,\n });\n this.throwErrorWhenDirectoryNotEmpty(this.consumer.toAbsolutePath(componentRootDir), componentMap, opts);\n return {\n existingComponentMap: componentMap,\n };\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 ...getParams(),\n };\n }\n private moveComponentsIfNeeded(opts: ManyComponentsWriterParams) {\n if (opts.writeToPath && this.consumer) {\n opts.components.forEach((component) => {\n const componentMap = component.componentMap as ComponentMap;\n if (!componentMap.rootDir) {\n throw new GeneralError(`unable to use \"--path\" flag.\nto move individual files, use bit move.\nto move all component files to a different directory, run bit remove and then bit import --path`);\n }\n const relativeWrittenPath = component.writtenPath;\n // @ts-ignore relativeWrittenPath is set at this point\n const absoluteWrittenPath = this.consumer.toAbsolutePath(relativeWrittenPath);\n // @ts-ignore this.writeToPath is set at this point\n const absoluteWriteToPath = path.resolve(opts.writeToPath); // don't use consumer.toAbsolutePath, it might be an inner dir\n if (relativeWrittenPath && absoluteWrittenPath !== absoluteWriteToPath) {\n this.mover.moveExistingComponent(component, absoluteWrittenPath, absoluteWriteToPath);\n }\n });\n }\n }\n private throwErrorWhenDirectoryNotEmpty(\n componentDir: PathOsBasedAbsolute,\n componentMap: ComponentMap | null | undefined,\n opts: ManyComponentsWriterParams\n ) {\n if (opts.skipWritingToFs) return;\n // if not writeToPath specified, it goes to the default directory. When componentMap exists, the\n // component is not new, and it's ok to override the existing directory.\n if (!opts.writeToPath && componentMap) return;\n // if writeToPath specified and that directory is already used for that component, it's ok to override\n if (opts.writeToPath && componentMap && componentMap.rootDir && componentMap.rootDir === opts.writeToPath) return;\n\n if (fs.pathExistsSync(componentDir)) {\n if (!isDir(componentDir)) {\n throw new BitError(`unable to import to ${componentDir} because it's a file`);\n }\n if (!isDirEmptySync(componentDir) && opts.throwForExistingDir) {\n throw new BitError(\n `unable to import to ${componentDir}, the directory is not empty. use --override flag to delete the directory and then import`\n );\n }\n }\n }\n\n static slots = [];\n static dependencies = [InstallAspect, CompilerAspect, LoggerAspect, WorkspaceAspect, MoverAspect];\n static runtime = MainRuntime;\n static async provider([install, compiler, loggerMain, workspace, mover]: [\n InstallMain,\n CompilerMain,\n LoggerMain,\n Workspace,\n MoverMain\n ]) {\n const logger = loggerMain.createLogger(ComponentWriterAspect.id);\n return new ComponentWriterMain(install, compiler, workspace, logger, mover);\n }\n}\n\nComponentWriterAspect.addRuntime(ComponentWriterMain);\n\nexport default ComponentWriterMain;\n"],"mappings":";;;;;;AAAA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,UAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,SAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,QAAA;EAAA,MAAAT,IAAA,GAAAC,OAAA;EAAAQ,OAAA,YAAAA,CAAA;IAAA,OA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C,gBAAW,CAAC;AAAAzJ,eAAA,CAhQtFmB,mBAAmB,aAiQbuI,kBAAW;AAa9BP,yCAAqB,CAACQ,UAAU,CAACxI,mBAAmB,CAAC;AAAC,IAAAyI,QAAA,GAEvCzI,mBAAmB;AAAAiI,OAAA,CAAAlL,OAAA,GAAA0L,QAAA"}
package/package.json CHANGED
@@ -1,30 +1,32 @@
1
1
  {
2
2
  "name": "@teambit/component-writer",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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.14"
9
+ "version": "1.0.15"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
13
+ "lodash": "4.17.21",
13
14
  "p-map-series": "2.1.0",
14
15
  "core-js": "^3.0.0",
15
16
  "@babel/runtime": "7.20.0",
16
17
  "@teambit/harmony": "0.4.6",
17
18
  "@teambit/bit-error": "0.0.404",
18
- "@teambit/cli": "0.0.793",
19
- "@teambit/compiler": "1.0.14",
20
- "@teambit/install": "1.0.14",
21
- "@teambit/logger": "0.0.886",
22
- "@teambit/mover": "1.0.14",
23
- "@teambit/workspace": "1.0.14",
19
+ "@teambit/cli": "0.0.794",
20
+ "@teambit/compiler": "1.0.15",
21
+ "@teambit/install": "1.0.15",
22
+ "@teambit/logger": "0.0.887",
23
+ "@teambit/mover": "1.0.15",
24
+ "@teambit/workspace": "1.0.15",
24
25
  "@teambit/component-version": "1.0.2"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/fs-extra": "9.0.7",
29
+ "@types/lodash": "4.14.165",
28
30
  "@types/mocha": "9.1.0",
29
31
  "@types/node": "12.20.4",
30
32
  "@types/react": "^17.0.8",
@@ -33,7 +35,7 @@
33
35
  "@types/testing-library__jest-dom": "5.9.5"
34
36
  },
35
37
  "peerDependencies": {
36
- "@teambit/legacy": "1.0.572",
38
+ "@teambit/legacy": "1.0.573",
37
39
  "react": "^16.8.0 || ^17.0.0",
38
40
  "react-dom": "^16.8.0 || ^17.0.0"
39
41
  },