@r_masseater/vite-plus-adopt 0.9.0 → 0.10.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 +26 -26
- package/THIRD-PARTY-NOTICES +55 -0
- package/dist/cli.mjs +1 -1
- package/dist/fsd.d.mts +1 -1
- package/dist/fsd.mjs +1 -1
- package/dist/{index-BBBvZ4td.d.mts → index-DiN12XmL.d.mts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/steiger-BX9S5pik.mjs +6225 -0
- package/dist/steiger-BX9S5pik.mjs.map +1 -0
- package/dist/{vpa-WxGKHnY6.mjs → vpa-DHB6y2A5.mjs} +177 -177
- package/dist/vpa-DHB6y2A5.mjs.map +1 -0
- package/package.json +17 -4
- package/dist/vpa-WxGKHnY6.mjs.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { a as ACTIONLINT, c as readTarGz, f as checksFailed, l as runCaptured, m as toolFailed, n as writeTo, o as BETTERLEAKS, p as configMissing, r as runVendored, s as ZIZMOR, t as finish, u as attempt } from "./output-BdvTIQ-k.mjs";
|
|
2
2
|
import { n as toJson } from "./json-QtVKpodH.mjs";
|
|
3
|
+
import { n as linter, r as processConfiguration } from "./steiger-BX9S5pik.mjs";
|
|
3
4
|
import { Array, Config, Context, Effect, Exit, FileSystem, Function, Layer, Option, Order, Path, Predicate, Record, Redacted, Schema, String, pipe } from "effect";
|
|
4
5
|
import { resolveConfigFromFile } from "vite-plus";
|
|
5
6
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
|
|
6
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
7
|
-
import { parse } from "yaml";
|
|
8
7
|
import format from "@commitlint/format";
|
|
9
8
|
import lint from "@commitlint/lint";
|
|
10
9
|
import load from "@commitlint/load";
|
|
10
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
11
11
|
import { lint as lint$1 } from "markdownlint/promise";
|
|
12
12
|
import { loadPackagesFromRawConfig } from "@textlint/config-loader";
|
|
13
13
|
import { TextlintKernelDescriptor } from "@textlint/kernel";
|
|
14
14
|
import { createLinter, loadLinterFormatter } from "textlint";
|
|
15
15
|
import { builtInPlugins } from "textlint/lib/src/loader/TextlintrcLoader.js";
|
|
16
16
|
import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils";
|
|
17
|
+
import { parse } from "yaml";
|
|
17
18
|
import { stringify } from "smol-toml";
|
|
18
19
|
import { minimatch } from "minimatch";
|
|
19
20
|
import { findWorkspaceProjectsNoCheck } from "@pnpm/workspace.projects-reader";
|
|
20
21
|
import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
|
|
21
22
|
import { intersects, valid, validRange } from "semver";
|
|
22
|
-
import { linter, processConfiguration } from "steiger";
|
|
23
23
|
// src/entities/vite-config/model/config.ts
|
|
24
24
|
const CONFIG_FILES = [
|
|
25
25
|
"vite.config.ts",
|
|
@@ -38,6 +38,179 @@ const loadViteConfig = (root) => findConfigFile(root).pipe(Effect.flatMap((file)
|
|
|
38
38
|
const requireSection = (key) => (config) => Effect.fromOption(Option.fromNullishOr(config[key])).pipe(Effect.mapError(() => configMissing(`vite.config has no "${key}" section`)));
|
|
39
39
|
/** @internal */
|
|
40
40
|
const loadSection = Function.dual(2, (root, key) => loadViteConfig(root).pipe(Effect.flatMap(requireSection(key))));
|
|
41
|
+
// src/features/check-text/model/commitlint.ts
|
|
42
|
+
const DATA_FIRST_ARITY_3$3 = 3;
|
|
43
|
+
const COMMENT_CHAR = "#";
|
|
44
|
+
const parserOptionsOf = (loaded) => {
|
|
45
|
+
return {
|
|
46
|
+
...pipe(Option.fromNullishOr(loaded.parserPreset), Option.map(({ parserOpts }) => parserOpts), Option.filter(Predicate.isObject), Option.getOrElse(() => ({}))),
|
|
47
|
+
commentChar: COMMENT_CHAR
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const lintOptionsOf = (loaded) => ({
|
|
51
|
+
parserOpts: parserOptionsOf(loaded),
|
|
52
|
+
plugins: loaded.plugins,
|
|
53
|
+
ignores: loaded.ignores ?? [],
|
|
54
|
+
defaultIgnores: loaded.defaultIgnores ?? true
|
|
55
|
+
});
|
|
56
|
+
/** @internal */
|
|
57
|
+
const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messages) => Effect.gen(function* lintMessages() {
|
|
58
|
+
const loaded = yield* attempt("commitlint")(() => load(config, { cwd: root }));
|
|
59
|
+
const results = yield* Effect.forEach(messages, (message) => attempt("commitlint")(() => lint(message, loaded.rules, lintOptionsOf(loaded))), { concurrency: 1 });
|
|
60
|
+
return {
|
|
61
|
+
valid: pipe(results, Array.every((result) => result.valid)),
|
|
62
|
+
output: format({ results }, { color: false })
|
|
63
|
+
};
|
|
64
|
+
}));
|
|
65
|
+
Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messageFile) => Effect.gen(function* read() {
|
|
66
|
+
const message = yield* (yield* FileSystem.FileSystem).readFileString(messageFile);
|
|
67
|
+
return yield* lintCommitMessages(config, root, [message]);
|
|
68
|
+
}));
|
|
69
|
+
/** @internal */
|
|
70
|
+
const withSection = Function.dual(2, (key, run) => (context) => pipe(Option.fromNullishOr(context.config[key]), Option.match({
|
|
71
|
+
onNone: () => Effect.succeedNone,
|
|
72
|
+
onSome: (section) => Effect.asSome(run(section, context))
|
|
73
|
+
})));
|
|
74
|
+
// src/shared/lib/git.ts
|
|
75
|
+
const DATA_FIRST_ARITY$3 = 2;
|
|
76
|
+
/** @internal */
|
|
77
|
+
const listGitFiles = Function.dual(DATA_FIRST_ARITY$3, (root, pathspecs) => Effect.gen(function* list() {
|
|
78
|
+
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
79
|
+
"-c",
|
|
80
|
+
"core.quotePath=false",
|
|
81
|
+
"ls-files",
|
|
82
|
+
"-co",
|
|
83
|
+
"--exclude-standard",
|
|
84
|
+
"-z",
|
|
85
|
+
"--",
|
|
86
|
+
...pathspecs
|
|
87
|
+
], { cwd: root }));
|
|
88
|
+
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
89
|
+
}));
|
|
90
|
+
/** @internal */
|
|
91
|
+
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$3, (root, range) => Effect.gen(function* messages() {
|
|
92
|
+
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
93
|
+
"log",
|
|
94
|
+
"-z",
|
|
95
|
+
"--first-parent",
|
|
96
|
+
"--format=%B",
|
|
97
|
+
range,
|
|
98
|
+
"--"
|
|
99
|
+
], { cwd: root }));
|
|
100
|
+
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
101
|
+
}));
|
|
102
|
+
// src/features/check-text/model/markdownlint.ts
|
|
103
|
+
const DATA_FIRST_ARITY_3$2 = 3;
|
|
104
|
+
const formatError = (file) => (error) => {
|
|
105
|
+
const detail = pipe([error.errorDetail, error.errorContext], Array.filter((part) => part !== null && part !== ""), Array.map((part) => ` [${part}]`), Array.join(""));
|
|
106
|
+
return `${file}:${error.lineNumber} ${Array.join(error.ruleNames, "/")} ${error.ruleDescription}${detail}`;
|
|
107
|
+
};
|
|
108
|
+
const optionsOf = (config, files) => ({
|
|
109
|
+
files: [...files],
|
|
110
|
+
...pipe(Option.fromNullishOr(config.config), Option.match({
|
|
111
|
+
onNone: () => ({}),
|
|
112
|
+
onSome: (rules) => ({ config: rules })
|
|
113
|
+
})),
|
|
114
|
+
...pipe(Option.fromNullishOr(config.customRules), Option.match({
|
|
115
|
+
onNone: () => ({}),
|
|
116
|
+
onSome: (rules) => ({ customRules: [...rules] })
|
|
117
|
+
}))
|
|
118
|
+
});
|
|
119
|
+
/** @internal */
|
|
120
|
+
const lintMarkdown = Function.dual(DATA_FIRST_ARITY_3$2, (config, root, files) => Effect.gen(function* markdown() {
|
|
121
|
+
const path = yield* Path.Path;
|
|
122
|
+
const absolute = pipe(files, Array.map((file) => path.join(root, file)));
|
|
123
|
+
const results = yield* attempt("markdownlint")(() => lint$1(optionsOf(config, absolute)));
|
|
124
|
+
const linesOf = ([file, errors]) => {
|
|
125
|
+
const format = formatError(path.relative(root, file));
|
|
126
|
+
return pipe(errors, Array.map(format));
|
|
127
|
+
};
|
|
128
|
+
const lines = pipe(Record.toEntries(results), Array.flatMap(linesOf));
|
|
129
|
+
return {
|
|
130
|
+
valid: Array.isArrayEmpty(lines),
|
|
131
|
+
output: Array.join(lines, "\n")
|
|
132
|
+
};
|
|
133
|
+
}));
|
|
134
|
+
// src/features/check-text/model/textlint-presets.ts
|
|
135
|
+
const NO_OPTIONS = {};
|
|
136
|
+
const isRuleOptions = Predicate.or(Predicate.isBoolean, Predicate.isReadonlyObject);
|
|
137
|
+
/** @internal */
|
|
138
|
+
const presetRulesOf = (config) => {
|
|
139
|
+
const settings = config.rules ?? {};
|
|
140
|
+
return pipe(Record.toEntries(config.presets ?? {}), Array.filter(([name]) => Boolean(settings[name])), Array.flatMap(([name, preset]) => {
|
|
141
|
+
const userOptions = pipe(Option.liftPredicate(settings[name], Predicate.isReadonlyObject), Option.getOrElse(() => NO_OPTIONS));
|
|
142
|
+
return pipe(Record.toEntries(preset.rules), Array.map(([key, rule]) => ({
|
|
143
|
+
ruleId: normalizeTextlintPresetSubRuleKey({
|
|
144
|
+
preset: name,
|
|
145
|
+
rule: key
|
|
146
|
+
}),
|
|
147
|
+
rule,
|
|
148
|
+
options: pipe(Record.get(userOptions, key), Option.filter((value) => value !== true), Option.filter(isRuleOptions), Option.getOrElse(() => preset.rulesConfig[key] ?? true))
|
|
149
|
+
})), Array.filter(({ options }) => options !== false));
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
/** @internal */
|
|
153
|
+
const rawConfigOf = (config) => {
|
|
154
|
+
const { ignores: _ignores, presets = {}, sources: _sources, ...rawConfig } = config;
|
|
155
|
+
return {
|
|
156
|
+
...rawConfig,
|
|
157
|
+
rules: pipe(rawConfig.rules ?? {}, Record.filter((_setting, name) => !Record.has(presets, name)))
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
// src/features/check-text/model/textlint.ts
|
|
161
|
+
const DATA_FIRST_ARITY_3$1 = 3;
|
|
162
|
+
const descriptorOf = (loaded, root, config) => {
|
|
163
|
+
if (!loaded.ok) return Effect.fail(toolFailed("textlint")(loaded.error.message));
|
|
164
|
+
return Effect.succeed(new TextlintKernelDescriptor({
|
|
165
|
+
rules: [...loaded.config.rules, ...presetRulesOf(config)],
|
|
166
|
+
filterRules: loaded.config.filterRules,
|
|
167
|
+
plugins: [...builtInPlugins, ...loaded.config.plugins],
|
|
168
|
+
configBaseDir: root
|
|
169
|
+
}));
|
|
170
|
+
};
|
|
171
|
+
/** @internal */
|
|
172
|
+
const lintTexts = Function.dual(DATA_FIRST_ARITY_3$1, (config, root, files) => Effect.gen(function* lint() {
|
|
173
|
+
const path = yield* Path.Path;
|
|
174
|
+
yield* attempt("textlint")(() => import("vite-plus/register"));
|
|
175
|
+
const loaded = yield* attempt("textlint")(() => loadPackagesFromRawConfig({
|
|
176
|
+
rawConfig: rawConfigOf(config),
|
|
177
|
+
node_moduleDir: path.join(root, "node_modules")
|
|
178
|
+
}));
|
|
179
|
+
const descriptor = yield* descriptorOf(loaded, root, config);
|
|
180
|
+
const absolute = pipe(files, Array.map((file) => path.join(root, file)));
|
|
181
|
+
const results = yield* attempt("textlint")(() => createLinter({ descriptor }).lintFiles([...absolute]));
|
|
182
|
+
const formatter = yield* attempt("textlint")(() => loadLinterFormatter({
|
|
183
|
+
formatterName: "stylish",
|
|
184
|
+
color: false
|
|
185
|
+
}));
|
|
186
|
+
return {
|
|
187
|
+
valid: pipe(results, Array.every((result) => Array.isArrayEmpty(result.messages))),
|
|
188
|
+
output: formatter.format(results)
|
|
189
|
+
};
|
|
190
|
+
}));
|
|
191
|
+
// src/features/check-text/model/text-checks.ts
|
|
192
|
+
const MARKDOWN = "*.md";
|
|
193
|
+
const GLOB_PATHSPEC = ":(glob)";
|
|
194
|
+
const markdownFiles = (root, ignores = []) => listGitFiles(root, [MARKDOWN, ...pipe(ignores, Array.map((glob) => `:(glob,exclude)${glob}`))]);
|
|
195
|
+
const sourceFiles = (root, files) => listGitFiles(root, pipe(files, Array.map((glob) => `${GLOB_PATHSPEC}${glob}`)));
|
|
196
|
+
const mergeReports = (reports) => ({
|
|
197
|
+
valid: pipe(reports, Array.every((report) => report.valid)),
|
|
198
|
+
output: pipe(reports, Array.map((report) => report.output), Array.filter(String.isNonEmpty), Array.join("\n"))
|
|
199
|
+
});
|
|
200
|
+
/** @internal */
|
|
201
|
+
const textlintCheck = withSection("textlint", (config, { root }) => {
|
|
202
|
+
const markdown = markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintTexts(config, root, files)));
|
|
203
|
+
const presets = config.presets ?? {};
|
|
204
|
+
const sources = pipe(config.sources ?? [], Array.map(({ files, ...source }) => Effect.flatMap(sourceFiles(root, files), (listed) => lintTexts({
|
|
205
|
+
...source,
|
|
206
|
+
presets
|
|
207
|
+
}, root, listed))));
|
|
208
|
+
return Effect.all([markdown, ...sources], { concurrency: 1 }).pipe(Effect.map(mergeReports));
|
|
209
|
+
});
|
|
210
|
+
/** @internal */
|
|
211
|
+
const markdownlintCheck = withSection("markdownlint", (config, { root }) => markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintMarkdown(config, root, files))));
|
|
212
|
+
/** @internal */
|
|
213
|
+
const commitlintCheck = withSection("commitlint", (config, { root, base }) => listCommitMessages(root, `${base}..HEAD`).pipe(Effect.flatMap((messages) => lintCommitMessages(config, root, messages))));
|
|
41
214
|
// src/shared/config/skills.ts
|
|
42
215
|
const Repository = Schema.String.check(Schema.isPattern(/^[\w-][\w.-]*\/[\w.-]+$/u));
|
|
43
216
|
const LocalDirectory = Schema.String.check(Schema.isPattern(/^\.\/[\w.-]+(?:\/[\w.-]+)*$/u));
|
|
@@ -407,179 +580,6 @@ const installSkills = (root) => Effect.gen(function* install() {
|
|
|
407
580
|
yield* linkSkills(root)(links);
|
|
408
581
|
return Option.some(links.length);
|
|
409
582
|
});
|
|
410
|
-
// src/features/lint-text/model/commitlint.ts
|
|
411
|
-
const DATA_FIRST_ARITY_3$3 = 3;
|
|
412
|
-
const COMMENT_CHAR = "#";
|
|
413
|
-
const parserOptionsOf = (loaded) => {
|
|
414
|
-
return {
|
|
415
|
-
...pipe(Option.fromNullishOr(loaded.parserPreset), Option.map(({ parserOpts }) => parserOpts), Option.filter(Predicate.isObject), Option.getOrElse(() => ({}))),
|
|
416
|
-
commentChar: COMMENT_CHAR
|
|
417
|
-
};
|
|
418
|
-
};
|
|
419
|
-
const lintOptionsOf = (loaded) => ({
|
|
420
|
-
parserOpts: parserOptionsOf(loaded),
|
|
421
|
-
plugins: loaded.plugins,
|
|
422
|
-
ignores: loaded.ignores ?? [],
|
|
423
|
-
defaultIgnores: loaded.defaultIgnores ?? true
|
|
424
|
-
});
|
|
425
|
-
/** @internal */
|
|
426
|
-
const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messages) => Effect.gen(function* lintMessages() {
|
|
427
|
-
const loaded = yield* attempt("commitlint")(() => load(config, { cwd: root }));
|
|
428
|
-
const results = yield* Effect.forEach(messages, (message) => attempt("commitlint")(() => lint(message, loaded.rules, lintOptionsOf(loaded))), { concurrency: 1 });
|
|
429
|
-
return {
|
|
430
|
-
valid: pipe(results, Array.every((result) => result.valid)),
|
|
431
|
-
output: format({ results }, { color: false })
|
|
432
|
-
};
|
|
433
|
-
}));
|
|
434
|
-
Function.dual(DATA_FIRST_ARITY_3$3, (config, root, messageFile) => Effect.gen(function* read() {
|
|
435
|
-
const message = yield* (yield* FileSystem.FileSystem).readFileString(messageFile);
|
|
436
|
-
return yield* lintCommitMessages(config, root, [message]);
|
|
437
|
-
}));
|
|
438
|
-
/** @internal */
|
|
439
|
-
const withSection = Function.dual(2, (key, run) => (context) => pipe(Option.fromNullishOr(context.config[key]), Option.match({
|
|
440
|
-
onNone: () => Effect.succeedNone,
|
|
441
|
-
onSome: (section) => Effect.asSome(run(section, context))
|
|
442
|
-
})));
|
|
443
|
-
// src/shared/lib/git.ts
|
|
444
|
-
const DATA_FIRST_ARITY$3 = 2;
|
|
445
|
-
/** @internal */
|
|
446
|
-
const listGitFiles = Function.dual(DATA_FIRST_ARITY$3, (root, pathspecs) => Effect.gen(function* list() {
|
|
447
|
-
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
448
|
-
"-c",
|
|
449
|
-
"core.quotePath=false",
|
|
450
|
-
"ls-files",
|
|
451
|
-
"-co",
|
|
452
|
-
"--exclude-standard",
|
|
453
|
-
"-z",
|
|
454
|
-
"--",
|
|
455
|
-
...pathspecs
|
|
456
|
-
], { cwd: root }));
|
|
457
|
-
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
458
|
-
}));
|
|
459
|
-
/** @internal */
|
|
460
|
-
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$3, (root, range) => Effect.gen(function* messages() {
|
|
461
|
-
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
462
|
-
"log",
|
|
463
|
-
"-z",
|
|
464
|
-
"--first-parent",
|
|
465
|
-
"--format=%B",
|
|
466
|
-
range,
|
|
467
|
-
"--"
|
|
468
|
-
], { cwd: root }));
|
|
469
|
-
return pipe(String.split(output, "\0"), Array.filter(String.isNonEmpty));
|
|
470
|
-
}));
|
|
471
|
-
// src/features/lint-text/model/markdownlint.ts
|
|
472
|
-
const DATA_FIRST_ARITY_3$2 = 3;
|
|
473
|
-
const formatError = (file) => (error) => {
|
|
474
|
-
const detail = pipe([error.errorDetail, error.errorContext], Array.filter((part) => part !== null && part !== ""), Array.map((part) => ` [${part}]`), Array.join(""));
|
|
475
|
-
return `${file}:${error.lineNumber} ${Array.join(error.ruleNames, "/")} ${error.ruleDescription}${detail}`;
|
|
476
|
-
};
|
|
477
|
-
const optionsOf = (config, files) => ({
|
|
478
|
-
files: [...files],
|
|
479
|
-
...pipe(Option.fromNullishOr(config.config), Option.match({
|
|
480
|
-
onNone: () => ({}),
|
|
481
|
-
onSome: (rules) => ({ config: rules })
|
|
482
|
-
})),
|
|
483
|
-
...pipe(Option.fromNullishOr(config.customRules), Option.match({
|
|
484
|
-
onNone: () => ({}),
|
|
485
|
-
onSome: (rules) => ({ customRules: [...rules] })
|
|
486
|
-
}))
|
|
487
|
-
});
|
|
488
|
-
/** @internal */
|
|
489
|
-
const lintMarkdown = Function.dual(DATA_FIRST_ARITY_3$2, (config, root, files) => Effect.gen(function* markdown() {
|
|
490
|
-
const path = yield* Path.Path;
|
|
491
|
-
const absolute = pipe(files, Array.map((file) => path.join(root, file)));
|
|
492
|
-
const results = yield* attempt("markdownlint")(() => lint$1(optionsOf(config, absolute)));
|
|
493
|
-
const linesOf = ([file, errors]) => {
|
|
494
|
-
const format = formatError(path.relative(root, file));
|
|
495
|
-
return pipe(errors, Array.map(format));
|
|
496
|
-
};
|
|
497
|
-
const lines = pipe(Record.toEntries(results), Array.flatMap(linesOf));
|
|
498
|
-
return {
|
|
499
|
-
valid: Array.isArrayEmpty(lines),
|
|
500
|
-
output: Array.join(lines, "\n")
|
|
501
|
-
};
|
|
502
|
-
}));
|
|
503
|
-
// src/features/lint-text/model/textlint-presets.ts
|
|
504
|
-
const NO_OPTIONS = {};
|
|
505
|
-
const isRuleOptions = Predicate.or(Predicate.isBoolean, Predicate.isReadonlyObject);
|
|
506
|
-
/** @internal */
|
|
507
|
-
const presetRulesOf = (config) => {
|
|
508
|
-
const settings = config.rules ?? {};
|
|
509
|
-
return pipe(Record.toEntries(config.presets ?? {}), Array.filter(([name]) => Boolean(settings[name])), Array.flatMap(([name, preset]) => {
|
|
510
|
-
const userOptions = pipe(Option.liftPredicate(settings[name], Predicate.isReadonlyObject), Option.getOrElse(() => NO_OPTIONS));
|
|
511
|
-
return pipe(Record.toEntries(preset.rules), Array.map(([key, rule]) => ({
|
|
512
|
-
ruleId: normalizeTextlintPresetSubRuleKey({
|
|
513
|
-
preset: name,
|
|
514
|
-
rule: key
|
|
515
|
-
}),
|
|
516
|
-
rule,
|
|
517
|
-
options: pipe(Record.get(userOptions, key), Option.filter((value) => value !== true), Option.filter(isRuleOptions), Option.getOrElse(() => preset.rulesConfig[key] ?? true))
|
|
518
|
-
})), Array.filter(({ options }) => options !== false));
|
|
519
|
-
}));
|
|
520
|
-
};
|
|
521
|
-
/** @internal */
|
|
522
|
-
const rawConfigOf = (config) => {
|
|
523
|
-
const { ignores: _ignores, presets = {}, sources: _sources, ...rawConfig } = config;
|
|
524
|
-
return {
|
|
525
|
-
...rawConfig,
|
|
526
|
-
rules: pipe(rawConfig.rules ?? {}, Record.filter((_setting, name) => !Record.has(presets, name)))
|
|
527
|
-
};
|
|
528
|
-
};
|
|
529
|
-
// src/features/lint-text/model/textlint.ts
|
|
530
|
-
const DATA_FIRST_ARITY_3$1 = 3;
|
|
531
|
-
const descriptorOf = (loaded, root, config) => {
|
|
532
|
-
if (!loaded.ok) return Effect.fail(toolFailed("textlint")(loaded.error.message));
|
|
533
|
-
return Effect.succeed(new TextlintKernelDescriptor({
|
|
534
|
-
rules: [...loaded.config.rules, ...presetRulesOf(config)],
|
|
535
|
-
filterRules: loaded.config.filterRules,
|
|
536
|
-
plugins: [...builtInPlugins, ...loaded.config.plugins],
|
|
537
|
-
configBaseDir: root
|
|
538
|
-
}));
|
|
539
|
-
};
|
|
540
|
-
/** @internal */
|
|
541
|
-
const lintTexts = Function.dual(DATA_FIRST_ARITY_3$1, (config, root, files) => Effect.gen(function* lint() {
|
|
542
|
-
const path = yield* Path.Path;
|
|
543
|
-
yield* attempt("textlint")(() => import("vite-plus/register"));
|
|
544
|
-
const loaded = yield* attempt("textlint")(() => loadPackagesFromRawConfig({
|
|
545
|
-
rawConfig: rawConfigOf(config),
|
|
546
|
-
node_moduleDir: path.join(root, "node_modules")
|
|
547
|
-
}));
|
|
548
|
-
const descriptor = yield* descriptorOf(loaded, root, config);
|
|
549
|
-
const absolute = pipe(files, Array.map((file) => path.join(root, file)));
|
|
550
|
-
const results = yield* attempt("textlint")(() => createLinter({ descriptor }).lintFiles([...absolute]));
|
|
551
|
-
const formatter = yield* attempt("textlint")(() => loadLinterFormatter({
|
|
552
|
-
formatterName: "stylish",
|
|
553
|
-
color: false
|
|
554
|
-
}));
|
|
555
|
-
return {
|
|
556
|
-
valid: pipe(results, Array.every((result) => Array.isArrayEmpty(result.messages))),
|
|
557
|
-
output: formatter.format(results)
|
|
558
|
-
};
|
|
559
|
-
}));
|
|
560
|
-
// src/features/lint-text/model/text-checks.ts
|
|
561
|
-
const MARKDOWN = "*.md";
|
|
562
|
-
const GLOB_PATHSPEC = ":(glob)";
|
|
563
|
-
const markdownFiles = (root, ignores = []) => listGitFiles(root, [MARKDOWN, ...pipe(ignores, Array.map((glob) => `:(glob,exclude)${glob}`))]);
|
|
564
|
-
const sourceFiles = (root, files) => listGitFiles(root, pipe(files, Array.map((glob) => `${GLOB_PATHSPEC}${glob}`)));
|
|
565
|
-
const mergeReports = (reports) => ({
|
|
566
|
-
valid: pipe(reports, Array.every((report) => report.valid)),
|
|
567
|
-
output: pipe(reports, Array.map((report) => report.output), Array.filter(String.isNonEmpty), Array.join("\n"))
|
|
568
|
-
});
|
|
569
|
-
/** @internal */
|
|
570
|
-
const textlintCheck = withSection("textlint", (config, { root }) => {
|
|
571
|
-
const markdown = markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintTexts(config, root, files)));
|
|
572
|
-
const presets = config.presets ?? {};
|
|
573
|
-
const sources = pipe(config.sources ?? [], Array.map(({ files, ...source }) => Effect.flatMap(sourceFiles(root, files), (listed) => lintTexts({
|
|
574
|
-
...source,
|
|
575
|
-
presets
|
|
576
|
-
}, root, listed))));
|
|
577
|
-
return Effect.all([markdown, ...sources], { concurrency: 1 }).pipe(Effect.map(mergeReports));
|
|
578
|
-
});
|
|
579
|
-
/** @internal */
|
|
580
|
-
const markdownlintCheck = withSection("markdownlint", (config, { root }) => markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintMarkdown(config, root, files))));
|
|
581
|
-
/** @internal */
|
|
582
|
-
const commitlintCheck = withSection("commitlint", (config, { root, base }) => listCommitMessages(root, `${base}..HEAD`).pipe(Effect.flatMap((messages) => lintCommitMessages(config, root, messages))));
|
|
583
583
|
// src/features/scan-secrets/model/betterleaks.ts
|
|
584
584
|
const toBetterleaksToml = (config) => {
|
|
585
585
|
const { ignoredSecrets: _ignoredSecrets, ...rest } = config;
|
|
@@ -1020,4 +1020,4 @@ const runVpa = Function.dual(DATA_FIRST_ARITY, (root, args) => pipe(args, Array.
|
|
|
1020
1020
|
})));
|
|
1021
1021
|
export { loadViteConfig as n, runVpa as t };
|
|
1022
1022
|
|
|
1023
|
-
//# sourceMappingURL=vpa-
|
|
1023
|
+
//# sourceMappingURL=vpa-DHB6y2A5.mjs.map
|