vfile/do-not-use-conditional-minpath after 0.5.3 -> 0.6.1 #88
-
don't know why, can't search for this. My usage is simple import { unified } from 'unified';
import remarkParse from 'remark-parse';
import { VFile } from 'vfile';
import retidStringify, { IOptions } from './retid-stringify';
import { Root as MdastRoot, Content as MdastContent } from 'mdast';
export const md2tidProcessor = unified().use(remarkParse).use(retidStringify);
export async function md2tid(markdownString: string): Promise<string> {
const vFile = new VFile({ path: 'fileName', value: markdownString });
const file = await md2tidProcessor.process(vFile);
return file.value as string;
}
export function toString(value: MdastRoot | MdastContent | string, options: IOptions) {
if (typeof value === 'string') {
value = { type: 'paragraph', children: [{ type: 'text', value }] };
}
if (value.type !== 'root') {
value = { type: 'root', children: [value] };
}
return unified().use(retidStringify, options).stringify(value);
} |
Beta Was this translation helpful? Give feedback.
Answered by
ChristianMurphy
Oct 15, 2023
Replies: 3 comments 3 replies
-
Found it on bundled file, but don't know why
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Sounds like you need to fix your bundler. This should work |
Beta Was this translation helpful? Give feedback.
2 replies
-
If you are stuck using jest, you will need to add entries to the
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adding on the stack trace includes jest.
Jest is known to have problems with ES modules (ESM). They have experimental ESM support https://jestjs.io/docs/ecmascript-modules but it has been experimental for years and has known bugs.
Consider dropping Jest entirely if you can, there are alternatives like
node:test
andvitest
which do fully support ESM.Or you could wrap jest with another tool like vite https://hung.dev/posts/jest-vite