Closed eternasuno closed 11 months ago
@eternasuno Can you please share a repro?
https://github.com/eternasuno/rehype-pretty-code-example
The error occurred after running yarn build
.
Type error: No overload matches this call.
Overload 1 of 3, '(preset?: Preset | null | undefined): Processor<import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root, undefined, undefined>', gave the following error.
Type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' has no properties in common with type 'Preset'.
Overload 2 of 3, '(list: PluggableList): Processor<import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root, undefined, undefined>', gave the following error.
Argument of type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to parameter of type 'PluggableList'.
Overload 3 of 3, '(plugin: Plugin<[], Root, Root>, ...parameters: [] | [boolean]): Processor<import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/mdast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root, undefined, undefined>', gave the following error.
Argument of type '(options?: void | Options | undefined) => void | Transformer<Root, Root>' is not assignable to parameter of type 'Plugin<[], Root, Root>'.
Type 'void | Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'.
Type 'Transformer<Root, Root>' is not assignable to type 'void | Transformer<Root, Root> | undefined'.
Type 'import("/workspaces/rehype-pretty-code-example/node_modules/rehype-pretty-code/node_modules/unified/index").Transformer<import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root>' is not assignable to type 'import("/workspaces/rehype-pretty-code-example/node_modules/unified/lib/index").Transformer<import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root, import("/workspaces/rehype-pretty-code-example/node_modules/@types/hast/index").Root>'.
Types of parameters 'file' and 'file' are incompatible.
Type 'import("/workspaces/rehype-pretty-code-example/node_modules/vfile/lib/index").VFile' is not assignable to type 'import("/workspaces/rehype-pretty-code-example/node_modules/rehype-pretty-code/node_modules/vfile/lib/index").VFile'.
Types of property 'messages' are incompatible.
Type 'import("/workspaces/rehype-pretty-code-example/node_modules/vfile-message/lib/index").VFileMessage[]' is not assignable to type 'import("/workspaces/rehype-pretty-code-example/node_modules/rehype-pretty-code/node_modules/vfile-message/lib/index").VFileMessage[]'.
Property 'position' is missing in type 'import("/workspaces/rehype-pretty-code-example/node_modules/vfile-message/lib/index").VFileMessage' but required in type 'import("/workspaces/rehype-pretty-code-example/node_modules/rehype-pretty-code/node_modules/vfile-message/lib/index").VFileMessage'.
8 | .use(remarkParse)
9 | .use(remarkRehype)
> 10 | .use(rehypePrettyCode)
| ^
11 | .use(rehypeStringify)
12 | .process('`const numbers = [1, 2, 3]{:js}`');
13 |
error Command failed with exit code 1.
By the way, it also errors in turbo mode, running yarn dev-turbo
.
Error: ENOENT: no such file or directory, open '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
at Object.open (node:internal/fs/sync:78:18)
at Object.openSync (node:fs:565:17)
at Object.readFileSync (node:fs:445:35)
at getOniguruma (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:2721:32)
at getHighlighter (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:3586:36)
at Function.rehypePrettyCode (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_rehype-pretty-code_b5388b._.js:1081:45)
at Function.freeze (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:597:42)
at Function.process (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:669:14)
at md (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:99:776)
at Home (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:101:31)
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9075
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9204
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:8898)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7840
at async Promise.all (index 0)
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7607)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:24472 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
}
Error: ENOENT: no such file or directory, open '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
at Object.open (node:internal/fs/sync:78:18)
at Object.openSync (node:fs:565:17)
at Object.readFileSync (node:fs:445:35)
at getOniguruma (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:2721:32)
at getHighlighter (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:3586:36)
at Function.rehypePrettyCode (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_rehype-pretty-code_b5388b._.js:1081:45)
at Function.freeze (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:597:42)
at Function.process (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:669:14)
at md (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:99:776)
at Home (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:101:31)
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9075
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9204
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:8898)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7840
at async Promise.all (index 0)
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7607)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:24472 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
}
⨯ unhandledRejection: Error: ENOENT: no such file or directory, open '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
at Object.open (node:internal/fs/sync:78:18)
at Object.openSync (node:fs:565:17)
at Object.readFileSync (node:fs:445:35)
at getOniguruma (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:2721:32)
at getHighlighter (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:3586:36)
at Function.rehypePrettyCode (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_rehype-pretty-code_b5388b._.js:1081:45)
at Function.freeze (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:597:42)
at Function.process (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:669:14)
at md (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:99:776)
at Home (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:101:31)
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9075
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9204
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:8898)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7840
at async Promise.all (index 0)
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7607)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:24472 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
}
⨯ unhandledRejection: Error: ENOENT: no such file or directory, open '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
at Object.open (node:internal/fs/sync:78:18)
at Object.openSync (node:fs:565:17)
at Object.readFileSync (node:fs:445:35)
at getOniguruma (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:2721:32)
at getHighlighter (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_shiki_dist_index_esm_3e0b13.js:3586:36)
at Function.rehypePrettyCode (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_rehype-pretty-code_b5388b._.js:1081:45)
at Function.freeze (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:597:42)
at Function.process (/workspaces/rehype-pretty-code-example/.next/server/chunks/node_modules_b9b0b8._.js:669:14)
at md (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:99:776)
at Home (/workspaces/rehype-pretty-code-example/.next/server/chunks/[root of the server]__93e7dd._.js:101:31)
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9075
at /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:9204
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:8898)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7840
at async Promise.all (index 0)
at async t7 (/workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:7607)
at async /workspaces/rehype-pretty-code-example/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:38:24472 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '[project]/node_modules/vscode-oniguruma/release/onig.wasm'
}
In https://github.com/atomiks/rehype-pretty-code/commit/b7c0854a8f26badc3f58a7059609bacc7a0bfc5b, @types/hast
was moved from deps to devDeps. Might be an issue:
Overload 1 of 3 [...] @types/hast/index").Root, undefined, undefined>', gave the following error.
Same error here
Build error after update to 0.10.2. I think the problem is the version of the vfile.