Skip to content

Commit e859f6d

Browse files
committed
🎨 Prettify files
1 parent afc4036 commit e859f6d

File tree

23 files changed

+75
-66
lines changed

23 files changed

+75
-66
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ export const load: PageLoad = async () => {
588588
slug: module.slug,
589589
frontmatter: module.frontmatter,
590590
};
591-
})
591+
}),
592592
);
593593
return { content };
594594
};

‎rollup.config.js‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ export default [
77
{
88
input: "src/index.ts",
99
output: [
10-
{
11-
file: "dist/main.cjs.js",
12-
format: "cjs",
10+
{
11+
file: "dist/main.cjs.js",
12+
format: "cjs",
1313
sourcemap: true,
14-
exports: "named"
14+
exports: "named",
1515
},
16-
{
17-
file: "dist/main.mjs",
18-
format: "esm",
16+
{
17+
file: "dist/main.mjs",
18+
format: "esm",
1919
sourcemap: true,
20-
exports: "named"
20+
exports: "named",
2121
},
2222
],
2323
external: ["@markdoc/markdoc", "fs", "path", "svelte", "vite", "yaml"],
2424
plugins: [
2525
typescript({
2626
sourceMap: true,
27-
inlineSources: true
28-
}),
27+
inlineSources: true,
28+
}),
2929
nodeResolve(),
30-
terser()
30+
terser(),
3131
],
3232
},
3333
{

‎src/components.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ export const extractUsedSvelteComponents = (
1717

1818
const traverse = (currentNode: RenderableTreeNode | null | undefined) => {
1919
// If current node can't be a component, skip it
20-
if (!currentNode || typeof currentNode === 'string' || typeof currentNode === 'number' || typeof currentNode === 'boolean')
20+
if (
21+
!currentNode ||
22+
typeof currentNode === "string" ||
23+
typeof currentNode === "number" ||
24+
typeof currentNode === "boolean"
25+
)
2126
return;
2227

2328
// Recursively work through children of arrays until get to objects
@@ -31,7 +36,11 @@ export const extractUsedSvelteComponents = (
3136
// Check if this RenderableTreeNode object itself represents a Svelte component.
3237
// 'currentNode.name' here is the name of the component/tag to be rendered.
3338
// Convention: if node.name starts with an uppercase letter, it's a Svelte component.
34-
if (currentNode.name && typeof currentNode.name === 'string' && /\p{Lu}/u.test(currentNode.name)) {
39+
if (
40+
currentNode.name &&
41+
typeof currentNode.name === "string" &&
42+
/\p{Lu}/u.test(currentNode.name)
43+
) {
3544
usedComponents.add(currentNode.name);
3645
}
3746

@@ -41,7 +50,7 @@ export const extractUsedSvelteComponents = (
4150
traverse(child as RenderableTreeNode | null | undefined);
4251
}
4352
}
44-
}
53+
};
4554

4655
traverse(node);
4756
return usedComponents;
@@ -63,7 +72,7 @@ export const getComponentImports = (
6372
for (const componentName of usedSvelteComponentNames) {
6473
// Use Vite's normalizePath for proper cross-platform path handling
6574
const componentPath = normalizePath(
66-
`${componentDirPath}/${componentName}.svelte`
75+
`${componentDirPath}/${componentName}.svelte`,
6776
);
6877

6978
// Generate the import statement

‎src/headings.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface Heading {
2323
*/
2424
export function collectHeadings(
2525
node: RenderableTreeNode | RenderableTreeNode[],
26-
sections: Heading[] = []
26+
sections: Heading[] = [],
2727
): Heading[] {
2828
// Handle array of nodes
2929
if (Array.isArray(node)) {

‎src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { markdocPreprocess } from "./main.ts";
22

33
export { default as Markdoc } from "@markdoc/markdoc";
4-
export type { Config } from "@markdoc/markdoc";
4+
export type { Config } from "@markdoc/markdoc";

‎src/main.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const markdocPreprocess = (options: Options = {}): PreprocessorGroup => {
4444
for (const key in options) {
4545
if (!validOptionKeys.includes(key as keyof Options)) {
4646
log.warn(
47-
`Invalid option "${key}" provided and ignored. Check the documentation for valid options.`
47+
`Invalid option "${key}" provided and ignored. Check the documentation for valid options.`,
4848
);
4949
}
5050
}
@@ -193,7 +193,7 @@ export const markdocPreprocess = (options: Options = {}): PreprocessorGroup => {
193193
extractUsedSvelteComponents(transformedContent);
194194
const componentImportStatements = getComponentImports(
195195
usedSvelteComponentNames,
196-
componentsPath
196+
componentsPath,
197197
);
198198

199199
// Construct script tag content

‎src/render.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const voidElements = new Set([
3232
* For other types, returns an empty string.
3333
*/
3434
const escapeChildrenToString = (
35-
content: string | RenderableTreeNode[] | { [key: string]: Scalar }
35+
content: string | RenderableTreeNode[] | { [key: string]: Scalar },
3636
): string => {
3737
if (typeof content === "string") {
3838
return escapeHtml(content);
@@ -76,7 +76,7 @@ const render = (node: RenderableTreeNodes): string => {
7676
const attributesList = Object.entries(attributes ?? {}).reduce(
7777
(accumulator, [key, value]) =>
7878
accumulator + ` ${key}="${escapeHtml(String(value))}"`,
79-
""
79+
"",
8080
);
8181
const openingTag = `<${tagName}${attributesList}`;
8282

‎src/schema.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface LoadedConfig {
3333
* - deps: An array of absolute file paths as dependencies for Svelte preprocessor.
3434
*/
3535
const loadSchemas = async (
36-
directory: string
36+
directory: string,
3737
): Promise<{
3838
config: LoadedConfig;
3939
deps: string[];
@@ -52,21 +52,21 @@ const loadSchemas = async (
5252
*/
5353
// Define readDirectory overloads (public signatures)
5454
async function readConfigPart(
55-
configPartName: "nodes"
55+
configPartName: "nodes",
5656
): Promise<Config["nodes"] | null>;
5757
async function readConfigPart(
58-
configPartName: "tags"
58+
configPartName: "tags",
5959
): Promise<Config["tags"] | null>;
6060
async function readConfigPart(
61-
configPartName: "variables"
61+
configPartName: "variables",
6262
): Promise<Config["variables"] | null>;
6363
async function readConfigPart(
64-
configPartName: "functions"
64+
configPartName: "functions",
6565
): Promise<Config["functions"] | null>;
6666

6767
// Implementation Signature
6868
async function readConfigPart(
69-
configPartName: string
69+
configPartName: string,
7070
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
7171
): Promise<unknown | null> {
7272
try {

‎src/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type ValidationLevel =
1515

1616
/**
1717
* Configuration options for the Markdoc preprocessor
18-
*/
18+
*/
1919
export interface Options {
2020
/**
2121
* File extensions to preprocess.

‎test/markdoc-parsing.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("Markdown parsing", () => {
88
await markdocPreprocess().markup!({
99
content: commonMark,
1010
filename: "test.md",
11-
})
11+
}),
1212
).toMatchSnapshot();
1313
});
1414

@@ -17,7 +17,7 @@ describe("Markdown parsing", () => {
1717
await markdocPreprocess().markup!({
1818
content: basicMarkdoc,
1919
filename: "test.md",
20-
})
20+
}),
2121
).toMatchSnapshot();
2222
});
2323
});

0 commit comments

Comments
 (0)