@teambit/tracker 1.0.329 → 1.0.331

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.
Files changed (65) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/schema.json +608 -73
  3. package/dist/add-cmd.d.ts +1 -1
  4. package/dist/add-cmd.js.map +1 -1
  5. package/dist/add-components.d.ts +2 -3
  6. package/dist/add-components.js +63 -58
  7. package/dist/add-components.js.map +1 -1
  8. package/dist/determine-main-file.d.ts +2 -2
  9. package/dist/determine-main-file.js +10 -10
  10. package/dist/determine-main-file.js.map +1 -1
  11. package/dist/exceptions/adding-individual-files.d.ts +5 -0
  12. package/dist/exceptions/adding-individual-files.js +26 -0
  13. package/dist/exceptions/adding-individual-files.js.map +1 -0
  14. package/dist/exceptions/duplicate-ids.d.ts +5 -0
  15. package/dist/exceptions/duplicate-ids.js +49 -0
  16. package/dist/exceptions/duplicate-ids.js.map +1 -0
  17. package/dist/exceptions/empty-directory.d.ts +4 -0
  18. package/dist/exceptions/empty-directory.js +29 -0
  19. package/dist/exceptions/empty-directory.js.map +1 -0
  20. package/dist/exceptions/excluded-main-file.d.ts +5 -0
  21. package/dist/exceptions/excluded-main-file.js +34 -0
  22. package/dist/exceptions/excluded-main-file.js.map +1 -0
  23. package/dist/exceptions/index.d.ts +10 -0
  24. package/dist/exceptions/index.js +125 -0
  25. package/dist/exceptions/index.js.map +1 -0
  26. package/dist/exceptions/main-file-is-dir.d.ts +5 -0
  27. package/dist/exceptions/main-file-is-dir.js +34 -0
  28. package/dist/exceptions/main-file-is-dir.js.map +1 -0
  29. package/dist/exceptions/missing-main-file-multiple-components.d.ts +5 -0
  30. package/dist/exceptions/missing-main-file-multiple-components.js +41 -0
  31. package/dist/exceptions/missing-main-file-multiple-components.js.map +1 -0
  32. package/dist/exceptions/no-files.d.ts +5 -0
  33. package/dist/exceptions/no-files.js +34 -0
  34. package/dist/exceptions/no-files.js.map +1 -0
  35. package/dist/exceptions/parent-dir-tracked.d.ts +4 -0
  36. package/dist/exceptions/parent-dir-tracked.js +23 -0
  37. package/dist/exceptions/parent-dir-tracked.js.map +1 -0
  38. package/dist/exceptions/path-outside-consumer.d.ts +5 -0
  39. package/dist/exceptions/path-outside-consumer.js +34 -0
  40. package/dist/exceptions/path-outside-consumer.js.map +1 -0
  41. package/dist/exceptions/paths-not-exist.d.ts +6 -0
  42. package/dist/exceptions/paths-not-exist.js +36 -0
  43. package/dist/exceptions/paths-not-exist.js.map +1 -0
  44. package/dist/exceptions/version-should-be-removed.d.ts +5 -0
  45. package/dist/exceptions/version-should-be-removed.js +34 -0
  46. package/dist/exceptions/version-should-be-removed.js.map +1 -0
  47. package/dist/index.d.ts +3 -0
  48. package/dist/index.js +51 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/tracker.main.runtime.d.ts +1 -1
  51. package/dist/tracker.main.runtime.js.map +1 -1
  52. package/exceptions/adding-individual-files.ts +9 -0
  53. package/exceptions/duplicate-ids.ts +25 -0
  54. package/exceptions/empty-directory.ts +8 -0
  55. package/exceptions/excluded-main-file.ts +10 -0
  56. package/exceptions/index.ts +21 -0
  57. package/exceptions/main-file-is-dir.ts +12 -0
  58. package/exceptions/missing-main-file-multiple-components.ts +16 -0
  59. package/exceptions/no-files.ts +14 -0
  60. package/exceptions/parent-dir-tracked.ts +9 -0
  61. package/exceptions/path-outside-consumer.ts +10 -0
  62. package/exceptions/paths-not-exist.ts +13 -0
  63. package/exceptions/version-should-be-removed.ts +10 -0
  64. package/package.json +12 -9
  65. /package/dist/{preview-1720427783719.js → preview-1720667996237.js} +0 -0
