@teambit/objects 0.0.173 → 0.0.175

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 (50) hide show
  1. package/dist/models/dependencies-graph.d.ts +1 -1
  2. package/dist/models/dependencies-graph.js.map +1 -1
  3. package/dist/models/lane-history.d.ts +1 -1
  4. package/dist/models/lane-history.js.map +1 -1
  5. package/dist/models/lane.d.ts +5 -4
  6. package/dist/models/lane.js.map +1 -1
  7. package/dist/models/model-component.d.ts +9 -7
  8. package/dist/models/model-component.js.map +1 -1
  9. package/dist/models/scopeMeta.d.ts +1 -1
  10. package/dist/models/scopeMeta.js.map +1 -1
  11. package/dist/models/version-history.d.ts +1 -1
  12. package/dist/models/version-history.js.map +1 -1
  13. package/dist/models/version.d.ts +10 -8
  14. package/dist/models/version.js.map +1 -1
  15. package/dist/objects/bit-object-list.d.ts +1 -1
  16. package/dist/objects/bit-object-list.js.map +1 -1
  17. package/dist/objects/object-list-to-graph.d.ts +2 -2
  18. package/dist/objects/object-list-to-graph.js.map +1 -1
  19. package/dist/objects/object.d.ts +2 -2
  20. package/dist/objects/object.js.map +1 -1
  21. package/dist/objects/objects-readable-generator.d.ts +4 -4
  22. package/dist/objects/objects-readable-generator.js.map +1 -1
  23. package/dist/objects/raw-object.d.ts +1 -1
  24. package/dist/objects/raw-object.js.map +1 -1
  25. package/dist/objects/ref.d.ts +2 -2
  26. package/dist/objects/ref.js.map +1 -1
  27. package/dist/objects/repository-hooks.d.ts +1 -1
  28. package/dist/objects/repository-hooks.js.map +1 -1
  29. package/dist/objects/repository.d.ts +10 -7
  30. package/dist/objects/repository.js.map +1 -1
  31. package/dist/objects/scope-index.d.ts +2 -2
  32. package/dist/objects/scope-index.js.map +1 -1
  33. package/models/dependencies-graph.ts +1 -1
  34. package/models/lane-history.ts +1 -1
  35. package/models/lane.ts +4 -3
  36. package/models/model-component.ts +13 -10
  37. package/models/scopeMeta.ts +1 -1
  38. package/models/version-history.ts +1 -1
  39. package/models/version.ts +9 -6
  40. package/objects/bit-object-list.ts +1 -1
  41. package/objects/object-list-to-graph.ts +2 -2
  42. package/objects/object.ts +2 -2
  43. package/objects/objects-readable-generator.ts +6 -6
  44. package/objects/raw-object.ts +1 -1
  45. package/objects/ref.ts +2 -2
  46. package/objects/repository-hooks.ts +1 -1
  47. package/objects/repository.ts +13 -14
  48. package/objects/scope-index.ts +2 -2
  49. package/package.json +30 -30
  50. /package/dist/{preview-1753803956605.js → preview-1753833698619.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Mutex } from 'async-mutex';
2
2
  import { LaneId } from '@teambit/lane-id';
