@teambit/component-writer 0.0.190 → 0.0.192

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.
@@ -47,7 +47,8 @@ export default class ComponentWriter {
47
47
  populateComponentsFilesToWrite(): Promise<Component>;
48
48
  private throwForImportingLegacyIntoHarmony;
49
49
  populateFilesToWriteToComponentDir(): Promise<void>;
50
- addComponentToBitMap(rootDir: string | undefined): ComponentMap;
50
+ addComponentToBitMap(rootDir: string | undefined): Promise<ComponentMap>;
51
+ private replaceSnapWithTagIfNeeded;
51
52
  _updateComponentRootPathAccordingToBitMap(): void;
52
53
  _updateFilesBasePaths(): void;
53
54
  _cleanOldNestedComponent(): Promise<void>;
@@ -70,6 +70,20 @@ function _removePath() {
70
70
  };
71
71
  return data;
72
72
  }
73
+ function _componentVersion() {
74
+ const data = require("@teambit/component-version");
75
+ _componentVersion = function () {
76
+ return data;
77
+ };
78
+ return data;
79
+ }
80
+ function _objects() {
81
+ const data = require("@teambit/legacy/dist/scope/objects");
82
+ _objects = function () {
83
+ return data;
84
+ };
85
+ return data;
86
+ }
73
87
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
74
88
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
75
89
  class ComponentWriter {
@@ -141,11 +155,11 @@ class ComponentWriter {
141
155
  this.throwForImportingLegacyIntoHarmony();
142
156
  this.component.dataToPersist = new (_dataToPersist().default)();
143
157
  this._updateFilesBasePaths();
144
- this.component.componentMap = this.existingComponentMap || this.addComponentToBitMap(this.writeToPath);
158
+ this.component.componentMap = this.existingComponentMap || (await this.addComponentToBitMap(this.writeToPath));
145
159
  this.deleteBitDirContent = false;
146
160
  this._updateComponentRootPathAccordingToBitMap();
147
161
  if (!this.skipUpdatingBitMap) {
148
- this.component.componentMap = this.addComponentToBitMap(this.component.componentMap.rootDir);
162
+ this.component.componentMap = await this.addComponentToBitMap(this.component.componentMap.rootDir);
149
163
  }
150
164
  this.writePackageJson = false;
151
165
  await this.populateFilesToWriteToComponentDir();
@@ -175,7 +189,7 @@ class ComponentWriter {
175
189
  this.component.dataToPersist.addFile(this.component.license);
176
190
  }
177
191
  }
178
- addComponentToBitMap(rootDir) {
192
+ async addComponentToBitMap(rootDir) {
179
193
  if (rootDir === '.') {
180
194
  throw new Error('addComponentToBitMap: rootDir cannot be "."');
181
195
  }
@@ -187,12 +201,23 @@ class ComponentWriter {
187
201
  };
188
202
  });
189
203
  return this.bitMap.addComponent({
190
- componentId: this.component.id,
204
+ componentId: await this.replaceSnapWithTagIfNeeded(),
191
205
  files: filesForBitMap,
192
206
  mainFile: (0, _path2().pathNormalizeToLinux)(this.component.mainFile),
193
207
  rootDir
194
208
  });
195
209
  }
