diff --git a/package.json b/package.json index 8201b9f..bdeb92f 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "description": "Parcel plugin to load markdown file with yaml-front-matter.", "author": "François de Metz ", "license": "MIT", - "type": "module", "source": "./src/index.ts", "main": "./dist/main.js", - "module": "dist/module.js", - "types": "dist/index.d.ts", + "module": "./dist/module.js", + "types": "./dist/index.d.ts", "scripts": { "watch": "parcel watch", "build": "parcel build", diff --git a/src/index.ts b/src/index.ts index e007777..0413f7b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,7 @@ import path from 'node:path'; import { Transformer } from '@parcel/plugin'; import { marked, type MarkedOptions } from 'marked'; -import yamlFrontmatter from 'yaml-front-matter'; -const { loadFront } = yamlFrontmatter; +import { loadFront } from 'yaml-front-matter'; export default new Transformer({ async loadConfig({ config }) { @@ -43,7 +42,7 @@ export default new Transformer({ const option: { marked?: MarkedOptions } = config || {}; const result = { ...frontMatter }; if (option.marked) { - result.__content = marked.parse(frontMatter.__content, { ...option.marked }); + result.__content = await marked.parse(frontMatter.__content, { ...option.marked }); } asset.type = 'js'; asset.setCode(`export default ${JSON.stringify(result)}`);