mock-repository-provider 8.1.4 → 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.4",
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.10",
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,15 +89,16 @@ replaceWithOneTimeExecutionMethod(
79
89
  );
80
90
 
81
91
  export class MockFileSystemBranch extends Branch {
82
-
92
+ // @ts-ignore
83
93
  async maybeEntry(name) {
84
94
  const entry = new FileSystemEntry(name, this.files);
85
95
  if (await entry.isExistent) {
86
96
  return entry;
87
97
  }
88
- return undefined;
89
98
  }
90
99
 
100
+ // @ts-ignore
101
+
91
102
  async entry(name) {
92
103
  const entry = new FileSystemEntry(name, this.files);
93
104
  if (await entry.isExistent) {
@@ -96,6 +107,7 @@ export class MockFileSystemBranch extends Branch {
96
107
  throw new Error(`Entry not found: ${name}`);
97
108
  }
98
109
 
110
+ // @ts-ignore
99
111
  async *entries(matchingPatterns = ["**/.*", "**/*"]) {
100
112
  for (const name of await globby(matchingPatterns, {
101
113
  cwd: this.files
@@ -105,6 +117,8 @@ export class MockFileSystemBranch extends Branch {
105
117
  }
106
118
 
107
119
  get files() {
120
+ // @ts-ignore
121
+
108
122
  return this.provider.files;
109
123
  }
110
124
 
@@ -115,6 +129,7 @@ export class MockFileSystemBranch extends Branch {
115
129
 
116
130
  export class MockFileSystemRepository extends Repository {
117
131
  get url() {
132
+ // @ts-ignore
118
133
  return `${this.provider.url}/${this.fullName}`;
119
134
  }
120
135
 
@@ -157,13 +172,16 @@ export class MockProvider extends MultiGroupProvider {
157
172
  }
158
173
 
159
174
  constructor(files, options) {
175
+ // @ts-ignore
160
176
  super(options);
161
177
  Object.defineProperty(this, "files", {
162
178
  value: files
163
179
  });
164
180
  }
165
181
 
182
+ // @ts-ignore
166
183
  async waitDelay(delay = this.delay) {
184
+ // @ts-ignore
167
185
  return new Promise(resolve => setTimeout(resolve, delay));
168
186
  }
169
187
 
@@ -174,11 +192,14 @@ export class MockProvider extends MultiGroupProvider {
174
192
  return this.repositoryBases[0];
175
193
  }
176
194
 
195
+ // @ts-ignore
177
196
  get branchClass() {
197
+ // @ts-ignore
178
198
  return typeof this.files === "string" ? MockFileSystemBranch : MockBranch;
179
199
  }
180
200
 
181
201
  get repositoryClass() {
202
+ // @ts-ignore
182
203
  return typeof this.files === "string"
183
204
  ? MockFileSystemRepository
184
205
  : MockRepository;
@@ -197,9 +218,14 @@ export class MockProvider extends MultiGroupProvider {
197
218
  group.addRepository(repoName);
198
219
  };
199
220
 
221
+ // @ts-ignore
200
222
  if (typeof this.files === "string") {
223
+ // @ts-ignore
224
+
201
225
  setupRepo(this.repositoryName);
202
226
  } else {
227
+ // @ts-ignore
228
+
203
229
  for (const name of Object.keys(this.files)) {
204
230
  setupRepo(name);
205
231
  }
@@ -1,18 +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
- maybeEntry(name: any): Promise<any>;
13
- entry(name: any): Promise<any>;
14
- 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>;
15
19
  get files(): any;
20
+ get entryClass(): typeof FileSystemEntry;
16
21
  }
17
22
  export class MockFileSystemRepository extends Repository {
18
23
  initializeBranches(): Promise<Branch>;
@@ -78,5 +83,7 @@ export class MockProvider extends MultiGroupProvider {
78
83
  }
79
84
  export default MockProvider;
80
85
  import { Branch } from "repository-provider";
86
+ import { StringContentEntry } from "content-entry";
81
87
  import { Repository } from "repository-provider";
88
+ import { FileSystemEntry } from "content-entry-filesystem";
82
89
  import { MultiGroupProvider } from "repository-provider";