@r_masseater/song-format 0.2.1 → 0.2.2
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/als-to-fumx.mjs +2 -2
- package/dist/fumx-language-server.mjs +1 -1
- package/dist/{fumx-module-CqxUe07y.mjs → fumx-module-BfH5pPUU.mjs} +26 -3
- package/dist/fumx-module-BfH5pPUU.mjs.map +1 -0
- package/dist/{fumx-module-CtXvLKU1.mjs → fumx-module-C1v5AGSG.mjs} +26 -3
- package/dist/fumx-module-C1v5AGSG.mjs.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/language.mjs +1 -1
- package/dist/mapper.mjs +1 -1
- package/dist/midi-to-fumx.mjs +2 -2
- package/dist/{run-main-Bf32CgzU.mjs → package-BhGdZERV.mjs} +4 -2
- package/dist/package-BhGdZERV.mjs.map +1 -0
- package/dist/{read-song-CzMPm8u8.mjs → read-song-CmIfnGfX.mjs} +11 -5
- package/dist/read-song-CmIfnGfX.mjs.map +1 -0
- package/dist/{read-song-BzqX5MuZ.mjs → read-song-ypQjpC0y.mjs} +11 -5
- package/dist/read-song-ypQjpC0y.mjs.map +1 -0
- package/dist/{round-trip-Cz8iQlpW.mjs → round-trip-CIXCochn.mjs} +5 -5
- package/dist/round-trip-CIXCochn.mjs.map +1 -0
- package/dist/song-report.mjs +4 -4
- package/dist/song-report.mjs.map +1 -1
- package/dist/{transform-BoSDqqPW.mjs → transform-MqcJm-I-.mjs} +2 -2
- package/dist/{transform-BoSDqqPW.mjs.map → transform-MqcJm-I-.mjs.map} +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +2 -2
- package/dist/fumx-module-CqxUe07y.mjs.map +0 -1
- package/dist/fumx-module-CtXvLKU1.mjs.map +0 -1
- package/dist/read-song-BzqX5MuZ.mjs.map +0 -1
- package/dist/read-song-CzMPm8u8.mjs.map +0 -1
- package/dist/round-trip-Cz8iQlpW.mjs.map +0 -1
- package/dist/run-main-Bf32CgzU.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-
|
|
1
|
+
{"version":3,"file":"transform-MqcJm-I-.mjs","names":["Arr","Rec"],"sources":["../src/features/build-song-module/model/song-module.ts","../src/app/transform.ts"],"sourcesContent":["import { nameLiteral, quoted, text } from \"@r_masseater/mapped-import\";\nimport type { Segment } from \"@r_masseater/mapped-import\";\nimport type { Issue, Mapped } from \"@r_masseater/mapped-import/mapper\";\nimport { Array as Arr, Effect, Option, Record as Rec, Schema, pipe } from \"effect\";\n\nimport { SongSchema } from \"#/entities/song/index.ts\";\nimport type { Song } from \"#/entities/song/index.ts\";\nimport { readSong } from \"#/features/read-song/@x/build-song-module.ts\";\nimport type {\n Named,\n Outline,\n SongSource,\n SourceIssue,\n} from \"#/features/read-song/@x/build-song-module.ts\";\n\nexport interface SongModuleSource<Failure> {\n readonly path: string;\n readonly content: string;\n readonly read: (path: string) => Effect.Effect<string, Failure>;\n}\n\nexport interface SongModule {\n readonly mapped: Mapped;\n readonly song: Option.Option<Song>;\n readonly files: readonly string[];\n}\n\ntype NamedField = {\n readonly [Field in keyof Song]: Song[Field] extends readonly { readonly name: string }[]\n ? Field\n : never;\n}[keyof Song];\n\nconst NAMED_FIELDS = {\n samples: \"Sample\",\n kits: \"Kit\",\n instruments: \"Instrument\",\n buses: \"Bus\",\n tracks: \"Track\",\n plugins: \"Plugin\",\n} as const satisfies Readonly<Record<NamedField, Named[\"$type\"]>>;\n\nconst SONG_MODULE = \"@r_masseater/song-format\";\n\nconst NEVER_SONG = \"export declare const song: never;\\n\";\n\nconst titleSegments = (song: Song, outline: Outline): readonly Segment[] =>\n Option.match(outline.title, {\n onNone: () => [text(quoted(song.title))],\n onSome: ({ start, end }): readonly Segment[] => [\n { kind: \"alias\", text: quoted(song.title), start, end },\n ],\n });\n\nconst fieldSegments =\n (song: Song, outline: Outline) =>\n ([field, type]: readonly [NamedField, Named[\"$type\"]]): readonly Segment[] => [\n text(` readonly ${field}: readonly [\\n`),\n ...pipe(\n song[field],\n Arr.flatMap(({ name }) => [\n text(` Song[\"${field}\"][number] & { readonly name: `),\n ...nameLiteral({\n name,\n span: pipe(\n outline.names,\n Arr.findFirst((found) => found.type === type && found.name === name),\n Option.map((found) => found.span),\n ),\n }),\n text(\" },\\n\"),\n ]),\n ),\n text(\" ];\\n\"),\n ];\n\nconst segmentsOf = (song: Song, outline: Outline): readonly Segment[] => [\n text(`import type { Song } from \"${SONG_MODULE}\";\\n`),\n text(\"export declare const song: Song & {\\n readonly title: \"),\n ...titleSegments(song, outline),\n text(\";\\n\"),\n ...pipe(Rec.toEntries(NAMED_FIELDS), Arr.flatMap(fieldSegments(song, outline))),\n text(\"};\\n\"),\n];\n\nconst issueOf =\n ({ path, outline }: Readonly<{ path: string; outline: Outline }>) =>\n (issue: SourceIssue): Issue => {\n if (issue.path === path) {\n return { message: issue.message, start: issue.start, end: issue.end };\n }\n const at = pipe(\n outline.imports,\n Arr.findFirst((found) => found.path === issue.path),\n Option.map((found) => found.span),\n Option.getOrElse(() => ({ start: 0, end: 0 })),\n );\n return {\n message: `${issue.path}:${String(issue.line)}:${String(issue.column)} ${issue.message}`,\n ...at,\n };\n };\n\nconst moduleOf =\n (path: string) =>\n (source: SongSource): SongModule => {\n if (source.status === \"invalid\") {\n return {\n mapped: {\n status: \"error\",\n fallback: NEVER_SONG,\n issues: pipe(source.issues, Arr.map(issueOf({ path, outline: source.outline }))),\n },\n song: Option.none(),\n files: source.outline.files,\n };\n }\n return {\n mapped: { status: \"ok\", segments: segmentsOf(source.song, source.outline) },\n song: Option.some(source.song),\n files: source.outline.files,\n };\n };\n\nexport const songModuleOf = <Failure>({\n path,\n content,\n read,\n}: SongModuleSource<Failure>): Effect.Effect<SongModule> =>\n readSong({\n path,\n read: (target) => {\n if (target === path) {\n return Effect.succeed(content);\n }\n return read(target);\n },\n }).pipe(Effect.map(moduleOf(path)));\n\nconst encodeSong = Schema.encodeEffect(Schema.fromJsonString(SongSchema));\n\nexport const songCodeOf = (song: Song): Effect.Effect<string> =>\n encodeSong(song).pipe(\n Effect.orDie,\n Effect.map(\n (json) =>\n `import { Schema } from \"effect\";\\nimport { SongSchema } from \"${SONG_MODULE}\";\\nexport const song = Schema.decodeSync(Schema.fromJsonString(SongSchema))(${quoted(json)});\\n`,\n ),\n );\n","import { NodeFileSystem } from \"@effect/platform-node-shared\";\nimport { mappedOutput } from \"@r_masseater/mapped-import/mapper\";\nimport type { Request } from \"@r_masseater/mapped-import/mapper\";\nimport { Effect, FileSystem, ManagedRuntime } from \"effect\";\nimport type { TransformResult } from \"ts-content-mapper\";\n\nimport { songModuleOf } from \"#/features/build-song-module/index.ts\";\n\nconst transformSong = Effect.fn(\"transformSong\")(function* transformSong(request: Request) {\n const fileSystem = yield* FileSystem.FileSystem;\n const { mapped } = yield* songModuleOf({\n path: request.fileName,\n content: request.content,\n read: (path) => fileSystem.readFileString(path),\n });\n return mappedOutput({ request, mapped });\n});\n\nconst runtime = ManagedRuntime.make(NodeFileSystem.layer);\n\nexport const transform = (request: Request): Promise<TransformResult> =>\n runtime.runPromise(transformSong(request));\n"],"mappings":";;;;;;;AAiCA,MAAM,eAAe;CACnB,SAAS;CACT,MAAM;CACN,aAAa;CACb,OAAO;CACP,QAAQ;CACR,SAAS;AACX;AAEA,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,MAAM,iBAAiB,MAAY,YACjC,OAAO,MAAM,QAAQ,OAAO;CAC1B,cAAc,CAAC,KAAK,OAAO,KAAK,KAAK,CAAC,CAAC;CACvC,SAAS,EAAE,OAAO,UAA8B,CAC9C;EAAE,MAAM;EAAS,MAAM,OAAO,KAAK,KAAK;EAAG;EAAO;CAAI,CACxD;AACF,CAAC;AAEH,MAAM,iBACH,MAAY,aACZ,CAAC,OAAO,UAAqE;CAC5E,KAAK,cAAc,MAAM,eAAe;CACxC,GAAG,KACD,KAAK,QACLA,MAAI,SAAS,EAAE,WAAW;EACxB,KAAK,aAAa,MAAM,+BAA+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OAAO,MAAM,OAAO,OAAO;EAAE;EAC1E,MAAM,OAAO,KAAK,OAAO,IAAI;EAC7B,OAAO,OAAO,QAAQ;CACxB;AACF;AAEF,MAAa,gBAAyB,EACpC,MACA,SACA,WAEA,SAAS;CACP;CACA,OAAO,WAAW;EAChB,IAAI,WAAW,MACb,OAAO,OAAO,QAAQ,OAAO;EAE/B,OAAO,KAAK,MAAM;CACpB;AACF,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,SAAS,IAAI,CAAC,CAAC;AAEjB,OAAO,aAAa,OAAO,eAAe,UAAU,CAAC;;ACnIxE,MAAM,gBAAgB,OAAO,GAAG,eAAe,CAAC,CAAC,UAAU,cAAc,SAAkB;CACzF,MAAM,aAAa,OAAO,WAAW;CACrC,MAAM,EAAE,WAAW,OAAO,aAAa;EACrC,MAAM,QAAQ;EACd,SAAS,QAAQ;EACjB,OAAO,SAAS,WAAW,eAAe,IAAI;CAChD,CAAC;CACD,OAAO,aAAa;EAAE;EAAS;CAAO,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,eAAe,KAAK,eAAe,KAAK;AAExD,MAAa,aAAa,YACxB,QAAQ,WAAW,cAAc,OAAO,CAAC"}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as SongSchema } from "./song-CYFBSTbH.mjs";
|
|
2
|
-
import { t as readSong } from "./read-song-
|
|
3
|
-
import { l as FumxLanguageMetaData } from "./fumx-module-
|
|
2
|
+
import { t as readSong } from "./read-song-CmIfnGfX.mjs";
|
|
3
|
+
import { l as FumxLanguageMetaData } from "./fumx-module-C1v5AGSG.mjs";
|
|
4
4
|
import { Array, Effect, Match, Option, Record, Schema, pipe } from "effect";
|
|
5
5
|
import { nameLiteral, quoted, renderSegments, text } from "@r_masseater/mapped-import";
|
|
6
6
|
import { contentImport } from "@r_masseater/mapped-import/vite";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r_masseater/song-format",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "The .fumx song format: a reader that turns a song into a typed value, key and chord analysis, import from TypeScript with Vite, a language server, MIDI and Ableton Live Set conversion that checks the result against the original, and a song report.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fumx",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@effect/vitest": "4.1.5",
|
|
88
88
|
"@r_masseater/mapped-import": "^0.1.0",
|
|
89
89
|
"@r_masseater/node-main": "0.1.0",
|
|
90
|
-
"@r_masseater/song-format": "0.2.
|
|
90
|
+
"@r_masseater/song-format": "0.2.2",
|
|
91
91
|
"@types/node": "26.6.10",
|
|
92
92
|
"effect": "4.1.5",
|
|
93
93
|
"langium-cli": "4.4.1",
|