@r_masseater/song-format 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +87 -0
- package/README.md +61 -2
- package/dist/app-CdpGdiWq.mjs +190 -0
- package/dist/app-CdpGdiWq.mjs.map +1 -0
- package/dist/convert-midi.d.mts +91 -0
- package/dist/convert-midi.mjs +918 -0
- package/dist/convert-midi.mjs.map +1 -0
- package/dist/fumx-language-server.mjs +23 -0
- package/dist/fumx-language-server.mjs.map +1 -0
- package/dist/mapper.mjs +14 -0
- package/dist/mapper.mjs.map +1 -0
- package/dist/midi-to-fumx.mjs +1128 -0
- package/dist/midi-to-fumx.mjs.map +1 -0
- package/dist/song-report.mjs +28 -0
- package/dist/song-report.mjs.map +1 -0
- package/dist/transform-C24h3upp.mjs +108 -0
- package/dist/transform-C24h3upp.mjs.map +1 -0
- package/dist/vite.d.mts +3 -0
- package/dist/vite.mjs +127 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +91 -3
- package/skills/use-fumx-tools/SKILL.md +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 masseater
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
@tanstack/eslint-plugin-start
|
|
26
|
+
|
|
27
|
+
MIT License
|
|
28
|
+
|
|
29
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
32
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
33
|
+
in the Software without restriction, including without limitation the rights
|
|
34
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
35
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
36
|
+
furnished to do so, subject to the following conditions:
|
|
37
|
+
|
|
38
|
+
The above copyright notice and this permission notice shall be included in all
|
|
39
|
+
copies or substantial portions of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
42
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
43
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
44
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
45
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
46
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
47
|
+
SOFTWARE.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
@typescript-eslint/utils
|
|
52
|
+
|
|
53
|
+
MIT License
|
|
54
|
+
|
|
55
|
+
Copyright (c) 2019 typescript-eslint and other contributors
|
|
56
|
+
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
in the Software without restriction, including without limitation the rights
|
|
60
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
furnished to do so, subject to the following conditions:
|
|
63
|
+
|
|
64
|
+
The above copyright notice and this permission notice shall be included in all
|
|
65
|
+
copies or substantial portions of the Software.
|
|
66
|
+
|
|
67
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
73
|
+
SOFTWARE.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
globals
|
|
78
|
+
|
|
79
|
+
MIT License
|
|
80
|
+
|
|
81
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
84
|
+
|
|
85
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @r_masseater/song-format
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tooling for `.fumx` songs: import a song from TypeScript with Vite, edit it with a language server, convert a MIDI file to `.fumx` with a check against the original, and print a report of its keys, chords and repeated bars.
|
|
4
|
+
|
|
5
|
+
It requires [Vite+](https://viteplus.dev/) and Node.js 26 or later. `effect` and `vite-plus` are peer dependencies. The grammar and the reader live in [`@r_masseater/fumx-parser`](https://www.npmjs.com/package/@r_masseater/fumx-parser).
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
vp add @r_masseater/song-format effect vite-plus
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import a song
|
|
12
|
+
|
|
13
|
+
Add the Vite plugin. TypeScript then reads a compiled song as a value.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { fumx } from "@r_masseater/song-format/vite";
|
|
17
|
+
import { defineConfig } from "vite-plus";
|
|
18
|
+
|
|
19
|
+
export default defineConfig({ plugins: [fumx()] });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { song } from "./song.fumx";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The plugin writes `song.d.fumx.ts` next to each song. For the TypeScript server to follow the import, list the package as a content mapper in `tsconfig.json`.
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"compilerOptions": { "allowArbitraryExtensions": true },
|
|
31
|
+
"contentMappers": [{ "package": "@r_masseater/song-format", "extensions": [".fumx"] }]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
`song-report <file>` prints, as JSON, the keys, chords and repeated bars derived from a song file. A reader that cannot listen to the song checks what was written from this output.
|
|
38
|
+
|
|
39
|
+
`midi-to-fumx <file>` converts a Standard MIDI File to `.fumx`. It reads the written `.fumx` back, compares it with the events of the original MIDI, and fails if even one differs.
|
|
40
|
+
|
|
41
|
+
`fumx-language-server` serves the `.fumx` language over stdio for editors.
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
vp exec song-report song.fumx
|
|
45
|
+
vp exec midi-to-fumx song.mid
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Convert from code
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { midiToFumx } from "@r_masseater/song-format/convert-midi";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`midiToFumx` takes a parsed MIDI file and returns the `.fumx` text. `compareWithMidi` reports how the written song differs from the original.
|
|
55
|
+
|
|
56
|
+
## Agent skills
|
|
57
|
+
|
|
58
|
+
The package ships agent skills in `skills/`. Add `permissions: { "@r_masseater/song-format": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Duration, Effect, Layer, Option } from "effect";
|
|
2
|
+
import * as NodeRuntime from "@effect/platform-node-shared/NodeRuntime";
|
|
3
|
+
import * as Layer$1 from "effect/Layer";
|
|
4
|
+
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
|
|
5
|
+
import * as NodePath from "@effect/platform-node-shared/NodePath";
|
|
6
|
+
import * as NodeStdio from "@effect/platform-node-shared/NodeStdio";
|
|
7
|
+
import * as NodeTerminal from "@effect/platform-node-shared/NodeTerminal";
|
|
8
|
+
import { FetchHttpClient } from "effect/http";
|
|
9
|
+
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
10
|
+
// \0rolldown/runtime.js
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __exportAll = (all, no_symbols) => {
|
|
16
|
+
let target = {};
|
|
17
|
+
for (var name in all) __defProp(target, name, {
|
|
18
|
+
get: all[name],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
22
|
+
return target;
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
26
|
+
key = keys[i];
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
28
|
+
get: ((k) => from[k]).bind(null, key),
|
|
29
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
35
|
+
Duration.fromInputUnsafe("2 seconds");
|
|
36
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js
|
|
37
|
+
/**
|
|
38
|
+
* Node.js process runner for Effect programs.
|
|
39
|
+
*
|
|
40
|
+
* This module exports `runMain`, which runs one Effect as the main process
|
|
41
|
+
* fiber in Node.js. It reuses the shared Node runtime runner, including its
|
|
42
|
+
* error reporting, `SIGINT` / `SIGTERM` interruption, and optional teardown
|
|
43
|
+
* behavior.
|
|
44
|
+
*
|
|
45
|
+
* @stability unstable
|
|
46
|
+
* @since 4.0.0
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Helps you run a main effect with built-in error handling, logging, and signal management.
|
|
50
|
+
*
|
|
51
|
+
* **When to use**
|
|
52
|
+
*
|
|
53
|
+
* Use to run a Node.js application's main Effect with structured error
|
|
54
|
+
* handling, log management, interrupt support, or advanced teardown
|
|
55
|
+
* capabilities.
|
|
56
|
+
*
|
|
57
|
+
* **Details**
|
|
58
|
+
*
|
|
59
|
+
* This function launches an Effect as the main entry point, setting exit codes
|
|
60
|
+
* based on success or failure, handling interrupts (e.g., Ctrl+C), and optionally
|
|
61
|
+
* logging errors. By default, it logs errors and uses a "pretty" format, but both
|
|
62
|
+
* behaviors can be turned off. You can also provide custom teardown logic to
|
|
63
|
+
* finalize resources or produce different exit codes.
|
|
64
|
+
*
|
|
65
|
+
* The optional configuration object can include:
|
|
66
|
+
* - `disableErrorReporting`: Turn off automatic error logging.
|
|
67
|
+
* - `teardown`: Provide custom finalization logic.
|
|
68
|
+
*
|
|
69
|
+
* @stability unstable
|
|
70
|
+
* @category running
|
|
71
|
+
* @since 4.0.0
|
|
72
|
+
*/
|
|
73
|
+
const runMain$1 = NodeRuntime.runMain;
|
|
74
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeChildProcessSpawner.js
|
|
75
|
+
var NodeChildProcessSpawner_exports = /* @__PURE__ */ __exportAll({});
|
|
76
|
+
import * as import__effect_platform_node_shared_NodeChildProcessSpawner from "@effect/platform-node-shared/NodeChildProcessSpawner";
|
|
77
|
+
__reExport(NodeChildProcessSpawner_exports, import__effect_platform_node_shared_NodeChildProcessSpawner);
|
|
78
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
|
|
79
|
+
/**
|
|
80
|
+
* Node.js `FileSystem` layer for programs that perform real filesystem I/O.
|
|
81
|
+
*
|
|
82
|
+
* The exported layer satisfies the platform-independent `FileSystem` service
|
|
83
|
+
* with Node-backed operations for files, directories, metadata, permissions,
|
|
84
|
+
* links, temporary paths, and path watching. Effects still call the service from
|
|
85
|
+
* `effect/FileSystem`; this module only chooses the Node implementation.
|
|
86
|
+
*
|
|
87
|
+
* @stability unstable
|
|
88
|
+
* @since 4.0.0
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Provides the `FileSystem` service backed by Node filesystem APIs.
|
|
92
|
+
*
|
|
93
|
+
* @stability unstable
|
|
94
|
+
* @category layers
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*/
|
|
97
|
+
const layer$4 = NodeFileSystem.layer;
|
|
98
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodePath.js
|
|
99
|
+
/**
|
|
100
|
+
* Node.js layers for Effect's `Path` service.
|
|
101
|
+
*
|
|
102
|
+
* This module provides the default, POSIX, and Windows variants of the
|
|
103
|
+
* platform-independent `Path` service by reusing the shared Node path
|
|
104
|
+
* implementation. The provided path services include Node file URL conversion
|
|
105
|
+
* behavior.
|
|
106
|
+
*
|
|
107
|
+
* @stability unstable
|
|
108
|
+
* @since 4.0.0
|
|
109
|
+
*/
|
|
110
|
+
/**
|
|
111
|
+
* Provides the default Node `Path` service using the platform's `node:path`
|
|
112
|
+
* implementation.
|
|
113
|
+
*
|
|
114
|
+
* @stability unstable
|
|
115
|
+
* @category layers
|
|
116
|
+
* @since 4.0.0
|
|
117
|
+
*/
|
|
118
|
+
const layer$3 = NodePath.layer;
|
|
119
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeStdio.js
|
|
120
|
+
/**
|
|
121
|
+
* Node.js `Stdio` layer for the current process.
|
|
122
|
+
*
|
|
123
|
+
* The exported layer reuses the shared Node stdio implementation. It satisfies
|
|
124
|
+
* the platform-independent `Stdio` service by reading command-line arguments
|
|
125
|
+
* from `process.argv`, consuming input from `process.stdin`, and writing output
|
|
126
|
+
* streams to `process.stdout` and `process.stderr`.
|
|
127
|
+
*
|
|
128
|
+
* @stability unstable
|
|
129
|
+
* @since 4.0.0
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Provides the `Stdio` service backed by the current process arguments,
|
|
133
|
+
* stdin, stdout, and stderr streams.
|
|
134
|
+
*
|
|
135
|
+
* @stability unstable
|
|
136
|
+
* @category layers
|
|
137
|
+
* @since 4.0.0
|
|
138
|
+
*/
|
|
139
|
+
const layer$2 = NodeStdio.layer;
|
|
140
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeTerminal.js
|
|
141
|
+
/**
|
|
142
|
+
* Node.js implementation of the Effect `Terminal` service.
|
|
143
|
+
*
|
|
144
|
+
* This module reuses the shared Node terminal implementation. `make` creates a
|
|
145
|
+
* scoped process-backed `Terminal` service, and `layer` provides the default
|
|
146
|
+
* service with the standard quit behavior for key input.
|
|
147
|
+
*
|
|
148
|
+
* @stability unstable
|
|
149
|
+
* @since 4.0.0
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Provides the default process-backed `Terminal` service, ending key input on
|
|
153
|
+
* bare Esc, Ctrl+C, or Ctrl+D.
|
|
154
|
+
*
|
|
155
|
+
* @stability unstable
|
|
156
|
+
* @category layers
|
|
157
|
+
* @since 4.0.0
|
|
158
|
+
*/
|
|
159
|
+
const layer$1 = NodeTerminal.layer;
|
|
160
|
+
// ../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeServices.js
|
|
161
|
+
/**
|
|
162
|
+
* Provides the default Node implementations for child process spawning,
|
|
163
|
+
* filesystem, path, stdio, and terminal services.
|
|
164
|
+
*
|
|
165
|
+
* @stability unstable
|
|
166
|
+
* @category layers
|
|
167
|
+
* @since 4.0.0
|
|
168
|
+
*/
|
|
169
|
+
const layer = /*#__PURE__*/ Layer$1.provideMerge(NodeChildProcessSpawner_exports.layer, /*#__PURE__*/ Layer$1.mergeAll(layer$4, layer$3, layer$2, layer$1));
|
|
170
|
+
// ../node-main/src/features/run-main/model/run-main.ts
|
|
171
|
+
const platform = Layer.mergeAll(layer, FetchHttpClient.layer);
|
|
172
|
+
const runWithTracingAnd = ({ serviceName, services, onFailure }) => (program) => {
|
|
173
|
+
const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));
|
|
174
|
+
const provided = Layer.provideMerge(services, platform);
|
|
175
|
+
const report = Option.fromNullishOr(onFailure);
|
|
176
|
+
const reported = Option.match(report, {
|
|
177
|
+
onNone: () => program,
|
|
178
|
+
onSome: (handler) => Effect.tapCause(program, handler)
|
|
179
|
+
});
|
|
180
|
+
runMain$1(Layer.mergeAll(tracing, provided).pipe(Layer.build, Effect.flatMap((context) => Effect.provideContext(reported, context)), Effect.scoped), { disableErrorReporting: Option.isSome(report) });
|
|
181
|
+
};
|
|
182
|
+
const runWithTracing = (serviceName) => runWithTracingAnd({
|
|
183
|
+
serviceName,
|
|
184
|
+
services: Layer.empty
|
|
185
|
+
});
|
|
186
|
+
/** @internal */
|
|
187
|
+
const runMain = runWithTracing;
|
|
188
|
+
export { runMain as t };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=app-CdpGdiWq.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-CdpGdiWq.mjs","names":["runMain","layer","layer","layer","layer","NodeChildProcessSpawner","NodeFileSystem.layer","NodePath.layer","NodeStdio.layer","NodeTerminal.layer","nodeServices"],"sources":["../../node-main/src/features/watch-parent/model/parent-process.ts","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeChildProcessSpawner.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodePath.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeStdio.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeTerminal.js","../../../node_modules/.pnpm/@effect+platform-node@4.1.5_effect@4.1.5_redis@6.2.1_@opentelemetry+api@1.10.0_/node_modules/@effect/platform-node/dist/NodeServices.js","../../node-main/src/features/run-main/model/run-main.ts"],"sourcesContent":["import { Duration, Effect, Option, Schedule, pipe } from \"effect\";\n\nconst PARENT_CHECK_INTERVAL = Duration.fromInputUnsafe(\"2 seconds\");\nconst SIGNAL_PROBE = 0;\n\nconst isAlive = (pid: number): boolean => {\n try {\n return globalThis.process.kill(pid, SIGNAL_PROBE);\n } catch {\n return false;\n }\n};\n\nconst untilExits = (pid: number): Effect.Effect<void> =>\n Effect.sync(() => isAlive(pid)).pipe(\n Effect.repeat({ schedule: Schedule.spaced(PARENT_CHECK_INTERVAL), while: (alive) => alive }),\n Effect.asVoid,\n );\n\nexport const whileParentAlive =\n (parentPid: Option.Option<string>) =>\n <Value, Failure, Requirements>(\n program: Effect.Effect<Value, Failure, Requirements>,\n ): Effect.Effect<void, Failure, Requirements> =>\n Effect.raceFirst(\n Effect.asVoid(program),\n pipe(\n parentPid,\n Option.map((pid) => untilExits(globalThis.Number(pid))),\n Option.getOrElse(() => Effect.never),\n ),\n );\n","/**\n * Node.js process runner for Effect programs.\n *\n * This module exports `runMain`, which runs one Effect as the main process\n * fiber in Node.js. It reuses the shared Node runtime runner, including its\n * error reporting, `SIGINT` / `SIGTERM` interruption, and optional teardown\n * behavior.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as NodeRuntime from \"@effect/platform-node-shared/NodeRuntime\";\n/**\n * Helps you run a main effect with built-in error handling, logging, and signal management.\n *\n * **When to use**\n *\n * Use to run a Node.js application's main Effect with structured error\n * handling, log management, interrupt support, or advanced teardown\n * capabilities.\n *\n * **Details**\n *\n * This function launches an Effect as the main entry point, setting exit codes\n * based on success or failure, handling interrupts (e.g., Ctrl+C), and optionally\n * logging errors. By default, it logs errors and uses a \"pretty\" format, but both\n * behaviors can be turned off. You can also provide custom teardown logic to\n * finalize resources or produce different exit codes.\n *\n * The optional configuration object can include:\n * - `disableErrorReporting`: Turn off automatic error logging.\n * - `teardown`: Provide custom finalization logic.\n *\n * @stability unstable\n * @category running\n * @since 4.0.0\n */\nexport const runMain = NodeRuntime.runMain;\n//# sourceMappingURL=NodeRuntime.js.map","/**\n * Node.js implementation of `ChildProcessSpawner`.\n *\n * @stability unstable\n * @since 4.0.0\n */\nexport * from \"@effect/platform-node-shared/NodeChildProcessSpawner\";\n//# sourceMappingURL=NodeChildProcessSpawner.js.map","/**\n * Node.js `FileSystem` layer for programs that perform real filesystem I/O.\n *\n * The exported layer satisfies the platform-independent `FileSystem` service\n * with Node-backed operations for files, directories, metadata, permissions,\n * links, temporary paths, and path watching. Effects still call the service from\n * `effect/FileSystem`; this module only chooses the Node implementation.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as NodeFileSystem from \"@effect/platform-node-shared/NodeFileSystem\";\n/**\n * Provides the `FileSystem` service backed by Node filesystem APIs.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeFileSystem.layer;\n//# sourceMappingURL=NodeFileSystem.js.map","/**\n * Node.js layers for Effect's `Path` service.\n *\n * This module provides the default, POSIX, and Windows variants of the\n * platform-independent `Path` service by reusing the shared Node path\n * implementation. The provided path services include Node file URL conversion\n * behavior.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as NodePath from \"@effect/platform-node-shared/NodePath\";\n/**\n * Provides the default Node `Path` service using the platform's `node:path`\n * implementation.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodePath.layer;\n/**\n * Provides the `Path` service using Node's POSIX path implementation,\n * regardless of the host platform.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layerPosix = NodePath.layerPosix;\n/**\n * Provides the `Path` service using Node's Windows path implementation,\n * regardless of the host platform.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layerWin32 = NodePath.layerWin32;\n//# sourceMappingURL=NodePath.js.map","/**\n * Node.js `Stdio` layer for the current process.\n *\n * The exported layer reuses the shared Node stdio implementation. It satisfies\n * the platform-independent `Stdio` service by reading command-line arguments\n * from `process.argv`, consuming input from `process.stdin`, and writing output\n * streams to `process.stdout` and `process.stderr`.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as NodeStdio from \"@effect/platform-node-shared/NodeStdio\";\n/**\n * Provides the `Stdio` service backed by the current process arguments,\n * stdin, stdout, and stderr streams.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeStdio.layer;\n//# sourceMappingURL=NodeStdio.js.map","/**\n * Node.js implementation of the Effect `Terminal` service.\n *\n * This module reuses the shared Node terminal implementation. `make` creates a\n * scoped process-backed `Terminal` service, and `layer` provides the default\n * service with the standard quit behavior for key input.\n *\n * @stability unstable\n * @since 4.0.0\n */\nimport * as NodeTerminal from \"@effect/platform-node-shared/NodeTerminal\";\n/**\n * Creates a scoped `Terminal` service backed by process stdin/stdout.\n * By default, Esc, Ctrl+C, and Ctrl+D end key input. Supply `shouldQuit` to\n * override these quit keys.\n *\n * @stability unstable\n * @category constructors\n * @since 4.0.0\n */\nexport const make = NodeTerminal.make;\n/**\n * Provides the default process-backed `Terminal` service, ending key input on\n * bare Esc, Ctrl+C, or Ctrl+D.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layer = NodeTerminal.layer;\n//# sourceMappingURL=NodeTerminal.js.map","import * as Layer from \"effect/Layer\";\nimport * as NodeChildProcessSpawner from \"./NodeChildProcessSpawner.js\";\nimport * as NodeFileSystem from \"./NodeFileSystem.js\";\nimport * as NodePath from \"./NodePath.js\";\nimport * as NodeStdio from \"./NodeStdio.js\";\nimport * as NodeTerminal from \"./NodeTerminal.js\";\n/**\n * Provides the default Node implementations for child process spawning,\n * filesystem, path, stdio, and terminal services.\n *\n * @stability unstable\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.provideMerge(NodeChildProcessSpawner.layer, /*#__PURE__*/Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer, NodeTerminal.layer));\n//# sourceMappingURL=NodeServices.js.map","import { runMain as nodeRuntimeRunMain } from \"@effect/platform-node/NodeRuntime\";\nimport { layer as nodeServices } from \"@effect/platform-node/NodeServices\";\nimport type { NodeServices } from \"@effect/platform-node/NodeServices\";\nimport { Effect, Layer, Option } from \"effect\";\nimport type { Cause } from \"effect\";\nimport { FetchHttpClient } from \"effect/http\";\nimport type { HttpClient } from \"effect/http\";\nimport { Otlp, OtlpSerialization } from \"effect/observability\";\n\n/** @internal */\nexport type Platform = NodeServices | HttpClient.HttpClient;\n\n/** @internal */\nexport type Run<Provided> = <Success, Failure>(\n program: Effect.Effect<Success, Failure, Platform | Provided>,\n) => void;\n\n/** @internal */\nexport type Report<Provided> = <Failure>(\n cause: Cause.Cause<Failure>,\n) => Effect.Effect<void, never, Platform | Provided>;\n\nconst platform = Layer.mergeAll(nodeServices, FetchHttpClient.layer);\n\nconst runWithTracingAnd =\n <Provided, LayerFailure>({\n serviceName,\n services,\n onFailure,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n onFailure?: Report<Provided>;\n }>): Run<Provided> =>\n (program) => {\n const tracing = Otlp.layerFromConfig({ resource: { serviceName } }).pipe(\n Layer.provide(OtlpSerialization.layerJson),\n Layer.provide(FetchHttpClient.layer),\n );\n const provided = Layer.provideMerge(services, platform);\n const report = Option.fromNullishOr(onFailure);\n const reported = Option.match(report, {\n onNone: () => program,\n onSome: (handler) => Effect.tapCause(program, handler),\n });\n nodeRuntimeRunMain(\n Layer.mergeAll(tracing, provided).pipe(\n Layer.build,\n Effect.flatMap((context) => Effect.provideContext(reported, context)),\n Effect.scoped,\n ),\n { disableErrorReporting: Option.isSome(report) },\n );\n };\n\nconst runWithTracing = (serviceName: string): Run<never> =>\n runWithTracingAnd({ serviceName, services: Layer.empty });\n\n/** @internal */\nexport const runMainWith = runWithTracingAnd;\n\n/** @internal */\nexport const runMain = runWithTracing;\n"],"ignoreList":[1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE8B,SAAS,gBAAgB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmClE,MAAaA,YAAU,YAAY;;;;;;;;;;;;;;;;;;;;;;;;AElBnC,MAAaC,UAAQ,eAAe;;;;;;;;;;;;;;;;;;;;;ACCpC,MAAaC,UAAQ,SAAS;;;;;;;;;;;;;;;;;;;;;ACA9B,MAAaC,UAAQ,UAAU;;;;;;;;;;;;;;;;;;;;ACS/B,MAAaC,UAAQ,aAAa;;;;;;;;;;ACflC,MAAa,QAAqB,sBAAM,aAAaC,gCAAwB,OAAoB,sBAAM,SAASC,SAAsBC,SAAgBC,SAAiBC,OAAkB,CAAC;;ACQ1L,MAAM,WAAW,MAAM,SAASC,OAAc,gBAAgB,KAAK;AAEnE,MAAM,qBACqB,EACvB,aACA,UACA,iBAMD,YAAY;CACX,MAAM,UAAU,KAAK,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,KAClE,MAAM,QAAQ,kBAAkB,SAAS,GACzC,MAAM,QAAQ,gBAAgB,KAAK,CACrC;CACA,MAAM,WAAW,MAAM,aAAa,UAAU,QAAQ;CACtD,MAAM,SAAS,OAAO,cAAc,SAAS;CAC7C,MAAM,WAAW,OAAO,MAAM,QAAQ;EACpC,cAAc;EACd,SAAS,YAAY,OAAO,SAAS,SAAS,OAAO;CACvD,CAAC;CACD,UACE,MAAM,SAAS,SAAS,QAAQ,CAAC,CAAC,KAChC,MAAM,OACN,OAAO,SAAS,YAAY,OAAO,eAAe,UAAU,OAAO,CAAC,GACpE,OAAO,MACT,GACA,EAAE,uBAAuB,OAAO,OAAO,MAAM,EAAE,CACjD;AACF;AAEF,MAAM,kBAAkB,gBACtB,kBAAkB;CAAE;CAAa,UAAU,MAAM;AAAM,CAAC;;AAM1D,MAAa,UAAU"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { Controller } from "@r_masseater/fumx-parser";
|
|
3
|
+
interface Timed {
|
|
4
|
+
readonly tick: number;
|
|
5
|
+
}
|
|
6
|
+
interface TimelineNote extends Timed {
|
|
7
|
+
readonly end: number;
|
|
8
|
+
readonly midi: number;
|
|
9
|
+
readonly velocity: number;
|
|
10
|
+
readonly release: number;
|
|
11
|
+
}
|
|
12
|
+
interface TimelineControl extends Timed {
|
|
13
|
+
readonly controller: Controller;
|
|
14
|
+
readonly value: number;
|
|
15
|
+
}
|
|
16
|
+
interface Text extends Timed {
|
|
17
|
+
readonly text: string;
|
|
18
|
+
}
|
|
19
|
+
interface Part {
|
|
20
|
+
readonly track: number;
|
|
21
|
+
readonly channel: number;
|
|
22
|
+
readonly name: Option.Option<string>;
|
|
23
|
+
readonly program: Option.Option<number>;
|
|
24
|
+
readonly notes: readonly TimelineNote[];
|
|
25
|
+
readonly controls: readonly TimelineControl[];
|
|
26
|
+
readonly lyrics: readonly Text[];
|
|
27
|
+
}
|
|
28
|
+
interface LaidTempo {
|
|
29
|
+
readonly offset: number;
|
|
30
|
+
readonly length: number;
|
|
31
|
+
readonly microseconds: number;
|
|
32
|
+
readonly target: Option.Option<number>;
|
|
33
|
+
}
|
|
34
|
+
interface Span {
|
|
35
|
+
readonly start: number;
|
|
36
|
+
readonly length: number;
|
|
37
|
+
}
|
|
38
|
+
interface LaidBar extends Span {
|
|
39
|
+
readonly meter: string;
|
|
40
|
+
readonly tempo: readonly LaidTempo[];
|
|
41
|
+
readonly marks: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
interface Group {
|
|
44
|
+
readonly start: number;
|
|
45
|
+
readonly end: number;
|
|
46
|
+
readonly midis: readonly number[];
|
|
47
|
+
readonly velocity: number;
|
|
48
|
+
readonly release: number;
|
|
49
|
+
readonly lyric: Option.Option<string>;
|
|
50
|
+
}
|
|
51
|
+
type Line = readonly Group[];
|
|
52
|
+
type Source = {
|
|
53
|
+
readonly kind: "instrument";
|
|
54
|
+
readonly instrument: string;
|
|
55
|
+
readonly program: number;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "kit";
|
|
58
|
+
};
|
|
59
|
+
interface PlannedPart {
|
|
60
|
+
readonly part: Part;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly source: Source;
|
|
63
|
+
readonly lines: readonly Line[];
|
|
64
|
+
readonly controls: readonly TimelineControl[];
|
|
65
|
+
}
|
|
66
|
+
interface Plan {
|
|
67
|
+
readonly parts: readonly PlannedPart[];
|
|
68
|
+
readonly instruments: ReadonlyMap<number, string>;
|
|
69
|
+
readonly drumVoices: ReadonlyMap<number, string>;
|
|
70
|
+
}
|
|
71
|
+
interface Written {
|
|
72
|
+
readonly text: string;
|
|
73
|
+
readonly plan: Plan;
|
|
74
|
+
readonly bars: readonly LaidBar[];
|
|
75
|
+
}
|
|
76
|
+
declare const UnreadableMidi_base: Schema.Class<UnreadableMidi, Schema.TaggedStruct<"UnreadableMidi", {
|
|
77
|
+
readonly message: Schema.String;
|
|
78
|
+
}>, import("effect/Cause").YieldableError & {
|
|
79
|
+
readonly brand: unique symbol;
|
|
80
|
+
}>;
|
|
81
|
+
export declare class UnreadableMidi extends UnreadableMidi_base {}
|
|
82
|
+
interface MidiFile {
|
|
83
|
+
readonly bytes: Uint8Array;
|
|
84
|
+
readonly title: string;
|
|
85
|
+
}
|
|
86
|
+
interface Fumx extends Written {
|
|
87
|
+
readonly offGrid: number;
|
|
88
|
+
}
|
|
89
|
+
export declare const midiToFumx: (input: MidiFile) => Effect.Effect<Fumx, UnreadableMidi, never>;
|
|
90
|
+
export type { Fumx, MidiFile };
|
|
91
|
+
//# sourceMappingURL=convert-midi.d.mts.map
|