@mannyc1/ts-release 0.2.2 → 0.3.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/ARCHITECTURE.md +60 -0
- package/CHANGELOG.md +82 -0
- package/README.md +129 -6
- package/SPEC.md +51 -0
- package/apps/release-ts/README.md +7 -0
- package/apps/ts-release-agents/package.json +1 -1
- package/apps/ts-release-agents/src/check.ts +7 -2
- package/apps/ts-release-agents/test/contract.test.ts +2 -2
- package/dist/bin/ts-release.js +154 -47
- package/dist/drivers/archive.d.ts +2 -1
- package/dist/drivers/archive.d.ts.map +1 -1
- package/dist/drivers/archive.js +12 -8
- package/dist/drivers/archive.js.map +1 -1
- package/dist/drivers/process.d.ts.map +1 -1
- package/dist/drivers/process.js +4 -4
- package/dist/drivers/process.js.map +1 -1
- package/dist/drivers/python-wheel.d.ts +21 -0
- package/dist/drivers/python-wheel.d.ts.map +1 -0
- package/dist/drivers/python-wheel.js +109 -0
- package/dist/drivers/python-wheel.js.map +1 -0
- package/dist/drivers/workspace.d.ts +3 -0
- package/dist/drivers/workspace.d.ts.map +1 -1
- package/dist/drivers/workspace.js +5 -1
- package/dist/drivers/workspace.js.map +1 -1
- package/dist/operation-journal/authority.d.ts +3 -0
- package/dist/operation-journal/authority.d.ts.map +1 -0
- package/dist/operation-journal/authority.js +147 -0
- package/dist/operation-journal/authority.js.map +1 -0
- package/dist/operation-journal/aws/deadline.d.ts +12 -0
- package/dist/operation-journal/aws/deadline.d.ts.map +1 -0
- package/dist/operation-journal/aws/deadline.js +38 -0
- package/dist/operation-journal/aws/deadline.js.map +1 -0
- package/dist/operation-journal/aws/oidc.d.ts +27 -0
- package/dist/operation-journal/aws/oidc.d.ts.map +1 -0
- package/dist/operation-journal/aws/oidc.js +361 -0
- package/dist/operation-journal/aws/oidc.js.map +1 -0
- package/dist/operation-journal/aws/policy.d.ts +42 -0
- package/dist/operation-journal/aws/policy.d.ts.map +1 -0
- package/dist/operation-journal/aws/policy.js +404 -0
- package/dist/operation-journal/aws/policy.js.map +1 -0
- package/dist/operation-journal/aws/s3-boundary.d.ts +17 -0
- package/dist/operation-journal/aws/s3-boundary.d.ts.map +1 -0
- package/dist/operation-journal/aws/s3-boundary.js +417 -0
- package/dist/operation-journal/aws/s3-boundary.js.map +1 -0
- package/dist/operation-journal/aws.d.ts +11 -0
- package/dist/operation-journal/aws.d.ts.map +1 -0
- package/dist/operation-journal/aws.js +50 -0
- package/dist/operation-journal/aws.js.map +1 -0
- package/dist/operation-journal/canonical.d.ts +52 -0
- package/dist/operation-journal/canonical.d.ts.map +1 -0
- package/dist/operation-journal/canonical.js +282 -0
- package/dist/operation-journal/canonical.js.map +1 -0
- package/dist/operation-journal/model.d.ts +251 -0
- package/dist/operation-journal/model.d.ts.map +1 -0
- package/dist/operation-journal/model.js +56 -0
- package/dist/operation-journal/model.js.map +1 -0
- package/dist/operation-journal/reducer.d.ts +28 -0
- package/dist/operation-journal/reducer.d.ts.map +1 -0
- package/dist/operation-journal/reducer.js +73 -0
- package/dist/operation-journal/reducer.js.map +1 -0
- package/dist/operation-journal/s3.d.ts +7 -0
- package/dist/operation-journal/s3.d.ts.map +1 -0
- package/dist/operation-journal/s3.js +667 -0
- package/dist/operation-journal/s3.js.map +1 -0
- package/dist/operation-journal.d.ts +14 -0
- package/dist/operation-journal.d.ts.map +1 -0
- package/dist/operation-journal.js +12 -0
- package/dist/operation-journal.js.map +1 -0
- package/dist/platform/credentials.d.ts.map +1 -1
- package/dist/platform/credentials.js +65 -3
- package/dist/platform/credentials.js.map +1 -1
- package/dist/publication/github.d.ts.map +1 -1
- package/dist/publication/github.js +66 -15
- package/dist/publication/github.js.map +1 -1
- package/dist/release/capabilities.d.ts.map +1 -1
- package/dist/release/capabilities.js +2 -2
- package/dist/release/capabilities.js.map +1 -1
- package/dist/release/prepare.d.ts.map +1 -1
- package/dist/release/prepare.js +4 -5
- package/dist/release/prepare.js.map +1 -1
- package/dist/release/prepared-store.d.ts.map +1 -1
- package/dist/release/prepared-store.js +11 -9
- package/dist/release/prepared-store.js.map +1 -1
- package/package.json +19 -4
- package/src/drivers/archive.ts +17 -8
- package/src/drivers/process.ts +3 -4
- package/src/drivers/python-wheel.ts +145 -0
- package/src/drivers/workspace.ts +7 -1
- package/src/operation-journal/authority.ts +162 -0
- package/src/operation-journal/aws/deadline.ts +41 -0
- package/src/operation-journal/aws/oidc.ts +439 -0
- package/src/operation-journal/aws/policy.ts +491 -0
- package/src/operation-journal/aws/s3-boundary.ts +562 -0
- package/src/operation-journal/aws.ts +60 -0
- package/src/operation-journal/canonical.ts +373 -0
- package/src/operation-journal/model.ts +301 -0
- package/src/operation-journal/reducer.ts +112 -0
- package/src/operation-journal/s3.ts +884 -0
- package/src/operation-journal.ts +51 -0
- package/src/platform/credentials.ts +71 -3
- package/src/publication/github.ts +83 -15
- package/src/release/capabilities.ts +3 -2
- package/src/release/prepare.ts +3 -5
- package/src/release/prepared-store.ts +8 -7
- package/templates/README.md +2 -2
- package/templates/github-actions/release.yml +24 -7
- package/templates/github-actions/reviewed-release.yml +49 -14
package/dist/bin/ts-release.js
CHANGED
|
@@ -26676,7 +26676,7 @@ var listAllAssets = fn2("GitHubReleaseSubject.listAllAssets")(function* (publica
|
|
|
26676
26676
|
reason: "GitHub asset pagination exceeded the bounded full-enumeration limit."
|
|
26677
26677
|
};
|
|
26678
26678
|
});
|
|
26679
|
-
var compareReleaseMetadata = (publication, facts) => {
|
|
26679
|
+
var compareReleaseMetadata = (publication, facts, options = {}) => {
|
|
26680
26680
|
const differences = [];
|
|
26681
26681
|
if (facts.tag !== publication.tag.toString()) {
|
|
26682
26682
|
differences.push(textDifference("release.tag", publication.tag.toString(), facts.tag));
|
|
@@ -26687,7 +26687,7 @@ var compareReleaseMetadata = (publication, facts) => {
|
|
|
26687
26687
|
const expectedBody = publication.body ?? "";
|
|
26688
26688
|
if (facts.body !== expectedBody)
|
|
26689
26689
|
differences.push(textDifference("release.body", expectedBody, facts.body));
|
|
26690
|
-
if (facts.draft !== publication.draft) {
|
|
26690
|
+
if (options.ignoreDraft !== true && facts.draft !== publication.draft) {
|
|
26691
26691
|
differences.push(scalarDifference("release.draft", publication.draft, facts.draft));
|
|
26692
26692
|
}
|
|
26693
26693
|
if (facts.prerelease !== publication.prerelease) {
|
|
@@ -26731,6 +26731,14 @@ var decideFor = (publication, observation, plan) => {
|
|
|
26731
26731
|
})
|
|
26732
26732
|
});
|
|
26733
26733
|
}
|
|
26734
|
+
if (plan?._tag === "PublishRelease") {
|
|
26735
|
+
return NeedsMutation.make({
|
|
26736
|
+
subject: publication.authority.subject,
|
|
26737
|
+
precondition: MutationPrecondition.make({
|
|
26738
|
+
kind: NonEmptyName.make("github-exact-draft-assets-complete")
|
|
26739
|
+
})
|
|
26740
|
+
});
|
|
26741
|
+
}
|
|
26734
26742
|
return ProviderBlocked.make({
|
|
26735
26743
|
subject: publication.authority.subject,
|
|
26736
26744
|
reason: SafeReason.make("GitHub absence carried no exact mutation plan.")
|
|
@@ -26757,7 +26765,7 @@ var appliedAttempt = (publication) => Applied.make({
|
|
|
26757
26765
|
subject: publication.authority.subject,
|
|
26758
26766
|
fact: ProviderMutationFact.make({
|
|
26759
26767
|
subject: publication.authority.subject,
|
|
26760
|
-
detail: SafeReason.make("GitHub accepted
|
|
26768
|
+
detail: SafeReason.make("GitHub accepted every mutation dispatched in this convergence phase; final equivalence still requires provider reobservation.")
|
|
26761
26769
|
})
|
|
26762
26770
|
});
|
|
26763
26771
|
var executeMutation = (mutationHttp, operation, request, grant) => mutationHttp.execute(operation, request, grant).pipe(map5((response) => ({ _tag: "Response", response })), catch_2((error) => succeed6({ _tag: "Failure", error })));
|
|
@@ -26865,7 +26873,10 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26865
26873
|
if (release === undefined || !validateUploadUrl(publication, release.id, release.uploadUrl)) {
|
|
26866
26874
|
return inconclusive(publication, "The GitHub release response omitted identity facts or carried an invalid repository-scoped upload template.");
|
|
26867
26875
|
}
|
|
26868
|
-
const
|
|
26876
|
+
const stagedForPublicPromotion = publication.draft === false && release.draft === true;
|
|
26877
|
+
const releaseDifferences = compareReleaseMetadata(publication, release, {
|
|
26878
|
+
ignoreDraft: stagedForPublicPromotion
|
|
26879
|
+
});
|
|
26869
26880
|
if (releaseDifferences.length > 0)
|
|
26870
26881
|
return presentDifferent(publication, releaseDifferences);
|
|
26871
26882
|
const listed = yield* listAllAssets(publication, http, grant, release.id);
|
|
@@ -26928,6 +26939,9 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26928
26939
|
}
|
|
26929
26940
|
}
|
|
26930
26941
|
if (missingIndexes.length > 0) {
|
|
26942
|
+
if (!release.draft) {
|
|
26943
|
+
return presentDifferent(publication, missingIndexes.map((index) => scalarDifference(`asset.${publication.assets[index].name}.count`, 1, 0)));
|
|
26944
|
+
}
|
|
26931
26945
|
if (mutationMayStillBecomeVisible) {
|
|
26932
26946
|
return pending(publication, "One or more intended GitHub assets are not yet visible after the accepted mutation.");
|
|
26933
26947
|
}
|
|
@@ -26939,6 +26953,10 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26939
26953
|
};
|
|
26940
26954
|
return absent(publication, "github-intended-assets-absent", "A full paginated release-asset enumeration proved at least one intended asset name absent.");
|
|
26941
26955
|
}
|
|
26956
|
+
if (stagedForPublicPromotion) {
|
|
26957
|
+
mutationPlan = { _tag: "PublishRelease", releaseId: release.id };
|
|
26958
|
+
return absent(publication, "github-exact-draft-assets-complete", "The exact private draft and complete asset set are ready for one final public transition.");
|
|
26959
|
+
}
|
|
26942
26960
|
return PresentEquivalent.make({ subject: publication.authority.subject });
|
|
26943
26961
|
});
|
|
26944
26962
|
const mutate = fn2("GitHubReleaseSubject.mutate")(function* (decision, grant) {
|
|
@@ -26949,11 +26967,11 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26949
26967
|
if (decision.subject !== publication.authority.subject || plan === undefined) {
|
|
26950
26968
|
return yield* mutationFailure(publication, "The GitHub mutation decision has no matching exact observation plan.");
|
|
26951
26969
|
}
|
|
26952
|
-
const expectedDecision = plan._tag === "CreateRelease" && plan.tagAbsent ? decision._tag === "ProviderAuthorizedCreate" && decision.proof.kind === "github-authenticated-repository-and-unique-tag" : plan._tag === "CreateRelease" ? decision._tag === "NeedsMutation" && decision.precondition.kind === "github-release-absent-at-exact-tag" : decision._tag === "NeedsMutation" && decision.precondition.kind === "github-intended-assets-authoritatively-absent";
|
|
26970
|
+
const expectedDecision = plan._tag === "CreateRelease" && plan.tagAbsent ? decision._tag === "ProviderAuthorizedCreate" && decision.proof.kind === "github-authenticated-repository-and-unique-tag" : plan._tag === "CreateRelease" ? decision._tag === "NeedsMutation" && decision.precondition.kind === "github-release-absent-at-exact-tag" : plan._tag === "UploadAssets" ? decision._tag === "NeedsMutation" && decision.precondition.kind === "github-intended-assets-authoritatively-absent" : decision._tag === "NeedsMutation" && decision.precondition.kind === "github-exact-draft-assets-complete";
|
|
26953
26971
|
if (!expectedDecision) {
|
|
26954
26972
|
return yield* mutationFailure(publication, "The GitHub mutation decision does not match its observed precondition.");
|
|
26955
26973
|
}
|
|
26956
|
-
const indexes = plan._tag === "CreateRelease" ? publication.assets.map((_, index) => index) : [...plan.assetIndexes];
|
|
26974
|
+
const indexes = plan._tag === "CreateRelease" ? publication.assets.map((_, index) => index) : plan._tag === "UploadAssets" ? [...plan.assetIndexes] : [];
|
|
26957
26975
|
const bytesByIndex = new Map;
|
|
26958
26976
|
for (const index of indexes) {
|
|
26959
26977
|
const asset = publication.assets[index];
|
|
@@ -26975,7 +26993,7 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26975
26993
|
decision
|
|
26976
26994
|
};
|
|
26977
26995
|
let acceptedWrites = 0;
|
|
26978
|
-
const dispatch = fn2("GitHubReleaseSubject.dispatch")(function* (request) {
|
|
26996
|
+
const dispatch = fn2("GitHubReleaseSubject.dispatch")(function* (request, acceptedStatus) {
|
|
26979
26997
|
const exchange = yield* executeMutation(mutationHttp, operation, request, grant);
|
|
26980
26998
|
if (exchange._tag === "Failure") {
|
|
26981
26999
|
if (acceptedWrites > 0 || exchange.error.commitment === "unknown") {
|
|
@@ -26983,12 +27001,13 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26983
27001
|
}
|
|
26984
27002
|
return yield* mutationFailure(publication, "The authorized GitHub HTTP boundary rejected mutation before dispatch.", "before-dispatch");
|
|
26985
27003
|
}
|
|
26986
|
-
if (exchange.response.status ===
|
|
27004
|
+
if (exchange.response.status === acceptedStatus) {
|
|
26987
27005
|
acceptedWrites += 1;
|
|
26988
27006
|
return { _tag: "Accepted", response: exchange.response };
|
|
26989
27007
|
}
|
|
26990
27008
|
return { _tag: "Attempt", attempt: unknownAttempt(publication, `GitHub returned conservative mutation status ${exchange.response.status}; exact outcome requires reobservation.`) };
|
|
26991
27009
|
});
|
|
27010
|
+
let releaseId;
|
|
26992
27011
|
let uploadUrl;
|
|
26993
27012
|
if (plan._tag === "CreateRelease") {
|
|
26994
27013
|
const body = JSON.stringify({
|
|
@@ -26996,7 +27015,7 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
26996
27015
|
target_commitish: publication.targetCommit.toString(),
|
|
26997
27016
|
name: publication.title.toString(),
|
|
26998
27017
|
body: publication.body ?? "",
|
|
26999
|
-
draft:
|
|
27018
|
+
draft: true,
|
|
27000
27019
|
prerelease: publication.prerelease
|
|
27001
27020
|
});
|
|
27002
27021
|
const created = yield* dispatch({
|
|
@@ -27008,20 +27027,24 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
27008
27027
|
"content-length": String(new TextEncoder().encode(body).length)
|
|
27009
27028
|
},
|
|
27010
27029
|
body
|
|
27011
|
-
});
|
|
27030
|
+
}, 201);
|
|
27012
27031
|
if (created._tag === "Attempt")
|
|
27013
27032
|
return created.attempt;
|
|
27014
27033
|
const facts = releaseFacts(parseJson2(created.response.body));
|
|
27015
|
-
if (facts === undefined || !validateUploadUrl(publication, facts.id, facts.uploadUrl) || compareReleaseMetadata(publication, facts).length > 0) {
|
|
27034
|
+
if (facts === undefined || facts.draft !== true || !validateUploadUrl(publication, facts.id, facts.uploadUrl) || compareReleaseMetadata(publication, facts, { ignoreDraft: publication.draft === false }).length > 0) {
|
|
27016
27035
|
return unknownAttempt(publication, "GitHub accepted release creation but its response did not establish the exact release identity and repository-scoped upload template.");
|
|
27017
27036
|
}
|
|
27037
|
+
releaseId = facts.id;
|
|
27018
27038
|
uploadUrl = facts.uploadUrl;
|
|
27019
|
-
} else {
|
|
27039
|
+
} else if (plan._tag === "UploadAssets") {
|
|
27040
|
+
releaseId = plan.releaseId;
|
|
27020
27041
|
uploadUrl = plan.uploadUrl;
|
|
27042
|
+
} else {
|
|
27043
|
+
releaseId = plan.releaseId;
|
|
27021
27044
|
}
|
|
27022
27045
|
for (const index of indexes) {
|
|
27023
27046
|
const bytes = bytesByIndex.get(index);
|
|
27024
|
-
const uploaded = yield* dispatch(uploadRequest(publication, uploadUrl, index, bytes));
|
|
27047
|
+
const uploaded = yield* dispatch(uploadRequest(publication, uploadUrl, index, bytes), 201);
|
|
27025
27048
|
if (uploaded._tag === "Attempt")
|
|
27026
27049
|
return uploaded.attempt;
|
|
27027
27050
|
const intended = publication.assets[index];
|
|
@@ -27030,6 +27053,25 @@ var makeGithubSubjects = (bundle, publication, http, mutationHttp) => {
|
|
|
27030
27053
|
return unknownAttempt(publication, "GitHub accepted an asset upload but its response did not establish the exact uploaded asset identity.");
|
|
27031
27054
|
}
|
|
27032
27055
|
}
|
|
27056
|
+
if (plan._tag === "PublishRelease") {
|
|
27057
|
+
const body = JSON.stringify({ draft: false });
|
|
27058
|
+
const published = yield* dispatch({
|
|
27059
|
+
method: "PATCH",
|
|
27060
|
+
url: `${publication.authority.audience}/releases/${releaseId}`,
|
|
27061
|
+
headers: {
|
|
27062
|
+
...githubJsonHeaders,
|
|
27063
|
+
"content-type": "application/json",
|
|
27064
|
+
"content-length": String(new TextEncoder().encode(body).length)
|
|
27065
|
+
},
|
|
27066
|
+
body
|
|
27067
|
+
}, 200);
|
|
27068
|
+
if (published._tag === "Attempt")
|
|
27069
|
+
return published.attempt;
|
|
27070
|
+
const facts = releaseFacts(parseJson2(published.response.body));
|
|
27071
|
+
if (facts === undefined || facts.id !== releaseId || facts.draft !== false || !validateUploadUrl(publication, releaseId, facts.uploadUrl) || compareReleaseMetadata(publication, facts).length > 0) {
|
|
27072
|
+
return unknownAttempt(publication, "GitHub accepted final release publication but its response did not establish the exact public release identity.");
|
|
27073
|
+
}
|
|
27074
|
+
}
|
|
27033
27075
|
return appliedAttempt(publication);
|
|
27034
27076
|
});
|
|
27035
27077
|
return [{
|
|
@@ -29922,8 +29964,8 @@ var contributeSourceArtifacts = (config, _context) => {
|
|
|
29922
29964
|
cwd,
|
|
29923
29965
|
inputs,
|
|
29924
29966
|
outputs: [
|
|
29925
|
-
output(preparation.outputs[0].id, preparation.outputs[0].path, preparation.outputs[0].kind ?? "file", preparation.outputs[0].mediaType),
|
|
29926
|
-
...preparation.outputs.slice(1).map((item) => output(item.id, item.path, item.kind ?? "file", item.mediaType))
|
|
29967
|
+
output(preparation.outputs[0].id, render(preparation.outputs[0].path, config), preparation.outputs[0].kind ?? "file", preparation.outputs[0].mediaType),
|
|
29968
|
+
...preparation.outputs.slice(1).map((item) => output(item.id, render(item.path, config), item.kind ?? "file", item.mediaType))
|
|
29927
29969
|
]
|
|
29928
29970
|
}));
|
|
29929
29971
|
else
|
|
@@ -31452,17 +31494,15 @@ import {
|
|
|
31452
31494
|
existsSync as existsSync4,
|
|
31453
31495
|
lstatSync as lstatSync4,
|
|
31454
31496
|
mkdirSync as mkdirSync4,
|
|
31455
|
-
mkdtempSync,
|
|
31456
31497
|
readFileSync as readFileSync4,
|
|
31457
31498
|
readdirSync as readdirSync3,
|
|
31458
31499
|
realpathSync as realpathSync4,
|
|
31459
31500
|
rmSync as rmSync2
|
|
31460
31501
|
} from "node:fs";
|
|
31461
31502
|
import { basename as basename3, isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve5, sep as sep3 } from "node:path";
|
|
31462
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
31463
31503
|
|
|
31464
31504
|
// src/drivers/archive.ts
|
|
31465
|
-
import { gzipSync } from "node:zlib";
|
|
31505
|
+
import { deflateRawSync, gzipSync } from "node:zlib";
|
|
31466
31506
|
var text = (value3) => new TextEncoder().encode(value3);
|
|
31467
31507
|
var concat = (parts) => {
|
|
31468
31508
|
const output2 = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
@@ -31495,38 +31535,40 @@ var crc322 = (data) => {
|
|
|
31495
31535
|
crc = crc >>> 8 ^ crcTable2[(crc ^ byte) & 255];
|
|
31496
31536
|
return (crc ^ 4294967295) >>> 0;
|
|
31497
31537
|
};
|
|
31498
|
-
var zip3 = (entries) => {
|
|
31538
|
+
var zip3 = (entries, compression = "store") => {
|
|
31499
31539
|
const bodies = [];
|
|
31500
31540
|
const central = [];
|
|
31501
31541
|
let offset = 0;
|
|
31502
31542
|
for (const entry of entries) {
|
|
31503
31543
|
const name = text(entry.path);
|
|
31504
31544
|
const crc = crc322(entry.data);
|
|
31545
|
+
const method = compression === "deflate" ? 8 : 0;
|
|
31546
|
+
const body = compression === "deflate" ? new Uint8Array(deflateRawSync(entry.data, { level: 9 })) : entry.data;
|
|
31505
31547
|
const local = concat([
|
|
31506
31548
|
integer(4, 67324752),
|
|
31507
31549
|
integer(2, 20),
|
|
31508
31550
|
integer(2, 2048),
|
|
31509
|
-
integer(2,
|
|
31551
|
+
integer(2, method),
|
|
31510
31552
|
integer(2, 0),
|
|
31511
31553
|
integer(2, 0),
|
|
31512
31554
|
integer(4, crc),
|
|
31513
|
-
integer(4,
|
|
31555
|
+
integer(4, body.length),
|
|
31514
31556
|
integer(4, entry.data.length),
|
|
31515
31557
|
integer(2, name.length),
|
|
31516
31558
|
integer(2, 0),
|
|
31517
31559
|
name
|
|
31518
31560
|
]);
|
|
31519
|
-
bodies.push(local,
|
|
31561
|
+
bodies.push(local, body);
|
|
31520
31562
|
central.push(concat([
|
|
31521
31563
|
integer(4, 33639248),
|
|
31522
31564
|
integer(2, 788),
|
|
31523
31565
|
integer(2, 20),
|
|
31524
31566
|
integer(2, 2048),
|
|
31525
|
-
integer(2,
|
|
31567
|
+
integer(2, method),
|
|
31526
31568
|
integer(2, 0),
|
|
31527
31569
|
integer(2, 0),
|
|
31528
31570
|
integer(4, crc),
|
|
31529
|
-
integer(4,
|
|
31571
|
+
integer(4, body.length),
|
|
31530
31572
|
integer(4, entry.data.length),
|
|
31531
31573
|
integer(2, name.length),
|
|
31532
31574
|
integer(2, 0),
|
|
@@ -31537,7 +31579,7 @@ var zip3 = (entries) => {
|
|
|
31537
31579
|
integer(4, offset),
|
|
31538
31580
|
name
|
|
31539
31581
|
]));
|
|
31540
|
-
offset += local.length +
|
|
31582
|
+
offset += local.length + body.length;
|
|
31541
31583
|
}
|
|
31542
31584
|
const directory = concat(central);
|
|
31543
31585
|
return concat([
|
|
@@ -31599,11 +31641,13 @@ import {
|
|
|
31599
31641
|
fsyncSync,
|
|
31600
31642
|
lstatSync,
|
|
31601
31643
|
mkdirSync,
|
|
31644
|
+
mkdtempSync,
|
|
31602
31645
|
openSync,
|
|
31603
31646
|
readFileSync,
|
|
31604
31647
|
realpathSync,
|
|
31605
31648
|
writeFileSync
|
|
31606
31649
|
} from "node:fs";
|
|
31650
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
31607
31651
|
import { join as join4 } from "node:path";
|
|
31608
31652
|
|
|
31609
31653
|
// src/drivers/contain.ts
|
|
@@ -31615,6 +31659,7 @@ var contained = (root, path) => {
|
|
|
31615
31659
|
|
|
31616
31660
|
// src/drivers/workspace.ts
|
|
31617
31661
|
var fail12 = (reason2) => DriverError.make({ reason: reason2, commitment: "before-commit" });
|
|
31662
|
+
var makeCanonicalTemporaryDirectory = (prefix) => realpathSync(mkdtempSync(join4(realpathSync(tmpdir2()), prefix)));
|
|
31618
31663
|
var secureRead = (root, path) => {
|
|
31619
31664
|
let current = root;
|
|
31620
31665
|
for (const part of path.split(/[\\/]+/u)) {
|
|
@@ -31893,9 +31938,11 @@ var causeReason = (cause) => typeof cause === "object" && cause !== null && ("re
|
|
|
31893
31938
|
var canonicalDirectory = (directory) => {
|
|
31894
31939
|
if (!existsSync2(directory))
|
|
31895
31940
|
mkdirSync2(directory, { recursive: true, mode: 448 });
|
|
31896
|
-
|
|
31897
|
-
if (real !== directory)
|
|
31941
|
+
if (lstatSync2(directory).isSymbolicLink())
|
|
31898
31942
|
fail13("Prepared store root must not be a symlink.");
|
|
31943
|
+
const real = realpathSync2(directory);
|
|
31944
|
+
if (!lstatSync2(real).isDirectory())
|
|
31945
|
+
fail13("Prepared store root must be a directory.");
|
|
31899
31946
|
return real;
|
|
31900
31947
|
};
|
|
31901
31948
|
var syncDirectory = (directory) => {
|
|
@@ -31944,20 +31991,20 @@ var validatePublications = (manifest, artifacts) => {
|
|
|
31944
31991
|
}
|
|
31945
31992
|
};
|
|
31946
31993
|
var readBundle = (directory) => {
|
|
31947
|
-
|
|
31948
|
-
if (real !== directory || lstatSync2(directory).isSymbolicLink())
|
|
31994
|
+
if (lstatSync2(directory).isSymbolicLink())
|
|
31949
31995
|
fail13("Prepared bundle directory must not be a symlink.");
|
|
31950
|
-
const
|
|
31996
|
+
const real = realpathSync2(directory);
|
|
31997
|
+
const bytes = secureRead(real, "prepared-release.json").bytes;
|
|
31951
31998
|
const manifest = decodePreparedRelease(bytes);
|
|
31952
31999
|
if (manifest.kind !== "complete")
|
|
31953
32000
|
fail13("Prepared store refuses every unknown or partial bundle kind.");
|
|
31954
32001
|
const manifestDigest = sha256Digest(bytes).hex;
|
|
31955
|
-
if (basename2(
|
|
32002
|
+
if (basename2(real) !== manifestDigest)
|
|
31956
32003
|
fail13("Prepared bundle directory does not match its manifest digest.");
|
|
31957
|
-
const entries = readdirSync(
|
|
32004
|
+
const entries = readdirSync(real, { withFileTypes: true });
|
|
31958
32005
|
if (entries.some((entry) => entry.name !== "prepared-release.json" && entry.name !== "blobs"))
|
|
31959
32006
|
fail13("Prepared bundle contains an unexpected top-level entry.");
|
|
31960
|
-
const blobDirectory = join5(
|
|
32007
|
+
const blobDirectory = join5(real, "blobs");
|
|
31961
32008
|
if (!existsSync2(blobDirectory) || lstatSync2(blobDirectory).isSymbolicLink() || !statSync(blobDirectory).isDirectory())
|
|
31962
32009
|
fail13("Prepared bundle is missing its real blobs directory.");
|
|
31963
32010
|
const artifacts = artifactsById(manifest);
|
|
@@ -31972,7 +32019,7 @@ var readBundle = (directory) => {
|
|
|
31972
32019
|
fail13("Prepared bundle blob set does not match its manifest.");
|
|
31973
32020
|
const blobs = new Map;
|
|
31974
32021
|
for (const artifact of artifacts.values()) {
|
|
31975
|
-
const blob = secureRead(
|
|
32022
|
+
const blob = secureRead(real, `blobs/${artifact.blob.hex}`).bytes;
|
|
31976
32023
|
if (blob.length !== artifact.size || !digestEquals(sha256Digest(blob), artifact.digest))
|
|
31977
32024
|
fail13(`Prepared blob ${artifact.id} failed size or digest verification.`);
|
|
31978
32025
|
blobs.set(artifact.id.toString(), new Uint8Array(blob));
|
|
@@ -33001,11 +33048,11 @@ var runtimeIdentity = (bunVersion, isolation, bunCompileRuntimes, npmPack, relea
|
|
|
33001
33048
|
bunCompileRuntimes: bunCompileRuntimes.length === 0 ? "not-used" : encodeCanonicalJson(bunCompileRuntimes),
|
|
33002
33049
|
npmPack: npmPack === undefined ? "not-used" : encodeCanonicalJson(npmPack),
|
|
33003
33050
|
releaseGraph,
|
|
33004
|
-
preparer: "@mannyc1/ts-release@0.
|
|
33051
|
+
preparer: "@mannyc1/ts-release@0.3.0"
|
|
33005
33052
|
});
|
|
33006
33053
|
var prepareRelease = fn2("prepareRelease")(function* (input) {
|
|
33007
33054
|
const sourceRoot = input.context.workspace.toString();
|
|
33008
|
-
const root = yield* attempt(() =>
|
|
33055
|
+
const root = yield* attempt(() => makeCanonicalTemporaryDirectory("ts-release-prepare-"));
|
|
33009
33056
|
try {
|
|
33010
33057
|
const sourceSnapshot = yield* input.materializeSource(input.context, WorkspaceRoot.make(root)).pipe(mapError3(failure3));
|
|
33011
33058
|
const context3 = stagedContext(input.context, root);
|
|
@@ -34666,7 +34713,6 @@ import {
|
|
|
34666
34713
|
copyFileSync as copyFileSync2,
|
|
34667
34714
|
lstatSync as lstatSync6,
|
|
34668
34715
|
mkdirSync as mkdirSync6,
|
|
34669
|
-
mkdtempSync as mkdtempSync2,
|
|
34670
34716
|
readFileSync as readFileSync6,
|
|
34671
34717
|
readdirSync as readdirSync5,
|
|
34672
34718
|
realpathSync as realpathSync7,
|
|
@@ -34674,7 +34720,6 @@ import {
|
|
|
34674
34720
|
statSync as statSync3,
|
|
34675
34721
|
writeFileSync as writeFileSync3
|
|
34676
34722
|
} from "node:fs";
|
|
34677
|
-
import { tmpdir as tmpdir3 } from "node:os";
|
|
34678
34723
|
import { delimiter, isAbsolute as isAbsolute6, join as join9, resolve as resolve7 } from "node:path";
|
|
34679
34724
|
|
|
34680
34725
|
// node_modules/effect/dist/ConfigProvider.js
|
|
@@ -35252,7 +35297,7 @@ var makeRunCommand = gen2(function* () {
|
|
|
35252
35297
|
const compileTarget = certifiedBunCompileTarget(command2);
|
|
35253
35298
|
const compileRuntime = compileTarget === undefined ? undefined : yield* resolveBunCompileRuntime(compileTarget, tool);
|
|
35254
35299
|
const compileResources = compileRuntime === undefined ? undefined : yield* acquireRelease2(sync2(() => {
|
|
35255
|
-
const directory =
|
|
35300
|
+
const directory = makeCanonicalTemporaryDirectory("ts-release-bun-runtime-");
|
|
35256
35301
|
const cache = join9(directory, "cache");
|
|
35257
35302
|
mkdirSync6(cache, { mode: 448 });
|
|
35258
35303
|
if (compileRuntime.sourcePath !== undefined) {
|
|
@@ -35266,7 +35311,7 @@ var makeRunCommand = gen2(function* () {
|
|
|
35266
35311
|
rmSync3(directory, { recursive: true, force: true });
|
|
35267
35312
|
}));
|
|
35268
35313
|
const isolationResources = command2.network === "deny" ? yield* acquireRelease2(sync2(() => {
|
|
35269
|
-
const directory =
|
|
35314
|
+
const directory = makeCanonicalTemporaryDirectory("ts-release-seccomp-");
|
|
35270
35315
|
const helper = join9(directory, "network-deny.mjs");
|
|
35271
35316
|
const identity2 = join9(directory, "identity.json");
|
|
35272
35317
|
writeFileSync3(helper, networkIsolationHelperSource, { mode: 320 });
|
|
@@ -35328,8 +35373,8 @@ var makeRunCommand = gen2(function* () {
|
|
|
35328
35373
|
|
|
35329
35374
|
// src/platform/credentials.ts
|
|
35330
35375
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
35331
|
-
import { chmod as chmod3, copyFile as copyFile3, mkdir as mkdir2, mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile3 } from "node:fs/promises";
|
|
35332
|
-
import { tmpdir as
|
|
35376
|
+
import { chmod as chmod3, copyFile as copyFile3, mkdir as mkdir2, mkdtemp as mkdtemp2, readFile as readFile3, realpath as realpath2, rm as rm2, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
|
|
35377
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
35333
35378
|
import { basename as basename4, isAbsolute as isAbsolute7, join as join10, resolve as resolve8 } from "node:path";
|
|
35334
35379
|
var Semver5 = __toESM(require_semver2(), 1);
|
|
35335
35380
|
class CredentialPlatformError extends TaggedErrorClass()("CredentialPlatformError", {
|
|
@@ -35666,7 +35711,7 @@ var makeNpmUserConfigResource = (vault, temporaryRoot) => ({
|
|
|
35666
35711
|
}
|
|
35667
35712
|
yield* checkAudience(input.operation.subject, input.operation.audience, input.registryUrl);
|
|
35668
35713
|
const token = yield* lookupToken(vault, grant.subject, grant.ref);
|
|
35669
|
-
const root = temporaryRoot ??
|
|
35714
|
+
const root = temporaryRoot ?? tmpdir3();
|
|
35670
35715
|
const handle = makeNpmUserConfigHandle();
|
|
35671
35716
|
const acquired = tryPromise2({
|
|
35672
35717
|
try: async () => {
|
|
@@ -35674,11 +35719,20 @@ var makeNpmUserConfigResource = (vault, temporaryRoot) => ({
|
|
|
35674
35719
|
const directory = await mkdtemp2(join10(root, "ts-release-npm-"));
|
|
35675
35720
|
try {
|
|
35676
35721
|
const path = join10(directory, "userconfig");
|
|
35722
|
+
const globalConfigPath = join10(directory, "globalconfig");
|
|
35677
35723
|
const contents = `${npmAuthLine(input.registryUrl, token)}
|
|
35678
35724
|
ignore-scripts=true
|
|
35679
35725
|
`;
|
|
35680
35726
|
await writeFile3(path, contents, { mode: 384, flag: "wx" });
|
|
35681
|
-
|
|
35727
|
+
await writeFile3(globalConfigPath, "", { mode: 384, flag: "wx" });
|
|
35728
|
+
npmUserConfigs.set(handle, {
|
|
35729
|
+
directory,
|
|
35730
|
+
path,
|
|
35731
|
+
globalConfigPath,
|
|
35732
|
+
subject: input.operation.subject,
|
|
35733
|
+
grant,
|
|
35734
|
+
token
|
|
35735
|
+
});
|
|
35682
35736
|
return handle;
|
|
35683
35737
|
} catch (cause) {
|
|
35684
35738
|
await rm2(directory, { recursive: true, force: true });
|
|
@@ -35713,6 +35767,53 @@ var optionalPath = option2(string4("PATH")).pipe(map5(getOrUndefined), orElseSuc
|
|
|
35713
35767
|
return;
|
|
35714
35768
|
}));
|
|
35715
35769
|
var closedBaseEnvironment = (path) => path === undefined ? {} : { PATH: path };
|
|
35770
|
+
var optionalReleaseHome = option2(string4("TS_RELEASE_HOME")).pipe(map5(getOrUndefined), orElseSucceed2(() => {
|
|
35771
|
+
return;
|
|
35772
|
+
}));
|
|
35773
|
+
var privateTrustedNpmEnvironment = fn2("CertifiedPublisherSpawn.privateTrustedNpmEnvironment")(function* (grant) {
|
|
35774
|
+
const configured = yield* optionalReleaseHome;
|
|
35775
|
+
if (configured === undefined || !isAbsolute7(configured) || resolve8(configured) !== configured) {
|
|
35776
|
+
return yield* new CredentialUnavailable({
|
|
35777
|
+
subject: grant.subject,
|
|
35778
|
+
provider: grant.provider,
|
|
35779
|
+
purpose: "publish",
|
|
35780
|
+
reason: "Trusted npm publishing requires one canonical absolute TS_RELEASE_HOME."
|
|
35781
|
+
});
|
|
35782
|
+
}
|
|
35783
|
+
return yield* tryPromise2({
|
|
35784
|
+
try: async () => {
|
|
35785
|
+
const canonicalHome = await realpath2(configured);
|
|
35786
|
+
if (canonicalHome !== configured)
|
|
35787
|
+
throw new Error("TS_RELEASE_HOME is not canonical.");
|
|
35788
|
+
const homeMetadata = await stat3(canonicalHome);
|
|
35789
|
+
const owner = typeof process.getuid === "function" ? process.getuid() : undefined;
|
|
35790
|
+
if (!homeMetadata.isDirectory() || (homeMetadata.mode & 63) !== 0 || owner !== undefined && homeMetadata.uid !== owner) {
|
|
35791
|
+
throw new Error("TS_RELEASE_HOME is not one private caller-owned directory.");
|
|
35792
|
+
}
|
|
35793
|
+
const userConfig = join10(canonicalHome, "npm-userconfig");
|
|
35794
|
+
const globalConfig = join10(canonicalHome, "npm-globalconfig");
|
|
35795
|
+
for (const path of [userConfig, globalConfig]) {
|
|
35796
|
+
if (await realpath2(path) !== path)
|
|
35797
|
+
throw new Error("A trusted npm config path is not canonical.");
|
|
35798
|
+
const metadata = await stat3(path);
|
|
35799
|
+
if (!metadata.isFile() || (metadata.mode & 511) !== 384 || owner !== undefined && metadata.uid !== owner || (await readFile3(path)).length !== 0) {
|
|
35800
|
+
throw new Error("A trusted npm config is not an empty private caller-owned file.");
|
|
35801
|
+
}
|
|
35802
|
+
}
|
|
35803
|
+
return {
|
|
35804
|
+
HOME: canonicalHome,
|
|
35805
|
+
NPM_CONFIG_USERCONFIG: userConfig,
|
|
35806
|
+
NPM_CONFIG_GLOBALCONFIG: globalConfig
|
|
35807
|
+
};
|
|
35808
|
+
},
|
|
35809
|
+
catch: () => new CredentialUnavailable({
|
|
35810
|
+
subject: grant.subject,
|
|
35811
|
+
provider: grant.provider,
|
|
35812
|
+
purpose: "publish",
|
|
35813
|
+
reason: "Trusted npm publishing requires validated empty private npm configuration files."
|
|
35814
|
+
})
|
|
35815
|
+
});
|
|
35816
|
+
});
|
|
35716
35817
|
var workloadEnvironment = fn2("CertifiedPublisherSpawn.workloadEnvironment")(function* (trustedWorkloads, grant) {
|
|
35717
35818
|
if (grant.names.size !== oidcNames.length || oidcNames.some((name) => !grant.names.has(name))) {
|
|
35718
35819
|
return yield* new CredentialStrategyUnsupported({
|
|
@@ -35732,7 +35833,11 @@ var workloadEnvironment = fn2("CertifiedPublisherSpawn.workloadEnvironment")(fun
|
|
|
35732
35833
|
});
|
|
35733
35834
|
}
|
|
35734
35835
|
const path = yield* optionalPath;
|
|
35735
|
-
const
|
|
35836
|
+
const privateEnvironment = yield* privateTrustedNpmEnvironment(grant);
|
|
35837
|
+
const env = {
|
|
35838
|
+
...closedBaseEnvironment(path),
|
|
35839
|
+
...privateEnvironment
|
|
35840
|
+
};
|
|
35736
35841
|
for (const name of oidcNames) {
|
|
35737
35842
|
const value3 = material.oidc.get(name);
|
|
35738
35843
|
if (value3 === undefined) {
|
|
@@ -35878,7 +35983,9 @@ var publisherEnvironment = fn2("CertifiedPublisherSpawn.environment")(function*
|
|
|
35878
35983
|
const path = yield* optionalPath;
|
|
35879
35984
|
return {
|
|
35880
35985
|
...closedBaseEnvironment(path),
|
|
35986
|
+
HOME: metadata.directory,
|
|
35881
35987
|
NPM_CONFIG_USERCONFIG: metadata.path,
|
|
35988
|
+
NPM_CONFIG_GLOBALCONFIG: metadata.globalConfigPath,
|
|
35882
35989
|
NPM_CONFIG_IGNORE_SCRIPTS: "true"
|
|
35883
35990
|
};
|
|
35884
35991
|
}
|
|
@@ -35899,7 +36006,7 @@ var redactPublisherOutput = (value3, env, spec) => {
|
|
|
35899
36006
|
return redactOutput(value3, known);
|
|
35900
36007
|
};
|
|
35901
36008
|
var makeNpmPublishTransport = (sourcePath, temporaryRoot) => {
|
|
35902
|
-
const root = temporaryRoot ??
|
|
36009
|
+
const root = temporaryRoot ?? tmpdir3();
|
|
35903
36010
|
const acquired = tryPromise2({
|
|
35904
36011
|
try: async () => {
|
|
35905
36012
|
await mkdir2(root, { recursive: true, mode: 448 });
|
|
@@ -39222,7 +39329,7 @@ var makeCli = (makeApi, cwd, io) => {
|
|
|
39222
39329
|
};
|
|
39223
39330
|
|
|
39224
39331
|
// apps/release-ts/src/cli/node-main.ts
|
|
39225
|
-
var version3 = "0.
|
|
39332
|
+
var version3 = "0.3.0";
|
|
39226
39333
|
var hostRefusal = unsupportedExecutionHost(process.platform);
|
|
39227
39334
|
if (hostRefusal !== undefined) {
|
|
39228
39335
|
console.error(hostRefusal);
|
|
@@ -3,6 +3,7 @@ export interface ArchiveEntry {
|
|
|
3
3
|
readonly data: Uint8Array;
|
|
4
4
|
readonly mode: number;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export type ZipCompression = "store" | "deflate";
|
|
7
|
+
export declare const zip: (entries: ReadonlyArray<ArchiveEntry>, compression?: ZipCompression) => Uint8Array;
|
|
7
8
|
export declare const tarGz: (entries: ReadonlyArray<ArchiveEntry>) => Uint8Array;
|
|
8
9
|
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/drivers/archive.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA8BD,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../src/drivers/archive.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA8BD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAA;AAEhD,eAAO,MAAM,GAAG,GACd,SAAS,aAAa,CAAC,YAAY,CAAC,EACpC,cAAa,cAAwB,KACpC,UAgCF,CAAA;AA6BD,eAAO,MAAM,KAAK,GAAI,SAAS,aAAa,CAAC,YAAY,CAAC,KAAG,UAQ5D,CAAA"}
|
package/dist/drivers/archive.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gzipSync } from "node:zlib";
|
|
1
|
+
import { deflateRawSync, gzipSync } from "node:zlib";
|
|
2
2
|
const text = (value) => new TextEncoder().encode(value);
|
|
3
3
|
const concat = (parts) => {
|
|
4
4
|
const output = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
@@ -31,27 +31,31 @@ const crc32 = (data) => {
|
|
|
31
31
|
crc = (crc >>> 8) ^ crcTable[(crc ^ byte) & 0xff];
|
|
32
32
|
return (crc ^ 0xffffffff) >>> 0;
|
|
33
33
|
};
|
|
34
|
-
export const zip = (entries) => {
|
|
34
|
+
export const zip = (entries, compression = "store") => {
|
|
35
35
|
const bodies = [];
|
|
36
36
|
const central = [];
|
|
37
37
|
let offset = 0;
|
|
38
38
|
for (const entry of entries) {
|
|
39
39
|
const name = text(entry.path);
|
|
40
40
|
const crc = crc32(entry.data);
|
|
41
|
+
const method = compression === "deflate" ? 8 : 0;
|
|
42
|
+
const body = compression === "deflate"
|
|
43
|
+
? new Uint8Array(deflateRawSync(entry.data, { level: 9 }))
|
|
44
|
+
: entry.data;
|
|
41
45
|
const local = concat([
|
|
42
|
-
integer(4, 0x04034b50), integer(2, 20), integer(2, 0x0800), integer(2,
|
|
43
|
-
integer(2, 0), integer(2, 0), integer(4, crc), integer(4,
|
|
46
|
+
integer(4, 0x04034b50), integer(2, 20), integer(2, 0x0800), integer(2, method),
|
|
47
|
+
integer(2, 0), integer(2, 0), integer(4, crc), integer(4, body.length),
|
|
44
48
|
integer(4, entry.data.length), integer(2, name.length), integer(2, 0), name
|
|
45
49
|
]);
|
|
46
|
-
bodies.push(local,
|
|
50
|
+
bodies.push(local, body);
|
|
47
51
|
central.push(concat([
|
|
48
52
|
integer(4, 0x02014b50), integer(2, 0x0314), integer(2, 20), integer(2, 0x0800),
|
|
49
|
-
integer(2,
|
|
50
|
-
integer(4,
|
|
53
|
+
integer(2, method), integer(2, 0), integer(2, 0), integer(4, crc),
|
|
54
|
+
integer(4, body.length), integer(4, entry.data.length), integer(2, name.length),
|
|
51
55
|
integer(2, 0), integer(2, 0), integer(2, 0), integer(2, 0),
|
|
52
56
|
integer(4, entry.mode << 16), integer(4, offset), name
|
|
53
57
|
]));
|
|
54
|
-
offset += local.length +
|
|
58
|
+
offset += local.length + body.length;
|
|
55
59
|
}
|
|
56
60
|
const directory = concat(central);
|
|
57
61
|
return concat([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/drivers/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/drivers/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAOpD,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,MAAM,MAAM,GAAG,CAAC,KAAgC,EAAc,EAAE;IAC9D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IACpF,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,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AC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACvE,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,IAAI;QAC5B,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;KAClF,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClD,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACpB,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAChB,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/drivers/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/drivers/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAA;AAqBjF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,oCAAoC,CAAA;IACvD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,UAAU,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,MAAM,CAAC;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD;8DAC0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IACtC;iFAC6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAA;CACzC,KAAK,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;AAoJhD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAuH7E,CAAA"}
|
package/dist/drivers/process.js
CHANGED
|
@@ -3,14 +3,14 @@ import * as Stream from "effect/Stream";
|
|
|
3
3
|
import * as ChildProcess from "effect/unstable/process/ChildProcess";
|
|
4
4
|
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
-
import { accessSync, chmodSync, constants, copyFileSync, lstatSync, mkdirSync,
|
|
7
|
-
import { tmpdir } from "node:os";
|
|
6
|
+
import { accessSync, chmodSync, constants, copyFileSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
8
7
|
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
9
8
|
import { readEnvironment, readOptionalEnv } from "./environment.js";
|
|
10
9
|
import { redactOutput, redactProtocolOutput } from "./redact.js";
|
|
11
10
|
import { networkIsolationHelperSource } from "./seccomp-helper-source.js";
|
|
12
11
|
import { failure } from "./utils.js";
|
|
13
12
|
import { DriverError } from "./errors.js";
|
|
13
|
+
import { makeCanonicalTemporaryDirectory } from "./workspace.js";
|
|
14
14
|
const helperDigest = createHash("sha256").update(networkIsolationHelperSource).digest("hex");
|
|
15
15
|
const collect = (stream) => Stream.mkString(Stream.decodeText(stream));
|
|
16
16
|
const executableIdentity = (command, cwd, path) => {
|
|
@@ -169,7 +169,7 @@ export const makeRunCommand = Effect.gen(function* () {
|
|
|
169
169
|
const compileResources = compileRuntime === undefined
|
|
170
170
|
? undefined
|
|
171
171
|
: yield* Effect.acquireRelease(Effect.sync(() => {
|
|
172
|
-
const directory =
|
|
172
|
+
const directory = makeCanonicalTemporaryDirectory("ts-release-bun-runtime-");
|
|
173
173
|
const cache = join(directory, "cache");
|
|
174
174
|
mkdirSync(cache, { mode: 0o700 });
|
|
175
175
|
if (compileRuntime.sourcePath !== undefined) {
|
|
@@ -184,7 +184,7 @@ export const makeRunCommand = Effect.gen(function* () {
|
|
|
184
184
|
}));
|
|
185
185
|
const isolationResources = command.network === "deny"
|
|
186
186
|
? yield* Effect.acquireRelease(Effect.sync(() => {
|
|
187
|
-
const directory =
|
|
187
|
+
const directory = makeCanonicalTemporaryDirectory("ts-release-seccomp-");
|
|
188
188
|
const helper = join(directory, "network-deny.mjs");
|
|
189
189
|
const identity = join(directory, "identity.json");
|
|
190
190
|
writeFileSync(helper, networkIsolationHelperSource, { mode: 0o500 });
|