Skip to content

Commit

Permalink
fix: get rid of top level await for now
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Jun 1, 2024
1 parent a7887d8 commit dc4f054
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

18 changes: 10 additions & 8 deletions dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@ const setFileName = (value) => {
});
};

if (schemaValue) {
schemaSelect!.value = schemaValue;
await getSchema(schemaValue);
document.querySelectorAll("h2 code span").forEach((el) => {
el.textContent = schemaValue.split(".")[0];
});
setFileName(schemaValue.split(".")[0]);
}
(async () => {
if (schemaValue) {
schemaSelect!.value = schemaValue;
await getSchema(schemaValue);
document.querySelectorAll("h2 code span").forEach((el) => {
el.textContent = schemaValue.split(".")[0];
});
setFileName(schemaValue.split(".")[0]);
}
})();

schemaSelect!.onchange = async (e) => {
const val = e.target!.value!;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
"scripts": {
"dev": "vite ./dev --port 3000",
"build": "pnpm tsc && tsc --module commonjs --target es2017 --outDir cjs && vite build ./dev --outDir ../public --emptyOutDir",
"build": "pnpm tsc && tsc --module commonjs --outDir cjs && vite build ./dev --outDir ../public --emptyOutDir",
"test": "vitest --dom",
"test:coverage": "vitest run --dom --coverage ",
"tsc": "NODE_OPTIONS=--experimental-specifier-resolution=node tsc && pnpm replace:env",
Expand Down
9 changes: 5 additions & 4 deletions src/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ const renderer = md({
typographer: true,
});

renderer.use(
await shiki({
(async () => {
const shikiRenderer = await shiki({
themes: {
light: "vitesse-light",
dark: "vitesse-dark",
},
})
);
});
renderer.use(shikiRenderer);
})();

export function renderMarkdown(markdown: string, inline: boolean = true) {
if (!inline) return renderer.render(markdown);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2017",
"module": "ES2022",
"module": "ESNext",
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
Expand Down

0 comments on commit dc4f054

Please sign in to comment.