@@ -98,11 +98,11 @@ test('@mdx-js/mdx: evaluate', async function (t) {
98
98
} )
99
99
100
100
await t . test (
101
- 'should support an `import` of a relative url w/ `useDynamicImport `' ,
101
+ 'should support an `import` of a relative url w/ `baseUrl `' ,
102
102
async function ( ) {
103
103
const mod = await evaluate (
104
104
'import {number} from "./context/data.js"\n\n{number}' ,
105
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
105
+ { baseUrl : import . meta. url , ...runtime }
106
106
)
107
107
108
108
assert . equal (
@@ -113,13 +113,13 @@ test('@mdx-js/mdx: evaluate', async function (t) {
113
113
)
114
114
115
115
await t . test (
116
- 'should support an `import` of a full url w/ `useDynamicImport `' ,
116
+ 'should support an `import` of a full url w/ `baseUrl `' ,
117
117
async function ( ) {
118
118
const mod = await evaluate (
119
119
'import {number} from "' +
120
120
new URL ( 'context/data.js' , import . meta. url ) +
121
121
'"\n\n{number}' ,
122
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
122
+ { baseUrl : import . meta. url , ...runtime }
123
123
)
124
124
125
125
assert . equal (
@@ -130,41 +130,33 @@ test('@mdx-js/mdx: evaluate', async function (t) {
130
130
)
131
131
132
132
await t . test (
133
- 'should support an `import` w/o specifiers w/ `useDynamicImport `' ,
133
+ 'should support an `import` w/o specifiers w/o `baseUrl `' ,
134
134
async function ( ) {
135
135
assert . match (
136
- String (
137
- await compile ( 'import "a"' , {
138
- outputFormat : 'function-body' ,
139
- useDynamicImport : true
140
- } )
141
- ) ,
136
+ String ( await compile ( 'import "a"' , { outputFormat : 'function-body' } ) ) ,
142
137
/ \n a w a i t i m p o r t \( " a " \) ; ? \n /
143
138
)
144
139
}
145
140
)
146
141
147
142
await t . test (
148
- 'should support an `import` w/ 0 specifiers w/ `useDynamicImport `' ,
143
+ 'should support an `import` w/ 0 specifiers w/o `baseUrl `' ,
149
144
async function ( ) {
150
145
assert . match (
151
146
String (
152
- await compile ( 'import {} from "a"' , {
153
- outputFormat : 'function-body' ,
154
- useDynamicImport : true
155
- } )
147
+ await compile ( 'import {} from "a"' , { outputFormat : 'function-body' } )
156
148
) ,
157
149
/ \n a w a i t i m p o r t \( " a " \) ; ? \n /
158
150
)
159
151
}
160
152
)
161
153
162
154
await t . test (
163
- 'should support a namespace import w/ `useDynamicImport `' ,
155
+ 'should support a namespace import w/ `baseUrl `' ,
164
156
async function ( ) {
165
157
const mod = await evaluate (
166
158
'import * as x from "./context/components.js"\n\n<x.Pill>Hi!</x.Pill>' ,
167
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
159
+ { baseUrl : import . meta. url , ...runtime }
168
160
)
169
161
170
162
assert . equal (
@@ -175,11 +167,11 @@ test('@mdx-js/mdx: evaluate', async function (t) {
175
167
)
176
168
177
169
await t . test (
178
- 'should support a namespace import and a bare specifier w/ `useDynamicImport `' ,
170
+ 'should support a namespace import and a bare specifier w/ `baseUrl `' ,
179
171
async function ( ) {
180
172
const mod = await evaluate (
181
173
'import Div, * as x from "./context/components.js"\n\n<x.Pill>a</x.Pill> and <Div>b</Div>' ,
182
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
174
+ { baseUrl : import . meta. url , ...runtime }
183
175
)
184
176
185
177
assert . equal (
@@ -247,81 +239,56 @@ test('@mdx-js/mdx: evaluate', async function (t) {
247
239
)
248
240
} )
249
241
250
- await t . test ( 'should throw on an `export * from`' , async function ( ) {
251
- try {
252
- await evaluate ( 'export {a} from "b"' , runtime )
253
- assert . fail ( )
254
- } catch ( error ) {
255
- assert . match (
256
- String ( error ) ,
257
- / U n e x p e c t e d ` i m p o r t ` o r ` e x p o r t … f r o m ` i n ` e v a l u a t e ` \( o u t p u t t i n g a f u n c t i o n b o d y \) b y d e f a u l t /
258
- )
259
- }
260
- } )
261
-
262
242
await t . test (
263
- 'should support an `export from` w/ `useDynamicImport `' ,
243
+ 'should support an `export from` w/ `baseUrl `' ,
264
244
async function ( ) {
265
245
const mod = await evaluate ( 'export {number} from "./context/data.js"' , {
266
246
baseUrl : import . meta. url ,
267
- useDynamicImport : true ,
268
247
...runtime
269
248
} )
270
249
271
250
assert . equal ( mod . number , 3.14 )
272
251
}
273
252
)
274
253
275
- await t . test (
276
- 'should support an `export` w/ `useDynamicImport`' ,
277
- async function ( ) {
278
- const mod = await evaluate (
279
- 'import {number} from "./context/data.js"\nexport {number}' ,
280
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
281
- )
254
+ await t . test ( 'should support an `export` w/ `baseUrl`' , async function ( ) {
255
+ const mod = await evaluate (
256
+ 'import {number} from "./context/data.js"\nexport {number}' ,
257
+ { baseUrl : import . meta. url , ...runtime }
258
+ )
282
259
283
- assert . equal ( mod . number , 3.14 )
284
- }
285
- )
260
+ assert . equal ( mod . number , 3.14 )
261
+ } )
286
262
287
263
await t . test (
288
- 'should support an `export as from` w/ `useDynamicImport `' ,
264
+ 'should support an `export as from` w/ `baseUrl `' ,
289
265
async function ( ) {
290
266
const mod = await evaluate (
291
267
'export {number as data} from "./context/data.js"' ,
292
- {
293
- baseUrl : import . meta. url ,
294
- useDynamicImport : true ,
295
- ...runtime
296
- }
268
+ { baseUrl : import . meta. url , ...runtime }
297
269
)
298
270
299
271
assert . equal ( mod . data , 3.14 )
300
272
}
301
273
)
302
274
303
275
await t . test (
304
- 'should support an `export default as from` w/ `useDynamicImport `' ,
276
+ 'should support an `export default as from` w/ `baseUrl `' ,
305
277
async function ( ) {
306
278
const mod = await evaluate (
307
279
'export {default as data} from "./context/data.js"' ,
308
- {
309
- baseUrl : import . meta. url ,
310
- useDynamicImport : true ,
311
- ...runtime
312
- }
280
+ { baseUrl : import . meta. url , ...runtime }
313
281
)
314
282
315
283
assert . equal ( mod . data , 6.28 )
316
284
}
317
285
)
318
286
319
287
await t . test (
320
- 'should support an `export all from` w/ `useDynamicImport `' ,
288
+ 'should support an `export all from` w/ `baseUrl `' ,
321
289
async function ( ) {
322
290
const mod = await evaluate ( 'export * from "./context/data.js"' , {
323
291
baseUrl : import . meta. url ,
324
- useDynamicImport : true ,
325
292
...runtime
326
293
} )
327
294
@@ -333,11 +300,11 @@ test('@mdx-js/mdx: evaluate', async function (t) {
333
300
)
334
301
335
302
await t . test (
336
- 'should support an `export all from`, but prefer explicit exports, w/ `useDynamicImport `' ,
303
+ 'should support an `export * from`, but prefer explicit exports, w/ `baseUrl `' ,
337
304
async function ( ) {
338
305
const mod = await evaluate (
339
306
'export {default as number} from "./context/data.js"\nexport * from "./context/data.js"' ,
340
- { baseUrl : import . meta. url , useDynamicImport : true , ...runtime }
307
+ { baseUrl : import . meta. url , ...runtime }
341
308
)
342
309
343
310
// I’m not sure if this makes sense, but it is how Node works.
@@ -372,42 +339,6 @@ test('@mdx-js/mdx: evaluate', async function (t) {
372
339
}
373
340
)
374
341
375
- await t . test ( 'should throw on an export all from' , async function ( ) {
376
- try {
377
- await evaluate ( 'export * from "a"' , runtime )
378
- assert . fail ( )
379
- } catch ( error ) {
380
- assert . match (
381
- String ( error ) ,
382
- / U n e x p e c t e d ` i m p o r t ` o r ` e x p o r t … f r o m ` i n ` e v a l u a t e ` \( o u t p u t t i n g a f u n c t i o n b o d y \) b y d e f a u l t /
383
- )
384
- }
385
- } )
386
-
387
- await t . test ( 'should throw on an import' , async function ( ) {
388
- try {
389
- await evaluate ( 'import {a} from "b"' , runtime )
390
- assert . fail ( )
391
- } catch ( error ) {
392
- assert . match (
393
- String ( error ) ,
394
- / U n e x p e c t e d ` i m p o r t ` o r ` e x p o r t … f r o m ` i n ` e v a l u a t e ` \( o u t p u t t i n g a f u n c t i o n b o d y \) b y d e f a u l t /
395
- )
396
- }
397
- } )
398
-
399
- await t . test ( 'should throw on an import default' , async function ( ) {
400
- try {
401
- await evaluate ( 'import a from "b"' , runtime )
402
- assert . fail ( )
403
- } catch ( error ) {
404
- assert . match (
405
- String ( error ) ,
406
- / U n e x p e c t e d ` i m p o r t ` o r ` e x p o r t … f r o m ` i n ` e v a l u a t e ` \( o u t p u t t i n g a f u n c t i o n b o d y \) b y d e f a u l t : /
407
- )
408
- }
409
- } )
410
-
411
342
await t . test ( 'should support a given components' , async function ( ) {
412
343
const mod = await evaluate ( '<X/>' , runtime )
413
344
0 commit comments