@r_masseater/i68 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-J9_4mtbE.mjs → app-D-q1EAoS.mjs} +2 -2
- package/dist/{app-J9_4mtbE.mjs.map → app-D-q1EAoS.mjs.map} +1 -1
- package/dist/cli-5PPi51Wt.mjs +20 -0
- package/dist/cli-5PPi51Wt.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/habits.mjs +1 -1
- package/dist/{index-DB7buWb9.d.mts → index-BquoJKM1.d.mts} +9 -3
- package/dist/{index-5D8Rm7JG.d.mts → index-C0eZzNJG.d.mts} +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{mix-facts-CvX18d2q.mjs → mix-facts-fJHVIUfj.mjs} +4 -3
- package/dist/mix-facts-fJHVIUfj.mjs.map +1 -0
- package/dist/presets.d.mts +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{section-C9JQ1-aJ.mjs → section-C_cbbf7V.mjs} +58 -20
- package/dist/section-C_cbbf7V.mjs.map +1 -0
- package/dist/vite.d.mts +1 -1
- package/package.json +4 -5
- package/skills/lint-songs/SKILL.md +0 -1
- package/skills/use-i68-presets/SKILL.md +0 -1
- package/dist/cli-CzV_7HHU.mjs +0 -15
- package/dist/cli-CzV_7HHU.mjs.map +0 -1
- package/dist/mix-facts-CvX18d2q.mjs.map +0 -1
- package/dist/section-C9JQ1-aJ.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./section-
|
|
1
|
+
import "./section-C_cbbf7V.mjs";
|
|
2
2
|
// src/entities/rule/model/define.ts
|
|
3
3
|
const defineRule = (rule) => rule;
|
|
4
4
|
const definePlugin = (plugin) => plugin;
|
|
5
5
|
export { defineRule as n, definePlugin as t };
|
|
6
6
|
|
|
7
|
-
//# sourceMappingURL=app-
|
|
7
|
+
//# sourceMappingURL=app-D-q1EAoS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-
|
|
1
|
+
{"version":3,"file":"app-D-q1EAoS.mjs","names":[],"sources":["../src/entities/rule/model/define.ts"],"sourcesContent":["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"],"mappings":";;AAEA,MAAa,cAAc,SAAqB;AAEhD,MAAa,gBAAgB,WAA2B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { c as runCli$1, n as songPathspecs, o as failedWith, r as lint, s as formatDiagnostic, t as i68Section } from "./section-C_cbbf7V.mjs";
|
|
2
|
+
// package.json
|
|
3
|
+
var version = "0.2.1";
|
|
4
|
+
var description = "A linter for .fumx songs that checks musical rules such as notes outside the key, part ranges, voicing clashes and parallel fifths, configured from vite.config.ts with rules written in TypeScript.";
|
|
5
|
+
// src/app/cli.ts
|
|
6
|
+
const runCli = () => {
|
|
7
|
+
runCli$1({
|
|
8
|
+
name: "i68",
|
|
9
|
+
version,
|
|
10
|
+
description,
|
|
11
|
+
section: i68Section,
|
|
12
|
+
pathspecs: songPathspecs,
|
|
13
|
+
lint,
|
|
14
|
+
format: formatDiagnostic,
|
|
15
|
+
failWith: failedWith
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { runCli };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=cli-5PPi51Wt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-5PPi51Wt.mjs","names":["manifest.version","manifest.description"],"sources":["../package.json","../src/app/cli.ts"],"sourcesContent":["","import { formatDiagnostic, runCli as runLinter } from \"@masseater.dev/lint-host\";\nimport manifest from \"@r_masseater/i68/package.json\" with { type: \"json\" };\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { lint } from \"./lint.ts\";\nimport { i68Section, songPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"i68\",\n version: manifest.version,\n description: manifest.description,\n section: i68Section,\n pathspecs: songPathspecs,\n lint,\n format: formatDiagnostic,\n failWith: failedWith,\n });\n};\n"],"mappings":";;;;;ACQA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACGA;EACIC;EACb,SAAS;EACT,WAAW;EACX;EACA,QAAQ;EACR,UAAU;CACZ,CAAC;AACH"}
|
package/dist/cli.mjs
CHANGED
package/dist/habits.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StyleRulesSchema, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, i as HABIT_KINDS, l as StyleTableSchema, o as SubjectSchema, s as subjectKeyOf, t as mixFactsOf, u as longestContext } from "./mix-facts-
|
|
1
|
+
import { a as StyleRulesSchema, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, i as HABIT_KINDS, l as StyleTableSchema, o as SubjectSchema, s as subjectKeyOf, t as mixFactsOf, u as longestContext } from "./mix-facts-fJHVIUfj.mjs";
|
|
2
2
|
import { Array, Effect, Number, Option, Order, Record, Schema, String, pipe } from "effect";
|
|
3
3
|
import { readSong } from "@r_masseater/song-format";
|
|
4
4
|
import { soundingsOf } from "@r_masseater/song-format/analysis";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { Effect, FileSystem, Option, Path } from "effect";
|
|
1
|
+
import { Effect, FileSystem, Option, Path, Schema } from "effect";
|
|
2
2
|
import { Song } from "@r_masseater/song-format";
|
|
3
3
|
import { Sounding } from "@r_masseater/song-format/analysis";
|
|
4
4
|
type Severity = "off" | "warn" | "error";
|
|
5
5
|
type RuleOptions = Readonly<Record<string, unknown>>;
|
|
6
6
|
type RuleEntry = Severity | readonly [Severity] | readonly [Severity, RuleOptions];
|
|
7
|
+
declare const NotUtf8Error_base: Schema.Class<NotUtf8Error, Schema.TaggedStruct<"NotUtf8Error", {
|
|
8
|
+
readonly path: Schema.String;
|
|
9
|
+
}>, import("effect/Cause").YieldableError & {
|
|
10
|
+
readonly brand: unique symbol;
|
|
11
|
+
}>;
|
|
12
|
+
declare class NotUtf8Error extends NotUtf8Error_base {}
|
|
7
13
|
interface PathspecRequest<Config> {
|
|
8
14
|
readonly config: Config;
|
|
9
15
|
readonly patterns?: readonly string[];
|
|
@@ -45,5 +51,5 @@ interface Diagnostic {
|
|
|
45
51
|
readonly detail?: string;
|
|
46
52
|
readonly severity: Exclude<Severity, "off">;
|
|
47
53
|
}
|
|
48
|
-
export { Rule as a,
|
|
49
|
-
//# sourceMappingURL=index-
|
|
54
|
+
export { Rule as a, NotUtf8Error as c, Severity as d, Report as i, RuleEntry as l, I68Config as n, RuleContext as o, Plugin as r, PathspecRequest as s, Diagnostic as t, RuleOptions as u };
|
|
55
|
+
//# sourceMappingURL=index-BquoJKM1.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Rule, n as I68Config, r as Plugin, s as PathspecRequest, t as Diagnostic } from "./index-
|
|
1
|
+
import { a as Rule, c as NotUtf8Error, n as I68Config, r as Plugin, s as PathspecRequest, t as Diagnostic } from "./index-BquoJKM1.mjs";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
import "@r_masseater/song-format";
|
|
4
4
|
interface Reportable {
|
|
@@ -23,7 +23,7 @@ declare const I68Error_base: Schema.Class<I68Error, Schema.TaggedStruct<"I68Erro
|
|
|
23
23
|
readonly brand: unique symbol;
|
|
24
24
|
}>;
|
|
25
25
|
declare class I68Error extends I68Error_base {}
|
|
26
|
-
type Read = (path: string) => Effect.Effect<string, I68Error>;
|
|
26
|
+
type Read = (path: string) => Effect.Effect<string, I68Error | NotUtf8Error>;
|
|
27
27
|
interface LintInput {
|
|
28
28
|
readonly root: string;
|
|
29
29
|
readonly files: readonly string[];
|
|
@@ -45,4 +45,4 @@ declare const songPathspecs: ({ config, patterns }: {
|
|
|
45
45
|
readonly patterns?: readonly string[];
|
|
46
46
|
}) => readonly string[];
|
|
47
47
|
export { TextInput as a, Read as c, defineRule as d, formatDiagnostic as f, LintInput as i, I68Error as l, i68Section as n, lint as o, songPathspecs as r, lintText as s, PathspecInput as t, definePlugin as u };
|
|
48
|
-
//# sourceMappingURL=index-
|
|
48
|
+
//# sourceMappingURL=index-C0eZzNJG.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as Rule,
|
|
2
|
-
import { a as TextInput, c as Read, d as defineRule, f as formatDiagnostic, i as LintInput, l as I68Error, n as i68Section, o as lint, r as songPathspecs, s as lintText, t as PathspecInput, u as definePlugin } from "./index-
|
|
1
|
+
import { a as Rule, d as Severity, i as Report, l as RuleEntry, n as I68Config, o as RuleContext, r as Plugin, t as Diagnostic, u as RuleOptions } from "./index-BquoJKM1.mjs";
|
|
2
|
+
import { a as TextInput, c as Read, d as defineRule, f as formatDiagnostic, i as LintInput, l as I68Error, n as i68Section, o as lint, r as songPathspecs, s as lintText, t as PathspecInput, u as definePlugin } from "./index-C0eZzNJG.mjs";
|
|
3
3
|
export { type Diagnostic, type I68Config, I68Error, type LintInput, type PathspecInput, type Plugin, type Read, type Report, type Rule, type RuleContext, type RuleEntry, type RuleOptions, type Severity, type TextInput, definePlugin, defineRule, formatDiagnostic as format, i68Section, lint, lintText, songPathspecs };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as defineRule, t as definePlugin } from "./app-
|
|
2
|
-
import { a as I68Error, i as lintText, n as songPathspecs, r as lint, s as formatDiagnostic, t as i68Section } from "./section-
|
|
1
|
+
import { n as defineRule, t as definePlugin } from "./app-D-q1EAoS.mjs";
|
|
2
|
+
import { a as I68Error, i as lintText, n as songPathspecs, r as lint, s as formatDiagnostic, t as i68Section } from "./section-C_cbbf7V.mjs";
|
|
3
3
|
export { I68Error, definePlugin, defineRule, formatDiagnostic as format, i68Section, lint, lintText, songPathspecs };
|
|
@@ -34,10 +34,11 @@ const reporterOf = (context) => {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
const
|
|
37
|
+
const groupedBy = (soundings, key) => Record.values(Array.groupBy(soundings, key));
|
|
38
|
+
const tracksOf = (soundings) => pipe(groupedBy(soundings, (sounding) => sounding.track), Array.map(sortByStart));
|
|
38
39
|
const soundingAt = (soundings) => (tick) => pipe(soundings, Array.filter((sounding) => sounding.start <= tick && tick < sounding.end));
|
|
39
40
|
const byOnset = Order.mapInput(byStart, (group) => Array.headNonEmpty(group));
|
|
40
|
-
const onsetsOf = (soundings) =>
|
|
41
|
+
const onsetsOf = (soundings) => Array.sort(groupedBy(soundings, (sounding) => String(sounding.start)), byOnset);
|
|
41
42
|
const topLineOf = (soundings) => pipe(onsetsOf(soundings), Array.map(highest));
|
|
42
43
|
const neighborsOf = (values) => Array.zip(values, Array.drop(values, 1));
|
|
43
44
|
// src/app/presets/shared/lib/pitch.ts
|
|
@@ -6994,4 +6995,4 @@ const mixFactsOf = (soundings) => (song) => {
|
|
|
6994
6995
|
};
|
|
6995
6996
|
export { tracksOf as A, neighborsOf as C, sortByPitch as D, reporterOf as E, soundingAt as O, lowest as S, overlappingPairs as T, pitchClassOf as _, StyleRulesSchema as a, highest as b, mixKeyOf as c, bach_chorales_default as d, progressionOf as f, nameOf as g, midiOf as h, HABIT_KINDS as i, topLineOf as k, StyleTableSchema as l, keysOf as m, placeIn as n, SubjectSchema as o, keyAt as p, trackKeyOf as r, subjectKeyOf as s, mixFactsOf as t, longestContext as u, MELODIC as v, onsetsOf as w, isPitched as x, hasRole as y };
|
|
6996
6997
|
|
|
6997
|
-
//# sourceMappingURL=mix-facts-
|
|
6998
|
+
//# sourceMappingURL=mix-facts-fJHVIUfj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mix-facts-fJHVIUfj.mjs","names":["Arr","Rec","Arr","Str","Arr","Str","Rec","FIRST","Arr","Arr","Rec","Num","Str","Arr"],"sources":["../src/app/presets/shared/lib/voices.ts","../src/app/presets/shared/lib/pitch.ts","../src/app/presets/shared/lib/keys.ts","../src/app/presets/shared/lib/degrees.ts","../src/app/presets/features/check-style/data/bach-chorales.json","../src/app/presets/shared/lib/style-table.ts","../src/app/presets/shared/lib/mix-habit.ts","../src/app/presets/shared/lib/style-rules.ts","../src/app/presets/shared/lib/mix-facts.ts"],"sourcesContent":["import type { Role } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport { overlapOf } from \"@r_masseater/song-format/analysis\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Report, RuleContext } from \"#/shared/config/index.ts\";\n\nconst SIXTEENTHS_PER_WHOLE = 16;\nconst SIXTEENTH = TICKS_PER_WHOLE / SIXTEENTHS_PER_WHOLE;\n\nexport const MELODIC: readonly Role[] = [\"melody\", \"countermelody\"];\n\nexport const hasRole =\n (roles: readonly Role[]) =>\n (sounding: Sounding): boolean =>\n Option.exists(sounding.role, (role) => Arr.contains(roles, role));\n\nexport const isPitched = (sounding: Sounding): boolean =>\n !Option.exists(sounding.role, (role) => role === \"drums\");\n\nconst byStart = Order.mapInput(Order.Number, (sounding: Sounding) => sounding.start);\n\nconst byPitch = Order.mapInput(Order.Number, (sounding: Sounding) => sounding.midi);\n\nexport const sortByStart = (soundings: readonly Sounding[]): readonly Sounding[] =>\n Arr.sort(soundings, byStart);\n\nexport const sortByPitch = (soundings: readonly Sounding[]): readonly Sounding[] =>\n Arr.sort(soundings, byPitch);\n\nexport const highest = (soundings: Arr.NonEmptyReadonlyArray<Sounding>): Sounding =>\n Arr.max(soundings, byPitch);\n\nexport const lowest = (soundings: Arr.NonEmptyReadonlyArray<Sounding>): Sounding =>\n Arr.min(soundings, byPitch);\n\nexport type Pair = readonly [Sounding, Sounding];\n\nconst stillSounding =\n (sounding: Sounding) =>\n (active: Sounding): boolean =>\n active.end > sounding.start;\n\nconst heldTogether =\n (sounding: Sounding) =>\n (other: Sounding): boolean =>\n overlapOf(other)(sounding) >= SIXTEENTH;\n\nexport const overlappingPairs = (soundings: readonly Sounding[]): readonly Pair[] => {\n const pairs: Pair[] = [];\n let active: readonly Sounding[] = [];\n for (const sounding of sortByStart(soundings)) {\n active = pipe(active, Arr.filter(stillSounding(sounding)));\n for (const other of pipe(active, Arr.filter(heldTogether(sounding)))) {\n pairs.push([other, sounding]);\n }\n active = [...active, sounding];\n }\n return pairs;\n};\n\nexport type Reporter = (key: string, report: Report) => void;\n\nexport const reporterOf = (context: RuleContext): Reporter => {\n const seen = new Set<string>();\n return (key, report) => {\n if (!seen.has(key)) {\n seen.add(key);\n context.report(report);\n }\n };\n};\n\nconst groupedBy = (\n soundings: readonly Sounding[],\n key: (sounding: Sounding) => string,\n): readonly Arr.NonEmptyReadonlyArray<Sounding>[] => Rec.values(Arr.groupBy(soundings, key));\n\nexport const tracksOf = (soundings: readonly Sounding[]): readonly (readonly Sounding[])[] =>\n pipe(\n groupedBy(soundings, (sounding) => sounding.track),\n Arr.map(sortByStart),\n );\n\nexport const soundingAt =\n (soundings: readonly Sounding[]) =>\n (tick: number): readonly Sounding[] =>\n pipe(\n soundings,\n Arr.filter((sounding) => sounding.start <= tick && tick < sounding.end),\n );\n\nexport type Onset = Arr.NonEmptyReadonlyArray<Sounding>;\n\nconst byOnset = Order.mapInput(byStart, (group: Onset) => Arr.headNonEmpty(group));\n\nexport const onsetsOf = (soundings: readonly Sounding[]): readonly Onset[] =>\n Arr.sort(\n groupedBy(soundings, (sounding) => String(sounding.start)),\n byOnset,\n );\n\nexport const topLineOf = (soundings: readonly Sounding[]): readonly Sounding[] =>\n pipe(onsetsOf(soundings), Arr.map(highest));\n\nexport const NEXT = 1;\n\nexport const neighborsOf = <Value>(\n values: readonly Value[],\n): readonly (readonly [Value, Value])[] => Arr.zip(values, Arr.drop(values, NEXT));\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nconst NAMES = [\"C\", \"C#\", \"D\", \"Eb\", \"E\", \"F\", \"F#\", \"G\", \"Ab\", \"A\", \"Bb\", \"B\"];\nconst PITCH = /^(?<letter>[A-G])(?<accidental>##|#|bb|b)?(?<octave>-?\\d+)$/u;\nconst OCTAVE = 12;\nconst OCTAVE_OFFSET = 1;\nconst SHARP = \"#\";\nconst FLAT = \"b\";\n\nexport const pitchClassOf = (midi: number): number => ((midi % OCTAVE) + OCTAVE) % OCTAVE;\n\nexport const nameOf = (midi: number): string =>\n `${Option.getOrElse(Arr.get(NAMES, pitchClassOf(midi)), () => \"?\")}${String(Math.floor(midi / OCTAVE) - OCTAVE_OFFSET)}`;\n\nconst countOf =\n (mark: string) =>\n (text: string): number =>\n pipe(\n Str.split(text, \"\"),\n Arr.filter((character) => character === mark),\n ).length;\n\ninterface PitchParts {\n readonly letter: string;\n readonly accidental: string;\n readonly octave: string;\n}\n\nconst partsOf = (name: string): Option.Option<PitchParts> =>\n pipe(\n Option.fromNullishOr(PITCH.exec(name)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n Option.flatMap((groups) =>\n Option.all({\n letter: Option.fromNullishOr(groups[\"letter\"]),\n accidental: Option.some(groups[\"accidental\"] ?? \"\"),\n octave: Option.fromNullishOr(groups[\"octave\"]),\n }),\n ),\n );\n\nexport const midiOf = (name: string): Option.Option<number> =>\n pipe(\n partsOf(name),\n Option.flatMap((parts) =>\n pipe(\n Arr.findFirstIndex(NAMES, (candidate) => candidate === parts.letter),\n Option.map(\n (letter) =>\n (Number(parts.octave) + OCTAVE_OFFSET) * OCTAVE +\n letter +\n countOf(SHARP)(parts.accidental) -\n countOf(FLAT)(parts.accidental),\n ),\n ),\n ),\n );\n","import type { Bar, Song } from \"@r_masseater/song-format\";\nimport { keyIn } from \"@r_masseater/song-format/analysis\";\nimport type { BarRange, KeySpan } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nconst UNLABELED = \"#song\";\n\ninterface Labeled {\n readonly bar: Bar;\n readonly label: string;\n}\n\nconst labeled = (bars: readonly Bar[]): readonly Labeled[] =>\n Arr.reduce(bars, Arr.empty<Labeled>(), (done, bar) => {\n const carried = pipe(\n Arr.last(done),\n Option.filter((previous) => !Str.startsWith(\"#\")(previous.label)),\n Option.map((previous) => previous.label),\n );\n const label = pipe(\n bar.section,\n Option.orElse(() => carried),\n Option.getOrElse(() => UNLABELED),\n );\n return Arr.append(done, { bar, label });\n });\n\nconst rangesOf = (song: Song): readonly BarRange[] =>\n pipe(\n Arr.match(labeled(song.bars), {\n onEmpty: (): readonly Arr.NonEmptyReadonlyArray<Labeled>[] => [],\n onNonEmpty: (bars) => Arr.groupWith(bars, (left, right) => left.label === right.label),\n }),\n Arr.map(Arr.map(({ bar }) => bar)),\n Arr.map((bars) => ({\n fromBar: Arr.headNonEmpty(bars).index,\n toBar: Arr.lastNonEmpty(bars).index,\n })),\n );\n\nexport const keysOf = (song: Song): readonly KeySpan[] =>\n pipe(rangesOf(song), Arr.map(keyIn(song)), Arr.getSomes);\n\nexport const keyAt =\n (keys: readonly KeySpan[]) =>\n (bar: number): Option.Option<KeySpan> =>\n pipe(\n keys,\n Arr.findFirst((span) => span.fromBar <= bar && bar <= span.toBar),\n );\n","import type { Song } from \"@r_masseater/song-format\";\nimport { chordsOf } from \"@r_masseater/song-format/analysis\";\nimport type { ChordSpan, KeySpan, Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\nimport { Chord, Note } from \"tonal\";\n\nimport { keyAt, keysOf } from \"./keys.ts\";\nimport { pitchClassOf } from \"./pitch.ts\";\nimport { isPitched, sortByStart } from \"./voices.ts\";\n\nconst DEGREES = {\n first: \"I\",\n flatSecond: \"bII\",\n second: \"II\",\n flatThird: \"bIII\",\n third: \"III\",\n fourth: \"IV\",\n raisedFourth: \"#IV\",\n fifth: \"V\",\n flatSixth: \"bVI\",\n sixth: \"VI\",\n flatSeventh: \"bVII\",\n seventh: \"VII\",\n};\nconst DEGREE_NAMES = Rec.values(DEGREES);\n\nconst SEVENTHS: Readonly<Record<string, string>> = {\n \"dominant seventh\": \"7\",\n \"major seventh\": \"M7\",\n \"minor seventh\": \"m7\",\n \"half-diminished\": \"m7b5\",\n \"diminished seventh\": \"dim7\",\n};\n\nconst TRIADS: Readonly<Record<string, string>> = {\n Major: \"\",\n Minor: \"m\",\n Diminished: \"dim\",\n Augmented: \"aug\",\n};\n\nconst RELATIVE_MAJOR = 3;\nconst FIRST = 1;\n\nexport interface Step {\n readonly token: string;\n readonly bar: number;\n readonly line: number;\n readonly column: number;\n}\n\nconst kindOf = (type: string, quality: string): Option.Option<string> =>\n pipe(\n Rec.get(SEVENTHS, type),\n Option.orElse(() => Rec.get(TRIADS, quality)),\n );\n\nconst majorTonicOf = (key: Pick<KeySpan, \"mode\" | \"pitchClass\">): number => {\n if (key.mode === \"minor\") {\n return key.pitchClass + RELATIVE_MAJOR;\n }\n return key.pitchClass;\n};\n\nexport interface ReadChord {\n readonly chroma: number;\n readonly kind: string;\n}\n\nexport const chordOf = (symbol: string): Option.Option<ReadChord> => {\n const chord = Chord.get(symbol);\n return Option.flatMap(Option.fromNullishOr(Note.chroma(chord.tonic ?? \"\")), (chroma) =>\n Option.map(kindOf(chord.type, chord.quality), (kind) => ({ chroma, kind })),\n );\n};\n\nexport const degreeOf =\n (key: Pick<KeySpan, \"mode\" | \"pitchClass\">) =>\n (chord: ReadChord): Option.Option<string> => {\n const pitchClass = pitchClassOf(chord.chroma - majorTonicOf(key));\n return pipe(\n Arr.get(DEGREE_NAMES, pitchClass),\n Option.map((degree) => `${degree}${chord.kind}`),\n );\n };\n\nexport const tokenOf =\n (key: Pick<KeySpan, \"mode\" | \"pitchClass\">) =>\n (symbol: string): Option.Option<string> =>\n Option.flatMap(chordOf(symbol), degreeOf(key));\n\nconst placeOf =\n (soundings: readonly Sounding[]) =>\n (tick: number): Option.Option<Sounding> =>\n pipe(\n soundings,\n Arr.findFirst((sounding) => sounding.start >= tick),\n );\n\nconst stepOf =\n (keys: readonly KeySpan[], place: (tick: number) => Option.Option<Sounding>) =>\n (span: ChordSpan): Option.Option<Step> =>\n pipe(\n keyAt(keys)(span.from.bar),\n Option.flatMap((key) => tokenOf(key)(span.symbol)),\n Option.flatMap((token) =>\n Option.map(place(span.start), (sounding) => ({\n token,\n bar: span.from.bar,\n line: sounding.line,\n column: sounding.column,\n })),\n ),\n );\n\nconst isNewChord = (step: Step, index: number, steps: readonly Step[]): boolean =>\n !pipe(\n Arr.get(steps, index - FIRST),\n Option.exists((previous) => previous.token === step.token),\n );\n\nexport const progressionOf =\n (soundings: readonly Sounding[]) =>\n (song: Song): readonly Step[] => {\n const pitched = pipe(soundings, Arr.filter(isPitched));\n const step = stepOf(keysOf(song), placeOf(sortByStart(pitched)));\n const steps = pipe(chordsOf(song), Arr.map(step), Arr.getSomes);\n return pipe(\n steps,\n Arr.filter((each, index) => isNewChord(each, index, steps)),\n );\n };\n","","import { Array as Arr, Number as Num, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport type { Step } from \"./degrees.ts\";\n\nexport const StyleTableSchema = Schema.Struct({\n name: Schema.String,\n source: Schema.String,\n order: Schema.Int,\n transitions: Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Int)),\n});\n\nexport type StyleTable = typeof StyleTableSchema.Type;\n\nexport type Transitions = StyleTable[\"transitions\"];\n\nexport interface Context {\n readonly words: string;\n readonly next: Readonly<Record<string, number>>;\n readonly total: number;\n}\n\nconst FIRST = 1;\n\nconst contextOf =\n (table: StyleTable, seen: number, before: readonly Step[]) =>\n (length: number): Option.Option<Context> => {\n const words = pipe(\n Arr.takeRight(before, length),\n Arr.map((step) => step.token),\n Arr.join(\" \"),\n );\n return pipe(\n Rec.get(table.transitions, words),\n Option.map((next) => ({ words, next, total: Num.sumAll(Rec.values(next)) })),\n Option.filter((context) => context.total >= seen),\n );\n };\n\nexport interface Judge {\n readonly table: StyleTable;\n readonly seen: number;\n}\n\nexport const longestContext =\n ({ table, seen }: Judge) =>\n (before: readonly Step[]): Option.Option<Context> =>\n pipe(\n Arr.range(FIRST, Math.min(table.order, before.length)),\n Arr.reverse,\n Arr.findFirst(contextOf(table, seen, before)),\n );\n","import { MIXER_PARAMETERS } from \"@r_masseater/song-format\";\nimport { Match, Schema } from \"effect\";\n\nconst Track = Schema.String;\n\nexport const MoveSchema = Schema.Struct({\n type: Schema.Literal(\"move\"),\n track: Track,\n parameter: Schema.Literals(MIXER_PARAMETERS),\n direction: Schema.Literals([\"up\", \"down\"]),\n edge: Schema.Literals([\"before\", \"after\"]),\n});\n\nexport const LevelSchema = Schema.Struct({\n type: Schema.Literal(\"level\"),\n track: Track,\n decibels: Schema.Finite,\n});\n\nexport const PanSchema = Schema.Struct({\n type: Schema.Literal(\"pan\"),\n track: Track,\n pan: Schema.Finite,\n});\n\nexport const SendSchema = Schema.Struct({\n type: Schema.Literal(\"send\"),\n track: Track,\n bus: Schema.String,\n amount: Schema.Finite,\n});\n\nexport const MixHabitSchema = Schema.Union([MoveSchema, LevelSchema, PanSchema, SendSchema]);\n\nexport type MixHabit = typeof MixHabitSchema.Type;\n\nconst PERCENT = 100;\n\nconst percentOf = (share: number): string => `${String(Math.round(share * PERCENT))}%`;\n\nconst ARROWS = { up: \"↑\", down: \"↓\" } as const;\n\nexport const mixKeyOf: (habit: MixHabit) => string = Match.type<MixHabit>().pipe(\n Match.discriminatorsExhaustive(\"type\")({\n move: (move) =>\n `${move.track} ${move.parameter} ${ARROWS[move.direction]} ${move.edge} section`,\n level: (level) => `${level.track} volume ${String(level.decibels)}dB from loudest`,\n pan: (pan) => `${pan.track} pan ${percentOf(pan.pan)}`,\n send: (send) => `${send.track} send ${send.bus} ${percentOf(send.amount)}`,\n }),\n);\n","import { Match, Schema } from \"effect\";\n\nimport { MixHabitSchema, mixKeyOf } from \"./mix-habit.ts\";\n\nexport const HABIT_KINDS = [\"keep\", \"fix\", \"suggest\"] as const;\n\nexport type HabitKind = (typeof HABIT_KINDS)[number];\n\nexport const ChordHabitSchema = Schema.Struct({\n type: Schema.Literal(\"chord\"),\n context: Schema.String,\n next: Schema.String,\n});\n\nexport const SubjectSchema = Schema.Union([ChordHabitSchema, MixHabitSchema]);\n\nexport type Subject = typeof SubjectSchema.Type;\n\nexport const HabitRuleSchema = Schema.Struct({\n habit: SubjectSchema,\n kind: Schema.Literals(HABIT_KINDS),\n aim: Schema.String,\n reason: Schema.optionalKey(Schema.String),\n});\n\nexport type HabitRule = typeof HabitRuleSchema.Type;\n\nexport const StyleRulesSchema = Schema.Struct({\n name: Schema.String,\n habits: Schema.Array(HabitRuleSchema),\n});\n\nexport type StyleRules = typeof StyleRulesSchema.Type;\n\nexport const subjectKeyOf = (subject: Subject): string =>\n Match.value(subject).pipe(\n Match.when({ type: \"chord\" }, (chord) => `${chord.context} → ${chord.next}`),\n Match.orElse(mixKeyOf),\n );\n","import { MIXER_PARAMETERS } from \"@r_masseater/song-format\";\nimport type { MixerParameter, Song } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { MixHabit } from \"./mix-habit.ts\";\n\nconst DECIBEL_STEP = 3;\nconst PAN_STEPS = 4;\nconst SEND_STEPS = 10;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst COPY = /-\\d+$/u;\n\nexport interface MixPlace {\n readonly bar: number;\n readonly line: number;\n readonly column: number;\n}\n\nexport interface MixFact {\n readonly habit: MixHabit;\n readonly place: MixPlace;\n}\n\ntype Track = Song[\"tracks\"][number];\n\nexport const trackKeyOf = (name: string): string => Str.replace(COPY, \"\")(name);\n\nconst stepped =\n (steps: number) =>\n (value: number): number =>\n Math.round(value * steps) / steps;\n\nconst decibelsStepped = (decibels: number): number =>\n Math.round(decibels / DECIBEL_STEP) * DECIBEL_STEP;\n\nexport const placeIn =\n (soundings: readonly Sounding[]) =>\n ({ track, bar }: Readonly<{ track: string; bar: number }>): MixPlace =>\n pipe(\n soundings,\n Arr.findFirst((sounding) => sounding.track === track && sounding.bar >= bar),\n Option.match({\n onNone: () => ({ bar, line: FIRST_LINE, column: FIRST_COLUMN }),\n onSome: (sounding) => ({ bar, line: sounding.line, column: sounding.column }),\n }),\n );\n\nconst loudestOf = (tracks: readonly Track[]): number =>\n Math.max(\n ...pipe(\n tracks,\n Arr.map((track) => track.mixer.volumeDecibels),\n ),\n );\n\nconst levelHabitsOf =\n (tracks: readonly Track[]) =>\n (track: Track): readonly MixHabit[] => [\n {\n type: \"level\",\n track: trackKeyOf(track.name),\n decibels: decibelsStepped(track.mixer.volumeDecibels - loudestOf(tracks)),\n },\n { type: \"pan\", track: trackKeyOf(track.name), pan: stepped(PAN_STEPS)(track.mixer.pan) },\n ...pipe(\n track.sends,\n Arr.map((send): MixHabit => ({\n type: \"send\",\n track: trackKeyOf(track.name),\n bus: trackKeyOf(send.bus),\n amount: stepped(SEND_STEPS)(send.amount),\n })),\n ),\n ];\n\nconst sectionStartsOf = (song: Song): readonly number[] =>\n pipe(\n song.bars,\n Arr.drop(FIRST_LINE),\n Arr.filter((bar) => Option.isSome(bar.section) || Option.isSome(bar.mark)),\n Arr.map((bar) => bar.index),\n );\n\ntype Automation = Song[\"automations\"][number];\n\nconst isMove = (\n automation: Automation,\n): automation is Automation & {\n readonly parameter: MixerParameter;\n} => Arr.contains(MIXER_PARAMETERS, automation.parameter);\n\nconst directionOf = (automation: Automation): \"up\" | \"down\" => {\n if (automation.to.value > automation.from.value) {\n return \"up\";\n }\n return \"down\";\n};\n\ntype Moved = Readonly<{ habit: MixHabit; bar: number; target: string }>;\n\nconst movesOf =\n (starts: readonly number[]) =>\n (automation: Automation): readonly Moved[] => {\n if (!isMove(automation) || automation.from.value === automation.to.value) {\n return [];\n }\n const direction = directionOf(automation);\n const end = automation.bar + automation.bars;\n const base = {\n type: \"move\" as const,\n track: trackKeyOf(automation.target),\n parameter: automation.parameter,\n direction,\n };\n return [\n ...pipe(\n starts,\n Arr.filter((start) => start === end),\n Arr.map((start) => ({\n habit: { ...base, edge: \"before\" as const },\n bar: start,\n target: automation.target,\n })),\n ),\n ...pipe(\n starts,\n Arr.filter((start) => start === automation.bar),\n Arr.map((start) => ({\n habit: { ...base, edge: \"after\" as const },\n bar: start,\n target: automation.target,\n })),\n ),\n ];\n };\n\nexport const mixFactsOf =\n (soundings: readonly Sounding[]) =>\n (song: Song): readonly MixFact[] => {\n const place = placeIn(soundings);\n const firstBar = pipe(\n Arr.head(song.bars),\n Option.match({ onNone: () => FIRST_LINE, onSome: (bar) => bar.index }),\n );\n const moves = movesOf(sectionStartsOf(song));\n return [\n ...pipe(\n song.tracks,\n Arr.flatMap((track) =>\n pipe(\n levelHabitsOf(song.tracks)(track),\n Arr.map((habit) => ({ habit, place: place({ track: track.name, bar: firstBar }) })),\n ),\n ),\n ),\n ...pipe(\n song.automations,\n Arr.flatMap(moves),\n Arr.map(({ habit, bar, target }) => ({ habit, place: place({ track: target, bar }) })),\n ),\n ];\n };\n"],"mappings":";;;;;AASA,MAAM,YAAY,kBAAkB;AAEpC,MAAa,UAA2B,CAAC,UAAU,eAAe;AAElE,MAAa,WACV,WACA,aACC,OAAO,OAAO,SAAS,OAAO,SAASA,MAAI,SAAS,OAAO,IAAI,CAAC;AAEpE,MAAa,aAAa,aACxB,CAAC,OAAO,OAAO,SAAS,OAAO,SAAS,SAAS,OAAO;AAE1D,MAAM,UAAU,MAAM,SAAS,MAAM,SAAS,aAAuB,SAAS,KAAK;AAEnF,MAAM,UAAU,MAAM,SAAS,MAAM,SAAS,aAAuB,SAAS,IAAI;AAElF,MAAa,eAAe,cAC1BA,MAAI,KAAK,WAAW,OAAO;AAE7B,MAAa,eAAe,cAC1BA,MAAI,KAAK,WAAW,OAAO;AAE7B,MAAa,WAAW,cACtBA,MAAI,IAAI,WAAW,OAAO;AAE5B,MAAa,UAAU,cACrBA,MAAI,IAAI,WAAW,OAAO;AAI5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AAM;GAAE,OAAO;GAAQ;EAAI,CAAC;CAAE,EAAE,CACvF,CACF;AACF"}
|
package/dist/presets.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as I68Config, r as Plugin } from "./index-
|
|
1
|
+
import { n as I68Config, r as Plugin } from "./index-BquoJKM1.mjs";
|
|
2
2
|
import { a as StyleRulesSchema, c as subjectKeyOf, d as StyleTable, i as StyleRules, l as MixHabit, n as HabitKind, o as Subject, p as Transitions, r as HabitRule, t as HABIT_KINDS, u as mixKeyOf } from "./style-rules-gR1Cixel.mjs";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-C0eZzNJG.mjs";
|
|
4
4
|
type Range = readonly [string, string];
|
|
5
5
|
type Ranges = Readonly<Record<string, Range>>;
|
|
6
6
|
export declare const DEFAULT_RANGES: Ranges;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as defineRule, t as definePlugin } from "./app-
|
|
2
|
-
import { A as tracksOf, C as neighborsOf, D as sortByPitch, E as reporterOf, O as soundingAt, S as lowest, T as overlappingPairs, _ as pitchClassOf, a as StyleRulesSchema, b as highest, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, g as nameOf, h as midiOf, i as HABIT_KINDS, k as topLineOf, m as keysOf, n as placeIn, p as keyAt, r as trackKeyOf, s as subjectKeyOf, t as mixFactsOf, u as longestContext, v as MELODIC, w as onsetsOf, x as isPitched, y as hasRole } from "./mix-facts-
|
|
1
|
+
import { n as defineRule, t as definePlugin } from "./app-D-q1EAoS.mjs";
|
|
2
|
+
import { A as tracksOf, C as neighborsOf, D as sortByPitch, E as reporterOf, O as soundingAt, S as lowest, T as overlappingPairs, _ as pitchClassOf, a as StyleRulesSchema, b as highest, c as mixKeyOf, d as bach_chorales_default, f as progressionOf, g as nameOf, h as midiOf, i as HABIT_KINDS, k as topLineOf, m as keysOf, n as placeIn, p as keyAt, r as trackKeyOf, s as subjectKeyOf, t as mixFactsOf, u as longestContext, v as MELODIC, w as onsetsOf, x as isPitched, y as hasRole } from "./mix-facts-fJHVIUfj.mjs";
|
|
3
3
|
import { Array, Match, Number, Option, Order, Predicate, Record, String as String$1, pipe } from "effect";
|
|
4
4
|
import { TICKS_PER_WHOLE } from "@r_masseater/song-format";
|
|
5
5
|
import { Chord } from "tonal";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Schema, String as String$1, pipe } from "effect";
|
|
1
|
+
import { Array, Boolean, Console, Effect, FileSystem, Function, Layer, Match, Option, Order, Path, Predicate, Record, Result, Schema, String as String$1, pipe } from "effect";
|
|
2
2
|
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
3
3
|
import { layer } from "@effect/platform-node/NodeServices";
|
|
4
4
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
5
|
+
import { Argument, Command } from "effect/cli";
|
|
5
6
|
import { FetchHttpClient } from "effect/http";
|
|
6
7
|
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
7
8
|
import { resolveConfigFromFile } from "vite-plus";
|
|
@@ -36,8 +37,8 @@ const abiOf = (platform) => Match.value(platform).pipe(Match.when("linux", () =>
|
|
|
36
37
|
const platformTarget = `${process.platform}-${process.arch}${abiOf(process.platform)}`;
|
|
37
38
|
const addonFileOf = (binary) => `${binary}.${platformTarget}.node`;
|
|
38
39
|
// ../lint-host/src/features/build-addon/model/build.ts
|
|
39
|
-
const taggedError$
|
|
40
|
-
var AddonBuildFailed = class extends taggedError$
|
|
40
|
+
const taggedError$2 = Schema.TaggedError;
|
|
41
|
+
var AddonBuildFailed = class extends taggedError$2()("AddonBuildFailed", { message: Schema.String }) {};
|
|
41
42
|
const LIBRARY = {
|
|
42
43
|
linux: (name) => `lib${name}.so`,
|
|
43
44
|
darwin: (name) => `lib${name}.dylib`,
|
|
@@ -69,6 +70,9 @@ Effect.fn("buildAddon")(function* build(options) {
|
|
|
69
70
|
const built = library(String$1.replaceAll("-", "_")(options.crate));
|
|
70
71
|
yield* fileSystem.copyFile(path.join(options.workspaceDir, "target", "release", built), path.join(output, addonFileOf(options.binary)));
|
|
71
72
|
});
|
|
73
|
+
// ../lint-host/src/shared/lib/fail.ts
|
|
74
|
+
const taggedError$1 = Schema.TaggedError;
|
|
75
|
+
var NotUtf8Error = class extends taggedError$1()("NotUtf8Error", { path: Schema.String }) {};
|
|
72
76
|
// ../lint-host/src/features/run-cli/model/cli.ts
|
|
73
77
|
const CONFIG_FILES = [
|
|
74
78
|
"vite.config.ts",
|
|
@@ -78,7 +82,7 @@ const CONFIG_FILES = [
|
|
|
78
82
|
];
|
|
79
83
|
const FAILED = 1;
|
|
80
84
|
const DATA_FIRST_ARITY$1 = 2;
|
|
81
|
-
const
|
|
85
|
+
const STRICT_UTF8 = new TextDecoder("utf-8", { fatal: true });
|
|
82
86
|
const readSectionIn = (source, root) => Effect.gen(function* readConfig() {
|
|
83
87
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
84
88
|
const path = yield* Path.Path;
|
|
@@ -122,12 +126,14 @@ const printAll = (found, format) => Array.match(found, {
|
|
|
122
126
|
const readerIn = (root, failWith) => Effect.gen(function* reader() {
|
|
123
127
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
124
128
|
const path = yield* Path.Path;
|
|
125
|
-
return (file) => fileSystem.
|
|
129
|
+
return (file) => fileSystem.readFile(path.resolve(root, file)).pipe(Effect.mapError(failWith(`could not read ${file}`)), Effect.flatMap((bytes) => Effect.try({
|
|
130
|
+
try: () => STRICT_UTF8.decode(bytes),
|
|
131
|
+
catch: () => NotUtf8Error.make({ path: file })
|
|
132
|
+
})));
|
|
126
133
|
});
|
|
127
|
-
const mainOf = (cli) => Effect.gen(function* main() {
|
|
134
|
+
const mainOf = (cli, patterns) => Effect.gen(function* main() {
|
|
128
135
|
const root = process.cwd();
|
|
129
136
|
const config = yield* readSectionIn(cli, root);
|
|
130
|
-
const patterns = process.argv.slice(ARGUMENTS_START);
|
|
131
137
|
const pathspecs = cli.pathspecs(requestOf(config, patterns));
|
|
132
138
|
const { files, projectFiles } = yield* Effect.all({
|
|
133
139
|
files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),
|
|
@@ -148,8 +154,14 @@ const runTraced = (name, program) => {
|
|
|
148
154
|
const services = Otlp.layerFromConfig({ resource: { serviceName: name } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer), Layer.provideMerge(layer));
|
|
149
155
|
runMain(program.pipe(Effect.provide(services)));
|
|
150
156
|
};
|
|
157
|
+
const variadicOf = ({ name, description }) => Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());
|
|
158
|
+
const pathspecArgument = () => variadicOf({
|
|
159
|
+
name: "pathspec",
|
|
160
|
+
description: "Git pathspecs of the files to lint, in place of the configured ones"
|
|
161
|
+
});
|
|
151
162
|
const runCli = (cli) => {
|
|
152
|
-
|
|
163
|
+
const command = Command.make(cli.name, { pathspecs: pathspecArgument() }, ({ pathspecs }) => mainOf(cli, pathspecs)).pipe(Command.withDescription(cli.description));
|
|
164
|
+
runTraced(cli.name, Command.run(command, { version: cli.version }));
|
|
153
165
|
};
|
|
154
166
|
const present = Function.dual(2, (value, build) => Option.match(value, {
|
|
155
167
|
onNone: () => ({}),
|
|
@@ -184,6 +196,14 @@ const formatDiagnostic = (diagnostic) => {
|
|
|
184
196
|
const column = pipe(Option.fromNullishOr(diagnostic.column), Option.map((value) => `:${String(value)}`), Option.getOrElse(() => ""));
|
|
185
197
|
return `${diagnostic.path}:${String(diagnostic.line)}${column} ${diagnostic.severity} ${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`;
|
|
186
198
|
};
|
|
199
|
+
const notUtf8 = (tool) => (path) => ({
|
|
200
|
+
path,
|
|
201
|
+
line: 1,
|
|
202
|
+
column: 1,
|
|
203
|
+
rule: "utf8",
|
|
204
|
+
message: `The file is not valid UTF-8, so ${tool} cannot read it`,
|
|
205
|
+
severity: "error"
|
|
206
|
+
});
|
|
187
207
|
// ../lint-host/src/shared/lib/section.ts
|
|
188
208
|
const sectionOf = ({ name, fallback, prepare = Function.identity }) => {
|
|
189
209
|
const hasSection = (value) => Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);
|
|
@@ -237,10 +257,10 @@ const isKnownRule = (config) => (id) => pipe(Record.get(config.plugins ?? {}, pl
|
|
|
237
257
|
const unknownRules = (config) => pipe(Record.keys(config.rules ?? {}), Array.filter((id) => !isKnownRule(config)(id)));
|
|
238
258
|
// src/features/read-songs/model/read.ts
|
|
239
259
|
const SEPARATOR = "/";
|
|
260
|
+
const pathOf = (input) => `${input.root}${SEPARATOR}${input.file}`;
|
|
240
261
|
const readSongFile = Effect.fn("i68.read")(function* readSongFile(input) {
|
|
241
|
-
const path = `${input.root}${SEPARATOR}${input.file}`;
|
|
242
262
|
const source = yield* readSong({
|
|
243
|
-
path,
|
|
263
|
+
path: pathOf(input),
|
|
244
264
|
read: input.read
|
|
245
265
|
});
|
|
246
266
|
return {
|
|
@@ -350,20 +370,38 @@ const lintFile = (rules) => (song) => {
|
|
|
350
370
|
rules
|
|
351
371
|
});
|
|
352
372
|
};
|
|
353
|
-
const lint = Effect.fn("i68.lint")(function* lint(input) {
|
|
354
|
-
const rules = yield* rulesOf(input.config);
|
|
355
|
-
const found = yield* Effect.all(pipe(input.files, Array.map((file) => readSongFile({
|
|
356
|
-
root: input.root,
|
|
357
|
-
file,
|
|
358
|
-
read: input.read
|
|
359
|
-
}).pipe(Effect.flatMap(lintFile(rules))))), { concurrency: "unbounded" });
|
|
360
|
-
return sortByPosition(Array.flatten(found));
|
|
361
|
-
});
|
|
362
373
|
const notFound = (path) => Effect.fail(I68Error.make({ message: `could not read ${path}` }));
|
|
363
374
|
const readerOf = (input) => (path) => {
|
|
364
375
|
if (path === input.path) return Effect.succeed(input.text);
|
|
365
376
|
return (input.read ?? notFound)(path);
|
|
366
377
|
};
|
|
378
|
+
const lintTracked = (rules, input) => Effect.fnUntraced(function* lintOne(file) {
|
|
379
|
+
const path = pathOf({
|
|
380
|
+
root: input.root,
|
|
381
|
+
file
|
|
382
|
+
});
|
|
383
|
+
const read = yield* Effect.result(input.read(path));
|
|
384
|
+
if (Result.isFailure(read) && Schema.is(NotUtf8Error)(read.failure)) return [notUtf8("i68")(file)];
|
|
385
|
+
const reader = Result.match(read, {
|
|
386
|
+
onFailure: () => input.read,
|
|
387
|
+
onSuccess: (text) => readerOf({
|
|
388
|
+
path,
|
|
389
|
+
text,
|
|
390
|
+
read: input.read
|
|
391
|
+
})
|
|
392
|
+
});
|
|
393
|
+
const source = yield* readSongFile({
|
|
394
|
+
root: input.root,
|
|
395
|
+
file,
|
|
396
|
+
read: reader
|
|
397
|
+
});
|
|
398
|
+
return yield* lintFile(rules)(source);
|
|
399
|
+
});
|
|
400
|
+
const lint = Effect.fn("i68.lint")(function* lint(input) {
|
|
401
|
+
const rules = yield* rulesOf(input.config);
|
|
402
|
+
const found = yield* Effect.forEach(input.files, lintTracked(rules, input), { concurrency: "unbounded" });
|
|
403
|
+
return sortByPosition(Array.flatten(found));
|
|
404
|
+
});
|
|
367
405
|
const lintText = Effect.fn("i68.lintText")(function* lintText(input) {
|
|
368
406
|
const rules = yield* rulesOf(input.config);
|
|
369
407
|
const source = yield* readSong({
|
|
@@ -385,4 +423,4 @@ const i68Section = sectionOf({
|
|
|
385
423
|
const songPathspecs = pathspecsOf({ defaults: ["*.fumx"] });
|
|
386
424
|
export { I68Error as a, runCli as c, lintText as i, songPathspecs as n, failedWith as o, lint as r, formatDiagnostic as s, i68Section as t };
|
|
387
425
|
|
|
388
|
-
//# sourceMappingURL=section-
|
|
426
|
+
//# sourceMappingURL=section-C_cbbf7V.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-C_cbbf7V.mjs","names":["Arr","Rec","taggedError","Rec","Str","taggedError","DATA_FIRST_ARITY","Arr","Fn","Str","nodeServices","Fn","LINE_START","Bool","Arr","Arr","Rec","Arr","Fn","Arr","Arr","SEPARATOR","Str","rulesOf","Rec","Arr","Str","rulesOf","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/entities/rule/model/severity.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/shared/lib/fail.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../../lint-host/src/shared/lib/layers.ts","../../lint-host/src/shared/lib/diagnostic.ts","../../lint-host/src/shared/lib/section.ts","../src/entities/rule/model/extend.ts","../src/entities/rule/model/resolve.ts","../src/features/read-songs/model/read.ts","../src/shared/lib/errors.ts","../src/features/run-rules/model/suppressions.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Record as Rec, pipe } 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\nconst optionsOf = (entry: RuleEntry): Option.Option<RuleOptions> =>\n Match.value(entry).pipe(\n Match.when(Match.string, () => Option.none()),\n Match.orElse(([, options]) => Option.fromUndefinedOr(options)),\n );\n\nconst overridden = (earlier: RuleEntry, later: RuleEntry): RuleEntry =>\n pipe(\n optionsOf(later),\n Option.orElse(() => optionsOf(earlier)),\n Option.match({\n onNone: () => later,\n onSome: (options): RuleEntry => [settingOf(later).severity, options],\n }),\n );\n\nexport const mergedRules = (\n layers: readonly (Readonly<Record<string, RuleEntry>> | undefined)[],\n): Readonly<Record<string, RuleEntry>> => {\n const merged: Record<string, RuleEntry> = {};\n for (const [name, later] of pipe(\n layers,\n Arr.flatMap((layer) => Rec.toEntries(layer ?? {})),\n )) {\n merged[name] = pipe(\n Rec.get(merged, name),\n Option.match({\n onNone: () => later,\n onSome: (earlier) => overridden(earlier, later),\n }),\n );\n }\n return merged;\n};\n","import { Match } from \"effect\";\n\nimport type { Setting, Severity } from \"./setting.ts\";\n\nexport const reportedSeverity = (setting: Setting): Exclude<Severity, \"off\"> =>\n Match.value(setting.severity).pipe(\n Match.when(\"warn\", (): Exclude<Severity, \"off\"> => \"warn\"),\n Match.orElse((): Exclude<Severity, \"off\"> => \"error\"),\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 { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\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)));\n};\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class NotUtf8Error extends taggedError<NotUtf8Error, { readonly brand: unique symbol }>()(\n \"NotUtf8Error\",\n { path: Schema.String },\n) {}\n\nexport type FailWith<Failure> = (message: string) => (cause: unknown) => Failure;\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport {\n Array as Arr,\n Console,\n Effect,\n FileSystem,\n Function as Fn,\n Layer,\n Option,\n Path,\n Record as Rec,\n String as Str,\n pipe,\n} from \"effect\";\nimport { Argument, Command, Flag } from \"effect/cli\";\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 { NotUtf8Error } from \"#/shared/lib/fail.ts\";\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 STRICT_UTF8 = new TextDecoder(\"utf-8\", { fatal: true });\n\nexport interface Reported {\n readonly severity: string;\n}\n\nexport interface LintCall<Config, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure | NotUtf8Error>;\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 version: string;\n readonly description: 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, Failure>) => Effect.Effect<readonly Found[], Failure>;\n readonly format: (found: Found) => string;\n}\n\nexport interface ToolParameter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface ToolInput {\n readonly flags: ReadonlySet<string>;\n readonly args: readonly string[];\n}\n\nexport interface ToolCall<Config> {\n readonly root: string;\n readonly config: Config;\n readonly input: ToolInput;\n}\n\nexport interface Tool<Config, Found, Failure> extends SectionSource<Config, Failure> {\n readonly flags: readonly ToolParameter[];\n readonly argument: ToolParameter;\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 readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure | NotUtf8Error>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure | NotUtf8Error> =>\n fileSystem.readFile(path.resolve(root, file)).pipe(\n Effect.mapError(failWith(`could not read ${file}`)),\n Effect.flatMap((bytes) =>\n Effect.try({\n try: () => STRICT_UTF8.decode(bytes),\n catch: () => NotUtf8Error.make({ path: file }),\n }),\n ),\n );\n });\n\nconst mainOf = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n patterns: readonly string[],\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 pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\n yield* printAll(found, cli.format);\n yield* failWhen(hasError(found));\n });\n\nconst toolMainOf =\n <Config, Found, Failure>(tool: Tool<Config, Found, Failure>) =>\n (input: ToolInput): 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, input });\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 | Command.Environment>,\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),\n );\n runMain(program.pipe(Effect.provide(services)));\n};\n\nconst variadicOf = ({ name, description }: ToolParameter): Argument.Argument<readonly string[]> =>\n Argument.String(name).pipe(Argument.withDescription(description), Argument.variadic());\n\nconst flagsOf = (flags: readonly ToolParameter[]): Readonly<Record<string, Flag.Flag<boolean>>> =>\n Rec.fromEntries(\n pipe(\n flags,\n Arr.map(({ name, description }) => [\n name,\n Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.withDefault(false)),\n ]),\n ),\n );\n\nconst setFlags = (values: Readonly<Record<string, boolean>>): ReadonlySet<string> =>\n new Set(pipe(values, Rec.filter(Fn.identity), Rec.keys));\n\nexport const runTool = <Config, Found, Failure>(tool: Tool<Config, Found, Failure>): void => {\n const command = Command.make(\n tool.name,\n { args: variadicOf(tool.argument), flags: flagsOf(tool.flags) },\n ({ args, flags }) => toolMainOf(tool)({ args, flags: setFlags(flags) }),\n ).pipe(Command.withDescription(tool.description));\n runTraced(tool.name, Command.run(command, { version: tool.version }));\n};\n\nconst pathspecArgument = (): Argument.Argument<readonly string[]> =>\n variadicOf({\n name: \"pathspec\",\n description: \"Git pathspecs of the files to lint, in place of the configured ones\",\n });\n\nexport const runCli = <Config, Found extends Reported, Failure>(\n cli: Cli<Config, Found, Failure>,\n): void => {\n const command = Command.make(cli.name, { pathspecs: pathspecArgument() }, ({ pathspecs }) =>\n mainOf(cli, pathspecs),\n ).pipe(Command.withDescription(cli.description));\n runTraced(cli.name, Command.run(command, { version: cli.version }));\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 readonly column?: number;\n}\n\nconst LINE_START = 0;\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.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Array as Arr, Record as Rec, pipe } from \"effect\";\n\nexport interface Layer<Plugin, Entry, Override> {\n readonly plugins?: Readonly<Record<string, Plugin>>;\n readonly rules?: Readonly<Record<string, Entry>>;\n readonly ignores?: readonly string[];\n readonly overrides?: readonly Override[];\n}\n\nexport interface Merged<Plugin, Entry, Override> {\n readonly plugins: Readonly<Record<string, Plugin>>;\n readonly rules: Readonly<Record<string, Entry>>;\n readonly ignores: readonly string[];\n readonly overrides: readonly Override[];\n}\n\nexport const mergedRecords = <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\nexport const layersOf = <Config extends { readonly extends?: readonly Config[] }>(\n config: Config,\n): readonly Omit<Config, \"extends\">[] => {\n const { extends: bases = [], ...own } = config;\n return [...pipe(bases, Arr.flatMap(layersOf)), own];\n};\n\nexport const mergedLayers = <Plugin, Entry, Override>(\n layers: readonly Layer<Plugin, Entry, Override>[],\n): Merged<Plugin, Entry, Override> => ({\n plugins: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.plugins),\n ),\n ),\n rules: mergedRecords(\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});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nexport interface Reportable {\n readonly path: string;\n readonly line: number;\n readonly column?: number | undefined;\n readonly rule: string;\n readonly message: string;\n readonly detail?: string | undefined;\n readonly context?: string | undefined;\n readonly severity: string;\n}\n\nexport const diagnosticDetail = (diagnostic: Reportable): 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 formatDiagnostic = (diagnostic: Reportable): 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\nexport interface NotUtf8 {\n readonly path: string;\n readonly line: number;\n readonly column: number;\n readonly rule: string;\n readonly message: string;\n readonly severity: \"error\";\n}\n\nexport const notUtf8 =\n (tool: string) =>\n (path: string): NotUtf8 => ({\n path,\n line: 1,\n column: 1,\n rule: \"utf8\",\n message: `The file is not valid UTF-8, so ${tool} cannot read it`,\n severity: \"error\",\n });\n","import { Array as Arr, Function as Fn, Option, Predicate, pipe } from \"effect\";\n\nexport interface SectionRequest<Config extends object> {\n readonly name: string;\n readonly fallback: Config;\n readonly prepare?: (section: Config) => Config;\n}\n\nexport const sectionOf = <Config extends object>({\n name,\n fallback,\n prepare = Fn.identity,\n}: SectionRequest<Config>): ((config: unknown) => Config) => {\n const hasSection = (value: unknown): value is Readonly<Record<string, Config>> =>\n Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);\n return (config) =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.flatMapNullishOr((value) => value[name]),\n Option.map(prepare),\n Option.getOrElse(() => fallback),\n );\n};\n\nexport interface Ignoring {\n readonly ignores?: readonly string[] | undefined;\n}\n\nexport interface Pathspecs {\n readonly defaults: readonly string[];\n readonly unowned?: readonly string[];\n}\n\nexport const pathspecsOf =\n ({ defaults, unowned = [] }: Pathspecs) =>\n ({\n config,\n patterns = [],\n }: {\n readonly config: Ignoring;\n readonly patterns?: readonly string[];\n }): readonly string[] => [\n ...Arr.match(patterns, { onEmpty: () => defaults, onNonEmpty: Fn.identity }),\n ...unowned,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n ];\n","import { layersOf, mergedLayers, mergedRules } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport const flattenConfig = (config: I68Config): I68Config => {\n const layers = layersOf(config);\n const { plugins, ignores } = mergedLayers(layers);\n const rules = mergedRules(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n );\n return { plugins, rules, ignores };\n};\n","import { settingOf } from \"@masseater.dev/lint-host\";\nimport type { Setting } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { I68Config, Plugin, Rule } from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst ENABLED: Setting = settingOf(\"error\");\n\nexport interface ResolvedRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\ntype PluginEntry = readonly [string, Plugin];\n\nconst idOf = (plugin: string, name: string): string => `${plugin}${SEPARATOR}${name}`;\n\nconst pluginOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => id,\n onSome: (slash) => Str.slice(START, slash)(id),\n }),\n );\n\nconst rulesOf =\n (config: I68Config) =>\n ([plugin, value]: PluginEntry): readonly ResolvedRule[] =>\n pipe(\n Rec.toEntries(value.rules),\n Arr.map(([name, rule]): ResolvedRule => {\n const id = idOf(plugin, name);\n return {\n id,\n rule,\n setting: pipe(\n config.rules ?? {},\n Rec.get(id),\n Option.map(settingOf),\n Option.getOrElse(() => ENABLED),\n ),\n };\n }),\n Arr.filter(({ setting }) => setting.severity !== \"off\"),\n );\n\nexport const resolve = (config: I68Config): readonly ResolvedRule[] =>\n pipe(Rec.toEntries(config.plugins ?? {}), Arr.flatMap(rulesOf(config)));\n\nexport const unknownPlugins = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.map(pluginOf),\n Arr.filter((plugin) => !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\n );\n\nconst ruleNameOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => \"\",\n onSome: (slash) => Str.slice(slash + SEPARATOR.length)(id),\n }),\n );\n\nconst isKnownRule =\n (config: I68Config) =>\n (id: string): boolean =>\n pipe(\n Rec.get(config.plugins ?? {}, pluginOf(id)),\n Option.match({\n onNone: () => true,\n onSome: (plugin) => Rec.has(plugin.rules, ruleNameOf(id)),\n }),\n );\n\nexport const unknownRules = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.filter((id) => !isKnownRule(config)(id)),\n );\n","import type { NotUtf8Error } from \"@masseater.dev/lint-host\";\nimport { readSong } from \"@r_masseater/song-format\";\nimport type { SongSource } from \"@r_masseater/song-format\";\nimport { Effect } from \"effect\";\n\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst SEPARATOR = \"/\";\n\nexport interface SongFile {\n readonly file: string;\n readonly source: SongSource;\n}\n\nexport type Read = (path: string) => Effect.Effect<string, I68Error | NotUtf8Error>;\n\nexport interface ReadInput {\n readonly root: string;\n readonly file: string;\n readonly read: Read;\n}\n\nexport const pathOf = (input: Omit<ReadInput, \"read\">): string =>\n `${input.root}${SEPARATOR}${input.file}`;\n\nexport const readSongFile = Effect.fn(\"i68.read\")(function* readSongFile(input: ReadInput) {\n const source = yield* readSong({ path: pathOf(input), read: input.read });\n return { file: input.file, source } satisfies SongFile;\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class I68Error extends taggedError<I68Error, { readonly brand: unique symbol }>()(\n \"I68Error\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): I68Error =>\n I68Error.make({ message: `${message}: ${String(cause)}` });\n","import type { SourceComment } from \"@r_masseater/song-format\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\n\nconst DIRECTIVE =\n /^i68-(?<kind>ignore-next-line|ignore-file|ignore|disable|enable)(?:\\s(?<rest>[\\s\\S]*))?$/u;\nconst REASON = /\\s-{2,}(?:\\s|$)/u;\nconst LINE_MARK = \"//\";\nconst BLOCK_START = \"/*\";\nconst BLOCK_END = \"*/\";\nconst LIST = \",\";\nconst NEXT = 1;\nconst LINE_START = 0;\n\ntype Kind = \"ignore\" | \"ignore-next-line\" | \"ignore-file\" | \"disable\" | \"enable\";\n\ninterface Directive {\n readonly line: number;\n readonly column: number;\n readonly kind: Kind;\n readonly rules: readonly string[];\n}\n\nexport interface Suppressed {\n readonly line: number;\n readonly column?: number;\n readonly rule: string;\n}\n\nconst kindOf = (text: string): Kind =>\n Match.value(text).pipe(\n Match.when(\"ignore-file\", (): Kind => \"ignore-file\"),\n Match.when(\"ignore-next-line\", (): Kind => \"ignore-next-line\"),\n Match.when(\"disable\", (): Kind => \"disable\"),\n Match.when(\"enable\", (): Kind => \"enable\"),\n Match.orElse((): Kind => \"ignore\"),\n );\n\nconst bodyOf = (text: string): string => {\n if (Str.startsWith(BLOCK_START)(text)) {\n return pipe(text, Str.slice(BLOCK_START.length), Str.replace(BLOCK_END, \"\"), Str.trim);\n }\n return pipe(text, Str.slice(LINE_MARK.length), Str.trim);\n};\n\nconst rulesOf = (rest: string): readonly string[] =>\n pipe(\n Str.split(` ${rest}`, REASON),\n Arr.head,\n Option.getOrElse(() => \"\"),\n Str.split(LIST),\n Arr.map(Str.trim),\n Arr.filter(Str.isNonEmpty),\n );\n\nconst groupsOf = (text: string): Option.Option<Partial<Record<string, string>>> =>\n pipe(\n Option.fromNullishOr(DIRECTIVE.exec(text)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n );\n\nconst directiveOf = (comment: SourceComment): Option.Option<Directive> =>\n pipe(\n groupsOf(bodyOf(comment.text)),\n Option.map((groups) => ({\n line: comment.line,\n column: comment.column,\n kind: kindOf(groups[\"kind\"] ?? \"\"),\n rules: rulesOf(groups[\"rest\"] ?? \"\"),\n })),\n );\n\nconst names =\n (rule: string) =>\n (directive: Directive): boolean =>\n !Arr.isReadonlyArrayNonEmpty(directive.rules) || Arr.contains(directive.rules, rule);\n\nconst isRange = (directive: Directive): boolean =>\n directive.kind === \"disable\" || directive.kind === \"enable\";\n\nconst coversLine =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n names(found.rule)(directive) &&\n Match.value(directive.kind).pipe(\n Match.when(\"ignore-file\", () => true),\n Match.when(\"ignore-next-line\", () => directive.line + NEXT === found.line),\n Match.when(\"ignore\", () => directive.line === found.line),\n Match.orElse(() => false),\n );\n\nconst isAfter =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n directive.line < found.line ||\n (directive.line === found.line && directive.column <= (found.column ?? LINE_START));\n\nconst insideRange =\n (directives: readonly Directive[]) =>\n (found: Suppressed): boolean =>\n pipe(\n directives,\n Arr.filter(\n (directive) =>\n isRange(directive) && isAfter(found)(directive) && names(found.rule)(directive),\n ),\n Arr.last,\n Option.exists((directive) => directive.kind === \"disable\"),\n );\n\nexport const suppressionsOf = (\n comments: readonly SourceComment[],\n): ((found: Suppressed) => boolean) => {\n const directives = pipe(comments, Arr.map(directiveOf), Arr.getSomes);\n return (found) => pipe(directives, Arr.some(coversLine(found))) || insideRange(directives)(found);\n};\n","import { present, reportedSeverity } from \"@masseater.dev/lint-host\";\nimport type { Song, SourceComment } from \"@r_masseater/song-format\";\nimport { soundingsOf } from \"@r_masseater/song-format/analysis\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, Report } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nimport { suppressionsOf } from \"./suppressions.ts\";\n\nexport interface RunInput {\n readonly path: string;\n readonly comments: readonly SourceComment[];\n readonly song: Song;\n readonly rules: readonly ResolvedRule[];\n}\n\nconst diagnosticOf =\n (path: string, rule: ResolvedRule) =>\n (report: Report): Diagnostic => ({\n path,\n line: report.line,\n rule: rule.id,\n message: report.message,\n severity: reportedSeverity(rule.setting),\n ...present(Option.fromNullishOr(report.column), (column) => ({ column })),\n ...present(Option.fromNullishOr(report.detail), (detail) => ({ detail })),\n });\n\nconst runOne = (\n input: RunInput,\n soundings: readonly Sounding[],\n): ((rule: ResolvedRule) => Effect.Effect<readonly Diagnostic[], I68Error>) =>\n Effect.fn(\"i68.rule\")(function* run(rule: ResolvedRule) {\n yield* Effect.annotateCurrentSpan({ \"i68.rule\": rule.id });\n const reports: Report[] = [];\n yield* Effect.try({\n try: () => {\n rule.rule.check({\n filename: input.path,\n song: input.song,\n soundings,\n options: rule.setting.options,\n report: (report) => {\n reports.push(report);\n },\n });\n },\n catch: failedWith(`${rule.id} failed`),\n });\n return pipe(reports, Arr.map(diagnosticOf(input.path, rule)));\n });\n\nexport const runRules = Effect.fn(\"i68.rules\")(function* runRules(input: RunInput) {\n const soundings = soundingsOf(input.song);\n const suppressed = suppressionsOf(input.comments);\n const found = yield* pipe(\n input.rules,\n Effect.forEach(runOne(input, soundings), { concurrency: 1 }),\n );\n return pipe(\n Arr.flatten(found),\n Arr.filter((diagnostic) => !suppressed(diagnostic)),\n );\n});\n","import { NotUtf8Error, notUtf8, sortByPosition } from \"@masseater.dev/lint-host\";\nimport { readSong } from \"@r_masseater/song-format\";\nimport type { SourceIssue } from \"@r_masseater/song-format\";\nimport { Array as Arr, Effect, Result, Schema, pipe } from \"effect\";\n\nimport { flattenConfig, resolve, unknownPlugins, unknownRules } from \"#/entities/rule/index.ts\";\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport { pathOf, readSongFile } from \"#/features/read-songs/index.ts\";\nimport type { Read, SongFile } from \"#/features/read-songs/index.ts\";\nimport { runRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, I68Config } from \"#/shared/config/index.ts\";\nimport { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst PARSE_RULE = \"i68/parse\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly read: Read;\n readonly config?: I68Config;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly read?: Read;\n readonly config?: I68Config;\n}\n\nconst failIfAny =\n (problem: string) =>\n (names: readonly string[]): Effect.Effect<void, I68Error> =>\n Arr.match(names, {\n onEmpty: () => Effect.void,\n onNonEmpty: (found) =>\n Effect.fail(I68Error.make({ message: `${problem}: ${Arr.join(found, \", \")}` })),\n });\n\nconst UNKNOWN_PLUGINS = failIfAny(\"rules name plugins that are not configured\");\nconst UNKNOWN_RULES = failIfAny(\"rules name rules that their plugins do not have\");\n\nconst checkPlugins = (config: I68Config): Effect.Effect<void, I68Error> => {\n const rules = UNKNOWN_RULES(unknownRules(config));\n return UNKNOWN_PLUGINS(unknownPlugins(config)).pipe(Effect.andThen(rules));\n};\n\nconst rulesOf = (\n config: I68Config | undefined,\n): Effect.Effect<readonly ResolvedRule[], I68Error> => {\n const flat = flattenConfig(config ?? {});\n return checkPlugins(flat).pipe(Effect.as(resolve(flat)));\n};\n\nconst parseDiagnosticsOf =\n (file: string) =>\n (issues: readonly SourceIssue[]): readonly Diagnostic[] =>\n pipe(\n issues,\n Arr.map((issue): Diagnostic => ({\n path: file,\n line: issue.line,\n column: issue.column,\n rule: PARSE_RULE,\n message: issue.message,\n severity: \"error\",\n })),\n );\n\nconst lintFile =\n (rules: readonly ResolvedRule[]) =>\n (song: SongFile): Effect.Effect<readonly Diagnostic[], I68Error> => {\n if (song.source.status === \"invalid\") {\n return Effect.succeed(parseDiagnosticsOf(song.file)(song.source.issues));\n }\n return runRules({\n path: song.file,\n comments: song.source.outline.comments,\n song: song.source.song,\n rules,\n });\n };\n\nconst notFound = (path: string): Effect.Effect<string, I68Error> =>\n Effect.fail(I68Error.make({ message: `could not read ${path}` }));\n\nconst readerOf =\n (input: TextInput): Read =>\n (path) => {\n if (path === input.path) {\n return Effect.succeed(input.text);\n }\n return (input.read ?? notFound)(path);\n };\n\nconst lintTracked = (\n rules: readonly ResolvedRule[],\n input: LintInput,\n): ((file: string) => Effect.Effect<readonly Diagnostic[], I68Error>) =>\n Effect.fnUntraced(function* lintOne(\n file: string,\n ): Effect.fn.Return<readonly Diagnostic[], I68Error> {\n const path = pathOf({ root: input.root, file });\n const read = yield* Effect.result(input.read(path));\n if (Result.isFailure(read) && Schema.is(NotUtf8Error)(read.failure)) {\n return [notUtf8(\"i68\")(file)];\n }\n const reader = Result.match(read, {\n onFailure: () => input.read,\n onSuccess: (text): Read => readerOf({ path, text, read: input.read }),\n });\n const source = yield* readSongFile({ root: input.root, file, read: reader });\n return yield* lintFile(rules)(source);\n });\n\nexport const lint = Effect.fn(\"i68.lint\")(function* lint(input: LintInput) {\n const rules = yield* rulesOf(input.config);\n const found = yield* Effect.forEach(input.files, lintTracked(rules, input), {\n concurrency: \"unbounded\",\n });\n return sortByPosition<Diagnostic>(Arr.flatten(found));\n});\n\nexport const lintText = Effect.fn(\"i68.lintText\")(function* lintText(input: TextInput) {\n const rules = yield* rulesOf(input.config);\n const source = yield* readSong({ path: input.path, read: readerOf(input) });\n const found = yield* lintFile(rules)({ file: input.path, source });\n return sortByPosition<Diagnostic>(found);\n});\n","import { pathspecsOf, sectionOf } from \"@masseater.dev/lint-host\";\nimport type { PathspecRequest } from \"@masseater.dev/lint-host\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport type PathspecInput = PathspecRequest<I68Config>;\n\nexport const i68Section = sectionOf<I68Config>({\n name: \"i68\",\n prepare: flattenConfig,\n fallback: {},\n});\n\nexport const songPathspecs = pathspecsOf({ defaults: [\"*.fumx\"] });\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;AAEF,MAAM,aAAa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AM,SAAS,OAAO,SAAS;EAAE,MAAM,MAAM;EAAM,MAAM,SAAS,KAAK;CAAE,CAAC;CAC1E,MAAM,QAAQ,OAAO,SAAS,KAAK,CAAC,CAAC;EAAE,MAAM,MAAM;EAAM;CAAO,CAAC;CACjE,OAAO,eAA2B,KAAK;AACzC,CAAC;;ACvHD,MAAa,aAAa,UAAqB;CAC7C,MAAM;CACN,SAAS;CACT,UAAU,CAAC;AACb,CAAC;AAED,MAAa,gBAAgB,YAAY,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC"}
|
package/dist/vite.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/i68",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A linter for .fumx songs that checks musical rules such as notes outside the key, part ranges, voicing clashes and parallel fifths, configured from vite.config.ts with rules written in TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fumx",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@effect/platform-node": "^4.1.5",
|
|
64
|
-
"@r_masseater/song-format": "^0.2.
|
|
64
|
+
"@r_masseater/song-format": "^0.2.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@effect/vitest": "4.1.5",
|
|
68
68
|
"@masseater.dev/lint-host": "0.0.0",
|
|
69
69
|
"@r_masseater/vitest-otlp": "0.2.2",
|
|
70
|
-
"@types/node": "26.6.
|
|
70
|
+
"@types/node": "26.6.10",
|
|
71
71
|
"effect": "4.1.5",
|
|
72
72
|
"tonal": "6.9.0",
|
|
73
73
|
"verovio": "6.4.1",
|
|
@@ -90,6 +90,5 @@
|
|
|
90
90
|
},
|
|
91
91
|
"engines": {
|
|
92
92
|
"node": ">=26.13.1"
|
|
93
|
-
}
|
|
94
|
-
"scripts": {}
|
|
93
|
+
}
|
|
95
94
|
}
|
package/dist/cli-CzV_7HHU.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { c as runCli$1, n as songPathspecs, o as failedWith, r as lint, s as formatDiagnostic, t as i68Section } from "./section-C9JQ1-aJ.mjs";
|
|
2
|
-
// src/app/cli.ts
|
|
3
|
-
const runCli = () => {
|
|
4
|
-
runCli$1({
|
|
5
|
-
name: "i68",
|
|
6
|
-
section: i68Section,
|
|
7
|
-
pathspecs: songPathspecs,
|
|
8
|
-
lint,
|
|
9
|
-
format: formatDiagnostic,
|
|
10
|
-
failWith: failedWith
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
export { runCli };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=cli-CzV_7HHU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-CzV_7HHU.mjs","names":[],"sources":["../src/app/cli.ts"],"sourcesContent":["import { formatDiagnostic, runCli as runLinter } from \"@masseater.dev/lint-host\";\n\nimport { failedWith } from \"#/shared/lib/errors.ts\";\n\nimport { lint } from \"./lint.ts\";\nimport { i68Section, songPathspecs } from \"./section.ts\";\n\nexport const runCli = (): void => {\n runLinter({\n name: \"i68\",\n section: i68Section,\n pathspecs: songPathspecs,\n lint,\n format: formatDiagnostic,\n failWith: failedWith,\n });\n};\n"],"mappings":";;AAOA,MAAa,eAAqB;CAChC,SAAU;EACR,MAAM;EACN,SAAS;EACT,WAAW;EACX;EACA,QAAQ;EACR,UAAU;CACZ,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mix-facts-CvX18d2q.mjs","names":["Arr","Rec","Arr","Str","Arr","Str","Rec","FIRST","Arr","Arr","Rec","Num","Str","Arr"],"sources":["../src/app/presets/shared/lib/voices.ts","../src/app/presets/shared/lib/pitch.ts","../src/app/presets/shared/lib/keys.ts","../src/app/presets/shared/lib/degrees.ts","../src/app/presets/features/check-style/data/bach-chorales.json","../src/app/presets/shared/lib/style-table.ts","../src/app/presets/shared/lib/mix-habit.ts","../src/app/presets/shared/lib/style-rules.ts","../src/app/presets/shared/lib/mix-facts.ts"],"sourcesContent":["import type { Role } from \"@r_masseater/song-format\";\nimport { TICKS_PER_WHOLE } from \"@r_masseater/song-format\";\nimport { overlapOf } from \"@r_masseater/song-format/analysis\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Order, Record as Rec, pipe } from \"effect\";\n\nimport type { Report, RuleContext } from \"#/shared/config/index.ts\";\n\nconst SIXTEENTHS_PER_WHOLE = 16;\nconst SIXTEENTH = TICKS_PER_WHOLE / SIXTEENTHS_PER_WHOLE;\n\nexport const MELODIC: readonly Role[] = [\"melody\", \"countermelody\"];\n\nexport const hasRole =\n (roles: readonly Role[]) =>\n (sounding: Sounding): boolean =>\n Option.exists(sounding.role, (role) => Arr.contains(roles, role));\n\nexport const isPitched = (sounding: Sounding): boolean =>\n !Option.exists(sounding.role, (role) => role === \"drums\");\n\nconst byStart = Order.mapInput(Order.Number, (sounding: Sounding) => sounding.start);\n\nconst byPitch = Order.mapInput(Order.Number, (sounding: Sounding) => sounding.midi);\n\nexport const sortByStart = (soundings: readonly Sounding[]): readonly Sounding[] =>\n Arr.sort(soundings, byStart);\n\nexport const sortByPitch = (soundings: readonly Sounding[]): readonly Sounding[] =>\n Arr.sort(soundings, byPitch);\n\nexport const highest = (soundings: Arr.NonEmptyReadonlyArray<Sounding>): Sounding =>\n Arr.max(soundings, byPitch);\n\nexport const lowest = (soundings: Arr.NonEmptyReadonlyArray<Sounding>): Sounding =>\n Arr.min(soundings, byPitch);\n\nexport type Pair = readonly [Sounding, Sounding];\n\nconst stillSounding =\n (sounding: Sounding) =>\n (active: Sounding): boolean =>\n active.end > sounding.start;\n\nconst heldTogether =\n (sounding: Sounding) =>\n (other: Sounding): boolean =>\n overlapOf(other)(sounding) >= SIXTEENTH;\n\nexport const overlappingPairs = (soundings: readonly Sounding[]): readonly Pair[] => {\n const pairs: Pair[] = [];\n let active: readonly Sounding[] = [];\n for (const sounding of sortByStart(soundings)) {\n active = pipe(active, Arr.filter(stillSounding(sounding)));\n for (const other of pipe(active, Arr.filter(heldTogether(sounding)))) {\n pairs.push([other, sounding]);\n }\n active = [...active, sounding];\n }\n return pairs;\n};\n\nexport type Reporter = (key: string, report: Report) => void;\n\nexport const reporterOf = (context: RuleContext): Reporter => {\n const seen = new Set<string>();\n return (key, report) => {\n if (!seen.has(key)) {\n seen.add(key);\n context.report(report);\n }\n };\n};\n\nexport const tracksOf = (soundings: readonly Sounding[]): readonly (readonly Sounding[])[] =>\n pipe(\n Arr.groupBy(soundings, (sounding) => sounding.track),\n Rec.values,\n Arr.map(sortByStart),\n );\n\nexport const soundingAt =\n (soundings: readonly Sounding[]) =>\n (tick: number): readonly Sounding[] =>\n pipe(\n soundings,\n Arr.filter((sounding) => sounding.start <= tick && tick < sounding.end),\n );\n\nexport type Onset = Arr.NonEmptyReadonlyArray<Sounding>;\n\nconst byOnset = Order.mapInput(byStart, (group: Onset) => Arr.headNonEmpty(group));\n\nexport const onsetsOf = (soundings: readonly Sounding[]): readonly Onset[] =>\n pipe(\n Arr.groupBy(soundings, (sounding) => String(sounding.start)),\n Rec.values,\n (groups) => Arr.sort(groups, byOnset),\n );\n\nexport const topLineOf = (soundings: readonly Sounding[]): readonly Sounding[] =>\n pipe(onsetsOf(soundings), Arr.map(highest));\n\nexport const NEXT = 1;\n\nexport const neighborsOf = <Value>(\n values: readonly Value[],\n): readonly (readonly [Value, Value])[] => Arr.zip(values, Arr.drop(values, NEXT));\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nconst NAMES = [\"C\", \"C#\", \"D\", \"Eb\", \"E\", \"F\", \"F#\", \"G\", \"Ab\", \"A\", \"Bb\", \"B\"];\nconst PITCH = /^(?<letter>[A-G])(?<accidental>##|#|bb|b)?(?<octave>-?\\d+)$/u;\nconst OCTAVE = 12;\nconst OCTAVE_OFFSET = 1;\nconst SHARP = \"#\";\nconst FLAT = \"b\";\n\nexport const pitchClassOf = (midi: number): number => ((midi % OCTAVE) + OCTAVE) % OCTAVE;\n\nexport const nameOf = (midi: number): string =>\n `${Option.getOrElse(Arr.get(NAMES, pitchClassOf(midi)), () => \"?\")}${String(Math.floor(midi / OCTAVE) - OCTAVE_OFFSET)}`;\n\nconst countOf =\n (mark: string) =>\n (text: string): number =>\n pipe(\n Str.split(text, \"\"),\n Arr.filter((character) => character === mark),\n ).length;\n\ninterface PitchParts {\n readonly letter: string;\n readonly accidental: string;\n readonly octave: string;\n}\n\nconst partsOf = (name: string): Option.Option<PitchParts> =>\n pipe(\n Option.fromNullishOr(PITCH.exec(name)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n Option.flatMap((groups) =>\n Option.all({\n letter: Option.fromNullishOr(groups[\"letter\"]),\n accidental: Option.some(groups[\"accidental\"] ?? \"\"),\n octave: Option.fromNullishOr(groups[\"octave\"]),\n }),\n ),\n );\n\nexport const midiOf = (name: string): Option.Option<number> =>\n pipe(\n partsOf(name),\n Option.flatMap((parts) =>\n pipe(\n Arr.findFirstIndex(NAMES, (candidate) => candidate === parts.letter),\n Option.map(\n (letter) =>\n (Number(parts.octave) + OCTAVE_OFFSET) * OCTAVE +\n letter +\n countOf(SHARP)(parts.accidental) -\n countOf(FLAT)(parts.accidental),\n ),\n ),\n ),\n );\n","import type { Bar, Song } from \"@r_masseater/song-format\";\nimport { keyIn } from \"@r_masseater/song-format/analysis\";\nimport type { BarRange, KeySpan } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nconst UNLABELED = \"#song\";\n\ninterface Labeled {\n readonly bar: Bar;\n readonly label: string;\n}\n\nconst labeled = (bars: readonly Bar[]): readonly Labeled[] =>\n Arr.reduce(bars, Arr.empty<Labeled>(), (done, bar) => {\n const carried = pipe(\n Arr.last(done),\n Option.filter((previous) => !Str.startsWith(\"#\")(previous.label)),\n Option.map((previous) => previous.label),\n );\n const label = pipe(\n bar.section,\n Option.orElse(() => carried),\n Option.getOrElse(() => UNLABELED),\n );\n return Arr.append(done, { bar, label });\n });\n\nconst rangesOf = (song: Song): readonly BarRange[] =>\n pipe(\n Arr.match(labeled(song.bars), {\n onEmpty: (): readonly Arr.NonEmptyReadonlyArray<Labeled>[] => [],\n onNonEmpty: (bars) => Arr.groupWith(bars, (left, right) => left.label === right.label),\n }),\n Arr.map(Arr.map(({ bar }) => bar)),\n Arr.map((bars) => ({\n fromBar: Arr.headNonEmpty(bars).index,\n toBar: Arr.lastNonEmpty(bars).index,\n })),\n );\n\nexport const keysOf = (song: Song): readonly KeySpan[] =>\n pipe(rangesOf(song), Arr.map(keyIn(song)), Arr.getSomes);\n\nexport const keyAt =\n (keys: readonly KeySpan[]) =>\n (bar: number): Option.Option<KeySpan> =>\n pipe(\n keys,\n Arr.findFirst((span) => span.fromBar <= bar && bar <= span.toBar),\n );\n","import type { Song } from \"@r_masseater/song-format\";\nimport { chordsOf } from \"@r_masseater/song-format/analysis\";\nimport type { ChordSpan, KeySpan, Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\nimport { Chord, Note } from \"tonal\";\n\nimport { keyAt, keysOf } from \"./keys.ts\";\nimport { pitchClassOf } from \"./pitch.ts\";\nimport { isPitched, sortByStart } from \"./voices.ts\";\n\nconst DEGREES = {\n first: \"I\",\n flatSecond: \"bII\",\n second: \"II\",\n flatThird: \"bIII\",\n third: \"III\",\n fourth: \"IV\",\n raisedFourth: \"#IV\",\n fifth: \"V\",\n flatSixth: \"bVI\",\n sixth: \"VI\",\n flatSeventh: \"bVII\",\n seventh: \"VII\",\n};\nconst DEGREE_NAMES = Rec.values(DEGREES);\n\nconst SEVENTHS: Readonly<Record<string, string>> = {\n \"dominant seventh\": \"7\",\n \"major seventh\": \"M7\",\n \"minor seventh\": \"m7\",\n \"half-diminished\": \"m7b5\",\n \"diminished seventh\": \"dim7\",\n};\n\nconst TRIADS: Readonly<Record<string, string>> = {\n Major: \"\",\n Minor: \"m\",\n Diminished: \"dim\",\n Augmented: \"aug\",\n};\n\nconst RELATIVE_MAJOR = 3;\nconst FIRST = 1;\n\nexport interface Step {\n readonly token: string;\n readonly bar: number;\n readonly line: number;\n readonly column: number;\n}\n\nconst kindOf = (type: string, quality: string): Option.Option<string> =>\n pipe(\n Rec.get(SEVENTHS, type),\n Option.orElse(() => Rec.get(TRIADS, quality)),\n );\n\nconst majorTonicOf = (key: Pick<KeySpan, \"mode\" | \"pitchClass\">): number => {\n if (key.mode === \"minor\") {\n return key.pitchClass + RELATIVE_MAJOR;\n }\n return key.pitchClass;\n};\n\nexport interface ReadChord {\n readonly chroma: number;\n readonly kind: string;\n}\n\nexport const chordOf = (symbol: string): Option.Option<ReadChord> => {\n const chord = Chord.get(symbol);\n return Option.flatMap(Option.fromNullishOr(Note.chroma(chord.tonic ?? \"\")), (chroma) =>\n Option.map(kindOf(chord.type, chord.quality), (kind) => ({ chroma, kind })),\n );\n};\n\nexport const degreeOf =\n (key: Pick<KeySpan, \"mode\" | \"pitchClass\">) =>\n (chord: ReadChord): Option.Option<string> => {\n const pitchClass = pitchClassOf(chord.chroma - majorTonicOf(key));\n return pipe(\n Arr.get(DEGREE_NAMES, pitchClass),\n Option.map((degree) => `${degree}${chord.kind}`),\n );\n };\n\nexport const tokenOf =\n (key: Pick<KeySpan, \"mode\" | \"pitchClass\">) =>\n (symbol: string): Option.Option<string> =>\n Option.flatMap(chordOf(symbol), degreeOf(key));\n\nconst placeOf =\n (soundings: readonly Sounding[]) =>\n (tick: number): Option.Option<Sounding> =>\n pipe(\n soundings,\n Arr.findFirst((sounding) => sounding.start >= tick),\n );\n\nconst stepOf =\n (keys: readonly KeySpan[], place: (tick: number) => Option.Option<Sounding>) =>\n (span: ChordSpan): Option.Option<Step> =>\n pipe(\n keyAt(keys)(span.from.bar),\n Option.flatMap((key) => tokenOf(key)(span.symbol)),\n Option.flatMap((token) =>\n Option.map(place(span.start), (sounding) => ({\n token,\n bar: span.from.bar,\n line: sounding.line,\n column: sounding.column,\n })),\n ),\n );\n\nconst isNewChord = (step: Step, index: number, steps: readonly Step[]): boolean =>\n !pipe(\n Arr.get(steps, index - FIRST),\n Option.exists((previous) => previous.token === step.token),\n );\n\nexport const progressionOf =\n (soundings: readonly Sounding[]) =>\n (song: Song): readonly Step[] => {\n const pitched = pipe(soundings, Arr.filter(isPitched));\n const step = stepOf(keysOf(song), placeOf(sortByStart(pitched)));\n const steps = pipe(chordsOf(song), Arr.map(step), Arr.getSomes);\n return pipe(\n steps,\n Arr.filter((each, index) => isNewChord(each, index, steps)),\n );\n };\n","","import { Array as Arr, Number as Num, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport type { Step } from \"./degrees.ts\";\n\nexport const StyleTableSchema = Schema.Struct({\n name: Schema.String,\n source: Schema.String,\n order: Schema.Int,\n transitions: Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Int)),\n});\n\nexport type StyleTable = typeof StyleTableSchema.Type;\n\nexport type Transitions = StyleTable[\"transitions\"];\n\nexport interface Context {\n readonly words: string;\n readonly next: Readonly<Record<string, number>>;\n readonly total: number;\n}\n\nconst FIRST = 1;\n\nconst contextOf =\n (table: StyleTable, seen: number, before: readonly Step[]) =>\n (length: number): Option.Option<Context> => {\n const words = pipe(\n Arr.takeRight(before, length),\n Arr.map((step) => step.token),\n Arr.join(\" \"),\n );\n return pipe(\n Rec.get(table.transitions, words),\n Option.map((next) => ({ words, next, total: Num.sumAll(Rec.values(next)) })),\n Option.filter((context) => context.total >= seen),\n );\n };\n\nexport interface Judge {\n readonly table: StyleTable;\n readonly seen: number;\n}\n\nexport const longestContext =\n ({ table, seen }: Judge) =>\n (before: readonly Step[]): Option.Option<Context> =>\n pipe(\n Arr.range(FIRST, Math.min(table.order, before.length)),\n Arr.reverse,\n Arr.findFirst(contextOf(table, seen, before)),\n );\n","import { MIXER_PARAMETERS } from \"@r_masseater/song-format\";\nimport { Match, Schema } from \"effect\";\n\nconst Track = Schema.String;\n\nexport const MoveSchema = Schema.Struct({\n type: Schema.Literal(\"move\"),\n track: Track,\n parameter: Schema.Literals(MIXER_PARAMETERS),\n direction: Schema.Literals([\"up\", \"down\"]),\n edge: Schema.Literals([\"before\", \"after\"]),\n});\n\nexport const LevelSchema = Schema.Struct({\n type: Schema.Literal(\"level\"),\n track: Track,\n decibels: Schema.Finite,\n});\n\nexport const PanSchema = Schema.Struct({\n type: Schema.Literal(\"pan\"),\n track: Track,\n pan: Schema.Finite,\n});\n\nexport const SendSchema = Schema.Struct({\n type: Schema.Literal(\"send\"),\n track: Track,\n bus: Schema.String,\n amount: Schema.Finite,\n});\n\nexport const MixHabitSchema = Schema.Union([MoveSchema, LevelSchema, PanSchema, SendSchema]);\n\nexport type MixHabit = typeof MixHabitSchema.Type;\n\nconst PERCENT = 100;\n\nconst percentOf = (share: number): string => `${String(Math.round(share * PERCENT))}%`;\n\nconst ARROWS = { up: \"↑\", down: \"↓\" } as const;\n\nexport const mixKeyOf: (habit: MixHabit) => string = Match.type<MixHabit>().pipe(\n Match.discriminatorsExhaustive(\"type\")({\n move: (move) =>\n `${move.track} ${move.parameter} ${ARROWS[move.direction]} ${move.edge} section`,\n level: (level) => `${level.track} volume ${String(level.decibels)}dB from loudest`,\n pan: (pan) => `${pan.track} pan ${percentOf(pan.pan)}`,\n send: (send) => `${send.track} send ${send.bus} ${percentOf(send.amount)}`,\n }),\n);\n","import { Match, Schema } from \"effect\";\n\nimport { MixHabitSchema, mixKeyOf } from \"./mix-habit.ts\";\n\nexport const HABIT_KINDS = [\"keep\", \"fix\", \"suggest\"] as const;\n\nexport type HabitKind = (typeof HABIT_KINDS)[number];\n\nexport const ChordHabitSchema = Schema.Struct({\n type: Schema.Literal(\"chord\"),\n context: Schema.String,\n next: Schema.String,\n});\n\nexport const SubjectSchema = Schema.Union([ChordHabitSchema, MixHabitSchema]);\n\nexport type Subject = typeof SubjectSchema.Type;\n\nexport const HabitRuleSchema = Schema.Struct({\n habit: SubjectSchema,\n kind: Schema.Literals(HABIT_KINDS),\n aim: Schema.String,\n reason: Schema.optionalKey(Schema.String),\n});\n\nexport type HabitRule = typeof HabitRuleSchema.Type;\n\nexport const StyleRulesSchema = Schema.Struct({\n name: Schema.String,\n habits: Schema.Array(HabitRuleSchema),\n});\n\nexport type StyleRules = typeof StyleRulesSchema.Type;\n\nexport const subjectKeyOf = (subject: Subject): string =>\n Match.value(subject).pipe(\n Match.when({ type: \"chord\" }, (chord) => `${chord.context} → ${chord.next}`),\n Match.orElse(mixKeyOf),\n );\n","import { MIXER_PARAMETERS } from \"@r_masseater/song-format\";\nimport type { MixerParameter, Song } from \"@r_masseater/song-format\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport type { MixHabit } from \"./mix-habit.ts\";\n\nconst DECIBEL_STEP = 3;\nconst PAN_STEPS = 4;\nconst SEND_STEPS = 10;\nconst FIRST_LINE = 1;\nconst FIRST_COLUMN = 1;\nconst COPY = /-\\d+$/u;\n\nexport interface MixPlace {\n readonly bar: number;\n readonly line: number;\n readonly column: number;\n}\n\nexport interface MixFact {\n readonly habit: MixHabit;\n readonly place: MixPlace;\n}\n\ntype Track = Song[\"tracks\"][number];\n\nexport const trackKeyOf = (name: string): string => Str.replace(COPY, \"\")(name);\n\nconst stepped =\n (steps: number) =>\n (value: number): number =>\n Math.round(value * steps) / steps;\n\nconst decibelsStepped = (decibels: number): number =>\n Math.round(decibels / DECIBEL_STEP) * DECIBEL_STEP;\n\nexport const placeIn =\n (soundings: readonly Sounding[]) =>\n ({ track, bar }: Readonly<{ track: string; bar: number }>): MixPlace =>\n pipe(\n soundings,\n Arr.findFirst((sounding) => sounding.track === track && sounding.bar >= bar),\n Option.match({\n onNone: () => ({ bar, line: FIRST_LINE, column: FIRST_COLUMN }),\n onSome: (sounding) => ({ bar, line: sounding.line, column: sounding.column }),\n }),\n );\n\nconst loudestOf = (tracks: readonly Track[]): number =>\n Math.max(\n ...pipe(\n tracks,\n Arr.map((track) => track.mixer.volumeDecibels),\n ),\n );\n\nconst levelHabitsOf =\n (tracks: readonly Track[]) =>\n (track: Track): readonly MixHabit[] => [\n {\n type: \"level\",\n track: trackKeyOf(track.name),\n decibels: decibelsStepped(track.mixer.volumeDecibels - loudestOf(tracks)),\n },\n { type: \"pan\", track: trackKeyOf(track.name), pan: stepped(PAN_STEPS)(track.mixer.pan) },\n ...pipe(\n track.sends,\n Arr.map((send): MixHabit => ({\n type: \"send\",\n track: trackKeyOf(track.name),\n bus: trackKeyOf(send.bus),\n amount: stepped(SEND_STEPS)(send.amount),\n })),\n ),\n ];\n\nconst sectionStartsOf = (song: Song): readonly number[] =>\n pipe(\n song.bars,\n Arr.drop(FIRST_LINE),\n Arr.filter((bar) => Option.isSome(bar.section) || Option.isSome(bar.mark)),\n Arr.map((bar) => bar.index),\n );\n\ntype Automation = Song[\"automations\"][number];\n\nconst isMove = (\n automation: Automation,\n): automation is Automation & {\n readonly parameter: MixerParameter;\n} => Arr.contains(MIXER_PARAMETERS, automation.parameter);\n\nconst directionOf = (automation: Automation): \"up\" | \"down\" => {\n if (automation.to.value > automation.from.value) {\n return \"up\";\n }\n return \"down\";\n};\n\ntype Moved = Readonly<{ habit: MixHabit; bar: number; target: string }>;\n\nconst movesOf =\n (starts: readonly number[]) =>\n (automation: Automation): readonly Moved[] => {\n if (!isMove(automation) || automation.from.value === automation.to.value) {\n return [];\n }\n const direction = directionOf(automation);\n const end = automation.bar + automation.bars;\n const base = {\n type: \"move\" as const,\n track: trackKeyOf(automation.target),\n parameter: automation.parameter,\n direction,\n };\n return [\n ...pipe(\n starts,\n Arr.filter((start) => start === end),\n Arr.map((start) => ({\n habit: { ...base, edge: \"before\" as const },\n bar: start,\n target: automation.target,\n })),\n ),\n ...pipe(\n starts,\n Arr.filter((start) => start === automation.bar),\n Arr.map((start) => ({\n habit: { ...base, edge: \"after\" as const },\n bar: start,\n target: automation.target,\n })),\n ),\n ];\n };\n\nexport const mixFactsOf =\n (soundings: readonly Sounding[]) =>\n (song: Song): readonly MixFact[] => {\n const place = placeIn(soundings);\n const firstBar = pipe(\n Arr.head(song.bars),\n Option.match({ onNone: () => FIRST_LINE, onSome: (bar) => bar.index }),\n );\n const moves = movesOf(sectionStartsOf(song));\n return [\n ...pipe(\n song.tracks,\n Arr.flatMap((track) =>\n pipe(\n levelHabitsOf(song.tracks)(track),\n Arr.map((habit) => ({ habit, place: place({ track: track.name, bar: firstBar }) })),\n ),\n ),\n ),\n ...pipe(\n song.automations,\n Arr.flatMap(moves),\n Arr.map(({ habit, bar, target }) => ({ habit, place: place({ track: target, bar }) })),\n ),\n ];\n };\n"],"mappings":";;;;;AASA,MAAM,YAAY,kBAAkB;AAEpC,MAAa,UAA2B,CAAC,UAAU,eAAe;AAElE,MAAa,WACV,WACA,aACC,OAAO,OAAO,SAAS,OAAO,SAASA,MAAI,SAAS,OAAO,IAAI,CAAC;AAEpE,MAAa,aAAa,aACxB,CAAC,OAAO,OAAO,SAAS,OAAO,SAAS,SAAS,OAAO;AAE1D,MAAM,UAAU,MAAM,SAAS,MAAM,SAAS,aAAuB,SAAS,KAAK;AAEnF,MAAM,UAAU,MAAM,SAAS,MAAM,SAAS,aAAuB,SAAS,IAAI;AAElF,MAAa,eAAe,cAC1BA,MAAI,KAAK,WAAW,OAAO;AAE7B,MAAa,eAAe,cAC1BA,MAAI,KAAK,WAAW,OAAO;AAE7B,MAAa,WAAW,cACtBA,MAAI,IAAI,WAAW,OAAO;AAE5B,MAAa,UAAU,cACrBA,MAAI,IAAI,WAAW,OAAO;AAI5B,MAAM,iBACH,cACA,WACC,OAAO,MAAM,SAAS;AAE1B,MAAM,gBACH,cACA,UACC,UAAU,KAAK,CAAC,CAAC,QAAQ,KAAK;AAElC,MAAa,oBAAoB,cAAoD;CACnF,MAAM,QAAgB,CAAC;CACvB,IAAI,SAA8B,CAAC;CACnC,KAAK,MAA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START","Bool","Arr","Arr","Rec","Arr","Fn","Arr","Arr","SEPARATOR","Str","rulesOf","Rec","Arr","Str","rulesOf","Arr","Arr","Arr"],"sources":["../../lint-host/src/entities/rule/model/setting.ts","../../lint-host/src/entities/rule/model/severity.ts","../../lint-host/src/shared/lib/target.ts","../../lint-host/src/features/build-addon/model/build.ts","../../lint-host/src/features/run-cli/model/cli.ts","../../lint-host/src/shared/lib/present.ts","../../lint-host/src/shared/lib/trace.ts","../../lint-host/src/shared/lib/layers.ts","../../lint-host/src/shared/lib/diagnostic.ts","../../lint-host/src/shared/lib/section.ts","../src/entities/rule/model/extend.ts","../src/entities/rule/model/resolve.ts","../src/features/read-songs/model/read.ts","../src/shared/lib/errors.ts","../src/features/run-rules/model/suppressions.ts","../src/features/run-rules/model/run.ts","../src/app/lint.ts","../src/app/section.ts"],"sourcesContent":["import { Array as Arr, Match, Option, Record as Rec, pipe } 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\nconst optionsOf = (entry: RuleEntry): Option.Option<RuleOptions> =>\n Match.value(entry).pipe(\n Match.when(Match.string, () => Option.none()),\n Match.orElse(([, options]) => Option.fromUndefinedOr(options)),\n );\n\nconst overridden = (earlier: RuleEntry, later: RuleEntry): RuleEntry =>\n pipe(\n optionsOf(later),\n Option.orElse(() => optionsOf(earlier)),\n Option.match({\n onNone: () => later,\n onSome: (options): RuleEntry => [settingOf(later).severity, options],\n }),\n );\n\nexport const mergedRules = (\n layers: readonly (Readonly<Record<string, RuleEntry>> | undefined)[],\n): Readonly<Record<string, RuleEntry>> => {\n const merged: Record<string, RuleEntry> = {};\n for (const [name, later] of pipe(\n layers,\n Arr.flatMap((layer) => Rec.toEntries(layer ?? {})),\n )) {\n merged[name] = pipe(\n Rec.get(merged, name),\n Option.match({\n onNone: () => later,\n onSome: (earlier) => overridden(earlier, later),\n }),\n );\n }\n return merged;\n};\n","import { Match } from \"effect\";\n\nimport type { Setting, Severity } from \"./setting.ts\";\n\nexport const reportedSeverity = (setting: Setting): Exclude<Severity, \"off\"> =>\n Match.value(setting.severity).pipe(\n Match.when(\"warn\", (): Exclude<Severity, \"off\"> => \"warn\"),\n Match.orElse((): Exclude<Severity, \"off\"> => \"error\"),\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 { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\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)));\n};\n","import { runMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\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, Failure> {\n readonly root: string;\n readonly files: readonly string[];\n readonly projectFiles: readonly string[];\n readonly config: Config;\n readonly read: (file: string) => Effect.Effect<string, Failure>;\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, Failure>) => 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 readerIn = <Failure>(\n root: string,\n failWith: FailWith<Failure>,\n): Effect.Effect<\n (file: string) => Effect.Effect<string, Failure>,\n never,\n FileSystem.FileSystem | Path.Path\n> =>\n Effect.gen(function* reader() {\n const fileSystem = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return (file: string): Effect.Effect<string, Failure> =>\n fileSystem\n .readFileString(path.resolve(root, file))\n .pipe(Effect.mapError(failWith(`could not read ${file}`)));\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 pathspecs = cli.pathspecs(requestOf(config, patterns));\n const { files, projectFiles } = yield* Effect.all(\n {\n files: trackedFiles(root, pathspecs).pipe(Effect.withSpan(`${cli.name}.files`)),\n projectFiles: trackedFiles(root, []).pipe(Effect.withSpan(`${cli.name}.project`)),\n },\n { concurrency: \"unbounded\" },\n );\n const read = yield* readerIn(root, cli.failWith);\n const found = yield* cli.lint({ root, files, projectFiles, config, read });\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),\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 readonly column?: number;\n}\n\nconst LINE_START = 0;\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.combine(\n Order.mapInput(Order.Number, (found: Positioned) => found.line),\n Order.mapInput(Order.Number, (found: Positioned) => found.column ?? LINE_START),\n ),\n);\n\nexport const sortByPosition = <Found extends Positioned>(found: readonly Found[]): Found[] =>\n Arr.sort(found, byPosition);\n","import { Array as Arr, Record as Rec, pipe } from \"effect\";\n\nexport interface Layer<Plugin, Entry, Override> {\n readonly plugins?: Readonly<Record<string, Plugin>>;\n readonly rules?: Readonly<Record<string, Entry>>;\n readonly ignores?: readonly string[];\n readonly overrides?: readonly Override[];\n}\n\nexport interface Merged<Plugin, Entry, Override> {\n readonly plugins: Readonly<Record<string, Plugin>>;\n readonly rules: Readonly<Record<string, Entry>>;\n readonly ignores: readonly string[];\n readonly overrides: readonly Override[];\n}\n\nexport const mergedRecords = <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\nexport const layersOf = <Config extends { readonly extends?: readonly Config[] }>(\n config: Config,\n): readonly Omit<Config, \"extends\">[] => {\n const { extends: bases = [], ...own } = config;\n return [...pipe(bases, Arr.flatMap(layersOf)), own];\n};\n\nexport const mergedLayers = <Plugin, Entry, Override>(\n layers: readonly Layer<Plugin, Entry, Override>[],\n): Merged<Plugin, Entry, Override> => ({\n plugins: mergedRecords(\n pipe(\n layers,\n Arr.map((layer) => layer.plugins),\n ),\n ),\n rules: mergedRecords(\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});\n","import { Array as Arr, Option, pipe } from \"effect\";\n\nexport interface Reportable {\n readonly path: string;\n readonly line: number;\n readonly column?: number | undefined;\n readonly rule: string;\n readonly message: string;\n readonly detail?: string | undefined;\n readonly context?: string | undefined;\n readonly severity: string;\n}\n\nexport const diagnosticDetail = (diagnostic: Reportable): 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 formatDiagnostic = (diagnostic: Reportable): 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 { Array as Arr, Function as Fn, Option, Predicate, pipe } from \"effect\";\n\nexport interface SectionRequest<Config extends object> {\n readonly name: string;\n readonly fallback: Config;\n readonly prepare?: (section: Config) => Config;\n}\n\nexport const sectionOf = <Config extends object>({\n name,\n fallback,\n prepare = Fn.identity,\n}: SectionRequest<Config>): ((config: unknown) => Config) => {\n const hasSection = (value: unknown): value is Readonly<Record<string, Config>> =>\n Predicate.hasProperty(value, name) && Predicate.isObject(value[name]);\n return (config) =>\n pipe(\n Option.liftPredicate(config, hasSection),\n Option.flatMapNullishOr((value) => value[name]),\n Option.map(prepare),\n Option.getOrElse(() => fallback),\n );\n};\n\nexport interface Ignoring {\n readonly ignores?: readonly string[] | undefined;\n}\n\nexport interface Pathspecs {\n readonly defaults: readonly string[];\n readonly unowned?: readonly string[];\n}\n\nexport const pathspecsOf =\n ({ defaults, unowned = [] }: Pathspecs) =>\n ({\n config,\n patterns = [],\n }: {\n readonly config: Ignoring;\n readonly patterns?: readonly string[];\n }): readonly string[] => [\n ...Arr.match(patterns, { onEmpty: () => defaults, onNonEmpty: Fn.identity }),\n ...unowned,\n ...pipe(\n config.ignores ?? [],\n Arr.map((glob) => `:(glob,exclude)${glob}`),\n ),\n ];\n","import { layersOf, mergedLayers, mergedRules } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, pipe } from \"effect\";\n\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport const flattenConfig = (config: I68Config): I68Config => {\n const layers = layersOf(config);\n const { plugins, ignores } = mergedLayers(layers);\n const rules = mergedRules(\n pipe(\n layers,\n Arr.map((layer) => layer.rules),\n ),\n );\n return { plugins, rules, ignores };\n};\n","import { settingOf } from \"@masseater.dev/lint-host\";\nimport type { Setting } from \"@masseater.dev/lint-host\";\nimport { Array as Arr, Option, Record as Rec, String as Str, pipe } from \"effect\";\n\nimport type { I68Config, Plugin, Rule } from \"#/shared/config/index.ts\";\n\nconst SEPARATOR = \"/\";\nconst START = 0;\nconst ENABLED: Setting = settingOf(\"error\");\n\nexport interface ResolvedRule {\n readonly id: string;\n readonly rule: Rule;\n readonly setting: Setting;\n}\n\ntype PluginEntry = readonly [string, Plugin];\n\nconst idOf = (plugin: string, name: string): string => `${plugin}${SEPARATOR}${name}`;\n\nconst pluginOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => id,\n onSome: (slash) => Str.slice(START, slash)(id),\n }),\n );\n\nconst rulesOf =\n (config: I68Config) =>\n ([plugin, value]: PluginEntry): readonly ResolvedRule[] =>\n pipe(\n Rec.toEntries(value.rules),\n Arr.map(([name, rule]): ResolvedRule => {\n const id = idOf(plugin, name);\n return {\n id,\n rule,\n setting: pipe(\n config.rules ?? {},\n Rec.get(id),\n Option.map(settingOf),\n Option.getOrElse(() => ENABLED),\n ),\n };\n }),\n Arr.filter(({ setting }) => setting.severity !== \"off\"),\n );\n\nexport const resolve = (config: I68Config): readonly ResolvedRule[] =>\n pipe(Rec.toEntries(config.plugins ?? {}), Arr.flatMap(rulesOf(config)));\n\nexport const unknownPlugins = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.map(pluginOf),\n Arr.filter((plugin) => !Rec.has(config.plugins ?? {}, plugin)),\n Arr.dedupe,\n );\n\nconst ruleNameOf = (id: string): string =>\n pipe(\n Str.indexOf(SEPARATOR)(id),\n Option.match({\n onNone: () => \"\",\n onSome: (slash) => Str.slice(slash + SEPARATOR.length)(id),\n }),\n );\n\nconst isKnownRule =\n (config: I68Config) =>\n (id: string): boolean =>\n pipe(\n Rec.get(config.plugins ?? {}, pluginOf(id)),\n Option.match({\n onNone: () => true,\n onSome: (plugin) => Rec.has(plugin.rules, ruleNameOf(id)),\n }),\n );\n\nexport const unknownRules = (config: I68Config): readonly string[] =>\n pipe(\n Rec.keys(config.rules ?? {}),\n Arr.filter((id) => !isKnownRule(config)(id)),\n );\n","import { readSong } from \"@r_masseater/song-format\";\nimport type { SongSource } from \"@r_masseater/song-format\";\nimport { Effect } from \"effect\";\n\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst SEPARATOR = \"/\";\n\nexport interface SongFile {\n readonly file: string;\n readonly source: SongSource;\n}\n\nexport type Read = (path: string) => Effect.Effect<string, I68Error>;\n\nexport interface ReadInput {\n readonly root: string;\n readonly file: string;\n readonly read: Read;\n}\n\nexport const readSongFile = Effect.fn(\"i68.read\")(function* readSongFile(input: ReadInput) {\n const path = `${input.root}${SEPARATOR}${input.file}`;\n const source = yield* readSong({ path, read: input.read });\n return { file: input.file, source } satisfies SongFile;\n});\n","import { Schema } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class I68Error extends taggedError<I68Error, { readonly brand: unique symbol }>()(\n \"I68Error\",\n { message: Schema.String },\n) {}\n\nexport const failedWith =\n (message: string) =>\n (cause: unknown): I68Error =>\n I68Error.make({ message: `${message}: ${String(cause)}` });\n","import type { SourceComment } from \"@r_masseater/song-format\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\n\nconst DIRECTIVE =\n /^i68-(?<kind>ignore-next-line|ignore-file|ignore|disable|enable)(?:\\s(?<rest>[\\s\\S]*))?$/u;\nconst REASON = /\\s-{2,}(?:\\s|$)/u;\nconst LINE_MARK = \"//\";\nconst BLOCK_START = \"/*\";\nconst BLOCK_END = \"*/\";\nconst LIST = \",\";\nconst NEXT = 1;\nconst LINE_START = 0;\n\ntype Kind = \"ignore\" | \"ignore-next-line\" | \"ignore-file\" | \"disable\" | \"enable\";\n\ninterface Directive {\n readonly line: number;\n readonly column: number;\n readonly kind: Kind;\n readonly rules: readonly string[];\n}\n\nexport interface Suppressed {\n readonly line: number;\n readonly column?: number;\n readonly rule: string;\n}\n\nconst kindOf = (text: string): Kind =>\n Match.value(text).pipe(\n Match.when(\"ignore-file\", (): Kind => \"ignore-file\"),\n Match.when(\"ignore-next-line\", (): Kind => \"ignore-next-line\"),\n Match.when(\"disable\", (): Kind => \"disable\"),\n Match.when(\"enable\", (): Kind => \"enable\"),\n Match.orElse((): Kind => \"ignore\"),\n );\n\nconst bodyOf = (text: string): string => {\n if (Str.startsWith(BLOCK_START)(text)) {\n return pipe(text, Str.slice(BLOCK_START.length), Str.replace(BLOCK_END, \"\"), Str.trim);\n }\n return pipe(text, Str.slice(LINE_MARK.length), Str.trim);\n};\n\nconst rulesOf = (rest: string): readonly string[] =>\n pipe(\n Str.split(` ${rest}`, REASON),\n Arr.head,\n Option.getOrElse(() => \"\"),\n Str.split(LIST),\n Arr.map(Str.trim),\n Arr.filter(Str.isNonEmpty),\n );\n\nconst groupsOf = (text: string): Option.Option<Partial<Record<string, string>>> =>\n pipe(\n Option.fromNullishOr(DIRECTIVE.exec(text)),\n Option.flatMap((found) => Option.fromNullishOr(found.groups)),\n );\n\nconst directiveOf = (comment: SourceComment): Option.Option<Directive> =>\n pipe(\n groupsOf(bodyOf(comment.text)),\n Option.map((groups) => ({\n line: comment.line,\n column: comment.column,\n kind: kindOf(groups[\"kind\"] ?? \"\"),\n rules: rulesOf(groups[\"rest\"] ?? \"\"),\n })),\n );\n\nconst names =\n (rule: string) =>\n (directive: Directive): boolean =>\n !Arr.isReadonlyArrayNonEmpty(directive.rules) || Arr.contains(directive.rules, rule);\n\nconst isRange = (directive: Directive): boolean =>\n directive.kind === \"disable\" || directive.kind === \"enable\";\n\nconst coversLine =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n names(found.rule)(directive) &&\n Match.value(directive.kind).pipe(\n Match.when(\"ignore-file\", () => true),\n Match.when(\"ignore-next-line\", () => directive.line + NEXT === found.line),\n Match.when(\"ignore\", () => directive.line === found.line),\n Match.orElse(() => false),\n );\n\nconst isAfter =\n (found: Suppressed) =>\n (directive: Directive): boolean =>\n directive.line < found.line ||\n (directive.line === found.line && directive.column <= (found.column ?? LINE_START));\n\nconst insideRange =\n (directives: readonly Directive[]) =>\n (found: Suppressed): boolean =>\n pipe(\n directives,\n Arr.filter(\n (directive) =>\n isRange(directive) && isAfter(found)(directive) && names(found.rule)(directive),\n ),\n Arr.last,\n Option.exists((directive) => directive.kind === \"disable\"),\n );\n\nexport const suppressionsOf = (\n comments: readonly SourceComment[],\n): ((found: Suppressed) => boolean) => {\n const directives = pipe(comments, Arr.map(directiveOf), Arr.getSomes);\n return (found) => pipe(directives, Arr.some(coversLine(found))) || insideRange(directives)(found);\n};\n","import { present, reportedSeverity } from \"@masseater.dev/lint-host\";\nimport type { Song, SourceComment } from \"@r_masseater/song-format\";\nimport { soundingsOf } from \"@r_masseater/song-format/analysis\";\nimport type { Sounding } from \"@r_masseater/song-format/analysis\";\nimport { Array as Arr, Effect, Option, pipe } from \"effect\";\n\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport type { Diagnostic, Report } from \"#/shared/config/index.ts\";\nimport { failedWith } from \"#/shared/lib/errors.ts\";\nimport type { I68Error } from \"#/shared/lib/errors.ts\";\n\nimport { suppressionsOf } from \"./suppressions.ts\";\n\nexport interface RunInput {\n readonly path: string;\n readonly comments: readonly SourceComment[];\n readonly song: Song;\n readonly rules: readonly ResolvedRule[];\n}\n\nconst diagnosticOf =\n (path: string, rule: ResolvedRule) =>\n (report: Report): Diagnostic => ({\n path,\n line: report.line,\n rule: rule.id,\n message: report.message,\n severity: reportedSeverity(rule.setting),\n ...present(Option.fromNullishOr(report.column), (column) => ({ column })),\n ...present(Option.fromNullishOr(report.detail), (detail) => ({ detail })),\n });\n\nconst runOne = (\n input: RunInput,\n soundings: readonly Sounding[],\n): ((rule: ResolvedRule) => Effect.Effect<readonly Diagnostic[], I68Error>) =>\n Effect.fn(\"i68.rule\")(function* run(rule: ResolvedRule) {\n yield* Effect.annotateCurrentSpan({ \"i68.rule\": rule.id });\n const reports: Report[] = [];\n yield* Effect.try({\n try: () => {\n rule.rule.check({\n filename: input.path,\n song: input.song,\n soundings,\n options: rule.setting.options,\n report: (report) => {\n reports.push(report);\n },\n });\n },\n catch: failedWith(`${rule.id} failed`),\n });\n return pipe(reports, Arr.map(diagnosticOf(input.path, rule)));\n });\n\nexport const runRules = Effect.fn(\"i68.rules\")(function* runRules(input: RunInput) {\n const soundings = soundingsOf(input.song);\n const suppressed = suppressionsOf(input.comments);\n const found = yield* pipe(\n input.rules,\n Effect.forEach(runOne(input, soundings), { concurrency: 1 }),\n );\n return pipe(\n Arr.flatten(found),\n Arr.filter((diagnostic) => !suppressed(diagnostic)),\n );\n});\n","import { sortByPosition } from \"@masseater.dev/lint-host\";\nimport { readSong } from \"@r_masseater/song-format\";\nimport type { SourceIssue } from \"@r_masseater/song-format\";\nimport { Array as Arr, Effect, pipe } from \"effect\";\n\nimport { flattenConfig, resolve, unknownPlugins, unknownRules } from \"#/entities/rule/index.ts\";\nimport type { ResolvedRule } from \"#/entities/rule/index.ts\";\nimport { readSongFile } from \"#/features/read-songs/index.ts\";\nimport type { Read, SongFile } from \"#/features/read-songs/index.ts\";\nimport { runRules } from \"#/features/run-rules/index.ts\";\nimport type { Diagnostic, I68Config } from \"#/shared/config/index.ts\";\nimport { I68Error } from \"#/shared/lib/errors.ts\";\n\nconst PARSE_RULE = \"i68/parse\";\n\nexport interface LintInput {\n readonly root: string;\n readonly files: readonly string[];\n readonly read: Read;\n readonly config?: I68Config;\n}\n\nexport interface TextInput {\n readonly path: string;\n readonly text: string;\n readonly read?: Read;\n readonly config?: I68Config;\n}\n\nconst failIfAny =\n (problem: string) =>\n (names: readonly string[]): Effect.Effect<void, I68Error> =>\n Arr.match(names, {\n onEmpty: () => Effect.void,\n onNonEmpty: (found) =>\n Effect.fail(I68Error.make({ message: `${problem}: ${Arr.join(found, \", \")}` })),\n });\n\nconst UNKNOWN_PLUGINS = failIfAny(\"rules name plugins that are not configured\");\nconst UNKNOWN_RULES = failIfAny(\"rules name rules that their plugins do not have\");\n\nconst checkPlugins = (config: I68Config): Effect.Effect<void, I68Error> => {\n const rules = UNKNOWN_RULES(unknownRules(config));\n return UNKNOWN_PLUGINS(unknownPlugins(config)).pipe(Effect.andThen(rules));\n};\n\nconst rulesOf = (\n config: I68Config | undefined,\n): Effect.Effect<readonly ResolvedRule[], I68Error> => {\n const flat = flattenConfig(config ?? {});\n return checkPlugins(flat).pipe(Effect.as(resolve(flat)));\n};\n\nconst parseDiagnosticsOf =\n (file: string) =>\n (issues: readonly SourceIssue[]): readonly Diagnostic[] =>\n pipe(\n issues,\n Arr.map((issue): Diagnostic => ({\n path: file,\n line: issue.line,\n column: issue.column,\n rule: PARSE_RULE,\n message: issue.message,\n severity: \"error\",\n })),\n );\n\nconst lintFile =\n (rules: readonly ResolvedRule[]) =>\n (song: SongFile): Effect.Effect<readonly Diagnostic[], I68Error> => {\n if (song.source.status === \"invalid\") {\n return Effect.succeed(parseDiagnosticsOf(song.file)(song.source.issues));\n }\n return runRules({\n path: song.file,\n comments: song.source.outline.comments,\n song: song.source.song,\n rules,\n });\n };\n\nexport const lint = Effect.fn(\"i68.lint\")(function* lint(input: LintInput) {\n const rules = yield* rulesOf(input.config);\n const found = yield* Effect.all(\n pipe(\n input.files,\n Arr.map((file) =>\n readSongFile({ root: input.root, file, read: input.read }).pipe(\n Effect.flatMap(lintFile(rules)),\n ),\n ),\n ),\n { concurrency: \"unbounded\" },\n );\n return sortByPosition<Diagnostic>(Arr.flatten(found));\n});\n\nconst notFound = (path: string): Effect.Effect<string, I68Error> =>\n Effect.fail(I68Error.make({ message: `could not read ${path}` }));\n\nconst readerOf =\n (input: TextInput): Read =>\n (path) => {\n if (path === input.path) {\n return Effect.succeed(input.text);\n }\n return (input.read ?? notFound)(path);\n };\n\nexport const lintText = Effect.fn(\"i68.lintText\")(function* lintText(input: TextInput) {\n const rules = yield* rulesOf(input.config);\n const source = yield* readSong({ path: input.path, read: readerOf(input) });\n const found = yield* lintFile(rules)({ file: input.path, source });\n return sortByPosition<Diagnostic>(found);\n});\n","import { pathspecsOf, sectionOf } from \"@masseater.dev/lint-host\";\nimport type { PathspecRequest } from \"@masseater.dev/lint-host\";\n\nimport { flattenConfig } from \"#/entities/rule/index.ts\";\nimport type { I68Config } from \"#/shared/config/index.ts\";\n\nexport type PathspecInput = PathspecRequest<I68Config>;\n\nexport const i68Section = sectionOf<I68Config>({\n name: \"i68\",\n prepare: flattenConfig,\n fallback: {},\n});\n\nexport const songPathspecs = pathspecsOf({ defaults: [\"*.fumx\"] });\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;AAEF,MAAM,aAAa,UACjB,MAAM,MAAM,KAAK,CAAC,CAAC,KACjB,MAAM,KAAK,MAAM,cAAc,OAAO,KAAK,CAAC,GAC5C,MAAM,QAAQ,GAAG,aAAa,OAAO,gBAAgB,OAAO,CAAC,CAC/D;AAEF,MAAM,cAAc,SAAoB,UACtC,KACE,UAAU,KAAK,GACf,OAAO,aAAa,UAAU,OAAO,CAAC,GACtC,OAAO,MAAM;CACX,cAAc;CACd,SAAS,YAAuB,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,OAAO;AACrE,CAAC,CACH;AAEF,MAAa,eACX,WACwC;CACxC,MAAM,SAAoC,CAAC;CAC3C,KAAK,MAAM,CAAC,MAAM,UAAU,KAC1B,QACAA,MAAI,SAAS,UAAUC,OAAI,UAAU,SAAS,CAAC,CAAC,CAAC,CACnD,GACE,OAAO,QAAQ,KACbA,OAAI,IAAI,QAAQ,IAAI,GACpB,OAAO,MAAM;EACX,cAAc;EACd,SAAS,YAAY,WAAW,SAAS,KAAK;CAChD,CAAC,CACH;CAEF,OAAO;AACT;;ACrDA,MAAa,oBAAoB,YAC/B,MAAM,MAAM,QAAQ,QAAQ,CAAC,CAAC,KAC5B,MAAM,KAAK,cAAwC,MAAM,GACzD,MAAM,aAAuC,OAAO,CACtD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