astro-lilypond 0.5.0 → 0.5.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.
Files changed (76) hide show
  1. package/README.md +12 -7
  2. package/components/LilyPond.astro +11 -11
  3. package/dist/execLilyPond.d.ts +18 -0
  4. package/dist/execLilyPond.d.ts.map +1 -0
  5. package/dist/execLilyPond.js +58 -0
  6. package/dist/execLilyPond.js.map +1 -0
  7. package/dist/index.d.ts +8 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +16 -15
  10. package/dist/index.js.map +1 -1
  11. package/dist/plugins/index.d.ts +5 -0
  12. package/dist/plugins/index.d.ts.map +1 -0
  13. package/dist/plugins/index.js +4 -0
  14. package/dist/plugins/index.js.map +1 -0
  15. package/dist/plugins/rehype.d.ts +6 -0
  16. package/dist/plugins/rehype.d.ts.map +1 -0
  17. package/dist/{rehype-plugin.js → plugins/rehype.js} +9 -8
  18. package/dist/plugins/rehype.js.map +1 -0
  19. package/dist/plugins/remark.d.ts +6 -0
  20. package/dist/plugins/remark.d.ts.map +1 -0
  21. package/dist/{remark-plugin.js → plugins/remark.js} +6 -6
  22. package/dist/plugins/remark.js.map +1 -0
  23. package/dist/plugins/satteri.d.ts +5 -0
  24. package/dist/plugins/satteri.d.ts.map +1 -0
  25. package/dist/{satteri-plugin.js → plugins/satteri.js} +5 -4
  26. package/dist/plugins/satteri.js.map +1 -0
  27. package/dist/plugins/types.d.ts +8 -0
  28. package/dist/plugins/types.d.ts.map +1 -0
  29. package/dist/plugins/types.js +2 -0
  30. package/dist/plugins/types.js.map +1 -0
  31. package/dist/readOutputFile.d.ts +10 -0
  32. package/dist/readOutputFile.d.ts.map +1 -0
  33. package/dist/readOutputFile.js +42 -0
  34. package/dist/readOutputFile.js.map +1 -0
  35. package/dist/render.d.ts +6 -0
  36. package/dist/render.d.ts.map +1 -1
  37. package/dist/render.js +16 -91
  38. package/dist/render.js.map +1 -1
  39. package/dist/utils/includePathsFor.d.ts +7 -0
  40. package/dist/utils/includePathsFor.d.ts.map +1 -0
  41. package/dist/utils/includePathsFor.js +14 -0
  42. package/dist/utils/includePathsFor.js.map +1 -0
  43. package/dist/utils/index.d.ts +6 -0
  44. package/dist/utils/index.d.ts.map +1 -0
  45. package/dist/utils/index.js +6 -0
  46. package/dist/utils/index.js.map +1 -0
  47. package/dist/utils/isLilypondLang.d.ts +3 -0
  48. package/dist/utils/isLilypondLang.d.ts.map +1 -0
  49. package/dist/utils/isLilypondLang.js +5 -0
  50. package/dist/utils/isLilypondLang.js.map +1 -0
  51. package/dist/utils/prependVersion.d.ts +6 -0
  52. package/dist/utils/prependVersion.d.ts.map +1 -0
  53. package/dist/utils/prependVersion.js +10 -0
  54. package/dist/utils/prependVersion.js.map +1 -0
  55. package/dist/utils/renderToHtml.d.ts +5 -0
  56. package/dist/utils/renderToHtml.d.ts.map +1 -0
  57. package/dist/utils/renderToHtml.js +12 -0
  58. package/dist/utils/renderToHtml.js.map +1 -0
  59. package/dist/utils/sourceNameFor.d.ts +7 -0
  60. package/dist/utils/sourceNameFor.d.ts.map +1 -0
  61. package/dist/utils/sourceNameFor.js +14 -0
  62. package/dist/utils/sourceNameFor.js.map +1 -0
  63. package/package.json +2 -2
  64. package/dist/rehype-plugin.d.ts +0 -6
  65. package/dist/rehype-plugin.d.ts.map +0 -1
  66. package/dist/rehype-plugin.js.map +0 -1
  67. package/dist/remark-plugin.d.ts +0 -6
  68. package/dist/remark-plugin.d.ts.map +0 -1
  69. package/dist/remark-plugin.js.map +0 -1
  70. package/dist/satteri-plugin.d.ts +0 -5
  71. package/dist/satteri-plugin.d.ts.map +0 -1
  72. package/dist/satteri-plugin.js.map +0 -1
  73. package/dist/util.d.ts +0 -31
  74. package/dist/util.d.ts.map +0 -1
  75. package/dist/util.js +0 -50
  76. package/dist/util.js.map +0 -1
