mock-repository-provider 8.1.3 → 8.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mock-repository-provider",
3
- "version": "8.1.3",
3
+ "version": "8.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -35,13 +35,13 @@
35
35
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
36
36
  },
37
37
  "dependencies": {
38
- "content-entry": "^6.0.0",
39
- "content-entry-filesystem": "^6.0.0",
38
+ "content-entry": "^9.0.0",
39
+ "content-entry-filesystem": "^6.1.0",
40
40
  "globby": "^14.0.1",
41
41
  "micromatch": "^4.0.2",
42
42
  "one-time-execution-method": "^3.1.1",
43
- "repository-provider": "^35.2.9",
44
- "repository-provider-test-support": "^3.1.2"
43
+ "repository-provider": "^35.2.11",
44
+ "repository-provider-test-support": "^3.1.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^20.11.19",
@@ -6,6 +6,7 @@ import { StringContentEntry } from "content-entry";
6
6
  import { FileSystemEntry } from "content-entry-filesystem";
7
7
 
8
8
  export class MockBranch extends Branch {
9
+ // @ts-ignore
9
10
  async maybeEntry(name) {
10
11
  if (this.files[name] === undefined) {
11
12
  return undefined;
@@ -14,6 +15,7 @@ export class MockBranch extends Branch {
14
15
  return new this.entryClass(name, this.files[name]);
15
16
  }
16
17
 
18
+ // @ts-ignore
17
19
  async entry(name) {
18
20
  if (this.files[name] === undefined) {
19
21
  throw new Error(`No such object '${name}'`);
@@ -22,6 +24,8 @@ export class MockBranch extends Branch {
22
24
  return new this.entryClass(name, this.files[name]);
23
25
  }
24
26
 
27
+ // @ts-ignore
28
+
25
29
  async *entries(patterns = "**/*") {
26
30
  for (const name of micromatch(Object.keys(this.files), patterns)) {
27
31
  yield new this.entryClass(name, this.files[name]);
@@ -29,6 +33,7 @@ export class MockBranch extends Branch {
29
33
  }
30
34
 
31
35
  get files() {
36
+ // @ts-ignore
32
37
  return this.repository.files[this.name];
33
38
  }
34
39
 
@@ -37,12 +42,17 @@ export class MockBranch extends Branch {
37
42
  }
38
43
  }
39
44
 
45
+ /**
46
+ *
47
+ */
40
48
  export class MockRepository extends Repository {
41
49
  get files() {
50
+ // @ts-ignore
42
51
  return this.provider.files[this.fullName];
43
52
  }
44
53
 
45
54
  get url() {
55
+ // @ts-ignore
46
56
  return `${this.provider.url}/${this.fullName}`;
47
57
  }
48
58
 
@@ -79,22 +89,16 @@ replaceWithOneTimeExecutionMethod(
79
89
  );
80
90
 
81
91
  export class MockFileSystemBranch extends Branch {
82
- async entry(name) {
83
- if (this.files[name] === undefined) {
84
- throw new Error(`No such entry '${name}'`);
85
- }
86
-
87
- return new this.entryClass(name, this.files[name]);
88
- }
89
-
92
+ // @ts-ignore
90
93
  async maybeEntry(name) {
91
94
  const entry = new FileSystemEntry(name, this.files);
92
95
  if (await entry.isExistent) {
93
96
  return entry;
94
97
  }
95
- return undefined;
96
98
  }
97
99
 
100
+ // @ts-ignore
101
+
98
102
  async entry(name) {
99
103
  const entry = new FileSystemEntry(name, this.files);
100
104
  if (await entry.isExistent) {
@@ -103,6 +107,7 @@ export class MockFileSystemBranch extends Branch {
103
107
  throw new Error(`Entry not found: ${name}`);
104
108
  }
105
109
 
110
+ // @ts-ignore
106
111
  async *entries(matchingPatterns = ["**/.*", "**/*"]) {
107
112
  for (const name of await globby(matchingPatterns, {
108
113
  cwd: this.files
@@ -112,6 +117,8 @@ export class MockFileSystemBranch extends Branch {
112
117
  }
113
118
 
114
119
  get files() {
120
+ // @ts-ignore
121
+
115
122
  return this.provider.files;
116
123
  }
117
124
 
@@ -122,6 +129,7 @@ export class MockFileSystemBranch extends Branch {
122
129
 
123
130
  export class MockFileSystemRepository extends Repository {
124
131
  get url() {
132
+ // @ts-ignore
125
133
  return `${this.provider.url}/${this.fullName}`;
126
134
  }
127
135
 
@@ -164,13 +172,16 @@ export class MockProvider extends MultiGroupProvider {
164
172
  }
165
173
 
166
174
  constructor(files, options) {
175
+ // @ts-ignore
167
176
  super(options);
168
177
  Object.defineProperty(this, "files", {
169
178
  value: files
170
179
  });
171
180
  }
172
181
 
182
+ // @ts-ignore
173
183
  async waitDelay(delay = this.delay) {
184
+ // @ts-ignore
174
185
  return new Promise(resolve => setTimeout(resolve, delay));
175
186
  }
176
187
 
@@ -181,11 +192,14 @@ export class MockProvider extends MultiGroupProvider {
181
192
  return this.repositoryBases[0];
182
193
  }
183
194
 
195
+ // @ts-ignore
184
196
  get branchClass() {
197
+ // @ts-ignore
185
198
  return typeof this.files === "string" ? MockFileSystemBranch : MockBranch;
186
199
  }
187
200
 
188
201
  get repositoryClass() {
202
+ // @ts-ignore
189
203
  return typeof this.files === "string"
190
204
  ? MockFileSystemRepository
191
205
  : MockRepository;
@@ -204,9 +218,14 @@ export class MockProvider extends MultiGroupProvider {
204
218
  group.addRepository(repoName);
205
219
  };
206
220
 
221
+ // @ts-ignore
207
222
  if (typeof this.files === "string") {
223
+ // @ts-ignore
224
+
208
225
  setupRepo(this.repositoryName);
209
226
  } else {
227
+ // @ts-ignore
228
+
210
229
  for (const name of Object.keys(this.files)) {
211
230
  setupRepo(name);
212
231
  }
@@ -1,19 +1,23 @@
1
1
  export class MockBranch extends Branch {
2
- maybeEntry(name: any): Promise<any>;
3
- entry(name: any): Promise<any>;
4
- entries(patterns?: string): AsyncGenerator<any, void, unknown>;
2
+ maybeEntry(name: any): Promise<StringContentEntry>;
3
+ entry(name: any): Promise<StringContentEntry>;
4
+ entries(patterns?: string): AsyncGenerator<StringContentEntry, void, unknown>;
5
5
  get files(): any;
6
+ get entryClass(): typeof StringContentEntry;
6
7
  }
8
+ /**
9
+ *
10
+ */
7
11
  export class MockRepository extends Repository {
8
12
  get files(): any;
9
13
  initializeBranches(): Promise<void>;
10
14
  }
11
15
  export class MockFileSystemBranch extends Branch {
12
- entry(name: any): Promise<any>;
13
- entry(name: any): Promise<any>;
14
- maybeEntry(name: any): Promise<any>;
15
- entries(matchingPatterns?: string[]): AsyncGenerator<any, void, unknown>;
16
+ maybeEntry(name: any): Promise<FileSystemEntry>;
17
+ entry(name: any): Promise<FileSystemEntry>;
18
+ entries(matchingPatterns?: string[]): AsyncGenerator<FileSystemEntry, void, unknown>;
16
19
  get files(): any;
20
+ get entryClass(): typeof FileSystemEntry;
17
21
  }
18
22
  export class MockFileSystemRepository extends Repository {
19
23
  initializeBranches(): Promise<Branch>;
@@ -79,5 +83,7 @@ export class MockProvider extends MultiGroupProvider {
79
83
  }
80
84
  export default MockProvider;
81
85
  import { Branch } from "repository-provider";
86
+ import { StringContentEntry } from "content-entry";
82
87
  import { Repository } from "repository-provider";
88
+ import { FileSystemEntry } from "content-entry-filesystem";
83
89
  import { MultiGroupProvider } from "repository-provider";