github-repository-provider 9.2.4 → 9.2.6
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 +4 -4
- package/src/github-branch.mjs +13 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-repository-provider",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"content-entry": "^13.
|
|
38
|
+
"content-entry": "^13.5.0",
|
|
39
39
|
"fetch-link-util": "^1.1.3",
|
|
40
40
|
"fetch-rate-limit-util": "^4.5.2",
|
|
41
41
|
"matching-iterator": "^2.1.3",
|
|
42
42
|
"one-time-execution-method": "^3.1.3",
|
|
43
|
-
"repository-provider": "^35.4.
|
|
43
|
+
"repository-provider": "^35.4.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.15.17",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"etag-cache-leveldb": "^2.1.14",
|
|
51
51
|
"leveldown": "^6.1.1",
|
|
52
52
|
"levelup": "^5.1.1",
|
|
53
|
-
"repository-provider-test-support": "^3.1.
|
|
53
|
+
"repository-provider-test-support": "^3.1.27",
|
|
54
54
|
"semantic-release": "^24.2.3",
|
|
55
55
|
"typescript": "^5.8.3"
|
|
56
56
|
},
|
package/src/github-branch.mjs
CHANGED
|
@@ -64,11 +64,12 @@ export class GithubBranch extends Branch {
|
|
|
64
64
|
);
|
|
65
65
|
|
|
66
66
|
const sha = await this.refId;
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
67
|
+
const repo = this.owner;
|
|
68
|
+
const latestCommit = await repo.commitForSha(sha);
|
|
69
|
+
const tree = await repo.addTree(updates, latestCommit.tree.sha);
|
|
70
|
+
const commit = await repo.addCommit(tree.sha, [sha], message);
|
|
70
71
|
|
|
71
|
-
return
|
|
72
|
+
return repo.setRefId(this.ref, commit.sha, options);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
/**
|
|
@@ -128,10 +129,16 @@ export class GithubBranch extends Branch {
|
|
|
128
129
|
break;
|
|
129
130
|
case "blob":
|
|
130
131
|
{
|
|
131
|
-
const e = new
|
|
132
|
+
const e = new BufferContentEntry(
|
|
132
133
|
entry.path,
|
|
133
134
|
{ mode: parseInt(entry.mode, 8) },
|
|
134
|
-
|
|
135
|
+
async (entry) => {
|
|
136
|
+
const { json } = await this.provider.fetchJSON(
|
|
137
|
+
`${this.api}/contents/${entry.name}?ref=${this.ref}`
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
return Buffer.from(json.content, "base64");
|
|
141
|
+
}
|
|
135
142
|
);
|
|
136
143
|
this.#entries.set(e.name, e);
|
|
137
144
|
yield e;
|
|
@@ -158,38 +165,3 @@ export class GithubBranch extends Branch {
|
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
167
|
}
|
|
161
|
-
|
|
162
|
-
class LazyBufferContentEntry extends BufferContentEntry {
|
|
163
|
-
constructor(name, options, branch) {
|
|
164
|
-
super(name, options);
|
|
165
|
-
this.branch = branch;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
get buffer() {
|
|
169
|
-
return this.getBuffer();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
set buffer(value) {
|
|
173
|
-
this._buffer = value;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async getBuffer() {
|
|
177
|
-
if (this._buffer) {
|
|
178
|
-
return this._buffer;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const branch = this.branch;
|
|
182
|
-
|
|
183
|
-
const f = async () => {
|
|
184
|
-
const { json } = await branch.provider.fetchJSON(
|
|
185
|
-
`${branch.api}/contents/${this.name}?ref=${branch.ref}`
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
this._buffer = Buffer.from(json.content, "base64");
|
|
189
|
-
return this._buffer;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
this._buffer = f();
|
|
193
|
-
return this._buffer;
|
|
194
|
-
}
|
|
195
|
-
}
|