@@ -45,6 +45,45 @@ test('@mdx-js/esbuild', async () => {
45
45
await fs . unlink ( new URL ( './esbuild.mdx' , import . meta. url ) )
46
46
await fs . unlink ( new URL ( './esbuild.js' , import . meta. url ) )
47
47
48
+ // Resolve directory.
49
+ await fs . writeFile (
50
+ new URL ( './esbuild-resolve.mdx' , import . meta. url ) ,
51
+ 'import Content from "./folder/file.mdx"\n\n<Content/>'
52
+ )
53
+ await fs . mkdir ( new URL ( './folder' , import . meta. url ) )
54
+ await fs . writeFile (
55
+ new URL ( './folder/file.mdx' , import . meta. url ) ,
56
+ 'import {data} from "./file.js"\n\n{data}'
57
+ )
58
+ await fs . writeFile (
59
+ new URL ( './folder/file.js' , import . meta. url ) ,
60
+ 'export const data = 0.1'
61
+ )
62
+ await esbuild . build ( {
63
+ bundle : true ,
64
+ define : { 'process.env.NODE_ENV' : '"development"' } ,
65
+ entryPoints : [
66
+ fileURLToPath ( new URL ( './esbuild-resolve.mdx' , import . meta. url ) )
67
+ ] ,
68
+ outfile : fileURLToPath ( new URL ( './esbuild-resolve.js' , import . meta. url ) ) ,
69
+ format : 'esm' ,
70
+ plugins : [ esbuildMdx ( ) ]
71
+ } )
72
+ /** @type {MDXContent } */
73
+ Content =
74
+ /* @ts -expect-error file is dynamically generated */
75
+ ( await import ( './esbuild-resolve.js' ) ) . default // type-coverage:ignore-line
76
+
77
+ assert . equal (
78
+ renderToStaticMarkup ( React . createElement ( Content ) ) ,
79
+ '0.1' ,
80
+ 'should compile'
81
+ )
82
+
83
+ await fs . unlink ( new URL ( './esbuild-resolve.mdx' , import . meta. url ) )
84
+ await fs . unlink ( new URL ( './esbuild-resolve.js' , import . meta. url ) )
85
+ await fs . rmdir ( new URL ( './folder/' , import . meta. url ) , { recursive : true } )
86
+
48
87
// Markdown.
49
88
await fs . writeFile ( new URL ( './esbuild.md' , import . meta. url ) , '\ta' )
50
89
@@ -337,8 +376,6 @@ test('@mdx-js/esbuild', async () => {
337
376
338
377
await fs . unlink ( new URL ( './esbuild-warnings.mdx' , import . meta. url ) )
339
378
340
- console . log ( '\nnote: the preceding errors and warnings are expected!\n' )
341
-
342
379
await fs . writeFile (
343
380
new URL ( './esbuild-plugin-crash.mdx' , import . meta. url ) ,
344
381
'# hi'
@@ -466,7 +503,7 @@ test('@mdx-js/esbuild', async () => {
466
503
// Remote markdown.
467
504
await fs . writeFile (
468
505
new URL ( './esbuild-with-remote-md.mdx' , import . meta. url ) ,
469
- 'import Content from "https://raw.githubusercontent.com/wooorm/xdm /main/test/files/md-file.md"\n\n<Content />'
506
+ 'import Content from "https://raw.githubusercontent.com/mdx-js/mdx /main/packages/esbuild /test/files/md-file.md"\n\n<Content />'
470
507
)
471
508
472
509
await esbuild . build ( {
@@ -498,7 +535,7 @@ test('@mdx-js/esbuild', async () => {
498
535
// Remote MDX importing more markdown.
499
536
await fs . writeFile (
500
537
new URL ( './esbuild-with-remote-mdx.mdx' , import . meta. url ) ,
501
- 'import Content from "https://raw.githubusercontent.com/wooorm/xdm /main/test/files/mdx-file-importing-markdown.mdx"\n\n<Content />'
538
+ 'import Content from "https://raw.githubusercontent.com/mdx-js/mdx /main/packages/esbuild /test/files/mdx-file-importing-markdown.mdx"\n\n<Content />'
502
539
)
503
540
504
541
await esbuild . build ( {
1 commit comments
vercel[bot] commentedon Dec 30, 2021
Successfully deployed to the following URLs: