@r_masseater/vite-plus-adopt 0.10.2 → 0.11.1
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/README.md +6 -13
- package/dist/attw.mjs +5 -11
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +21 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/fsd.d.mts +1 -1
- package/dist/fsd.mjs +3 -5
- package/dist/fsd.mjs.map +1 -1
- package/dist/{index-HO_uRepr.d.mts → index-DyvYt7R0.d.mts} +11 -47
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -3
- package/dist/{vpa-B3VOYbg1.mjs → vpa-MRYbih3E.mjs} +168 -205
- package/dist/vpa-MRYbih3E.mjs.map +1 -0
- package/package.json +45 -44
- package/skills/configure-checks/SKILL.md +13 -18
- package/dist/output-BdvTIQ-k.mjs +0 -223
- package/dist/output-BdvTIQ-k.mjs.map +0 -1
- package/dist/postinstall.d.mts +0 -1
- package/dist/postinstall.mjs +0 -19
- package/dist/postinstall.mjs.map +0 -1
- package/dist/run-cli-BiPFbX9J.mjs +0 -24
- package/dist/run-cli-BiPFbX9J.mjs.map +0 -1
- package/dist/vpa-B3VOYbg1.mjs.map +0 -1
package/dist/output-BdvTIQ-k.mjs
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { Array, Context, Effect, FileSystem, Function, Option, Path, Record, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
2
|
-
import { HttpClient } from "effect/http";
|
|
3
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
|
-
import { Tar } from "effect/encoding";
|
|
5
|
-
import { encode } from "effect/encoding/Hex";
|
|
6
|
-
import { unzip } from "fflate";
|
|
7
|
-
// src/shared/lib/errors.ts
|
|
8
|
-
const taggedError = Schema.TaggedError;
|
|
9
|
-
var VpToolsError = class extends taggedError()("VpToolsError", {
|
|
10
|
-
kind: Schema.Literals([
|
|
11
|
-
"config-missing",
|
|
12
|
-
"tool-failed",
|
|
13
|
-
"checks-failed"
|
|
14
|
-
]),
|
|
15
|
-
message: Schema.String
|
|
16
|
-
}) {};
|
|
17
|
-
const configMissing = (message) => VpToolsError.make({
|
|
18
|
-
kind: "config-missing",
|
|
19
|
-
message
|
|
20
|
-
});
|
|
21
|
-
const checksFailed = (message) => VpToolsError.make({
|
|
22
|
-
kind: "checks-failed",
|
|
23
|
-
message
|
|
24
|
-
});
|
|
25
|
-
const toolFailed = (tool) => (cause) => VpToolsError.make({
|
|
26
|
-
kind: "tool-failed",
|
|
27
|
-
message: `${tool} failed: ${String(cause)}`
|
|
28
|
-
});
|
|
29
|
-
// src/shared/lib/attempt.ts
|
|
30
|
-
const attempt = (tool) => (run) => Effect.tryPromise({
|
|
31
|
-
try: run,
|
|
32
|
-
catch: toolFailed(tool)
|
|
33
|
-
});
|
|
34
|
-
// src/shared/lib/process.ts
|
|
35
|
-
const SUCCESS = 0;
|
|
36
|
-
const stdinOf = (input) => pipe(Option.fromNullishOr(input), Option.match({
|
|
37
|
-
onNone: () => "ignore",
|
|
38
|
-
onSome: (text) => Stream.make(new TextEncoder().encode(text))
|
|
39
|
-
}));
|
|
40
|
-
/** @internal */
|
|
41
|
-
const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => Effect.gen(function* run() {
|
|
42
|
-
const handle = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).spawn(ChildProcess.make(file, args, {
|
|
43
|
-
cwd: root,
|
|
44
|
-
env,
|
|
45
|
-
extendEnv: true,
|
|
46
|
-
stdin: stdinOf(input)
|
|
47
|
-
}));
|
|
48
|
-
const [text, exitCode] = yield* Effect.all([handle[output].pipe(Stream.decodeText, Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
49
|
-
return {
|
|
50
|
-
valid: exitCode === SUCCESS,
|
|
51
|
-
output: text
|
|
52
|
-
};
|
|
53
|
-
}).pipe(Effect.scoped);
|
|
54
|
-
// src/shared/lib/tar-gz.ts
|
|
55
|
-
const gunzipped = (data) => {
|
|
56
|
-
const compressed = new Blob([new Uint8Array(data)]).stream();
|
|
57
|
-
return attempt("gunzip")(() => new Response(compressed.pipeThrough(new DecompressionStream("gzip"))).arrayBuffer());
|
|
58
|
-
};
|
|
59
|
-
const untarred = (archive) => Stream.make(new Uint8Array(archive)).pipe(Stream.pipeThroughChannel(Tar.decode()), Stream.mapEffect(({ header, body }) => Effect.map(Stream.mkUint8Array(body), (bytes) => ({
|
|
60
|
-
header,
|
|
61
|
-
bytes
|
|
62
|
-
}))), Stream.runCollect, Effect.mapError(toolFailed("untar")));
|
|
63
|
-
/** @internal */
|
|
64
|
-
const readTarGz = (data) => Effect.flatMap(gunzipped(data), untarred);
|
|
65
|
-
// src/entities/binary/model/binaries.ts
|
|
66
|
-
const archiveOf = (file) => {
|
|
67
|
-
if (String$1.endsWith(".zip")(file)) return "zip";
|
|
68
|
-
return "tar.gz";
|
|
69
|
-
};
|
|
70
|
-
const releaseAsset = (release) => (file, sha256) => ({
|
|
71
|
-
url: `${release}/${file}`,
|
|
72
|
-
sha256,
|
|
73
|
-
archive: archiveOf(file)
|
|
74
|
-
});
|
|
75
|
-
const betterleaksAsset = releaseAsset("https://github.com/betterleaks/betterleaks/releases/download/v2.0.0-rc.7");
|
|
76
|
-
const BETTERLEAKS = {
|
|
77
|
-
name: "betterleaks",
|
|
78
|
-
version: "2.0.0-rc.7",
|
|
79
|
-
assets: {
|
|
80
|
-
"darwin-arm64": betterleaksAsset("betterleaks_2.0.0-rc.7_darwin_arm64.tar.gz", "d5052b4789752e3d9995c0b71a5b531aea747455ba4f8d1534c90b41e03f906c"),
|
|
81
|
-
"darwin-x64": betterleaksAsset("betterleaks_2.0.0-rc.7_darwin_x64.tar.gz", "b3be0c6b4b91036a6d8b98e47642470a5a872d4bff08b8ee34348e9baf1e3434"),
|
|
82
|
-
"linux-arm64": betterleaksAsset("betterleaks_2.0.0-rc.7_linux_arm64.tar.gz", "32fcd5a77d7c3c2d97cc615c5d70344d0c62b5a36f38568ce8ec72e62783acad"),
|
|
83
|
-
"linux-x64": betterleaksAsset("betterleaks_2.0.0-rc.7_linux_x64.tar.gz", "230ef42dc3a0ee35e5148b7b4e9280224a412ef100cd4e74d3d6681d94e6ccb8"),
|
|
84
|
-
"win32-x64": betterleaksAsset("betterleaks_2.0.0-rc.7_windows_x64.zip", "36db668ba12b55537a11cc45cd61565ab7f4f23ce606e0827206f49048a5183e")
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const actionlintAsset = releaseAsset("https://github.com/rhysd/actionlint/releases/download/v1.7.12");
|
|
88
|
-
const ACTIONLINT = {
|
|
89
|
-
name: "actionlint",
|
|
90
|
-
version: "1.7.12",
|
|
91
|
-
assets: {
|
|
92
|
-
"darwin-arm64": actionlintAsset("actionlint_1.7.12_darwin_arm64.tar.gz", "aba9ced2dee8d27fecca3dc7feb1a7f9a52caefa1eb46f3271ea66b6e0e6953f"),
|
|
93
|
-
"darwin-x64": actionlintAsset("actionlint_1.7.12_darwin_amd64.tar.gz", "5b44c3bc2255115c9b69e30efc0fecdf498fdb63c5d58e17084fd5f16324c644"),
|
|
94
|
-
"linux-arm64": actionlintAsset("actionlint_1.7.12_linux_arm64.tar.gz", "325e971b6ba9bfa504672e29be93c24981eeb1c07576d730e9f7c8805afff0c6"),
|
|
95
|
-
"linux-x64": actionlintAsset("actionlint_1.7.12_linux_amd64.tar.gz", "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8"),
|
|
96
|
-
"win32-x64": actionlintAsset("actionlint_1.7.12_windows_amd64.zip", "6e7241b51e6817ea6a047693d8e6fed13b31819c9a0dd6c5a726e1592d22f6e9")
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const zizmorAsset = releaseAsset("https://github.com/zizmorcore/zizmor/releases/download/v1.32.0");
|
|
100
|
-
const ZIZMOR = {
|
|
101
|
-
name: "zizmor",
|
|
102
|
-
version: "1.32.0",
|
|
103
|
-
assets: {
|
|
104
|
-
"darwin-arm64": zizmorAsset("zizmor-aarch64-apple-darwin.tar.gz", "6efed18c4539a663fd3c851a2be9533fd8456c4e646d9416206da059154a0d3c"),
|
|
105
|
-
"darwin-x64": zizmorAsset("zizmor-x86_64-apple-darwin.tar.gz", "6983143c719ada6845a69cc4dd2bacc215f971662fecd8bbd2678388e5ce5969"),
|
|
106
|
-
"linux-arm64": zizmorAsset("zizmor-aarch64-unknown-linux-gnu.tar.gz", "cb152b207f815116d7fa1c1ee4614f61578803351395052908095e79adfd9fd0"),
|
|
107
|
-
"linux-x64": zizmorAsset("zizmor-x86_64-unknown-linux-gnu.tar.gz", "bb110cc765eca9cd7efb2e284a956be5974c60027b0970f16397d86208a9957b"),
|
|
108
|
-
"win32-x64": zizmorAsset("zizmor-x86_64-pc-windows-msvc.zip", "d284a16e09d9df4ce2c000357e7b59bd531be093bea5718a1ce225b449b59d49")
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const PLATFORMS = [
|
|
112
|
-
"darwin-arm64",
|
|
113
|
-
"darwin-x64",
|
|
114
|
-
"linux-arm64",
|
|
115
|
-
"linux-x64",
|
|
116
|
-
"win32-x64"
|
|
117
|
-
];
|
|
118
|
-
// src/entities/binary/model/vendor.ts
|
|
119
|
-
const VendorDirectory = Context.Reference("vite-plus-adopt/VendorDirectory", { defaultValue: () => `${import.meta.dirname}/../vendor` });
|
|
120
|
-
// src/entities/binary/model/install.ts
|
|
121
|
-
const EXECUTABLE = 493;
|
|
122
|
-
const NOT_INSTALLED = "was not installed. Allow the postinstall of @r_masseater/vite-plus-adopt in allowBuilds of pnpm-workspace.yaml and run vp install.";
|
|
123
|
-
const currentPlatform = () => Array.findFirst(PLATFORMS, (platform) => platform === `${process.platform}-${process.arch}`);
|
|
124
|
-
const executableName = (binary, platform) => {
|
|
125
|
-
if (platform === "win32-x64") return `${binary.name}.exe`;
|
|
126
|
-
return binary.name;
|
|
127
|
-
};
|
|
128
|
-
const assetOf = ({ binary, platform }) => binary.assets[platform];
|
|
129
|
-
const download = (binary, asset) => Effect.gen(function* fetchAsset() {
|
|
130
|
-
const httpClient = yield* HttpClient.HttpClient;
|
|
131
|
-
const body = yield* (yield* HttpClient.filterStatusOk(httpClient).get(asset.url)).arrayBuffer;
|
|
132
|
-
return new Uint8Array(body);
|
|
133
|
-
}).pipe(Effect.mapError(toolFailed(binary.name)));
|
|
134
|
-
const verify = (fetched) => {
|
|
135
|
-
const asset = assetOf(fetched);
|
|
136
|
-
const failed = toolFailed(fetched.binary.name);
|
|
137
|
-
const data = new Uint8Array(fetched.data);
|
|
138
|
-
return attempt(fetched.binary.name)(() => crypto.subtle.digest("SHA-256", data)).pipe(Effect.map((digest) => encode(new Uint8Array(digest))), Effect.filterOrFail((digest) => digest === asset.sha256, (digest) => failed(`${asset.url} has SHA-256 ${digest}, expected ${asset.sha256}`)), Effect.as(fetched));
|
|
139
|
-
};
|
|
140
|
-
const tarEntries = (data) => readTarGz(data).pipe(Effect.map(Array.map(({ header, bytes }) => [header.path, bytes])), Effect.map((entries) => new Map(entries)));
|
|
141
|
-
const zipEntries = (data) => Effect.callback((resume) => {
|
|
142
|
-
unzip(data, (failure, files) => {
|
|
143
|
-
if (failure === null) {
|
|
144
|
-
const entries = new Map(Record.toEntries(files));
|
|
145
|
-
resume(Effect.succeed(entries));
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
resume(Effect.fail(toolFailed("unzip")(failure)));
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
const entriesOf = (asset) => {
|
|
152
|
-
if (asset.archive === "zip") return zipEntries;
|
|
153
|
-
return tarEntries;
|
|
154
|
-
};
|
|
155
|
-
const extract = (fetched) => {
|
|
156
|
-
const asset = assetOf(fetched);
|
|
157
|
-
const executable = executableName(fetched.binary, fetched.platform);
|
|
158
|
-
return entriesOf(asset)(fetched.data).pipe(Effect.flatMap((files) => Effect.fromNullishOr(files.get(executable))), Effect.mapError(() => toolFailed(fetched.binary.name)(`${asset.url} has no ${executable}`)));
|
|
159
|
-
};
|
|
160
|
-
const binaryPath = (binary, platform) => Effect.gen(function* vendoredPath() {
|
|
161
|
-
const path = yield* Path.Path;
|
|
162
|
-
const vendor = yield* VendorDirectory;
|
|
163
|
-
return path.join(vendor, binary.name, binary.version, executableName(binary, platform));
|
|
164
|
-
});
|
|
165
|
-
const place = (fetched, bytes) => Effect.gen(function* write() {
|
|
166
|
-
const fs = yield* FileSystem.FileSystem;
|
|
167
|
-
const path = yield* Path.Path;
|
|
168
|
-
const file = yield* binaryPath(fetched.binary, fetched.platform);
|
|
169
|
-
yield* fs.makeDirectory(path.dirname(file), { recursive: true });
|
|
170
|
-
yield* Effect.scoped(Effect.gen(function* stage() {
|
|
171
|
-
const staging = yield* fs.makeTempDirectoryScoped({
|
|
172
|
-
directory: path.dirname(file),
|
|
173
|
-
prefix: ".partial-"
|
|
174
|
-
});
|
|
175
|
-
const partial = path.join(staging, path.basename(file));
|
|
176
|
-
yield* fs.writeFile(partial, bytes);
|
|
177
|
-
yield* fs.chmod(partial, EXECUTABLE);
|
|
178
|
-
yield* fs.rename(partial, file);
|
|
179
|
-
}));
|
|
180
|
-
});
|
|
181
|
-
const unpack = (fetched) => verify(fetched).pipe(Effect.flatMap(extract), Effect.flatMap((bytes) => place(fetched, bytes)));
|
|
182
|
-
const platformOf = (binary) => pipe(currentPlatform(), Effect.fromOption, Effect.mapError(() => toolFailed(binary.name)(`no release for ${process.platform}-${process.arch}`)));
|
|
183
|
-
const isPlaced = (binary, platform) => Effect.gen(function* placed() {
|
|
184
|
-
const fs = yield* FileSystem.FileSystem;
|
|
185
|
-
const file = yield* binaryPath(binary, platform);
|
|
186
|
-
return yield* fs.exists(file);
|
|
187
|
-
});
|
|
188
|
-
/** @internal */
|
|
189
|
-
const installBinary = (binary) => Effect.gen(function* install() {
|
|
190
|
-
const platform = yield* platformOf(binary);
|
|
191
|
-
if (yield* isPlaced(binary, platform)) return;
|
|
192
|
-
const data = yield* download(binary, binary.assets[platform]);
|
|
193
|
-
yield* unpack({
|
|
194
|
-
binary,
|
|
195
|
-
platform,
|
|
196
|
-
data
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
/** @internal */
|
|
200
|
-
const locateBinary = (binary) => Effect.gen(function* locate() {
|
|
201
|
-
const platform = yield* platformOf(binary);
|
|
202
|
-
if (!(yield* isPlaced(binary, platform))) return yield* configMissing(`${binary.name} ${binary.version} ${NOT_INSTALLED}`);
|
|
203
|
-
return yield* binaryPath(binary, platform);
|
|
204
|
-
});
|
|
205
|
-
/** @internal */
|
|
206
|
-
const runVendored = Function.dual(2, (binary, invocation) => locateBinary(binary).pipe(Effect.flatMap((file) => runCaptured({
|
|
207
|
-
...invocation,
|
|
208
|
-
file
|
|
209
|
-
}))));
|
|
210
|
-
/** @internal */
|
|
211
|
-
const writeTo = Function.dual(2, (sink, text) => Effect.gen(function* write() {
|
|
212
|
-
const stdio = yield* Stdio.Stdio;
|
|
213
|
-
yield* Stream.make(text).pipe(Stream.run(stdio[sink]()), Effect.orDie);
|
|
214
|
-
}));
|
|
215
|
-
/** @internal */
|
|
216
|
-
const finish = (report) => {
|
|
217
|
-
if (!report.valid) return Effect.fail(checksFailed(report.output));
|
|
218
|
-
if (report.output === "") return Effect.void;
|
|
219
|
-
return writeTo("stdout", `${report.output}\n`);
|
|
220
|
-
};
|
|
221
|
-
export { ACTIONLINT as a, readTarGz as c, VpToolsError as d, checksFailed as f, installBinary as i, runCaptured as l, toolFailed as m, writeTo as n, BETTERLEAKS as o, configMissing as p, runVendored as r, ZIZMOR as s, finish as t, attempt as u };
|
|
222
|
-
|
|
223
|
-
//# sourceMappingURL=output-BdvTIQ-k.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-BdvTIQ-k.mjs","names":["Str","Arr","encodeHex","Rec","DATA_FIRST_ARITY","Fn","Fn"],"sources":["../src/shared/lib/errors.ts","../src/shared/lib/attempt.ts","../src/shared/lib/process.ts","../src/shared/lib/tar-gz.ts","../src/entities/binary/model/binaries.ts","../src/entities/binary/model/vendor.ts","../src/entities/binary/model/install.ts","../src/entities/binary/model/vendored.ts","../src/shared/lib/output.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class VpToolsError extends taggedError<VpToolsError, { readonly brand: unique symbol }>()(\n \"VpToolsError\",\n {\n kind: Schema.Literals([\"config-missing\", \"tool-failed\", \"checks-failed\"]),\n message: Schema.String,\n },\n) {}\n\nexport const configMissing = (message: string): VpToolsError =>\n VpToolsError.make({ kind: \"config-missing\", message });\n\nexport const checksFailed = (message: string): VpToolsError =>\n VpToolsError.make({ kind: \"checks-failed\", message });\n\nexport const toolFailed =\n (tool: string) =>\n (cause: unknown): VpToolsError =>\n VpToolsError.make({ kind: \"tool-failed\", message: `${tool} failed: ${String(cause)}` });\n","import { Effect } from \"effect\";\n\nimport { toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\n\nexport const attempt =\n (tool: string) =>\n <Value>(run: () => PromiseLike<Value>): Effect.Effect<Value, VpToolsError> =>\n Effect.tryPromise({ try: run, catch: toolFailed(tool) });\n","import { Effect, Option, Stream, pipe } from \"effect\";\nimport type { PlatformError } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport type { Report } from \"./report.ts\";\n\nconst SUCCESS = 0;\n\n/** @internal */\nexport interface Invocation {\n readonly root: string;\n readonly file: string;\n readonly args: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly input?: string | undefined;\n readonly output?: \"all\" | \"stdout\";\n}\n\nconst stdinOf = (input: string | undefined): ChildProcess.CommandInput =>\n pipe(\n Option.fromNullishOr(input),\n Option.match({\n onNone: (): ChildProcess.CommandInput => \"ignore\",\n onSome: (text) => Stream.make(new TextEncoder().encode(text)),\n }),\n );\n\n/** @internal */\nexport const runCaptured = ({\n root,\n file,\n args,\n env = {},\n input,\n output = \"all\",\n}: Invocation): Effect.Effect<\n Report,\n PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner\n> =>\n Effect.gen(function* run() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const handle = yield* spawner.spawn(\n ChildProcess.make(file, args, { cwd: root, env, extendEnv: true, stdin: stdinOf(input) }),\n );\n const [text, exitCode] = yield* Effect.all(\n [handle[output].pipe(Stream.decodeText, Stream.mkString), handle.exitCode],\n { concurrency: \"unbounded\" },\n );\n return { valid: exitCode === SUCCESS, output: text };\n }).pipe(Effect.scoped);\n","import { Effect, Stream } from \"effect\";\nimport { Tar } from \"effect/encoding\";\n\nimport { attempt } from \"./attempt.ts\";\nimport { toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\n\n/** @internal */\nexport interface TarEntry {\n readonly header: Tar.Header;\n readonly bytes: Uint8Array;\n}\n\nconst gunzipped = (data: Uint8Array): Effect.Effect<ArrayBuffer, VpToolsError> => {\n const compressed = new Blob([new Uint8Array(data)]).stream();\n return attempt(\"gunzip\")(() =>\n new Response(compressed.pipeThrough(new DecompressionStream(\"gzip\"))).arrayBuffer(),\n );\n};\n\nconst untarred = (archive: ArrayBuffer): Effect.Effect<readonly TarEntry[], VpToolsError> =>\n Stream.make(new Uint8Array(archive)).pipe(\n Stream.pipeThroughChannel(Tar.decode()),\n Stream.mapEffect(({ header, body }) =>\n Effect.map(Stream.mkUint8Array(body), (bytes): TarEntry => ({ header, bytes })),\n ),\n Stream.runCollect,\n Effect.mapError(toolFailed(\"untar\")),\n );\n\n/** @internal */\nexport const readTarGz = (data: Uint8Array): Effect.Effect<readonly TarEntry[], VpToolsError> =>\n Effect.flatMap(gunzipped(data), untarred);\n","import { String as Str } from \"effect\";\n\nexport type Platform = \"darwin-arm64\" | \"darwin-x64\" | \"linux-arm64\" | \"linux-x64\" | \"win32-x64\";\n\nexport type Archive = \"tar.gz\" | \"zip\";\n\nexport interface BinaryAsset {\n readonly url: string;\n readonly sha256: string;\n readonly archive: Archive;\n}\n\nexport interface Binary {\n readonly name: string;\n readonly version: string;\n readonly assets: Readonly<Record<Platform, BinaryAsset>>;\n}\n\nconst archiveOf = (file: string): Archive => {\n if (Str.endsWith(\".zip\")(file)) {\n return \"zip\";\n }\n return \"tar.gz\";\n};\n\nconst releaseAsset =\n (release: string) =>\n (file: string, sha256: string): BinaryAsset => ({\n url: `${release}/${file}`,\n sha256,\n archive: archiveOf(file),\n });\n\nconst betterleaksAsset = releaseAsset(\n \"https://github.com/betterleaks/betterleaks/releases/download/v2.0.0-rc.7\",\n);\n\nexport const BETTERLEAKS: Binary = {\n name: \"betterleaks\",\n version: \"2.0.0-rc.7\",\n assets: {\n \"darwin-arm64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_darwin_arm64.tar.gz\",\n \"d5052b4789752e3d9995c0b71a5b531aea747455ba4f8d1534c90b41e03f906c\",\n ),\n \"darwin-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_darwin_x64.tar.gz\",\n \"b3be0c6b4b91036a6d8b98e47642470a5a872d4bff08b8ee34348e9baf1e3434\",\n ),\n \"linux-arm64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_linux_arm64.tar.gz\",\n \"32fcd5a77d7c3c2d97cc615c5d70344d0c62b5a36f38568ce8ec72e62783acad\",\n ),\n \"linux-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_linux_x64.tar.gz\",\n \"230ef42dc3a0ee35e5148b7b4e9280224a412ef100cd4e74d3d6681d94e6ccb8\",\n ),\n \"win32-x64\": betterleaksAsset(\n \"betterleaks_2.0.0-rc.7_windows_x64.zip\",\n \"36db668ba12b55537a11cc45cd61565ab7f4f23ce606e0827206f49048a5183e\",\n ),\n },\n};\n\nconst actionlintAsset = releaseAsset(\n \"https://github.com/rhysd/actionlint/releases/download/v1.7.12\",\n);\n\nexport const ACTIONLINT: Binary = {\n name: \"actionlint\",\n version: \"1.7.12\",\n assets: {\n \"darwin-arm64\": actionlintAsset(\n \"actionlint_1.7.12_darwin_arm64.tar.gz\",\n \"aba9ced2dee8d27fecca3dc7feb1a7f9a52caefa1eb46f3271ea66b6e0e6953f\",\n ),\n \"darwin-x64\": actionlintAsset(\n \"actionlint_1.7.12_darwin_amd64.tar.gz\",\n \"5b44c3bc2255115c9b69e30efc0fecdf498fdb63c5d58e17084fd5f16324c644\",\n ),\n \"linux-arm64\": actionlintAsset(\n \"actionlint_1.7.12_linux_arm64.tar.gz\",\n \"325e971b6ba9bfa504672e29be93c24981eeb1c07576d730e9f7c8805afff0c6\",\n ),\n \"linux-x64\": actionlintAsset(\n \"actionlint_1.7.12_linux_amd64.tar.gz\",\n \"8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8\",\n ),\n \"win32-x64\": actionlintAsset(\n \"actionlint_1.7.12_windows_amd64.zip\",\n \"6e7241b51e6817ea6a047693d8e6fed13b31819c9a0dd6c5a726e1592d22f6e9\",\n ),\n },\n};\n\nconst zizmorAsset = releaseAsset(\"https://github.com/zizmorcore/zizmor/releases/download/v1.32.0\");\n\nexport const ZIZMOR: Binary = {\n name: \"zizmor\",\n version: \"1.32.0\",\n assets: {\n \"darwin-arm64\": zizmorAsset(\n \"zizmor-aarch64-apple-darwin.tar.gz\",\n \"6efed18c4539a663fd3c851a2be9533fd8456c4e646d9416206da059154a0d3c\",\n ),\n \"darwin-x64\": zizmorAsset(\n \"zizmor-x86_64-apple-darwin.tar.gz\",\n \"6983143c719ada6845a69cc4dd2bacc215f971662fecd8bbd2678388e5ce5969\",\n ),\n \"linux-arm64\": zizmorAsset(\n \"zizmor-aarch64-unknown-linux-gnu.tar.gz\",\n \"cb152b207f815116d7fa1c1ee4614f61578803351395052908095e79adfd9fd0\",\n ),\n \"linux-x64\": zizmorAsset(\n \"zizmor-x86_64-unknown-linux-gnu.tar.gz\",\n \"bb110cc765eca9cd7efb2e284a956be5974c60027b0970f16397d86208a9957b\",\n ),\n \"win32-x64\": zizmorAsset(\n \"zizmor-x86_64-pc-windows-msvc.zip\",\n \"d284a16e09d9df4ce2c000357e7b59bd531be093bea5718a1ce225b449b59d49\",\n ),\n },\n};\n\nexport const PLATFORMS: readonly Platform[] = [\n \"darwin-arm64\",\n \"darwin-x64\",\n \"linux-arm64\",\n \"linux-x64\",\n \"win32-x64\",\n];\n","import { Context } from \"effect\";\n\nexport const VendorDirectory = Context.Reference<string>(\"vite-plus-adopt/VendorDirectory\", {\n defaultValue: () => `${import.meta.dirname}/../vendor`,\n});\n","import { Array as Arr, Effect, FileSystem, Path, pipe, Record as Rec } from \"effect\";\nimport type { Option, PlatformError } from \"effect\";\nimport { encode as encodeHex } from \"effect/encoding/Hex\";\nimport { HttpClient } from \"effect/http\";\nimport { unzip } from \"fflate\";\n\nimport { attempt } from \"#/shared/lib/attempt.ts\";\nimport { configMissing, toolFailed } from \"#/shared/lib/errors.ts\";\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { readTarGz } from \"#/shared/lib/tar-gz.ts\";\n\nimport { PLATFORMS } from \"./binaries.ts\";\nimport type { Binary, BinaryAsset, Platform } from \"./binaries.ts\";\nimport { VendorDirectory } from \"./vendor.ts\";\n\ntype Entries = ReadonlyMap<string, Uint8Array>;\n\ninterface Download {\n readonly binary: Binary;\n readonly platform: Platform;\n readonly data: Uint8Array;\n}\n\ntype InstallServices = FileSystem.FileSystem | Path.Path;\n\ntype InstallError = VpToolsError | PlatformError.PlatformError;\n\nconst EXECUTABLE = 0o755;\n\nconst NOT_INSTALLED =\n \"was not installed. Allow the postinstall of @r_masseater/vite-plus-adopt in allowBuilds of pnpm-workspace.yaml and run vp install.\";\n\nconst currentPlatform = (): Option.Option<Platform> =>\n Arr.findFirst(PLATFORMS, (platform) => platform === `${process.platform}-${process.arch}`);\n\nconst executableName = (binary: Binary, platform: Platform): string => {\n if (platform === \"win32-x64\") {\n return `${binary.name}.exe`;\n }\n return binary.name;\n};\n\nconst assetOf = ({ binary, platform }: Download): BinaryAsset => binary.assets[platform];\n\nconst download = (\n binary: Binary,\n asset: BinaryAsset,\n): Effect.Effect<Uint8Array, VpToolsError, HttpClient.HttpClient> =>\n Effect.gen(function* fetchAsset() {\n const httpClient = yield* HttpClient.HttpClient;\n const client = HttpClient.filterStatusOk(httpClient);\n const response = yield* client.get(asset.url);\n const body = yield* response.arrayBuffer;\n return new Uint8Array(body);\n }).pipe(Effect.mapError(toolFailed(binary.name)));\n\nconst verify = (fetched: Download): Effect.Effect<Download, VpToolsError> => {\n const asset = assetOf(fetched);\n const failed = toolFailed(fetched.binary.name);\n const data = new Uint8Array(fetched.data);\n return attempt(fetched.binary.name)(() => crypto.subtle.digest(\"SHA-256\", data)).pipe(\n Effect.map((digest) => encodeHex(new Uint8Array(digest))),\n Effect.filterOrFail(\n (digest) => digest === asset.sha256,\n (digest) => failed(`${asset.url} has SHA-256 ${digest}, expected ${asset.sha256}`),\n ),\n Effect.as(fetched),\n );\n};\n\nconst tarEntries = (data: Uint8Array): Effect.Effect<Entries, VpToolsError> =>\n readTarGz(data).pipe(\n Effect.map(Arr.map(({ header, bytes }) => [header.path, bytes] as const)),\n Effect.map((entries): Entries => new Map(entries)),\n );\n\nconst zipEntries = (data: Uint8Array): Effect.Effect<Entries, VpToolsError> =>\n Effect.callback<Entries, VpToolsError>((resume) => {\n unzip(data, (failure, files) => {\n if (failure === null) {\n const entries: Entries = new Map(Rec.toEntries(files));\n resume(Effect.succeed(entries));\n return;\n }\n resume(Effect.fail(toolFailed(\"unzip\")(failure)));\n });\n });\n\nconst entriesOf = (\n asset: BinaryAsset,\n): ((data: Uint8Array) => Effect.Effect<Entries, VpToolsError>) => {\n if (asset.archive === \"zip\") {\n return zipEntries;\n }\n return tarEntries;\n};\n\nconst extract = (fetched: Download): Effect.Effect<Uint8Array, VpToolsError> => {\n const asset = assetOf(fetched);\n const executable = executableName(fetched.binary, fetched.platform);\n return entriesOf(asset)(fetched.data).pipe(\n Effect.flatMap((files) => Effect.fromNullishOr(files.get(executable))),\n Effect.mapError(() => toolFailed(fetched.binary.name)(`${asset.url} has no ${executable}`)),\n );\n};\n\nconst binaryPath = (binary: Binary, platform: Platform): Effect.Effect<string, never, Path.Path> =>\n Effect.gen(function* vendoredPath() {\n const path = yield* Path.Path;\n const vendor = yield* VendorDirectory;\n return path.join(vendor, binary.name, binary.version, executableName(binary, platform));\n });\n\nconst place = (\n fetched: Download,\n bytes: Uint8Array,\n): Effect.Effect<void, PlatformError.PlatformError, InstallServices> =>\n Effect.gen(function* write() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const file = yield* binaryPath(fetched.binary, fetched.platform);\n yield* fs.makeDirectory(path.dirname(file), { recursive: true });\n yield* Effect.scoped(\n Effect.gen(function* stage() {\n const staging = yield* fs.makeTempDirectoryScoped({\n directory: path.dirname(file),\n prefix: \".partial-\",\n });\n const partial = path.join(staging, path.basename(file));\n yield* fs.writeFile(partial, bytes);\n yield* fs.chmod(partial, EXECUTABLE);\n yield* fs.rename(partial, file);\n }),\n );\n });\n\nconst unpack = (fetched: Download): Effect.Effect<void, InstallError, InstallServices> =>\n verify(fetched).pipe(\n Effect.flatMap(extract),\n Effect.flatMap((bytes) => place(fetched, bytes)),\n );\n\nconst platformOf = (binary: Binary): Effect.Effect<Platform, VpToolsError> =>\n pipe(\n currentPlatform(),\n Effect.fromOption,\n Effect.mapError(() =>\n toolFailed(binary.name)(`no release for ${process.platform}-${process.arch}`),\n ),\n );\n\nconst isPlaced = (\n binary: Binary,\n platform: Platform,\n): Effect.Effect<boolean, PlatformError.PlatformError, InstallServices> =>\n Effect.gen(function* placed() {\n const fs = yield* FileSystem.FileSystem;\n const file = yield* binaryPath(binary, platform);\n return yield* fs.exists(file);\n });\n\n/** @internal */\nexport const installBinary = (\n binary: Binary,\n): Effect.Effect<\n void,\n VpToolsError | PlatformError.PlatformError,\n FileSystem.FileSystem | HttpClient.HttpClient | Path.Path\n> =>\n Effect.gen(function* install() {\n const platform = yield* platformOf(binary);\n if (yield* isPlaced(binary, platform)) {\n return;\n }\n const data = yield* download(binary, binary.assets[platform]);\n yield* unpack({ binary, platform, data });\n });\n\n/** @internal */\nexport const locateBinary = (\n binary: Binary,\n): Effect.Effect<\n string,\n VpToolsError | PlatformError.PlatformError,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* locate() {\n const platform = yield* platformOf(binary);\n if (!(yield* isPlaced(binary, platform))) {\n return yield* configMissing(`${binary.name} ${binary.version} ${NOT_INSTALLED}`);\n }\n return yield* binaryPath(binary, platform);\n });\n","import { Effect, Function as Fn } from \"effect\";\nimport type { FileSystem, Path, PlatformError } from \"effect\";\nimport type { ChildProcessSpawner } from \"effect/process\";\n\nimport type { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { runCaptured } from \"#/shared/lib/process.ts\";\nimport type { Invocation } from \"#/shared/lib/process.ts\";\nimport type { Report } from \"#/shared/lib/report.ts\";\n\nimport type { Binary } from \"./binaries.ts\";\nimport { locateBinary } from \"./install.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const runVendored: {\n (\n invocation: Omit<Invocation, \"file\">,\n ): (\n binary: Binary,\n ) => Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n >;\n (\n binary: Binary,\n invocation: Omit<Invocation, \"file\">,\n ): Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n >;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n (\n binary: Binary,\n invocation: Omit<Invocation, \"file\">,\n ): Effect.Effect<\n Report,\n VpToolsError | PlatformError.PlatformError,\n ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path\n > => locateBinary(binary).pipe(Effect.flatMap((file) => runCaptured({ ...invocation, file }))),\n);\n","import { Effect, Stdio, Stream, Function as Fn } from \"effect\";\n\nimport { checksFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.ts\";\nimport type { Report } from \"./report.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport type Sink = \"stdout\" | \"stderr\";\n\n/** @internal */\nexport const writeTo: {\n (text: string): (sink: Sink) => Effect.Effect<void, never, Stdio.Stdio>;\n (sink: Sink, text: string): Effect.Effect<void, never, Stdio.Stdio>;\n} = Fn.dual(DATA_FIRST_ARITY, (sink: Sink, text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* write() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio[sink]()), Effect.orDie);\n }),\n);\n\n/** @internal */\nexport const finish = (report: Report): Effect.Effect<void, VpToolsError, Stdio.Stdio> => {\n if (!report.valid) {\n return Effect.fail(checksFailed(report.output));\n }\n if (report.output === \"\") {\n return Effect.void;\n }\n return writeTo(\"stdout\", `${report.output}\\n`);\n};\n"],"mappings":";;;;;;;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,eAAb,cAAkC,YAA6D,CAAC,CAC9F,gBACA;CACE,MAAM,OAAO,SAAS;EAAC;EAAkB;EAAe;CAAe,CAAC;CACxE,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;AAEH,MAAa,iBAAiB,YAC5B,aAAa,KAAK;CAAE,MAAM;CAAkB;AAAQ,CAAC;AAEvD,MAAa,gBAAgB,YAC3B,aAAa,KAAK;CAAE,MAAM;CAAiB;AAAQ,CAAC;AAEtD,MAAa,cACV,UACA,UACC,aAAa,KAAK;CAAE,MAAM;CAAe,SAAS,GAAG,KAAK,WAAW,OAAO,KAAK;AAAI,CAAC;;AChB1F,MAAa,WACV,UACO,QACN,OAAO,WAAW;CAAE,KAAK;CAAK,OAAO,WAAW,IAAI;AAAE,CAAC;;ACF3D,MAAM,UAAU;AAYhB,MAAM,WAAW,UACf,KACE,OAAO,cAAc,KAAK,GAC1B,OAAO,MAAM;CACX,cAAyC;CACz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,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,KAAK,CAAC,CAAC,GAAG,OAAO,KAAK;AACvE,CAAC,CACH;;AAGA,MAAa,UAAU,WAAmE;CACxF,IAAI,CAAC,OAAO,OACV,OAAO,OAAO,KAAK,aAAa,OAAO,MAAM,CAAC;CAEhD,IAAI,OAAO,WAAW,IACpB,OAAO,OAAO;CAEhB,OAAO,QAAQ,UAAU,GAAG,OAAO,OAAO,GAAG;AAC/C"}
|
package/dist/postinstall.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
package/dist/postinstall.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { a as ACTIONLINT, i as installBinary, o as BETTERLEAKS, s as ZIZMOR } from "./output-BdvTIQ-k.mjs";
|
|
2
|
-
import { t as runCli } from "./run-cli-BiPFbX9J.mjs";
|
|
3
|
-
import { Effect, Layer } from "effect";
|
|
4
|
-
import { FetchHttpClient } from "effect/http";
|
|
5
|
-
// src/app/postinstall.ts
|
|
6
|
-
const BINARIES = [
|
|
7
|
-
BETTERLEAKS,
|
|
8
|
-
ACTIONLINT,
|
|
9
|
-
ZIZMOR
|
|
10
|
-
];
|
|
11
|
-
const installAll = Effect.forEach(BINARIES, installBinary, {
|
|
12
|
-
concurrency: "unbounded",
|
|
13
|
-
discard: true
|
|
14
|
-
});
|
|
15
|
-
const program = Layer.build(FetchHttpClient.layer).pipe(Effect.flatMap((context) => Effect.provideContext(installAll, context)), Effect.scoped);
|
|
16
|
-
runCli(program);
|
|
17
|
-
export {};
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=postinstall.mjs.map
|
package/dist/postinstall.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.mjs","names":[],"sources":["../src/app/postinstall.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport { ACTIONLINT, BETTERLEAKS, ZIZMOR, installBinary } from \"#/entities/binary/index.ts\";\n\nimport { runCli } from \"./run-cli.ts\";\n\nconst BINARIES = [BETTERLEAKS, ACTIONLINT, ZIZMOR];\n\nconst installAll = Effect.forEach(BINARIES, installBinary, {\n concurrency: \"unbounded\",\n discard: true,\n});\n\nconst program = Layer.build(FetchHttpClient.layer).pipe(\n Effect.flatMap((context) => Effect.provideContext(installAll, context)),\n Effect.scoped,\n);\n\nrunCli(program);\n"],"mappings":";;;;;AAOA,MAAM,WAAW;CAAC;CAAa;CAAY;AAAM;AAEjD,MAAM,aAAa,OAAO,QAAQ,UAAU,eAAe;CACzD,aAAa;CACb,SAAS;AACX,CAAC;AAED,MAAM,UAAU,MAAM,MAAM,gBAAgB,KAAK,CAAC,CAAC,KACjD,OAAO,SAAS,YAAY,OAAO,eAAe,YAAY,OAAO,CAAC,GACtE,OAAO,MACT;AAEA,OAAO,OAAO"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { d as VpToolsError, n as writeTo } from "./output-BdvTIQ-k.mjs";
|
|
2
|
-
import { Cause, Effect, Layer, Option, Schema, pipe } from "effect";
|
|
3
|
-
import { runMain } from "@effect/platform-node-shared/NodeRuntime";
|
|
4
|
-
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
5
|
-
// src/shared/lib/node-services.ts
|
|
6
|
-
/** @internal */
|
|
7
|
-
const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
|
|
8
|
-
// src/app/run-cli.ts
|
|
9
|
-
const reportFailure = (cause) => {
|
|
10
|
-
const message = pipe(Cause.findErrorOption(cause), Option.filter(Schema.is(VpToolsError)), Option.match({
|
|
11
|
-
onNone: () => Cause.pretty(cause),
|
|
12
|
-
onSome: (error) => error.message
|
|
13
|
-
}));
|
|
14
|
-
return writeTo("stderr", `${message}\n`);
|
|
15
|
-
};
|
|
16
|
-
/** @internal */
|
|
17
|
-
const runCli = (program) => {
|
|
18
|
-
const reported = program.pipe(Effect.tapCause(reportFailure));
|
|
19
|
-
const main = Layer.build(nodeServicesLayer).pipe(Effect.flatMap((services) => Effect.provideContext(reported, services)), Effect.scoped);
|
|
20
|
-
runMain(main, { disableErrorReporting: true });
|
|
21
|
-
};
|
|
22
|
-
export { runCli as t };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=run-cli-BiPFbX9J.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli-BiPFbX9J.mjs","names":[],"sources":["../src/shared/lib/node-services.ts","../src/app/run-cli.ts"],"sourcesContent":["import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { Layer } from \"effect\";\n\n/** @internal */\nexport const nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n","import { runMain } from \"@effect/platform-node-shared/NodeRuntime\";\nimport { Cause, Effect, Layer, Option, Schema, pipe } from \"effect\";\nimport type { Stdio } from \"effect\";\n\nimport type { CommandServices } from \"#/shared/lib/command.ts\";\nimport { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { nodeServicesLayer } from \"#/shared/lib/node-services.ts\";\nimport { writeTo } from \"#/shared/lib/output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> => {\n const message = pipe(\n Cause.findErrorOption(cause),\n Option.filter(Schema.is(VpToolsError)),\n Option.match({\n onNone: () => Cause.pretty(cause),\n onSome: (error) => error.message,\n }),\n );\n return writeTo(\"stderr\", `${message}\\n`);\n};\n\n/** @internal */\nexport const runCli = <Failure>(program: Effect.Effect<void, Failure, CommandServices>): void => {\n const reported = program.pipe(Effect.tapCause(reportFailure));\n const main = Layer.build(nodeServicesLayer).pipe(\n Effect.flatMap((services) => Effect.provideContext(reported, services)),\n Effect.scoped,\n );\n runMain(main, { disableErrorReporting: true });\n};\n"],"mappings":";;;;;;AASA,MAAa,oBAAoB,MAAM,aACrC,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;;ACHA,MAAM,iBACJ,UAC4C;CAC5C,MAAM,UAAU,KACd,MAAM,gBAAgB,KAAK,GAC3B,OAAO,OAAO,OAAO,GAAG,YAAY,CAAC,GACrC,OAAO,MAAM;EACX,cAAc,MAAM,OAAO,KAAK;EAChC,SAAS,UAAU,MAAM;CAC3B,CAAC,CACH;CACA,OAAO,QAAQ,UAAU,GAAG,QAAQ,GAAG;AACzC;;AAGA,MAAa,UAAmB,YAAiE;CAC/F,MAAM,WAAW,QAAQ,KAAK,OAAO,SAAS,aAAa,CAAC;CAC5D,MAAM,OAAO,MAAM,MAAM,iBAAiB,CAAC,CAAC,KAC1C,OAAO,SAAS,aAAa,OAAO,eAAe,UAAU,QAAQ,CAAC,GACtE,OAAO,MACT;CACA,QAAQ,MAAM,EAAE,uBAAuB,KAAK,CAAC;AAC/C"}
|