@teambit/workspace 1.0.332 → 1.0.333

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.
@@ -2,7 +2,7 @@ import { ComponentID, AspectList, AspectEntry, ResolveComponentIdFunc } from '@t
2
2
  import { COMPONENT_CONFIG_FILE_NAME } from '@teambit/legacy/dist/constants';
3
3
  import { ExtensionDataList, configEntryToDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
4
4
  import { PathOsBasedAbsolute } from '@teambit/legacy.utils';
5
- import { JsonVinyl } from '@teambit/legacy/dist/consumer/component/json-vinyl';
5
+ import { JsonVinyl } from '@teambit/component.sources';
6
6
  import detectIndent from 'detect-indent';
7
7
  import detectNewline from 'detect-newline';
8
8
  import fs from 'fs-extra';
@@ -1,7 +1,7 @@
1
1
  import { ComponentID, AspectList, ResolveComponentIdFunc } from '@teambit/component';
2
2
  import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
3
3
  import { PathOsBasedAbsolute } from '@teambit/legacy.utils';
4
- import { JsonVinyl } from '@teambit/legacy/dist/consumer/component/json-vinyl';
4
+ import { JsonVinyl } from '@teambit/component.sources';
5
5
  interface ComponentConfigFileOptions {
6
6
  indent: string;
7
7
  newLine: '\r\n' | '\n' | undefined;
@@ -25,9 +25,9 @@ function _extensionData() {
25
25
  };
26
26
  return data;
27
27
  }
28
- function _jsonVinyl() {
29
- const data = require("@teambit/legacy/dist/consumer/component/json-vinyl");
30
- _jsonVinyl = function () {
28
+ function _component2() {
29
+ const data = require("@teambit/component.sources");
30
+ _component2 = function () {
31
31
  return data;
32
32
  };
33
33
  return data;
@@ -123,7 +123,7 @@ class ComponentConfigFile {
123
123
  if (isExist && !options.override) {
124
124
  throw new (_exceptions().AlreadyExistsError)(filePath);
125
125
  }
126
- return _jsonVinyl().JsonVinyl.load({
126
+ return _component2().JsonVinyl.load({
127
127
  base: _path().default.dirname(filePath),
128
128
  path: filePath,
129
129
  content: json,
@@ -1 +1 @@
1
- {"version":3,"names":["_component","data","require","_constants","_extensionData","_jsonVinyl","_detectIndent","_interopRequireDefault","_detectNewline","_fsExtra","_path","_config","_lodash","_exceptions","e","__esModule","default","DEFAULT_INDENT","DEFAULT_NEWLINE","ComponentConfigFile","constructor","componentId","aspects","componentDir","propagate","options","indent","newLine","defaultScope","load","aspectListFactory","outsideDefaultScope","filePath","composePath","isExist","fs","pathExists","undefined","content","readFile","parsed","parseComponentJsonContent","detectIndent","detectNewline","ComponentID","fromObject","ExtensionDataList","fromConfigObject","extensions","Boolean","componentRootFolder","path","join","COMPONENT_CONFIG_FILE_NAME","toVinylFile","json","toJson","override","AlreadyExistsError","JsonVinyl","base","dirname","newline","write","vinyl","addAspect","aspectId","config","resolveComponentId","shouldMergeConfig","existing","get","getNewConfig","merge","aspectEntry","aspectEntryFromConfigObject","entries","push","removeAspect","markWithMinusIfNotExist","aspectList","withoutEntries","REMOVE_EXTENSION_SPECIAL_SIGN","id","legacyEntry","configEntryToDataEntry","AspectEntry","toObject","toConfigObject","exports","str","dir","JSON","parse","err","Error","message"],"sources":["component-config-file.ts"],"sourcesContent":["import { ComponentID, AspectList, AspectEntry, ResolveComponentIdFunc } from '@teambit/component';\nimport { COMPONENT_CONFIG_FILE_NAME } from '@teambit/legacy/dist/constants';\nimport { ExtensionDataList, configEntryToDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { JsonVinyl } from '@teambit/legacy/dist/consumer/component/json-vinyl';\nimport detectIndent from 'detect-indent';\nimport detectNewline from 'detect-newline';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { merge } from 'lodash';\nimport { AlreadyExistsError } from './exceptions';\n\ninterface ComponentConfigFileOptions {\n indent: string;\n newLine: '\\r\\n' | '\\n' | undefined;\n}\n\ninterface WriteConfigFileOptions {\n override?: boolean;\n}\n\ninterface ComponentConfigFileJson {\n componentId: any;\n // TODO: think if we want to change it to aspects\n extensions: any;\n propagate: boolean;\n defaultScope?: string;\n}\n\nconst DEFAULT_INDENT = ' ';\nconst DEFAULT_NEWLINE = '\\n';\n\nexport class ComponentConfigFile {\n constructor(\n public componentId: ComponentID,\n public aspects: AspectList,\n private componentDir: PathOsBasedAbsolute,\n public propagate: boolean = false,\n private options: ComponentConfigFileOptions = { indent: DEFAULT_INDENT, newLine: DEFAULT_NEWLINE },\n public defaultScope?: string\n ) {}\n\n static async load(\n componentDir: PathOsBasedAbsolute,\n aspectListFactory: (extensionDataList: ExtensionDataList) => Promise<AspectList>,\n outsideDefaultScope?: string\n ): Promise<ComponentConfigFile | undefined> {\n const filePath = ComponentConfigFile.composePath(componentDir);\n const isExist = await fs.pathExists(filePath);\n if (!isExist) {\n return undefined;\n }\n const content = await fs.readFile(filePath, 'utf-8');\n const parsed: ComponentConfigFileJson = parseComponentJsonContent(content, componentDir);\n const indent = detectIndent(content).indent;\n const newLine = detectNewline(content);\n const componentId = ComponentID.fromObject(parsed.componentId, parsed.defaultScope || outsideDefaultScope);\n const aspects = await aspectListFactory(ExtensionDataList.fromConfigObject(parsed.extensions));\n\n return new ComponentConfigFile(\n componentId,\n aspects,\n componentDir,\n Boolean(parsed.propagate),\n { indent, newLine },\n parsed.defaultScope\n );\n }\n\n static composePath(componentRootFolder: string) {\n return path.join(componentRootFolder, COMPONENT_CONFIG_FILE_NAME);\n }\n\n async toVinylFile(options: WriteConfigFileOptions = {}): Promise<JsonVinyl> {\n const json = this.toJson();\n const filePath = ComponentConfigFile.composePath(this.componentDir);\n const isExist = await fs.pathExists(filePath);\n if (isExist && !options.override) {\n throw new AlreadyExistsError(filePath);\n }\n\n return JsonVinyl.load({\n base: path.dirname(filePath),\n path: filePath,\n content: json,\n override: true,\n indent: this.options.indent,\n newline: this.options.newLine,\n });\n }\n\n async write(options: WriteConfigFileOptions = {}): Promise<void> {\n const vinyl = await this.toVinylFile(options);\n await vinyl.write();\n }\n\n async addAspect(\n aspectId: string,\n config: any,\n resolveComponentId: ResolveComponentIdFunc,\n shouldMergeConfig = false\n ) {\n const existing = this.aspects.get(aspectId);\n\n if (existing) {\n const getNewConfig = () => {\n if (!shouldMergeConfig) return config;\n if (!config || config === '-') return config;\n if (!existing.config) return config;\n // @ts-ignore\n if (existing.config === '-') return config;\n return merge(existing.config, config);\n };\n existing.config = getNewConfig();\n } else {\n const aspectEntry = await this.aspectEntryFromConfigObject(aspectId, config, resolveComponentId);\n this.aspects.entries.push(aspectEntry);\n }\n }\n\n async removeAspect(aspectId: string, markWithMinusIfNotExist: boolean, resolveComponentId: ResolveComponentIdFunc) {\n const existing = this.aspects.get(aspectId);\n if (existing) {\n const aspectList = this.aspects.withoutEntries([aspectId]);\n this.aspects = aspectList;\n } else if (markWithMinusIfNotExist) {\n await this.addAspect(aspectId, REMOVE_EXTENSION_SPECIAL_SIGN, resolveComponentId);\n }\n }\n\n private async aspectEntryFromConfigObject(id: string, config: any, resolveComponentId: ResolveComponentIdFunc) {\n const aspectId = await resolveComponentId(id);\n const legacyEntry = configEntryToDataEntry(id, config);\n return new AspectEntry(aspectId, legacyEntry);\n }\n\n toJson(): ComponentConfigFileJson {\n return {\n componentId: this.componentId.toObject(),\n propagate: this.propagate,\n defaultScope: this.defaultScope,\n extensions: this.aspects.toConfigObject(),\n };\n }\n}\n\nfunction parseComponentJsonContent(str: string, dir: string) {\n try {\n return JSON.parse(str);\n } catch (err: any) {\n throw new Error(`failed parsing component.json file at ${dir}. original error: ${err.message}`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA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AC3B,CAAC,MAAM,IAAID,uBAAuB,EAAE;MAClC,MAAM,IAAI,CAACd,SAAS,CAACC,QAAQ,EAAEgB,uCAA6B,EAAEd,kBAAkB,CAAC;IACnF;EACF;EAEA,MAAcO,2BAA2BA,CAACQ,EAAU,EAAEhB,MAAW,EAAEC,kBAA0C,EAAE;IAC7G,MAAMF,QAAQ,GAAG,MAAME,kBAAkB,CAACe,EAAE,CAAC;IAC7C,MAAMC,WAAW,GAAG,IAAAC,uCAAsB,EAACF,EAAE,EAAEhB,MAAM,CAAC;IACtD,OAAO,KAAImB,wBAAW,EAACpB,QAAQ,EAAEkB,WAAW,CAAC;EAC/C;EAEA5B,MAAMA,CAAA,EAA4B;IAChC,OAAO;MACLnC,WAAW,EAAE,IAAI,CAACA,WAAW,CAACkE,QAAQ,CAAC,CAAC;MACxC/D,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,YAAY,EAAE,IAAI,CAACA,YAAY;MAC/BoB,UAAU,EAAE,IAAI,CAAC1B,OAAO,CAACkE,cAAc,CAAC;IAC1C,CAAC;EACH;AACF;AAACC,OAAA,CAAAtE,mBAAA,GAAAA,mBAAA;AAED,SAASsB,yBAAyBA,CAACiD,GAAW,EAAEC,GAAW,EAAE;EAC3D,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC;EACxB,CAAC,CAAC,OAAOI,GAAQ,EAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,yCAAyCJ,GAAG,qBAAqBG,GAAG,CAACE,OAAO,EAAE,CAAC;EACjG;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_component","data","require","_constants","_extensionData","_component2","_detectIndent","_interopRequireDefault","_detectNewline","_fsExtra","_path","_config","_lodash","_exceptions","e","__esModule","default","DEFAULT_INDENT","DEFAULT_NEWLINE","ComponentConfigFile","constructor","componentId","aspects","componentDir","propagate","options","indent","newLine","defaultScope","load","aspectListFactory","outsideDefaultScope","filePath","composePath","isExist","fs","pathExists","undefined","content","readFile","parsed","parseComponentJsonContent","detectIndent","detectNewline","ComponentID","fromObject","ExtensionDataList","fromConfigObject","extensions","Boolean","componentRootFolder","path","join","COMPONENT_CONFIG_FILE_NAME","toVinylFile","json","toJson","override","AlreadyExistsError","JsonVinyl","base","dirname","newline","write","vinyl","addAspect","aspectId","config","resolveComponentId","shouldMergeConfig","existing","get","getNewConfig","merge","aspectEntry","aspectEntryFromConfigObject","entries","push","removeAspect","markWithMinusIfNotExist","aspectList","withoutEntries","REMOVE_EXTENSION_SPECIAL_SIGN","id","legacyEntry","configEntryToDataEntry","AspectEntry","toObject","toConfigObject","exports","str","dir","JSON","parse","err","Error","message"],"sources":["component-config-file.ts"],"sourcesContent":["import { ComponentID, AspectList, AspectEntry, ResolveComponentIdFunc } from '@teambit/component';\nimport { COMPONENT_CONFIG_FILE_NAME } from '@teambit/legacy/dist/constants';\nimport { ExtensionDataList, configEntryToDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { PathOsBasedAbsolute } from '@teambit/legacy.utils';\nimport { JsonVinyl } from '@teambit/component.sources';\nimport detectIndent from 'detect-indent';\nimport detectNewline from 'detect-newline';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { REMOVE_EXTENSION_SPECIAL_SIGN } from '@teambit/legacy/dist/consumer/config';\nimport { merge } from 'lodash';\nimport { AlreadyExistsError } from './exceptions';\n\ninterface ComponentConfigFileOptions {\n indent: string;\n newLine: '\\r\\n' | '\\n' | undefined;\n}\n\ninterface WriteConfigFileOptions {\n override?: boolean;\n}\n\ninterface ComponentConfigFileJson {\n componentId: any;\n // TODO: think if we want to change it to aspects\n extensions: any;\n propagate: boolean;\n defaultScope?: string;\n}\n\nconst DEFAULT_INDENT = ' ';\nconst DEFAULT_NEWLINE = '\\n';\n\nexport class ComponentConfigFile {\n constructor(\n public componentId: ComponentID,\n public aspects: AspectList,\n private componentDir: PathOsBasedAbsolute,\n public propagate: boolean = false,\n private options: ComponentConfigFileOptions = { indent: DEFAULT_INDENT, newLine: DEFAULT_NEWLINE },\n public defaultScope?: string\n ) {}\n\n static async load(\n componentDir: PathOsBasedAbsolute,\n aspectListFactory: (extensionDataList: ExtensionDataList) => Promise<AspectList>,\n outsideDefaultScope?: string\n ): Promise<ComponentConfigFile | undefined> {\n const filePath = ComponentConfigFile.composePath(componentDir);\n const isExist = await fs.pathExists(filePath);\n if (!isExist) {\n return undefined;\n }\n const content = await fs.readFile(filePath, 'utf-8');\n const parsed: ComponentConfigFileJson = parseComponentJsonContent(content, componentDir);\n const indent = detectIndent(content).indent;\n const newLine = detectNewline(content);\n const componentId = ComponentID.fromObject(parsed.componentId, parsed.defaultScope || outsideDefaultScope);\n const aspects = await aspectListFactory(ExtensionDataList.fromConfigObject(parsed.extensions));\n\n return new ComponentConfigFile(\n componentId,\n aspects,\n componentDir,\n Boolean(parsed.propagate),\n { indent, newLine },\n parsed.defaultScope\n );\n }\n\n static composePath(componentRootFolder: string) {\n return path.join(componentRootFolder, COMPONENT_CONFIG_FILE_NAME);\n }\n\n async toVinylFile(options: WriteConfigFileOptions = {}): Promise<JsonVinyl> {\n const json = this.toJson();\n const filePath = ComponentConfigFile.composePath(this.componentDir);\n const isExist = await fs.pathExists(filePath);\n if (isExist && !options.override) {\n throw new AlreadyExistsError(filePath);\n }\n\n return JsonVinyl.load({\n base: path.dirname(filePath),\n path: filePath,\n content: json,\n override: true,\n indent: this.options.indent,\n newline: this.options.newLine,\n });\n }\n\n async write(options: WriteConfigFileOptions = {}): Promise<void> {\n const vinyl = await this.toVinylFile(options);\n await vinyl.write();\n }\n\n async addAspect(\n aspectId: string,\n config: any,\n resolveComponentId: ResolveComponentIdFunc,\n shouldMergeConfig = false\n ) {\n const existing = this.aspects.get(aspectId);\n\n if (existing) {\n const getNewConfig = () => {\n if (!shouldMergeConfig) return config;\n if (!config || config === '-') return config;\n if (!existing.config) return config;\n // @ts-ignore\n if (existing.config === '-') return config;\n return merge(existing.config, config);\n };\n existing.config = getNewConfig();\n } else {\n const aspectEntry = await this.aspectEntryFromConfigObject(aspectId, config, resolveComponentId);\n this.aspects.entries.push(aspectEntry);\n }\n }\n\n async removeAspect(aspectId: string, markWithMinusIfNotExist: boolean, resolveComponentId: ResolveComponentIdFunc) {\n const existing = this.aspects.get(aspectId);\n if (existing) {\n const aspectList = this.aspects.withoutEntries([aspectId]);\n this.aspects = aspectList;\n } else if (markWithMinusIfNotExist) {\n await this.addAspect(aspectId, REMOVE_EXTENSION_SPECIAL_SIGN, resolveComponentId);\n }\n }\n\n private async aspectEntryFromConfigObject(id: string, config: any, resolveComponentId: ResolveComponentIdFunc) {\n const aspectId = await resolveComponentId(id);\n const legacyEntry = configEntryToDataEntry(id, config);\n return new AspectEntry(aspectId, legacyEntry);\n }\n\n toJson(): ComponentConfigFileJson {\n return {\n componentId: this.componentId.toObject(),\n propagate: this.propagate,\n defaultScope: this.defaultScope,\n extensions: this.aspects.toConfigObject(),\n };\n }\n}\n\nfunction parseComponentJsonContent(str: string, dir: string) {\n try {\n return JSON.parse(str);\n } catch (err: any) {\n throw new Error(`failed parsing component.json file at ${dir}. original error: ${err.message}`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,eAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,cAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAA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G,IAAAC,uCAAsB,EAACF,EAAE,EAAEhB,MAAM,CAAC;IACtD,OAAO,KAAImB,wBAAW,EAACpB,QAAQ,EAAEkB,WAAW,CAAC;EAC/C;EAEA5B,MAAMA,CAAA,EAA4B;IAChC,OAAO;MACLnC,WAAW,EAAE,IAAI,CAACA,WAAW,CAACkE,QAAQ,CAAC,CAAC;MACxC/D,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBI,YAAY,EAAE,IAAI,CAACA,YAAY;MAC/BoB,UAAU,EAAE,IAAI,CAAC1B,OAAO,CAACkE,cAAc,CAAC;IAC1C,CAAC;EACH;AACF;AAACC,OAAA,CAAAtE,mBAAA,GAAAA,mBAAA;AAED,SAASsB,yBAAyBA,CAACiD,GAAW,EAAEC,GAAW,EAAE;EAC3D,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACH,GAAG,CAAC;EACxB,CAAC,CAAC,OAAOI,GAAQ,EAAE;IACjB,MAAM,IAAIC,KAAK,CAAC,yCAAyCJ,GAAG,qBAAqBG,GAAG,CAACE,OAAO,EAAE,CAAC;EACjG;AACF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.332/dist/workspace.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.332/dist/workspace.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.333/dist/workspace.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.workspace_workspace@1.0.333/dist/workspace.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,5 +1,5 @@
1
1
  import { ComponentID } from '@teambit/component-id';
2
- import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';
2
+ import { SourceFile } from '@teambit/component.sources';
3
3
  import { SourceFileModel } from '@teambit/legacy/dist/scope/models/version';
4
4
  import { Repository } from '@teambit/legacy/dist/scope/objects';
5
5
  type FILE_STATUS = 'new' | 'modified' | 'deleted' | 'unchanged';
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CompFiles = void 0;
7
- function _sources() {
8
- const data = require("@teambit/legacy/dist/consumer/component/sources");
9
- _sources = function () {
7
+ function _component() {
8
+ const data = require("@teambit/component.sources");
9
+ _component = function () {
10
10
  return data;
11
11
  };
12
12
  return data;
@@ -34,7 +34,7 @@ class CompFiles {
34
34
  return this.currentFiles;
35
35
  }
36
36
  async getHeadFiles() {
37
- return Promise.all(this.modelFiles.map(file => _sources().SourceFile.loadFromSourceFileModel(file, this.repository)));
37
+ return Promise.all(this.modelFiles.map(file => _component().SourceFile.loadFromSourceFileModel(file, this.repository)));
38
38
  }
39
39
  getFilesStatus() {
40
40
  const result = this.currentFiles.reduce((acc, file) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_sources","data","require","CompFiles","constructor","id","repository","currentFiles","compDir","modelFiles","isModified","length","some","file","headFile","find","h","relativePath","relative","isEqual","toSourceAsLinuxEOL","hash","getCurrentFiles","getHeadFiles","Promise","all","map","SourceFile","loadFromSourceFileModel","getFilesStatus","result","reduce","acc","getType","forEach","currentFile","c","exports"],"sources":["comp-files.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { SourceFileModel } from '@teambit/legacy/dist/scope/models/version';\nimport { Repository } from '@teambit/legacy/dist/scope/objects';\n\ntype FILE_STATUS = 'new' | 'modified' | 'deleted' | 'unchanged';\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\nexport type FilesStatus = { [pathRelativeToCompDir: PathLinux]: FILE_STATUS };\n\nexport class CompFiles {\n constructor(\n readonly id: ComponentID,\n private repository: Repository,\n private currentFiles: SourceFile[],\n readonly compDir: PathLinux,\n private modelFiles: SourceFileModel[] = []\n ) {}\n\n isModified(): boolean {\n if (!this.modelFiles.length) return false;\n if (this.currentFiles.length !== this.modelFiles.length) return true;\n return this.currentFiles.some((file) => {\n const headFile = this.modelFiles.find((h) => h.relativePath === file.relative);\n if (!headFile) return true;\n return !headFile.file.isEqual(file.toSourceAsLinuxEOL().hash());\n });\n }\n\n getCurrentFiles(): SourceFile[] {\n return this.currentFiles;\n }\n\n async getHeadFiles(): Promise<SourceFile[]> {\n return Promise.all(this.modelFiles.map((file) => SourceFile.loadFromSourceFileModel(file, this.repository)));\n }\n\n getFilesStatus(): FilesStatus {\n const result = this.currentFiles.reduce((acc, file) => {\n const headFile = this.modelFiles.find((h) => h.relativePath === file.relative);\n const getType = (): FILE_STATUS => {\n if (!headFile) return 'new';\n if (headFile.file.isEqual(file.toSourceAsLinuxEOL().hash())) return 'unchanged';\n return 'modified';\n };\n acc[file.relative] = getType();\n return acc;\n }, {});\n this.modelFiles.forEach((headFile) => {\n const currentFile = this.currentFiles.find((c) => c.relative === headFile.relativePath);\n if (!currentFile) {\n result[headFile.relativePath] = 'deleted';\n }\n });\n return result;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKyB;;AAGlB,MAAME,SAAS,CAAC;EACrBC,WAAWA,CACAC,EAAe,EAChBC,UAAsB,EACtBC,YAA0B,EACzBC,OAAkB,EACnBC,UAA6B,GAAG,EAAE,EAC1C;IAAA,KALSJ,EAAe,GAAfA,EAAe;IAAA,KAChBC,UAAsB,GAAtBA,UAAsB;IAAA,KACtBC,YAA0B,GAA1BA,YAA0B;IAAA,KACzBC,OAAkB,GAAlBA,OAAkB;IAAA,KACnBC,UAA6B,GAA7BA,UAA6B;EACpC;EAEHC,UAAUA,CAAA,EAAY;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CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,WAAW;QAC/E,OAAO,UAAU;MACnB,CAAC;MACDW,GAAG,CAACnB,IAAI,CAACK,QAAQ,CAAC,GAAGe,OAAO,CAAC,CAAC;MAC9B,OAAOD,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IACN,IAAI,CAACvB,UAAU,CAACyB,OAAO,CAAEpB,QAAQ,IAAK;MACpC,MAAMqB,WAAW,GAAG,IAAI,CAAC5B,YAAY,CAACQ,IAAI,CAAEqB,CAAC,IAAKA,CAAC,CAAClB,QAAQ,KAAKJ,QAAQ,CAACG,YAAY,CAAC;MACvF,IAAI,CAACkB,WAAW,EAAE;QAChBL,MAAM,CAAChB,QAAQ,CAACG,YAAY,CAAC,GAAG,SAAS;MAC3C;IACF,CAAC,CAAC;IACF,OAAOa,MAAM;EACf;AACF;AAACO,OAAA,CAAAlC,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_component","data","require","CompFiles","constructor","id","repository","currentFiles","compDir","modelFiles","isModified","length","some","file","headFile","find","h","relativePath","relative","isEqual","toSourceAsLinuxEOL","hash","getCurrentFiles","getHeadFiles","Promise","all","map","SourceFile","loadFromSourceFileModel","getFilesStatus","result","reduce","acc","getType","forEach","currentFile","c","exports"],"sources":["comp-files.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport { SourceFile } from '@teambit/component.sources';\nimport { SourceFileModel } from '@teambit/legacy/dist/scope/models/version';\nimport { Repository } from '@teambit/legacy/dist/scope/objects';\n\ntype FILE_STATUS = 'new' | 'modified' | 'deleted' | 'unchanged';\ntype PathLinux = string; // ts fails when importing it from @teambit/legacy/dist/utils/path.\nexport type FilesStatus = { [pathRelativeToCompDir: PathLinux]: FILE_STATUS };\n\nexport class CompFiles {\n constructor(\n readonly id: ComponentID,\n private repository: Repository,\n private currentFiles: SourceFile[],\n readonly compDir: PathLinux,\n private modelFiles: SourceFileModel[] = []\n ) {}\n\n isModified(): boolean {\n if (!this.modelFiles.length) return false;\n if (this.currentFiles.length !== this.modelFiles.length) return true;\n return this.currentFiles.some((file) => {\n const headFile = this.modelFiles.find((h) => h.relativePath === file.relative);\n if (!headFile) return true;\n return !headFile.file.isEqual(file.toSourceAsLinuxEOL().hash());\n });\n }\n\n getCurrentFiles(): SourceFile[] {\n return this.currentFiles;\n }\n\n async getHeadFiles(): Promise<SourceFile[]> {\n return Promise.all(this.modelFiles.map((file) => SourceFile.loadFromSourceFileModel(file, this.repository)));\n }\n\n getFilesStatus(): FilesStatus {\n const result = this.currentFiles.reduce((acc, file) => {\n const headFile = this.modelFiles.find((h) => h.relativePath === file.relative);\n const getType = (): FILE_STATUS => {\n if (!headFile) return 'new';\n if (headFile.file.isEqual(file.toSourceAsLinuxEOL().hash())) return 'unchanged';\n return 'modified';\n };\n acc[file.relative] = getType();\n return acc;\n }, {});\n this.modelFiles.forEach((headFile) => {\n const currentFile = this.currentFiles.find((c) => c.relative === headFile.relativePath);\n if (!currentFile) {\n result[headFile.relativePath] = 'deleted';\n }\n });\n return result;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKyB;;AAGlB,MAAME,SAAS,CAAC;EACrBC,WAAWA,CACAC,EAAe,EAChBC,UAAsB,EACtBC,YAA0B,EACzBC,OAAkB,EACnBC,UAA6B,GAAG,EAAE,EAC1C;IAAA,KALSJ,EAAe,GAAfA,EAAe;IAAA,KAChBC,UAAsB,GAAtBA,UAAsB;IAAA,KACtBC,YAA0B,GAA1BA,YAA0B;IAAA,KACzBC,OAAkB,GAAlBA,OAAkB;IAAA,KACnBC,UAA6B,GAA7BA,UAA6B;EACpC;EAEHC,UAAUA,CAAA,EAAY;IACpB,IAAI,CAAC,IAAI,CAACD,UAAU,CAACE,MAAM,EAAE,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WAAW;QAC/E,OAAO,UAAU;MACnB,CAAC;MACDW,GAAG,CAACnB,IAAI,CAACK,QAAQ,CAAC,GAAGe,OAAO,CAAC,CAAC;MAC9B,OAAOD,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IACN,IAAI,CAACvB,UAAU,CAACyB,OAAO,CAAEpB,QAAQ,IAAK;MACpC,MAAMqB,WAAW,GAAG,IAAI,CAAC5B,YAAY,CAACQ,IAAI,CAAEqB,CAAC,IAAKA,CAAC,CAAClB,QAAQ,KAAKJ,QAAQ,CAACG,YAAY,CAAC;MACvF,IAAI,CAACkB,WAAW,EAAE;QAChBL,MAAM,CAAChB,QAAQ,CAACG,YAAY,CAAC,GAAG,SAAS;MAC3C;IACF,CAAC,CAAC;IACF,OAAOa,MAAM;EACf;AACF;AAACO,OAAA,CAAAlC,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -16,17 +16,16 @@ import { BitId } from '@teambit/legacy-bit-id';
16
16
  import { LaneId } from '@teambit/lane-id';
17
17
  import { Consumer } from '@teambit/legacy/dist/consumer';
18
18
  import { GetBitMapComponentOptions } from '@teambit/legacy.bit-map';
19
- import ComponentsList from '@teambit/legacy/dist/consumer/component/components-list';
19
+ import { ComponentsList } from '@teambit/legacy.component-list';
20
20
  import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
21
21
  import { PathOsBased, PathOsBasedRelative, PathOsBasedAbsolute } from '@teambit/toolbox.path.path';
22
22
  import { CompIdGraph, DepEdgeType } from '@teambit/graph';
23
23
  import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
24
24
  import { WatchOptions } from '@teambit/watcher';
25
25
  import type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
26
- import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';
26
+ import { SourceFile, JsonVinyl } from '@teambit/component.sources';
27
27
  import { Lane } from '@teambit/legacy/dist/scope/models';
28
28
  import { GlobalConfigMain } from '@teambit/global-config';
29
- import { JsonVinyl } from '@teambit/legacy/dist/consumer/component/json-vinyl';
30
29
  import { ComponentConfigFile } from './component-config-file';
31
30
  import { OnComponentAdd, OnComponentChange, OnComponentEventResult, OnComponentLoad, OnComponentRemove } from './on-component-events';
32
31
  import { WorkspaceExtConfig } from './types';
package/dist/workspace.js CHANGED
@@ -109,9 +109,9 @@ function _harmonyModules() {
109
109
  };
110
110
  return data;
111
111
  }
112
- function _componentsList() {
113
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/components-list"));
114
- _componentsList = function () {
112
+ function _legacy2() {
113
+ const data = require("@teambit/legacy.component-list");
114
+ _legacy2 = function () {
115
115
  return data;
116
116
  };
117
117
  return data;
@@ -172,9 +172,9 @@ function _component2() {
172
172
  };
173
173
  return data;
174
174
  }
175
- function _sources() {
176
- const data = require("@teambit/legacy/dist/consumer/component/sources");
177
- _sources = function () {
175
+ function _component3() {
176
+ const data = require("@teambit/component.sources");
177
+ _component3 = function () {
178
178
  return data;
179
179
  };
180
180
  return data;
@@ -193,9 +193,9 @@ function _loader() {
193
193
  };
194
194
  return data;
195
195
  }
196
- function _legacy2() {
196
+ function _legacy3() {
197
197
  const data = require("@teambit/legacy.scope-api");
198
- _legacy2 = function () {
198
+ _legacy3 = function () {
199
199
  return data;
200
200
  };
201
201
  return data;
@@ -221,13 +221,6 @@ function _http() {
221
221
  };
222
222
  return data;
223
223
  }
224
- function _dataToPersist() {
225
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component/sources/data-to-persist"));
226
- _dataToPersist = function () {
227
- return data;
228
- };
229
- return data;
230
- }
231
224
  function _componentConfigFile() {
232
225
  const data = require("./component-config-file");
233
226
  _componentConfigFile = function () {
@@ -351,7 +344,7 @@ class Workspace {
351
344
  /**
352
345
  * access to the `ComponentProvider` instance
353
346
  */
354
- componentAspect, dependencyResolver, variants, aspectLoader, logger, componentList = new (_componentsList().default)(consumer),
347
+ componentAspect, dependencyResolver, variants, aspectLoader, logger, componentList = new (_legacy2().ComponentsList)(consumer),
355
348
  /**
356
349
  * private reference to the instance of Harmony.
357
350
  */
@@ -498,7 +491,7 @@ class Workspace {
498
491
  return this.config.icon;
499
492
  }
500
493
  async listAutoTagPendingComponentIds() {
501
- const componentsList = new (_componentsList().default)(this.consumer);
494
+ const componentsList = new (_legacy2().ComponentsList)(this.consumer);
502
495
  const modifiedComponents = (await this.modified()).map(c => c.id);
503
496
  const newComponents = await componentsList.listNewComponents();
504
497
  if (!modifiedComponents || !modifiedComponents.length) return [];
@@ -789,7 +782,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
789
782
  const compDirAbs = _path().default.join(this.path, compDir);
790
783
  const sourceFilesVinyls = bitMapEntry.files.map(file => {
791
784
  const filePath = _path().default.join(compDirAbs, file.relativePath);
792
- return _sources().SourceFile.load(filePath, compDirAbs, this.path, {});
785
+ return _component3().SourceFile.load(filePath, compDirAbs, this.path, {});
793
786
  });
794
787
  const repo = this.scope.legacyScope.objects;
795
788
  const getModelFiles = async () => {
@@ -868,13 +861,13 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
868
861
  this.componentLoader.clearCache();
869
862
  this.consumer.componentLoader.clearComponentsCache();
870
863
  this.componentStatusLoader.clearCache();
871
- this.componentList = new (_componentsList().default)(this.consumer);
864
+ this.componentList = new (_legacy2().ComponentsList)(this.consumer);
872
865
  }
873
866
  clearComponentCache(id) {
874
867
  this.componentLoader.clearComponentCache(id);
875
868
  this.componentStatusLoader.clearOneComponentCache(id);
876
869
  this.consumer.clearOneComponentCache(id);
877
- this.componentList = new (_componentsList().default)(this.consumer);
870
+ this.componentList = new (_legacy2().ComponentsList)(this.consumer);
878
871
  }
879
872
  async warmCache() {
880
873
  await this.list();
@@ -1011,7 +1004,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1011
1004
  const lanes = await scopeComponentImporter.importLanes([currentLaneId]);
1012
1005
  return lanes[0];
1013
1006
  } catch (err) {
1014
- if (err instanceof _legacyBitId().InvalidScopeName || err instanceof _scopeNotFoundOrDenied().ScopeNotFoundOrDenied || err instanceof _legacy2().LaneNotFound || err instanceof _legacyBitId().InvalidScopeNameFromRemote) {
1007
+ if (err instanceof _legacyBitId().InvalidScopeName || err instanceof _scopeNotFoundOrDenied().ScopeNotFoundOrDenied || err instanceof _legacy3().LaneNotFound || err instanceof _legacyBitId().InvalidScopeNameFromRemote) {
1015
1008
  const bitMapLaneId = this.bitMap.getExportedLaneId();
1016
1009
  if (bitMapLaneId?.isEqual(currentLaneId)) {
1017
1010
  throw err; // we know the lane is not new, so the error is legit
@@ -1058,7 +1051,7 @@ it's possible that the version ${component.id.version} belong to ${idStr.split('
1058
1051
  const EjectConfResult = vinylFiles.map(file => ({
1059
1052
  configPath: file.path
1060
1053
  }));
1061
- const dataToPersist = new (_dataToPersist().default)();
1054
+ const dataToPersist = new (_component3().DataToPersist)();
1062
1055
  dataToPersist.addManyFiles(vinylFiles);
1063
1056
  dataToPersist.addBasePath(this.path);
1064
1057
  await dataToPersist.persistAllToFS();