@@ -38,10 +38,26 @@ fs.writeFileSync(
3838 // @ts -ignore Hush, `2021` is fine.
3939 { sourceType : 'module' , ecmaVersion : 2021 }
4040 ) ,
41- { runtime : 'automatic' , importSource : '. ' }
41+ { runtime : 'automatic' , importSource : 'xastscript ' }
4242 )
4343 // @ts -expect-error Some bug in `to-js`
44- ) . value . replace ( / \/ j s x - r u n t i m e (? = [ " ' ] ) / g, './lib/runtime.js' )
44+ ) . value
45+ )
46+
47+ fs . writeFileSync (
48+ path . join ( 'test' , 'jsx-build-jsx-automatic-development.js' ) ,
49+ toJs (
50+ // @ts -expect-error it’s a program.
51+ buildJsx (
52+ // @ts -expect-error Acorn nodes are assignable to ESTree nodes.
53+ Parser . extend ( acornJsx ( ) ) . parse (
54+ doc . replace ( / ' n a m e ' / , "'jsx (estree-util-build-jsx, automatic)'" ) ,
55+ { sourceType : 'module' , ecmaVersion : 2021 }
56+ ) ,
57+ { runtime : 'automatic' , importSource : 'xastscript' , development : true }
58+ )
59+ // @ts -expect-error Some bug in `to-js`
60+ ) . value
4561)
4662
4763fs . writeFileSync (
@@ -57,14 +73,25 @@ fs.writeFileSync(
5773fs . writeFileSync (
5874 path . join ( 'test' , 'jsx-babel-automatic.js' ) ,
5975 // @ts -expect-error Result always given.
60- babel
61- . transformSync ( doc . replace ( / ' n a m e ' / , "'jsx (babel, automatic)'" ) , {
62- plugins : [
63- [
64- '@babel/plugin-transform-react-jsx' ,
65- { runtime : 'automatic' , importSource : '.' }
66- ]
76+ babel . transformSync ( doc . replace ( / ' n a m e ' / , "'jsx (babel, automatic)'" ) , {
77+ plugins : [
78+ [
79+ '@babel/plugin-transform-react-jsx' ,
80+ { runtime : 'automatic' , importSource : 'xastscript' }
6781 ]
68- } )
69- . code . replace ( / \/ j s x - r u n t i m e (? = [ " ' ] ) / g, './lib/runtime.js' )
82+ ]
83+ } ) . code
84+ )
85+
86+ fs . writeFileSync (
87+ path . join ( 'test' , 'jsx-babel-automatic-development.js' ) ,
88+ // @ts -expect-error Result always given.
89+ babel . transformSync ( doc . replace ( / ' n a m e ' / , "'jsx (babel, automatic)'" ) , {
90+ plugins : [
91+ [
92+ '@babel/plugin-transform-react-jsx' ,
93+ { runtime : 'automatic' , importSource : 'xastscript' , development : true }
94+ ]
95+ ]
96+ } ) . code
7097)
0 commit comments