package/dist/add-cmd.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Command, CommandOptions } from '@teambit/cli';
2
- import { PathLinux } from '@teambit/legacy/dist/utils/path';
2
+ import { PathLinux } from '@teambit/legacy.utils';
3
3
  import { Warnings } from './add-components';
4
4
  import { TrackerMain } from './tracker.main.runtime';
5
5
  type AddFlags = {
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","path","_interopRequireWildcard","_bitError","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AddCmd","constructor","tracker","report","paths","addFlags","addedComponents","warnings","json","paintWarning","alreadyUsedOutput","alreadyUsedWarning","keys","alreadyUsed","map","key","chalk","yellow","bold","join","filter","x","emptyDirectoryOutput","emptyDirectory","length","green","result","files","underline","red","id","title","file","flat","main","namespace","scope","env","override","BitError","normalizedPaths","p","normalize","addForCLI","componentPaths","undefined","defaultScope","added","toString","f","relativePath","exports"],"sources":["add-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';\nimport { AddActionResults, Warnings } from './add-components';\nimport { TrackerMain } from './tracker.main.runtime';\n\ntype AddFlags = {\n id: string | null | undefined;\n main: string | null | undefined;\n namespace: string | null | undefined;\n scope?: string;\n env?: string;\n override: boolean;\n};\n\ntype AddResults = {\n addedComponents: Array<{ id: string; files: PathLinux[] }>;\n warnings: Warnings;\n};\n\nexport class AddCmd implements Command {\n name = 'add [path...]';\n description = 'Add any subset of files to be tracked as a component(s).';\n group = 'development';\n extendedDescription = 'Learn the recommended workflow for tracking directories as components, in the link below.';\n helpUrl = 'reference/workspace/component-directory';\n alias = 'a';\n options = [\n ['i', 'id <name>', 'manually set component id'],\n ['m', 'main <file>', 'define component entry point'],\n ['n', 'namespace <namespace>', 'organize component in a namespace'],\n ['o', 'override <boolean>', 'override existing component if exists (default = false)'],\n [\n 's',\n 'scope <string>',\n `sets the component's scope. if not entered, the default-scope from workspace.jsonc will be used`,\n ],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants if exists)\"],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private tracker: TrackerMain) {}\n\n async report([paths = []]: [string[]], addFlags: AddFlags) {\n const { addedComponents, warnings }: AddResults = await this.json([paths], addFlags);\n\n const paintWarning = () => {\n const alreadyUsedOutput = () => {\n const alreadyUsedWarning = Object.keys(warnings.alreadyUsed)\n .map((key) =>\n chalk.yellow(\n `warning: files ${chalk.bold(warnings.alreadyUsed[key].join(', '))} already used by component: ${key}`\n )\n )\n .filter((x) => x)\n .join('\\n');\n return alreadyUsedWarning ? `${alreadyUsedWarning}\\n` : '';\n };\n const emptyDirectoryOutput = () => {\n if (!warnings.emptyDirectory.length) return '';\n return chalk.yellow(\n `warning: the following directories are empty or all their files were excluded\\n${chalk.bold(\n warnings.emptyDirectory.join('\\n')\n )}\\n`\n );\n };\n return alreadyUsedOutput() + emptyDirectoryOutput();\n };\n\n if (addedComponents.length > 1) {\n return paintWarning() + chalk.green(`tracking ${addedComponents.length} new components`);\n }\n\n return (\n paintWarning() +\n addedComponents\n .map((result) => {\n if (result.files.length === 0) {\n return chalk.underline.red(`could not track component ${chalk.bold(result.id)}: no files to track`);\n }\n const title = chalk.underline(`tracking component ${chalk.bold(result.id)}:\\n`);\n const files = result.files.map((file) => chalk.green(`added ${file}`));\n return title + files.join('\\n');\n })\n .flat()\n .join('\\n\\n')\n );\n }\n\n async json(\n [paths = []]: [string[]],\n { id, main, namespace, scope, env, override = false }: AddFlags\n ): Promise<AddResults> {\n if (namespace && id) {\n throw new BitError(\n 'please use either [id] or [namespace] to add a particular component - they cannot be used together'\n );\n }\n\n const normalizedPaths: PathOsBased[] = paths.map((p) => path.normalize(p));\n const { addedComponents, warnings }: AddActionResults = await this.tracker.addForCLI({\n componentPaths: normalizedPaths,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n id,\n main: main ? path.normalize(main) : undefined,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n namespace,\n defaultScope: scope,\n override,\n env,\n });\n return {\n addedComponents: addedComponents.map((added) => ({\n id: added.id.toString(),\n files: added.files.map((f) => f.relativePath),\n })),\n warnings,\n };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,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;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAA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equireWildcard","_bitError","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","AddCmd","constructor","tracker","report","paths","addFlags","addedComponents","warnings","json","paintWarning","alreadyUsedOutput","alreadyUsedWarning","keys","alreadyUsed","map","key","chalk","yellow","bold","join","filter","x","emptyDirectoryOutput","emptyDirectory","length","green","result","files","underline","red","id","title","file","flat","main","namespace","scope","env","override","BitError","normalizedPaths","p","normalize","addForCLI","componentPaths","undefined","defaultScope","added","toString","f","relativePath","exports"],"sources":["add-cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { BitError } from '@teambit/bit-error';\nimport { PathLinux, PathOsBased } from '@teambit/legacy.utils';\nimport { AddActionResults, Warnings } from './add-components';\nimport { TrackerMain } from './tracker.main.runtime';\n\ntype AddFlags = {\n id: string | null | undefined;\n main: string | null | undefined;\n namespace: string | null | undefined;\n scope?: string;\n env?: string;\n override: boolean;\n};\n\ntype AddResults = {\n addedComponents: Array<{ id: string; files: PathLinux[] }>;\n warnings: Warnings;\n};\n\nexport class AddCmd implements Command {\n name = 'add [path...]';\n description = 'Add any subset of files to be tracked as a component(s).';\n group = 'development';\n extendedDescription = 'Learn the recommended workflow for tracking directories as components, in the link below.';\n helpUrl = 'reference/workspace/component-directory';\n alias = 'a';\n options = [\n ['i', 'id <name>', 'manually set component id'],\n ['m', 'main <file>', 'define component entry point'],\n ['n', 'namespace <namespace>', 'organize component in a namespace'],\n ['o', 'override <boolean>', 'override existing component if exists (default = false)'],\n [\n 's',\n 'scope <string>',\n `sets the component's scope. if not entered, the default-scope from workspace.jsonc will be used`,\n ],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants if exists)\"],\n ['j', 'json', 'output as json format'],\n ] as CommandOptions;\n loader = true;\n\n constructor(private tracker: TrackerMain) {}\n\n async report([paths = []]: [string[]], addFlags: AddFlags) {\n const { addedComponents, warnings }: AddResults = await this.json([paths], addFlags);\n\n const paintWarning = () => {\n const alreadyUsedOutput = () => {\n const alreadyUsedWarning = Object.keys(warnings.alreadyUsed)\n .map((key) =>\n chalk.yellow(\n `warning: files ${chalk.bold(warnings.alreadyUsed[key].join(', '))} already used by component: ${key}`\n )\n )\n .filter((x) => x)\n .join('\\n');\n return alreadyUsedWarning ? `${alreadyUsedWarning}\\n` : '';\n };\n const emptyDirectoryOutput = () => {\n if (!warnings.emptyDirectory.length) return '';\n return chalk.yellow(\n `warning: the following directories are empty or all their files were excluded\\n${chalk.bold(\n warnings.emptyDirectory.join('\\n')\n )}\\n`\n );\n };\n return alreadyUsedOutput() + emptyDirectoryOutput();\n };\n\n if (addedComponents.length > 1) {\n return paintWarning() + chalk.green(`tracking ${addedComponents.length} new components`);\n }\n\n return (\n paintWarning() +\n addedComponents\n .map((result) => {\n if (result.files.length === 0) {\n return chalk.underline.red(`could not track component ${chalk.bold(result.id)}: no files to track`);\n }\n const title = chalk.underline(`tracking component ${chalk.bold(result.id)}:\\n`);\n const files = result.files.map((file) => chalk.green(`added ${file}`));\n return title + files.join('\\n');\n })\n .flat()\n .join('\\n\\n')\n );\n }\n\n async json(\n [paths = []]: [string[]],\n { id, main, namespace, scope, env, override = false }: AddFlags\n ): Promise<AddResults> {\n if (namespace && id) {\n throw new BitError(\n 'please use either [id] or [namespace] to add a particular component - they cannot be used together'\n );\n }\n\n const normalizedPaths: PathOsBased[] = paths.map((p) => path.normalize(p));\n const { addedComponents, warnings }: AddActionResults = await this.tracker.addForCLI({\n componentPaths: normalizedPaths,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n id,\n main: main ? path.normalize(main) : undefined,\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n namespace,\n defaultScope: scope,\n override,\n env,\n });\n return {\n addedComponents: addedComponents.map((added) => ({\n id: added.id.toString(),\n files: added.files.map((f) => f.relativePath),\n })),\n warnings,\n };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,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;AACA,SAAAK,UAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8C,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,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C,CAAC,CACDc,IAAI,CAAC,CAAC,CACNd,IAAI,CAAC,MAAM,CAAC;EAEnB;EAEA,MAAMX,IAAIA,CACR,CAACJ,KAAK,GAAG,EAAE,CAAa,EACxB;IAAE0B,EAAE;IAAEI,IAAI;IAAEC,SAAS;IAAEC,KAAK;IAAEC,GAAG;IAAEC,QAAQ,GAAG;EAAgB,CAAC,EAC1C;IACrB,IAAIH,SAAS,IAAIL,EAAE,EAAE;MACnB,MAAM,KAAIS,oBAAQ,EAChB,oGACF,CAAC;IACH;IAEA,MAAMC,eAA8B,GAAGpC,KAAK,CAACU,GAAG,CAAE2B,CAAC,IAAK5E,IAAI,CAAD,CAAC,CAAC6E,SAAS,CAACD,CAAC,CAAC,CAAC;IAC1E,MAAM;MAAEnC,eAAe;MAAEC;IAA2B,CAAC,GAAG,MAAM,IAAI,CAACL,OAAO,CAACyC,SAAS,CAAC;MACnFC,cAAc,EAAEJ,eAAe;MAC/B;MACAV,EAAE;MACFI,IAAI,EAAEA,IAAI,GAAGrE,IAAI,CAAD,CAAC,CAAC6E,SAAS,CAACR,IAAI,CAAC,GAAGW,SAAS;MAC7C;MACAV,SAAS;MACTW,YAAY,EAAEV,KAAK;MACnBE,QAAQ;MACRD;IACF,CAAC,CAAC;IACF,OAAO;MACL/B,eAAe,EAAEA,eAAe,CAACQ,GAAG,CAAEiC,KAAK,KAAM;QAC/CjB,EAAE,EAAEiB,KAAK,CAACjB,EAAE,CAACkB,QAAQ,CAAC,CAAC;QACvBrB,KAAK,EAAEoB,KAAK,CAACpB,KAAK,CAACb,GAAG,CAAEmC,CAAC,IAAKA,CAAC,CAACC,YAAY;MAC9C,CAAC,CAAC,CAAC;MACH3C;IACF,CAAC;EACH;AACF;AAAC4C,OAAA,CAAAnD,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -1,8 +1,7 @@
1
1
  import { ComponentID } from '@teambit/component-id';
2
- import BitMap from '@teambit/legacy/dist/consumer/bit-map';
2
+ import { BitMap, ComponentMap, ComponentMapFile, Config } from '@teambit/legacy.bit-map';
3
3
  import Consumer from '@teambit/legacy/dist/consumer/consumer';
4
- import { PathLinux, PathOsBased } from '@teambit/legacy/dist/utils/path';
5
- import ComponentMap, { ComponentMapFile, Config } from '@teambit/legacy/dist/consumer/bit-map/component-map';
4
+ import { PathLinux, PathOsBased } from '@teambit/legacy.utils';
6
5
  import { Workspace } from '@teambit/workspace';
7
6
  export type AddResult = {
8
7
  id: ComponentID;
@@ -11,6 +11,13 @@ function _arrayDifference() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _firstline() {
15
+ const data = _interopRequireDefault(require("firstline"));
16
+ _firstline = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _fsExtra() {
15
22
  const data = _interopRequireDefault(require("fs-extra"));
16
23
  _fsExtra = function () {
@@ -74,83 +81,76 @@ function _constants() {
74
81
  };
75
82
  return data;
76
83
  }
77
- function _bitError() {
78
- const data = require("@teambit/bit-error");
79
- _bitError = function () {
80
- return data;
81
- };
82
- return data;
83
- }
84
- function _logger() {
85
- const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
86
- _logger = function () {
87
- return data;
88
- };
89
- return data;
90
- }
91
- function _utils() {
92
- const data = require("@teambit/legacy/dist/utils");
93
- _utils = function () {
94
- return data;
95
- };
96
- return data;
97
- }
98
- function _componentMap() {
99
- const data = _interopRequireWildcard(require("@teambit/legacy/dist/consumer/bit-map/component-map"));
100
- _componentMap = function () {
101
- return data;
102
- };
103
- return data;
104
- }
105
- function _missingMainFile() {
106
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/bit-map/exceptions/missing-main-file"));
107
- _missingMainFile = function () {
84
+ function _legacy2() {
85
+ const data = require("@teambit/legacy.bit-map");
86
+ _legacy2 = function () {
108
87
  return data;
109
88
  };
110
89
  return data;
111
90
  }
112
91
  function _exceptions() {
113
- const data = require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions");
92
+ const data = require("./exceptions");
114
93
  _exceptions = function () {
115
94
  return data;
116
95
  };
117
96
  return data;
118
97
  }
119
98
  function _addingIndividualFiles() {
120
- const data = require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/adding-individual-files");
99
+ const data = require("./exceptions/adding-individual-files");
121
100
  _addingIndividualFiles = function () {
122
101
  return data;
123
102
  };
124
103
  return data;
125
104
  }
126
105
  function _missingMainFileMultipleComponents() {
127
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/missing-main-file-multiple-components"));
106
+ const data = _interopRequireDefault(require("./exceptions/missing-main-file-multiple-components"));
128
107
  _missingMainFileMultipleComponents = function () {
129
108
  return data;
130
109
  };
131
110
  return data;
132
111
  }
133
112
  function _parentDirTracked() {
134
- const data = require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/parent-dir-tracked");
113
+ const data = require("./exceptions/parent-dir-tracked");
135
114
  _parentDirTracked = function () {
136
115
  return data;
137
116
  };
138
117
  return data;
139
118
  }
140
119
  function _pathOutsideConsumer() {
141
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/path-outside-consumer"));
120
+ const data = _interopRequireDefault(require("./exceptions/path-outside-consumer"));
142
121
  _pathOutsideConsumer = function () {
143
122
  return data;
144
123
  };
145
124
  return data;
146
125
  }
147
126
  function _versionShouldBeRemoved() {
148
- const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/add-components/exceptions/version-should-be-removed"));
127
+ const data = _interopRequireDefault(require("./exceptions/version-should-be-removed"));
149
128
  _versionShouldBeRemoved = function () {
150
129
  return data;
151
130
  };
152
131
  return data;
153
132
  }
133
+ function _bitError() {
134
+ const data = require("@teambit/bit-error");
135
+ _bitError = function () {
136
+ return data;
137
+ };
138
+ return data;
139
+ }
140
+ function _logger() {
141
+ const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
142
+ _logger = function () {
143
+ return data;
144
+ };
145
+ return data;
146
+ }
147
+ function _legacy3() {
148
+ const data = require("@teambit/legacy.utils");
149
+ _legacy3 = function () {
150
+ return data;
151
+ };
152
+ return data;
153
+ }
154
154
  function _workspaceModules() {
155
155
  const data = require("@teambit/workspace.modules.node-modules-linker");
156
156
  _workspaceModules = function () {
@@ -201,6 +201,7 @@ class AddComponents {
201
201
  _defineProperty(this, "shouldHandleOutOfSync", void 0);
202
202
  this.workspace = context.workspace;
203
203
  this.consumer = context.workspace.consumer;
204
+ // @ts-ignore todo: remove after deleting teambit.legacy
204
205
  this.bitMap = this.consumer.bitMap;
205
206
  this.componentPaths = addProps.componentPaths;
206
207
  this.id = addProps.id;
@@ -230,7 +231,7 @@ class AddComponents {
230
231
  const filesListMatch = files.map(async file => {
231
232
  const fileInfo = calculateFileInfo(file);
232
233
  const generatedFile = (0, _stringFormat().default)(dsl, fileInfo);
233
- const matches = await (0, _utils().glob)(generatedFile);
234
+ const matches = await (0, _legacy3().glob)(generatedFile);
234
235
  const matchesAfterGitIgnore = this.gitIgnore.filter(matches);
235
236
  return matchesAfterGitIgnore.filter(match => _fsExtra().default.existsSync(match));
236
237
  });
@@ -240,10 +241,10 @@ class AddComponents {
240
241
  const filesListUnique = (0, _lodash().uniq)(filesListFlatten);
241
242
  return filesListUnique.map(file => {
242
243
  // when files array has the test file with different letter case, use the one from the file array
243
- const fileNormalized = (0, _utils().pathNormalizeToLinux)(file);
244
+ const fileNormalized = (0, _legacy3().pathNormalizeToLinux)(file);
244
245
  const fileWithCorrectCase = files.find(f => f.toLowerCase() === fileNormalized.toLowerCase()) || fileNormalized;
245
246
  const relativeToConsumer = this.consumer.getPathRelativeToConsumer(fileWithCorrectCase);
246
- return (0, _utils().pathNormalizeToLinux)(relativeToConsumer);
247
+ return (0, _legacy3().pathNormalizeToLinux)(relativeToConsumer);
247
248
  });
248
249
  }
249
250
 
@@ -289,7 +290,7 @@ class AddComponents {
289
290
  const componentFilesP = files.map(async file => {
290
291
  // $FlowFixMe null is removed later on
291
292
  const filePath = path().join(consumerPath, file.relativePath);
292
- const isAutoGenerated = await (0, _utils().isAutoGeneratedFile)(filePath);
293
+ const isAutoGenerated = await isAutoGeneratedFile(filePath);
293
294
  if (isAutoGenerated) {
294
295
  return null;
295
296
  }
@@ -351,13 +352,13 @@ class AddComponents {
351
352
  if (this.trackDirFeature) throw new Error('track dir should not calculate the rootDir');
352
353
  if (foundComponentFromBitMap) return foundComponentFromBitMap.rootDir;
353
354
  if (!trackDir) throw new Error(`addOrUpdateComponentInBitMap expect to have trackDir for non-legacy workspace`);
354
- const fileNotInsideTrackDir = componentFiles.find(file => !(0, _utils().pathNormalizeToLinux)(file.relativePath).startsWith(`${(0, _utils().pathNormalizeToLinux)(trackDir)}/`));
355
+ const fileNotInsideTrackDir = componentFiles.find(file => !(0, _legacy3().pathNormalizeToLinux)(file.relativePath).startsWith(`${(0, _legacy3().pathNormalizeToLinux)(trackDir)}/`));
355
356
  if (fileNotInsideTrackDir) {
356
357
  // we check for this error before. however, it's possible that a user have one trackDir
357
358
  // and another dir for the tests.
358
359
  throw new (_addingIndividualFiles().AddingIndividualFiles)(fileNotInsideTrackDir.relativePath);
359
360
  }
360
- return (0, _utils().pathNormalizeToLinux)(trackDir);
361
+ return (0, _legacy3().pathNormalizeToLinux)(trackDir);
361
362
  };
362
363
  const getComponentMap = async () => {
363
364
  if (this.trackDirFeature) {
@@ -397,19 +398,19 @@ class AddComponents {
397
398
  _updateFilesAccordingToExistingRootDir(foundComponentFromBitMap, componentFiles, component) {
398
399
  const existingRootDir = foundComponentFromBitMap.rootDir;
399
400
  if (!existingRootDir) return; // nothing to do.
400
- const areFilesInsideExistingRootDir = componentFiles.every(file => (0, _utils().pathNormalizeToLinux)(file.relativePath).startsWith(`${existingRootDir}/`));
401
+ const areFilesInsideExistingRootDir = componentFiles.every(file => (0, _legacy3().pathNormalizeToLinux)(file.relativePath).startsWith(`${existingRootDir}/`));
401
402
  if (areFilesInsideExistingRootDir) {
402
- _componentMap().default.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);
403
+ _legacy2().ComponentMap.changeFilesPathAccordingToItsRootDir(existingRootDir, componentFiles);
403
404
  return;
404
405
  }
405
406
  // some (or all) added files are outside the existing rootDir, the rootDir needs to be changed
406
407
  // if a directory was added and it's a parent of the existing rootDir, change the rootDir to
407
408
  // the currently added rootDir.
408
- const currentlyAddedDir = (0, _utils().pathNormalizeToLinux)(component.trackDir);
409
+ const currentlyAddedDir = (0, _legacy3().pathNormalizeToLinux)(component.trackDir);
409
410
  const currentlyAddedDirParentOfRootDir = currentlyAddedDir && existingRootDir.startsWith(`${currentlyAddedDir}/`);
410
411
  if (currentlyAddedDirParentOfRootDir) {
411
412
  foundComponentFromBitMap.changeRootDirAndUpdateFilesAccordingly(currentlyAddedDir);
412
- _componentMap().default.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);
413
+ _legacy2().ComponentMap.changeFilesPathAccordingToItsRootDir(currentlyAddedDir, componentFiles);
413
414
  return;
414
415
  }
415
416
  throw new (_bitError().BitError)(`unable to add individual files outside the root dir (${existingRootDir}) of ${component.componentId}.
@@ -466,7 +467,7 @@ you can add the directory these files are located at and it'll change the root d
466
467
  return existingComponentId;
467
468
  }
468
469
  _getIdAccordingToTrackDir(dir) {
469
- const dirNormalizedToLinux = (0, _utils().pathNormalizeToLinux)(dir);
470
+ const dirNormalizedToLinux = (0, _legacy3().pathNormalizeToLinux)(dir);
470
471
  const trackDirs = this.bitMap.getAllTrackDirs();
471
472
  if (!trackDirs) return null;
472
473
  return trackDirs[dirNormalizedToLinux];
@@ -493,7 +494,7 @@ you can add the directory these files are located at and it'll change the root d
493
494
  throw new (_exceptions().ExcludedMainFile)(generatedFile);
494
495
  }
495
496
  files.push({
496
- relativePath: (0, _utils().pathNormalizeToLinux)(generatedFile),
497
+ relativePath: (0, _legacy3().pathNormalizeToLinux)(generatedFile),
497
498
  test: false,
498
499
  name: path().basename(generatedFile)
499
500
  });
@@ -507,7 +508,7 @@ you can add the directory these files are located at and it'll change the root d
507
508
  if (_fsExtra().default.existsSync(mainPath)) {
508
509
  const shouldIgnore = this.gitIgnore.ignores(mainFileRelativeToConsumer);
509
510
  if (shouldIgnore) throw new (_exceptions().ExcludedMainFile)(mainFileRelativeToConsumer);
510
- if ((0, _utils().isDir)(mainPath)) {
511
+ if ((0, _legacy3().isDir)(mainPath)) {
511
512
  throw new (_exceptions().MainFileIsDir)(mainPath);
512
513
  }
513
514
  const foundFile = this._findMainFileInFiles(mainFileRelativeToConsumer, files);
@@ -515,7 +516,7 @@ you can add the directory these files are located at and it'll change the root d
515
516
  return foundFile.relativePath;
516
517
  }
517
518
  files.push({
518
- relativePath: (0, _utils().pathNormalizeToLinux)(mainFileRelativeToConsumer),
519
+ relativePath: (0, _legacy3().pathNormalizeToLinux)(mainFileRelativeToConsumer),
519
520
  test: false,
520
521
  name: path().basename(mainFileRelativeToConsumer)
521
522
  });
@@ -524,7 +525,7 @@ you can add the directory these files are located at and it'll change the root d
524
525
  return mainFile;
525
526
  }
526
527
  _findMainFileInFiles(mainFile, files) {
527
- const normalizedMainFile = (0, _utils().pathNormalizeToLinux)(mainFile).toLowerCase();
528
+ const normalizedMainFile = (0, _legacy3().pathNormalizeToLinux)(mainFile).toLowerCase();
528
529
  return files.find(file => file.relativePath.toLowerCase() === normalizedMainFile);
529
530
  }
530
531
  async getDefaultScope(rootDir, componentName) {
@@ -546,7 +547,7 @@ you can add the directory these files are located at and it'll change the root d
546
547
  const relativeComponentPath = this.consumer.getPathRelativeToConsumer(componentPath);
547
548
  this._throwForOutsideConsumer(relativeComponentPath);
548
549
  this.throwForExistingParentDir(relativeComponentPath);
549
- const matches = await (0, _utils().glob)(path().join(relativeComponentPath, '**'), {
550
+ const matches = await (0, _legacy3().glob)(path().join(relativeComponentPath, '**'), {
550
551
  cwd: this.consumer.getPath(),
551
552
  nodir: true
552
553
  });
@@ -557,7 +558,7 @@ you can add the directory these files are located at and it'll change the root d
557
558
  }
558
559
  const filteredMatchedFiles = filteredMatches.map(match => {
559
560
  return {
560
- relativePath: (0, _utils().pathNormalizeToLinux)(match),
561
+ relativePath: (0, _legacy3().pathNormalizeToLinux)(match),
561
562
  test: false,
562
563
  name: path().basename(match)
563
564
  };
@@ -600,14 +601,14 @@ you can add the directory these files are located at and it'll change the root d
600
601
  }
601
602
  async getIgnoreList() {
602
603
  const consumerPath = this.consumer.getPath();
603
- return (0, _componentMap().getIgnoreListHarmony)(consumerPath);
604
+ return (0, _legacy2().getIgnoreListHarmony)(consumerPath);
604
605
  }
605
606
  async add() {
606
607
  this.ignoreList = await this.getIgnoreList();
607
608
  this.gitIgnore = (0, _ignore().default)().add(this.ignoreList); // add ignore list
608
609
 
609
610
  let componentPathsStats = {};
610
- const resolvedComponentPathsWithoutGitIgnore = (await Promise.all(this.componentPaths.map(componentPath => (0, _utils().glob)(componentPath)))).flat();
611
+ const resolvedComponentPathsWithoutGitIgnore = (await Promise.all(this.componentPaths.map(componentPath => (0, _legacy3().glob)(componentPath)))).flat();
611
612
  this.gitIgnore = (0, _ignore().default)().add(this.ignoreList); // add ignore list
612
613
 
613
614
  const resolvedComponentPathsWithGitIgnore = this.gitIgnore.filter(resolvedComponentPathsWithoutGitIgnore);
@@ -692,7 +693,7 @@ you can add the directory these files are located at and it'll change the root d
692
693
  const addedComponent = await this.addOrUpdateComponentInBitMap(component);
693
694
  if (addedComponent && addedComponent.files.length) this.addedComponents.push(addedComponent);
694
695
  } catch (err) {
695
- if (!(err instanceof _missingMainFile().default)) throw err;
696
+ if (!(err instanceof _legacy2().MissingMainFile)) throw err;
696
697
  // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
697
698
  missingMainFiles.push(err);
698
699
  }
@@ -766,7 +767,7 @@ function validatePaths(fileArray) {
766
767
  throw new (_exceptions().PathsNotExist)([componentPath]);
767
768
  }
768
769
  componentPathsStats[componentPath] = {
769
- isDir: (0, _utils().isDir)(componentPath)
770
+ isDir: (0, _legacy3().isDir)(componentPath)
770
771
  };
771
772
  });
772
773
  return componentPathsStats;
@@ -804,5 +805,9 @@ function calculateFileInfo(relativePath) {
804
805
  FILE_NAME: fileInfo.name
805
806
  };
806
807
  }
808
+ async function isAutoGeneratedFile(filePath) {
809
+ const line = await (0, _firstline().default)(filePath);
810
+ return line.includes(_constants().AUTO_GENERATED_STAMP);
811
+ }
807
812
 
808
813
  //# sourceMappingURL=add-components.js.map