3
- import BitObject from './object';
4
- import Ref from './ref';
3
+ import type BitObject from './object';
4
+ import type Ref from './ref';
5
5
  export interface IndexItem {
6
6
  hash: string;
7
7
  toIdentifierString(): string;
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_asyncMutex","path","_interopRequireWildcard","_laneId","_legacy","_legacy2","_models","_lane","_lodash","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","COMPONENTS_INDEX_FILENAME","ComponentItem","constructor","id","isSymlink","hash","toIdentifierString","scope","name","exports","LaneItem","toLaneId","LaneId","IndexType","ScopeIndex","indexPath","index","components","lanes","writeIndexMutex","_writeIndexMutex","Mutex","load","basePath","_composePath","indexRaw","fs","readJson","getIndexWithBackwardCompatibility","Array","isArray","indexObject","map","c","l","err","message","includes","InvalidIndexJson","create","reset","logger","debug","remove","write","runExclusive","writeJson","spaces","getAll","values","flat","getHashes","indexType","indexItem","getHashesByQuery","filter","getHashesIncludeSymlinks","addMany","bitObjects","added","bitObject","addOne","some","oneAdded","ModelComponent","Symlink","Lane","toString","found","find","isEqual","laneItem","push","_exist","componentItem","removeMany","refs","removed","ref","removeOne","removedOne","entity","keys","difference","deleteFile","getPath","isFileOnBitHub","Boolean","join"],"sources":["scope-index.ts"],"sourcesContent":["/* eslint max-classes-per-file: 0 */\nimport fs from 'fs-extra';\nimport { Mutex } from 'async-mutex';\nimport * as path from 'path';\nimport { LaneId } from '@teambit/lane-id';\nimport { logger } from '@teambit/legacy.logger';\nimport { InvalidIndexJson } from '@teambit/legacy.scope';\nimport { ModelComponent, Symlink } from '../models';\nimport Lane from '../models/lane';\nimport BitObject from './object';\nimport Ref from './ref';\nimport { difference } from 'lodash';\n\nconst COMPONENTS_INDEX_FILENAME = 'index.json';\n\nexport interface IndexItem {\n hash: string;\n toIdentifierString(): string;\n}\n\nexport class ComponentItem implements IndexItem {\n constructor(\n public id: { scope: string | null; name: string },\n public isSymlink: boolean,\n public hash: string\n ) {}\n\n toIdentifierString(): string {\n const scope = this.id.scope ? `${this.id.scope}/` : '';\n return `component \"${scope}${this.id.name}\"`;\n }\n}\n\nexport class LaneItem implements IndexItem {\n constructor(\n public id: { scope: string; name: string },\n public hash: string\n ) {}\n\n toIdentifierString() {\n const scope = this.id.scope ? `${this.id.scope}/` : '';\n return `lane \"${scope}${this.id.name}\"`;\n }\n\n toLaneId(): LaneId {\n return new LaneId({ name: this.id.name, scope: this.id.scope });\n }\n}\n\nexport enum IndexType {\n components = 'components',\n lanes = 'lanes',\n}\n\ntype Index = { [IndexType.components]: ComponentItem[]; [IndexType.lanes]: LaneItem[] };\n\nexport class ScopeIndex {\n indexPath: string;\n index: Index;\n _writeIndexMutex?: Mutex;\n constructor(indexPath: string, index: Index = { [IndexType.components]: [], [IndexType.lanes]: [] }) {\n this.indexPath = indexPath;\n this.index = index;\n }\n get writeIndexMutex() {\n if (!this._writeIndexMutex) {\n this._writeIndexMutex = new Mutex();\n }\n return this._writeIndexMutex;\n }\n static async load(basePath: string): Promise<ScopeIndex> {\n const indexPath = this._composePath(basePath);\n try {\n const indexRaw = await fs.readJson(indexPath);\n const getIndexWithBackwardCompatibility = (): Index => {\n if (Array.isArray(indexRaw)) {\n return { [IndexType.components]: indexRaw, [IndexType.lanes]: [] };\n }\n return indexRaw;\n };\n const indexObject = getIndexWithBackwardCompatibility();\n const index = {\n [IndexType.components]: indexObject[IndexType.components].map(\n (c) => new ComponentItem(c.id, c.isSymlink, c.hash)\n ),\n [IndexType.lanes]: indexObject[IndexType.lanes].map((l) => new LaneItem(l.id, l.hash)),\n };\n return new ScopeIndex(indexPath, index);\n } catch (err: any) {\n if (err.message.includes('Unexpected token')) {\n throw new InvalidIndexJson(indexPath, err.message);\n }\n throw err;\n }\n }\n static create(basePath: string): ScopeIndex {\n const indexPath = this._composePath(basePath);\n return new ScopeIndex(indexPath);\n }\n static async reset(basePath: string) {\n const indexPath = this._composePath(basePath);\n logger.debug(`ComponentsIndex, deleting the index file at ${indexPath}`);\n await fs.remove(indexPath);\n }\n async write() {\n // write only one at a time to avoid corrupting the json file.\n await this.writeIndexMutex.runExclusive(() => fs.writeJson(this.indexPath, this.index, { spaces: 2 }));\n }\n getAll(): IndexItem[] {\n return Object.values(this.index).flat();\n }\n\n getHashes(indexType: IndexType): string[] {\n // @ts-ignore how to tell TS that all this.index.prop are array?\n return this.index[indexType].map((indexItem: IndexItem) => indexItem.hash);\n }\n getHashesByQuery(indexType: IndexType, filter: Function): string[] {\n // @ts-ignore how to tell TS that all this.index.prop are array?\n return this.index[indexType].filter(filter).map((indexItem: IndexItem) => indexItem.hash);\n }\n getHashesIncludeSymlinks(): string[] {\n return this.index.components.map((indexItem) => indexItem.hash);\n }\n addMany(bitObjects: BitObject[]): boolean {\n const added = bitObjects.map((bitObject) => this.addOne(bitObject));\n return added.some((oneAdded) => oneAdded); // return true if one of the objects was added\n }\n addOne(bitObject: BitObject): boolean {\n if (!(bitObject instanceof ModelComponent) && !(bitObject instanceof Symlink) && !(bitObject instanceof Lane))\n return false;\n const hash = bitObject.hash().toString();\n\n if (bitObject instanceof Lane) {\n const found = this.find(hash) as LaneItem | undefined;\n if (found) {\n if ((found as LaneItem).toLaneId().isEqual(bitObject.toLaneId())) return false;\n found.id = bitObject.toLaneId();\n } else {\n const laneItem = new LaneItem(bitObject.toLaneId(), hash);\n this.index.lanes.push(laneItem);\n }\n return true;\n }\n if (bitObject instanceof ModelComponent || bitObject instanceof Symlink) {\n if (this._exist(hash)) return false;\n const componentItem = new ComponentItem(\n { scope: bitObject.scope || null, name: bitObject.name },\n bitObject instanceof Symlink,\n hash\n );\n this.index.components.push(componentItem);\n }\n return true;\n }\n removeMany(refs: Ref[]): boolean {\n const removed = refs.map((ref) => this.removeOne(ref.toString()));\n return removed.some((removedOne) => removedOne); // return true if one of the objects was removed\n }\n removeOne(hash: string): boolean {\n for (const entity of Object.keys(IndexType)) {\n const found = this.index[entity].find((indexItem) => indexItem.hash === hash);\n if (found) {\n this.index[entity] = difference(this.index[entity], [found]);\n return true;\n }\n }\n return false;\n }\n async deleteFile() {\n logger.debug(`ComponentsIndex, deleting the index file at ${this.indexPath}`);\n await fs.remove(this.indexPath);\n }\n getPath() {\n return this.indexPath;\n }\n /**\n * it's obviously not accurate. a local path might include 'bithub' as part of the path as well.\n * however, it's needed only for suppressing the error message when the indexJson is outdate,\n * so if it happens on a local scope it's okay.\n * for other purposes, don't rely on this.\n */\n isFileOnBitHub() {\n return this.indexPath.includes('/bithub/') || this.indexPath.includes('/tmp/scope-fs/');\n }\n find(hash: string): IndexItem | null {\n for (const entity of Object.keys(IndexType)) {\n const found = this.index[entity].find((indexItem) => indexItem.hash === hash);\n if (found) return found;\n }\n return null;\n }\n _exist(hash: string): boolean {\n return Boolean(this.find(hash));\n }\n static _composePath(basePath: string): string {\n return path.join(basePath, COMPONENTS_INDEX_FILENAME);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EA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A,CAACpE,IAAY,EAAW;IAC5B,OAAOkF,OAAO,CAAC,IAAI,CAAClB,IAAI,CAAChE,IAAI,CAAC,CAAC;EACjC;EACA,OAAOmB,YAAYA,CAACD,QAAgB,EAAU;IAC5C,OAAO9D,IAAI,CAAD,CAAC,CAAC+H,IAAI,CAACjE,QAAQ,EAAEvB,yBAAyB,CAAC;EACvD;AACF;AAACS,OAAA,CAAAK,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_asyncMutex","path","_interopRequireWildcard","_laneId","_legacy","_legacy2","_models","_lane","_lodash","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","COMPONENTS_INDEX_FILENAME","ComponentItem","constructor","id","isSymlink","hash","toIdentifierString","scope","name","exports","LaneItem","toLaneId","LaneId","IndexType","ScopeIndex","indexPath","index","components","lanes","writeIndexMutex","_writeIndexMutex","Mutex","load","basePath","_composePath","indexRaw","fs","readJson","getIndexWithBackwardCompatibility","Array","isArray","indexObject","map","c","l","err","message","includes","InvalidIndexJson","create","reset","logger","debug","remove","write","runExclusive","writeJson","spaces","getAll","values","flat","getHashes","indexType","indexItem","getHashesByQuery","filter","getHashesIncludeSymlinks","addMany","bitObjects","added","bitObject","addOne","some","oneAdded","ModelComponent","Symlink","Lane","toString","found","find","isEqual","laneItem","push","_exist","componentItem","removeMany","refs","removed","ref","removeOne","removedOne","entity","keys","difference","deleteFile","getPath","isFileOnBitHub","Boolean","join"],"sources":["scope-index.ts"],"sourcesContent":["/* eslint max-classes-per-file: 0 */\nimport fs from 'fs-extra';\nimport { Mutex } from 'async-mutex';\nimport * as path from 'path';\nimport { LaneId } from '@teambit/lane-id';\nimport { logger } from '@teambit/legacy.logger';\nimport { InvalidIndexJson } from '@teambit/legacy.scope';\nimport { ModelComponent, Symlink } from '../models';\nimport Lane from '../models/lane';\nimport type BitObject from './object';\nimport type Ref from './ref';\nimport { difference } from 'lodash';\n\nconst COMPONENTS_INDEX_FILENAME = 'index.json';\n\nexport interface IndexItem {\n hash: string;\n toIdentifierString(): string;\n}\n\nexport class ComponentItem implements IndexItem {\n constructor(\n public id: { scope: string | null; name: string },\n public isSymlink: boolean,\n public hash: string\n ) {}\n\n toIdentifierString(): string {\n const scope = this.id.scope ? `${this.id.scope}/` : '';\n return `component \"${scope}${this.id.name}\"`;\n }\n}\n\nexport class LaneItem implements IndexItem {\n constructor(\n public id: { scope: string; name: string },\n public hash: string\n ) {}\n\n toIdentifierString() {\n const scope = this.id.scope ? `${this.id.scope}/` : '';\n return `lane \"${scope}${this.id.name}\"`;\n }\n\n toLaneId(): LaneId {\n return new LaneId({ name: this.id.name, scope: this.id.scope });\n }\n}\n\nexport enum IndexType {\n components = 'components',\n lanes = 'lanes',\n}\n\ntype Index = { [IndexType.components]: ComponentItem[]; [IndexType.lanes]: LaneItem[] };\n\nexport class ScopeIndex {\n indexPath: string;\n index: Index;\n _writeIndexMutex?: Mutex;\n constructor(indexPath: string, index: Index = { [IndexType.components]: [], [IndexType.lanes]: [] }) {\n this.indexPath = indexPath;\n this.index = index;\n }\n get writeIndexMutex() {\n if (!this._writeIndexMutex) {\n this._writeIndexMutex = new Mutex();\n }\n return this._writeIndexMutex;\n }\n static async load(basePath: string): Promise<ScopeIndex> {\n const indexPath = this._composePath(basePath);\n try {\n const indexRaw = await fs.readJson(indexPath);\n const getIndexWithBackwardCompatibility = (): Index => {\n if (Array.isArray(indexRaw)) {\n return { [IndexType.components]: indexRaw, [IndexType.lanes]: [] };\n }\n return indexRaw;\n };\n const indexObject = getIndexWithBackwardCompatibility();\n const index = {\n [IndexType.components]: indexObject[IndexType.components].map(\n (c) => new ComponentItem(c.id, c.isSymlink, c.hash)\n ),\n [IndexType.lanes]: indexObject[IndexType.lanes].map((l) => new LaneItem(l.id, l.hash)),\n };\n return new ScopeIndex(indexPath, index);\n } catch (err: any) {\n if (err.message.includes('Unexpected token')) {\n throw new InvalidIndexJson(indexPath, err.message);\n }\n throw err;\n }\n }\n static create(basePath: string): ScopeIndex {\n const indexPath = this._composePath(basePath);\n return new ScopeIndex(indexPath);\n }\n static async reset(basePath: string) {\n const indexPath = this._composePath(basePath);\n logger.debug(`ComponentsIndex, deleting the index file at ${indexPath}`);\n await fs.remove(indexPath);\n }\n async write() {\n // write only one at a time to avoid corrupting the json file.\n await this.writeIndexMutex.runExclusive(() => fs.writeJson(this.indexPath, this.index, { spaces: 2 }));\n }\n getAll(): IndexItem[] {\n return Object.values(this.index).flat();\n }\n\n getHashes(indexType: IndexType): string[] {\n // @ts-ignore how to tell TS that all this.index.prop are array?\n return this.index[indexType].map((indexItem: IndexItem) => indexItem.hash);\n }\n getHashesByQuery(indexType: IndexType, filter: Function): string[] {\n // @ts-ignore how to tell TS that all this.index.prop are array?\n return this.index[indexType].filter(filter).map((indexItem: IndexItem) => indexItem.hash);\n }\n getHashesIncludeSymlinks(): string[] {\n return this.index.components.map((indexItem) => indexItem.hash);\n }\n addMany(bitObjects: BitObject[]): boolean {\n const added = bitObjects.map((bitObject) => this.addOne(bitObject));\n return added.some((oneAdded) => oneAdded); // return true if one of the objects was added\n }\n addOne(bitObject: BitObject): boolean {\n if (!(bitObject instanceof ModelComponent) && !(bitObject instanceof Symlink) && !(bitObject instanceof Lane))\n return false;\n const hash = bitObject.hash().toString();\n\n if (bitObject instanceof Lane) {\n const found = this.find(hash) as LaneItem | undefined;\n if (found) {\n if ((found as LaneItem).toLaneId().isEqual(bitObject.toLaneId())) return false;\n found.id = bitObject.toLaneId();\n } else {\n const laneItem = new LaneItem(bitObject.toLaneId(), hash);\n this.index.lanes.push(laneItem);\n }\n return true;\n }\n if (bitObject instanceof ModelComponent || bitObject instanceof Symlink) {\n if (this._exist(hash)) return false;\n const componentItem = new ComponentItem(\n { scope: bitObject.scope || null, name: bitObject.name },\n bitObject instanceof Symlink,\n hash\n );\n this.index.components.push(componentItem);\n }\n return true;\n }\n removeMany(refs: Ref[]): boolean {\n const removed = refs.map((ref) => this.removeOne(ref.toString()));\n return removed.some((removedOne) => removedOne); // return true if one of the objects was removed\n }\n removeOne(hash: string): boolean {\n for (const entity of Object.keys(IndexType)) {\n const found = this.index[entity].find((indexItem) => indexItem.hash === hash);\n if (found) {\n this.index[entity] = difference(this.index[entity], [found]);\n return true;\n }\n }\n return false;\n }\n async deleteFile() {\n logger.debug(`ComponentsIndex, deleting the index file at ${this.indexPath}`);\n await fs.remove(this.indexPath);\n }\n getPath() {\n return this.indexPath;\n }\n /**\n * it's obviously not accurate. a local path might include 'bithub' as part of the path as well.\n * however, it's needed only for suppressing the error message when the indexJson is outdate,\n * so if it happens on a local scope it's okay.\n * for other purposes, don't rely on this.\n */\n isFileOnBitHub() {\n return this.indexPath.includes('/bithub/') || this.indexPath.includes('/tmp/scope-fs/');\n }\n find(hash: string): IndexItem | null {\n for (const entity of Object.keys(IndexType)) {\n const found = this.index[entity].find((indexItem) => indexItem.hash === hash);\n if (found) return found;\n }\n return null;\n }\n _exist(hash: string): boolean {\n return Boolean(this.find(hash));\n }\n static _composePath(basePath: string): string {\n return path.join(basePath, COMPONENTS_INDEX_FILENAME);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAK,uBAAA,CAAAH,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA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AA,CAAAK,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import semver from 'semver';
2
- import { LockfilePackageInfo } from '@pnpm/lockfile.types';
2
+ import type { LockfilePackageInfo } from '@pnpm/lockfile.types';
3
3
  import * as dp from '@pnpm/dependency-path';
4
4
 
5
5
  export type PackagesMap = Map<string, PackageAttributes>;
@@ -2,7 +2,7 @@ import { v4 } from 'uuid';
2
2
  import { getStringifyArgs } from '@teambit/legacy.utils';
3
3
  import { getBasicLog } from '@teambit/harmony.modules.get-basic-log';
4
4
  import { BitObject } from '../objects';
5
- import Lane from './lane';
5
+ import type Lane from './lane';
6
6
 
7
7
  type Log = { date: string; username?: string; email?: string; message?: string };
8
8
 
package/models/lane.ts CHANGED
@@ -5,15 +5,16 @@ import { BitError } from '@teambit/bit-error';
5
5
  import { ComponentID, ComponentIdList } from '@teambit/component-id';
6
6
  import { isSnap } from '@teambit/component-version';
7
7
  import { LaneId, DEFAULT_LANE, LANE_REMOTE_DELIMITER } from '@teambit/lane-id';
8
- import { Scope } from '@teambit/legacy.scope';
8
+ import type { Scope } from '@teambit/legacy.scope';
9
9
  import { CFG_USER_EMAIL_KEY, CFG_USER_NAME_KEY, PREVIOUS_DEFAULT_LANE } from '@teambit/legacy.constants';
10
10
  import { ValidationError } from '@teambit/legacy.cli.error';
11
11
  import { logger } from '@teambit/legacy.logger';
12
12
  import { getStringifyArgs } from '@teambit/legacy.utils';
13
13
  import { sha1 } from '@teambit/toolbox.crypto.sha1';
14
14
  import { hasVersionByRef } from '@teambit/component.snap-distance';
15
- import { BitObject, Ref, Repository } from '../objects';
16
- import Version from './version';
15
+ import type { Repository } from '../objects';
16
+ import { BitObject, Ref } from '../objects';
17
+ import type Version from './version';
17
18
  import { getConfig } from '@teambit/config-store';
18
19
 
19
20
  export type Log = { date: string; username?: string; email?: string; profileImage?: string };
@@ -6,19 +6,20 @@ import { BitError } from '@teambit/bit-error';
6
6
  import { LaneId, DEFAULT_LANE } from '@teambit/lane-id';
7
7
  import { ComponentID, ComponentIdList } from '@teambit/component-id';
8
8
  import pMapSeries from 'p-map-series';
9
- import { LegacyComponentLog } from '@teambit/legacy-component-log';
9
+ import type { LegacyComponentLog } from '@teambit/legacy-component-log';
10
10
  import { findDuplications } from '@teambit/toolbox.array.duplications-finder';
11
11
  import { BitId } from '@teambit/legacy-bit-id';
12
12
  import { DEFAULT_BIT_RELEASE_TYPE, DEFAULT_BIT_VERSION, DEFAULT_LANGUAGE, Extensions } from '@teambit/legacy.constants';
13
- import { ConsumerComponent, SchemaName, Dependencies, Dependency } from '@teambit/legacy.consumer-component';
13
+ import type { Dependencies, Dependency } from '@teambit/legacy.consumer-component';
14
+ import { ConsumerComponent, SchemaName } from '@teambit/legacy.consumer-component';
14
15
  import { License, SourceFile, getRefsFromExtensions } from '@teambit/component.sources';
15
16
  import { ComponentOverrides, getBindingPrefixByDefaultScope } from '@teambit/legacy.consumer-config';
16
17
  import { ValidationError } from '@teambit/legacy.cli.error';
17
18
  import { logger } from '@teambit/legacy.logger';
18
19
  import { getStringifyArgs } from '@teambit/legacy.utils';
19
20
  import { getLatestVersion, validateVersion } from '@teambit/pkg.modules.semver-helper';
21
+ import type { SnapsDistance } from '@teambit/component.snap-distance';
20
22
  import {
21
- SnapsDistance,
22
23
  getDivergeData,
23
24
  getAllVersionParents,
24
25
  getAllVersionsInfo,
@@ -36,15 +37,17 @@ import {
36
37
  errorIsTypeOfMissingObject,
37
38
  BitIdCompIdError,
38
39
  } from '@teambit/legacy.scope';
39
- import { Repository, BitObject, Ref } from '../objects';
40
- import Lane from './lane';
40
+ import type { Repository } from '../objects';
41
+ import { BitObject, Ref } from '../objects';
42
+ import type Lane from './lane';
41
43
  import ScopeMeta from './scopeMeta';
42
- import Source from './source';
43
- import Version from './version';
44
- import VersionHistory, { VersionParents } from './version-history';
45
- import { ObjectItem } from '../objects/object-list';
44
+ import type Source from './source';
45
+ import type Version from './version';
46
+ import type { VersionParents } from './version-history';
47
+ import VersionHistory from './version-history';
48
+ import type { ObjectItem } from '../objects/object-list';
46
49
  import type { Scope } from '@teambit/legacy.scope';
47
- import { ExtensionDataList } from '@teambit/legacy.extension-data';
50
+ import type { ExtensionDataList } from '@teambit/legacy.extension-data';
48
51
  import { DetachedHeads } from './detach-heads';
49
52
 
50
53
  type State = {
@@ -1,6 +1,6 @@
1
1
  import { getStringifyArgs } from '@teambit/legacy.utils';
2
2
  import { BitObject } from '../objects';
3
- import Ref from '../objects/ref';
3
+ import type Ref from '../objects/ref';
4
4
 
5
5
  type ScopeMetaProps = {
6
6
  name: string;
@@ -7,7 +7,7 @@ import Ref from '../objects/ref';
7
7
  import { BitObject } from '../objects';
8
8
  import type Version from './version';
9
9
  import { getVersionParentsFromVersion } from '@teambit/component.snap-distance';
10
- import ModelComponent from './model-component';
10
+ import type ModelComponent from './model-component';
11
11
 
12
12
  export type VersionParents = {
13
13
  hash: Ref;
package/models/version.ts CHANGED
@@ -3,24 +3,27 @@ import { isSnap } from '@teambit/component-version';
3
3
  import { ComponentID, ComponentIdList } from '@teambit/component-id';
4
4
  import { LaneId } from '@teambit/lane-id';
5
5
  import { v4 } from 'uuid';
6
- import { BuildStatus, DEFAULT_BUNDLE_FILENAME, Extensions } from '@teambit/legacy.constants';
6
+ import type { BuildStatus } from '@teambit/legacy.constants';
7
+ import { DEFAULT_BUNDLE_FILENAME, Extensions } from '@teambit/legacy.constants';
8
+ import type { ConsumerComponent } from '@teambit/legacy.consumer-component';
7
9
  import {
8
10
  isSchemaSupport,
9
11
  SchemaFeature,
10
12
  SchemaName,
11
13
  Dependencies,
12
14
  Dependency,
13
- ConsumerComponent,
14
15
  } from '@teambit/legacy.consumer-component';
15
16
  import { getRefsFromExtensions, SourceFile } from '@teambit/component.sources';
16
- import { ComponentOverridesData } from '@teambit/legacy.consumer-config';
17
+ import type { ComponentOverridesData } from '@teambit/legacy.consumer-config';
17
18
  import { ExtensionDataEntry, ExtensionDataList } from '@teambit/legacy.extension-data';
18
19
  import type { Doclet } from '@teambit/semantics.doc-parser';
19
20
  import { logger } from '@teambit/legacy.logger';
20
- import { getStringifyArgs, PathLinux, pathNormalizeToLinux } from '@teambit/legacy.utils';
21
+ import type { PathLinux } from '@teambit/legacy.utils';
22
+ import { getStringifyArgs, pathNormalizeToLinux } from '@teambit/legacy.utils';
21
23
  import { sha1 } from '@teambit/toolbox.crypto.sha1';
22
- import { BitObject, Ref, Repository } from '../objects';
23
- import { ObjectItem } from '../objects/object-list';
24
+ import type { Repository } from '../objects';
25
+ import { BitObject, Ref } from '../objects';
26
+ import type { ObjectItem } from '../objects/object-list';
24
27
  import { BitIdCompIdError, VersionInvalid, validateVersionInstance } from '@teambit/legacy.scope';
25
28
  import Source from './source';
26
29
  import { DependenciesGraph } from './dependencies-graph';
@@ -1,4 +1,4 @@
1
- import BitObject from './object';
1
+ import type BitObject from './object';
2
2
  import { ExportMetadata, Lane, LaneHistory, ModelComponent, Version, VersionHistory } from '../models';
3
3
 
4
4
  export class BitObjectList {
@@ -1,8 +1,8 @@
1
1
  import { Graph, Node, Edge } from '@teambit/graph.cleargraph';
2
2
  import { uniqBy } from 'lodash';
3
- import { ComponentID } from '@teambit/component-id';
3
+ import type { ComponentID } from '@teambit/component-id';
4
4
  import type { ObjectList } from './object-list';
5
- import { BitObjectList } from './bit-object-list';
5
+ import type { BitObjectList } from './bit-object-list';
6
6
  import { getAllVersionsInfo } from '@teambit/component.snap-distance';
7
7
  import { Dependency } from '@teambit/graph';
8
8
 
package/objects/object.ts CHANGED
@@ -4,9 +4,9 @@ import { NULL_BYTE, SPACE_DELIMITER } from '@teambit/legacy.constants';
4
4
  import { deflate, inflate } from '@teambit/legacy.utils';
5
5
  import { sha1 } from '@teambit/toolbox.crypto.sha1';
6
6
  import { UnknownObjectType, typesObj as types } from '@teambit/legacy.scope';
7
- import { ObjectItem } from './object-list';
7
+ import type { ObjectItem } from './object-list';
8
8
  import Ref from './ref';
9
- import Repository from './repository';
9
+ import type Repository from './repository';
10
10
 
11
11
  function parse(buffer: Buffer): BitObject {
12
12
  const { type, hash, contents } = extractHeaderAndContent(buffer);
@@ -1,14 +1,14 @@
1
1
  import pMapSeries from 'p-map-series';
2
2
  import { BitError } from '@teambit/bit-error';
3
3
  import { Readable } from 'stream';
4
- import BitObject from './object';
5
- import Repository from './repository';
6
- import Ref from './ref';
7
- import { Scope } from '@teambit/legacy.scope';
4
+ import type BitObject from './object';
5
+ import type Repository from './repository';
6
+ import type Ref from './ref';
7
+ import type { Scope } from '@teambit/legacy.scope';
8
8
  import { logger } from '@teambit/legacy.logger';
9
9
  import { getAllVersionHashesMemoized } from '@teambit/component.snap-distance';
10
- import { Lane, LaneHistory, ModelComponent, Version } from '../models';
11
- import { ObjectItem } from './object-list';
10
+ import type { Lane, LaneHistory, ModelComponent, Version } from '../models';
11
+ import type { ObjectItem } from './object-list';
12
12
 
13
13
  export type ComponentWithCollectOptions = {
14
14
  component: ModelComponent;
@@ -1,7 +1,7 @@
1
1
  import { NULL_BYTE, SPACE_DELIMITER } from '@teambit/legacy.constants';
2
2
  import { getStringifyArgs, inflate } from '@teambit/legacy.utils';
3
3
  import { typesObj as types } from '@teambit/legacy.scope';
4
- import BitObject from './object';
4
+ import type BitObject from './object';
5
5
  import { clone } from 'lodash';
6
6
 
7
7
  export default class BitRawObject {
package/objects/ref.ts CHANGED
@@ -1,5 +1,5 @@
1
- import BitObject from './object';
2
- import Repository from './repository';
1
+ import type BitObject from './object';
2
+ import type Repository from './repository';
3
3
 
4
4
  export default class Ref {
5
5
  hash: string;
@@ -1,7 +1,7 @@
1
1
  import isRelative from 'is-relative-path';
2
2
  import path from 'path';
3
3
 
4
- import { ScopeJson } from '@teambit/legacy.scope';
4
+ import type { ScopeJson } from '@teambit/legacy.scope';
5
5
 
6
6
  export type ContentTransformer = (content: Buffer) => Buffer;
7
7
 
@@ -3,30 +3,29 @@ import uidNumber from 'uid-number';
3
3
  import { Mutex } from 'async-mutex';
4
4
  import { compact, uniqBy, differenceWith, isEqual } from 'lodash';
5
5
  import { BitError } from '@teambit/bit-error';
6
- import { ComponentID } from '@teambit/component-id';
6
+ import type { ComponentID } from '@teambit/component-id';
7
7
  import { HASH_SIZE, isSnap } from '@teambit/component-version';
8
8
  import * as path from 'path';
9
9
  import { pMapPool } from '@teambit/toolbox.promise.map-pool';
10
10
  import { OBJECTS_DIR } from '@teambit/legacy.constants';
11
11
  import { logger } from '@teambit/legacy.logger';
12
- import { glob, writeFile, ChownOptions, PathOsBasedAbsolute } from '@teambit/legacy.utils';
12
+ import type { ChownOptions, PathOsBasedAbsolute } from '@teambit/legacy.utils';
13
+ import { glob, writeFile } from '@teambit/legacy.utils';
13
14
  import { removeEmptyDir } from '@teambit/toolbox.fs.remove-empty-dir';
14
15
  import { concurrentIOLimit } from '@teambit/harmony.modules.concurrency';
15
- import {
16
- Types,
17
- HashNotFound,
18
- OutdatedIndexJson,
19
- ScopeJson,
20
- UnmergedComponents,
21
- RemoteLanes,
22
- } from '@teambit/legacy.scope';
23
- import { ScopeIndex, IndexType, IndexItem } from './scope-index';
16
+ import type { Types, ScopeJson } from '@teambit/legacy.scope';
17
+ import { HashNotFound, OutdatedIndexJson, UnmergedComponents, RemoteLanes } from '@teambit/legacy.scope';
18
+ import type { IndexType, IndexItem } from './scope-index';
19
+ import { ScopeIndex } from './scope-index';
24
20
  import BitObject from './object';
25
- import { ObjectItem, ObjectList } from './object-list';
21
+ import type { ObjectItem } from './object-list';
22
+ import { ObjectList } from './object-list';
26
23
  import BitRawObject from './raw-object';
27
24
  import Ref from './ref';
28
- import { ContentTransformer, onPersist, onRead } from './repository-hooks';
29
- import { getMaxSizeForObjects, InMemoryCache, createInMemoryCache } from '@teambit/harmony.modules.in-memory-cache';
25
+ import type { ContentTransformer } from './repository-hooks';
26
+ import { onPersist, onRead } from './repository-hooks';
27
+ import type { InMemoryCache } from '@teambit/harmony.modules.in-memory-cache';
28
+ import { getMaxSizeForObjects, createInMemoryCache } from '@teambit/harmony.modules.in-memory-cache';
30
29
  import { ScopeMeta, Lane, ModelComponent } from '../models';
31
30
 
32
31
  const OBJECTS_BACKUP_DIR = `${OBJECTS_DIR}.bak`;
@@ -7,8 +7,8 @@ import { logger } from '@teambit/legacy.logger';
7
7
  import { InvalidIndexJson } from '@teambit/legacy.scope';
8
8
  import { ModelComponent, Symlink } from '../models';
9
9
  import Lane from '../models/lane';
10
- import BitObject from './object';
11
- import Ref from './ref';
10
+ import type BitObject from './object';
11
+ import type Ref from './ref';
12
12
  import { difference } from 'lodash';
13
13
 
14
14
  const COMPONENTS_INDEX_FILENAME = 'index.json';
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
1
  {
2
2
  "name": "@teambit/objects",
3
- "version": "0.0.173",
3
+ "version": "0.0.175",
4
4
  "homepage": "https://bit.cloud/teambit/scope/objects",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.scope",
8
8
  "name": "objects",
9
- "version": "0.0.173"
9
+ "version": "0.0.175"
10
10
  },
11
11
  "dependencies": {
12
- "@pnpm/dependency-path": "1001.0.2",
13
- "@pnpm/lockfile.types": "^1001.1.0",
14
- "semver": "7.7.1",
15
12
  "lodash": "4.17.21",
16
- "uuid": "8.3.2",
17
- "async-mutex": "0.3.1",
18
- "p-map-series": "2.1.0",
19
13
  "tar-stream": "2.2.0",
14
+ "p-map-series": "2.1.0",
20
15
  "is-relative-path": "2.0.0",
16
+ "async-mutex": "0.3.1",
21
17
  "fs-extra": "10.0.0",
22
18
  "uid-number": "0.0.6",
19
+ "@pnpm/dependency-path": "1001.0.2",
20
+ "@pnpm/lockfile.types": "^1001.1.0",
21
+ "semver": "7.7.1",
22
+ "uuid": "8.3.2",
23
23
  "@teambit/harmony": "0.4.7",
24
24
  "@teambit/component-id": "1.2.4",
25
+ "@teambit/graph.cleargraph": "0.0.11",
26
+ "@teambit/harmony.modules.concurrency": "0.0.14",
27
+ "@teambit/legacy.logger": "0.0.22",
28
+ "@teambit/toolbox.promise.map-pool": "0.0.6",
29
+ "@teambit/legacy.constants": "0.0.13",
25
30
  "@teambit/legacy.utils": "0.0.22",
26
- "@teambit/harmony.modules.get-basic-log": "0.0.58",
31
+ "@teambit/toolbox.crypto.sha1": "0.0.7",
27
32
  "@teambit/bit-error": "0.0.404",
28
33
  "@teambit/component-version": "1.0.4",
29
- "@teambit/component.snap-distance": "0.0.58",
34
+ "@teambit/toolbox.fs.remove-empty-dir": "0.0.5",
30
35
  "@teambit/lane-id": "0.0.312",
31
36
  "@teambit/legacy.cli.error": "0.0.22",
32
- "@teambit/legacy.constants": "0.0.13",
33
- "@teambit/legacy.logger": "0.0.22",
34
- "@teambit/legacy.scope": "0.0.57",
35
- "@teambit/toolbox.crypto.sha1": "0.0.7",
36
- "@teambit/component.sources": "0.0.109",
37
37
  "@teambit/legacy-bit-id": "1.1.3",
38
38
  "@teambit/legacy-component-log": "0.0.408",
39
- "@teambit/legacy.consumer-component": "0.0.58",
40
- "@teambit/legacy.consumer-config": "0.0.57",
41
- "@teambit/legacy.extension-data": "0.0.59",
42
- "@teambit/pkg.modules.semver-helper": "0.0.12",
43
39
  "@teambit/toolbox.array.duplications-finder": "0.0.3",
44
- "@teambit/graph.cleargraph": "0.0.11",
45
40
  "@teambit/bit.get-bit-version": "0.0.6",
46
- "@teambit/semantics.doc-parser": "0.0.65",
47
- "@teambit/harmony.modules.concurrency": "0.0.14",
48
- "@teambit/toolbox.promise.map-pool": "0.0.6",
49
- "@teambit/harmony.modules.in-memory-cache": "0.0.15",
50
- "@teambit/toolbox.fs.remove-empty-dir": "0.0.5",
51
- "@teambit/cli": "0.0.1243",
52
- "@teambit/config-store": "0.0.123",
53
- "@teambit/graph": "1.0.666"
41
+ "@teambit/cli": "0.0.1245",
42
+ "@teambit/component.snap-distance": "0.0.59",
43
+ "@teambit/graph": "1.0.668",
44
+ "@teambit/legacy.scope": "0.0.58",
45
+ "@teambit/harmony.modules.in-memory-cache": "0.0.16",
46
+ "@teambit/harmony.modules.get-basic-log": "0.0.59",
47
+ "@teambit/config-store": "0.0.125",
48
+ "@teambit/component.sources": "0.0.110",
49
+ "@teambit/legacy.consumer-component": "0.0.59",
50
+ "@teambit/legacy.consumer-config": "0.0.58",
51
+ "@teambit/legacy.extension-data": "0.0.60",
52
+ "@teambit/pkg.modules.semver-helper": "0.0.13",
53
+ "@teambit/semantics.doc-parser": "0.0.66"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/semver": "7.5.8",
57
56
  "@types/lodash": "4.14.165",
58
- "@types/uuid": "8.3.4",
59
57
  "@types/fs-extra": "9.0.7",
58
+ "@types/semver": "7.5.8",
59
+ "@types/uuid": "8.3.4",
60
60
  "@teambit/harmony.envs.core-aspect-env": "0.0.72"
61
61
  },
62
62
  "peerDependencies": {