@r_masseater/vite-plus-adopt 0.8.1 → 0.10.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/README.md +29 -1
- package/THIRD-PARTY-NOTICES +55 -0
- package/dist/attw.mjs +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/fsd.d.mts +1 -1
- package/dist/fsd.mjs +1 -1
- package/dist/{index-D34U8BFs.d.mts → index-vq2Re-JL.d.mts} +20 -5
- package/dist/index.d.mts +2 -9
- package/dist/index.mjs +2 -2
- package/dist/{output-DKrfYl9Q.mjs → output-BdvTIQ-k.mjs} +36 -29
- package/dist/output-BdvTIQ-k.mjs.map +1 -0
- package/dist/postinstall.mjs +2 -2
- package/dist/{run-cli-BVnXT7zF.mjs → run-cli-BiPFbX9J.mjs} +2 -2
- package/dist/{run-cli-BVnXT7zF.mjs.map → run-cli-BiPFbX9J.mjs.map} +1 -1
- package/dist/steiger-Bi33gRXU.mjs +6225 -0
- package/dist/steiger-Bi33gRXU.mjs.map +1 -0
- package/dist/{vpa-Cvkfsskf.mjs → vpa-B2qvWn3Q.mjs} +418 -44
- package/dist/vpa-B2qvWn3Q.mjs.map +1 -0
- package/package.json +24 -6
- package/skills/configure-checks/SKILL.md +99 -0
- package/dist/output-DKrfYl9Q.mjs.map +0 -1
- package/dist/vpa-Cvkfsskf.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# vite-plus-adopt
|
|
2
2
|
|
|
3
|
-
`vpa` は、Betterleaks・actionlint・zizmor・commitlint・textlint・markdownlint・Steiger・fallow
|
|
3
|
+
`vpa` は、Betterleaks・actionlint・zizmor・commitlint・textlint・markdownlint・Steiger・fallow とエージェントスキルの導入を Vite+ に取り込む CLI である。設定と依存の規則を `vite.config.ts` に書くと、そこから読んで動かす。
|
|
4
4
|
引数なしの `vpa` を 1 回実行すると、設定のある検査をすべて並行して動かし、結果をまとめて出す。
|
|
5
5
|
TypeScript 7 だけで動く Feature-Sliced Design の Steiger プラグインと @arethetypeswrong/core も同梱する。
|
|
6
6
|
|
|
@@ -61,6 +61,34 @@ vpa --staged
|
|
|
61
61
|
vpa --commit-msg "$1"
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
## エージェントスキル
|
|
65
|
+
|
|
66
|
+
`skills` に GitHub のリポジトリとコミットを書くと、`vpa --prepare` がそのスキルを `.agents/skills/` に置く。スキルは `SKILL.md` の `name` で選び、`"all"` は `root` の下のすべてを選ぶ。
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
skills: {
|
|
71
|
+
"masseater/skills": {
|
|
72
|
+
commit: "40c8069607f259ab20d7cfee82f7c29b29fc65ad",
|
|
73
|
+
root: "plugins/masseater-skills/skills",
|
|
74
|
+
skills: "all",
|
|
75
|
+
},
|
|
76
|
+
"cloudflare/skills": { commit: "…", root: "skills", skills: ["cloudflare"] },
|
|
77
|
+
"./docs/skills": { skills: "all" },
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
取得したスキルは `~/.cache/vpa/skills/`(`XDG_CACHE_HOME`、Windows では `LOCALAPPDATA` の下)に読み取り専用で置く。`.agents/skills/` からはシンボリックリンク(Windows ではジャンクション)で指す。同じコミットはマシンのどのワークツリーでも取り直さない。非公開のリポジトリは `GITHUB_TOKEN` で取る。
|
|
83
|
+
|
|
84
|
+
`./` で始まるキーは、このリポジトリのフォルダである。コミットは書かず、`SKILL.md` を持つ直下のフォルダをそのまま指す。
|
|
85
|
+
|
|
86
|
+
`prepare` には `vpa --prepare` を書く。Renovate がコミットを更新できるように、`renovate.json` で次のプリセットを読む。
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{ "extends": ["github>masseater/masseater.dev//libs/vite-plus-adopt/renovate"] }
|
|
90
|
+
```
|
|
91
|
+
|
|
64
92
|
## Feature-Sliced Design のプラグイン
|
|
65
93
|
|
|
66
94
|
`@r_masseater/vite-plus-adopt/fsd` は [@feature-sliced/steiger-plugin][fsd-plugin] 0.8.2 を同梱したもので、ルールと `configs.recommended` は元と同じである。
|
package/THIRD-PARTY-NOTICES
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
dist/fsd.mjs bundles @feature-sliced/steiger-plugin and @feature-sliced/filesystem,
|
|
2
2
|
and dist/parsers holds the tree-sitter grammars that @feature-sliced/steiger-plugin ships.
|
|
3
|
+
dist/steiger-*.mjs bundles the linter API of steiger 0.10.0 and zod 4.6.7, which steiger uses.
|
|
3
4
|
dist/attw.mjs bundles the dist of @arethetypeswrong/core 0.18.5 from upstream/attw-core/lib,
|
|
4
5
|
with upstream/attw-core/lib.patch applied, and the module resolution, program construction
|
|
5
6
|
and binding in src/attw follow TypeScript 5.6.1-rc.
|
|
@@ -277,3 +278,57 @@ If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
|
277
278
|
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
278
279
|
|
|
279
280
|
END OF TERMS AND CONDITIONS
|
|
281
|
+
|
|
282
|
+
================================================================================
|
|
283
|
+
|
|
284
|
+
steiger 0.10.0
|
|
285
|
+
Source: https://github.com/feature-sliced/steiger
|
|
286
|
+
|
|
287
|
+
MIT License
|
|
288
|
+
|
|
289
|
+
Copyright (c) 2026 [Feature-Sliced Design core team and contributors](https://github.com/feature-sliced)
|
|
290
|
+
|
|
291
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
292
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
293
|
+
in the Software without restriction, including without limitation the rights
|
|
294
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
295
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
296
|
+
furnished to do so, subject to the following conditions:
|
|
297
|
+
|
|
298
|
+
The above copyright notice and this permission notice shall be included in all
|
|
299
|
+
copies or substantial portions of the Software.
|
|
300
|
+
|
|
301
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
302
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
303
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
304
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
305
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
306
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
307
|
+
SOFTWARE.
|
|
308
|
+
|
|
309
|
+
================================================================================
|
|
310
|
+
|
|
311
|
+
zod 4.6.7
|
|
312
|
+
Source: https://github.com/colinhacks/zod
|
|
313
|
+
|
|
314
|
+
MIT License
|
|
315
|
+
|
|
316
|
+
Copyright (c) 2025 Colin McDonnell
|
|
317
|
+
|
|
318
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
319
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
320
|
+
in the Software without restriction, including without limitation the rights
|
|
321
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
322
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
323
|
+
furnished to do so, subject to the following conditions:
|
|
324
|
+
|
|
325
|
+
The above copyright notice and this permission notice shall be included in all
|
|
326
|
+
copies or substantial portions of the Software.
|
|
327
|
+
|
|
328
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
329
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
330
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
331
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
332
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
333
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
334
|
+
SOFTWARE.
|
package/dist/attw.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { t as parseJson } from "./json-QtVKpodH.mjs";
|
|
2
2
|
import { Array as Array$1, Function, MutableRef, Option, Order, Predicate, Record, String as String$1, pipe } from "effect";
|
|
3
|
-
import { untar } from "@andrewbranch/untar.js";
|
|
4
3
|
import { FlateErrorCode, Gunzip } from "fflate";
|
|
5
4
|
import semver, { major, maxSatisfying, minor, valid, validRange } from "semver";
|
|
6
5
|
import { serverFS } from "typescript/fs";
|
|
@@ -8,6 +7,7 @@ import { API, ModuleKind, ModuleResolutionKind, ObjectFlags, SignatureKind, Symb
|
|
|
8
7
|
import { init, parse } from "cjs-module-lexer";
|
|
9
8
|
import { InternalSymbolName, ModifierFlags, NodeFlags, ScriptKind, ScriptTarget, SyntaxKind, escapeLeadingUnderscores, getNameOfDeclaration } from "typescript/ast";
|
|
10
9
|
import { isArrayBindingPattern, isArrayLiteralExpression, isArrowFunction, isBinaryExpression, isBindingElement, isBlock, isCallExpression, isCatchClause, isClassDeclaration, isClassExpression, isElementAccessExpression, isEnumDeclaration, isExportAssignment, isExportDeclaration, isExportSpecifier, isExpression, isExpressionStatement, isForInStatement, isFunctionDeclaration, isFunctionExpression, isIdentifier, isImportAttributes, isImportClause, isImportDeclaration, isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, isInterfaceDeclaration, isJSDoc, isJSDocCallbackTag, isJSDocImportTag, isJSDocTypedefTag, isModuleBlock, isModuleDeclaration, isNamedExports, isNamespaceExport, isNamespaceImport, isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isParameterDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, isPropertyAccessExpression, isPropertyAssignment, isReturnStatement, isShorthandPropertyAssignment, isSourceFile, isStringLiteral, isStringLiteralLikeNode, isTypeAliasDeclaration, isVariableDeclaration, isVariableDeclarationList, isVariableStatement, isVoidExpression } from "typescript/ast/is";
|
|
10
|
+
import { untar } from "@andrewbranch/untar.js";
|
|
11
11
|
import validatePackgeName from "validate-npm-package-name";
|
|
12
12
|
import * as cjs from "@loaderkit/resolve/cjs";
|
|
13
13
|
import * as esm from "@loaderkit/resolve/esm";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./run-cli-
|
|
3
|
-
import { t as runVpa } from "./vpa-
|
|
2
|
+
import { t as runCli } from "./run-cli-BiPFbX9J.mjs";
|
|
3
|
+
import { t as runVpa } from "./vpa-B2qvWn3Q.mjs";
|
|
4
4
|
import { Effect, Path, Stdio } from "effect";
|
|
5
5
|
// src/app/cli.ts
|
|
6
6
|
runCli(Effect.gen(function* main() {
|
package/dist/fsd.d.mts
CHANGED
package/dist/fsd.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as toJson } from "./json-QtVKpodH.mjs";
|
|
2
2
|
import { Option, String, pipe } from "effect";
|
|
3
|
+
import { isBuiltin } from "module";
|
|
3
4
|
import { basename, dirname, extname, join, relative, resolve, sep } from "path";
|
|
4
5
|
import { basename as basename$1, join as join$1, parse, sep as sep$1 } from "node:path";
|
|
5
6
|
import { serverFS } from "typescript/fs";
|
|
@@ -8,7 +9,6 @@ import { API } from "typescript/sync";
|
|
|
8
9
|
import * as fs from "fs";
|
|
9
10
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
10
11
|
import { parse as parse$1 } from "tsconfck";
|
|
11
|
-
import { isBuiltin } from "module";
|
|
12
12
|
import { Language, Parser, Query } from "web-tree-sitter";
|
|
13
13
|
import pluralize from "pluralize";
|
|
14
14
|
import { distance } from "fastest-levenshtein";
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as defineConfig } from "./steiger-Bi33gRXU.mjs";
|
|
2
|
+
import { Effect, Path, Schema } from "effect";
|
|
3
3
|
import { TextlintRcConfig } from "@textlint/config-loader";
|
|
4
4
|
import { TextlintKernelRule } from "@textlint/kernel";
|
|
5
|
-
import { defineConfig } from "steiger";
|
|
6
5
|
import { UserConfig } from "@commitlint/types";
|
|
7
6
|
import { Configuration, Rule } from "markdownlint";
|
|
7
|
+
declare const VpToolsError_base: Schema.Class<VpToolsError, Schema.TaggedStruct<"VpToolsError", {
|
|
8
|
+
readonly kind: Schema.Literals<readonly ["config-missing", "tool-failed", "checks-failed"]>;
|
|
9
|
+
readonly message: Schema.String;
|
|
10
|
+
}>, import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly brand: unique symbol;
|
|
12
|
+
}>;
|
|
13
|
+
declare class VpToolsError extends VpToolsError_base {}
|
|
8
14
|
declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
|
|
9
15
|
/** @internal */
|
|
10
16
|
type DependencyField = (typeof DEPENDENCY_FIELDS)[number];
|
|
17
|
+
declare const SkillsSectionSchema: Schema.$Record<Schema.Union<readonly [Schema.String, Schema.String]>, Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly commit: Schema.String;
|
|
19
|
+
readonly root: Schema.optional<Schema.String>;
|
|
20
|
+
readonly skills: Schema.Union<readonly [Schema.Literal<"all">, Schema.NonEmptyArray<Schema.String>]>;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
readonly skills: Schema.Union<readonly [Schema.Literal<"all">, Schema.NonEmptyArray<Schema.String>]>;
|
|
23
|
+
}>]>>;
|
|
24
|
+
type SkillsSection = typeof SkillsSectionSchema.Encoded;
|
|
11
25
|
interface CommitlintConfig extends Readonly<UserConfig> {}
|
|
12
26
|
type SteigerConfig = readonly ReturnType<typeof defineConfig>[number][];
|
|
13
27
|
interface BetterleaksRule {
|
|
@@ -81,11 +95,12 @@ interface ToolSections {
|
|
|
81
95
|
readonly dependencyRules?: DependencyRules;
|
|
82
96
|
readonly fallow?: FallowConfig;
|
|
83
97
|
readonly markdownlint?: MarkdownlintConfig;
|
|
98
|
+
readonly skills?: SkillsSection;
|
|
84
99
|
readonly steiger?: SteigerSection;
|
|
85
100
|
readonly textlint?: TextlintConfig;
|
|
86
101
|
}
|
|
87
102
|
declare module "vite" {
|
|
88
103
|
interface UserConfig extends ToolSections {}
|
|
89
104
|
}
|
|
90
|
-
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 };
|
|
91
|
-
//# sourceMappingURL=index-
|
|
105
|
+
export { FallowConfig as a, SteigerSection as c, SkillsSection as d, VpToolsError as f, DependencyRules as i, TextlintConfig as l, BetterleaksRule as n, MarkdownlintConfig as o, CommitlintConfig as r, SteigerConfig as s, BetterleaksConfig as t, ToolSections as u };
|
|
106
|
+
//# sourceMappingURL=index-vq2Re-JL.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { a as FallowConfig, c as SteigerSection, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./index-
|
|
1
|
+
import { a as FallowConfig, c as SteigerSection, d as SkillsSection, f as VpToolsError, i as DependencyRules, l as TextlintConfig, n as BetterleaksRule, o as MarkdownlintConfig, r as CommitlintConfig, s as SteigerConfig, t as BetterleaksConfig, u as ToolSections } from "./index-vq2Re-JL.mjs";
|
|
2
2
|
import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
|
|
3
3
|
import { ChildProcessSpawner } from "effect/process";
|
|
4
|
-
declare const VpToolsError_base: Schema.Class<VpToolsError, Schema.TaggedStruct<"VpToolsError", {
|
|
5
|
-
readonly kind: Schema.Literals<readonly ["config-missing", "tool-failed", "checks-failed"]>;
|
|
6
|
-
readonly message: Schema.String;
|
|
7
|
-
}>, import("effect/Cause").YieldableError & {
|
|
8
|
-
readonly brand: unique symbol;
|
|
9
|
-
}>;
|
|
10
|
-
export declare class VpToolsError extends VpToolsError_base {}
|
|
11
4
|
/** @internal */
|
|
12
5
|
type FileServices = FileSystem.FileSystem | Path.Path;
|
|
13
6
|
/** @internal */
|
|
@@ -23,5 +16,5 @@ export declare const runVpa: {
|
|
|
23
16
|
(args: readonly string[]): (root: string) => CommandEffect;
|
|
24
17
|
(root: string, args: readonly string[]): CommandEffect;
|
|
25
18
|
};
|
|
26
|
-
export type
|
|
19
|
+
export { type BetterleaksConfig, type BetterleaksRule, type CommitlintConfig, type DependencyRules, type FallowConfig, type MarkdownlintConfig, type SkillsSection, type SteigerConfig, type SteigerSection, type TextlintConfig, type ToolSections, VpToolsError };
|
|
27
20
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as loadViteConfig, t as runVpa } from "./vpa-
|
|
2
|
-
import {
|
|
1
|
+
import { n as loadViteConfig, t as runVpa } from "./vpa-B2qvWn3Q.mjs";
|
|
2
|
+
import { d as VpToolsError } from "./output-BdvTIQ-k.mjs";
|
|
3
3
|
export { VpToolsError, loadViteConfig, runVpa };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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";
|
|
2
3
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
3
|
-
import {
|
|
4
|
+
import { Tar } from "effect/encoding";
|
|
4
5
|
import { encode } from "effect/encoding/Hex";
|
|
5
|
-
import { HttpClient } from "effect/http";
|
|
6
6
|
import { unzip } from "fflate";
|
|
7
7
|
// src/shared/lib/errors.ts
|
|
8
8
|
const taggedError = Schema.TaggedError;
|
|
@@ -31,6 +31,37 @@ const attempt = (tool) => (run) => Effect.tryPromise({
|
|
|
31
31
|
try: run,
|
|
32
32
|
catch: toolFailed(tool)
|
|
33
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);
|
|
34
65
|
// src/entities/binary/model/binaries.ts
|
|
35
66
|
const archiveOf = (file) => {
|
|
36
67
|
if (String$1.endsWith(".zip")(file)) return "zip";
|
|
@@ -106,11 +137,7 @@ const verify = (fetched) => {
|
|
|
106
137
|
const data = new Uint8Array(fetched.data);
|
|
107
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));
|
|
108
139
|
};
|
|
109
|
-
const
|
|
110
|
-
const compressed = new Blob([new Uint8Array(data)]).stream();
|
|
111
|
-
return attempt("gunzip")(() => new Response(compressed.pipeThrough(new DecompressionStream("gzip"))).arrayBuffer());
|
|
112
|
-
};
|
|
113
|
-
const tarEntries = (data) => gunzipped(data).pipe(Effect.map(untar), Effect.map((files) => new Map(pipe(files, Array.map((file) => [file.name, file.fileData])))));
|
|
140
|
+
const tarEntries = (data) => readTarGz(data).pipe(Effect.map(Array.map(({ header, bytes }) => [header.path, bytes])), Effect.map((entries) => new Map(entries)));
|
|
114
141
|
const zipEntries = (data) => Effect.callback((resume) => {
|
|
115
142
|
unzip(data, (failure, files) => {
|
|
116
143
|
if (failure === null) {
|
|
@@ -175,26 +202,6 @@ const locateBinary = (binary) => Effect.gen(function* locate() {
|
|
|
175
202
|
if (!(yield* isPlaced(binary, platform))) return yield* configMissing(`${binary.name} ${binary.version} ${NOT_INSTALLED}`);
|
|
176
203
|
return yield* binaryPath(binary, platform);
|
|
177
204
|
});
|
|
178
|
-
// src/shared/lib/process.ts
|
|
179
|
-
const SUCCESS = 0;
|
|
180
|
-
const stdinOf = (input) => pipe(Option.fromNullishOr(input), Option.match({
|
|
181
|
-
onNone: () => "ignore",
|
|
182
|
-
onSome: (text) => Stream.make(new TextEncoder().encode(text))
|
|
183
|
-
}));
|
|
184
|
-
/** @internal */
|
|
185
|
-
const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => Effect.gen(function* run() {
|
|
186
|
-
const handle = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).spawn(ChildProcess.make(file, args, {
|
|
187
|
-
cwd: root,
|
|
188
|
-
env,
|
|
189
|
-
extendEnv: true,
|
|
190
|
-
stdin: stdinOf(input)
|
|
191
|
-
}));
|
|
192
|
-
const [text, exitCode] = yield* Effect.all([handle[output].pipe(Stream.decodeText, Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
193
|
-
return {
|
|
194
|
-
valid: exitCode === SUCCESS,
|
|
195
|
-
output: text
|
|
196
|
-
};
|
|
197
|
-
}).pipe(Effect.scoped);
|
|
198
205
|
/** @internal */
|
|
199
206
|
const runVendored = Function.dual(2, (binary, invocation) => locateBinary(binary).pipe(Effect.flatMap((file) => runCaptured({
|
|
200
207
|
...invocation,
|
|
@@ -211,6 +218,6 @@ const finish = (report) => {
|
|
|
211
218
|
if (report.output === "") return Effect.void;
|
|
212
219
|
return writeTo("stdout", `${report.output}\n`);
|
|
213
220
|
};
|
|
214
|
-
export {
|
|
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 };
|
|
215
222
|
|
|
216
|
-
//# sourceMappingURL=output-
|
|
223
|
+
//# sourceMappingURL=output-BdvTIQ-k.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,W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CAAC,CAAC,KAAK,OAAO,SAAS,SAAS,YAAY;CAAE,GAAG;CAAY;AAAK,CAAC,CAAC,CAAC,CAC/F;;AC/BA,MAAa,UAGTE,SAAG,KAAK,IAAmB,MAAY,SACzC,OAAO,IAAI,UAAU,QAAQ;CAC3B,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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as runCli } from "./run-cli-
|
|
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
3
|
import { Effect, Layer } from "effect";
|
|
4
4
|
import { FetchHttpClient } from "effect/http";
|
|
5
5
|
// src/app/postinstall.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as VpToolsError, n as writeTo } from "./output-BdvTIQ-k.mjs";
|
|
2
2
|
import { Cause, Effect, Layer, Option, Schema, pipe } from "effect";
|
|
3
3
|
import { runMain } from "@effect/platform-node-shared/NodeRuntime";
|
|
4
4
|
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
@@ -21,4 +21,4 @@ const runCli = (program) => {
|
|
|
21
21
|
};
|
|
22
22
|
export { runCli as t };
|
|
23
23
|
|
|
24
|
-
//# sourceMappingURL=run-cli-
|
|
24
|
+
//# sourceMappingURL=run-cli-BiPFbX9J.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli-
|
|
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"}
|