From e1c80209df752a028f21531babc47d8bf399f4d0 Mon Sep 17 00:00:00 2001 From: henrikvilhelmberglund Date: Sun, 15 Oct 2023 00:39:59 +0200 Subject: [PATCH 1/4] fix: replace yaml dash with underscore to prevent build error --- packages/mdsvex/src/transformers/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mdsvex/src/transformers/index.ts b/packages/mdsvex/src/transformers/index.ts index a992fcca..f7759dde 100644 --- a/packages/mdsvex/src/transformers/index.ts +++ b/packages/mdsvex/src/transformers/index.ts @@ -332,7 +332,7 @@ export function transform_hast({ const fm = metadata && `export const metadata = ${stringified};${newline}` + - `\tconst { ${Object.keys(metadata).join(', ')} } = metadata;`; + `\tconst { ${Object.keys(metadata).join(', ').replace("-","_")} } = metadata;`; const frontmatter_layout = metadata && (metadata.layout as string | undefined | false); From 8c7bdd70091b9e7708a677284e7a9eb24b4dce4d Mon Sep 17 00:00:00 2001 From: henrikvilhelmberglund Date: Sun, 15 Oct 2023 00:57:23 +0200 Subject: [PATCH 2/4] chore: add changeset --- .changeset/moody-balloons-cheat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-balloons-cheat.md diff --git a/.changeset/moody-balloons-cheat.md b/.changeset/moody-balloons-cheat.md new file mode 100644 index 00000000..f94d16db --- /dev/null +++ b/.changeset/moody-balloons-cheat.md @@ -0,0 +1,5 @@ +--- +'mdsvex': patch +--- + +Replace hyphen in YAML frontmatter with underscore to prevent issues when building From 4b8f35b5f19851219c296c4506b51103cd69cca5 Mon Sep 17 00:00:00 2001 From: henrikvilhelmberglund Date: Thu, 15 Aug 2024 15:26:16 +0200 Subject: [PATCH 3/4] chore: lint --- packages/mdsvex/src/transformers/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/mdsvex/src/transformers/index.ts b/packages/mdsvex/src/transformers/index.ts index 0e960a9b..d4368de1 100644 --- a/packages/mdsvex/src/transformers/index.ts +++ b/packages/mdsvex/src/transformers/index.ts @@ -332,7 +332,9 @@ export function transform_hast({ const fm = metadata && `export const metadata = ${stringified};${newline}` + - `\tconst { ${Object.keys(metadata).join(', ').replace("-","_")} } = metadata;`; + `\tconst { ${Object.keys(metadata) + .join(', ') + .replace('-', '_')} } = metadata;`; const frontmatter_layout = metadata && (metadata.layout as string | undefined | false); From 3d717fa440b1353865e5b1889a24a82721374159 Mon Sep 17 00:00:00 2001 From: henrikvilhelmberglund Date: Thu, 15 Aug 2024 19:02:34 +0200 Subject: [PATCH 4/4] fix: use regex instead to replace all dashes --- packages/mdsvex/src/transformers/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mdsvex/src/transformers/index.ts b/packages/mdsvex/src/transformers/index.ts index d4368de1..8ca31803 100644 --- a/packages/mdsvex/src/transformers/index.ts +++ b/packages/mdsvex/src/transformers/index.ts @@ -334,7 +334,7 @@ export function transform_hast({ `export const metadata = ${stringified};${newline}` + `\tconst { ${Object.keys(metadata) .join(', ') - .replace('-', '_')} } = metadata;`; + .replace(/-/g, '_')} } = metadata;`; const frontmatter_layout = metadata && (metadata.layout as string | undefined | false);