@elmeragroup/internal 0.2.0-canary.3 → 0.2.0-canary.5
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/release.mjs +51 -2
- package/package.json +6 -6
package/dist/release.mjs
CHANGED
|
@@ -144,6 +144,54 @@ function packageManifestGitPath(pkg) {
|
|
|
144
144
|
return join(relative(pkg.checkoutRoot, pkg.packageDirectory), "package.json").replaceAll("\\", "/");
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
|
+
//#region ../release/dist/connection-retry.js
|
|
148
|
+
/**
|
|
149
|
+
* Failure codes of a request whose pooled keep-alive connection was already gone. GitHub drops
|
|
150
|
+
* idle connections within a minute without a keep-alive hint, and the engine blocks its event
|
|
151
|
+
* loop while the adapter packs and while npm runs, so the pool cannot notice before it reuses the
|
|
152
|
+
* socket: the next request fails with `UND_ERR_SOCKET` ("other side closed") or `EPIPE`.
|
|
153
|
+
*/
|
|
154
|
+
const DROPPED_CONNECTION_CODES = /* @__PURE__ */ new Set([
|
|
155
|
+
"UND_ERR_SOCKET",
|
|
156
|
+
"EPIPE",
|
|
157
|
+
"ECONNRESET"
|
|
158
|
+
]);
|
|
159
|
+
/**
|
|
160
|
+
* Methods the engine may send twice. GET, HEAD, PUT and DELETE are idempotent, and the engine's
|
|
161
|
+
* only PATCH sets fixed fields on its own release. POST writes are never resent: each follows a
|
|
162
|
+
* state read, so rerunning the Merge job resumes them instead.
|
|
163
|
+
*/
|
|
164
|
+
const RESENDABLE_METHODS = /* @__PURE__ */ new Set([
|
|
165
|
+
"GET",
|
|
166
|
+
"HEAD",
|
|
167
|
+
"PUT",
|
|
168
|
+
"DELETE",
|
|
169
|
+
"PATCH"
|
|
170
|
+
]);
|
|
171
|
+
/** The system error a failed fetch carries as its `cause`; only its code is read. */
|
|
172
|
+
const isCodedCause = Schema.is(Schema.Struct({ code: Schema.String }));
|
|
173
|
+
function droppedConnection(error) {
|
|
174
|
+
return error instanceof TypeError && isCodedCause(error.cause) && DROPPED_CONNECTION_CODES.has(error.cause.code);
|
|
175
|
+
}
|
|
176
|
+
function requestMethod(input, init) {
|
|
177
|
+
return (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Wraps `fetcher` so a resendable request that fails on a dropped connection is sent once more,
|
|
181
|
+
* which opens a fresh connection. HTTP error statuses, aborts, other network failures, a POST, and
|
|
182
|
+
* a second drop all pass through unchanged.
|
|
183
|
+
*/
|
|
184
|
+
function resendOnDroppedConnection(fetcher) {
|
|
185
|
+
return async (input, init) => {
|
|
186
|
+
try {
|
|
187
|
+
return await fetcher(input, init);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (!droppedConnection(error) || !RESENDABLE_METHODS.has(requestMethod(input, init))) throw error;
|
|
190
|
+
return fetcher(input, init);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
147
195
|
//#region ../release/dist/github.js
|
|
148
196
|
/** Brands a decoded GitHub release id; the two id spaces are nominal, so they must not mix. */
|
|
149
197
|
const releaseId = Brand.nominal();
|
|
@@ -184,7 +232,7 @@ function releaseEnvironment() {
|
|
|
184
232
|
return {
|
|
185
233
|
repository: process.env.GITHUB_REPOSITORY ?? "",
|
|
186
234
|
token: Redacted.make(process.env.GH_TOKEN ?? ""),
|
|
187
|
-
fetch: (input, init) => globalThis.fetch(input, init)
|
|
235
|
+
fetch: resendOnDroppedConnection((input, init) => globalThis.fetch(input, init))
|
|
188
236
|
};
|
|
189
237
|
}
|
|
190
238
|
/**
|
|
@@ -523,7 +571,7 @@ const ChangesetConfig = Schema.Struct({ baseBranch: Schema.String });
|
|
|
523
571
|
const PlannedReleaseEntry = Schema.Struct({
|
|
524
572
|
name: Schema.String,
|
|
525
573
|
type: Schema.String,
|
|
526
|
-
newVersion: Schema.String
|
|
574
|
+
newVersion: Schema.optionalKey(Schema.String)
|
|
527
575
|
});
|
|
528
576
|
const ChangesetPlan = Schema.Struct({ releases: Schema.Array(PlannedReleaseEntry) });
|
|
529
577
|
function changesetBin(checkoutRoot) {
|
|
@@ -584,6 +632,7 @@ function plannedCanaryBase(current, packageName, checkoutRoot) {
|
|
|
584
632
|
if (planned.length > 1) throw new Error("Multiple release plans for the public package");
|
|
585
633
|
const release = planned[0];
|
|
586
634
|
if (release === void 0) return nextPatchVersion(current);
|
|
635
|
+
if (release.newVersion === void 0) throw new Error(`The release plan for ${packageName} has no newVersion`);
|
|
587
636
|
return assertStableReleaseVersion(release.newVersion);
|
|
588
637
|
});
|
|
589
638
|
}
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"@types/node": "25.9.5",
|
|
12
12
|
"vitest": "4.1.11",
|
|
13
13
|
"tsdown": "0.23.0",
|
|
14
|
-
"@elmeragroup/typescript-config": "0.0.0",
|
|
15
|
-
"@elmeragroup/api-artifacts": "0.0.0",
|
|
16
14
|
"@elmeragroup/api-extractor": "0.0.0",
|
|
15
|
+
"@elmeragroup/typescript-config": "0.0.0",
|
|
17
16
|
"@elmeragroup/oxlint-plugin": "0.0.0",
|
|
18
|
-
"@elmeragroup/
|
|
19
|
-
"@elmeragroup/
|
|
17
|
+
"@elmeragroup/oxlint-plugin-anti-slop": "0.0.0",
|
|
18
|
+
"@elmeragroup/api-artifacts": "0.0.0",
|
|
19
|
+
"@elmeragroup/release": "0.0.0"
|
|
20
20
|
},
|
|
21
|
-
"version": "0.2.0-canary.
|
|
21
|
+
"version": "0.2.0-canary.5",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/index.d.mts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"sideEffects": false,
|
|
71
71
|
"elmeraRelease": {
|
|
72
|
-
"commit": "
|
|
72
|
+
"commit": "56943afa4d2a0630618cc252cb8f45c1121b4d08",
|
|
73
73
|
"channel": "canary"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|