@teambit/objects 0.0.0-fa67beef549c3d61c669c563519ad82f2716253c → 0.0.0-fd2249ffcd55620756a03ddbb0200c1fc6109411
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.
- package/dist/models/dependencies-graph.d.ts +1 -1
- package/dist/models/dependencies-graph.js.map +1 -1
- package/dist/models/export-metadata.js +0 -2
- package/dist/models/export-metadata.js.map +1 -1
- package/dist/models/lane-history.d.ts +1 -1
- package/dist/models/lane-history.js.map +1 -1
- package/dist/models/lane.d.ts +4 -3
- package/dist/models/lane.js.map +1 -1
- package/dist/models/model-component.d.ts +10 -8
- package/dist/models/model-component.js +0 -3
- package/dist/models/model-component.js.map +1 -1
- package/dist/models/scopeMeta.d.ts +1 -1
- package/dist/models/scopeMeta.js +0 -3
- package/dist/models/scopeMeta.js.map +1 -1
- package/dist/models/source.d.ts +2 -2
- package/dist/models/source.js +0 -1
- package/dist/models/source.js.map +1 -1
- package/dist/models/symlink.d.ts +1 -1
- package/dist/models/version-history.d.ts +1 -1
- package/dist/models/version-history.js.map +1 -1
- package/dist/models/version.d.ts +11 -9
- package/dist/models/version.js +0 -3
- package/dist/models/version.js.map +1 -1
- package/dist/objects/bit-object-list.d.ts +1 -1
- package/dist/objects/bit-object-list.js.map +1 -1
- package/dist/objects/object-list-to-graph.d.ts +2 -2
- package/dist/objects/object-list-to-graph.js.map +1 -1
- package/dist/objects/object.d.ts +2 -2
- package/dist/objects/object.js +0 -1
- package/dist/objects/object.js.map +1 -1
- package/dist/objects/objects-readable-generator.d.ts +4 -4
- package/dist/objects/objects-readable-generator.js.map +1 -1
- package/dist/objects/raw-object.d.ts +2 -2
- package/dist/objects/raw-object.js +1 -11
- package/dist/objects/raw-object.js.map +1 -1
- package/dist/objects/ref.d.ts +2 -2
- package/dist/objects/ref.js.map +1 -1
- package/dist/objects/repository.d.ts +23 -7
- package/dist/objects/repository.js +14 -10
- package/dist/objects/repository.js.map +1 -1
- package/dist/objects/scope-index.d.ts +2 -2
- package/dist/objects/scope-index.js +0 -1
- package/dist/objects/scope-index.js.map +1 -1
- package/models/dependencies-graph.ts +1 -1
- package/models/export-metadata.ts +0 -1
- package/models/lane-history.ts +1 -1
- package/models/lane.ts +4 -3
- package/models/model-component.ts +13 -14
- package/models/scopeMeta.ts +1 -3
- package/models/source.ts +0 -1
- package/models/version-history.ts +1 -1
- package/models/version.ts +9 -12
- package/objects/bit-object-list.ts +1 -1
- package/objects/object-list-to-graph.ts +2 -2
- package/objects/object.ts +2 -3
- package/objects/objects-readable-generator.ts +6 -6
- package/objects/raw-object.ts +2 -12
- package/objects/ref.ts +2 -2
- package/objects/repository.ts +28 -17
- package/objects/scope-index.ts +2 -3
- package/package.json +35 -36
- package/dist/objects/repository-hooks.d.ts +0 -4
- package/dist/objects/repository-hooks.js +0 -56
- package/dist/objects/repository-hooks.js.map +0 -1
- package/objects/repository-hooks.ts +0 -42
- /package/dist/{preview-1753295114389.js → preview-1756143197831.js} +0 -0
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
|
|
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 {
|
|
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 {
|
|
23
|
-
import {
|
|
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';
|
|
@@ -67,11 +70,8 @@ export type VersionProps = {
|
|
|
67
70
|
flattenedEdges?: DepEdge[];
|
|
68
71
|
flattenedEdgesRef?: Ref;
|
|
69
72
|
dependenciesGraphRef?: Ref;
|
|
70
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
71
73
|
packageDependencies?: { [key: string]: string };
|
|
72
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
73
74
|
devPackageDependencies?: { [key: string]: string };
|
|
74
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
75
75
|
peerPackageDependencies?: { [key: string]: string };
|
|
76
76
|
bindingPrefix: string;
|
|
77
77
|
schema?: string;
|
|
@@ -120,7 +120,6 @@ export default class Version extends BitObject {
|
|
|
120
120
|
* (around August 2023 should be safe)
|
|
121
121
|
*/
|
|
122
122
|
private flattenedEdges: DepEdge[];
|
|
123
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
124
123
|
packageDependencies: { [key: string]: string };
|
|
125
124
|
devPackageDependencies: { [key: string]: string };
|
|
126
125
|
peerPackageDependencies: { [key: string]: string };
|
|
@@ -697,7 +696,6 @@ export default class Version extends BitObject {
|
|
|
697
696
|
files: files.map(parseFile),
|
|
698
697
|
bindingPrefix: component.bindingPrefix,
|
|
699
698
|
log: component.log as Log,
|
|
700
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
701
699
|
docs: component.docs,
|
|
702
700
|
dependencies: component.dependencies.get(),
|
|
703
701
|
devDependencies: component.devDependencies.get(),
|
|
@@ -711,7 +709,6 @@ export default class Version extends BitObject {
|
|
|
711
709
|
flattenedEdgesRef: flattenedEdges?.hash(),
|
|
712
710
|
schema: component.schema,
|
|
713
711
|
overrides: component.overrides.componentOverridesData,
|
|
714
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
715
712
|
packageJsonChangedProps: component.packageJsonChangedProps,
|
|
716
713
|
extensions: component.extensions,
|
|
717
714
|
buildStatus: component.buildStatus,
|
|
@@ -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);
|
|
@@ -147,7 +147,6 @@ path: ${err.path}`);
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
static makeHash(str: string | Buffer): string {
|
|
150
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
151
150
|
return sha1(str);
|
|
152
151
|
}
|
|
153
152
|
}
|
|
@@ -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;
|
package/objects/raw-object.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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 {
|
|
8
8
|
headers: string[];
|
|
9
9
|
type: string;
|
|
10
10
|
content: Buffer;
|
|
11
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
12
11
|
parsedContent: any;
|
|
13
12
|
_ref: string;
|
|
14
13
|
|
|
@@ -17,7 +16,6 @@ export default class BitRawObject {
|
|
|
17
16
|
ref: string | null | undefined,
|
|
18
17
|
type: string | null | undefined,
|
|
19
18
|
content: Buffer | null | undefined,
|
|
20
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
21
19
|
parsedContent: any | null | undefined
|
|
22
20
|
) {
|
|
23
21
|
let headers;
|
|
@@ -72,17 +70,14 @@ export default class BitRawObject {
|
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
76
73
|
set ref(ref: string) {
|
|
77
74
|
this._ref = ref;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
81
77
|
get ref(): string {
|
|
82
78
|
return this._ref;
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
86
81
|
get id(): string {
|
|
87
82
|
switch (this.type) {
|
|
88
83
|
case 'Version':
|
|
@@ -114,11 +109,7 @@ export default class BitRawObject {
|
|
|
114
109
|
return [];
|
|
115
110
|
}
|
|
116
111
|
|
|
117
|
-
static async fromDeflatedBuffer(
|
|
118
|
-
fileContents: Buffer,
|
|
119
|
-
ref: string | null | undefined
|
|
120
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
121
|
-
): Promise<BitObject> {
|
|
112
|
+
static async fromDeflatedBuffer(fileContents: Buffer, ref: string | null | undefined): Promise<BitObject> {
|
|
122
113
|
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
123
114
|
return inflate(fileContents).then((buffer) => new BitRawObject(buffer, ref));
|
|
124
115
|
}
|
|
@@ -129,7 +120,6 @@ export default class BitRawObject {
|
|
|
129
120
|
* @param {Any} parsedContent
|
|
130
121
|
*/
|
|
131
122
|
toRealObject() {
|
|
132
|
-
// @ts-ignore
|
|
133
123
|
return types[this.type].from(this.parsedContent || this.getParsedContent(), this.headers[1]);
|
|
134
124
|
}
|
|
135
125
|
|
package/objects/ref.ts
CHANGED
package/objects/repository.ts
CHANGED
|
@@ -3,37 +3,34 @@ 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 {
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
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 {
|
|
29
|
-
import { getMaxSizeForObjects,
|
|
25
|
+
import type { InMemoryCache } from '@teambit/harmony.modules.in-memory-cache';
|
|
26
|
+
import { getMaxSizeForObjects, createInMemoryCache } from '@teambit/harmony.modules.in-memory-cache';
|
|
30
27
|
import { ScopeMeta, Lane, ModelComponent } from '../models';
|
|
31
28
|
|
|
29
|
+
type ContentTransformer = (content: Buffer) => Buffer;
|
|
32
30
|
const OBJECTS_BACKUP_DIR = `${OBJECTS_DIR}.bak`;
|
|
33
31
|
const TRASH_DIR = 'trash';
|
|
34
32
|
|
|
35
33
|
export default class Repository {
|
|
36
|
-
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
|
|
37
34
|
objects: { [key: string]: BitObject } = {};
|
|
38
35
|
objectsToRemove: Ref[] = [];
|
|
39
36
|
scopeJson: ScopeJson;
|
|
@@ -48,8 +45,8 @@ export default class Repository {
|
|
|
48
45
|
constructor(scopePath: string, scopeJson: ScopeJson) {
|
|
49
46
|
this.scopePath = scopePath;
|
|
50
47
|
this.scopeJson = scopeJson;
|
|
51
|
-
this.onRead =
|
|
52
|
-
this.onPersist =
|
|
48
|
+
this.onRead = (content: Buffer) => Repository.onPostObjectRead?.(content) || content;
|
|
49
|
+
this.onPersist = (content: Buffer) => Repository.onPreObjectPersist?.(content) || content;
|
|
53
50
|
this.cache = createInMemoryCache({ maxSize: getMaxSizeForObjects() });
|
|
54
51
|
}
|
|
55
52
|
|
|
@@ -92,6 +89,20 @@ export default class Repository {
|
|
|
92
89
|
|
|
93
90
|
static onPostObjectsPersist: () => Promise<void>;
|
|
94
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Hook for transforming content before objects are persisted to the filesystem.
|
|
94
|
+
* Note: This function cannot be async because it's used by the synchronous `loadSync` method
|
|
95
|
+
* which needs to maintain sync behavior for compatibility with existing code.
|
|
96
|
+
*/
|
|
97
|
+
static onPreObjectPersist: (content: Buffer) => Buffer;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Hook for transforming content after objects are read from the filesystem.
|
|
101
|
+
* Note: This function cannot be async because it's used by the synchronous `loadSync` method
|
|
102
|
+
* which needs to maintain sync behavior for compatibility with existing code.
|
|
103
|
+
*/
|
|
104
|
+
static onPostObjectRead: (content: Buffer) => Buffer;
|
|
105
|
+
|
|
95
106
|
async reLoadScopeIndex() {
|
|
96
107
|
this.scopeIndex = await this.loadOptionallyCreateScopeIndex();
|
|
97
108
|
}
|
package/objects/scope-index.ts
CHANGED
|
@@ -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';
|
|
@@ -111,7 +111,6 @@ export class ScopeIndex {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
getHashes(indexType: IndexType): string[] {
|
|
114
|
-
// @ts-ignore how to tell TS that all this.index.prop are array?
|
|
115
114
|
return this.index[indexType].map((indexItem: IndexItem) => indexItem.hash);
|
|
116
115
|
}
|
|
117
116
|
getHashesByQuery(indexType: IndexType, filter: Function): string[] {
|
package/package.json
CHANGED
|
@@ -1,63 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/objects",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-fd2249ffcd55620756a03ddbb0200c1fc6109411",
|
|
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": "
|
|
9
|
+
"version": "fd2249ffcd55620756a03ddbb0200c1fc6109411"
|
|
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",
|
|
20
|
-
"
|
|
14
|
+
"p-map-series": "2.1.0",
|
|
15
|
+
"async-mutex": "0.3.1",
|
|
21
16
|
"fs-extra": "10.0.0",
|
|
22
17
|
"uid-number": "0.0.6",
|
|
18
|
+
"@pnpm/dependency-path": "1001.1.0",
|
|
19
|
+
"@pnpm/lockfile.types": "^1002.0.0",
|
|
20
|
+
"semver": "7.7.1",
|
|
21
|
+
"uuid": "8.3.2",
|
|
23
22
|
"@teambit/harmony": "0.4.7",
|
|
23
|
+
"@teambit/cli": "0.0.1268",
|
|
24
24
|
"@teambit/component-id": "1.2.4",
|
|
25
|
-
"@teambit/
|
|
26
|
-
"@teambit/
|
|
25
|
+
"@teambit/component.snap-distance": "0.0.70",
|
|
26
|
+
"@teambit/graph.cleargraph": "0.0.11",
|
|
27
|
+
"@teambit/harmony.modules.concurrency": "0.0.16",
|
|
28
|
+
"@teambit/legacy.logger": "0.0.25",
|
|
29
|
+
"@teambit/legacy.scope": "0.0.69",
|
|
30
|
+
"@teambit/toolbox.promise.map-pool": "0.0.7",
|
|
31
|
+
"@teambit/legacy.constants": "0.0.15",
|
|
32
|
+
"@teambit/legacy.utils": "0.0.24",
|
|
33
|
+
"@teambit/toolbox.crypto.sha1": "0.0.8",
|
|
27
34
|
"@teambit/bit-error": "0.0.404",
|
|
28
35
|
"@teambit/component-version": "1.0.4",
|
|
29
|
-
"@teambit/
|
|
36
|
+
"@teambit/harmony.modules.in-memory-cache": "0.0.18",
|
|
37
|
+
"@teambit/toolbox.fs.remove-empty-dir": "0.0.6",
|
|
30
38
|
"@teambit/lane-id": "0.0.312",
|
|
31
|
-
"@teambit/
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/legacy.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/toolbox.crypto.sha1": "0.0.7",
|
|
36
|
-
"@teambit/component.sources": "0.0.109",
|
|
39
|
+
"@teambit/harmony.modules.get-basic-log": "0.0.70",
|
|
40
|
+
"@teambit/config-store": "0.0.148",
|
|
41
|
+
"@teambit/legacy.cli.error": "0.0.25",
|
|
42
|
+
"@teambit/component.sources": "0.0.121",
|
|
37
43
|
"@teambit/legacy-bit-id": "1.1.3",
|
|
38
|
-
"@teambit/legacy-component-log": "0.0.
|
|
39
|
-
"@teambit/legacy.consumer-component": "0.0.
|
|
40
|
-
"@teambit/legacy.consumer-config": "0.0.
|
|
41
|
-
"@teambit/legacy.extension-data": "0.0.
|
|
42
|
-
"@teambit/pkg.modules.semver-helper": "0.0.
|
|
44
|
+
"@teambit/legacy-component-log": "0.0.409",
|
|
45
|
+
"@teambit/legacy.consumer-component": "0.0.70",
|
|
46
|
+
"@teambit/legacy.consumer-config": "0.0.69",
|
|
47
|
+
"@teambit/legacy.extension-data": "0.0.71",
|
|
48
|
+
"@teambit/pkg.modules.semver-helper": "0.0.14",
|
|
43
49
|
"@teambit/toolbox.array.duplications-finder": "0.0.3",
|
|
44
|
-
"@teambit/
|
|
45
|
-
"@teambit/
|
|
46
|
-
"@teambit/
|
|
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.0-3741fe3bcbab09953d02970a928c25db3c627bc1",
|
|
52
|
-
"@teambit/config-store": "0.0.0-b573b3bdf0a6430bd5acd2e77e6f5b968b39c180",
|
|
53
|
-
"@teambit/graph": "0.0.0-99208b4fecec721b005ea71057cb2ada828910d5"
|
|
50
|
+
"@teambit/bit.get-bit-version": "0.0.7",
|
|
51
|
+
"@teambit/semantics.doc-parser": "0.0.77",
|
|
52
|
+
"@teambit/graph": "0.0.0-37b53323e220abd2cba7406bda61d358f6e58adb"
|
|
54
53
|
},
|
|
55
54
|
"devDependencies": {
|
|
56
|
-
"@types/semver": "7.5.8",
|
|
57
55
|
"@types/lodash": "4.14.165",
|
|
58
|
-
"@types/uuid": "8.3.4",
|
|
59
56
|
"@types/fs-extra": "9.0.7",
|
|
60
|
-
"@
|
|
57
|
+
"@types/semver": "7.5.8",
|
|
58
|
+
"@types/uuid": "8.3.4",
|
|
59
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.78"
|
|
61
60
|
},
|
|
62
61
|
"peerDependencies": {
|
|
63
62
|
"chai": "5.2.1",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ScopeJson } from '@teambit/legacy.scope';
|
|
2
|
-
export type ContentTransformer = (content: Buffer) => Buffer;
|
|
3
|
-
export declare function onPersist(scopePath: string, scopeJson: ScopeJson): ContentTransformer;
|
|
4
|
-
export declare function onRead(scopePath: string, scopeJson: ScopeJson): ContentTransformer;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.onPersist = onPersist;
|
|
7
|
-
exports.onRead = onRead;
|
|
8
|
-
function _isRelativePath() {
|
|
9
|
-
const data = _interopRequireDefault(require("is-relative-path"));
|
|
10
|
-
_isRelativePath = function () {
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
function _path() {
|
|
16
|
-
const data = _interopRequireDefault(require("path"));
|
|
17
|
-
_path = function () {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
-
function loadHooks(scopePath, scopeJson) {
|
|
24
|
-
const hooksPath = scopeJson.hooksPath;
|
|
25
|
-
if (hooksPath) {
|
|
26
|
-
const hooksFinalPath = (0, _isRelativePath().default)(hooksPath) ? _path().default.join(scopePath, hooksPath) : hooksPath;
|
|
27
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
28
|
-
const hooks = require(hooksFinalPath);
|
|
29
|
-
return hooks;
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
function onPersist(scopePath, scopeJson) {
|
|
34
|
-
const defaultFunc = content => content;
|
|
35
|
-
const hooks = loadHooks(scopePath, scopeJson);
|
|
36
|
-
if (hooks) {
|
|
37
|
-
const onReadFunction = hooks.onPersist;
|
|
38
|
-
if (onReadFunction) {
|
|
39
|
-
return onReadFunction;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return defaultFunc;
|
|
43
|
-
}
|
|
44
|
-
function onRead(scopePath, scopeJson) {
|
|
45
|
-
const defaultFunc = content => content;
|
|
46
|
-
const hooks = loadHooks(scopePath, scopeJson);
|
|
47
|
-
if (hooks) {
|
|
48
|
-
const onReadFunction = hooks.onRead;
|
|
49
|
-
if (onReadFunction) {
|
|
50
|
-
return onReadFunction;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return defaultFunc;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=repository-hooks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_isRelativePath","data","_interopRequireDefault","require","_path","e","__esModule","default","loadHooks","scopePath","scopeJson","hooksPath","hooksFinalPath","isRelative","path","join","hooks","undefined","onPersist","defaultFunc","content","onReadFunction","onRead"],"sources":["repository-hooks.ts"],"sourcesContent":["import isRelative from 'is-relative-path';\nimport path from 'path';\n\nimport { ScopeJson } from '@teambit/legacy.scope';\n\nexport type ContentTransformer = (content: Buffer) => Buffer;\n\nfunction loadHooks(scopePath: string, scopeJson: ScopeJson): any | undefined {\n const hooksPath = scopeJson.hooksPath;\n if (hooksPath) {\n const hooksFinalPath = isRelative(hooksPath) ? path.join(scopePath, hooksPath) : hooksPath;\n // eslint-disable-next-line global-require, import/no-dynamic-require\n const hooks = require(hooksFinalPath);\n return hooks;\n }\n return undefined;\n}\n\nexport function onPersist(scopePath: string, scopeJson: ScopeJson): ContentTransformer {\n const defaultFunc = (content) => content;\n const hooks = loadHooks(scopePath, scopeJson);\n if (hooks) {\n const onReadFunction = hooks.onPersist;\n if (onReadFunction) {\n return onReadFunction;\n }\n }\n return defaultFunc;\n}\n\nexport function onRead(scopePath: string, scopeJson: ScopeJson): ContentTransformer {\n const defaultFunc = (content) => content;\n\n const hooks = loadHooks(scopePath, scopeJson);\n if (hooks) {\n const onReadFunction = hooks.onRead;\n if (onReadFunction) {\n return onReadFunction;\n }\n }\n return defaultFunc;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwB,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMxB,SAASG,SAASA,CAACC,SAAiB,EAAEC,SAAoB,EAAmB;EAC3E,MAAMC,SAAS,GAAGD,SAAS,CAACC,SAAS;EACrC,IAAIA,SAAS,EAAE;IACb,MAAMC,cAAc,GAAG,IAAAC,yBAAU,EAACF,SAAS,CAAC,GAAGG,eAAI,CAACC,IAAI,CAACN,SAAS,EAAEE,SAAS,CAAC,GAAGA,SAAS;IAC1F;IACA,MAAMK,KAAK,GAAGb,OAAO,CAACS,cAAc,CAAC;IACrC,OAAOI,KAAK;EACd;EACA,OAAOC,SAAS;AAClB;AAEO,SAASC,SAASA,CAACT,SAAiB,EAAEC,SAAoB,EAAsB;EACrF,MAAMS,WAAW,GAAIC,OAAO,IAAKA,OAAO;EACxC,MAAMJ,KAAK,GAAGR,SAAS,CAACC,SAAS,EAAEC,SAAS,CAAC;EAC7C,IAAIM,KAAK,EAAE;IACT,MAAMK,cAAc,GAAGL,KAAK,CAACE,SAAS;IACtC,IAAIG,cAAc,EAAE;MAClB,OAAOA,cAAc;IACvB;EACF;EACA,OAAOF,WAAW;AACpB;AAEO,SAASG,MAAMA,CAACb,SAAiB,EAAEC,SAAoB,EAAsB;EAClF,MAAMS,WAAW,GAAIC,OAAO,IAAKA,OAAO;EAExC,MAAMJ,KAAK,GAAGR,SAAS,CAACC,SAAS,EAAEC,SAAS,CAAC;EAC7C,IAAIM,KAAK,EAAE;IACT,MAAMK,cAAc,GAAGL,KAAK,CAACM,MAAM;IACnC,IAAID,cAAc,EAAE;MAClB,OAAOA,cAAc;IACvB;EACF;EACA,OAAOF,WAAW;AACpB","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import isRelative from 'is-relative-path';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import { ScopeJson } from '@teambit/legacy.scope';
|
|
5
|
-
|
|
6
|
-
export type ContentTransformer = (content: Buffer) => Buffer;
|
|
7
|
-
|
|
8
|
-
function loadHooks(scopePath: string, scopeJson: ScopeJson): any | undefined {
|
|
9
|
-
const hooksPath = scopeJson.hooksPath;
|
|
10
|
-
if (hooksPath) {
|
|
11
|
-
const hooksFinalPath = isRelative(hooksPath) ? path.join(scopePath, hooksPath) : hooksPath;
|
|
12
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
13
|
-
const hooks = require(hooksFinalPath);
|
|
14
|
-
return hooks;
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function onPersist(scopePath: string, scopeJson: ScopeJson): ContentTransformer {
|
|
20
|
-
const defaultFunc = (content) => content;
|
|
21
|
-
const hooks = loadHooks(scopePath, scopeJson);
|
|
22
|
-
if (hooks) {
|
|
23
|
-
const onReadFunction = hooks.onPersist;
|
|
24
|
-
if (onReadFunction) {
|
|
25
|
-
return onReadFunction;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return defaultFunc;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function onRead(scopePath: string, scopeJson: ScopeJson): ContentTransformer {
|
|
32
|
-
const defaultFunc = (content) => content;
|
|
33
|
-
|
|
34
|
-
const hooks = loadHooks(scopePath, scopeJson);
|
|
35
|
-
if (hooks) {
|
|
36
|
-
const onReadFunction = hooks.onRead;
|
|
37
|
-
if (onReadFunction) {
|
|
38
|
-
return onReadFunction;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return defaultFunc;
|
|
42
|
-
}
|
|
File without changes
|