210
+ async replaceSnapWithTagIfNeeded() {
211
+ var _this$scope;
212
+ const version = this.component.id.version;
213
+ if (!version || !(0, _componentVersion().isHash)(version)) {
214
+ return this.component.id;
215
+ }
216
+ const compFromModel = await ((_this$scope = this.scope) === null || _this$scope === void 0 ? void 0 : _this$scope.getModelComponentIfExist(this.component.id));
217
+ const tag = compFromModel === null || compFromModel === void 0 ? void 0 : compFromModel.getTagOfRefIfExists(_objects().Ref.from(version));
218
+ if (tag) return this.component.id.changeVersion(tag);
219
+ return this.component.id;
220
+ }
196
221
  _updateComponentRootPathAccordingToBitMap() {
197
222
  // @ts-ignore this.component.componentMap is set
198
223
  this.writeToPath = this.component.componentMap.getRootDir();
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","path","_interopRequireWildcard","_showDoctorError","_logger","_componentNodeModulesPath","_path2","_dataToPersist","_removePath","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ComponentWriter","constructor","component","writeToPath","writeConfig","writePackageJson","override","isolated","consumer","scope","bitMap","ignoreBitDependencies","deleteBitDirContent","existingComponentMap","skipUpdatingBitMap","_defineProperty2","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","mainFile","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 { 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';\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 || this.addComponentToBitMap(this.writeToPath);\n this.deleteBitDirContent = false;\n this._updateComponentRootPathAccordingToBitMap();\n if (!this.skipUpdatingBitMap) {\n this.component.componentMap = 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 addComponentToBitMap(rootDir: string | undefined): 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: this.component.id,\n files: filesForBitMap,\n mainFile: pathNormalizeToLinux(this.component.mainFile),\n rootDir,\n });\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;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,0BAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,yBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAS,eAAA;EAAA,M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MACnG,MAAMG,gBAAgB,GAAG,IAAI,CAACnE,QAAQ,GAAG,IAAAoE,mCAA6B,EAAC,IAAI,CAAC1E,SAAS,CAAC,GAAG,IAAI;MAC7F,MAAM2E,kBAAkB,GACtB,IAAI,CAACrE,QAAQ,IAAIiE,qBAAqB,IAAIE,gBAAgB,GACtD,IAAI,CAACnE,QAAQ,CAACsE,cAAc,CAAC5G,IAAI,CAAD,CAAC,CAAC2F,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,CAAAhG,OAAA,GAAAe,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","ComponentWriter","constructor","component","writeToPath","writeConfig","writePackageJson","override","isolated","consumer","scope","bitMap","ignoreBitDependencies","deleteBitDirContent","existingComponentMap","skipUpdatingBitMap","_defineProperty2","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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211,9 +211,9 @@ class ComponentWriterMain {
211
211
  this.fixDirsIfNested(componentWriterInstances);
212
212
  // add componentMap entries into .bitmap before starting the process because steps like writing package-json
213
213
  // rely on .bitmap to determine whether a dependency exists and what's its origin
214
- componentWriterInstances.forEach(componentWriter => {
215
- componentWriter.existingComponentMap = componentWriter.existingComponentMap || componentWriter.addComponentToBitMap(componentWriter.writeToPath);
216
- });
214
+ await Promise.all(componentWriterInstances.map(async componentWriter => {
215
+ componentWriter.existingComponentMap = componentWriter.existingComponentMap || (await componentWriter.addComponentToBitMap(componentWriter.writeToPath));
216
+ }));
217
217
  if (opts.resetConfig) {
218
218
  componentWriterInstances.forEach(componentWriter => {
219
219
  var _componentWriter$exis;
@@ -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","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","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","undefined","err","consoleFailure","message","error","compileOnWorkspace","_this$consumer","_this$consumer$config","skipWritingToFs","dataToPersist","DataToPersist","components","component","merge","componentsConfig","config","hasChanged","_this$consumer2","jsonFiles","toVinyl","getPath","addManyFiles","addBasePath","persistAllToFS","writeComponentsParams","map","getWriteParamsOfOneComponent","componentWriterInstances","writeParams","ComponentWriter","fixDirsIfNested","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 componentWriterInstances.forEach((componentWriter: ComponentWriter) => {\n componentWriter.existingComponentMap =\n componentWriter.existingComponentMap || componentWriter.addComponentToBitMap(componentWriter.writeToPath);\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,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,IA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MAAM,EAAEC,KAAK,CAAC;EAC7E;AACF;AAAC8G,OAAA,CAAApH,mBAAA,GAAAA,mBAAA;AAAA,IAAAH,gBAAA,GAAAjC,OAAA,EA1OYoC,mBAAmB,WA6Nf,EAAE;AAAA,IAAAH,gBAAA,GAAAjC,OAAA,EA7NNoC,mBAAmB,kBA8NR,CAACqH,kBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,gBAAW,CAAC;AAAA,IAAA5H,gBAAA,GAAAjC,OAAA,EA9NtFoC,mBAAmB,aA+Nb0H,kBAAW;AAa9BP,yCAAqB,CAACQ,UAAU,CAAC3H,mBAAmB,CAAC;AAAC,IAAA4H,QAAA,GAEvC5H,mBAAmB;AAAAoH,OAAA,CAAAxJ,OAAA,GAAAgK,QAAA"}
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","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","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","undefined","err","consoleFailure","message","error","compileOnWorkspace","_this$consumer","_this$consumer$config","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,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,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AU,CAACC,YAAY,CAACC,yCAAqB,CAACzB,EAAE,CAAC;IAChE,OAAO,IAAI5F,mBAAmB,CAACyB,OAAO,EAAEtB,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,CAAC;EAC7E;AACF;AAACgH,OAAA,CAAAtH,mBAAA,GAAAA,mBAAA;AAAA,IAAAH,gBAAA,GAAAjC,OAAA,EA7OYoC,mBAAmB,WAgOf,EAAE;AAAA,IAAAH,gBAAA,GAAAjC,OAAA,EAhONoC,mBAAmB,kBAiOR,CAACuH,kBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,gBAAW,CAAC;AAAA,IAAA9H,gBAAA,GAAAjC,OAAA,EAjOtFoC,mBAAmB,aAkOb4H,kBAAW;AAa9BP,yCAAqB,CAACQ,UAAU,CAAC7H,mBAAmB,CAAC;AAAC,IAAA8H,QAAA,GAEvC9H,mBAAmB;AAAAsH,OAAA,CAAA1J,OAAA,GAAAkK,QAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component-writer",
3
- "version": "0.0.190",
3
+ "version": "0.0.192",
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": "0.0.190"
9
+ "version": "0.0.192"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
@@ -15,12 +15,13 @@
15
15
  "@babel/runtime": "7.20.0",
16
16
  "@teambit/harmony": "0.4.6",
17
17
  "@teambit/bit-error": "0.0.402",
18
- "@teambit/cli": "0.0.770",
19
- "@teambit/compiler": "0.0.1154",
20
- "@teambit/install": "0.0.238",
21
- "@teambit/logger": "0.0.863",
22
- "@teambit/mover": "0.0.185",
23
- "@teambit/workspace": "0.0.1154"
18
+ "@teambit/cli": "0.0.771",
19
+ "@teambit/compiler": "0.0.1156",
20
+ "@teambit/install": "0.0.240",
21
+ "@teambit/logger": "0.0.864",
22
+ "@teambit/mover": "0.0.187",
23
+ "@teambit/workspace": "0.0.1156",
24
+ "@teambit/component-version": "1.0.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@types/fs-extra": "9.0.7",
@@ -32,7 +33,7 @@
32
33
  "@types/testing-library__jest-dom": "5.9.5"
33
34
  },
34
35
  "peerDependencies": {
35
- "@teambit/legacy": "1.0.555",
36
+ "@teambit/legacy": "1.0.556",
36
37
  "react": "^16.8.0 || ^17.0.0",
37
38
  "react-dom": "^16.8.0 || ^17.0.0"
38
39
  },