astro-lilypond 0.7.0 → 0.8.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/components/LilyPond.astro +15 -20
- package/dist/execLilyPond.d.ts +3 -2
- package/dist/execLilyPond.d.ts.map +1 -1
- package/dist/execLilyPond.js +1 -2
- package/dist/execLilyPond.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/plugins/rehype.d.ts.map +1 -1
- package/dist/plugins/rehype.js +14 -9
- package/dist/plugins/rehype.js.map +1 -1
- package/dist/plugins/remark.d.ts.map +1 -1
- package/dist/plugins/remark.js +14 -9
- package/dist/plugins/remark.js.map +1 -1
- package/dist/plugins/satteri.d.ts.map +1 -1
- package/dist/plugins/satteri.js +13 -11
- package/dist/plugins/satteri.js.map +1 -1
- package/dist/readOutputFile.d.ts +1 -1
- package/dist/readOutputFile.d.ts.map +1 -1
- package/dist/readOutputFile.js +33 -14
- package/dist/readOutputFile.js.map +1 -1
- package/dist/render.d.ts +38 -13
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +14 -5
- package/dist/render.js.map +1 -1
- package/dist/utils/assetsUrlBaseFor.d.ts +1 -2
- package/dist/utils/assetsUrlBaseFor.d.ts.map +1 -1
- package/dist/utils/assetsUrlBaseFor.js +3 -5
- package/dist/utils/assetsUrlBaseFor.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lyImportQuery.d.ts +21 -0
- package/dist/utils/lyImportQuery.d.ts.map +1 -0
- package/dist/utils/lyImportQuery.js +26 -0
- package/dist/utils/lyImportQuery.js.map +1 -0
- package/dist/utils/renderedHtml.d.ts +7 -0
- package/dist/utils/renderedHtml.d.ts.map +1 -0
- package/dist/utils/renderedHtml.js +14 -0
- package/dist/utils/renderedHtml.js.map +1 -0
- package/dist/writeAsset.d.ts +15 -9
- package/dist/writeAsset.d.ts.map +1 -1
- package/dist/writeAsset.js +60 -20
- package/dist/writeAsset.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/imgTag.d.ts +0 -5
- package/dist/utils/imgTag.d.ts.map +0 -1
- package/dist/utils/imgTag.js +0 -7
- package/dist/utils/imgTag.js.map +0 -1
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
const HTML_ENTITIES: Record<string, string> = {
|
|
3
|
-
"&": "&",
|
|
4
|
-
"<": "<",
|
|
5
|
-
">": ">",
|
|
6
|
-
'"': """,
|
|
7
|
-
"'": "'",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
function escapeHtml(text: unknown): string {
|
|
11
|
-
return String(text).replace(/[&<>"']/g, (c) => HTML_ENTITIES[c] ?? c);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
2
|
interface Props {
|
|
15
|
-
content: string;
|
|
3
|
+
content: { srcs: string[] };
|
|
16
4
|
class?: string | undefined;
|
|
17
5
|
style?: string | undefined;
|
|
18
6
|
}
|
|
19
7
|
|
|
20
8
|
const { content, class: className, style } = Astro.props;
|
|
21
|
-
|
|
22
|
-
let html = content;
|
|
23
|
-
if (className)
|
|
24
|
-
html = html.replace('class="lilypond"', `class="lilypond ${className}"`);
|
|
25
|
-
if (style)
|
|
26
|
-
html = html.replace(/<(svg|img)\b/, `<$1 style="${escapeHtml(style)}"`);
|
|
9
|
+
const { srcs } = content;
|
|
27
10
|
---
|
|
28
11
|
|
|
29
|
-
|
|
12
|
+
{
|
|
13
|
+
srcs.length === 1 ? (
|
|
14
|
+
<img data-lilypond-image class={className} src={srcs[0]} alt="" style={style} />
|
|
15
|
+
) : (
|
|
16
|
+
<ol data-lilypond-group class={className} style={style}>
|
|
17
|
+
{srcs.map((src) => (
|
|
18
|
+
<li>
|
|
19
|
+
<img data-lilypond-image src={src} alt="" />
|
|
20
|
+
</li>
|
|
21
|
+
))}
|
|
22
|
+
</ol>
|
|
23
|
+
)
|
|
24
|
+
}
|
package/dist/execLilyPond.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Format
|
|
1
|
+
import type { Format } from "./render.js";
|
|
2
2
|
export interface ExecLilypondOptions {
|
|
3
3
|
binaryPath: string;
|
|
4
4
|
format: Format;
|
|
5
|
-
|
|
5
|
+
crop: boolean;
|
|
6
|
+
resolution: number;
|
|
6
7
|
includePaths: string[];
|
|
7
8
|
timeout: number;
|
|
8
9
|
inputPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execLilyPond.d.ts","sourceRoot":"","sources":["../src/execLilyPond.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
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,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,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"}
|
package/dist/execLilyPond.js
CHANGED
|
@@ -8,8 +8,7 @@ const MAX_BUFFER = 16 * 1024 * 1024; // 16 MiB
|
|
|
8
8
|
* build output); throws a normalized Error on a non-zero exit or timeout.
|
|
9
9
|
*/
|
|
10
10
|
export async function execLilyPond(options) {
|
|
11
|
-
const { binaryPath, format,
|
|
12
|
-
const { resolution, crop } = defaults;
|
|
11
|
+
const { binaryPath, format, crop, resolution, includePaths, timeout, inputPath, outputBase, } = options;
|
|
13
12
|
const args = [
|
|
14
13
|
// Render the correct format
|
|
15
14
|
`--format=${format}`,
|
package/dist/execLilyPond.js.map
CHANGED
|
@@ -1 +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;
|
|
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,IAAI,EACJ,UAAU,EACV,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,e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/index.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import type { AstroIntegration } from "astro";
|
|
|
2
2
|
import { type PluginOptions } from "./plugins/index.js";
|
|
3
3
|
import { type LilypondDefaults } from "./render.js";
|
|
4
4
|
export type { LilypondDefaults, PluginOptions as LilypondPluginOptions };
|
|
5
|
+
/**
|
|
6
|
+
* The default export of a `.ly`/`.lilypond`/`.ily` import — one URL per
|
|
7
|
+
* rendered page, in order, for `<LilyPond>` to build markup from.
|
|
8
|
+
*/
|
|
9
|
+
export interface LilypondContent {
|
|
10
|
+
srcs: string[];
|
|
11
|
+
}
|
|
5
12
|
export interface LilypondOptions extends PluginOptions {
|
|
6
13
|
/**
|
|
7
14
|
* Output format to be written to a file under `outputDir`.
|
|
@@ -9,8 +16,8 @@ export interface LilypondOptions extends PluginOptions {
|
|
|
9
16
|
*/
|
|
10
17
|
format?: "svg" | "png";
|
|
11
18
|
/**
|
|
12
|
-
* Defaults passed to each score
|
|
13
|
-
*
|
|
19
|
+
* Defaults passed to each score.
|
|
20
|
+
* Defaults can still be overridden by individual `.ly` files.
|
|
14
21
|
*/
|
|
15
22
|
defaults?: LilypondDefaults;
|
|
16
23
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EACN,KAAK,aAAa,EAKlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EACN,KAAK,aAAa,EAKlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEN,KAAK,gBAAgB,EAGrB,MAAM,aAAa,CAAC;AAiBrB,YAAY,EAAE,gBAAgB,EAAE,aAAa,IAAI,qBAAqB,EAAE,CAAC;AAEzE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACrD;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAE5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AA2DD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC/B,OAAO,GAAE,eAAoB,GAC3B,gBAAgB,CA2IlB"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
import { pruneOrphanedAssets, pruneStaleAssets } from "./deleteAssets.js";
|
|
6
6
|
import { rehypePlugin, remarkPlugin, satteriPlugin, } from "./plugins/index.js";
|
|
7
|
-
import { defaultOptions, render } from "./render.js";
|
|
8
|
-
import { assetsUrlBaseFor, contentHashFor,
|
|
9
|
-
import {
|
|
7
|
+
import { defaultOptions, render, resolveCrop, } from "./render.js";
|
|
8
|
+
import { assetsUrlBaseFor, contentHashFor, includePathsFor, parseLyImportQuery, prependVersion, resolveDefaults, sourceNameFor, titleFor, } from "./utils/index.js";
|
|
9
|
+
import { writeAssets } from "./writeAsset.js";
|
|
10
10
|
const execFileAsync = promisify(execFile);
|
|
11
11
|
const LY_EXTENSIONS = [".ly", ".lilypond", ".ily"];
|
|
12
12
|
function lyFilePlugin(options) {
|
|
@@ -14,34 +14,46 @@ function lyFilePlugin(options) {
|
|
|
14
14
|
name: "vite-plugin-astro-lilypond-ly",
|
|
15
15
|
enforce: "pre",
|
|
16
16
|
async transform(source, id) {
|
|
17
|
-
|
|
17
|
+
// undefined means an unrecognized query param (e.g. Vite's `?raw`,
|
|
18
|
+
// `?url`) — not ours to render, so let it fall through.
|
|
19
|
+
const query = parseLyImportQuery(id);
|
|
20
|
+
if (!query)
|
|
18
21
|
return;
|
|
19
|
-
const {
|
|
22
|
+
const { pathname, cropOverride } = query;
|
|
23
|
+
if (!LY_EXTENSIONS.some((ext) => pathname.endsWith(ext)))
|
|
24
|
+
return;
|
|
25
|
+
const { version, resolution, crop: cropSetting, } = resolveDefaults(options.defaults);
|
|
26
|
+
const crop = cropOverride ?? resolveCrop(cropSetting, "component");
|
|
20
27
|
const src = version ? prependVersion(source, version) : source;
|
|
21
28
|
const format = options.format ?? defaultOptions.format;
|
|
22
|
-
const includePaths = includePathsFor(
|
|
23
|
-
const sourceName = sourceNameFor(
|
|
29
|
+
const includePaths = includePathsFor(pathname);
|
|
30
|
+
const sourceName = sourceNameFor(pathname);
|
|
24
31
|
const title = titleFor(sourceName);
|
|
25
32
|
const hash = contentHashFor({ source: src, format, resolution, crop });
|
|
26
|
-
const
|
|
27
|
-
const url = await writeAsset({
|
|
33
|
+
const assets = await writeAssets({
|
|
28
34
|
hash,
|
|
29
35
|
title,
|
|
30
36
|
format,
|
|
31
37
|
outputDir: options.assetsDir,
|
|
32
38
|
urlBase: options.assetsUrlBase,
|
|
33
39
|
trackAsset: options.trackAsset,
|
|
34
|
-
|
|
40
|
+
getBuffers: () => render(src, {
|
|
35
41
|
format,
|
|
42
|
+
crop,
|
|
36
43
|
defaults: options.defaults,
|
|
37
44
|
timeout: options.timeout,
|
|
38
45
|
includePaths,
|
|
39
46
|
sourceName,
|
|
40
47
|
}),
|
|
41
48
|
});
|
|
42
|
-
|
|
49
|
+
// Keyed by the full id (including query) so `./score.ly` and
|
|
50
|
+
// `./score.ly?crop` are tracked as independent sources.
|
|
51
|
+
await options.pruneStaleAssets(id, assets.map((asset) => asset.fileName));
|
|
52
|
+
const content = {
|
|
53
|
+
srcs: assets.map((asset) => asset.url),
|
|
54
|
+
};
|
|
43
55
|
return {
|
|
44
|
-
code: `export default ${JSON.stringify(
|
|
56
|
+
code: `export default ${JSON.stringify(content)}`,
|
|
45
57
|
};
|
|
46
58
|
},
|
|
47
59
|
};
|
|
@@ -134,7 +146,7 @@ export default function lilypond(options = {}) {
|
|
|
134
146
|
"astro:config:done": ({ injectTypes }) => {
|
|
135
147
|
injectTypes({
|
|
136
148
|
filename: "ly-types.d.ts",
|
|
137
|
-
content: LY_EXTENSIONS.map((ext) => `declare module "*${ext}" {\n const
|
|
149
|
+
content: LY_EXTENSIONS.map((ext) => `declare module "*${ext}" {\n const content: import("astro-lilypond").LilypondContent;\n export default content;\n}`).join("\n"),
|
|
138
150
|
});
|
|
139
151
|
},
|
|
140
152
|
"astro:build:done": async ({ logger }) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAGN,YAAY,EACZ,YAAY,EACZ,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,O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mBAAmB,GAAG,qBAAqB,CAAC;AAIxD,wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,GAE1B,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"rehype.d.ts","sourceRoot":"","sources":["../../src/plugins/rehype.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAQxD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAIxD,wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,GAE1B,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CA8ExD"}
|
package/dist/plugins/rehype.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { visit } from "unist-util-visit";
|
|
2
|
-
import { defaultOptions, render } from "../render.js";
|
|
3
|
-
import { contentHashFor,
|
|
4
|
-
import {
|
|
2
|
+
import { defaultOptions, render, resolveCrop } from "../render.js";
|
|
3
|
+
import { contentHashFor, includePathsFor, isLilypondLang, prependVersion, renderedHtml, resolveDefaults, sourceNameFor, titleFor, } from "../utils/index.js";
|
|
4
|
+
import { writeAssets } from "../writeAsset.js";
|
|
5
5
|
// Typed loosely so it's assignable to both RehypePlugin and the unified
|
|
6
6
|
// Plugin generic regardless of which @types/hast version the host project pins.
|
|
7
7
|
export function rehypePlugin(options) {
|
|
@@ -32,27 +32,32 @@ export function rehypePlugin(options) {
|
|
|
32
32
|
.filter((c) => c.type === "text")
|
|
33
33
|
.map((c) => c.value)
|
|
34
34
|
.join("");
|
|
35
|
-
const { version, resolution, crop } = resolveDefaults(options.defaults);
|
|
35
|
+
const { version, resolution, crop: cropSetting, } = resolveDefaults(options.defaults);
|
|
36
36
|
const source = version ? prependVersion(raw, version) : raw;
|
|
37
37
|
const format = options.format ?? defaultOptions.format;
|
|
38
|
+
const crop = resolveCrop(cropSetting, "markdown");
|
|
38
39
|
const hash = contentHashFor({ source, format, resolution, crop });
|
|
39
|
-
|
|
40
|
-
const promise = writeAsset({
|
|
40
|
+
const promise = writeAssets({
|
|
41
41
|
hash,
|
|
42
42
|
title,
|
|
43
43
|
format,
|
|
44
44
|
outputDir: options.assetsDir,
|
|
45
45
|
urlBase: options.assetsUrlBase,
|
|
46
46
|
trackAsset: options.trackAsset,
|
|
47
|
-
|
|
47
|
+
getBuffers: () => render(source, {
|
|
48
48
|
format,
|
|
49
|
+
crop,
|
|
49
50
|
defaults: options.defaults,
|
|
50
51
|
timeout: options.timeout,
|
|
51
52
|
includePaths,
|
|
52
53
|
sourceName,
|
|
53
54
|
}),
|
|
54
|
-
}).then((
|
|
55
|
-
|
|
55
|
+
}).then((assets) => {
|
|
56
|
+
fileNames.push(...assets.map((asset) => asset.fileName));
|
|
57
|
+
const rawNode = {
|
|
58
|
+
type: "raw",
|
|
59
|
+
value: renderedHtml(assets.map((asset) => asset.url)),
|
|
60
|
+
};
|
|
56
61
|
parent.children[index] = rawNode;
|
|
57
62
|
});
|
|
58
63
|
promises.push(promise);
|
|
@@ -1 +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;
|
|
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,WAAW,EAAE,MAAM,cAAc,CAAC;AACnE,OA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AAC;aACH,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAQ,EAAE;gBACxB,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACzD,MAAM,OAAO,GAAY;oBACxB,IAAI,EAAE,KAAK;oBACX,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;iBACrD,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;QAE5B,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;YAChB,MAAM,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC;IACF,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1 +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;AActC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,EAAE,IAAI,
|
|
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;AActC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,EAAE,IAAI,CAuD5D,CAAC"}
|
package/dist/plugins/remark.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { visit } from "unist-util-visit";
|
|
2
|
-
import { defaultOptions, render } from "../render.js";
|
|
3
|
-
import { contentHashFor,
|
|
4
|
-
import {
|
|
2
|
+
import { defaultOptions, render, resolveCrop } from "../render.js";
|
|
3
|
+
import { contentHashFor, includePathsFor, isLilypondLang, prependVersion, renderedHtml, resolveDefaults, sourceNameFor, titleFor, } from "../utils/index.js";
|
|
4
|
+
import { writeAssets } from "../writeAsset.js";
|
|
5
5
|
export const remarkPlugin = (options) => {
|
|
6
6
|
return async (tree, file) => {
|
|
7
7
|
const promises = [];
|
|
@@ -12,27 +12,32 @@ export const remarkPlugin = (options) => {
|
|
|
12
12
|
visit(tree, "code", (node, index, parent) => {
|
|
13
13
|
if (!isLilypondLang(node.lang) || index === undefined || !parent)
|
|
14
14
|
return;
|
|
15
|
-
const { version, resolution, crop } = resolveDefaults(options.defaults);
|
|
15
|
+
const { version, resolution, crop: cropSetting, } = resolveDefaults(options.defaults);
|
|
16
16
|
const source = version ? prependVersion(node.value, version) : node.value;
|
|
17
17
|
const format = options.format ?? defaultOptions.format;
|
|
18
|
+
const crop = resolveCrop(cropSetting, "markdown");
|
|
18
19
|
const hash = contentHashFor({ source, format, resolution, crop });
|
|
19
|
-
|
|
20
|
-
const promise = writeAsset({
|
|
20
|
+
const promise = writeAssets({
|
|
21
21
|
hash,
|
|
22
22
|
title,
|
|
23
23
|
format,
|
|
24
24
|
outputDir: options.assetsDir,
|
|
25
25
|
urlBase: options.assetsUrlBase,
|
|
26
26
|
trackAsset: options.trackAsset,
|
|
27
|
-
|
|
27
|
+
getBuffers: () => render(source, {
|
|
28
28
|
format,
|
|
29
|
+
crop,
|
|
29
30
|
defaults: options.defaults,
|
|
30
31
|
timeout: options.timeout,
|
|
31
32
|
includePaths,
|
|
32
33
|
sourceName,
|
|
33
34
|
}),
|
|
34
|
-
}).then((
|
|
35
|
-
|
|
35
|
+
}).then((assets) => {
|
|
36
|
+
fileNames.push(...assets.map((asset) => asset.fileName));
|
|
37
|
+
const htmlNode = {
|
|
38
|
+
type: "html",
|
|
39
|
+
value: renderedHtml(assets.map((asset) => asset.url)),
|
|
40
|
+
};
|
|
36
41
|
parent.children[index] = htmlNode;
|
|
37
42
|
});
|
|
38
43
|
promises.push(promise);
|
|
@@ -1 +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;
|
|
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,WAAW,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACN,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,QAAQ,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C,MAAM,CAAC,MAAM,YAAY,GAAwC,CAAC,OAAO,EAAE,EAAE;IAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,G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["../../src/plugins/satteri.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,SAAS,CAAC;AAa1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAEzD,wBAAgB,aAAa,CAC5B,OAAO,EAAE,oBAAoB,GAC3B,qBAAqB,CAwDvB"}
|
package/dist/plugins/satteri.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defaultOptions, render } from "../render.js";
|
|
2
|
-
import { contentHashFor,
|
|
3
|
-
import {
|
|
1
|
+
import { defaultOptions, render, resolveCrop } from "../render.js";
|
|
2
|
+
import { contentHashFor, includePathsFor, isLilypondLang, prependVersion, renderedHtml, resolveDefaults, sourceNameFor, titleFor, } from "../utils/index.js";
|
|
3
|
+
import { writeAssets } from "../writeAsset.js";
|
|
4
4
|
export function satteriPlugin(options) {
|
|
5
5
|
return {
|
|
6
6
|
name: "astro-lilypond",
|
|
@@ -10,23 +10,24 @@ export function satteriPlugin(options) {
|
|
|
10
10
|
async code(node, ctx) {
|
|
11
11
|
if (!isLilypondLang(node.lang))
|
|
12
12
|
return undefined;
|
|
13
|
-
const { version, resolution, crop } = resolveDefaults(options.defaults);
|
|
13
|
+
const { version, resolution, crop: cropSetting, } = resolveDefaults(options.defaults);
|
|
14
14
|
const source = version ? prependVersion(node.value, version) : node.value;
|
|
15
15
|
const format = options.format ?? defaultOptions.format;
|
|
16
16
|
const includePaths = includePathsFor(ctx.fileURL);
|
|
17
17
|
const sourceName = sourceNameFor(ctx.fileURL);
|
|
18
18
|
const title = titleFor(sourceName);
|
|
19
|
+
const crop = resolveCrop(cropSetting, "markdown");
|
|
19
20
|
const hash = contentHashFor({ source, format, resolution, crop });
|
|
20
|
-
const
|
|
21
|
-
const url = await writeAsset({
|
|
21
|
+
const assets = await writeAssets({
|
|
22
22
|
hash,
|
|
23
23
|
title,
|
|
24
24
|
format,
|
|
25
25
|
outputDir: options.assetsDir,
|
|
26
26
|
urlBase: options.assetsUrlBase,
|
|
27
27
|
trackAsset: options.trackAsset,
|
|
28
|
-
|
|
28
|
+
getBuffers: () => render(source, {
|
|
29
29
|
format,
|
|
30
|
+
crop,
|
|
30
31
|
defaults: options.defaults,
|
|
31
32
|
timeout: options.timeout,
|
|
32
33
|
includePaths,
|
|
@@ -36,11 +37,12 @@ export function satteriPlugin(options) {
|
|
|
36
37
|
// Sätteri has no per-file "done" hook, so prune per block instead.
|
|
37
38
|
if (ctx.fileURL) {
|
|
38
39
|
const index = ctx.indexOf(node) ?? "root";
|
|
39
|
-
await options.pruneStaleAssets(`${ctx.fileURL.href}#${index}`,
|
|
40
|
-
fileName,
|
|
41
|
-
]);
|
|
40
|
+
await options.pruneStaleAssets(`${ctx.fileURL.href}#${index}`, assets.map((asset) => asset.fileName));
|
|
42
41
|
}
|
|
43
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
type: "html",
|
|
44
|
+
value: renderedHtml(assets.map((asset) => asset.url)),
|
|
45
|
+
};
|
|
44
46
|
},
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"satteri.js","sourceRoot":"","sources":["../../src/plugins/satteri.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACN,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,QAAQ,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/C,MAAM,UAAU,aAA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C1B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,YAAY;oBACZ,UAAU;iBACV,CAAC;aACH,CAAC,CAAC;YAEH,mEAAmE;YACnE,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBACjB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC;gBAC1C,MAAM,OAAO,CAAC,gBAAgB,CAC7B,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,EAAE,EAC9B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CACrC,CAAC;YACH,CAAC;YAED,OAAO;gBACN,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACrD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/readOutputFile.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import type { Format } from "./render.js";
|
|
|
6
6
|
* the generic `"input.ly"`.
|
|
7
7
|
*/
|
|
8
8
|
export declare function safeInputFileName(sourceName: string | undefined): string;
|
|
9
|
-
export declare function readOutputFile(base: string, format: Format, crop: boolean): Promise<Buffer>;
|
|
9
|
+
export declare function readOutputFile(base: string, format: Format, crop: boolean): Promise<Buffer[]>;
|
|
10
10
|
//# sourceMappingURL=readOutputFile.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAkBD,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACX,OAAO,CAAC,MAAM,EAAE,CAAC,CAqCnB"}
|
package/dist/readOutputFile.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { basename } from "node:path";
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the base name to use for the temp input file. Strips any
|
|
5
5
|
* directory components from `sourceName` (it may be a full path) and
|
|
@@ -15,28 +15,47 @@ export function safeInputFileName(sourceName) {
|
|
|
15
15
|
}
|
|
16
16
|
return base;
|
|
17
17
|
}
|
|
18
|
+
/** Sorts by the numeric page captured in `match[1]`, ascending. */
|
|
19
|
+
function byPageNumber(a, b) {
|
|
20
|
+
return Number(a[1]) - Number(b[1]);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Multi-page naming convention per format: SVG (and PDF/PS/EPS, should they
|
|
24
|
+
* be added to `FORMATS`) uses `<base>-1.<ext>`; PNG uses `<base>-page1.<ext>`.
|
|
25
|
+
* Listed explicitly so adding a format means stating its convention here,
|
|
26
|
+
* not guessing among known patterns.
|
|
27
|
+
*/
|
|
28
|
+
const PAGE_NUMBER_INFIX = {
|
|
29
|
+
svg: "-",
|
|
30
|
+
png: "-page",
|
|
31
|
+
};
|
|
18
32
|
export async function readOutputFile(base, format, crop) {
|
|
19
33
|
// --define-default crop writes <base>.cropped.<format> alongside <base>.<format>
|
|
20
34
|
if (crop) {
|
|
21
35
|
try {
|
|
22
|
-
return await readFile(`${base}.cropped.${format}`);
|
|
36
|
+
return [await readFile(`${base}.cropped.${format}`)];
|
|
23
37
|
}
|
|
24
38
|
catch (err) {
|
|
25
39
|
throw new Error(`expected cropped output at ${base}.cropped.${format} but it was not found: ${err instanceof Error ? err.message : String(err)}`);
|
|
26
40
|
}
|
|
27
41
|
}
|
|
28
|
-
// Regular output: single page → <base>.<format
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
// Regular output: single page → <base>.<format>; multi-page → numbered
|
|
43
|
+
// per `PAGE_NUMBER_INFIX`. List the directory once so the full page
|
|
44
|
+
// count is known up front, rather than probing paths one at a time.
|
|
45
|
+
const dir = dirname(base);
|
|
46
|
+
const prefix = basename(base);
|
|
47
|
+
const entries = await readdir(dir);
|
|
48
|
+
if (entries.includes(`${prefix}.${format}`)) {
|
|
49
|
+
return [await readFile(join(dir, `${prefix}.${format}`))];
|
|
32
50
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
const pagePattern = new RegExp(`^${prefix}${PAGE_NUMBER_INFIX[format]}(\\d+)\\.${format}$`);
|
|
52
|
+
const pages = entries
|
|
53
|
+
.map((name) => name.match(pagePattern))
|
|
54
|
+
.filter((match) => match !== null)
|
|
55
|
+
.sort(byPageNumber);
|
|
56
|
+
if (pages.length > 0) {
|
|
57
|
+
return Promise.all(pages.map((match) => readFile(join(dir, match[0]))));
|
|
40
58
|
}
|
|
59
|
+
throw new Error(`no ${format} output found in ${dir}`);
|
|
41
60
|
}
|
|
42
61
|
//# sourceMappingURL=readOutputFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOutputFile.js","sourceRoot":"","sources":["../src/readOutputFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
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1,25 @@
|
|
|
1
1
|
import type { LilypondVersion } from "./types/lilypondVersion.js";
|
|
2
2
|
export declare const FORMATS: readonly ["png", "svg"];
|
|
3
3
|
export type Format = (typeof FORMATS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Controls whether rendered output is cropped tightly to the content
|
|
6
|
+
* bounding box, or left as full, potentially multi-page, output.
|
|
7
|
+
*
|
|
8
|
+
* - `true` — crop everywhere: Markdown fences and `<LilyPond>` `.ly` imports.
|
|
9
|
+
* - `false` — never crop by default (a `.ly` import can still opt in with
|
|
10
|
+
* `?crop`).
|
|
11
|
+
* - `"markdown-only"` — crop Markdown fences, but leave `<LilyPond>` `.ly`
|
|
12
|
+
* imports uncropped unless the import opts in with `?crop`.
|
|
13
|
+
*/
|
|
14
|
+
export type CropSetting = boolean | "markdown-only";
|
|
15
|
+
/** Which kind of consumer is resolving a `CropSetting` — see `resolveCrop`. */
|
|
16
|
+
export type CropContext = "markdown" | "component";
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the three-way `CropSetting` into the plain boolean a given
|
|
19
|
+
* consumer needs, per the semantics documented on `CropSetting`. Shared by
|
|
20
|
+
* every plugin that reads `defaults.crop`, instead of each re-deriving it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveCrop(cropSetting: CropSetting, context: CropContext): boolean;
|
|
4
23
|
/**
|
|
5
24
|
* Defaults passed to each score for rendering.
|
|
6
25
|
* Individual `.ly` files can still override.
|
|
@@ -18,18 +37,18 @@ export interface LilypondDefaults {
|
|
|
18
37
|
*/
|
|
19
38
|
resolution?: number;
|
|
20
39
|
/**
|
|
21
|
-
* Crop the output tightly to the content bounding box
|
|
22
|
-
*
|
|
23
|
-
* @default
|
|
40
|
+
* Crop the output tightly to the content bounding box, producing one
|
|
41
|
+
* continuous image instead of paginated output.
|
|
42
|
+
* @default "markdown-only"
|
|
24
43
|
*/
|
|
25
|
-
crop?:
|
|
44
|
+
crop?: CropSetting;
|
|
26
45
|
}
|
|
27
46
|
/**
|
|
28
|
-
* The subset of `LilypondDefaults`
|
|
29
|
-
*
|
|
30
|
-
*
|
|
47
|
+
* The subset of `LilypondDefaults` that `render()` itself reads. `version`
|
|
48
|
+
* and `crop` are resolved by the caller before reaching `render()`
|
|
49
|
+
* (`version` by prepending it to source text, `crop` via `resolveCrop`).
|
|
31
50
|
*/
|
|
32
|
-
export type
|
|
51
|
+
export type RenderDefaults = Omit<LilypondDefaults, "version" | "crop">;
|
|
33
52
|
export interface RenderOptions {
|
|
34
53
|
/**
|
|
35
54
|
* Output format.
|
|
@@ -37,11 +56,17 @@ export interface RenderOptions {
|
|
|
37
56
|
*/
|
|
38
57
|
format?: Format;
|
|
39
58
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
59
|
+
* Crop the output tightly to the content bounding box, producing one
|
|
60
|
+
* continuous image instead of paginated output. Disable for full-page,
|
|
61
|
+
* potentially multi-page output.
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
crop?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Defaults for rendering each score. `version` and `crop` aren't read
|
|
67
|
+
* here — see `RenderDefaults`.
|
|
43
68
|
*/
|
|
44
|
-
defaults?:
|
|
69
|
+
defaults?: RenderDefaults;
|
|
45
70
|
/**
|
|
46
71
|
* Path to the `lilypond` binary.
|
|
47
72
|
* @default "lilypond"
|
|
@@ -68,5 +93,5 @@ export interface RenderOptions {
|
|
|
68
93
|
export declare const defaultOptions: Required<Omit<RenderOptions, "includePaths" | "sourceName" | "defaults">> & {
|
|
69
94
|
defaults: Required<LilypondDefaults>;
|
|
70
95
|
};
|
|
71
|
-
export declare function render(source: string, options?: RenderOptions): Promise<Buffer>;
|
|
96
|
+
export declare function render(source: string, options?: RenderOptions): Promise<Buffer[]>;
|
|
72
97
|
//# sourceMappingURL=render.d.ts.map
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,eAAO,MAAM,OAAO,YAAI,KAAK,EAAE,KAAK,CAAU,CAAC;AAE/C,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,eAAO,MAAM,OAAO,YAAI,KAAK,EAAE,KAAK,CAAU,CAAC;AAE/C,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,eAAe,CAAC;AAEpD,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,WAAW,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,WAAW,GAClB,OAAO,CAET;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAExE,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CACpC,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,YAAY,GAAG,UAAU,CAAC,CAC/D,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAA;CAUzC,CAAC;AAEF,wBAAsB,MAAM,CAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCnB"}
|
package/dist/render.js
CHANGED
|
@@ -5,20 +5,28 @@ import { execLilyPond } from "./execLilyPond.js";
|
|
|
5
5
|
import { readOutputFile, safeInputFileName } from "./readOutputFile.js";
|
|
6
6
|
import { resolveDefaults } from "./utils/resolveDefaults.js";
|
|
7
7
|
export const FORMATS = ["png", "svg"];
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the three-way `CropSetting` into the plain boolean a given
|
|
10
|
+
* consumer needs, per the semantics documented on `CropSetting`. Shared by
|
|
11
|
+
* every plugin that reads `defaults.crop`, instead of each re-deriving it.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveCrop(cropSetting, context) {
|
|
14
|
+
return context === "markdown" ? cropSetting !== false : cropSetting === true;
|
|
15
|
+
}
|
|
8
16
|
export const defaultOptions = {
|
|
9
17
|
format: "svg",
|
|
18
|
+
crop: true,
|
|
10
19
|
binaryPath: "lilypond",
|
|
11
20
|
timeout: 60_000,
|
|
12
21
|
defaults: {
|
|
13
22
|
version: "2.26.0",
|
|
14
23
|
resolution: 144,
|
|
15
|
-
crop:
|
|
24
|
+
crop: "markdown-only",
|
|
16
25
|
},
|
|
17
26
|
};
|
|
18
27
|
export async function render(source, options = {}) {
|
|
19
|
-
const { format = defaultOptions.format, binaryPath = defaultOptions.binaryPath, timeout = defaultOptions.timeout, includePaths = [], sourceName, } = options;
|
|
20
|
-
const { resolution
|
|
21
|
-
const defaults = { resolution, crop };
|
|
28
|
+
const { format = defaultOptions.format, crop = defaultOptions.crop, binaryPath = defaultOptions.binaryPath, timeout = defaultOptions.timeout, includePaths = [], sourceName, } = options;
|
|
29
|
+
const { resolution } = resolveDefaults(options.defaults);
|
|
22
30
|
if (!FORMATS.includes(format)) {
|
|
23
31
|
throw new Error(`${format} is not a supported format`);
|
|
24
32
|
}
|
|
@@ -30,7 +38,8 @@ export async function render(source, options = {}) {
|
|
|
30
38
|
await execLilyPond({
|
|
31
39
|
binaryPath,
|
|
32
40
|
format,
|
|
33
|
-
|
|
41
|
+
crop,
|
|
42
|
+
resolution,
|
|
34
43
|
includePaths,
|
|
35
44
|
timeout,
|
|
36
45
|
inputPath,
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,M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,GACV,GAAG,OAAO,CAAC;IAEZ,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEzD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,4BAA4B,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAEvC,IAAI,CAAC;QACJ,MAAM,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE3C,MAAM,YAAY,CAAC;YAClB,UAAU;YACV,MAAM;YACN,IAAI;YACJ,UAAU;YACV,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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Joins Astro's `base` config with the configured output directory name
|
|
3
|
-
* into a clean URL prefix
|
|
4
|
-
* — regardless of whether `base` is `"/"`, `"/docs"`, or `"/docs/"`.
|
|
3
|
+
* into a clean URL prefix.
|
|
5
4
|
*/
|
|
6
5
|
export declare function assetsUrlBaseFor(base: string, outputDirName: string): string;
|
|
7
6
|
//# sourceMappingURL=assetsUrlBaseFor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetsUrlBaseFor.d.ts","sourceRoot":"","sources":["../../src/utils/assetsUrlBaseFor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assetsUrlBaseFor.d.ts","sourceRoot":"","sources":["../../src/utils/assetsUrlBaseFor.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAE5E"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
1
2
|
/**
|
|
2
3
|
* Joins Astro's `base` config with the configured output directory name
|
|
3
|
-
* into a clean URL prefix
|
|
4
|
-
* — regardless of whether `base` is `"/"`, `"/docs"`, or `"/docs/"`.
|
|
4
|
+
* into a clean URL prefix.
|
|
5
5
|
*/
|
|
6
6
|
export function assetsUrlBaseFor(base, outputDirName) {
|
|
7
|
-
|
|
8
|
-
const trimmedDir = outputDirName.replace(/^\/+|\/+$/g, "");
|
|
9
|
-
return `${trimmedBase}/${trimmedDir}`;
|
|
7
|
+
return posix.join(base, outputDirName);
|
|
10
8
|
}
|
|
11
9
|
//# sourceMappingURL=assetsUrlBaseFor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetsUrlBaseFor.js","sourceRoot":"","sources":["../../src/utils/assetsUrlBaseFor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"assetsUrlBaseFor.js","sourceRoot":"","sources":["../../src/utils/assetsUrlBaseFor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,aAAqB;IACnE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { assetsUrlBaseFor } from "./assetsUrlBaseFor.js";
|
|
2
2
|
export { contentHashFor } from "./contentHashFor.js";
|
|
3
|
-
export { imgTag } from "./imgTag.js";
|
|
4
3
|
export { includePathsFor } from "./includePathsFor.js";
|
|
5
4
|
export { isLilypondLang } from "./isLilypondLang.js";
|
|
5
|
+
export { parseLyImportQuery } from "./lyImportQuery.js";
|
|
6
6
|
export { contentTypeFor, isOwnAssetFileName } from "./ownAssetFileName.js";
|
|
7
7
|
export { prependVersion } from "./prependVersion.js";
|
|
8
|
+
export { renderedHtml } from "./renderedHtml.js";
|
|
8
9
|
export { resolveDefaults } from "./resolveDefaults.js";
|
|
9
10
|
export { sourceNameFor } from "./sourceNameFor.js";
|
|
10
11
|
export { titleFor } from "./titleFor.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { assetsUrlBaseFor } from "./assetsUrlBaseFor.js";
|
|
2
2
|
export { contentHashFor } from "./contentHashFor.js";
|
|
3
|
-
export { imgTag } from "./imgTag.js";
|
|
4
3
|
export { includePathsFor } from "./includePathsFor.js";
|
|
5
4
|
export { isLilypondLang } from "./isLilypondLang.js";
|
|
5
|
+
export { parseLyImportQuery } from "./lyImportQuery.js";
|
|
6
6
|
export { contentTypeFor, isOwnAssetFileName } from "./ownAssetFileName.js";
|
|
7
7
|
export { prependVersion } from "./prependVersion.js";
|
|
8
|
+
export { renderedHtml } from "./renderedHtml.js";
|
|
8
9
|
export { resolveDefaults } from "./resolveDefaults.js";
|
|
9
10
|
export { sourceNameFor } from "./sourceNameFor.js";
|
|
10
11
|
export { titleFor } from "./titleFor.js";
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface LyImportQuery {
|
|
2
|
+
/** The import's module id with any query string stripped. */
|
|
3
|
+
pathname: string;
|
|
4
|
+
/**
|
|
5
|
+
* The crop override the import's query string requests, if any:
|
|
6
|
+
* `true` for `?crop`, `false` for `?nocrop`, `undefined` if neither is
|
|
7
|
+
* present (the caller's own default applies).
|
|
8
|
+
*/
|
|
9
|
+
cropOverride: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parses a Vite module id for a `.ly`/`.lilypond`/`.ily` import into its
|
|
13
|
+
* pathname and this plugin's `?crop`/`?nocrop` override.
|
|
14
|
+
*
|
|
15
|
+
* Returns `undefined` when the id carries a query param this plugin
|
|
16
|
+
* doesn't own (e.g. Vite's built-in `?raw`, `?url`) — such imports aren't
|
|
17
|
+
* ours to render, and the caller should let them fall through to whichever
|
|
18
|
+
* plugin does own them.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseLyImportQuery(id: string): LyImportQuery | undefined;
|
|
21
|
+
//# sourceMappingURL=lyImportQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lyImportQuery.d.ts","sourceRoot":"","sources":["../../src/utils/lyImportQuery.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC7B,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,YAAY,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAkBxE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Query params `lyFilePlugin` recognizes as its own on a `.ly`-family import. */
|
|
2
|
+
const RECOGNIZED_PARAMS = new Set(["crop", "nocrop"]);
|
|
3
|
+
/**
|
|
4
|
+
* Parses a Vite module id for a `.ly`/`.lilypond`/`.ily` import into its
|
|
5
|
+
* pathname and this plugin's `?crop`/`?nocrop` override.
|
|
6
|
+
*
|
|
7
|
+
* Returns `undefined` when the id carries a query param this plugin
|
|
8
|
+
* doesn't own (e.g. Vite's built-in `?raw`, `?url`) — such imports aren't
|
|
9
|
+
* ours to render, and the caller should let them fall through to whichever
|
|
10
|
+
* plugin does own them.
|
|
11
|
+
*/
|
|
12
|
+
export function parseLyImportQuery(id) {
|
|
13
|
+
const queryIndex = id.indexOf("?");
|
|
14
|
+
const pathname = queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
15
|
+
const params = new URLSearchParams(queryIndex === -1 ? "" : id.slice(queryIndex + 1));
|
|
16
|
+
if ([...params.keys()].some((key) => !RECOGNIZED_PARAMS.has(key))) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const cropOverride = params.has("crop")
|
|
20
|
+
? true
|
|
21
|
+
: params.has("nocrop")
|
|
22
|
+
? false
|
|
23
|
+
: undefined;
|
|
24
|
+
return { pathname, cropOverride };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=lyImportQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lyImportQuery.js","sourceRoot":"","sources":["../../src/utils/lyImportQuery.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AActD;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC5C,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,IAAI,eAAe,CACjC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CACjD,CAAC;IAEF,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;QACtC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;YACrB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps a rendered score's page URLs in the markup embedded in the page.
|
|
3
|
+
* A single page is a plain `<img>`; multiple pages are wrapped in an
|
|
4
|
+
* `<ol><li>` so every page renders, in order.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderedHtml(srcs: string[]): string;
|
|
7
|
+
//# sourceMappingURL=renderedHtml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderedHtml.d.ts","sourceRoot":"","sources":["../../src/utils/renderedHtml.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps a rendered score's page URLs in the markup embedded in the page.
|
|
3
|
+
* A single page is a plain `<img>`; multiple pages are wrapped in an
|
|
4
|
+
* `<ol><li>` so every page renders, in order.
|
|
5
|
+
*/
|
|
6
|
+
export function renderedHtml(srcs) {
|
|
7
|
+
if (srcs.length === 1) {
|
|
8
|
+
return `<img data-lilypond-image src="${srcs[0]}" alt="">`;
|
|
9
|
+
}
|
|
10
|
+
return `<ol data-lilypond-group>${srcs
|
|
11
|
+
.map((src) => `<li><img data-lilypond-image src="${src}" alt=""></li>`)
|
|
12
|
+
.join("")}</ol>`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=renderedHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderedHtml.js","sourceRoot":"","sources":["../../src/utils/renderedHtml.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAc;IAC1C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,iCAAiC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC5D,CAAC;IAED,OAAO,2BAA2B,IAAI;SACpC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,qCAAqC,GAAG,gBAAgB,CAAC;SACtE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;AACnB,CAAC"}
|
package/dist/writeAsset.d.ts
CHANGED
|
@@ -13,19 +13,25 @@ export interface WriteAssetOptions {
|
|
|
13
13
|
outputDir: string;
|
|
14
14
|
/** URL prefix the returned URL is built from, e.g. `"/_lilypond"`. */
|
|
15
15
|
urlBase: string;
|
|
16
|
-
/** Called with
|
|
16
|
+
/** Called with each written/reused file's name, hit or miss. */
|
|
17
17
|
trackAsset?: (fileName: string) => void;
|
|
18
18
|
/**
|
|
19
|
-
* Produces the bytes to write. Only invoked on a
|
|
20
|
-
* can defer an expensive render behind this and
|
|
21
|
-
* content-addressed file already
|
|
19
|
+
* Produces the bytes to write, one Buffer per page. Only invoked on a
|
|
20
|
+
* cache miss, so a caller can defer an expensive render behind this and
|
|
21
|
+
* skip it entirely when the content-addressed file(s) already exist.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
getBuffers: () => Promise<Buffer[]>;
|
|
24
|
+
}
|
|
25
|
+
export interface WrittenAsset {
|
|
26
|
+
/** Bare filename under `outputDir`. */
|
|
27
|
+
fileName: string;
|
|
28
|
+
/** Public URL to reference the file by. */
|
|
29
|
+
url: string;
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
26
|
-
* Persists rendered
|
|
27
|
-
* skipping the render entirely if
|
|
28
|
-
* public URL
|
|
32
|
+
* Persists rendered pages to content-addressed files under `outputDir`,
|
|
33
|
+
* skipping the render entirely if page 1 already exists on disk, and returns
|
|
34
|
+
* each page's filename and public URL, in page order.
|
|
29
35
|
*/
|
|
30
|
-
export declare function
|
|
36
|
+
export declare function writeAssets(options: WriteAssetOptions): Promise<WrittenAsset[]>;
|
|
31
37
|
//# sourceMappingURL=writeAsset.d.ts.map
|
package/dist/writeAsset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeAsset.d.ts","sourceRoot":"","sources":["../src/writeAsset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IACjC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IAEf,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAElB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAEhB
|
|
1
|
+
{"version":3,"file":"writeAsset.d.ts","sourceRoot":"","sources":["../src/writeAsset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IACjC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IAEf,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAElB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC;;;;OAIG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC5B,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IAEjB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;CACZ;AA0CD;;;;GAIG;AACH,wBAAsB,WAAW,CAChC,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,YAAY,EAAE,CAAC,CAwCzB"}
|
package/dist/writeAsset.js
CHANGED
|
@@ -1,29 +1,69 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { access, mkdir, rename, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
/** Page 1 keeps the plain `<hash>.<title>.<format>` name; later pages get `-pN`. */
|
|
5
|
+
function pageFileName(hash, title, format, page) {
|
|
6
|
+
return page === 1
|
|
7
|
+
? `${hash}.${title}.${format}`
|
|
8
|
+
: `${hash}.${title}-p${page}.${format}`;
|
|
9
|
+
}
|
|
10
|
+
async function exists(path) {
|
|
11
|
+
return access(path).then(() => true, () => false);
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
14
|
+
* Finds every already-written sibling page after page 1, stopping at the
|
|
15
|
+
* first missing page number — pages are written contiguously, so a gap
|
|
16
|
+
* means the end. Costs one `access()` per actual page (typically 0-2)
|
|
17
|
+
* rather than listing the whole (potentially large, shared) `outputDir`.
|
|
8
18
|
*/
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
async function existingSiblingPages(outputDir, hash, title, format) {
|
|
20
|
+
const siblings = [];
|
|
21
|
+
for (let page = 2;; page++) {
|
|
22
|
+
const fileName = pageFileName(hash, title, format, page);
|
|
23
|
+
if (!(await exists(join(outputDir, fileName))))
|
|
24
|
+
break;
|
|
25
|
+
siblings.push(fileName);
|
|
26
|
+
}
|
|
27
|
+
return siblings;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Persists rendered pages to content-addressed files under `outputDir`,
|
|
31
|
+
* skipping the render entirely if page 1 already exists on disk, and returns
|
|
32
|
+
* each page's filename and public URL, in page order.
|
|
33
|
+
*/
|
|
34
|
+
export async function writeAssets(options) {
|
|
35
|
+
const { hash, title, format, outputDir, urlBase, trackAsset, getBuffers } = options;
|
|
36
|
+
const page1Name = pageFileName(hash, title, format, 1);
|
|
37
|
+
const page1Path = join(outputDir, page1Name);
|
|
38
|
+
const alreadyWritten = await exists(page1Path);
|
|
39
|
+
let fileNames;
|
|
40
|
+
if (alreadyWritten) {
|
|
41
|
+
fileNames = [
|
|
42
|
+
page1Name,
|
|
43
|
+
...(await existingSiblingPages(outputDir, hash, title, format)),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const buffers = await getBuffers();
|
|
48
|
+
fileNames = buffers.map((_, i) => pageFileName(hash, title, format, i + 1));
|
|
17
49
|
await mkdir(outputDir, { recursive: true });
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
50
|
+
await Promise.all(buffers.map(async (buf, i) => {
|
|
51
|
+
const destPath = join(outputDir, fileNames[i]);
|
|
52
|
+
// Write to a uniquely-suffixed temp file, then atomically rename
|
|
53
|
+
// onto the final path — safe under concurrent writers racing to
|
|
54
|
+
// produce the same hash, since identical hashes imply identical
|
|
55
|
+
// bytes, so whichever rename lands "wins" without ever leaving a
|
|
56
|
+
// corrupt/partial file.
|
|
57
|
+
const tmpPath = `${destPath}.${randomUUID()}.tmp`;
|
|
58
|
+
await writeFile(tmpPath, buf);
|
|
59
|
+
await rename(tmpPath, destPath);
|
|
60
|
+
}));
|
|
25
61
|
}
|
|
26
|
-
|
|
27
|
-
|
|
62
|
+
for (const fileName of fileNames)
|
|
63
|
+
trackAsset?.(fileName);
|
|
64
|
+
return fileNames.map((fileName) => ({
|
|
65
|
+
fileName,
|
|
66
|
+
url: `${urlBase}/${fileName}`,
|
|
67
|
+
}));
|
|
28
68
|
}
|
|
29
69
|
//# sourceMappingURL=writeAsset.js.map
|
package/dist/writeAsset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeAsset.js","sourceRoot":"","sources":["../src/writeAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"writeAsset.js","sourceRoot":"","sources":["../src/writeAsset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KA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AAC,QAAQ,CAAC,CAAC;IAEzD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnC,QAAQ;QACR,GAAG,EAAE,GAAG,OAAO,IAAI,QAAQ,EAAE;KAC7B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
package/dist/utils/imgTag.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imgTag.d.ts","sourceRoot":"","sources":["../../src/utils/imgTag.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C"}
|
package/dist/utils/imgTag.js
DELETED
package/dist/utils/imgTag.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imgTag.js","sourceRoot":"","sources":["../../src/utils/imgTag.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IACjC,OAAO,8BAA8B,GAAG,WAAW,CAAC;AACrD,CAAC"}
|