github-repository-provider 7.25.59 → 7.25.60

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": "github-repository-provider",
3
- "version": "7.25.59",
3
+ "version": "7.25.60",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -84,16 +84,13 @@ export class GithubBranch extends Branch {
84
84
  })
85
85
  });
86
86
 
87
- r = await this.provider.fetchJSON(
88
- `repos/${this.slug}/git/${this.ref}`,
89
- {
90
- method: "PATCH",
91
- body: JSON.stringify({
92
- ...options,
93
- sha: r.json.sha
94
- })
95
- }
96
- );
87
+ r = await this.provider.fetchJSON(`repos/${this.slug}/git/${this.ref}`, {
88
+ method: "PATCH",
89
+ body: JSON.stringify({
90
+ ...options,
91
+ sha: r.json.sha
92
+ })
93
+ });
97
94
 
98
95
  return r.json;
99
96
  }
@@ -103,11 +100,26 @@ export class GithubBranch extends Branch {
103
100
  * @param {string} name
104
101
  */
105
102
  async entry(name) {
103
+ if (this._entries) {
104
+ const entry = this._entries.get(name);
105
+ if (entry) {
106
+ return entry;
107
+ }
108
+ } else {
109
+ this._entries = new Map();
110
+ }
111
+
106
112
  const { json } = await this.provider.fetchJSON(
107
113
  `repos/${this.slug}/contents/${name}?ref=${this.ref}`
108
114
  );
109
115
 
110
- return new this.entryClass(name, Buffer.from(json.content, "base64"));
116
+ const entry = new this.entryClass(
117
+ name,
118
+ Buffer.from(json.content, "base64")
119
+ );
120
+
121
+ this._entries.set(name, entry);
122
+ return entry;
111
123
  }
112
124
 
113
125
  /**
@@ -130,7 +142,7 @@ export class GithubBranch extends Branch {
130
142
  );
131
143
 
132
144
  this._commitForSha.set(sha, json);
133
-
145
+
134
146
  return json;
135
147
  }
136
148
 
@@ -163,6 +175,10 @@ export class GithubBranch extends Branch {
163
175
  async *entries(patterns) {
164
176
  const commit = await this.commitForSha(await this.refId());
165
177
 
178
+ if (!this._entries) {
179
+ this._entries = new Map();
180
+ }
181
+
166
182
  for (const entry of matcher(await this.tree(commit.tree.sha), patterns, {
167
183
  name: "path"
168
184
  })) {
@@ -171,11 +187,13 @@ export class GithubBranch extends Branch {
171
187
  yield new BaseCollectionEntry(entry.path);
172
188
  break;
173
189
  case "blob":
174
- yield new LazyBufferContentEntry(
190
+ const e = new LazyBufferContentEntry(
175
191
  entry.path,
176
192
  parseInt(entry.mode, 8),
177
193
  this
178
194
  );
195
+ this._entries.set(e.path, e);
196
+ yield e;
179
197
  break;
180
198
  /* case "commit":
181
199
  break;*/