@r_masseater/vite-plus-adopt 0.4.1 → 0.6.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-Cj_2weFd.mjs","names":["Fn","Str","Arr","encodeHex","Rec"],"sources":["../src/errors.ts","../src/attempt.ts","../src/output.ts","../src/binaries.ts","../src/vendor.ts","../src/install.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, 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","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 { untar } from \"@andrewbranch/untar.js\";\nimport { 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 \"./attempt.ts\";\nimport { PLATFORMS } from \"./binaries.ts\";\nimport type { Binary, BinaryAsset, Platform } from \"./binaries.ts\";\nimport { configMissing, toolFailed } from \"./errors.ts\";\nimport type { VpToolsError } from \"./errors.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 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 tarEntries = (data: Uint8Array): Effect.Effect<Entries, VpToolsError> =>\n gunzipped(data).pipe(\n Effect.map(untar),\n Effect.map(\n (files) =>\n new Map(\n pipe(\n files,\n Arr.map((file) => [file.name, file.fileData] as const),\n ),\n ),\n ),\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"],"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;AAEv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O,IAAI,CAAC,CAAC,kBAAkB,QAAQ,SAAS,GAAG,QAAQ,MAAM,CAC9E,CACF;AAEF,MAAM,YACJ,QACA,aAEA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,WAAW,QAAQ,QAAQ;CAC/C,OAAO,OAAO,GAAG,OAAO,IAAI;AAC9B,CAAC;;AAGH,MAAa,iBACX,WAMA,OAAO,IAAI,UAAU,UAAU;CAC7B,MAAM,WAAW,OAAO,WAAW,MAAM;CACzC,IAAI,OAAO,SAAS,QAAQ,QAAQ,GAClC;CAEF,MAAM,OAAO,OAAO,SAAS,QAAQ,OAAO,OAAO,SAAS;CAC5D,OAAO,OAAO;EAAE;EAAQ;EAAU;CAAK,CAAC;AAC1C,CAAC;;AAGH,MAAa,gBACX,WAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,WAAW,OAAO,WAAW,MAAM;CACzC,IAAI,EAAE,OAAO,SAAS,QAAQ,QAAQ,IACpC,OAAO,OAAO,cAAc,GAAG,OAAO,KAAK,GAAG,OAAO,QAAQ,GAAG,eAAe;CAEjF,OAAO,OAAO,WAAW,QAAQ,QAAQ;AAC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"json-D-rhjlSM.mjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["import { Option, Schema } from \"effect\";\n\nconst JsonText = Schema.fromJsonString(Schema.Unknown);\n\nconst encodeJson = Schema.encodeUnknownOption(JsonText);\n\nconst toJson = (value: unknown): string => Option.getOrElse(encodeJson(value), () => String(value));\n\nconst parseJson: (text: string) => Option.Option<unknown> = Schema.decodeOption(JsonText);\n\nexport { parseJson, toJson };\n"],"mappings":";;AAEA,MAAM,WAAW,OAAO,eAAe,OAAO,OAAO;AAErD,MAAM,aAAa,OAAO,oBAAoB,QAAQ;AAEtD,MAAM,UAAU,UAA2B,OAAO,UAAU,WAAW,KAAK,SAAS,OAAO,KAAK,CAAC;AAElG,MAAM,YAAsD,OAAO,aAAa,QAAQ"}
1
+ {"version":3,"file":"json-D-rhjlSM.mjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["import { Option, Schema } from \"effect\";\n\nconst JsonText = Schema.fromJsonString(Schema.Unknown);\n\nconst encodeJson = Schema.encodeUnknownOption(JsonText);\n\nexport const toJson = (value: unknown): string =>\n Option.getOrElse(encodeJson(value), () => String(value));\n\nexport const parseJson: (text: string) => Option.Option<unknown> = Schema.decodeOption(JsonText);\n"],"mappings":";;AAEA,MAAM,WAAW,OAAO,eAAe,OAAO,OAAO;AAErD,MAAM,aAAa,OAAO,oBAAoB,QAAQ;AAEtD,MAAa,UAAU,UACrB,OAAO,UAAU,WAAW,KAAK,SAAS,OAAO,KAAK,CAAC;AAEzD,MAAa,YAAsD,OAAO,aAAa,QAAQ"}
@@ -1,4 +1,5 @@
1
- import { a as ZIZMOR, i as BETTERLEAKS, o as runCli, r as ACTIONLINT, t as installBinary } from "./install-C-6lZ_z7.mjs";
1
+ import { a as ZIZMOR, i as BETTERLEAKS, r as ACTIONLINT, t as installBinary } from "./install-Cj_2weFd.mjs";
2
+ import { t as runCli } from "./run-cli-CSEt6b4a.mjs";
2
3
  import { Effect, Layer } from "effect";
3
4
  import { FetchHttpClient } from "effect/http";
4
5
  // src/postinstall.ts
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.mjs","names":[],"sources":["../src/postinstall.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport { ACTIONLINT, BETTERLEAKS, ZIZMOR } from \"./binaries.ts\";\nimport { installBinary } from \"./install.ts\";\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
+ {"version":3,"file":"postinstall.mjs","names":[],"sources":["../src/postinstall.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\n\nimport { ACTIONLINT, BETTERLEAKS, ZIZMOR } from \"./binaries.ts\";\nimport { installBinary } from \"./install.ts\";\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"}
@@ -0,0 +1,24 @@
1
+ import { l as VpToolsError, s as writeTo } from "./install-Cj_2weFd.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/node-services.ts
6
+ /** @internal */
7
+ const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
8
+ // src/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-CSEt6b4a.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-cli-CSEt6b4a.mjs","names":[],"sources":["../src/node-services.ts","../src/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 \"./command.ts\";\nimport { VpToolsError } from \"./errors.ts\";\nimport { nodeServicesLayer } from \"./node-services.ts\";\nimport { writeTo } from \"./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"}
@@ -1,10 +1,11 @@
1
- import { Effect, FileSystem, Path, Schema } from "effect";
1
+ import { Effect, FileSystem, Path, PlatformError, Schema } from "effect";
2
2
  import { ChildProcessSpawner } from "effect/process";
3
3
  import { defineConfig } from "steiger";
4
4
  import { TextlintRcConfig } from "@textlint/config-loader";
5
5
  import { UserConfig } from "@commitlint/types";
6
6
  import { Configuration, Rule } from "markdownlint";
7
7
  declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
8
+ /** @internal */
8
9
  type DependencyField = (typeof DEPENDENCY_FIELDS)[number];
9
10
  interface CommitlintConfig extends Readonly<UserConfig> {}
10
11
  type SteigerConfig = readonly ReturnType<typeof defineConfig>[number][];
@@ -76,4 +77,4 @@ declare module "vite" {
76
77
  interface UserConfig extends ToolSections {}
77
78
  }
78
79
  export { FallowConfig as a, SteigerSection as c, DependencyRules as i, TextlintConfig as l, BetterleaksRule as n, MarkdownlintConfig as o, CommitlintConfig as r, SteigerConfig as s, BetterleaksConfig as t, ToolSections as u };
79
- //# sourceMappingURL=types-LygeEwCK.d.mts.map
80
+ //# sourceMappingURL=types-Cxh9JcmN.d.mts.map