@r_masseater/y8 0.1.0 → 0.2.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/dist/{app-D5BcM070.mjs → app-DJaOhWCw.mjs} +49 -41
- package/dist/app-DJaOhWCw.mjs.map +1 -0
- package/dist/cli.mjs +2 -2
- package/dist/{index-CS7Sntk8.d.mts → index-CkE9LH6X.d.mts} +5 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/kuromojin.mjs +1 -1
- package/dist/{split-morphemes-BS74IEHA.mjs → split-morphemes-DC2pNnQU.mjs} +22 -15
- package/dist/split-morphemes-DC2pNnQU.mjs.map +1 -0
- package/dist/vite.d.mts +1 -1
- package/package.json +7 -7
- package/skills/lint-markdown/SKILL.md +1 -1
- package/dist/app-D5BcM070.mjs.map +0 -1
- package/dist/split-morphemes-BS74IEHA.mjs.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as FIELD, c as Y8Error, d as traceparent, f as present, h as settingOf$1, i as native, l as failedWith, m as callAddon, o as TAGS, s as sourceView, u as sortByPosition } from "./split-morphemes-
|
|
1
|
+
import { a as FIELD, c as Y8Error, d as traceparent, f as present, h as settingOf$1, i as native, l as failedWith, m as callAddon, o as TAGS, s as sourceView, u as sortByPosition } from "./split-morphemes-DC2pNnQU.mjs";
|
|
2
2
|
import { Array, Effect, Function, Match, Option, Predicate, Record, Schema, String as String$1, pipe } from "effect";
|
|
3
3
|
import { minimatch } from "minimatch";
|
|
4
4
|
import { parse } from "yaml";
|
|
5
5
|
// src/entities/rule/model/agnix.ts
|
|
6
|
-
const agnix = {
|
|
6
|
+
const agnix = { builtin: "agnix" };
|
|
7
7
|
// src/entities/rule/model/define.ts
|
|
8
8
|
const defineRule = (rule) => rule;
|
|
9
9
|
const definePlugin = (plugin) => plugin;
|
|
10
10
|
// src/entities/rule/model/resolve.ts
|
|
11
11
|
const BUILTIN = "markdownlint";
|
|
12
|
-
const SEPARATOR$
|
|
12
|
+
const SEPARATOR$1 = "/";
|
|
13
13
|
const START = 0;
|
|
14
14
|
const reportedSeverity = (setting) => Match.value(setting.severity).pipe(Match.when("warn", () => "warn"), Match.orElse(() => "error"));
|
|
15
|
-
const ruleIdOf = (id) => pipe(String$1.indexOf(SEPARATOR$
|
|
15
|
+
const ruleIdOf = (id) => pipe(String$1.indexOf(SEPARATOR$1)(id), Option.match({
|
|
16
16
|
onNone: () => ({
|
|
17
17
|
plugin: BUILTIN,
|
|
18
18
|
name: id
|
|
@@ -29,14 +29,14 @@ const coreEntry = (setting) => Match.value(setting.severity).pipe(Match.when("of
|
|
|
29
29
|
severity: coreSeverity(severity)
|
|
30
30
|
})));
|
|
31
31
|
const ENABLED = settingOf$1("error");
|
|
32
|
-
const configured = (config, plugin) => (name) => pipe(config.rules ?? {}, Record.get(`${plugin}${SEPARATOR$
|
|
32
|
+
const configured = (config, plugin) => (name) => pipe(config.rules ?? {}, Record.get(`${plugin}${SEPARATOR$1}${name}`), Option.map(settingOf$1));
|
|
33
33
|
const scriptRules = (config) => ([plugin, value]) => pipe(Record.toEntries(value.rules ?? {}), Array.map(([name, rule]) => ({
|
|
34
|
-
id: `${plugin}${SEPARATOR$
|
|
34
|
+
id: `${plugin}${SEPARATOR$1}${name}`,
|
|
35
35
|
rule,
|
|
36
36
|
setting: Option.getOrElse(configured(config, plugin)(name), () => ENABLED)
|
|
37
37
|
})), Array.filter(({ setting }) => isOn(setting)));
|
|
38
38
|
const compatRule = (config, plugin) => (rule) => pipe(Array.head(rule.names), Option.map((name) => ({
|
|
39
|
-
id: `${plugin}${SEPARATOR$
|
|
39
|
+
id: `${plugin}${SEPARATOR$1}${name}`,
|
|
40
40
|
rule,
|
|
41
41
|
setting: pipe(rule.names, Array.findFirst(configured(config, plugin)), Option.getOrElse(() => ENABLED))
|
|
42
42
|
})));
|
|
@@ -45,18 +45,15 @@ const builtinEntries = (config) => pipe(Record.toEntries(config.rules ?? {}), Ar
|
|
|
45
45
|
...ruleIdOf(id),
|
|
46
46
|
setting: settingOf$1(entry)
|
|
47
47
|
})), Array.filter(({ plugin }) => plugin === BUILTIN), Array.map(({ name, setting }) => [name, coreEntry(setting)]), Record.fromEntries);
|
|
48
|
-
const
|
|
48
|
+
const severities = (config, plugin) => pipe(Record.toEntries(config.rules ?? {}), Array.map(([id, entry]) => ({
|
|
49
49
|
...ruleIdOf(id),
|
|
50
50
|
setting: settingOf$1(entry)
|
|
51
|
-
})), Array.filter((rule) => rule.plugin === plugin), Array.map(({ name, setting }) => [name, setting]), Record.fromEntries);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
disabled: pipe(Record.toEntries(settings), Array.filter(([, setting]) => !isOn(setting)), Array.map(([name]) => name))
|
|
58
|
-
};
|
|
59
|
-
};
|
|
51
|
+
})), Array.filter((rule) => rule.plugin === plugin), Array.map(({ name, setting }) => [name, setting.severity]), Record.fromEntries);
|
|
52
|
+
const builtinRules = (config) => ([prefix, value]) => pipe(Option.fromNullishOr(value.builtin), Option.map((name) => ({
|
|
53
|
+
name,
|
|
54
|
+
prefix,
|
|
55
|
+
rules: severities(config, prefix)
|
|
56
|
+
})), Option.toArray);
|
|
60
57
|
const resolve = (config) => {
|
|
61
58
|
const plugins = Record.toEntries(config.plugins ?? {});
|
|
62
59
|
return {
|
|
@@ -66,10 +63,30 @@ const resolve = (config) => {
|
|
|
66
63
|
},
|
|
67
64
|
scripts: pipe(plugins, Array.flatMap(scriptRules(config))),
|
|
68
65
|
compat: pipe(plugins, Array.flatMap(compatRules(config))),
|
|
69
|
-
|
|
66
|
+
builtins: pipe(plugins, Array.flatMap(builtinRules(config)))
|
|
70
67
|
};
|
|
71
68
|
};
|
|
72
69
|
const unknownPlugins = (config) => pipe(config.overrides ?? [], Array.flatMap((override) => Record.keys(override.rules)), Array.appendAll(Record.keys(config.rules ?? {})), Array.map((id) => ruleIdOf(id).plugin), Array.filter((plugin) => plugin !== "markdownlint" && !Record.has(config.plugins ?? {}, plugin)), Array.dedupe);
|
|
70
|
+
// src/entities/rule/model/extend.ts
|
|
71
|
+
const recordOf = (records) => pipe(records, Array.flatMap((record) => Record.toEntries(record ?? {})), Record.fromEntries);
|
|
72
|
+
const layersOf = (config) => {
|
|
73
|
+
const { extends: bases = [], ...own } = config;
|
|
74
|
+
return [...pipe(bases, Array.flatMap(layersOf)), own];
|
|
75
|
+
};
|
|
76
|
+
const lastInlineConfig = (layers) => pipe(layers, Array.findLast((layer) => Option.fromNullishOr(layer.inlineConfig)), Option.match({
|
|
77
|
+
onNone: () => ({}),
|
|
78
|
+
onSome: (inlineConfig) => ({ inlineConfig })
|
|
79
|
+
}));
|
|
80
|
+
const flattenConfig = (config) => {
|
|
81
|
+
const layers = layersOf(config);
|
|
82
|
+
return {
|
|
83
|
+
plugins: recordOf(pipe(layers, Array.map((layer) => layer.plugins))),
|
|
84
|
+
rules: recordOf(pipe(layers, Array.map((layer) => layer.rules))),
|
|
85
|
+
ignores: pipe(layers, Array.flatMap((layer) => layer.ignores ?? [])),
|
|
86
|
+
overrides: pipe(layers, Array.flatMap((layer) => layer.overrides ?? [])),
|
|
87
|
+
...lastInlineConfig(layers)
|
|
88
|
+
};
|
|
89
|
+
};
|
|
73
90
|
// src/entities/rule/model/override.ts
|
|
74
91
|
const NEGATION = "!";
|
|
75
92
|
const KEY_SEPARATOR = ",";
|
|
@@ -105,22 +122,18 @@ const format = (diagnostic) => {
|
|
|
105
122
|
const column = pipe(Option.fromNullishOr(diagnostic.column), Option.map((value) => `:${String(value)}`), Option.getOrElse(() => ""));
|
|
106
123
|
return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`;
|
|
107
124
|
};
|
|
108
|
-
// src/features/map-
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const diagnosticOf$2 = (rules, path) => (diagnostic) => ({
|
|
125
|
+
// src/features/map-plugin-diagnostics/model/map.ts
|
|
126
|
+
const severityOf$1 = (diagnostic) => Match.value(diagnostic.severity).pipe(Match.when("error", () => "error"), Match.orElse(() => "warn"));
|
|
127
|
+
const diagnosticOf$2 = (path) => (diagnostic) => ({
|
|
112
128
|
path,
|
|
113
129
|
line: diagnostic.line,
|
|
114
130
|
column: diagnostic.column,
|
|
115
|
-
rule:
|
|
131
|
+
rule: diagnostic.rule,
|
|
116
132
|
message: diagnostic.message,
|
|
117
|
-
severity:
|
|
118
|
-
|
|
119
|
-
onSome: reportedSeverity
|
|
120
|
-
})),
|
|
121
|
-
...present(Option.fromNullishOr(diagnostic.suggestion), (detail) => ({ detail }))
|
|
133
|
+
severity: severityOf$1(diagnostic),
|
|
134
|
+
...present(Option.fromNullishOr(diagnostic.detail), (detail) => ({ detail }))
|
|
122
135
|
});
|
|
123
|
-
const
|
|
136
|
+
const pluginDiagnosticsOf = (result) => pipe(result.pluginDiagnostics ?? [], Array.map(diagnosticOf$2(result.path)));
|
|
124
137
|
// src/features/read-project/model/project.ts
|
|
125
138
|
const MANIFEST = "package.json";
|
|
126
139
|
const SEPARATOR = "/";
|
|
@@ -386,10 +399,8 @@ const nativeOptions = (root, resolved, config) => traceparent.pipe(Effect.map((p
|
|
|
386
399
|
keepTree: Array.isReadonlyArrayNonEmpty(resolved.scripts),
|
|
387
400
|
keepSource: needsText(resolved),
|
|
388
401
|
...present(parent, (value) => ({ traceparent: value })),
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
disabled
|
|
392
|
-
} }))
|
|
402
|
+
root,
|
|
403
|
+
plugins: resolved.builtins
|
|
393
404
|
})));
|
|
394
405
|
const viewOf = (result) => pipe(Option.fromNullishOr(result.source), Option.map(sourceView));
|
|
395
406
|
const sourceOf = (result) => pipe(viewOf(result), Option.map((view) => ({
|
|
@@ -426,19 +437,16 @@ const lintGroup = (root, project) => Effect.fn("y8.lint.group")(function* group(
|
|
|
426
437
|
"y8.files": results.length,
|
|
427
438
|
"y8.rules": resolved.scripts.length
|
|
428
439
|
} }));
|
|
429
|
-
const
|
|
430
|
-
onNone: () => [],
|
|
431
|
-
onSome: (rules) => pipe(results, Array.flatMap(agentDiagnosticsOf(rules)))
|
|
432
|
-
});
|
|
440
|
+
const plugins = pipe(results, Array.flatMap(pluginDiagnosticsOf));
|
|
433
441
|
return [
|
|
434
442
|
...builtin,
|
|
435
443
|
...scripted,
|
|
436
444
|
...compat,
|
|
437
|
-
...
|
|
445
|
+
...plugins
|
|
438
446
|
];
|
|
439
447
|
});
|
|
440
448
|
const lint = Effect.fn("y8.lint")(function* lint(input) {
|
|
441
|
-
const config = input.config ?? {};
|
|
449
|
+
const config = flattenConfig(input.config ?? {});
|
|
442
450
|
yield* checkPlugins(config);
|
|
443
451
|
const project = yield* readProject({
|
|
444
452
|
root: input.root,
|
|
@@ -451,8 +459,8 @@ const lint = Effect.fn("y8.lint")(function* lint(input) {
|
|
|
451
459
|
// src/app/section.ts
|
|
452
460
|
const MARKDOWN = "*.md";
|
|
453
461
|
const hasSection = (value) => Predicate.hasProperty(value, "y8") && Predicate.isObject(value.y8);
|
|
454
|
-
const y8Section = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => value.y8), Option.getOrElse(() => ({})));
|
|
462
|
+
const y8Section = (config) => pipe(Option.liftPredicate(config, hasSection), Option.map((value) => flattenConfig(value.y8)), Option.getOrElse(() => ({})));
|
|
455
463
|
const markdownPathspecs = ({ config, patterns = [MARKDOWN] }) => [...patterns, ...pipe(config.ignores ?? [], Array.map((glob) => `:(glob,exclude)${glob}`))];
|
|
456
464
|
export { format as a, agnix as c, diagnosticDetail as i, y8Section as n, definePlugin as o, lint as r, defineRule as s, markdownPathspecs as t };
|
|
457
465
|
|
|
458
|
-
//# sourceMappingURL=app-
|
|
466
|
+
//# sourceMappingURL=app-DJaOhWCw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-DJaOhWCw.mjs","names":["SEPARATOR","Str","settingOf","Rec","Arr","Arr","Rec","Str","Arr","Rec","Fn","Arr","severityOf","diagnosticOf","Arr","Str","Arr","Arr","diagnosticOf","Rec","Arr","Rec","Str","Arr","Arr","Arr"],"sources":["../src/entities/rule/model/agnix.ts","../src/entities/rule/model/define.ts","../src/entities/rule/model/resolve.ts","../src/entities/rule/model/extend.ts","../src/entities/rule/model/override.ts","../src/app/format.ts","../src/features/map-plugin-diagnostics/model/map.ts","../src/features/read-project/model/project.ts","../src/features/run-compat-rules/model/compat.ts","../src/features/run-rules/model/document.ts","../src/features/run-rules/model/frontmatter.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import type { Plugin } from \"#/shared/config/index.ts\";\n\nexport const agnix: Plugin = { builtin: \"agnix\" };\n","import type { Plugin, Rule } from \"#/shared/config/index.ts\";\n\nexport const defineRule = (rule: Rule): Rule => rule;\n\nexport const definePlugin = (plugin: Plugin): Plugin => plugin;\n","import { settingOf } from \"@masseater.dev/lint-host\";\nimport type { Setting } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Match, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type {\n BuiltinPlugin,\n Diagnostic,\n MarkdownlintRule,\n Y8Config,\n Plugin,\n Rule,\n Severity,\n} from \"#/shared/config/index.ts\";\n\nexport const BUILTIN = \"markdownlint\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\n\nexport type { Setting } from \"@masseater.dev/lint-host\";\n\nexport const reportedSeverity = (setting: Setting): Diagnostic[\"severity\"] =>\n Match.value(setting.severity).pipe(\n Match.when(\"warn\", (): Diagnostic[\"severity\"] => \"warn\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"error\"),\n );\n\nexport interface ScriptRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\nexport interface CompatRule {\n readonly id: string;\n readonly rule: MarkdownlintRule;\n readonly setting: Setting;\n}\n\nexport interface BuiltinRules {\n readonly name: BuiltinPlugin;\n readonly prefix: string;\n readonly rules: Readonly<Record<string, Severity>>;\n}\n\nexport interface Resolved {\n readonly core: Readonly<Record<string, unknown>>;\n readonly scripts: readonly ScriptRule[];\n readonly compat: readonly CompatRule[];\n readonly builtins: readonly BuiltinRules[];\n}\n\ninterface RuleId {\n readonly plugin: string;\n readonly name: string;\n}\n\ntype PluginEntry = readonly [string, Plugin];\n\nconst ruleIdOf = (id: string): RuleId =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: (): RuleId => ({ plugin: BUILTIN, name: id }),\n onSome: (slash): RuleId => ({\n plugin: Str.slice(START, slash)(id),\n name: Str.slice(slash + SEPARATOR.length)(id),\n }),\n }),\n );\n\nconst isOn = (setting: Setting): boolean => setting.severity !== \"off\";\n\nconst coreSeverity = (severity: Severity): string =>\n Match.value(severity).pipe(\n Match.when(\"warn\", () => \"warning\"),\n Match.orElse(() => \"error\"),\n );\n\nconst coreEntry = (setting: Setting): unknown =>\n Match.value(setting.severity).pipe(\n Match.when(\"off\", (): unknown => false),\n Match.orElse((severity): unknown => ({ ...setting.options, severity: coreSeverity(severity) })),\n );\n\nconst ENABLED: Setting = settingOf(\"error\");\n\nconst configured =\n (config: Y8Config, plugin: string) =>\n (name: string): Option.Option<Setting> =>\n pipe(config.rules ?? {}, Rec.get(`${plugin}${SEPARATOR}${name}`), Option.map(settingOf));\n\nconst scriptRules =\n (config: Y8Config) =>\n ([plugin, value]: PluginEntry): readonly ScriptRule[] =>\n pipe(\n Rec.toEntries(value.rules ?? {}),\n Arr.map(([name, rule]): ScriptRule => ({\n id: `${plugin}${SEPARATOR}${name}`,\n rule,\n setting: Option.getOrElse(configured(config, plugin)(name), () => ENABLED),\n })),\n Arr.filter(({ setting }) => isOn(setting)),\n );\n\nconst compatRule =\n (config: Y8Config, plugin: string) =>\n (rule: MarkdownlintRule): Option.Option<CompatRule> =>\n pipe(\n Arr.head(rule.names),\n Option.map((name): CompatRule => ({\n id: `${plugin}${SEPARATOR}${name}`,\n rule,\n setting: pipe(\n rule.names,\n Arr.findFirst(configured(config, plugin)),\n Option.getOrElse(() => ENABLED),\n ),\n })),\n );\n\nconst compatRules =\n (config: Y8Config) =>\n ([plugin, value]: PluginEntry): readonly CompatRule[] =>\n pipe(\n value.markdownlintRules ?? [],\n Arr.flatMap((rule) => Option.toArray(compatRule(config, plugin)(rule))),\n Arr.filter(({ setting }) => isOn(setting)),\n );\n\nconst builtinEntries = (config: Y8Config): Readonly<Record<string, unknown>> =>\n pipe(\n Rec.toEntries(config.rules ?? {}),\n Arr.map(([id, entry]) => ({ ...ruleIdOf(id), setting: settingOf(entry) })),\n Arr.filter(({ plugin }) => plugin === BUILTIN),\n Arr.map(({ name, setting }): readonly [string, unknown] => [name, coreEntry(setting)]),\n Rec.fromEntries,\n );\n\nconst severities = (config: Y8Config, plugin: string): Readonly<Record<string, Severity>> =>\n pipe(\n Rec.toEntries(config.rules ?? {}),\n Arr.map(([id, entry]) => ({ ...ruleIdOf(id), setting: settingOf(entry) })),\n Arr.filter((rule) => rule.plugin === plugin),\n Arr.map(({ name, setting }): readonly [string, Severity] => [name, setting.severity]),\n Rec.fromEntries,\n );\n\nconst builtinRules =\n (config: Y8Config) =>\n ([prefix, value]: PluginEntry): readonly BuiltinRules[] =>\n pipe(\n Option.fromNullishOr(value.builtin),\n Option.map((name): BuiltinRules => ({ name, prefix, rules: severities(config, prefix) })),\n Option.toArray,\n );\n\nexport const resolve = (config: Y8Config): Resolved => {\n const plugins = Rec.toEntries(config.plugins ?? {});\n return {\n core: { default: true, ...builtinEntries(config) },\n scripts: pipe(plugins, Arr.flatMap(scriptRules(config))),\n compat: pipe(plugins, Arr.flatMap(compatRules(config))),\n builtins: pipe(plugins, Arr.flatMap(builtinRules(config))),\n };\n};\n\nexport const unknownPlugins = (config: Y8Config): readonly string[] =>\n pipe(\n config.overrides ?? [],\n Arr.flatMap((override) => Rec.keys(override.rules)),\n Arr.appendAll(Rec.keys(config.rules ?? {})),\n Arr.map((id) => ruleIdOf(id).plugin),\n Arr.filter((plugin) => plugin !== BUILTIN && !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\n );\n","import { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\n\nimport type { Y8Config } from \"#/shared/config/index.ts\";\n\nconst recordOf = <Value>(\n records: readonly (Readonly<Record<string, Value>> | undefined)[],\n): Readonly<Record<string, Value>> =>\n pipe(\n records,\n Arr.flatMap((record) => Rec.toEntries(record ?? {})),\n Rec.fromEntries,\n );\n\nconst layersOf = (config: Y8Config): readonly Y8Config[] => {\n const { extends: bases = [], ...own } = config;\n return [...pipe(bases, Arr.flatMap(layersOf)), own];\n};\n\nconst lastInlineConfig = (layers: readonly Y8Config[]): Partial<Pick<Y8Config, \"inlineConfig\">> =>\n pipe(\n layers,\n Arr.findLast((layer) => Option.fromNullishOr(layer.inlineConfig)),\n Option.match({\n onNone: () => ({}),\n onSome: (inlineConfig) => ({ inlineConfig }),\n }),\n );\n\nexport const flattenConfig = (config: Y8Config): Y8Config => {\n const layers = layersOf(config);\n return {\n plugins: recordOf(\n pipe(\n layers,\n Arr.map((layer) => layer.plugins),\n ),\n ),\n rules: recordOf(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n ),\n ignores: pipe(\n layers,\n Arr.flatMap((layer) => layer.ignores ?? []),\n ),\n overrides: pipe(\n layers,\n Arr.flatMap((layer) => layer.overrides ?? []),\n ),\n ...lastInlineConfig(layers),\n };\n};\n","import { Array as Arr, Function as Fn, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport { minimatch } from \"minimatch\";\n\nimport type { Override, RuleEntry, Y8Config } from \"#/shared/config/index.ts\";\n\nconst NEGATION = \"!\";\nconst KEY_SEPARATOR = \",\";\nconst DATA_FIRST_ARITY = 2;\n\nexport interface FileGroup {\n readonly config: Y8Config;\n readonly files: readonly string[];\n}\n\ntype Rules = Readonly<Record<string, RuleEntry>>;\n\ninterface Member {\n readonly path: string;\n readonly indexes: readonly number[];\n}\n\nconst isNegated = Str.startsWith(NEGATION);\n\nconst isIncluded = (pattern: string): boolean => !isNegated(pattern);\n\nconst matchesAny =\n (path: string) =>\n (patterns: readonly string[]): boolean =>\n pipe(\n patterns,\n Arr.some((pattern) => minimatch(path, pattern, { dot: true })),\n );\n\nconst excludedOf = (override: Override): readonly string[] =>\n pipe(override.files, Arr.filter(isNegated), Arr.map(Str.slice(NEGATION.length)));\n\nconst applies =\n (path: string) =>\n (override: Override): boolean =>\n pipe(override.files, Arr.filter(isIncluded), matchesAny(path)) &&\n !matchesAny(path)(excludedOf(override));\n\nconst matchingIndexes = (config: Y8Config, path: string): readonly number[] =>\n pipe(\n config.overrides ?? [],\n Arr.flatMap((override, index) =>\n Option.toArray(Option.liftPredicate(index, () => applies(path)(override))),\n ),\n );\n\nconst entriesOf = (override: Override): readonly (readonly [string, RuleEntry])[] =>\n Rec.toEntries(override.rules);\n\nconst rulesWith = (base: Rules, overrides: readonly Override[]): Rules =>\n pipe(overrides, Arr.flatMap(entriesOf), Arr.prependAll(Rec.toEntries(base)), Rec.fromEntries);\n\nconst overridesAt =\n (overrides: readonly Override[]) =>\n (indexes: readonly number[]): readonly Override[] =>\n pipe(\n indexes,\n Arr.flatMap((index) => Option.toArray(Arr.get(overrides, index))),\n );\n\nconst configWith = (config: Y8Config, indexes: readonly number[]): Y8Config => {\n const { overrides = [], ...base } = config;\n return { ...base, rules: rulesWith(base.rules ?? {}, overridesAt(overrides)(indexes)) };\n};\n\nconst keyOf = (member: Member): string =>\n pipe(member.indexes, Arr.map(String), Arr.join(KEY_SEPARATOR));\n\nconst groupOf =\n (config: Y8Config) =>\n (members: Arr.NonEmptyReadonlyArray<Member>): FileGroup => ({\n config: configWith(config, Arr.headNonEmpty(members).indexes),\n files: pipe(\n members,\n Arr.map((member) => member.path),\n ),\n });\n\nexport const groupByOverrides: {\n (files: readonly string[]): (config: Y8Config) => readonly FileGroup[];\n (config: Y8Config, files: readonly string[]): readonly FileGroup[];\n} = Fn.dual(DATA_FIRST_ARITY, (config: Y8Config, files: readonly string[]): readonly FileGroup[] =>\n pipe(\n files,\n Arr.map((path): Member => ({ path, indexes: matchingIndexes(config, path) })),\n Arr.groupBy(keyOf),\n Rec.values,\n Arr.map(groupOf(config)),\n ),\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\n\nexport const diagnosticDetail = (diagnostic: Diagnostic): string =>\n pipe(\n [diagnostic.detail, diagnostic.context],\n Arr.flatMap((part) => Option.toArray(Option.fromNullishOr(part))),\n Arr.filter((part) => part !== \"\"),\n Arr.map((part) => ` [${part}]`),\n Arr.join(\"\"),\n );\n\nexport const format = (diagnostic: Diagnostic): string => {\n const column = pipe(\n Option.fromNullishOr(diagnostic.column),\n Option.map((value) => `:${String(value)}`),\n Option.getOrElse(() => \"\"),\n );\n return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`;\n};\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\nimport type { NativeResult, PluginDiagnostic } from \"#/shared/native/index.ts\";\n\nconst severityOf = (diagnostic: PluginDiagnostic): Diagnostic[\"severity\"] =>\n Match.value(diagnostic.severity).pipe(\n Match.when(\"error\", (): Diagnostic[\"severity\"] => \"error\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"warn\"),\n );\n\nconst diagnosticOf =\n (path: string) =>\n (diagnostic: PluginDiagnostic): Diagnostic => ({\n path,\n line: diagnostic.line,\n column: diagnostic.column,\n rule: diagnostic.rule,\n message: diagnostic.message,\n severity: severityOf(diagnostic),\n ...present(Option.fromNullishOr(diagnostic.detail), (detail) => ({ detail })),\n });\n\nexport const pluginDiagnosticsOf = (result: NativeResult): readonly Diagnostic[] =>\n pipe(result.pluginDiagnostics ?? [], Arr.map(diagnosticOf(result.path)));\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport type { PackageManifest, Project } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\n\nconst MANIFEST = \"package.json\";\nconst SEPARATOR = \"/\";\nconst ONE = 1;\n\nconst ancestorsOf = (file: string): readonly string[] => {\n const parts = Str.split(file, SEPARATOR);\n return Arr.makeBy(parts.length, (index) =>\n pipe(parts, Arr.take(parts.length - ONE - index), Arr.join(SEPARATOR)),\n );\n};\n\nconst manifestFileOf = (directory: string): string =>\n pipe([directory, MANIFEST], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR));\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\n\nconst manifestFrom =\n (directory: string) =>\n (text: string | null): Option.Option<PackageManifest> =>\n pipe(\n Option.fromNullishOr(text),\n Option.flatMap(decodeJson),\n Option.filter(Predicate.isObject),\n Option.map((data): PackageManifest => ({ directory, data })),\n );\n\nexport interface ProjectInput {\n readonly root: string;\n readonly projectFiles: readonly string[];\n readonly files: readonly string[];\n}\n\nconst prefixOf = (directory: string): string =>\n pipe(\n Option.liftPredicate(directory, Str.isNonEmpty),\n Option.map((value) => `${value}${SEPARATOR}`),\n Option.getOrElse(() => \"\"),\n );\n\nconst isUnder = (directory: string): ((path: string) => boolean) =>\n Str.startsWith(prefixOf(directory));\n\nexport const readProject = Effect.fn(\"y8.project\")(function* readProject(input: ProjectInput) {\n const listed: ReadonlySet<string> = new Set([...input.projectFiles, ...input.files]);\n const all = Arr.fromIterable(listed);\n const directories = pipe(\n input.files,\n Arr.flatMap(ancestorsOf),\n Arr.dedupe,\n Arr.filter((directory) => listed.has(manifestFileOf(directory))),\n );\n const addon = yield* native;\n const texts = yield* Effect.try({\n try: () => addon.readTexts(input.root, pipe(directories, Arr.map(manifestFileOf))),\n catch: failedWith(\"y8 could not read package.json\"),\n });\n const manifests: ReadonlyMap<string, PackageManifest> = new Map(\n pipe(\n Arr.zip(directories, texts),\n Arr.flatMap(([directory, text]) => Option.toArray(manifestFrom(directory)(text))),\n Arr.map((manifest): readonly [string, PackageManifest] => [manifest.directory, manifest]),\n ),\n );\n return {\n exists: (path): boolean => listed.has(path) || pipe(all, Arr.some(isUnder(path))),\n under: (directory): readonly string[] => pipe(all, Arr.filter(isUnder(directory))),\n manifestOf: (file): PackageManifest | undefined =>\n pipe(\n ancestorsOf(file),\n Arr.findFirst((directory) => Option.fromNullishOr(manifests.get(directory))),\n Option.getOrUndefined,\n ),\n } satisfies Project;\n});\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport { reportedSeverity } from \"#/entities/rule/index.ts\";\nimport type { CompatRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\nimport { Y8Error, failedWith } from \"#/shared/lib/errors.ts\";\nimport type { SourceFile } from \"#/shared/native/index.ts\";\n\ninterface MarkdownlintError {\n readonly lineNumber: number;\n readonly ruleNames: readonly string[];\n readonly ruleDescription: string;\n readonly errorDetail?: string | null;\n readonly errorContext?: string | null;\n readonly errorRange?: readonly [number, number] | null;\n}\n\ninterface MarkdownlintOptions {\n readonly strings: Readonly<Record<string, string>>;\n readonly config: Readonly<Record<string, unknown>>;\n readonly customRules: readonly unknown[];\n}\n\ninterface MarkdownlintModule {\n readonly lint: (\n options: MarkdownlintOptions,\n ) => Promise<Readonly<Record<string, readonly MarkdownlintError[]>>>;\n}\n\nexport interface CompatInput {\n readonly files: readonly SourceFile[];\n readonly rules: readonly CompatRule[];\n}\n\nconst MARKDOWNLINT = \"markdownlint/promise\";\n\nconst isMarkdownlint = (value: unknown): value is MarkdownlintModule =>\n Predicate.hasProperty(value, \"lint\") && Predicate.isFunction(value.lint);\n\nconst load = Effect.tryPromise({\n try: (): Promise<unknown> => import(MARKDOWNLINT),\n catch: failedWith(\"markdownlint custom rules need the markdownlint package installed\"),\n}).pipe(\n Effect.filterOrFail(isMarkdownlint, () =>\n Y8Error.make({ message: `${MARKDOWNLINT} does not export lint` }),\n ),\n);\n\nconst ruleOf = (\n rules: readonly CompatRule[],\n error: MarkdownlintError,\n): Option.Option<CompatRule> =>\n pipe(\n Arr.head(error.ruleNames),\n Option.flatMap((name) =>\n pipe(\n rules,\n Arr.findFirst(({ rule }) => pipe(rule.names, Arr.contains(name))),\n ),\n ),\n );\n\nconst rangeFields = (\n error: MarkdownlintError,\n): Partial<{ readonly column: number; readonly length: number }> =>\n present(Option.fromNullishOr(error.errorRange), ([column, length]) => ({ column, length }));\n\nconst diagnosticOf =\n (path: string, rules: readonly CompatRule[]) =>\n (error: MarkdownlintError): Option.Option<Diagnostic> =>\n pipe(\n ruleOf(rules, error),\n Option.map((rule): Diagnostic => ({\n path,\n line: error.lineNumber,\n rule: rule.id,\n message: error.ruleDescription,\n severity: reportedSeverity(rule.setting),\n ...rangeFields(error),\n ...present(Option.fromNullishOr(error.errorDetail), (detail) => ({ detail })),\n ...present(Option.fromNullishOr(error.errorContext), (context) => ({ context })),\n })),\n );\n\nconst settingOf = (rule: CompatRule): unknown =>\n pipe(\n rule.setting.options,\n Option.liftPredicate((options) => !Rec.isEmptyRecord(options)),\n Option.getOrElse((): unknown => true),\n );\n\nconst configOf = (rules: readonly CompatRule[]): Readonly<Record<string, unknown>> =>\n pipe(\n rules,\n Arr.flatMap((rule) =>\n pipe(\n Arr.head(rule.rule.names),\n Option.map((name): readonly [string, unknown] => [name, settingOf(rule)]),\n Option.toArray,\n ),\n ),\n Rec.fromEntries,\n );\n\nconst optionsOf = (input: CompatInput): MarkdownlintOptions => ({\n strings: pipe(\n input.files,\n Arr.map(({ path, text }): readonly [string, string] => [path, text]),\n Rec.fromEntries,\n ),\n config: { default: false, ...configOf(input.rules) },\n customRules: pipe(\n input.rules,\n Arr.map(({ rule }) => rule),\n ),\n});\n\nconst diagnosticsOf =\n (rules: readonly CompatRule[]) =>\n ([path, errors]: readonly [string, readonly MarkdownlintError[]]): readonly Diagnostic[] =>\n pipe(\n errors,\n Arr.flatMap((found) => Option.toArray(diagnosticOf(path, rules)(found))),\n );\n\nconst run = Effect.fn(\"y8.markdownlint_rules\")(function* run(input: CompatInput) {\n const markdownlint = yield* load;\n const results = yield* Effect.tryPromise({\n try: () => markdownlint.lint(optionsOf(input)),\n catch: failedWith(\"a markdownlint custom rule failed\"),\n });\n return pipe(Rec.toEntries(results), Arr.flatMap(diagnosticsOf(input.rules)));\n});\n\nexport const runCompatRules = (input: CompatInput): Effect.Effect<readonly Diagnostic[], Y8Error> =>\n Arr.match(input.rules, {\n onEmpty: () => Effect.succeed([]),\n onNonEmpty: () => run(input),\n });\n","import { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport type { MarkdownNode, Position } from \"#/shared/config/index.ts\";\nimport { FIELD, NODE_WORDS, TAGS } from \"#/shared/native/index.ts\";\nimport type { NodeType, SourceView } from \"#/shared/native/index.ts\";\n\nconst NONE = 0;\nconst ROOT = 0;\nconst NEXT = 1;\nconst SET = 1;\nconst TITLE = 1;\nconst LABEL = 2;\n\nconst LINKS = [\n \"inline\",\n \"reference\",\n \"collapsed\",\n \"shortcut\",\n \"autolink\",\n \"email\",\n \"wiki\",\n] as const;\n\nexport interface Document {\n readonly root: MarkdownNode;\n readonly textOf: (node: MarkdownNode) => string;\n readonly positionOf: (offset: number) => Position;\n}\n\ntype Data = Readonly<Record<string, unknown>>;\n\ninterface Fields {\n readonly view: SourceView;\n readonly type: NodeType;\n readonly first: number;\n readonly second: number;\n}\n\nconst linkData = ({ view, first, second }: Fields): Data => ({\n link: pipe(\n LINKS,\n Arr.get(first),\n Option.getOrElse(() => LINKS[NONE]),\n ),\n destination: view.stringAt(second),\n title: view.stringAt(second + TITLE),\n label: view.stringAt(second + LABEL),\n});\n\nconst listData = ({ first, second }: Fields): Data => ({\n ordered: first === SET,\n ...pipe(\n Option.some(second),\n Option.filter((value) => value !== NONE),\n Option.match({\n onNone: (): Data => ({}),\n onSome: (value): Data => ({ start: value - NEXT }),\n }),\n ),\n});\n\nconst dataOf = (fields: Fields): Data =>\n Match.value(fields.type).pipe(\n Match.when(\"heading\", (): Data => ({ level: fields.first, setext: fields.second === SET })),\n Match.when(\"codeBlock\", (): Data => ({\n fenced: fields.first === SET,\n info: fields.view.stringAt(fields.second),\n })),\n Match.when(\"list\", () => listData(fields)),\n Match.whenOr(\"footnoteDefinition\", \"footnoteReference\", (): Data => ({\n label: fields.view.stringAt(fields.first),\n })),\n Match.whenOr(\"link\", \"image\", () => linkData(fields)),\n Match.when(\"math\", (): Data => ({ display: fields.first === SET })),\n Match.when(\"taskListMarker\", (): Data => ({ checked: fields.first === SET })),\n Match.orElse((): Data => ({})),\n );\n\nexport const once = <Value>(make: () => Value): (() => Value) => {\n const made: Value[] = [];\n return () =>\n pipe(\n Arr.head(made),\n Option.getOrElse(() => {\n const value = make();\n made.push(value);\n return value;\n }),\n );\n};\n\ninterface Tree {\n readonly at: (id: number) => MarkdownNode;\n readonly field: (id: number, field: number) => number;\n}\n\nconst linked =\n (tree: Tree) =>\n (plusOne: number): Option.Option<MarkdownNode> =>\n pipe(\n Option.some(plusOne),\n Option.filter((value) => value !== NONE),\n Option.map((value) => tree.at(value - NEXT)),\n );\n\nconst childrenOf = (tree: Tree, id: number): readonly MarkdownNode[] => {\n const found: MarkdownNode[] = [];\n for (\n let child = tree.field(id, FIELD.firstChild);\n child !== NONE;\n child = tree.field(child - NEXT, FIELD.nextSibling)\n ) {\n found.push(tree.at(child - NEXT));\n }\n return found;\n};\n\nconst nodeOf = (tree: Tree, view: SourceView, id: number): MarkdownNode => {\n const type = pipe(\n TAGS,\n Arr.get(tree.field(id, FIELD.tag)),\n Option.getOrElse((): NodeType => \"other\"),\n );\n const children = once(() => childrenOf(tree, id));\n const data = once(() =>\n dataOf({\n view,\n type,\n first: tree.field(id, FIELD.first),\n second: tree.field(id, FIELD.second),\n }),\n );\n return {\n type,\n id,\n start: tree.field(id, FIELD.start),\n end: tree.field(id, FIELD.end),\n get parent() {\n return pipe(linked(tree)(tree.field(id, FIELD.parent)), Option.getOrUndefined);\n },\n get children() {\n return children();\n },\n get data() {\n return data();\n },\n };\n};\n\nconst treeOf = (view: SourceView): Tree => {\n const made = new Map<number, MarkdownNode>();\n const tree: Tree = {\n field: (id, field) => view.nodes[id * NODE_WORDS + field] ?? NONE,\n at: (id) =>\n pipe(\n Option.fromNullishOr(made.get(id)),\n Option.getOrElse(() => {\n const node = nodeOf(tree, view, id);\n made.set(id, node);\n return node;\n }),\n ),\n };\n return tree;\n};\n\nconst positionIn =\n (view: SourceView) =>\n (offset: number): Position => {\n const line = Math.max(\n view.lineStarts.findLastIndex((start) => start <= offset),\n ROOT,\n );\n const start = view.lineStarts[line] ?? NONE;\n return { line: line + NEXT, column: view.slice(start, offset).length + NEXT };\n };\n\nexport const documentOf = (view: SourceView): Option.Option<Document> =>\n pipe(\n Option.some(view),\n Option.filter(({ nodeCount }) => nodeCount !== NONE),\n Option.map((source): Document => ({\n root: treeOf(source).at(ROOT),\n textOf: (node) => source.slice(node.start, node.end),\n positionOf: positionIn(source),\n })),\n );\n","import { Option, Predicate, Record as Rec, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Frontmatter } from \"#/shared/config/index.ts\";\n\nconst BLOCK = /^---\\r?\\n(?<body>[\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/u;\n\nconst parsed = (body: string): Option.Option<unknown> =>\n Option.liftThrowable((): unknown => parse(body))();\n\nexport const frontmatterOf = (text: string): Frontmatter | undefined =>\n pipe(\n Option.fromNullishOr(BLOCK.exec(text)),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap(Rec.get(\"body\")),\n Option.flatMap(parsed),\n Option.filter(Predicate.isObject),\n Option.getOrUndefined,\n );\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { reportedSeverity } from \"#/entities/rule/index.ts\";\nimport type { ScriptRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, MarkdownNode, Project, Report, Visitors } from \"#/shared/config/index.ts\";\nimport type { SourceView } from \"#/shared/native/index.ts\";\n\nimport { documentOf, once } from \"./document.ts\";\nimport type { Document } from \"./document.ts\";\nimport { frontmatterOf } from \"./frontmatter.ts\";\n\nconst EXIT = \":exit\";\nconst FIRST_LINE = 1;\nconst LINE_BREAK = /\\r\\n|\\r|\\n/u;\n\nexport interface ScriptInput {\n readonly path: string;\n readonly source: SourceView;\n readonly rules: readonly ScriptRule[];\n readonly project: Project;\n}\n\ntype Handler = (node: MarkdownNode) => void;\n\nconst handlerOf = (visitor: Visitors, key: keyof Visitors): Option.Option<Handler> =>\n Option.fromNullishOr(visitor[key]);\n\nconst visit = (visitors: readonly Visitors[], key: keyof Visitors, node: MarkdownNode): void => {\n for (const visitor of visitors) {\n for (const handler of Option.toArray(handlerOf(visitor, key))) {\n handler(node);\n }\n }\n};\n\nconst walk = (visitors: readonly Visitors[], node: MarkdownNode): void => {\n visit(visitors, node.type, node);\n for (const child of node.children) {\n walk(visitors, child);\n }\n visit(visitors, `${node.type}${EXIT}`, node);\n};\n\ntype Extras = Partial<{\n readonly column: number;\n readonly length: number;\n readonly detail: string;\n}>;\n\nconst extras = (report: Report, position: Option.Option<{ readonly column: number }>): Extras => ({\n ...present(\n pipe(\n Option.fromNullishOr(report.column),\n Option.orElse(() =>\n pipe(\n position,\n Option.map(({ column }) => column),\n ),\n ),\n ),\n (column) => ({ column }),\n ),\n ...present(Option.fromNullishOr(report.length), (length) => ({ length })),\n ...present(Option.fromNullishOr(report.detail), (detail) => ({ detail })),\n});\n\nconst diagnosticOf =\n (path: string, document: Document, rule: ScriptRule) =>\n (report: Report): Diagnostic => {\n const position = pipe(\n Option.fromNullishOr(report.node),\n Option.map((node) => document.positionOf(node.start)),\n );\n const line = pipe(\n Option.fromNullishOr(report.line),\n Option.orElse(() =>\n pipe(\n position,\n Option.map(({ line: at }) => at),\n ),\n ),\n Option.getOrElse(() => FIRST_LINE),\n );\n return {\n path,\n line,\n rule: rule.id,\n message: report.message,\n severity: reportedSeverity(rule.setting),\n ...extras(report, position),\n };\n };\n\nconst runOn = (input: ScriptInput, document: Document): readonly Diagnostic[] => {\n const found: Diagnostic[] = [];\n const text = input.source.text();\n const lines = once(() => Str.split(text, LINE_BREAK));\n const frontmatter = once(() => frontmatterOf(text));\n const visitors = pipe(\n input.rules,\n Arr.map((rule) => {\n const toDiagnostic = diagnosticOf(input.path, document, rule);\n return rule.rule.create({\n filename: input.path,\n get frontmatter() {\n return frontmatter();\n },\n exists: input.project.exists,\n filesUnder: input.project.under,\n manifest: input.project.manifestOf(input.path),\n text,\n get lines() {\n return lines();\n },\n options: rule.setting.options,\n root: document.root,\n textOf: document.textOf,\n positionOf: document.positionOf,\n report: (report) => {\n found.push(toDiagnostic(report));\n },\n });\n }),\n );\n walk(visitors, document.root);\n return found;\n};\n\nexport const runScriptRules = (input: ScriptInput): readonly Diagnostic[] =>\n pipe(\n documentOf(input.source),\n Option.filter(() => Arr.isReadonlyArrayNonEmpty(input.rules)),\n Option.map((document) => runOn(input, document)),\n Option.getOrElse((): readonly Diagnostic[] => []),\n );\n","import { callAddon, present, sortByPosition, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect, Match, Option, pipe } from \"effect\";\n\nimport {\n BUILTIN,\n flattenConfig,\n groupByOverrides,\n resolve,\n unknownPlugins,\n} from \"#/entities/rule/index.ts\";\nimport type { FileGroup, Resolved } from \"#/entities/rule/index.ts\";\nimport { pluginDiagnosticsOf } from \"#/features/map-plugin-diagnostics/index.ts\";\nimport { readProject } from \"#/features/read-project/index.ts\";\nimport { runCompatRules } from \"#/features/run-compat-rules/index.ts\";\nimport { runScriptRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, Project, Y8Config } from \"#/shared/config/index.ts\";\nimport { Y8Error, failedWith } from \"#/shared/lib/errors.ts\";\nimport { native, sourceView } from \"#/shared/native/index.ts\";\nimport type {\n NativeDiagnostic,\n NativeOptions,\n NativeResult,\n SourceFile,\n SourceView,\n} from \"#/shared/native/index.ts\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles?: readonly string[];\n readonly config?: Y8Config;\n}\n\ntype RangeFields = Partial<{ readonly column: number; readonly length: number }>;\n\nconst rangeOf = (diagnostic: NativeDiagnostic): RangeFields =>\n present(Option.fromNullishOr(diagnostic.range), ([column, length]) => ({ column, length }));\n\nconst severityOf = (diagnostic: NativeDiagnostic): Diagnostic[\"severity\"] =>\n Match.value(diagnostic.severity).pipe(\n Match.when(\"warning\", (): Diagnostic[\"severity\"] => \"warn\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"error\"),\n );\n\nconst fromNative =\n (path: string) =>\n (diagnostic: NativeDiagnostic): Diagnostic => ({\n path,\n line: diagnostic.line,\n rule: `${BUILTIN}/${Option.getOrElse(Arr.head(diagnostic.ruleNames), () => \"\")}`,\n message: diagnostic.description,\n severity: severityOf(diagnostic),\n ...rangeOf(diagnostic),\n ...present(Option.fromNullishOr(diagnostic.detail), (detail) => ({ detail })),\n ...present(Option.fromNullishOr(diagnostic.context), (context) => ({ context })),\n });\n\nconst needsText = (resolved: Resolved): boolean =>\n Arr.isReadonlyArrayNonEmpty(resolved.scripts) || Arr.isReadonlyArrayNonEmpty(resolved.compat);\n\nconst nativeOptions = (\n root: string,\n resolved: Resolved,\n config: Y8Config,\n): Effect.Effect<NativeOptions> =>\n traceparent.pipe(\n Effect.map((parent): NativeOptions => ({\n config: resolved.core,\n inlineConfig: config.inlineConfig ?? true,\n keepTree: Arr.isReadonlyArrayNonEmpty(resolved.scripts),\n keepSource: needsText(resolved),\n ...present(parent, (value) => ({ traceparent: value })),\n root,\n plugins: resolved.builtins,\n })),\n );\n\nconst viewOf = (result: NativeResult): Option.Option<SourceView> =>\n pipe(Option.fromNullishOr(result.source), Option.map(sourceView));\n\nconst sourceOf = (result: NativeResult): Option.Option<SourceFile> =>\n pipe(\n viewOf(result),\n Option.map((view): SourceFile => ({ path: result.path, text: view.text() })),\n );\n\nconst scriptedOne =\n (resolved: Resolved, project: Project) =>\n (result: NativeResult): readonly Diagnostic[] =>\n pipe(\n viewOf(result),\n Option.map((source) =>\n runScriptRules({\n path: result.path,\n source,\n rules: resolved.scripts,\n project,\n }),\n ),\n Option.getOrElse((): readonly Diagnostic[] => []),\n );\n\nconst builtinOf = (result: NativeResult): readonly Diagnostic[] =>\n pipe(result.diagnostics, Arr.map(fromNative(result.path)));\n\nconst checkPlugins = (config: Y8Config): Effect.Effect<void, Y8Error> =>\n Arr.match(unknownPlugins(config), {\n onEmpty: () => Effect.void,\n onNonEmpty: (names) =>\n Effect.fail(\n Y8Error.make({\n message: `rules name plugins that are not configured: ${Arr.join(names, \", \")}`,\n }),\n ),\n });\n\nconst lintGroup = (\n root: string,\n project: Project,\n): ((group: FileGroup) => Effect.Effect<readonly Diagnostic[], Y8Error>) =>\n Effect.fn(\"y8.lint.group\")(function* group(input: FileGroup) {\n const resolved = resolve(input.config);\n const options = yield* nativeOptions(root, resolved, input.config);\n const results = yield* callAddon({\n addon: native,\n name: \"y8\",\n files: input.files.length,\n call: (addon) => addon.lintPaths(root, input.files, options),\n failWith: failedWith,\n });\n const compat = yield* runCompatRules({\n files: pipe(\n results,\n Arr.flatMap((result) => Option.toArray(sourceOf(result))),\n ),\n rules: resolved.compat,\n });\n const builtin = pipe(results, Arr.flatMap(builtinOf));\n const scripted = yield* Effect.sync(() =>\n pipe(results, Arr.flatMap(scriptedOne(resolved, project))),\n ).pipe(\n Effect.withSpan(\"y8.script_rules\", {\n attributes: { \"y8.files\": results.length, \"y8.rules\": resolved.scripts.length },\n }),\n );\n const plugins = pipe(results, Arr.flatMap(pluginDiagnosticsOf));\n return [...builtin, ...scripted, ...compat, ...plugins];\n });\n\nexport const lint = Effect.fn(\"y8.lint\")(function* lint(input: LintInput) {\n const config = flattenConfig(input.config ?? {});\n yield* checkPlugins(config);\n const project = yield* readProject({\n root: input.root,\n files: input.files,\n projectFiles: input.projectFiles ?? [],\n });\n const found = yield* Effect.forEach(\n groupByOverrides(config, input.files),\n lintGroup(input.root, project),\n { concurrency: 1 },\n );\n return sortByPosition<Diagnostic>(Arr.flatten(found));\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { Y8Config } from \"#/shared/config/index.ts\";\n\nconst MARKDOWN = \"*.md\";\n\nconst hasSection = (value: unknown): value is { readonly y8: Y8Config } =>\n Predicate.hasProperty(value, \"y8\") && Predicate.isObject(value.y8);\n\nexport const y8Section = (config: unknown): Y8Config =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => flattenConfig(value.y8)),\n Option.getOrElse((): Y8Config => ({})),\n );\n\nexport interface PathspecInput {\n readonly config: Y8Config;\n readonly patterns?: readonly string[];\n}\n\nexport const markdownPathspecs = ({\n config,\n patterns = [MARKDOWN],\n}: PathspecInput): readonly string[] => [\n ...patterns,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n];\n"],"mappings":";;;;;AAEA,MAAa,QAAgB,EAAE,SAAS,QAAQ;;ACAhD,MAAa,cAAc,SAAqB;AAEhD,MAAa,gBAAgB,WAA2B;;ACUxD,MAAa,UAAU;AAEvB,MAAMA,cAAY;AAClB,MAAM,QAAQ;AAId,MAAa,oBAAoB,YAC/B,MAAM,MAAM,QAAQ,QAAQ,CAAC,CAAC,KAC5B,MAAM,KAAK,cAAsC,MAAM,GACvD,MAAM,aAAqC,OAAO,CACpD;AAkCF,MAAM,YAAY,OAChB,KACEC,SAAI,QAAQD,WAAS,CAAC,CAAC,EAAE,GACzB,OAAO,MAAM;CACX,eAAuB;EAAE,QAAQ;EAAS,MAAM;CAAG;CACnD,SAAS,WAAmB;EAC1B,QAAQC,SAAI,MAAM,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AG;EAAU,GAAG;EAAQ,GAAG;CAAO;AACxD,CAAC;AAEH,MAAa,OAAO,OAAO,GAAG,SAAS,CAAC,CAAC,UAAU,KAAK,OAAkB;CACxE,MAAM,SAAS,cAAc,MAAM,UAAU,CAAC,CAAC;CAC/C,OAAO,aAAa,MAAM;CAC1B,MAAM,UAAU,OAAO,YAAY;EACjC,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,cAAc,MAAM,gBAAgB,CAAC;CACvC,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,QAC1B,iBAAiB,QAAQ,MAAM,KAAK,GACpC,UAAU,MAAM,MAAM,OAAO,GAC7B,EAAE,aAAa,EAAE,CACnB;CACA,OAAO,eAA2BA,MAAI,QAAQ,KAAK,CAAC;AACtD,CAAC;;AC9JD,MAAM,WAAW;AAEjB,MAAM,cAAc,UAClB,UAAU,YAAY,OAAO,IAAI,KAAK,UAAU,SAAS,MAAM,EAAE;AAEnE,MAAa,aAAa,WACxB,KACE,OAAO,cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,cAAc,MAAM,EAAE,CAAC,GAC7C,OAAO,iBAA2B,CAAC,EAAE,CACvC;AAOF,MAAa,qBAAqB,EAChC,QACA,WAAW,CAAC,QAAQ,QACkB,CACtC,GAAG,UACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBC,MAAI,KAAK,SAAS,kBAAkB,MAAM,CAC5C,CACF"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { l as failedWith, p as runCli$1 } from "./split-morphemes-
|
|
3
|
-
import { a as format, n as y8Section, r as lint, t as markdownPathspecs } from "./app-
|
|
2
|
+
import { l as failedWith, p as runCli$1 } from "./split-morphemes-DC2pNnQU.mjs";
|
|
3
|
+
import { a as format, n as y8Section, r as lint, t as markdownPathspecs } from "./app-DJaOhWCw.mjs";
|
|
4
4
|
// src/app/cli.ts
|
|
5
5
|
const runCli = () => {
|
|
6
6
|
runCli$1({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as NodeType } from "./index-Dvd9WB0d.mjs";
|
|
2
|
-
import { Effect, Option } from "effect";
|
|
2
|
+
import { Effect, FileSystem, Option, Path } from "effect";
|
|
3
3
|
type Severity = "off" | "warn" | "error";
|
|
4
4
|
type RuleOptions = Readonly<Record<string, unknown>>;
|
|
5
5
|
type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
|
|
@@ -59,16 +59,18 @@ interface MarkdownlintRule {
|
|
|
59
59
|
readonly function: unknown;
|
|
60
60
|
readonly [field: string]: unknown;
|
|
61
61
|
}
|
|
62
|
+
type BuiltinPlugin = "agnix";
|
|
62
63
|
interface Plugin {
|
|
63
64
|
readonly rules?: Readonly<Record<string, Rule>>;
|
|
64
65
|
readonly markdownlintRules?: readonly MarkdownlintRule[];
|
|
65
|
-
readonly
|
|
66
|
+
readonly builtin?: BuiltinPlugin;
|
|
66
67
|
}
|
|
67
68
|
interface Override {
|
|
68
69
|
readonly files: readonly string[];
|
|
69
70
|
readonly rules: Readonly<Record<string, RuleEntry>>;
|
|
70
71
|
}
|
|
71
72
|
interface Y8Config {
|
|
73
|
+
readonly extends?: readonly Y8Config[];
|
|
72
74
|
readonly plugins?: Readonly<Record<string, Plugin>>;
|
|
73
75
|
readonly rules?: Readonly<Record<string, RuleEntry>>;
|
|
74
76
|
readonly ignores?: readonly string[];
|
|
@@ -87,4 +89,4 @@ interface Diagnostic {
|
|
|
87
89
|
readonly severity: Exclude<Severity, "off">;
|
|
88
90
|
}
|
|
89
91
|
export { Override as a, Position as c, RuleContext as d, Visitors as f, Severity as g, RuleOptions as h, MarkdownlintRule as i, Report as l, RuleEntry as m, Frontmatter as n, PackageManifest as o, Y8Config as p, MarkdownNode as r, Plugin as s, Diagnostic as t, Rule as u };
|
|
90
|
-
//# sourceMappingURL=index-
|
|
92
|
+
//# sourceMappingURL=index-CkE9LH6X.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as Override, c as Position, d as RuleContext, f as Visitors, g as Severity, h as RuleOptions, i as MarkdownlintRule, l as Report, m as RuleEntry, n as Frontmatter, o as PackageManifest, p as Y8Config, r as MarkdownNode, s as Plugin, t as Diagnostic, u as Rule } from "./index-
|
|
1
|
+
import { a as Override, c as Position, d as RuleContext, f as Visitors, g as Severity, h as RuleOptions, i as MarkdownlintRule, l as Report, m as RuleEntry, n as Frontmatter, o as PackageManifest, p as Y8Config, r as MarkdownNode, s as Plugin, t as Diagnostic, u as Rule } from "./index-CkE9LH6X.mjs";
|
|
2
2
|
import { r as Y8Error, t as Morpheme } from "./index-Dvd9WB0d.mjs";
|
|
3
3
|
import { i as tokenize, r as morphemesOf } from "./index-AoTF_uMY.mjs";
|
|
4
|
-
import { Effect
|
|
4
|
+
import { Effect } from "effect";
|
|
5
5
|
export declare const agnix: Plugin;
|
|
6
6
|
export declare const defineRule: (rule: Rule) => Rule;
|
|
7
7
|
export declare const definePlugin: (plugin: Plugin) => Plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as format, c as agnix, i as diagnosticDetail, n as y8Section, o as definePlugin, r as lint, s as defineRule, t as markdownPathspecs } from "./app-
|
|
2
|
-
import { c as Y8Error, n as morphemesOf, r as tokenize } from "./split-morphemes-
|
|
1
|
+
import { a as format, c as agnix, i as diagnosticDetail, n as y8Section, o as definePlugin, r as lint, s as defineRule, t as markdownPathspecs } from "./app-DJaOhWCw.mjs";
|
|
2
|
+
import { c as Y8Error, n as morphemesOf, r as tokenize } from "./split-morphemes-DC2pNnQU.mjs";
|
|
3
3
|
export { Y8Error, agnix, definePlugin, defineRule, diagnosticDetail, format, lint, markdownPathspecs, morphemesOf, tokenize, y8Section };
|
package/dist/kuromojin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as getTokenizer, r as tokenize } from "./split-morphemes-
|
|
1
|
+
export { t as getTokenizer, r as tokenize } from "./split-morphemes-DC2pNnQU.mjs";
|
|
@@ -74,8 +74,9 @@ const CONFIG_FILES = [
|
|
|
74
74
|
"vite.config.mjs"
|
|
75
75
|
];
|
|
76
76
|
const FAILED = 1;
|
|
77
|
+
const DATA_FIRST_ARITY$1 = 2;
|
|
77
78
|
const ARGUMENTS_START = 2;
|
|
78
|
-
const
|
|
79
|
+
const readSectionIn = (source, root) => Effect.gen(function* readConfig() {
|
|
79
80
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
80
81
|
const path = yield* Path.Path;
|
|
81
82
|
const found = yield* pipe(CONFIG_FILES, Array.map((name) => path.join(root, name)), Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))));
|
|
@@ -83,11 +84,12 @@ const configOf = (cli, root) => Effect.gen(function* readConfig() {
|
|
|
83
84
|
onNone: () => Effect.succeed({}),
|
|
84
85
|
onSome: (file) => Effect.tryPromise({
|
|
85
86
|
try: () => resolveConfigFromFile(file),
|
|
86
|
-
catch:
|
|
87
|
+
catch: source.failWith(`could not load ${file}`)
|
|
87
88
|
})
|
|
88
89
|
});
|
|
89
|
-
return
|
|
90
|
-
}).pipe(Effect.withSpan(`${
|
|
90
|
+
return source.section(loaded);
|
|
91
|
+
}).pipe(Effect.withSpan(`${source.name}.config`));
|
|
92
|
+
Function.dual(DATA_FIRST_ARITY$1, readSectionIn);
|
|
91
93
|
const trackedFiles = (root, pathspecs) => Effect.gen(function* listFiles() {
|
|
92
94
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
93
95
|
"ls-files",
|
|
@@ -107,9 +109,16 @@ const requestOf = (config, patterns) => Array.match(patterns, {
|
|
|
107
109
|
})
|
|
108
110
|
});
|
|
109
111
|
const hasError = (found) => pipe(found, Array.some(({ severity }) => severity === "error"));
|
|
112
|
+
const failWhen = (failed) => Effect.when(Effect.sync(() => {
|
|
113
|
+
process.exitCode = FAILED;
|
|
114
|
+
}), Effect.succeed(failed)).pipe(Effect.asVoid);
|
|
115
|
+
const printAll = (found, format) => Array.match(found, {
|
|
116
|
+
onEmpty: () => Effect.void,
|
|
117
|
+
onNonEmpty: (all) => Console.log(pipe(all, Array.map(format), Array.join("\n")))
|
|
118
|
+
});
|
|
110
119
|
const mainOf = (cli) => Effect.gen(function* main() {
|
|
111
120
|
const root = process.cwd();
|
|
112
|
-
const config = yield*
|
|
121
|
+
const config = yield* readSectionIn(cli, root);
|
|
113
122
|
const patterns = process.argv.slice(ARGUMENTS_START);
|
|
114
123
|
const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(Effect.withSpan(`${cli.name}.files`));
|
|
115
124
|
const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));
|
|
@@ -119,17 +128,15 @@ const mainOf = (cli) => Effect.gen(function* main() {
|
|
|
119
128
|
projectFiles,
|
|
120
129
|
config
|
|
121
130
|
});
|
|
122
|
-
yield*
|
|
123
|
-
|
|
124
|
-
onNonEmpty: (all) => Console.log(pipe(all, Array.map(cli.format), Array.join("\n")))
|
|
125
|
-
});
|
|
126
|
-
yield* Effect.when(Effect.sync(() => {
|
|
127
|
-
process.exitCode = FAILED;
|
|
128
|
-
}), Effect.sync(() => hasError(found)));
|
|
131
|
+
yield* printAll(found, cli.format);
|
|
132
|
+
yield* failWhen(hasError(found));
|
|
129
133
|
});
|
|
134
|
+
const runTraced = (name, program) => {
|
|
135
|
+
const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(NodeServices.layer));
|
|
136
|
+
runMain(program.pipe(Effect.provide(services)));
|
|
137
|
+
};
|
|
130
138
|
const runCli = (cli) => {
|
|
131
|
-
|
|
132
|
-
runMain(mainOf(cli).pipe(Effect.provide(services)));
|
|
139
|
+
runTraced(cli.name, mainOf(cli));
|
|
133
140
|
};
|
|
134
141
|
const present = Function.dual(2, (value, build) => Option.match(value, {
|
|
135
142
|
onNone: () => ({}),
|
|
@@ -279,4 +286,4 @@ const getTokenizer = () => Promise.resolve(tokenizer);
|
|
|
279
286
|
const tokenize = (text) => Promise.resolve(morphemesOf(text));
|
|
280
287
|
export { FIELD as a, Y8Error as c, traceparent as d, present as f, settingOf as h, native as i, failedWith as l, callAddon as m, morphemesOf as n, TAGS as o, runCli as p, tokenize as r, sourceView as s, getTokenizer as t, sortByPosition as u };
|
|
281
288
|
|
|
282
|
-
//# sourceMappingURL=split-morphemes-
|
|
289
|
+
//# sourceMappingURL=split-morphemes-DC2pNnQU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-morphemes-DC2pNnQU.mjs","names":["taggedError","Rec","Str","DATA_FIRST_ARITY","Arr","Fn","Str","Fn","Bool","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/lib/errors.ts","../src/shared/native/source.ts","../src/shared/native/index.ts","../src/features/split-morphemes/model/tokenize.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nexport type Severity = \"off\" | \"warn\" | \"error\";\n\nexport type RuleOptions = Readonly<Record<string, unknown>>;\n\nexport type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];\n\nexport interface Setting {\n readonly severity: Severity;\n readonly options: RuleOptions;\n}\n\nconst NO_OPTIONS: RuleOptions = {};\n\nexport const settingOf = (entry: RuleEntry): Setting =>\n Match.value(entry).pipe(\n Match.when(Match.string, (severity): Setting => ({ severity, options: NO_OPTIONS })),\n Match.orElse(([severity, options]): Setting => ({\n severity,\n options: options ?? NO_OPTIONS,\n })),\n );\n","import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(NodeServices.layer)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst DATA_FIRST_ARITY = 2;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface SectionSource<Config, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly failWith: FailWith<Failure>;\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> extends SectionSource<\n Config,\n Failure\n> {\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly args: readonly string[];\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly scan: (call: ToolCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\ntype CliServices = FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;\n\nconst readSectionIn = <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: source.failWith(`could not load ${file}`),\n }),\n });\n return source.section(loaded);\n }).pipe(Effect.withSpan(`${source.name}.config`));\n\n/** @internal */\nexport const readSection: {\n (\n root: string,\n ): <Config, Failure>(\n source: SectionSource<Config, Failure>,\n ) => Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n <Config, Failure>(\n source: SectionSource<Config, Failure>,\n root: string,\n ): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path>;\n} = Fn.dual(DATA_FIRST_ARITY, readSectionIn);\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst failWhen = (failed: boolean): Effect.Effect<void> =>\n Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.succeed(failed),\n ).pipe(Effect.asVoid);\n\nconst printAll = <Found>(\n found: readonly Found[],\n format: (found: Found) => string,\n): Effect.Effect<void> =>\n Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(format), Arr.join(\"\\n\"))),\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(\n Effect.withSpan(`${cli.name}.files`),\n );\n const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));\n const found = yield* cli.lint({ root, files, projectFiles, config });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf = <Config, Found, Failure>(\n tool: Tool<Config, Found, Failure>,\n): Effect.Effect<void, Failure | PlatformError, CliServices> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* readSectionIn(tool, root);\n const found = yield* tool.scan({ root, config, args: process.argv.slice(ARGUMENTS_START) });\n yield* printAll(found, tool.format);\n yield* failWhen(Arr.isReadonlyArrayNonEmpty(found));\n });\n\nconst runTraced = <Failure>(\n name: string,\n program: Effect.Effect<void, Failure, CliServices>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(NodeServices.layer),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n runTraced(cli.name, mainOf(cli));\n};\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n runTraced(tool.name, toolMainOf(tool));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n}\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class Y8Error extends taggedError<Y8Error, { readonly brand: unique symbol }>()(\"Y8Error\", {\n message: Schema.String,\n}) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): Y8Error =>\n Y8Error.make({ message: `${message}: ${String(cause)}` });\n","import { Option } from \"effect\";\n\nimport type { NodeType } from \"./index.ts\";\n\nconst WORD = 4;\nconst EMPTY = 0;\nconst HEADER_WORDS = 5;\nconst HEADER = { nodes: 0, strings: 1, lines: 2, text: 3 } as const;\nconst STRING_WORDS = 2;\nconst LENGTH = 1;\nexport const NODE_WORDS = 8;\n\nexport const FIELD = {\n tag: 0,\n start: 1,\n end: 2,\n parent: 3,\n firstChild: 4,\n nextSibling: 5,\n first: 6,\n second: 7,\n} as const;\n\nexport const TAGS: readonly NodeType[] = [\n \"document\",\n \"paragraph\",\n \"heading\",\n \"blockQuote\",\n \"codeBlock\",\n \"htmlBlock\",\n \"list\",\n \"listItem\",\n \"footnoteDefinition\",\n \"table\",\n \"tableHead\",\n \"tableRow\",\n \"tableCell\",\n \"emphasis\",\n \"strong\",\n \"strikethrough\",\n \"link\",\n \"image\",\n \"text\",\n \"code\",\n \"html\",\n \"inlineHtml\",\n \"softBreak\",\n \"hardBreak\",\n \"thematicBreak\",\n \"math\",\n \"mathBlock\",\n \"footnoteReference\",\n \"taskListMarker\",\n \"other\",\n];\n\nexport interface SourceView {\n readonly nodeCount: number;\n readonly nodes: Uint32Array;\n readonly lineStarts: Uint32Array;\n readonly text: () => string;\n readonly slice: (start: number, end: number) => string;\n readonly stringAt: (index: number) => string;\n}\n\nconst decoder = new TextDecoder();\n\nconst padded = (length: number): number => Math.ceil(length / WORD) * WORD;\n\nconst aligned = (buffer: Uint8Array): Uint8Array =>\n Option.match(\n Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % WORD === EMPTY),\n {\n onNone: () => Uint8Array.from(buffer),\n onSome: (value) => value,\n },\n );\n\nconst wordAt = (words: Uint32Array, index: number): number => words[index] ?? EMPTY;\n\nconst decode = (from: Uint8Array, start: number, end: number): string =>\n decoder.decode(from.subarray(start, end));\n\ninterface Layout {\n readonly nodeCount: number;\n readonly stringCount: number;\n readonly lineCount: number;\n readonly textLength: number;\n}\n\nconst wordsOf =\n (buffer: Uint8Array) =>\n (at: number, count: number): Uint32Array =>\n new Uint32Array(buffer.buffer, buffer.byteOffset + at * WORD, count);\n\nconst layoutOf = (header: Uint32Array): Layout => ({\n nodeCount: wordAt(header, HEADER.nodes),\n stringCount: wordAt(header, HEADER.strings),\n lineCount: wordAt(header, HEADER.lines),\n textLength: wordAt(header, HEADER.text),\n});\n\nexport const sourceView = (raw: Uint8Array): SourceView => {\n const buffer = aligned(raw);\n const words = wordsOf(buffer);\n const { nodeCount, stringCount, lineCount, textLength } = layoutOf(words(EMPTY, HEADER_WORDS));\n const stringsAt = HEADER_WORDS + nodeCount * NODE_WORDS;\n const linesAt = stringsAt + stringCount * STRING_WORDS;\n const textAt = (linesAt + lineCount) * WORD;\n const bytes = buffer.subarray(textAt, textAt + textLength);\n const strings = words(stringsAt, stringCount * STRING_WORDS);\n const blob = buffer.subarray(textAt + padded(textLength));\n return {\n nodeCount,\n nodes: words(HEADER_WORDS, nodeCount * NODE_WORDS),\n lineStarts: words(linesAt, lineCount),\n text: () => decoder.decode(bytes),\n slice: (start, end) => decode(bytes, start, end),\n stringAt: (index) => {\n const offset = wordAt(strings, index * STRING_WORDS);\n return decode(blob, offset, offset + wordAt(strings, index * STRING_WORDS + LENGTH));\n },\n };\n};\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Predicate, pipe } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Y8Error } from \"#/shared/lib/errors.ts\";\n\nexport { FIELD, NODE_WORDS, TAGS, sourceView } from \"./source.ts\";\nexport type { SourceView } from \"./source.ts\";\n\nexport type NodeType =\n | \"document\"\n | \"paragraph\"\n | \"heading\"\n | \"blockQuote\"\n | \"codeBlock\"\n | \"htmlBlock\"\n | \"list\"\n | \"listItem\"\n | \"footnoteDefinition\"\n | \"table\"\n | \"tableHead\"\n | \"tableRow\"\n | \"tableCell\"\n | \"emphasis\"\n | \"strong\"\n | \"strikethrough\"\n | \"link\"\n | \"image\"\n | \"text\"\n | \"code\"\n | \"html\"\n | \"inlineHtml\"\n | \"softBreak\"\n | \"hardBreak\"\n | \"thematicBreak\"\n | \"math\"\n | \"mathBlock\"\n | \"footnoteReference\"\n | \"taskListMarker\"\n | \"other\";\n\nexport type Level = \"error\" | \"warning\" | \"info\";\n\nexport interface NativeDiagnostic {\n readonly line: number;\n readonly ruleNames: readonly string[];\n readonly description: string;\n readonly detail: string | null;\n readonly context: string | null;\n readonly range: readonly [number, number] | null;\n readonly severity: Exclude<Level, \"info\">;\n}\n\nexport interface PluginDiagnostic {\n readonly rule: string;\n readonly line: number;\n readonly column: number;\n readonly message: string;\n readonly detail: string | null;\n readonly severity: Exclude<Level, \"info\">;\n}\n\nexport interface PluginOptions {\n readonly name: string;\n readonly prefix: string;\n readonly rules: Readonly<Record<string, string>>;\n}\n\nexport interface NativeResult {\n readonly path: string;\n readonly diagnostics: readonly NativeDiagnostic[];\n readonly pluginDiagnostics?: readonly PluginDiagnostic[] | null;\n readonly source?: Uint8Array | null;\n}\n\nexport interface NativeOptions {\n readonly config?: Readonly<Record<string, unknown>>;\n readonly inlineConfig?: boolean;\n readonly keepTree?: boolean;\n readonly keepSource?: boolean;\n readonly traceparent?: string;\n readonly root?: string;\n readonly plugins?: readonly PluginOptions[];\n}\n\nexport interface SourceFile {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface Morpheme {\n readonly word_id: number;\n readonly word_type: \"KNOWN\" | \"UNKNOWN\";\n readonly surface_form: string;\n readonly pos: string;\n readonly pos_detail_1: string;\n readonly pos_detail_2: string;\n readonly pos_detail_3: string;\n readonly conjugated_type: string;\n readonly conjugated_form: string;\n readonly basic_form: string;\n readonly reading?: string;\n readonly pronunciation?: string;\n readonly word_position: number;\n}\n\nexport interface Native {\n readonly lint: (files: readonly SourceFile[], options: NativeOptions) => readonly NativeResult[];\n readonly lintPaths: (\n root: string,\n paths: readonly string[],\n options: NativeOptions,\n ) => readonly NativeResult[];\n readonly flushTelemetry: () => Promise<void>;\n readonly readTexts: (root: string, paths: readonly string[]) => readonly (string | null)[];\n readonly tokenize: (text: string) => string;\n}\n\nconst NATIVE_FUNCTIONS = [\"lint\", \"lintPaths\", \"flushTelemetry\", \"readTexts\", \"tokenize\"] as const;\n\nconst hasFunction =\n (value: unknown) =>\n (name: string): boolean =>\n Predicate.hasProperty(value, name) && Predicate.isFunction(value[name]);\n\nconst isNative = (value: unknown): value is Native =>\n pipe(NATIVE_FUNCTIONS, Arr.every(hasFunction(value)));\n\nexport const native: Effect.Effect<Native, Y8Error> = loadAddon({\n packageName: \"@r_masseater/y8\",\n binary: \"y8\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { native } from \"#/shared/native/index.ts\";\nimport type { Morpheme } from \"#/shared/native/index.ts\";\n\nexport interface Tokenizer {\n readonly tokenize: (text: string) => readonly Morpheme[];\n readonly tokenizeForSentence: (text: string) => readonly Morpheme[];\n}\n\nconst CACHE_SIZE = 10_000;\nconst NO_MORPHEMES: readonly Morpheme[] = [];\n\nconst addon = Effect.cached(native).pipe(Effect.runSync);\n\nconst cache = new Map<string, readonly Morpheme[]>();\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\n\nconst isMorphemes = (value: unknown): value is readonly Morpheme[] => Arr.isArray(value);\n\nconst parsed = (json: string): readonly Morpheme[] =>\n pipe(\n decodeJson(json),\n Option.filter(isMorphemes),\n Option.getOrElse(() => NO_MORPHEMES),\n );\n\nconst remember = (text: string, morphemes: readonly Morpheme[]): readonly Morpheme[] => {\n if (cache.size >= CACHE_SIZE) {\n cache.clear();\n }\n cache.set(text, morphemes);\n return morphemes;\n};\n\nexport const morphemesOf = (text: string): readonly Morpheme[] =>\n pipe(\n Option.fromUndefinedOr(cache.get(text)),\n Option.getOrElse(() => remember(text, parsed(pipe(addon, Effect.runSync).tokenize(text)))),\n );\n\nconst tokenizer: Tokenizer = { tokenize: morphemesOf, tokenizeForSentence: morphemesOf };\n\nexport const getTokenizer = (): Promise<Tokenizer> => Promise.resolve(tokenizer);\n\nexport const tokenize = (text: string): Promise<readonly Morpheme[]> =>\n Promise.resolve(morphemesOf(text));\n"],"mappings":";;;;;;;;;AAaA,MAAM,aAA0B,CAAC;AAEjC,MAAa,aAAa,UACxB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,SAAS,cAAuB;CAAE;CAAU,SAAS;AAAW,EAAE,GACnF,MAAM,QAAQ,CAAC,UAAU,cAAuB;CAC9C;CACA,SAAS,WAAW;AACtB,EAAE,CACJ;;ACpBF,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO,OAAO,CAC3B,CAAC,CAAC,CAAC;AAEH,MAAM,UAA8D;CAClE,QAAQ,SAAS,MAAM,KAAK;CAC5B,SAAS,SAAS,MAAM,KAAK;CAC7B,QAAQ,SAAS,GAAG,KAAK;AAC3B;AAEA,MAAM,UAAU;AAShB,MAAM,QAAQ,OAAO,GAAG,OAAO,CAAC,CAAC,UAAU,MAAM,OAAe,WAAmB;CAEjF,MAAM,WAAW,QAAO,OADD,oBAAoB,oBAAA,CACX,SAC9B,aAAa,KAAK,SAAS;EAAC;EAAS;EAAa;EAAY;EAAM;CAAK,GAAG;EAC1E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AO,WAAW,GACzB,OAAO,gBAAgB,YAAY,CACrC;AAEF,MAAM,YAAY,MAAc,cAAwD;CACtF,IAAI,MAAM,QAAQ,YAChB,MAAM,MAAM;CAEd,MAAM,IAAI,MAAM,SAAS;CACzB,OAAO;AACT;AAEA,MAAa,eAAe,SAC1B,KACE,OAAO,gBAAgB,MAAM,IAAI,IAAI,CAAC,GACtC,OAAO,gBAAgB,SAAS,MAAM,OAAO,KAAK,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAC3F;AAEF,MAAM,YAAuB;CAAE,UAAU;CAAa,qBAAqB;AAAY;AAEvF,MAAa,qBAAyC,QAAQ,QAAQ,SAAS;AAE/E,MAAa,YAAY,SACvB,QAAQ,QAAQ,YAAY,IAAI,CAAC"}
|
package/dist/vite.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/y8",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A Markdown linter written in Rust that matches markdownlint's built-in rules, configured from vite.config.ts, with TypeScript rules, markdownlint custom-rule support and a Japanese tokenizer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"provenance": true
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@effect/platform-node": "4.1.4",
|
|
56
|
-
"minimatch": "11.0.8",
|
|
57
|
-
"yaml": "2.9.1"
|
|
55
|
+
"@effect/platform-node": "^4.1.4",
|
|
56
|
+
"minimatch": "^11.0.8",
|
|
57
|
+
"yaml": "^2.9.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@masseater.dev/lint-host": "0.0.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"engines": {
|
|
86
|
-
"node": "
|
|
86
|
+
"node": "v26.13.1"
|
|
87
87
|
},
|
|
88
88
|
"native": {
|
|
89
89
|
"binary": "y8",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
95
|
"optionalDependencies": {
|
|
96
|
-
"@r_masseater/y8-linux-x64-gnu": "0.
|
|
97
|
-
"@r_masseater/y8-win32-x64-msvc": "0.
|
|
96
|
+
"@r_masseater/y8-linux-x64-gnu": "0.2.0",
|
|
97
|
+
"@r_masseater/y8-win32-x64-msvc": "0.2.0"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {}
|
|
100
100
|
}
|
|
@@ -51,7 +51,7 @@ Run `y8` in the repository root. It lints the Markdown files git tracks and prin
|
|
|
51
51
|
and later entries win.
|
|
52
52
|
|
|
53
53
|
Rule packages export presets that return a whole config.
|
|
54
|
-
|
|
54
|
+
Built-in plugins run inside the native engine, as oxlint's built-in plugins do. `agnix` runs the agnix rules for agent files: register it as `plugins: { agnix }` and its rules are named `agnix/<ID>`, or `<name>/<ID>` under another key. Set one to `"off"`, `"warn"` or `"error"`; unset rules keep agnix's own level.
|
|
55
55
|
|
|
56
56
|
## Rules in TypeScript
|
|
57
57
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-D5BcM070.mjs","names":["SEPARATOR","Str","settingOf","Rec","Arr","Str","Arr","Rec","Fn","Arr","SEPARATOR","diagnosticOf","Rec","Arr","Str","Arr","Arr","diagnosticOf","Rec","Arr","Rec","Str","Arr","Arr","Arr"],"sources":["../src/entities/rule/model/agnix.ts","../src/entities/rule/model/define.ts","../src/entities/rule/model/resolve.ts","../src/entities/rule/model/override.ts","../src/app/format.ts","../src/features/map-agent-diagnostics/model/map.ts","../src/features/read-project/model/project.ts","../src/features/run-compat-rules/model/compat.ts","../src/features/run-rules/model/document.ts","../src/features/run-rules/model/frontmatter.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import type { Plugin } from \"#/shared/config/index.ts\";\n\nexport const agnix: Plugin = { agentConfig: true };\n","import type { Plugin, Rule } from \"#/shared/config/index.ts\";\n\nexport const defineRule = (rule: Rule): Rule => rule;\n\nexport const definePlugin = (plugin: Plugin): Plugin => plugin;\n","import { settingOf } from \"@masseater.dev/lint-host\";\nimport type { Setting } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Match, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type {\n Diagnostic,\n MarkdownlintRule,\n Y8Config,\n Plugin,\n Rule,\n Severity,\n} from \"#/shared/config/index.ts\";\n\nexport const BUILTIN = \"markdownlint\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\n\nexport type { Setting } from \"@masseater.dev/lint-host\";\n\nexport const reportedSeverity = (setting: Setting): Diagnostic[\"severity\"] =>\n Match.value(setting.severity).pipe(\n Match.when(\"warn\", (): Diagnostic[\"severity\"] => \"warn\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"error\"),\n );\n\nexport interface ScriptRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\nexport interface CompatRule {\n readonly id: string;\n readonly rule: MarkdownlintRule;\n readonly setting: Setting;\n}\n\nexport interface AgentRules {\n readonly plugin: string;\n readonly disabled: readonly string[];\n readonly settings: Readonly<Record<string, Setting>>;\n}\n\nexport interface Resolved {\n readonly core: Readonly<Record<string, unknown>>;\n readonly scripts: readonly ScriptRule[];\n readonly compat: readonly CompatRule[];\n readonly agent: Option.Option<AgentRules>;\n}\n\ninterface RuleId {\n readonly plugin: string;\n readonly name: string;\n}\n\ntype PluginEntry = readonly [string, Plugin];\n\nconst ruleIdOf = (id: string): RuleId =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: (): RuleId => ({ plugin: BUILTIN, name: id }),\n onSome: (slash): RuleId => ({\n plugin: Str.slice(START, slash)(id),\n name: Str.slice(slash + SEPARATOR.length)(id),\n }),\n }),\n );\n\nconst isOn = (setting: Setting): boolean => setting.severity !== \"off\";\n\nconst coreSeverity = (severity: Severity): string =>\n Match.value(severity).pipe(\n Match.when(\"warn\", () => \"warning\"),\n Match.orElse(() => \"error\"),\n );\n\nconst coreEntry = (setting: Setting): unknown =>\n Match.value(setting.severity).pipe(\n Match.when(\"off\", (): unknown => false),\n Match.orElse((severity): unknown => ({ ...setting.options, severity: coreSeverity(severity) })),\n );\n\nconst ENABLED: Setting = settingOf(\"error\");\n\nconst configured =\n (config: Y8Config, plugin: string) =>\n (name: string): Option.Option<Setting> =>\n pipe(config.rules ?? {}, Rec.get(`${plugin}${SEPARATOR}${name}`), Option.map(settingOf));\n\nconst scriptRules =\n (config: Y8Config) =>\n ([plugin, value]: PluginEntry): readonly ScriptRule[] =>\n pipe(\n Rec.toEntries(value.rules ?? {}),\n Arr.map(([name, rule]): ScriptRule => ({\n id: `${plugin}${SEPARATOR}${name}`,\n rule,\n setting: Option.getOrElse(configured(config, plugin)(name), () => ENABLED),\n })),\n Arr.filter(({ setting }) => isOn(setting)),\n );\n\nconst compatRule =\n (config: Y8Config, plugin: string) =>\n (rule: MarkdownlintRule): Option.Option<CompatRule> =>\n pipe(\n Arr.head(rule.names),\n Option.map((name): CompatRule => ({\n id: `${plugin}${SEPARATOR}${name}`,\n rule,\n setting: pipe(\n rule.names,\n Arr.findFirst(configured(config, plugin)),\n Option.getOrElse(() => ENABLED),\n ),\n })),\n );\n\nconst compatRules =\n (config: Y8Config) =>\n ([plugin, value]: PluginEntry): readonly CompatRule[] =>\n pipe(\n value.markdownlintRules ?? [],\n Arr.flatMap((rule) => Option.toArray(compatRule(config, plugin)(rule))),\n Arr.filter(({ setting }) => isOn(setting)),\n );\n\nconst builtinEntries = (config: Y8Config): Readonly<Record<string, unknown>> =>\n pipe(\n Rec.toEntries(config.rules ?? {}),\n Arr.map(([id, entry]) => ({ ...ruleIdOf(id), setting: settingOf(entry) })),\n Arr.filter(({ plugin }) => plugin === BUILTIN),\n Arr.map(({ name, setting }): readonly [string, unknown] => [name, coreEntry(setting)]),\n Rec.fromEntries,\n );\n\nconst agentSettings = (config: Y8Config, plugin: string): Readonly<Record<string, Setting>> =>\n pipe(\n Rec.toEntries(config.rules ?? {}),\n Arr.map(([id, entry]) => ({ ...ruleIdOf(id), setting: settingOf(entry) })),\n Arr.filter((rule) => rule.plugin === plugin),\n Arr.map(({ name, setting }): readonly [string, Setting] => [name, setting]),\n Rec.fromEntries,\n );\n\nconst agentRules =\n (config: Y8Config) =>\n ([plugin]: PluginEntry): AgentRules => {\n const settings = agentSettings(config, plugin);\n return {\n plugin,\n settings,\n disabled: pipe(\n Rec.toEntries(settings),\n Arr.filter(([, setting]) => !isOn(setting)),\n Arr.map(([name]) => name),\n ),\n };\n };\n\nexport const resolve = (config: Y8Config): Resolved => {\n const plugins = Rec.toEntries(config.plugins ?? {});\n return {\n core: { default: true, ...builtinEntries(config) },\n scripts: pipe(plugins, Arr.flatMap(scriptRules(config))),\n compat: pipe(plugins, Arr.flatMap(compatRules(config))),\n agent: pipe(\n plugins,\n Arr.findFirst(([, value]) => value.agentConfig === true),\n Option.map(agentRules(config)),\n ),\n };\n};\n\nexport const unknownPlugins = (config: Y8Config): readonly string[] =>\n pipe(\n config.overrides ?? [],\n Arr.flatMap((override) => Rec.keys(override.rules)),\n Arr.appendAll(Rec.keys(config.rules ?? {})),\n Arr.map((id) => ruleIdOf(id).plugin),\n Arr.filter((plugin) => plugin !== BUILTIN && !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\n );\n","import { Array as Arr, Function as Fn, Option, Record as Rec, String as Str, pipe } from \"effect\";\nimport { minimatch } from \"minimatch\";\n\nimport type { Override, RuleEntry, Y8Config } from \"#/shared/config/index.ts\";\n\nconst NEGATION = \"!\";\nconst KEY_SEPARATOR = \",\";\nconst DATA_FIRST_ARITY = 2;\n\nexport interface FileGroup {\n readonly config: Y8Config;\n readonly files: readonly string[];\n}\n\ntype Rules = Readonly<Record<string, RuleEntry>>;\n\ninterface Member {\n readonly path: string;\n readonly indexes: readonly number[];\n}\n\nconst isNegated = Str.startsWith(NEGATION);\n\nconst isIncluded = (pattern: string): boolean => !isNegated(pattern);\n\nconst matchesAny =\n (path: string) =>\n (patterns: readonly string[]): boolean =>\n pipe(\n patterns,\n Arr.some((pattern) => minimatch(path, pattern, { dot: true })),\n );\n\nconst excludedOf = (override: Override): readonly string[] =>\n pipe(override.files, Arr.filter(isNegated), Arr.map(Str.slice(NEGATION.length)));\n\nconst applies =\n (path: string) =>\n (override: Override): boolean =>\n pipe(override.files, Arr.filter(isIncluded), matchesAny(path)) &&\n !matchesAny(path)(excludedOf(override));\n\nconst matchingIndexes = (config: Y8Config, path: string): readonly number[] =>\n pipe(\n config.overrides ?? [],\n Arr.flatMap((override, index) =>\n Option.toArray(Option.liftPredicate(index, () => applies(path)(override))),\n ),\n );\n\nconst entriesOf = (override: Override): readonly (readonly [string, RuleEntry])[] =>\n Rec.toEntries(override.rules);\n\nconst rulesWith = (base: Rules, overrides: readonly Override[]): Rules =>\n pipe(overrides, Arr.flatMap(entriesOf), Arr.prependAll(Rec.toEntries(base)), Rec.fromEntries);\n\nconst overridesAt =\n (overrides: readonly Override[]) =>\n (indexes: readonly number[]): readonly Override[] =>\n pipe(\n indexes,\n Arr.flatMap((index) => Option.toArray(Arr.get(overrides, index))),\n );\n\nconst configWith = (config: Y8Config, indexes: readonly number[]): Y8Config => {\n const { overrides = [], ...base } = config;\n return { ...base, rules: rulesWith(base.rules ?? {}, overridesAt(overrides)(indexes)) };\n};\n\nconst keyOf = (member: Member): string =>\n pipe(member.indexes, Arr.map(String), Arr.join(KEY_SEPARATOR));\n\nconst groupOf =\n (config: Y8Config) =>\n (members: Arr.NonEmptyReadonlyArray<Member>): FileGroup => ({\n config: configWith(config, Arr.headNonEmpty(members).indexes),\n files: pipe(\n members,\n Arr.map((member) => member.path),\n ),\n });\n\nexport const groupByOverrides: {\n (files: readonly string[]): (config: Y8Config) => readonly FileGroup[];\n (config: Y8Config, files: readonly string[]): readonly FileGroup[];\n} = Fn.dual(DATA_FIRST_ARITY, (config: Y8Config, files: readonly string[]): readonly FileGroup[] =>\n pipe(\n files,\n Arr.map((path): Member => ({ path, indexes: matchingIndexes(config, path) })),\n Arr.groupBy(keyOf),\n Rec.values,\n Arr.map(groupOf(config)),\n ),\n);\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\n\nexport const diagnosticDetail = (diagnostic: Diagnostic): string =>\n pipe(\n [diagnostic.detail, diagnostic.context],\n Arr.flatMap((part) => Option.toArray(Option.fromNullishOr(part))),\n Arr.filter((part) => part !== \"\"),\n Arr.map((part) => ` [${part}]`),\n Arr.join(\"\"),\n );\n\nexport const format = (diagnostic: Diagnostic): string => {\n const column = pipe(\n Option.fromNullishOr(diagnostic.column),\n Option.map((value) => `:${String(value)}`),\n Option.getOrElse(() => \"\"),\n );\n return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`;\n};\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Match, Option, Record as Rec, pipe } from \"effect\";\n\nimport { reportedSeverity } from \"#/entities/rule/index.ts\";\nimport type { AgentRules } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\nimport type { AgentDiagnostic, NativeResult } from \"#/shared/native/index.ts\";\n\nconst SEPARATOR = \"/\";\n\nconst levelSeverity = (diagnostic: AgentDiagnostic): Diagnostic[\"severity\"] =>\n Match.value(diagnostic.level).pipe(\n Match.when(\"error\", (): Diagnostic[\"severity\"] => \"error\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"warn\"),\n );\n\nconst diagnosticOf =\n (rules: AgentRules, path: string) =>\n (diagnostic: AgentDiagnostic): Diagnostic => ({\n path,\n line: diagnostic.line,\n column: diagnostic.column,\n rule: `${rules.plugin}${SEPARATOR}${diagnostic.rule}`,\n message: diagnostic.message,\n severity: pipe(\n Rec.get(rules.settings, diagnostic.rule),\n Option.match({ onNone: () => levelSeverity(diagnostic), onSome: reportedSeverity }),\n ),\n ...present(Option.fromNullishOr(diagnostic.suggestion), (detail) => ({ detail })),\n });\n\nexport const agentDiagnosticsOf =\n (rules: AgentRules) =>\n (result: NativeResult): readonly Diagnostic[] =>\n pipe(result.agentDiagnostics ?? [], Arr.map(diagnosticOf(rules, result.path)));\n","import { Array as Arr, Effect, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nimport type { PackageManifest, Project } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport { native } from \"#/shared/native/index.ts\";\n\nconst MANIFEST = \"package.json\";\nconst SEPARATOR = \"/\";\nconst ONE = 1;\n\nconst ancestorsOf = (file: string): readonly string[] => {\n const parts = Str.split(file, SEPARATOR);\n return Arr.makeBy(parts.length, (index) =>\n pipe(parts, Arr.take(parts.length - ONE - index), Arr.join(SEPARATOR)),\n );\n};\n\nconst manifestFileOf = (directory: string): string =>\n pipe([directory, MANIFEST], Arr.filter(Str.isNonEmpty), Arr.join(SEPARATOR));\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\n\nconst manifestFrom =\n (directory: string) =>\n (text: string | null): Option.Option<PackageManifest> =>\n pipe(\n Option.fromNullishOr(text),\n Option.flatMap(decodeJson),\n Option.filter(Predicate.isObject),\n Option.map((data): PackageManifest => ({ directory, data })),\n );\n\nexport interface ProjectInput {\n readonly root: string;\n readonly projectFiles: readonly string[];\n readonly files: readonly string[];\n}\n\nconst prefixOf = (directory: string): string =>\n pipe(\n Option.liftPredicate(directory, Str.isNonEmpty),\n Option.map((value) => `${value}${SEPARATOR}`),\n Option.getOrElse(() => \"\"),\n );\n\nconst isUnder = (directory: string): ((path: string) => boolean) =>\n Str.startsWith(prefixOf(directory));\n\nexport const readProject = Effect.fn(\"y8.project\")(function* readProject(input: ProjectInput) {\n const listed: ReadonlySet<string> = new Set([...input.projectFiles, ...input.files]);\n const all = Arr.fromIterable(listed);\n const directories = pipe(\n input.files,\n Arr.flatMap(ancestorsOf),\n Arr.dedupe,\n Arr.filter((directory) => listed.has(manifestFileOf(directory))),\n );\n const addon = yield* native;\n const texts = yield* Effect.try({\n try: () => addon.readTexts(input.root, pipe(directories, Arr.map(manifestFileOf))),\n catch: failedWith(\"y8 could not read package.json\"),\n });\n const manifests: ReadonlyMap<string, PackageManifest> = new Map(\n pipe(\n Arr.zip(directories, texts),\n Arr.flatMap(([directory, text]) => Option.toArray(manifestFrom(directory)(text))),\n Arr.map((manifest): readonly [string, PackageManifest] => [manifest.directory, manifest]),\n ),\n );\n return {\n exists: (path): boolean => listed.has(path) || pipe(all, Arr.some(isUnder(path))),\n under: (directory): readonly string[] => pipe(all, Arr.filter(isUnder(directory))),\n manifestOf: (file): PackageManifest | undefined =>\n pipe(\n ancestorsOf(file),\n Arr.findFirst((directory) => Option.fromNullishOr(manifests.get(directory))),\n Option.getOrUndefined,\n ),\n } satisfies Project;\n});\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect, Option, Predicate, Record as Rec, pipe } from \"effect\";\n\nimport { reportedSeverity } from \"#/entities/rule/index.ts\";\nimport type { CompatRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic } from \"#/shared/config/index.ts\";\nimport { Y8Error, failedWith } from \"#/shared/lib/errors.ts\";\nimport type { SourceFile } from \"#/shared/native/index.ts\";\n\ninterface MarkdownlintError {\n readonly lineNumber: number;\n readonly ruleNames: readonly string[];\n readonly ruleDescription: string;\n readonly errorDetail?: string | null;\n readonly errorContext?: string | null;\n readonly errorRange?: readonly [number, number] | null;\n}\n\ninterface MarkdownlintOptions {\n readonly strings: Readonly<Record<string, string>>;\n readonly config: Readonly<Record<string, unknown>>;\n readonly customRules: readonly unknown[];\n}\n\ninterface MarkdownlintModule {\n readonly lint: (\n options: MarkdownlintOptions,\n ) => Promise<Readonly<Record<string, readonly MarkdownlintError[]>>>;\n}\n\nexport interface CompatInput {\n readonly files: readonly SourceFile[];\n readonly rules: readonly CompatRule[];\n}\n\nconst MARKDOWNLINT = \"markdownlint/promise\";\n\nconst isMarkdownlint = (value: unknown): value is MarkdownlintModule =>\n Predicate.hasProperty(value, \"lint\") && Predicate.isFunction(value.lint);\n\nconst load = Effect.tryPromise({\n try: (): Promise<unknown> => import(MARKDOWNLINT),\n catch: failedWith(\"markdownlint custom rules need the markdownlint package installed\"),\n}).pipe(\n Effect.filterOrFail(isMarkdownlint, () =>\n Y8Error.make({ message: `${MARKDOWNLINT} does not export lint` }),\n ),\n);\n\nconst ruleOf = (\n rules: readonly CompatRule[],\n error: MarkdownlintError,\n): Option.Option<CompatRule> =>\n pipe(\n Arr.head(error.ruleNames),\n Option.flatMap((name) =>\n pipe(\n rules,\n Arr.findFirst(({ rule }) => pipe(rule.names, Arr.contains(name))),\n ),\n ),\n );\n\nconst rangeFields = (\n error: MarkdownlintError,\n): Partial<{ readonly column: number; readonly length: number }> =>\n present(Option.fromNullishOr(error.errorRange), ([column, length]) => ({ column, length }));\n\nconst diagnosticOf =\n (path: string, rules: readonly CompatRule[]) =>\n (error: MarkdownlintError): Option.Option<Diagnostic> =>\n pipe(\n ruleOf(rules, error),\n Option.map((rule): Diagnostic => ({\n path,\n line: error.lineNumber,\n rule: rule.id,\n message: error.ruleDescription,\n severity: reportedSeverity(rule.setting),\n ...rangeFields(error),\n ...present(Option.fromNullishOr(error.errorDetail), (detail) => ({ detail })),\n ...present(Option.fromNullishOr(error.errorContext), (context) => ({ context })),\n })),\n );\n\nconst settingOf = (rule: CompatRule): unknown =>\n pipe(\n rule.setting.options,\n Option.liftPredicate((options) => !Rec.isEmptyRecord(options)),\n Option.getOrElse((): unknown => true),\n );\n\nconst configOf = (rules: readonly CompatRule[]): Readonly<Record<string, unknown>> =>\n pipe(\n rules,\n Arr.flatMap((rule) =>\n pipe(\n Arr.head(rule.rule.names),\n Option.map((name): readonly [string, unknown] => [name, settingOf(rule)]),\n Option.toArray,\n ),\n ),\n Rec.fromEntries,\n );\n\nconst optionsOf = (input: CompatInput): MarkdownlintOptions => ({\n strings: pipe(\n input.files,\n Arr.map(({ path, text }): readonly [string, string] => [path, text]),\n Rec.fromEntries,\n ),\n config: { default: false, ...configOf(input.rules) },\n customRules: pipe(\n input.rules,\n Arr.map(({ rule }) => rule),\n ),\n});\n\nconst diagnosticsOf =\n (rules: readonly CompatRule[]) =>\n ([path, errors]: readonly [string, readonly MarkdownlintError[]]): readonly Diagnostic[] =>\n pipe(\n errors,\n Arr.flatMap((found) => Option.toArray(diagnosticOf(path, rules)(found))),\n );\n\nconst run = Effect.fn(\"y8.markdownlint_rules\")(function* run(input: CompatInput) {\n const markdownlint = yield* load;\n const results = yield* Effect.tryPromise({\n try: () => markdownlint.lint(optionsOf(input)),\n catch: failedWith(\"a markdownlint custom rule failed\"),\n });\n return pipe(Rec.toEntries(results), Arr.flatMap(diagnosticsOf(input.rules)));\n});\n\nexport const runCompatRules = (input: CompatInput): Effect.Effect<readonly Diagnostic[], Y8Error> =>\n Arr.match(input.rules, {\n onEmpty: () => Effect.succeed([]),\n onNonEmpty: () => run(input),\n });\n","import { Array as Arr, Match, Option, pipe } from \"effect\";\n\nimport type { MarkdownNode, Position } from \"#/shared/config/index.ts\";\nimport { FIELD, NODE_WORDS, TAGS } from \"#/shared/native/index.ts\";\nimport type { NodeType, SourceView } from \"#/shared/native/index.ts\";\n\nconst NONE = 0;\nconst ROOT = 0;\nconst NEXT = 1;\nconst SET = 1;\nconst TITLE = 1;\nconst LABEL = 2;\n\nconst LINKS = [\n \"inline\",\n \"reference\",\n \"collapsed\",\n \"shortcut\",\n \"autolink\",\n \"email\",\n \"wiki\",\n] as const;\n\nexport interface Document {\n readonly root: MarkdownNode;\n readonly textOf: (node: MarkdownNode) => string;\n readonly positionOf: (offset: number) => Position;\n}\n\ntype Data = Readonly<Record<string, unknown>>;\n\ninterface Fields {\n readonly view: SourceView;\n readonly type: NodeType;\n readonly first: number;\n readonly second: number;\n}\n\nconst linkData = ({ view, first, second }: Fields): Data => ({\n link: pipe(\n LINKS,\n Arr.get(first),\n Option.getOrElse(() => LINKS[NONE]),\n ),\n destination: view.stringAt(second),\n title: view.stringAt(second + TITLE),\n label: view.stringAt(second + LABEL),\n});\n\nconst listData = ({ first, second }: Fields): Data => ({\n ordered: first === SET,\n ...pipe(\n Option.some(second),\n Option.filter((value) => value !== NONE),\n Option.match({\n onNone: (): Data => ({}),\n onSome: (value): Data => ({ start: value - NEXT }),\n }),\n ),\n});\n\nconst dataOf = (fields: Fields): Data =>\n Match.value(fields.type).pipe(\n Match.when(\"heading\", (): Data => ({ level: fields.first, setext: fields.second === SET })),\n Match.when(\"codeBlock\", (): Data => ({\n fenced: fields.first === SET,\n info: fields.view.stringAt(fields.second),\n })),\n Match.when(\"list\", () => listData(fields)),\n Match.whenOr(\"footnoteDefinition\", \"footnoteReference\", (): Data => ({\n label: fields.view.stringAt(fields.first),\n })),\n Match.whenOr(\"link\", \"image\", () => linkData(fields)),\n Match.when(\"math\", (): Data => ({ display: fields.first === SET })),\n Match.when(\"taskListMarker\", (): Data => ({ checked: fields.first === SET })),\n Match.orElse((): Data => ({})),\n );\n\nexport const once = <Value>(make: () => Value): (() => Value) => {\n const made: Value[] = [];\n return () =>\n pipe(\n Arr.head(made),\n Option.getOrElse(() => {\n const value = make();\n made.push(value);\n return value;\n }),\n );\n};\n\ninterface Tree {\n readonly at: (id: number) => MarkdownNode;\n readonly field: (id: number, field: number) => number;\n}\n\nconst linked =\n (tree: Tree) =>\n (plusOne: number): Option.Option<MarkdownNode> =>\n pipe(\n Option.some(plusOne),\n Option.filter((value) => value !== NONE),\n Option.map((value) => tree.at(value - NEXT)),\n );\n\nconst childrenOf = (tree: Tree, id: number): readonly MarkdownNode[] => {\n const found: MarkdownNode[] = [];\n for (\n let child = tree.field(id, FIELD.firstChild);\n child !== NONE;\n child = tree.field(child - NEXT, FIELD.nextSibling)\n ) {\n found.push(tree.at(child - NEXT));\n }\n return found;\n};\n\nconst nodeOf = (tree: Tree, view: SourceView, id: number): MarkdownNode => {\n const type = pipe(\n TAGS,\n Arr.get(tree.field(id, FIELD.tag)),\n Option.getOrElse((): NodeType => \"other\"),\n );\n const children = once(() => childrenOf(tree, id));\n const data = once(() =>\n dataOf({\n view,\n type,\n first: tree.field(id, FIELD.first),\n second: tree.field(id, FIELD.second),\n }),\n );\n return {\n type,\n id,\n start: tree.field(id, FIELD.start),\n end: tree.field(id, FIELD.end),\n get parent() {\n return pipe(linked(tree)(tree.field(id, FIELD.parent)), Option.getOrUndefined);\n },\n get children() {\n return children();\n },\n get data() {\n return data();\n },\n };\n};\n\nconst treeOf = (view: SourceView): Tree => {\n const made = new Map<number, MarkdownNode>();\n const tree: Tree = {\n field: (id, field) => view.nodes[id * NODE_WORDS + field] ?? NONE,\n at: (id) =>\n pipe(\n Option.fromNullishOr(made.get(id)),\n Option.getOrElse(() => {\n const node = nodeOf(tree, view, id);\n made.set(id, node);\n return node;\n }),\n ),\n };\n return tree;\n};\n\nconst positionIn =\n (view: SourceView) =>\n (offset: number): Position => {\n const line = Math.max(\n view.lineStarts.findLastIndex((start) => start <= offset),\n ROOT,\n );\n const start = view.lineStarts[line] ?? NONE;\n return { line: line + NEXT, column: view.slice(start, offset).length + NEXT };\n };\n\nexport const documentOf = (view: SourceView): Option.Option<Document> =>\n pipe(\n Option.some(view),\n Option.filter(({ nodeCount }) => nodeCount !== NONE),\n Option.map((source): Document => ({\n root: treeOf(source).at(ROOT),\n textOf: (node) => source.slice(node.start, node.end),\n positionOf: positionIn(source),\n })),\n );\n","import { Option, Predicate, Record as Rec, pipe } from \"effect\";\nimport { parse } from \"yaml\";\n\nimport type { Frontmatter } from \"#/shared/config/index.ts\";\n\nconst BLOCK = /^---\\r?\\n(?<body>[\\s\\S]*?)\\r?\\n---(?:\\r?\\n|$)/u;\n\nconst parsed = (body: string): Option.Option<unknown> =>\n Option.liftThrowable((): unknown => parse(body))();\n\nexport const frontmatterOf = (text: string): Frontmatter | undefined =>\n pipe(\n Option.fromNullishOr(BLOCK.exec(text)),\n Option.flatMap((match) => Option.fromNullishOr(match.groups)),\n Option.flatMap(Rec.get(\"body\")),\n Option.flatMap(parsed),\n Option.filter(Predicate.isObject),\n Option.getOrUndefined,\n );\n","import { present } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport { reportedSeverity } from \"#/entities/rule/index.ts\";\nimport type { ScriptRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, MarkdownNode, Project, Report, Visitors } from \"#/shared/config/index.ts\";\nimport type { SourceView } from \"#/shared/native/index.ts\";\n\nimport { documentOf, once } from \"./document.ts\";\nimport type { Document } from \"./document.ts\";\nimport { frontmatterOf } from \"./frontmatter.ts\";\n\nconst EXIT = \":exit\";\nconst FIRST_LINE = 1;\nconst LINE_BREAK = /\\r\\n|\\r|\\n/u;\n\nexport interface ScriptInput {\n readonly path: string;\n readonly source: SourceView;\n readonly rules: readonly ScriptRule[];\n readonly project: Project;\n}\n\ntype Handler = (node: MarkdownNode) => void;\n\nconst handlerOf = (visitor: Visitors, key: keyof Visitors): Option.Option<Handler> =>\n Option.fromNullishOr(visitor[key]);\n\nconst visit = (visitors: readonly Visitors[], key: keyof Visitors, node: MarkdownNode): void => {\n for (const visitor of visitors) {\n for (const handler of Option.toArray(handlerOf(visitor, key))) {\n handler(node);\n }\n }\n};\n\nconst walk = (visitors: readonly Visitors[], node: MarkdownNode): void => {\n visit(visitors, node.type, node);\n for (const child of node.children) {\n walk(visitors, child);\n }\n visit(visitors, `${node.type}${EXIT}`, node);\n};\n\ntype Extras = Partial<{\n readonly column: number;\n readonly length: number;\n readonly detail: string;\n}>;\n\nconst extras = (report: Report, position: Option.Option<{ readonly column: number }>): Extras => ({\n ...present(\n pipe(\n Option.fromNullishOr(report.column),\n Option.orElse(() =>\n pipe(\n position,\n Option.map(({ column }) => column),\n ),\n ),\n ),\n (column) => ({ column }),\n ),\n ...present(Option.fromNullishOr(report.length), (length) => ({ length })),\n ...present(Option.fromNullishOr(report.detail), (detail) => ({ detail })),\n});\n\nconst diagnosticOf =\n (path: string, document: Document, rule: ScriptRule) =>\n (report: Report): Diagnostic => {\n const position = pipe(\n Option.fromNullishOr(report.node),\n Option.map((node) => document.positionOf(node.start)),\n );\n const line = pipe(\n Option.fromNullishOr(report.line),\n Option.orElse(() =>\n pipe(\n position,\n Option.map(({ line: at }) => at),\n ),\n ),\n Option.getOrElse(() => FIRST_LINE),\n );\n return {\n path,\n line,\n rule: rule.id,\n message: report.message,\n severity: reportedSeverity(rule.setting),\n ...extras(report, position),\n };\n };\n\nconst runOn = (input: ScriptInput, document: Document): readonly Diagnostic[] => {\n const found: Diagnostic[] = [];\n const text = input.source.text();\n const lines = once(() => Str.split(text, LINE_BREAK));\n const frontmatter = once(() => frontmatterOf(text));\n const visitors = pipe(\n input.rules,\n Arr.map((rule) => {\n const toDiagnostic = diagnosticOf(input.path, document, rule);\n return rule.rule.create({\n filename: input.path,\n get frontmatter() {\n return frontmatter();\n },\n exists: input.project.exists,\n filesUnder: input.project.under,\n manifest: input.project.manifestOf(input.path),\n text,\n get lines() {\n return lines();\n },\n options: rule.setting.options,\n root: document.root,\n textOf: document.textOf,\n positionOf: document.positionOf,\n report: (report) => {\n found.push(toDiagnostic(report));\n },\n });\n }),\n );\n walk(visitors, document.root);\n return found;\n};\n\nexport const runScriptRules = (input: ScriptInput): readonly Diagnostic[] =>\n pipe(\n documentOf(input.source),\n Option.filter(() => Arr.isReadonlyArrayNonEmpty(input.rules)),\n Option.map((document) => runOn(input, document)),\n Option.getOrElse((): readonly Diagnostic[] => []),\n );\n","import { callAddon, present, sortByPosition, traceparent } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Effect, Match, Option, pipe } from \"effect\";\n\nimport { BUILTIN, groupByOverrides, resolve, unknownPlugins } from \"#/entities/rule/index.ts\";\nimport type { FileGroup, Resolved } from \"#/entities/rule/index.ts\";\nimport { agentDiagnosticsOf } from \"#/features/map-agent-diagnostics/index.ts\";\nimport { readProject } from \"#/features/read-project/index.ts\";\nimport { runCompatRules } from \"#/features/run-compat-rules/index.ts\";\nimport { runScriptRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, Project, Y8Config } from \"#/shared/config/index.ts\";\nimport { Y8Error, failedWith } from \"#/shared/lib/errors.ts\";\nimport { native, sourceView } from \"#/shared/native/index.ts\";\nimport type {\n NativeDiagnostic,\n NativeOptions,\n NativeResult,\n SourceFile,\n SourceView,\n} from \"#/shared/native/index.ts\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles?: readonly string[];\n readonly config?: Y8Config;\n}\n\ntype RangeFields = Partial<{ readonly column: number; readonly length: number }>;\n\nconst rangeOf = (diagnostic: NativeDiagnostic): RangeFields =>\n present(Option.fromNullishOr(diagnostic.range), ([column, length]) => ({ column, length }));\n\nconst severityOf = (diagnostic: NativeDiagnostic): Diagnostic[\"severity\"] =>\n Match.value(diagnostic.severity).pipe(\n Match.when(\"warning\", (): Diagnostic[\"severity\"] => \"warn\"),\n Match.orElse((): Diagnostic[\"severity\"] => \"error\"),\n );\n\nconst fromNative =\n (path: string) =>\n (diagnostic: NativeDiagnostic): Diagnostic => ({\n path,\n line: diagnostic.line,\n rule: `${BUILTIN}/${Option.getOrElse(Arr.head(diagnostic.ruleNames), () => \"\")}`,\n message: diagnostic.description,\n severity: severityOf(diagnostic),\n ...rangeOf(diagnostic),\n ...present(Option.fromNullishOr(diagnostic.detail), (detail) => ({ detail })),\n ...present(Option.fromNullishOr(diagnostic.context), (context) => ({ context })),\n });\n\nconst needsText = (resolved: Resolved): boolean =>\n Arr.isReadonlyArrayNonEmpty(resolved.scripts) || Arr.isReadonlyArrayNonEmpty(resolved.compat);\n\nconst nativeOptions = (\n root: string,\n resolved: Resolved,\n config: Y8Config,\n): Effect.Effect<NativeOptions> =>\n traceparent.pipe(\n Effect.map((parent): NativeOptions => ({\n config: resolved.core,\n inlineConfig: config.inlineConfig ?? true,\n keepTree: Arr.isReadonlyArrayNonEmpty(resolved.scripts),\n keepSource: needsText(resolved),\n ...present(parent, (value) => ({ traceparent: value })),\n ...present(resolved.agent, ({ disabled }) => ({ agnix: { root, disabled } })),\n })),\n );\n\nconst viewOf = (result: NativeResult): Option.Option<SourceView> =>\n pipe(Option.fromNullishOr(result.source), Option.map(sourceView));\n\nconst sourceOf = (result: NativeResult): Option.Option<SourceFile> =>\n pipe(\n viewOf(result),\n Option.map((view): SourceFile => ({ path: result.path, text: view.text() })),\n );\n\nconst scriptedOne =\n (resolved: Resolved, project: Project) =>\n (result: NativeResult): readonly Diagnostic[] =>\n pipe(\n viewOf(result),\n Option.map((source) =>\n runScriptRules({\n path: result.path,\n source,\n rules: resolved.scripts,\n project,\n }),\n ),\n Option.getOrElse((): readonly Diagnostic[] => []),\n );\n\nconst builtinOf = (result: NativeResult): readonly Diagnostic[] =>\n pipe(result.diagnostics, Arr.map(fromNative(result.path)));\n\nconst checkPlugins = (config: Y8Config): Effect.Effect<void, Y8Error> =>\n Arr.match(unknownPlugins(config), {\n onEmpty: () => Effect.void,\n onNonEmpty: (names) =>\n Effect.fail(\n Y8Error.make({\n message: `rules name plugins that are not configured: ${Arr.join(names, \", \")}`,\n }),\n ),\n });\n\nconst lintGroup = (\n root: string,\n project: Project,\n): ((group: FileGroup) => Effect.Effect<readonly Diagnostic[], Y8Error>) =>\n Effect.fn(\"y8.lint.group\")(function* group(input: FileGroup) {\n const resolved = resolve(input.config);\n const options = yield* nativeOptions(root, resolved, input.config);\n const results = yield* callAddon({\n addon: native,\n name: \"y8\",\n files: input.files.length,\n call: (addon) => addon.lintPaths(root, input.files, options),\n failWith: failedWith,\n });\n const compat = yield* runCompatRules({\n files: pipe(\n results,\n Arr.flatMap((result) => Option.toArray(sourceOf(result))),\n ),\n rules: resolved.compat,\n });\n const builtin = pipe(results, Arr.flatMap(builtinOf));\n const scripted = yield* Effect.sync(() =>\n pipe(results, Arr.flatMap(scriptedOne(resolved, project))),\n ).pipe(\n Effect.withSpan(\"y8.script_rules\", {\n attributes: { \"y8.files\": results.length, \"y8.rules\": resolved.scripts.length },\n }),\n );\n const agent = Option.match(resolved.agent, {\n onNone: (): readonly Diagnostic[] => [],\n onSome: (rules) => pipe(results, Arr.flatMap(agentDiagnosticsOf(rules))),\n });\n return [...builtin, ...scripted, ...compat, ...agent];\n });\n\nexport const lint = Effect.fn(\"y8.lint\")(function* lint(input: LintInput) {\n const config = input.config ?? {};\n yield* checkPlugins(config);\n const project = yield* readProject({\n root: input.root,\n files: input.files,\n projectFiles: input.projectFiles ?? [],\n });\n const found = yield* Effect.forEach(\n groupByOverrides(config, input.files),\n lintGroup(input.root, project),\n { concurrency: 1 },\n );\n return sortByPosition<Diagnostic>(Arr.flatten(found));\n});\n","import { Array as Arr, Option, Predicate, pipe } from \"effect\";\n\nimport type { Y8Config } from \"#/shared/config/index.ts\";\n\nconst MARKDOWN = \"*.md\";\n\nconst hasSection = (value: unknown): value is { readonly y8: Y8Config } =>\n Predicate.hasProperty(value, \"y8\") && Predicate.isObject(value.y8);\n\nexport const y8Section = (config: unknown): Y8Config =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.map((value) => value.y8),\n Option.getOrElse((): Y8Config => ({})),\n );\n\nexport interface PathspecInput {\n readonly config: Y8Config;\n readonly patterns?: readonly string[];\n}\n\nexport const markdownPathspecs = ({\n config,\n patterns = [MARKDOWN],\n}: PathspecInput): readonly string[] => [\n ...patterns,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n];\n"],"mappings":";;;;;AAEA,MAAa,QAAgB,EAAE,aAAa,KAAK;;ACAjD,MAAa,cAAc,SAAqB;AAEhD,MAAa,gBAAgB,WAA2B;;ACSxD,MAAa,UAAU;AAEvB,MAAMA,cAAY;AAClB,MAAM,QAAQ;AAId,MAAa,oBAAoB,YAC/B,MAAM,MAAM,QAAQ,QAAQ,CA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,OAAO,aAAa,MAAM;CAC1B,MAAM,UAAU,OAAO,YAAY;EACjC,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,cAAc,MAAM,gBAAgB,CAAC;CACvC,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,QAC1B,iBAAiB,QAAQ,MAAM,KAAK,GACpC,UAAU,MAAM,MAAM,OAAO,GAC7B,EAAE,aAAa,EAAE,CACnB;CACA,OAAO,eAA2BA,MAAI,QAAQ,KAAK,CAAC;AACtD,CAAC;;AC3JD,MAAM,WAAW;AAEjB,MAAM,cAAc,UAClB,UAAU,YAAY,OAAO,IAAI,KAAK,UAAU,SAAS,MAAM,EAAE;AAEnE,MAAa,aAAa,WACxB,KACE,OAAO,cAAc,QAAQ,UAAU,GACvC,OAAO,KAAK,UAAU,MAAM,EAAE,GAC9B,OAAO,iBAA2B,CAAC,EAAE,CACvC;AAOF,MAAa,qBAAqB,EAChC,QACA,WAAW,CAAC,QAAQ,QACkB,CACtC,GAAG,UACH,GAAG,KACD,OAAO,WAAW,CAAC,GACnBC,MAAI,KAAK,SAAS,kBAAkB,MAAM,CAC5C,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split-morphemes-BS74IEHA.mjs","names":["taggedError","Rec","Str","Arr","Str","Fn","Bool","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/load-addon/model/load.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../src/shared/lib/errors.ts","../src/shared/native/source.ts","../src/shared/native/index.ts","../src/features/split-morphemes/model/tokenize.ts"],"sourcesContent":["import { Match } from \"effect\";\n\nexport type Severity = \"off\" | \"warn\" | \"error\";\n\nexport type RuleOptions = Readonly<Record<string, unknown>>;\n\nexport type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];\n\nexport interface Setting {\n readonly severity: Severity;\n readonly options: RuleOptions;\n}\n\nconst NO_OPTIONS: RuleOptions = {};\n\nexport const settingOf = (entry: RuleEntry): Setting =>\n Match.value(entry).pipe(\n Match.when(Match.string, (severity): Setting => ({ severity, options: NO_OPTIONS })),\n Match.orElse(([severity, options]): Setting => ({\n severity,\n options: options ?? NO_OPTIONS,\n })),\n );\n","import { Match } from \"effect\";\n\nconst abiOf = (platform: string): string =>\n Match.value(platform).pipe(\n Match.when(\"linux\", () => \"-gnu\"),\n Match.when(\"win32\", () => \"-msvc\"),\n Match.orElse(() => \"\"),\n );\n\nexport const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;\n\nexport const addonFileOf = (binary: string): string => `${binary}.${platformTarget}.node`;\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { Effect, FileSystem, Path, Record as Rec, Schema, String as Str } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { addonFileOf } from \"#/shared/lib/target.ts\";\n\nconst taggedError = Schema.TaggedError;\n\nclass AddonBuildFailed extends taggedError<AddonBuildFailed, { readonly brand: unique symbol }>()(\n \"AddonBuildFailed\",\n { message: Schema.String },\n) {}\n\nconst LIBRARY: Readonly<Record<string, (name: string) => string>> = {\n linux: (name) => `lib${name}.so`,\n darwin: (name) => `lib${name}.dylib`,\n win32: (name) => `${name}.dll`,\n};\n\nconst SUCCESS = 0;\n\nexport interface AddonBuild {\n readonly crate: string;\n readonly binary: string;\n readonly packageDir: string;\n readonly workspaceDir: string;\n}\n\nconst cargo = Effect.fn(\"cargo\")(function* cargo(crate: string, workspace: string) {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const exitCode = yield* spawner.exitCode(\n ChildProcess.make(\"cargo\", [\"build\", \"--release\", \"--locked\", \"-p\", crate], {\n cwd: workspace,\n stdout: \"inherit\",\n stderr: \"inherit\",\n }),\n );\n const failure = AddonBuildFailed.make({ message: `cargo exited with ${String(exitCode)}` });\n yield* Effect.when(\n Effect.fail(failure),\n Effect.sync(() => Number(exitCode) !== SUCCESS),\n );\n});\n\nconst build = Effect.fn(\"buildAddon\")(function* build(options: AddonBuild) {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const library = yield* Effect.fromOption(Rec.get(LIBRARY, process.platform)).pipe(\n Effect.mapError(() =>\n AddonBuildFailed.make({ message: `no native build for ${process.platform}` }),\n ),\n );\n yield* cargo(options.crate, options.workspaceDir);\n const output = path.join(options.packageDir, \"native\");\n yield* fileSystem.makeDirectory(output, { recursive: true });\n const built = library(Str.replaceAll(\"-\", \"_\")(options.crate));\n yield* fileSystem.copyFile(\n path.join(options.workspaceDir, \"target\", \"release\", built),\n path.join(output, addonFileOf(options.binary)),\n );\n});\n\nexport const buildAddon = (options: AddonBuild): void => {\n runMain(build(options).pipe(Effect.provide(NodeServices.layer)));\n};\n","import { createRequire } from \"node:module\";\n\nimport { Effect } from \"effect\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\nimport { addonFileOf, platformTarget } from \"#/shared/lib/target.ts\";\n\nexport interface AddonSource<Addon, Failure> {\n readonly packageName: string;\n readonly binary: string;\n readonly from: string;\n readonly isAddon: (value: unknown) => value is Addon;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const loadAddon = <Addon, Failure>({\n packageName,\n binary,\n from,\n isAddon,\n failWith,\n}: AddonSource<Addon, Failure>): Effect.Effect<Addon, Failure> => {\n const requireFrom = createRequire(from);\n const loadFrom = (specifier: string): Effect.Effect<unknown, Failure> =>\n Effect.try({\n try: (): unknown => requireFrom(specifier),\n catch: failWith(`could not load ${specifier}`),\n });\n return loadFrom(`${packageName}-${platformTarget}`).pipe(\n Effect.catchCause(() => loadFrom(`${packageName}/native/${addonFileOf(binary)}`)),\n Effect.filterOrFail(isAddon, (found) =>\n failWith(`no ${binary} addon for ${platformTarget}`)(found),\n ),\n );\n};\n\nexport interface Telemetered {\n readonly flushTelemetry: () => Promise<void>;\n}\n\nexport interface AddonCall<Addon extends Telemetered, Result, Failure> {\n readonly addon: Effect.Effect<Addon, Failure>;\n readonly name: string;\n readonly files: number;\n readonly call: (addon: Addon) => Result;\n readonly failWith: FailWith<Failure>;\n}\n\nexport const callAddon = <Addon extends Telemetered, Result, Failure>({\n addon,\n name,\n files,\n call,\n failWith,\n}: AddonCall<Addon, Result, Failure>): Effect.Effect<Result, Failure> =>\n addon.pipe(\n Effect.flatMap((loaded) =>\n Effect.try({ try: () => call(loaded), catch: failWith(`${name} could not lint`) }).pipe(\n Effect.tap(() => Effect.promise(() => loaded.flushTelemetry())),\n ),\n ),\n Effect.withSpan(`${name}.native`, { attributes: { [`${name}.files`]: files } }),\n );\n","import { NodeServices } from \"@effect/platform-node\";\nimport { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Layer,\n Option,\n Path,\n String as Str,\n pipe,\n} from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\nimport type { PlatformError } from \"effect/PlatformError\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { resolveConfigFromFile } from \"vite-plus\";\n\nimport type { FailWith } from \"#/shared/lib/fail.ts\";\n\nconst CONFIG_FILES = [\"vite.config.ts\", \"vite.config.mts\", \"vite.config.js\", \"vite.config.mjs\"];\nconst FAILED = 1;\nconst ARGUMENTS_START = 2;\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n}\n\nexport interface PathspecRequest<Config> {\n readonly config: Config;\n readonly patterns?: readonly string[];\n}\n\nexport interface Cli<Config, Found extends Reported, Failure> {\n readonly name: string;\n readonly section: (config: unknown) => Config;\n readonly pathspecs: (request: PathspecRequest<Config>) => readonly string[];\n readonly lint: (call: LintCall<Config>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n readonly failWith: FailWith<Failure>;\n}\n\nconst configOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n root: string,\n): Effect.Effect<Config, Failure, FileSystem.FileSystem | Path.Path> =>\n Effect.gen(function* readConfig() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const found = yield* pipe(\n CONFIG_FILES,\n Arr.map((name) => path.join(root, name)),\n Effect.filter((file) => fileSystem.exists(file).pipe(Effect.orElseSucceed(() => false))),\n );\n const loaded = yield* Option.match(Arr.head(found), {\n onNone: () => Effect.succeed<unknown>({}),\n onSome: (file) =>\n Effect.tryPromise({\n try: () => resolveConfigFromFile(file),\n catch: cli.failWith(`could not load ${file}`),\n }),\n });\n return cli.section(loaded);\n }).pipe(Effect.withSpan(`${cli.name}.config`));\n\nconst trackedFiles = (\n root: string,\n pathspecs: readonly string[],\n): Effect.Effect<readonly string[], PlatformError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function* listFiles() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const output = yield* spawner.string(\n ChildProcess.make(\n \"git\",\n [\"ls-files\", \"-co\", \"--exclude-standard\", \"-z\", \"--\", ...pathspecs],\n { cwd: root },\n ),\n );\n return pipe(Str.split(output, \"\\0\"), Arr.filter(Str.isNonEmpty));\n });\n\nconst requestOf = <Config>(config: Config, patterns: readonly string[]): PathspecRequest<Config> =>\n Arr.match(patterns, {\n onEmpty: () => ({ config }),\n onNonEmpty: (given) => ({ config, patterns: given }),\n });\n\nconst hasError = (found: readonly Reported[]): boolean =>\n pipe(\n found,\n Arr.some(({ severity }) => severity === \"error\"),\n );\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): Effect.Effect<\n void,\n Failure | PlatformError,\n FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner\n> =>\n Effect.gen(function* main() {\n const root = process.cwd();\n const config = yield* configOf(cli, root);\n const patterns = process.argv.slice(ARGUMENTS_START);\n const files = yield* trackedFiles(root, cli.pathspecs(requestOf(config, patterns))).pipe(\n Effect.withSpan(`${cli.name}.files`),\n );\n const projectFiles = yield* trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`));\n const found = yield* cli.lint({ root, files, projectFiles, config });\n yield* Arr.match(found, {\n onEmpty: () => Effect.void,\n onNonEmpty: (all) => Console.log(pipe(all, Arr.map(cli.format), Arr.join(\"\\n\"))),\n });\n yield* Effect.when(\n Effect.sync(() => {\n process.exitCode = FAILED;\n }),\n Effect.sync(() => hasError(found)),\n );\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const services = Otlp.layerFromConfig({ resource: { serviceName: cli.name } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n Layer.provideMerge(NodeServices.layer),\n );\n runMain(mainOf(cli).pipe(Effect.provide(services)));\n};\n","import { Function as Fn, Option } from \"effect\";\n\nconst DATA_FIRST_ARITY = 2;\n\nexport const present: {\n <Value, Fields extends object>(\n build: (value: Value) => Fields,\n ): (value: Option.Option<Value>) => Partial<Fields>;\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields>;\n} = Fn.dual(\n DATA_FIRST_ARITY,\n <Value, Fields extends object>(\n value: Option.Option<Value>,\n build: (value: Value) => Fields,\n ): Partial<Fields> => Option.match(value, { onNone: (): Partial<Fields> => ({}), onSome: build }),\n);\n","import { Array as Arr, Boolean as Bool, Effect, Order } from \"effect\";\nimport type { Option } from \"effect\";\n\nconst SAMPLED = \"01\";\nconst NOT_SAMPLED = \"00\";\n\nexport interface Positioned {\n readonly path: string;\n readonly line: number;\n}\n\nconst flagsOf = (sampled: boolean): string =>\n Bool.match(sampled, { onFalse: () => NOT_SAMPLED, onTrue: () => SAMPLED });\n\nexport const traceparent: Effect.Effect<Option.Option<string>> = Effect.currentSpan.pipe(\n Effect.map((span) => `00-${span.traceId}-${span.spanId}-${flagsOf(span.sampled)}`),\n Effect.option,\n);\n\nconst byPosition: Order.Order<Positioned> = Order.combine(\n Order.mapInput(Order.String, (found: Positioned) => found.path),\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class Y8Error extends taggedError<Y8Error, { readonly brand: unique symbol }>()(\"Y8Error\", {\n message: Schema.String,\n}) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): Y8Error =>\n Y8Error.make({ message: `${message}: ${String(cause)}` });\n","import { Option } from \"effect\";\n\nimport type { NodeType } from \"./index.ts\";\n\nconst WORD = 4;\nconst EMPTY = 0;\nconst HEADER_WORDS = 5;\nconst HEADER = { nodes: 0, strings: 1, lines: 2, text: 3 } as const;\nconst STRING_WORDS = 2;\nconst LENGTH = 1;\nexport const NODE_WORDS = 8;\n\nexport const FIELD = {\n tag: 0,\n start: 1,\n end: 2,\n parent: 3,\n firstChild: 4,\n nextSibling: 5,\n first: 6,\n second: 7,\n} as const;\n\nexport const TAGS: readonly NodeType[] = [\n \"document\",\n \"paragraph\",\n \"heading\",\n \"blockQuote\",\n \"codeBlock\",\n \"htmlBlock\",\n \"list\",\n \"listItem\",\n \"footnoteDefinition\",\n \"table\",\n \"tableHead\",\n \"tableRow\",\n \"tableCell\",\n \"emphasis\",\n \"strong\",\n \"strikethrough\",\n \"link\",\n \"image\",\n \"text\",\n \"code\",\n \"html\",\n \"inlineHtml\",\n \"softBreak\",\n \"hardBreak\",\n \"thematicBreak\",\n \"math\",\n \"mathBlock\",\n \"footnoteReference\",\n \"taskListMarker\",\n \"other\",\n];\n\nexport interface SourceView {\n readonly nodeCount: number;\n readonly nodes: Uint32Array;\n readonly lineStarts: Uint32Array;\n readonly text: () => string;\n readonly slice: (start: number, end: number) => string;\n readonly stringAt: (index: number) => string;\n}\n\nconst decoder = new TextDecoder();\n\nconst padded = (length: number): number => Math.ceil(length / WORD) * WORD;\n\nconst aligned = (buffer: Uint8Array): Uint8Array =>\n Option.match(\n Option.liftPredicate(buffer, ({ byteOffset }) => byteOffset % WORD === EMPTY),\n {\n onNone: () => Uint8Array.from(buffer),\n onSome: (value) => value,\n },\n );\n\nconst wordAt = (words: Uint32Array, index: number): number => words[index] ?? EMPTY;\n\nconst decode = (from: Uint8Array, start: number, end: number): string =>\n decoder.decode(from.subarray(start, end));\n\ninterface Layout {\n readonly nodeCount: number;\n readonly stringCount: number;\n readonly lineCount: number;\n readonly textLength: number;\n}\n\nconst wordsOf =\n (buffer: Uint8Array) =>\n (at: number, count: number): Uint32Array =>\n new Uint32Array(buffer.buffer, buffer.byteOffset + at * WORD, count);\n\nconst layoutOf = (header: Uint32Array): Layout => ({\n nodeCount: wordAt(header, HEADER.nodes),\n stringCount: wordAt(header, HEADER.strings),\n lineCount: wordAt(header, HEADER.lines),\n textLength: wordAt(header, HEADER.text),\n});\n\nexport const sourceView = (raw: Uint8Array): SourceView => {\n const buffer = aligned(raw);\n const words = wordsOf(buffer);\n const { nodeCount, stringCount, lineCount, textLength } = layoutOf(words(EMPTY, HEADER_WORDS));\n const stringsAt = HEADER_WORDS + nodeCount * NODE_WORDS;\n const linesAt = stringsAt + stringCount * STRING_WORDS;\n const textAt = (linesAt + lineCount) * WORD;\n const bytes = buffer.subarray(textAt, textAt + textLength);\n const strings = words(stringsAt, stringCount * STRING_WORDS);\n const blob = buffer.subarray(textAt + padded(textLength));\n return {\n nodeCount,\n nodes: words(HEADER_WORDS, nodeCount * NODE_WORDS),\n lineStarts: words(linesAt, lineCount),\n text: () => decoder.decode(bytes),\n slice: (start, end) => decode(bytes, start, end),\n stringAt: (index) => {\n const offset = wordAt(strings, index * STRING_WORDS);\n return decode(blob, offset, offset + wordAt(strings, index * STRING_WORDS + LENGTH));\n },\n };\n};\n","import { loadAddon } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Predicate, pipe } from \"effect\";\nimport type { Effect } from \"effect\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { Y8Error } from \"#/shared/lib/errors.ts\";\n\nexport { FIELD, NODE_WORDS, TAGS, sourceView } from \"./source.ts\";\nexport type { SourceView } from \"./source.ts\";\n\nexport type NodeType =\n | \"document\"\n | \"paragraph\"\n | \"heading\"\n | \"blockQuote\"\n | \"codeBlock\"\n | \"htmlBlock\"\n | \"list\"\n | \"listItem\"\n | \"footnoteDefinition\"\n | \"table\"\n | \"tableHead\"\n | \"tableRow\"\n | \"tableCell\"\n | \"emphasis\"\n | \"strong\"\n | \"strikethrough\"\n | \"link\"\n | \"image\"\n | \"text\"\n | \"code\"\n | \"html\"\n | \"inlineHtml\"\n | \"softBreak\"\n | \"hardBreak\"\n | \"thematicBreak\"\n | \"math\"\n | \"mathBlock\"\n | \"footnoteReference\"\n | \"taskListMarker\"\n | \"other\";\n\nexport type Level = \"error\" | \"warning\" | \"info\";\n\nexport interface NativeDiagnostic {\n readonly line: number;\n readonly ruleNames: readonly string[];\n readonly description: string;\n readonly detail: string | null;\n readonly context: string | null;\n readonly range: readonly [number, number] | null;\n readonly severity: Exclude<Level, \"info\">;\n}\n\nexport interface AgentDiagnostic {\n readonly line: number;\n readonly column: number;\n readonly rule: string;\n readonly message: string;\n readonly suggestion: string | null;\n readonly level: Level;\n}\n\nexport interface AgnixOptions {\n readonly root: string;\n readonly disabled: readonly string[];\n}\n\nexport interface NativeResult {\n readonly path: string;\n readonly diagnostics: readonly NativeDiagnostic[];\n readonly agentDiagnostics?: readonly AgentDiagnostic[] | null;\n readonly source?: Uint8Array | null;\n}\n\nexport interface NativeOptions {\n readonly config?: Readonly<Record<string, unknown>>;\n readonly inlineConfig?: boolean;\n readonly keepTree?: boolean;\n readonly keepSource?: boolean;\n readonly traceparent?: string;\n readonly agnix?: AgnixOptions;\n}\n\nexport interface SourceFile {\n readonly path: string;\n readonly text: string;\n}\n\nexport interface Morpheme {\n readonly word_id: number;\n readonly word_type: \"KNOWN\" | \"UNKNOWN\";\n readonly surface_form: string;\n readonly pos: string;\n readonly pos_detail_1: string;\n readonly pos_detail_2: string;\n readonly pos_detail_3: string;\n readonly conjugated_type: string;\n readonly conjugated_form: string;\n readonly basic_form: string;\n readonly reading?: string;\n readonly pronunciation?: string;\n readonly word_position: number;\n}\n\nexport interface Native {\n readonly lint: (files: readonly SourceFile[], options: NativeOptions) => readonly NativeResult[];\n readonly lintPaths: (\n root: string,\n paths: readonly string[],\n options: NativeOptions,\n ) => readonly NativeResult[];\n readonly flushTelemetry: () => Promise<void>;\n readonly readTexts: (root: string, paths: readonly string[]) => readonly (string | null)[];\n readonly tokenize: (text: string) => string;\n}\n\nconst NATIVE_FUNCTIONS = [\"lint\", \"lintPaths\", \"flushTelemetry\", \"readTexts\", \"tokenize\"] as const;\n\nconst hasFunction =\n (value: unknown) =>\n (name: string): boolean =>\n Predicate.hasProperty(value, name) && Predicate.isFunction(value[name]);\n\nconst isNative = (value: unknown): value is Native =>\n pipe(NATIVE_FUNCTIONS, Arr.every(hasFunction(value)));\n\nexport const native: Effect.Effect<Native, Y8Error> = loadAddon({\n packageName: \"@r_masseater/y8\",\n binary: \"y8\",\n from: import.meta.url,\n isAddon: isNative,\n failWith: failedWith,\n});\n","import { Array as Arr, Effect, Option, Schema, pipe } from \"effect\";\n\nimport { native } from \"#/shared/native/index.ts\";\nimport type { Morpheme } from \"#/shared/native/index.ts\";\n\nexport interface Tokenizer {\n readonly tokenize: (text: string) => readonly Morpheme[];\n readonly tokenizeForSentence: (text: string) => readonly Morpheme[];\n}\n\nconst CACHE_SIZE = 10_000;\nconst NO_MORPHEMES: readonly Morpheme[] = [];\n\nconst addon = Effect.cached(native).pipe(Effect.runSync);\n\nconst cache = new Map<string, readonly Morpheme[]>();\n\nconst decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));\n\nconst isMorphemes = (value: unknown): value is readonly Morpheme[] => Arr.isArray(value);\n\nconst parsed = (json: string): readonly Morpheme[] =>\n pipe(\n decodeJson(json),\n Option.filter(isMorphemes),\n Option.getOrElse(() => NO_MORPHEMES),\n );\n\nconst remember = (text: string, morphemes: readonly Morpheme[]): readonly Morpheme[] => {\n if (cache.size >= CACHE_SIZE) {\n cache.clear();\n }\n cache.set(text, morphemes);\n return morphemes;\n};\n\nexport const morphemesOf = (text: string): readonly Morpheme[] =>\n pipe(\n Option.fromUndefinedOr(cache.get(text)),\n Option.getOrElse(() => remember(text, parsed(pipe(addon, Effect.runSync).tokenize(text)))),\n );\n\nconst tokenizer: Tokenizer = { tokenize: morphemesOf, tokenizeForSentence: morphemesOf };\n\nexport const getTokenizer = (): Promise<Tokenizer> => Promise.resolve(tokenizer);\n\nexport const tokenize = (text: string): Promise<readonly Morpheme[]> =>\n Promise.resolve(morphemesOf(text));\n"],"mappings":";;;;;;;;;AAaA,MAAM,aAA0B,CAAC;AAEjC,MAAa,aAAa,UACxB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,SAAS,cAAuB;CAAE;CAAU,SAAS;AAAW,EAAE,GACnF,MAAM,QAAQ,CAAC,UAAU,cAAuB;CAC9C;CACA,SAAS,WAAW;AACtB,EAAE,CACJ;;ACpBF,MAAM,SAAS,aACb,MAAM,MAAM,QAAQ,CAAC,CAAC,KACpB,MAAM,KAAK,eAAe,MAAM,GAChC,MAAM,KAAK,eAAe,OAAO,GACjC,MAAM,aAAa,EAAE,CACvB;AAEF,MAAa,iBAAiB,GAAG,QAAQ,SAAS,GAAG,QAAQ,OAAO,MAAM,QAAQ,QAAQ;AAE1F,MAAa,eAAe,WAA2B,GAAG,OAAO,GAAG,eAAe;;ACJnF,MAAMA,gBAAc,OAAO;AAE3B,IAAM,mBAAN,cAA+BA,cAAiE,CAAC,CAC/F,oBACA,EAAE,SAAS,OAAO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