@teambit/component-writer 0.0.194 → 0.0.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
3
  Object.defineProperty(exports, "__esModule", {
7
4
  value: true
8
5
  });
9
6
  exports.default = void 0;
10
- function _defineProperty2() {
11
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- _defineProperty2 = function () {
13
- return data;
14
- };
15
- return data;
16
- }
17
7
  function _fsExtra() {
18
8
  const data = _interopRequireDefault(require("fs-extra"));
19
9
  _fsExtra = function () {
@@ -86,6 +76,10 @@ function _objects() {
86
76
  }
87
77
  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); }
88
78
  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; }
79
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
80
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
81
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
82
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
89
83
  class ComponentWriter {
90
84
  constructor({
91
85
  component,
@@ -102,21 +96,21 @@ class ComponentWriter {
102
96
  existingComponentMap,
103
97
  skipUpdatingBitMap
104
98
  }) {
105
- (0, _defineProperty2().default)(this, "component", void 0);
106
- (0, _defineProperty2().default)(this, "writeToPath", void 0);
107
- (0, _defineProperty2().default)(this, "writeConfig", void 0);
108
- (0, _defineProperty2().default)(this, "writePackageJson", void 0);
109
- (0, _defineProperty2().default)(this, "override", void 0);
99
+ _defineProperty(this, "component", void 0);
100
+ _defineProperty(this, "writeToPath", void 0);
101
+ _defineProperty(this, "writeConfig", void 0);
102
+ _defineProperty(this, "writePackageJson", void 0);
103
+ _defineProperty(this, "override", void 0);
110
104
  // default to true
111
- (0, _defineProperty2().default)(this, "isolated", void 0);
112
- (0, _defineProperty2().default)(this, "consumer", void 0);
105
+ _defineProperty(this, "isolated", void 0);
106
+ _defineProperty(this, "consumer", void 0);
113
107
  // when using capsule, the consumer is not defined
114
- (0, _defineProperty2().default)(this, "scope", void 0);
115
- (0, _defineProperty2().default)(this, "bitMap", void 0);
116
- (0, _defineProperty2().default)(this, "ignoreBitDependencies", void 0);
117
- (0, _defineProperty2().default)(this, "deleteBitDirContent", void 0);
118
- (0, _defineProperty2().default)(this, "existingComponentMap", void 0);
119
- (0, _defineProperty2().default)(this, "skipUpdatingBitMap", void 0);
108
+ _defineProperty(this, "scope", void 0);
109
+ _defineProperty(this, "bitMap", void 0);
110
+ _defineProperty(this, "ignoreBitDependencies", void 0);
111
+ _defineProperty(this, "deleteBitDirContent", void 0);
112
+ _defineProperty(this, "existingComponentMap", void 0);
113
+ _defineProperty(this, "skipUpdatingBitMap", void 0);
120
114
  this.component = component;
121
115
  this.writeToPath = writeToPath;
122
116
  this.writeConfig = writeConfig;
@@ -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","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,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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tC,GAAG,CAAE0C,WAAW,IAAK;MACtC,MAAMC,qBAAqB,GAAG,IAAI,CAAC5E,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACE,MAAM,CAAC2E,YAAY,CAACF,WAAW,CAAC,GAAG,IAAI;MACnG,MAAMG,gBAAgB,GAAG,IAAI,CAAC9E,QAAQ,GAAG,IAAA+E,mCAA6B,EAAC,IAAI,CAACrF,SAAS,CAAC,GAAG,IAAI;MAC7F,MAAMsF,kBAAkB,GACtB,IAAI,CAAChF,QAAQ,IAAI4E,qBAAqB,IAAIE,gBAAgB,GACtD,IAAI,CAAC9E,QAAQ,CAACiF,cAAc,CAACzH,IAAI,CAAD,CAAC,CAACwG,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,CAAA3G,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","_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;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,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,cAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,YAAA;EAAA,MAAAV,IAA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AG,CAAE0C,WAAW,IAAK;MACtC,MAAMC,qBAAqB,GAAG,IAAI,CAAC3E,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACE,MAAM,CAAC0E,YAAY,CAACF,WAAW,CAAC,GAAG,IAAI;MACnG,MAAMG,gBAAgB,GAAG,IAAI,CAAC7E,QAAQ,GAAG,IAAA8E,mCAA6B,EAAC,IAAI,CAACpF,SAAS,CAAC,GAAG,IAAI;MAC7F,MAAMqF,kBAAkB,GACtB,IAAI,CAAC/E,QAAQ,IAAI2E,qBAAqB,IAAIE,gBAAgB,GACtD,IAAI,CAAC7E,QAAQ,CAACgF,cAAc,CAAC1I,IAAI,CAAD,CAAC,CAACyH,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,CAAA5H,OAAA,GAAAiC,eAAA"}
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.promise.js");
6
- require("core-js/modules/es.regexp.exec.js");
7
- require("core-js/modules/es.string.replace.js");
8
3
  Object.defineProperty(exports, "__esModule", {
9
4
  value: true
10
5
  });
11
6
  exports.default = exports.ComponentWriterMain = void 0;
12
- function _defineProperty2() {
13
- const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- _defineProperty2 = function () {
15
- return data;
16
- };
17
- return data;
18
- }
19
7
  function _cli() {
20
8
  const data = require("@teambit/cli");
21
9
  _cli = function () {
@@ -130,8 +118,12 @@ function _componentWriter2() {
130
118
  }
131
119
  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); }
132
120
  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; }
121
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
133
122
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
134
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
123
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
124
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
125
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
126
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
135
127
  class ComponentWriterMain {
136
128
  constructor(installer, compiler, workspace, logger, mover) {
137
129
  this.installer = installer;
@@ -342,9 +334,9 @@ to move all component files to a different directory, run bit remove and then bi
342
334
  }
343
335
  }
344
336
  exports.ComponentWriterMain = ComponentWriterMain;
345
- (0, _defineProperty2().default)(ComponentWriterMain, "slots", []);
346
- (0, _defineProperty2().default)(ComponentWriterMain, "dependencies", [_install().default, _compiler().CompilerAspect, _logger().LoggerAspect, _workspace().default, _mover().default]);
347
- (0, _defineProperty2().default)(ComponentWriterMain, "runtime", _cli().MainRuntime);
337
+ _defineProperty(ComponentWriterMain, "slots", []);
338
+ _defineProperty(ComponentWriterMain, "dependencies", [_install().default, _compiler().CompilerAspect, _logger().LoggerAspect, _workspace().default, _mover().default]);
339
+ _defineProperty(ComponentWriterMain, "runtime", _cli().MainRuntime);
348
340
  _componentWriter2().ComponentWriterAspect.addRuntime(ComponentWriterMain);
349
341
  var _default = ComponentWriterMain;
350
342
  exports.default = _default;
@@ -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","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(ComponentWriter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AAA8H,QAAA,GAEvC9H,mBAAmB;AAAAsH,OAAA,CAAA1J,OAAA,GAAAkK,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","_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","_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,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,YAAA;EAAA,MAAAT,IAAA,GAAAI,sBAAA,CAAA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,WAAW,EAAE;IAE3G,IAAI8C,kBAAE,CAACC,cAAc,CAACF,YAAY,CAAC,EAAE;MACnC,IAAI,CAAC,IAAAG,cAAK,EAACH,YAAY,CAAC,EAAE;QACxB,MAAM,KAAII,oBAAQ,EAAE,uBAAsBJ,YAAa,sBAAqB,CAAC;MAC/E;MACA,IAAI,CAAC,IAAAK,uBAAc,EAACL,YAAY,CAAC,IAAIjG,IAAI,CAACuG,mBAAmB,EAAE;QAC7D,MAAM,KAAIF,oBAAQ,EACf,uBAAsBJ,YAAa,2FACtC,CAAC;MACH;IACF;EACF;EAKA,aAAaO,QAAQA,CAAC,CAACxF,OAAO,EAAEtB,QAAQ,EAAE+G,UAAU,EAAE9G,SAAS,EAAEE,KAAK,CAMrE,EAAE;IACD,MAAMD,MAAM,GAAG6G,UAAU,CAACC,YAAY,CAACC,yCAAqB,CAACzB,EAAE,CAAC;IAChE,OAAO,IAAI3F,mBAAmB,CAACyB,OAAO,EAAEtB,QAAQ,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,CAAC;EAC7E;AACF;AAAC+G,OAAA,CAAArH,mBAAA,GAAAA,mBAAA;AAAAnB,eAAA,CA7OYmB,mBAAmB,WAgOf,EAAE;AAAAnB,eAAA,CAhONmB,mBAAmB,kBAiOR,CAACsH,kBAAa,EAAEC,0BAAc,EAAEC,sBAAY,EAAEC,oBAAe,EAAEC,gBAAW,CAAC;AAAA7I,eAAA,CAjOtFmB,mBAAmB,aAkOb2H,kBAAW;AAa9BP,yCAAqB,CAACQ,UAAU,CAAC5H,mBAAmB,CAAC;AAAC,IAAA6H,QAAA,GAEvC7H,mBAAmB;AAAAqH,OAAA,CAAAzK,OAAA,GAAAiL,QAAA"}
package/package.json CHANGED
@@ -1,26 +1,24 @@
1
1
  {
2
2
  "name": "@teambit/component-writer",
3
- "version": "0.0.194",
3
+ "version": "0.0.196",
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.194"
9
+ "version": "0.0.196"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
13
13
  "p-map-series": "2.1.0",
14
- "core-js": "^3.0.0",
15
- "@babel/runtime": "7.20.0",
16
14
  "@teambit/harmony": "0.4.6",
17
15
  "@teambit/bit-error": "0.0.402",
18
- "@teambit/cli": "0.0.772",
19
- "@teambit/compiler": "0.0.1158",
20
- "@teambit/install": "0.0.242",
21
- "@teambit/logger": "0.0.865",
22
- "@teambit/mover": "0.0.189",
23
- "@teambit/workspace": "0.0.1158",
16
+ "@teambit/cli": "0.0.774",
17
+ "@teambit/compiler": "0.0.1160",
18
+ "@teambit/install": "0.0.244",
19
+ "@teambit/logger": "0.0.867",
20
+ "@teambit/mover": "0.0.191",
21
+ "@teambit/workspace": "0.0.1160",
24
22
  "@teambit/component-version": "1.0.0"
25
23
  },
26
24
  "devDependencies": {
@@ -33,7 +31,7 @@
33
31
  "@types/testing-library__jest-dom": "5.9.5"
34
32
  },
35
33
  "peerDependencies": {
36
- "@teambit/legacy": "1.0.557",
34
+ "@teambit/legacy": "1.0.559",
37
35
  "react": "^16.8.0 || ^17.0.0",
38
36
  "react-dom": "^16.8.0 || ^17.0.0"
39
37
  },