package/README.md CHANGED
@@ -4,25 +4,24 @@ An [Astro](https://astro.build) integration for rendering [LilyPond](https://lil
4
4
 
5
5
  - Render LilyPond via Markdown or with a `<LilyPond>` component
6
6
  - Works with both `unified()` and `satteri()` Markdown processors
7
+ - Zero runtime JavaScript!
7
8
  - Supports all LilyPond syntax
8
9
 
9
10
  Docs: https://lilypond.ky.fyi
10
11
 
11
12
  ## Quick Start
12
13
 
13
- ### Prerequisites
14
+ ### 1. Install LilyPond
14
15
 
15
16
  Install the LilyPond binary directly from [lilypond.org](https://lilypond.org/download.html) or with `brew install lilypond` (Mac) or `apt install lilypond` (Linux).
16
17
 
17
- ### Installation
18
-
19
- #### 1. Install `astro-lilypond`
18
+ ### 2. Install `astro-lilypond`
20
19
 
21
20
  ```sh
22
21
  pnpm add astro-lilypond
23
22
  ```
24
23
 
25
- #### 2. Add the integration to your Astro config
24
+ ### 3. Add the integration to your Astro config
26
25
 
27
26
  ```js
28
27
  // astro.config.mjs
@@ -34,9 +33,9 @@ export default defineConfig({
34
33
  });
35
34
  ```
36
35
 
37
- #### 3. Write your music
36
+ ### 4. Write your music
38
37
 
39
- Write LilyPond code within fenced code blocks with the `lilypond` or `ly` language tag.
38
+ Write LilyPond code within fenced code blocks with the `lilypond`, `ly`, or `ily` language tag.
40
39
 
41
40
  ````md
42
41
  ```lilypond
@@ -45,3 +44,9 @@ Write LilyPond code within fenced code blocks with the `lilypond` or `ly` langua
45
44
  ````
46
45
 
47
46
  Your score will be built to `.svg` or `.png` and display alongside the rest of your content.
47
+
48
+ ---
49
+
50
+ For more info, refer to the docs: https://lilypond.ky.fyi
51
+
52
+ Happy notating!
@@ -1,29 +1,29 @@
1
1
  ---
2
2
  const HTML_ENTITIES: Record<string, string> = {
3
- "&": "&amp;",
4
- "<": "&lt;",
5
- ">": "&gt;",
6
- '"': "&quot;",
7
- "'": "&#39;",
3
+ "&": "&amp;",
4
+ "<": "&lt;",
5
+ ">": "&gt;",
6
+ '"': "&quot;",
7
+ "'": "&#39;",
8
8
  };
9
9
 
10
10
  function escapeHtml(text: unknown): string {
11
- return String(text).replace(/[&<>"']/g, (c) => HTML_ENTITIES[c] ?? c);
11
+ return String(text).replace(/[&<>"']/g, (c) => HTML_ENTITIES[c] ?? c);
12
12
  }
13
13
 
14
14
  interface Props {
15
- content: string;
16
- class?: string | undefined;
17
- style?: string | undefined;
15
+ content: string;
16
+ class?: string | undefined;
17
+ style?: string | undefined;
18
18
  }
19
19
 
20
20
  const { content, class: className, style } = Astro.props;
21
21
 
22
22
  let html = content;
23
23
  if (className)
24
- html = html.replace('class="lilypond"', `class="lilypond ${className}"`);
24
+ html = html.replace('class="lilypond"', `class="lilypond ${className}"`);
25
25
  if (style)
26
- html = html.replace(/<(svg|img)\b/, `<$1 style="${escapeHtml(style)}"`);
26
+ html = html.replace(/<(svg|img)\b/, `<$1 style="${escapeHtml(style)}"`);
27
27
  ---
28
28
 
29
29
  <Fragment set:html={html} />
@@ -0,0 +1,18 @@
1
+ import type { Format } from "./render.js";
2
+ export interface ExecLilypondOptions {
3
+ binaryPath: string;
4
+ format: Format;
5
+ resolution: number;
6
+ crop: boolean;
7
+ includePaths: string[];
8
+ timeout: number;
9
+ inputPath: string;
10
+ outputBase: string;
11
+ }
12
+ /**
13
+ * Invokes the `lilypond` binary against an already-written input file.
14
+ * Resolves once compilation succeeds (surfacing any stderr warnings to the
15
+ * build output); throws a normalized Error on a non-zero exit or timeout.
16
+ */
17
+ export declare function execLilyPond(options: ExecLilypondOptions): Promise<void>;
18
+ //# sourceMappingURL=execLilyPond.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execLilyPond.d.ts","sourceRoot":"","sources":["../src/execLilyPond.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAM1C,MAAM,WAAW,mBAAmB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CACjC,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgEf"}
@@ -0,0 +1,58 @@
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+ const execFileAsync = promisify(execFile);
4
+ const MAX_BUFFER = 16 * 1024 * 1024; // 16 MiB
5
+ /**
6
+ * Invokes the `lilypond` binary against an already-written input file.
7
+ * Resolves once compilation succeeds (surfacing any stderr warnings to the
8
+ * build output); throws a normalized Error on a non-zero exit or timeout.
9
+ */
10
+ export async function execLilyPond(options) {
11
+ const { binaryPath, format, resolution, crop, includePaths, timeout, inputPath, outputBase, } = options;
12
+ const args = [
13
+ // Render the correct format
14
+ `--format=${format}`,
15
+ // Define defaults — these can be overridden with the appropriate flags
16
+ // inside of individual .ly files
17
+ // Disable point-and-click behavior on SVGs when clicking noteheads
18
+ "--define-default=no-point-and-click",
19
+ // Use the `cairo` backend for graphics rendering; faster than the default `ps` backend
20
+ // https://lilypond.org/doc/v2.26/Documentation/usage/advanced-command_002dline-options-for-lilypond
21
+ "--define-default=backend=cairo",
22
+ // Resolution for generating PNGs (set in DPI)
23
+ `--define-default=resolution=${resolution}`,
24
+ // Set cropping
25
+ `--define-default=crop=${crop ? "#t" : "#f"}`,
26
+ // If the LilyPond file imports from others via \include, make sure those files are included
27
+ ...includePaths.map((p) => `--include=${p}`),
28
+ "--output",
29
+ outputBase,
30
+ inputPath,
31
+ ];
32
+ // LilyPond writes its progress log, (and any warnings/errors) to stderr,
33
+ // even on success. surface it in the build output so it's visible,
34
+ // but let the exit code (not stderr content) decide pass/fail.
35
+ let stderr;
36
+ try {
37
+ ({ stderr } = await execFileAsync(binaryPath, args, {
38
+ signal: AbortSignal.timeout(timeout),
39
+ maxBuffer: MAX_BUFFER,
40
+ }));
41
+ }
42
+ catch (err) {
43
+ if (err &&
44
+ typeof err === "object" &&
45
+ err.name === "AbortError") {
46
+ throw new Error(`lilypond timed out after ${timeout}ms`);
47
+ }
48
+ const errStderr = err && typeof err === "object" && "stderr" in err
49
+ ? String(err.stderr)
50
+ : undefined;
51
+ if (errStderr)
52
+ process.stderr.write(errStderr);
53
+ throw new Error(errStderr || (err instanceof Error ? err.message : String(err)));
54
+ }
55
+ if (stderr)
56
+ process.stderr.write(stderr);
57
+ }
58
+ //# sourceMappingURL=execLilyPond.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execLilyPond.js","sourceRoot":"","sources":["../src/execLilyPond.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,SAAS;AAa9C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,OAA4B;IAE5B,MAAM,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,SAAS,EACT,UAAU,GACV,GAAG,OAAO,CAAC;IAEZ,MAAM,IAAI,GAAG;QACZ,4BAA4B;QAC5B,YAAY,MAAM,EAAE;QAEpB,uEAAuE;QACvE,iCAAiC;QAEjC,mEAAmE;QACnE,qCAAqC;QACrC,uFAAuF;QACvF,oGAAoG;QACpG,gCAAgC;QAChC,8CAA8C;QAC9C,+BAA+B,UAAU,EAAE;QAC3C,eAAe;QACf,yBAAyB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;QAE7C,4FAA4F;QAC5F,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QAE5C,UAAU;QACV,UAAU;QACV,SAAS;KACT,CAAC;IAEF,yEAAyE;IACzE,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACJ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,IAAI,EAAE;YACnD,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;YACpC,SAAS,EAAE,UAAU;SACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IACC,GAAG;YACH,OAAO,GAAG,KAAK,QAAQ;YACtB,GAAyB,CAAC,IAAI,KAAK,YAAY,EAC/C,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,IAAI,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,SAAS,GACd,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,IAAI,GAAG;YAChD,CAAC,CAAC,MAAM,CAAE,GAA2B,CAAC,MAAM,CAAC;YAC7C,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,SAAS;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CACd,SAAS,IAAI,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAC/D,CAAC;IACH,CAAC;IACD,IAAI,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AstroIntegration } from "astro";
2
- import type { LilypondPluginOptions } from "./util.js";
3
- export type { LilypondPluginOptions };
4
- export interface LilypondOptions extends LilypondPluginOptions {
2
+ import { type PluginOptions } from "./plugins/index.js";
3
+ export type { PluginOptions as LilypondPluginOptions };
4
+ export interface LilypondOptions extends PluginOptions {
5
5
  /**
6
6
  * LilyPond version string to prepend automatically to every block that
7
7
  * doesn't already declare `\version`. Example: `"2.24.0"`.
@@ -24,6 +24,11 @@ export interface LilypondOptions extends LilypondPluginOptions {
24
24
  * Crop the output tightly to the content bounding box. Defaults to `true`.
25
25
  */
26
26
  crop?: boolean;
27
+ /**
28
+ * Milliseconds to wait for a single `lilypond` invocation before
29
+ * aborting it. Defaults to `60000` (60s).
30
+ */
31
+ timeout?: number;
27
32
  }
28
33
  export default function lilypond(options?: LilypondOptions): AstroIntegration;
29
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAS9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMvD,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC7D;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAsBD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,gBAAgB,CAiGhF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EACN,KAAK,aAAa,EAIlB,MAAM,oBAAoB,CAAC;AAa5B,YAAY,EAAE,aAAa,IAAI,qBAAqB,EAAE,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACrD;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AA2BD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC/B,OAAO,GAAE,eAAoB,GAC3B,gBAAgB,CAsGlB"}
package/dist/index.js CHANGED
@@ -1,10 +1,8 @@
1
- import { execFile } from "child_process";
2
- import { promisify } from "util";
3
- import { remarkLilypondPlugin } from "./remark-plugin.js";
4
- import { rehypeLilypondPlugin } from "./rehype-plugin.js";
5
- import { satteriLilypondPlugin } from "./satteri-plugin.js";
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+ import { rehypePlugin, remarkPlugin, satteriPlugin, } from "./plugins/index.js";
6
4
  import { defaultOptions, render } from "./render.js";
7
- import { includePathsFor, prependVersion, renderToHtml, sourceNameFor } from "./util.js";
5
+ import { includePathsFor, prependVersion, renderToHtml, sourceNameFor, } from "./utils/index.js";
8
6
  const execFileAsync = promisify(execFile);
9
7
  const LY_EXTENSIONS = [".ly", ".lilypond", ".ily"];
10
8
  function lyFilePlugin(options) {
@@ -12,18 +10,23 @@ function lyFilePlugin(options) {
12
10
  name: "vite-plugin-astro-lilypond-ly",
13
11
  enforce: "pre",
14
12
  async transform(source, id) {
15
- if (!LY_EXTENSIONS.some(ext => id.endsWith(ext)))
13
+ if (!LY_EXTENSIONS.some((ext) => id.endsWith(ext)))
16
14
  return;
17
- const src = options.version ? prependVersion(source, options.version) : source;
15
+ const src = options.version
16
+ ? prependVersion(source, options.version)
17
+ : source;
18
18
  const format = options.format ?? defaultOptions.format;
19
19
  const buf = await render(src, {
20
20
  format,
21
21
  resolution: options.resolution,
22
22
  crop: options.crop,
23
+ timeout: options.timeout,
23
24
  includePaths: includePathsFor(id),
24
25
  sourceName: sourceNameFor(id),
25
26
  });
26
- return { code: `export default ${JSON.stringify(renderToHtml(buf, format))}` };
27
+ return {
28
+ code: `export default ${JSON.stringify(renderToHtml(buf, format))}`,
29
+ };
27
30
  },
28
31
  };
29
32
  }
@@ -54,7 +57,7 @@ export default function lilypond(options = {}) {
54
57
  ...existingOptions,
55
58
  mdastPlugins: [
56
59
  ...(existingOptions.mdastPlugins ?? []),
57
- satteriLilypondPlugin(options),
60
+ satteriPlugin(options),
58
61
  ],
59
62
  }),
60
63
  },
@@ -75,11 +78,11 @@ export default function lilypond(options = {}) {
75
78
  ...existingOptions,
76
79
  remarkPlugins: [
77
80
  ...(existingOptions.remarkPlugins ?? []),
78
- [remarkLilypondPlugin, options],
81
+ [remarkPlugin, options],
79
82
  ],
80
83
  rehypePlugins: [
81
84
  ...(existingOptions.rehypePlugins ?? []),
82
- [rehypeLilypondPlugin, options],
85
+ [rehypePlugin, options],
83
86
  ],
84
87
  }),
85
88
  },
@@ -95,9 +98,7 @@ export default function lilypond(options = {}) {
95
98
  "astro:config:done": ({ injectTypes }) => {
96
99
  injectTypes({
97
100
  filename: "ly-types.d.ts",
98
- content: LY_EXTENSIONS
99
- .map(ext => `declare module "*${ext}" {\n const html: string;\n export default html;\n}`)
100
- .join("\n"),
101
+ content: LY_EXTENSIONS.map((ext) => `declare module "*${ext}" {\n const html: string;\n export default html;\n}`).join("\n"),
101
102
  });
102
103
  },
103
104
  },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AA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E;oBAC3E,uBAAuB,iBAAiB,EAAE,IAAI,IAAI,MAAM,GAAG,CAC5D,CAAC;YACH,CAAC;YAED,mBAAmB,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;gBACxC,WAAW,CAAC;oBACX,QAAQ,EAAE,eAAe;oBACzB,OAAO,EAAE,aAAa,CAAC,GAAG,CACzB,CAAC,GAAG,EAAE,EAAE,CACP,oBAAoB,GAAG,uDAAuD,CAC/E,CAAC,IAAI,CAAC,IAAI,CAAC;iBACZ,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { rehypePlugin } from "./rehype.js";
2
+ export { remarkPlugin } from "./remark.js";
3
+ export { satteriPlugin } from "./satteri.js";
4
+ export type { PluginOptions } from "./types.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { rehypePlugin } from "./rehype.js";
2
+ export { remarkPlugin } from "./remark.js";
3
+ export { satteriPlugin } from "./satteri.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { PluginOptions } from "./types.js";
2
+ export type RehypePluginOptions = PluginOptions;
3
+ export declare function rehypePlugin(options?: RehypePluginOptions): (tree: any, file?: {
4
+ path?: string;
5
+ }) => Promise<void>;
6
+ //# sourceMappingURL=rehype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype.d.ts","sourceRoot":"","sources":["../../src/plugins/rehype.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAIhD,wBAAgB,YAAY,CAC3B,OAAO,GAAE,mBAAwB,GAE/B,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAyDxD"}
@@ -1,10 +1,9 @@
1
1
  import { visit } from "unist-util-visit";
2
- import { defaultOptions, render } from "./render.js";
3
- import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "./util.js";
2
+ import { defaultOptions, render } from "../render.js";
3
+ import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "../utils/index.js";
4
4
  // Typed loosely so it's assignable to both RehypePlugin and the unified
5
5
  // Plugin generic regardless of which @types/hast version the host project pins.
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- export function rehypeLilypondPlugin(options = {}) {
6
+ export function rehypePlugin(options = {}) {
8
7
  return async (tree, file) => {
9
8
  const promises = [];
10
9
  const includePaths = includePathsFor(file?.path);
@@ -21,7 +20,9 @@ export function rehypeLilypondPlugin(options = {}) {
21
20
  const cls = codeNode.properties?.className;
22
21
  if (!Array.isArray(cls))
23
22
  return;
24
- const lang = cls.find((c) => c.startsWith("language-"))?.slice("language-".length);
23
+ const lang = cls
24
+ .find((c) => c.startsWith("language-"))
25
+ ?.slice("language-".length);
25
26
  if (!isLilypondLang(lang))
26
27
  return;
27
28
  const raw = codeNode.children
@@ -36,10 +37,10 @@ export function rehypeLilypondPlugin(options = {}) {
36
37
  format,
37
38
  resolution: options.resolution,
38
39
  crop: options.crop,
40
+ timeout: options.timeout,
39
41
  includePaths,
40
42
  sourceName,
41
- })
42
- .then((buf) => {
43
+ }).then((buf) => {
43
44
  const rawNode = {
44
45
  type: "raw",
45
46
  value: renderToHtml(buf, format),
@@ -51,4 +52,4 @@ export function rehypeLilypondPlugin(options = {}) {
51
52
  await Promise.all(promises);
52
53
  };
53
54
  }
54
- //# sourceMappingURL=rehype-plugin.js.map
55
+ //# sourceMappingURL=rehype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehype.js","sourceRoot":"","sources":["../../src/plugins/rehype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACb,MAAM,mBAAmB,CAAC;AAW3B,wEAAwE;AACxE,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAC3B,OAAO,GAAwB,EAAE;IAGjC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7C,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC9C,IACC,IAAI,CAAC,OAAO,KAAK,KAAK;gBACtB,IAAI,CAAC,QAAQ,EAAE,MAAM,KAAK,CAAC;gBAC3B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS;gBACnC,IAAI,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GAAG,EAAQ,EAAE;gBACrB,MAAM,OAAO,GAAY;oBACxB,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC;iBAChC,CAAC;gBACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;YAClC,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Root } from "mdast";
2
+ import type { Plugin } from "unified";
3
+ import type { PluginOptions } from "./types.js";
4
+ export type RemarkPluginOptions = PluginOptions;
5
+ export declare const remarkPlugin: Plugin<[RemarkPluginOptions?], Root>;
6
+ //# sourceMappingURL=remark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark.d.ts","sourceRoot":"","sources":["../../src/plugins/remark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAUtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEhD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAoC7D,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { visit } from "unist-util-visit";
2
- import { defaultOptions, render } from "./render.js";
3
- import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "./util.js";
4
- export const remarkLilypondPlugin = (options = {}) => {
2
+ import { defaultOptions, render } from "../render.js";
3
+ import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "../utils/index.js";
4
+ export const remarkPlugin = (options = {}) => {
5
5
  return async (tree, file) => {
6
6
  const promises = [];
7
7
  const includePaths = includePathsFor(file?.path);
@@ -17,10 +17,10 @@ export const remarkLilypondPlugin = (options = {}) => {
17
17
  format,
18
18
  resolution: options.resolution,
19
19
  crop: options.crop,
20
+ timeout: options.timeout,
20
21
  includePaths,
21
22
  sourceName,
22
- })
23
- .then((buf) => {
23
+ }).then((buf) => {
24
24
  const htmlNode = {
25
25
  type: "html",
26
26
  value: renderToHtml(buf, format),
@@ -32,4 +32,4 @@ export const remarkLilypondPlugin = (options = {}) => {
32
32
  await Promise.all(promises);
33
33
  };
34
34
  };
35
- //# sourceMappingURL=remark-plugin.js.map
35
+ //# sourceMappingURL=remark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark.js","sourceRoot":"","sources":["../../src/plugins/remark.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACb,MAAM,mBAAmB,CAAC;AAK3B,MAAM,CAAC,MAAM,YAAY,GAAyC,CACjE,OAAO,GAAG,EAAE,EACX,EAAE;IACH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEzE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;YAEvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE;gBAC9B,MAAM;gBACN,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY;gBACZ,UAAU;aACV,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAQ,EAAE;gBACrB,MAAM,QAAQ,GAAS;oBACtB,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC;iBAChC,CAAC;gBACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YACnC,CAAC,CAAC,CAAC;YAEH,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { MdastPluginDefinition } from "satteri";
2
+ import type { PluginOptions } from "./types.js";
3
+ export type SatteriPluginOptions = PluginOptions;
4
+ export declare function satteriPlugin(options?: SatteriPluginOptions): MdastPluginDefinition;
5
+ //# sourceMappingURL=satteri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satteri.d.ts","sourceRoot":"","sources":["../../src/plugins/satteri.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,SAAS,CAAC;AAS1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAEjD,wBAAgB,aAAa,CAC5B,OAAO,GAAE,oBAAyB,GAChC,qBAAqB,CA4BvB"}
@@ -1,6 +1,6 @@
1
- import { defaultOptions, render } from "./render.js";
2
- import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "./util.js";
3
- export function satteriLilypondPlugin(options = {}) {
1
+ import { defaultOptions, render } from "../render.js";
2
+ import { includePathsFor, isLilypondLang, prependVersion, renderToHtml, sourceNameFor, } from "../utils/index.js";
3
+ export function satteriPlugin(options = {}) {
4
4
  return {
5
5
  name: "astro-lilypond",
6
6
  // Returning an mdast Html node (type: 'html') emits the value verbatim.
@@ -19,6 +19,7 @@ export function satteriLilypondPlugin(options = {}) {
19
19
  format,
20
20
  resolution: options.resolution,
21
21
  crop: options.crop,
22
+ timeout: options.timeout,
22
23
  includePaths,
23
24
  sourceName,
24
25
  });
@@ -26,4 +27,4 @@ export function satteriLilypondPlugin(options = {}) {
26
27
  },
27
28
  };
28
29
  }
29
- //# sourceMappingURL=satteri-plugin.js.map
30
+ //# sourceMappingURL=satteri.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"satteri.js","sourceRoot":"","sources":["../../src/plugins/satteri.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACb,MAAM,mBAAmB,CAAC;AAK3B,MAAM,UAAU,aAAa,CAC5B,OAAO,GAAyB,EAAE;IAElC,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,wEAAwE;QACxE,sEAAsE;QACtE,yEAAyE;QACzE,KAAK,CAAC,IAAI,CACT,IAAoB,EACpB,GAAwB;YAExB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,SAAS,CAAC;YACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;YACvD,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE;gBAChC,MAAM;gBACN,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY;gBACZ,UAAU;aACV,CAAC,CAAC;YACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;QAC3D,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface PluginOptions {
2
+ version?: string;
3
+ format?: "svg" | "png";
4
+ resolution?: number;
5
+ crop?: boolean;
6
+ timeout?: number;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { Format } from "./render.js";
2
+ /**
3
+ * Resolves the base name to use for the temp input file. Strips any
4
+ * directory components from `sourceName` (it may be a full path) and
5
+ * rejects anything that isn't a plain, safe file name, falling back to
6
+ * the generic `"input.ly"`.
7
+ */
8
+ export declare function safeInputFileName(sourceName: string | undefined): string;
9
+ export declare function readOutputFile(base: string, format: Format, crop: boolean): Promise<Buffer>;
10
+ //# sourceMappingURL=readOutputFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readOutputFile.d.ts","sourceRoot":"","sources":["../src/readOutputFile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAOxE;AAED,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACX,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
@@ -0,0 +1,42 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { basename } from "node:path";
3
+ /**
4
+ * Resolves the base name to use for the temp input file. Strips any
5
+ * directory components from `sourceName` (it may be a full path) and
6
+ * rejects anything that isn't a plain, safe file name, falling back to
7
+ * the generic `"input.ly"`.
8
+ */
9
+ export function safeInputFileName(sourceName) {
10
+ if (!sourceName)
11
+ return "input.ly";
12
+ const base = basename(sourceName);
13
+ if (!base || base === "." || base === ".." || !/^[\w.-]+$/.test(base)) {
14
+ return "input.ly";
15
+ }
16
+ return base;
17
+ }
18
+ export async function readOutputFile(base, format, crop) {
19
+ // --define-default crop writes <base>.cropped.<format> alongside <base>.<format>
20
+ if (crop) {
21
+ try {
22
+ return await readFile(`${base}.cropped.${format}`);
23
+ }
24
+ catch (err) {
25
+ throw new Error(`expected cropped output at ${base}.cropped.${format} but it was not found: ${err instanceof Error ? err.message : String(err)}`);
26
+ }
27
+ }
28
+ // Regular output: single page → <base>.<format>, multi-page →
29
+ // <base>-1.<format> (svg) or <base>-page1.<format> (png).
30
+ try {
31
+ return await readFile(`${base}.${format}`);
32
+ }
33
+ catch {
34
+ try {
35
+ return await readFile(`${base}-1.${format}`);
36
+ }
37
+ catch {
38
+ return await readFile(`${base}-page1.${format}`);
39
+ }
40
+ }
41
+ }
42
+ //# sourceMappingURL=readOutputFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readOutputFile.js","sourceRoot":"","sources":["../src/readOutputFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAA8B;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,UAAU,CAAC;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvE,OAAO,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,IAAY,EACZ,MAAc,EACd,IAAa;IAEb,iFAAiF;IACjF,IAAI,IAAI,EAAE,CAAC;QACV,IAAI,CAAC;YACJ,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,YAAY,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACd,8BAA8B,IAAI,YAAY,MAAM,0BACnD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAChD,EAAE,CACF,CAAC;QACH,CAAC;IACF,CAAC;IAED,8DAA8D;IAC9D,0DAA0D;IAC1D,IAAI,CAAC;QACJ,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACR,IAAI,CAAC;YACJ,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,MAAM,MAAM,EAAE,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,UAAU,MAAM,EAAE,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;AACF,CAAC"}
package/dist/render.d.ts CHANGED
@@ -24,6 +24,12 @@ export interface RenderOptions {
24
24
  * `"input.ly"` when omitted or unsafe to use as a filename.
25
25
  */
26
26
  sourceName?: string;
27
+ /**
28
+ * Milliseconds to wait for a single `lilypond` invocation before
29
+ * aborting it, so a pathological score can't hang the build forever.
30
+ * Defaults to `60000` (60s).
31
+ */
32
+ timeout?: number;
27
33
  }
28
34
  export declare const defaultOptions: Required<Omit<RenderOptions, "includePaths" | "sourceName">>;
29
35
  export declare function render(source: string, options?: RenderOptions): Promise<Buffer>;
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAsBA,QAAA,MAAM,OAAO,YAAI,KAAK,EAAE,KAAK,CAAU,CAAC;AAExC,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC7B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,kEAAkE;IAClE,UAAU,CAA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OAAO,CAAC,MAAM,CAAC,CAqCjB"}
package/dist/render.js CHANGED
@@ -1,27 +1,18 @@
1
- import { execFile } from "child_process";
2
- import { mkdtemp, readFile, rm, writeFile } from "fs/promises";
3
- import { basename, join } from "path";
4
- import { tmpdir } from "os";
5
- import { promisify } from "util";
6
- const execFileAsync = promisify(execFile);
7
- // Concurrent `lilypond` processes can encounter race conditions
8
- // and corrupt the output. Serialize invocations of the binary so
9
- // no two processes build at once.
10
- let invocationQueue = Promise.resolve();
11
- function runExclusive(task) {
12
- const result = invocationQueue.then(task, task);
13
- invocationQueue = result.then(() => undefined, () => undefined);
14
- return result;
15
- }
1
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { execLilyPond } from "./execLilyPond.js";
5
+ import { readOutputFile, safeInputFileName } from "./readOutputFile.js";
16
6
  const FORMATS = ["png", "svg"];
17
7
  export const defaultOptions = {
18
8
  format: "svg",
19
9
  resolution: 144,
20
10
  binaryPath: "lilypond",
21
11
  crop: true,
12
+ timeout: 60_000,
22
13
  };
23
14
  export async function render(source, options = {}) {
24
- const { format = defaultOptions.format, resolution = defaultOptions.resolution, binaryPath = defaultOptions.binaryPath, crop = defaultOptions.crop, includePaths = [], sourceName, } = options;
15
+ const { format = defaultOptions.format, resolution = defaultOptions.resolution, binaryPath = defaultOptions.binaryPath, crop = defaultOptions.crop, timeout = defaultOptions.timeout, includePaths = [], sourceName, } = options;
25
16
  if (!FORMATS.includes(format)) {
26
17
  throw new Error(`${format} is not a supported format`);
27
18
  }
@@ -30,86 +21,20 @@ export async function render(source, options = {}) {
30
21
  const outputBase = join(dir, "output");
31
22
  try {
32
23
  await writeFile(inputPath, source, "utf8");
33
- const args = [
34
- // Render the correct format
35
- `--format=${format}`,
36
- // Define defaults — these can be overridden with the appropriate flags
37
- // inside of individual .ly files
38
- // Disable point-and-click behavior on SVGs when clicking noteheads
39
- "--define-default=no-point-and-click",
40
- // Use the `cairo` backend for graphics rendering; faster than the default `ps` backend
41
- // https://lilypond.org/doc/v2.26/Documentation/usage/advanced-command_002dline-options-for-lilypond
42
- "--define-default=backend=cairo",
43
- // Resolution for generating PNGs (set in DPI)
44
- `--define-default=resolution=${resolution}`,
45
- // Set cropping
46
- `--define-default=crop=${crop ? "#t" : "#f"}`,
47
- // If the LilyPond file imports from others via \include, make sure those files are included
48
- ...includePaths.map((p) => `--include=${p}`),
49
- "--output",
50
- outputBase,
24
+ await execLilyPond({
25
+ binaryPath,
26
+ format,
27
+ resolution,
28
+ crop,
29
+ includePaths,
30
+ timeout,
51
31
  inputPath,
52
- ];
53
- // LilyPond writes its progress log, and any warnings/errors, to stderr
54
- // even on success — surface it in the build output so it's visible,
55
- // but let the exit code (not stderr content) decide pass/fail.
56
- let stderr;
57
- try {
58
- ({ stderr } = await runExclusive(() => execFileAsync(binaryPath, args)));
59
- }
60
- catch (err) {
61
- const errStderr = err && typeof err === "object" && "stderr" in err
62
- ? String(err.stderr)
63
- : undefined;
64
- if (errStderr)
65
- process.stderr.write(errStderr);
66
- throw new Error(errStderr || (err instanceof Error ? err.message : String(err)));
67
- }
68
- if (stderr)
69
- process.stderr.write(stderr);
32
+ outputBase,
33
+ });
70
34
  return await readOutputFile(outputBase, format, crop);
71
35
  }
72
36
  finally {
73
37
  await rm(dir, { recursive: true, force: true });
74
38
  }
75
39
  }
76
- /**
77
- * Resolves the base name to use for the temp input file. Strips any
78
- * directory components from `sourceName` (it may be a full path) and
79
- * rejects anything that isn't a plain, safe file name, falling back to
80
- * the generic `"input.ly"`.
81
- */
82
- function safeInputFileName(sourceName) {
83
- if (!sourceName)
84
- return "input.ly";
85
- const base = basename(sourceName);
86
- if (!base || base === "." || base === ".." || !/^[\w.-]+$/.test(base)) {
87
- return "input.ly";
88
- }
89
- return base;
90
- }
91
- async function readOutputFile(base, format, crop) {
92
- // --define-default crop writes <base>.cropped.<format> alongside <base>.<format>
93
- if (crop) {
94
- try {
95
- return await readFile(`${base}.cropped.${format}`);
96
- }
97
- catch (err) {
98
- throw new Error(`expected cropped output at ${base}.cropped.${format} but it was not found: ${err instanceof Error ? err.message : String(err)}`);
99
- }
100
- }
101
- // Regular output: single page → <base>.<format>, multi-page →
102
- // <base>-1.<format> (svg) or <base>-page1.<format> (png).
103
- try {
104
- return await readFile(`${base}.${format}`);
105
- }
106
- catch {
107
- try {
108
- return await readFile(`${base}-1.${format}`);
109
- }
110
- catch {
111
- return await readFile(`${base}-page1.${format}`);
112
- }
113
- }
114
- }
115
40
  //# sourceMappingURL=render.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,gEAAgE;AAChE,iEAAiE;AACjE,kCAAkC;AAClC,IAAI,eAAe,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;AAEvD,SAAS,YAAY,CAAI,IAAsB;IAC9C,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChD,eAAe,GAAG,MAAM,CAAC,IAAI,CAC5B,GAAG,EAAE,CAAC,SAAS,EACf,GAAG,EAAE,CAAC,SAAS,CACf,CAAC;IACF,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC;AAmCxC,MAAM,CAAC,MAAM,cAAc,GAAiE;IAC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AAI;YACJ,YAAY;YACZ,OAAO;YACP,SAAS;YACT,UAAU;SACV,CAAC,CAAC;QAEH,OAAO,MAAM,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;YAAS,CAAC;QACV,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Derives `render()`'s `includePaths` from the source file's path or URL, so
3
+ * `\include`d sibling files resolve even though rendering happens in a temp
4
+ * directory. Returns `[]` when the source location is unknown.
5
+ */
6
+ export declare function includePathsFor(source: string | URL | null | undefined): string[];
7
+ //# sourceMappingURL=includePathsFor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"includePathsFor.d.ts","sourceRoot":"","sources":["../../src/utils/includePathsFor.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,MAAM,EAAE,CAIV"}
@@ -0,0 +1,14 @@
1
+ import { dirname } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ /**
4
+ * Derives `render()`'s `includePaths` from the source file's path or URL, so
5
+ * `\include`d sibling files resolve even though rendering happens in a temp
6
+ * directory. Returns `[]` when the source location is unknown.
7
+ */
8
+ export function includePathsFor(source) {
9
+ if (!source)
10
+ return [];
11
+ const path = typeof source === "string" ? source : fileURLToPath(source);
12
+ return [dirname(path)];
13
+ }
14
+ //# sourceMappingURL=includePathsFor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"includePathsFor.js","sourceRoot":"","sources":["../../src/utils/includePathsFor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC9B,MAAuC;IAEvC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { includePathsFor } from "./includePathsFor.js";
2
+ export { isLilypondLang } from "./isLilypondLang.js";
3
+ export { prependVersion } from "./prependVersion.js";
4
+ export { renderToHtml } from "./renderToHtml.js";
5
+ export { sourceNameFor } from "./sourceNameFor.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { includePathsFor } from "./includePathsFor.js";
2
+ export { isLilypondLang } from "./isLilypondLang.js";
3
+ export { prependVersion } from "./prependVersion.js";
4
+ export { renderToHtml } from "./renderToHtml.js";
5
+ export { sourceNameFor } from "./sourceNameFor.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Returns true for the fenced-block language identifiers that trigger SVG rendering. */
2
+ export declare function isLilypondLang(lang: string | null | undefined): boolean;
3
+ //# sourceMappingURL=isLilypondLang.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isLilypondLang.d.ts","sourceRoot":"","sources":["../../src/utils/isLilypondLang.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEvE"}
@@ -0,0 +1,5 @@
1
+ /** Returns true for the fenced-block language identifiers that trigger SVG rendering. */
2
+ export function isLilypondLang(lang) {
3
+ return lang === "lilypond" || lang === "ly" || lang === "ily";
4
+ }
5
+ //# sourceMappingURL=isLilypondLang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isLilypondLang.js","sourceRoot":"","sources":["../../src/utils/isLilypondLang.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAAC,IAA+B;IAC7D,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * If `version` is provided and the source doesn't already declare `\version`,
3
+ * prepend `\version "X.X.X"` so users don't need to write it manually.
4
+ */
5
+ export declare function prependVersion(source: string, version: string): string;
6
+ //# sourceMappingURL=prependVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prependVersion.d.ts","sourceRoot":"","sources":["../../src/utils/prependVersion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGtE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * If `version` is provided and the source doesn't already declare `\version`,
3
+ * prepend `\version "X.X.X"` so users don't need to write it manually.
4
+ */
5
+ export function prependVersion(source, version) {
6
+ if (/\\version\b/.test(source))
7
+ return source;
8
+ return `\\version "${version}"\n${source}`;
9
+ }
10
+ //# sourceMappingURL=prependVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prependVersion.js","sourceRoot":"","sources":["../../src/utils/prependVersion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,OAAe;IAC7D,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,cAAc,OAAO,MAAM,MAAM,EAAE,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts a rendered LilyPond buffer to an HTML string.
3
+ */
4
+ export declare function renderToHtml(buf: Buffer, format: "svg" | "png"): string;
5
+ //# sourceMappingURL=renderToHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderToHtml.d.ts","sourceRoot":"","sources":["../../src/utils/renderToHtml.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAGvE"}
@@ -0,0 +1,12 @@
1
+ const MIME_TYPES = {
2
+ svg: "image/svg+xml",
3
+ png: "image/png",
4
+ };
5
+ /**
6
+ * Converts a rendered LilyPond buffer to an HTML string.
7
+ */
8
+ export function renderToHtml(buf, format) {
9
+ const b64 = buf.toString("base64");
10
+ return `<img class="lilypond" src="data:${MIME_TYPES[format]};base64,${b64}" alt="">`;
11
+ }
12
+ //# sourceMappingURL=renderToHtml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderToHtml.js","sourceRoot":"","sources":["../../src/utils/renderToHtml.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG;IAClB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,WAAW;CACP,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAqB;IAC9D,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,mCAAmC,UAAU,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;AACvF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Derives `render()`'s `sourceName` from the source file's path or URL, so
3
+ * build output identifies the originating file instead of a generic
4
+ * `input.ly`. Returns `undefined` when the source location is unknown.
5
+ */
6
+ export declare function sourceNameFor(source: string | URL | null | undefined): string | undefined;
7
+ //# sourceMappingURL=sourceNameFor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceNameFor.d.ts","sourceRoot":"","sources":["../../src/utils/sourceNameFor.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,MAAM,GAAG,SAAS,CAIpB"}
@@ -0,0 +1,14 @@
1
+ import { basename } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ /**
4
+ * Derives `render()`'s `sourceName` from the source file's path or URL, so
5
+ * build output identifies the originating file instead of a generic
6
+ * `input.ly`. Returns `undefined` when the source location is unknown.
7
+ */
8
+ export function sourceNameFor(source) {
9
+ if (!source)
10
+ return undefined;
11
+ const path = typeof source === "string" ? source : fileURLToPath(source);
12
+ return basename(path);
13
+ }
14
+ //# sourceMappingURL=sourceNameFor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceNameFor.js","sourceRoot":"","sources":["../../src/utils/sourceNameFor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC5B,MAAuC;IAEvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-lilypond",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "An Astro integration for rendering Lilypond markup to music notation.",
5
5
  "homepage": "https://lilypond.ky.fyi",
6
6
  "author": "Ky Decker",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "files": [
23
23
  "dist",
24
- "components"
24
+ "components/*.astro"
25
25
  ],
26
26
  "keywords": [
27
27
  "astro",
@@ -1,6 +0,0 @@
1
- import type { LilypondPluginOptions } from "./util.js";
2
- export type RehypePluginOptions = LilypondPluginOptions;
3
- export declare function rehypeLilypondPlugin(options?: RehypePluginOptions): (tree: any, file?: {
4
- path?: string;
5
- }) => Promise<void>;
6
- //# sourceMappingURL=rehype-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rehype-plugin.d.ts","sourceRoot":"","sources":["../src/rehype-plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAQvD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAKxD,wBAAgB,oBAAoB,CACnC,OAAO,GAAE,mBAAwB,GAC/B,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,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@@ -1,6 +0,0 @@
1
- import type { Root } from "mdast";
2
- import type { Plugin } from "unified";
3
- import type { LilypondPluginOptions } from "./util.js";
4
- export type RemarkPluginOptions = LilypondPluginOptions;
5
- export declare const remarkLilypondPlugin: Plugin<[RemarkPluginOptions?], Root>;
6
- //# sourceMappingURL=remark-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remark-plugin.d.ts","sourceRoot":"","sources":["../src/remark-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAUtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAoCrE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"remark-plugin.js","sourceRoot":"","sources":["../src/remark-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACb,MAAM,WAAW,CAAC;AAKnB,MAAM,CAAC,MAAM,oBAAoB,GAAyC,CACzE,OAAO,GAAG,EAAE,EACX,EAAE;IACH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEzE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;YAEvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE;gBAC9B,MAAM;gBACN,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,YAAY;gBACZ,UAAU;aACV,CAAC;iBACA,IAAI,CAAC,CAAC,GAAG,EAAQ,EAAE;gBACnB,MAAM,QAAQ,GAAS;oBACtB,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC;iBAChC,CAAC;gBACF,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YACnC,CAAC,CAAC,CAAC;YAEJ,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { MdastPluginDefinition } from "satteri";
2
- import type { LilypondPluginOptions } from "./util.js";
3
- export type SatteriPluginOptions = LilypondPluginOptions;
4
- export declare function satteriLilypondPlugin(options?: SatteriPluginOptions): MdastPluginDefinition;
5
- //# sourceMappingURL=satteri-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"satteri-plugin.d.ts","sourceRoot":"","sources":["../src/satteri-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,qBAAqB,EAErB,MAAM,SAAS,CAAC;AASjB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAEzD,wBAAgB,qBAAqB,CACpC,OAAO,GAAE,oBAAyB,GAChC,qBAAqB,CA2BvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"satteri-plugin.js","sourceRoot":"","sources":["../src/satteri-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,GACb,MAAM,WAAW,CAAC;AAKnB,MAAM,UAAU,qBAAqB,CACpC,OAAO,GAAyB,EAAE;IAElC,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,wEAAwE;QACxE,sEAAsE;QACtE,yEAAyE;QACzE,KAAK,CAAC,IAAI,CACT,IAAoB,EACpB,GAAwB;YAExB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,SAAS,CAAC;YACjD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO;gBAC7B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;YACvD,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClD,MAAM,UAAU,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE;gBAChC,MAAM;gBACN,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,YAAY;gBACZ,UAAU;aACV,CAAC,CAAC;YACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;QAC3D,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/util.d.ts DELETED
@@ -1,31 +0,0 @@
1
- export interface LilypondPluginOptions {
2
- version?: string;
3
- format?: "svg" | "png";
4
- resolution?: number;
5
- crop?: boolean;
6
- }
7
- /** Returns true for the fenced-block language identifiers that trigger SVG rendering. */
8
- export declare function isLilypondLang(lang: string | null | undefined): boolean;
9
- /**
10
- * If `version` is provided and the source doesn't already declare `\version`,
11
- * prepend `\version "X.X.X"` so users don't need to write it manually.
12
- */
13
- export declare function prependVersion(source: string, version: string): string;
14
- /**
15
- * Derives `render()`'s `includePaths` from the source file's path or URL, so
16
- * `\include`d sibling files resolve even though rendering happens in a temp
17
- * directory. Returns `[]` when the source location is unknown.
18
- */
19
- export declare function includePathsFor(source: string | URL | null | undefined): string[];
20
- /**
21
- * Derives `render()`'s `sourceName` from the source file's path or URL, so
22
- * build output identifies the originating file instead of a generic
23
- * `input.ly`. Returns `undefined` when the source location is unknown.
24
- */
25
- export declare function sourceNameFor(source: string | URL | null | undefined): string | undefined;
26
- /**
27
- * Converts a rendered LilyPond buffer to an HTML string suitable for
28
- * embedding.
29
- */
30
- export declare function renderToHtml(buf: Buffer, format: "svg" | "png"): string;
31
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAIjF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAIzF;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAGvE"}
package/dist/util.js DELETED
@@ -1,50 +0,0 @@
1
- import { basename, dirname } from "path";
2
- import { fileURLToPath } from "url";
3
- /** Returns true for the fenced-block language identifiers that trigger SVG rendering. */
4
- export function isLilypondLang(lang) {
5
- return lang === "lilypond" || lang === "ly" || lang === "ily";
6
- }
7
- /**
8
- * If `version` is provided and the source doesn't already declare `\version`,
9
- * prepend `\version "X.X.X"` so users don't need to write it manually.
10
- */
11
- export function prependVersion(source, version) {
12
- if (/\\version\b/.test(source))
13
- return source;
14
- return `\\version "${version}"\n${source}`;
15
- }
16
- /**
17
- * Derives `render()`'s `includePaths` from the source file's path or URL, so
18
- * `\include`d sibling files resolve even though rendering happens in a temp
19
- * directory. Returns `[]` when the source location is unknown.
20
- */
21
- export function includePathsFor(source) {
22
- if (!source)
23
- return [];
24
- const path = typeof source === "string" ? source : fileURLToPath(source);
25
- return [dirname(path)];
26
- }
27
- /**
28
- * Derives `render()`'s `sourceName` from the source file's path or URL, so
29
- * build output identifies the originating file instead of a generic
30
- * `input.ly`. Returns `undefined` when the source location is unknown.
31
- */
32
- export function sourceNameFor(source) {
33
- if (!source)
34
- return undefined;
35
- const path = typeof source === "string" ? source : fileURLToPath(source);
36
- return basename(path);
37
- }
38
- const MIME_TYPES = {
39
- svg: "image/svg+xml",
40
- png: "image/png",
41
- };
42
- /**
43
- * Converts a rendered LilyPond buffer to an HTML string suitable for
44
- * embedding.
45
- */
46
- export function renderToHtml(buf, format) {
47
- const b64 = buf.toString("base64");
48
- return `<img class="lilypond" src="data:${MIME_TYPES[format]};base64,${b64}" alt="">`;
49
- }
50
- //# sourceMappingURL=util.js.map
package/dist/util.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AASpC,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAAC,IAA+B;IAC7D,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,OAAe;IAC7D,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,cAAc,OAAO,MAAM,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuC;IACtE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACxB,CAAC;AAED;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