@@ -3,7 +3,7 @@ import {Parser} from 'acorn'
33// @ts -ignore
44import jsx from 'acorn-jsx'
55import { walk } from 'estree-walker'
6- import astring from 'astring'
6+ import { generate } from 'astring'
77import recast from 'recast'
88import escodegen from 'escodegen'
99import { buildJsx } from './index.js'
@@ -87,7 +87,7 @@ test('estree-util-build-jsx', function (t) {
8787 )
8888
8989 t . equal (
90- astring . generate ( buildJsx ( parse ( '<x />' ) , { pragma : 'a.b-c' } ) ) ,
90+ generate ( buildJsx ( parse ( '<x />' ) , { pragma : 'a.b-c' } ) ) ,
9191 'a["b-c"]("x");\n' ,
9292 'should support `pragma` w/ non-identifiers (2)'
9393 )
@@ -247,7 +247,7 @@ test('estree-util-build-jsx', function (t) {
247247 )
248248
249249 t . equal (
250- astring . generate ( buildJsx ( parse ( '<a.b-c />' ) , { pragma : 'h' } ) ) ,
250+ generate ( buildJsx ( parse ( '<a.b-c />' ) , { pragma : 'h' } ) ) ,
251251 'h(a["b-c"]);\n' ,
252252 'should support dots *and* dashes in tag names (2)'
253253 )
@@ -272,7 +272,7 @@ test('estree-util-build-jsx', function (t) {
272272 )
273273
274274 t . equal (
275- astring . generate ( buildJsx ( parse ( '<a-b.c />' ) , { pragma : 'h' } ) ) ,
275+ generate ( buildJsx ( parse ( '<a-b.c />' ) , { pragma : 'h' } ) ) ,
276276 'h(("a-b").c);\n' ,
277277 'should support dots *and* dashes in tag names (4)'
278278 )
@@ -849,7 +849,7 @@ test('estree-util-build-jsx', function (t) {
849849 )
850850
851851 t . equal (
852- astring . generate (
852+ generate (
853853 buildJsx ( parse ( '<>\n <a b c="d" e={f} {...g}>h</a>\n</>' ) , {
854854 pragma : 'h' ,
855855 pragmaFrag : 'f'
@@ -1143,7 +1143,7 @@ test('estree-util-build-jsx', function (t) {
11431143 )
11441144
11451145 t . deepEqual (
1146- astring . generate ( buildJsx ( parse ( '<>a</>' ) , { runtime : 'automatic' } ) ) ,
1146+ generate ( buildJsx ( parse ( '<>a</>' ) , { runtime : 'automatic' } ) ) ,
11471147 [
11481148 'import {Fragment as _Fragment, jsx as _jsx} from "react/jsx-runtime";' ,
11491149 '_jsx(_Fragment, {' ,
@@ -1155,9 +1155,7 @@ test('estree-util-build-jsx', function (t) {
11551155 )
11561156
11571157 t . deepEqual (
1158- astring . generate (
1159- buildJsx ( parse ( '/*@jsxRuntime automatic*/\n<a key="a">b{1}</a>' ) )
1160- ) ,
1158+ generate ( buildJsx ( parse ( '/*@jsxRuntime automatic*/\n<a key="a">b{1}</a>' ) ) ) ,
11611159 [
11621160 'import {jsxs as _jsxs} from "react/jsx-runtime";' ,
11631161 '_jsxs("a", {' ,
@@ -1169,9 +1167,7 @@ test('estree-util-build-jsx', function (t) {
11691167 )
11701168
11711169 t . deepEqual (
1172- astring . generate (
1173- buildJsx ( parse ( '<a b="1" {...c}>d</a>' ) , { runtime : 'automatic' } )
1174- ) ,
1170+ generate ( buildJsx ( parse ( '<a b="1" {...c}>d</a>' ) , { runtime : 'automatic' } ) ) ,
11751171 [
11761172 'import {jsx as _jsx} from "react/jsx-runtime";' ,
11771173 '_jsx("a", Object.assign({' ,
@@ -1185,7 +1181,7 @@ test('estree-util-build-jsx', function (t) {
11851181 )
11861182
11871183 t . deepEqual (
1188- astring . generate (
1184+ generate (
11891185 buildJsx ( parse ( '<a {...{b: 1, c: 2}} d="e">f</a>' ) , {
11901186 runtime : 'automatic'
11911187 } )
@@ -1205,7 +1201,7 @@ test('estree-util-build-jsx', function (t) {
12051201 )
12061202
12071203 t . deepEqual (
1208- astring . generate ( buildJsx ( parse ( '<a>b</a>' ) , { runtime : 'automatic' } ) ) ,
1204+ generate ( buildJsx ( parse ( '<a>b</a>' ) , { runtime : 'automatic' } ) ) ,
12091205 [
12101206 'import {jsx as _jsx} from "react/jsx-runtime";' ,
12111207 '_jsx("a", {' ,
@@ -1217,7 +1213,7 @@ test('estree-util-build-jsx', function (t) {
12171213 )
12181214
12191215 t . deepEqual (
1220- astring . generate ( buildJsx ( parse ( '<a/>' ) , { runtime : 'automatic' } ) ) ,
1216+ generate ( buildJsx ( parse ( '<a/>' ) , { runtime : 'automatic' } ) ) ,
12211217 [
12221218 'import {jsx as _jsx} from "react/jsx-runtime";' ,
12231219 '_jsx("a", {});' ,
@@ -1227,7 +1223,7 @@ test('estree-util-build-jsx', function (t) {
12271223 )
12281224
12291225 t . deepEqual (
1230- astring . generate ( buildJsx ( parse ( '<a key/>' ) , { runtime : 'automatic' } ) ) ,
1226+ generate ( buildJsx ( parse ( '<a key/>' ) , { runtime : 'automatic' } ) ) ,
12311227 [
12321228 'import {jsx as _jsx} from "react/jsx-runtime";' ,
12331229 '_jsx("a", {}, true);' ,
@@ -1245,7 +1241,7 @@ test('estree-util-build-jsx', function (t) {
12451241 )
12461242
12471243 t . deepEqual (
1248- astring . generate (
1244+ generate (
12491245 buildJsx ( parse ( '/*@jsxRuntime classic*/ <a/>' ) , { runtime : 'automatic' } )
12501246 ) ,
12511247 'React.createElement("a");\n' ,
0 commit comments