@@ -9,7 +9,6 @@ import test from 'ava';
99import { getLocator } from 'locate-character' ;
1010
1111import { rollup } from 'rollup' ;
12- import { SourceMapConsumer } from 'source-map' ;
1312import { install } from 'source-map-support' ;
1413
1514import { testBundle } from '../../../util/test' ;
@@ -63,6 +62,9 @@ test('generates a sourcemap', async (t) => {
6362 sourcemapFile : path . resolve ( 'bundle.js' )
6463 } ) ;
6564
65+ // Hack to make it work on Node 18
66+ delete global . fetch ;
67+ const { SourceMapConsumer } = await import ( 'source-map' ) ;
6668 const smc = await new SourceMapConsumer ( map ) ;
6769 const locator = getLocator ( code , { offsetLine : 1 } ) ;
6870
@@ -804,7 +806,7 @@ test('handles when an imported dependency of an ES module changes type', async (
804806 let bundle = await rollup ( options ) ;
805807 t . is ( meta . isCommonJS , false ) ;
806808 t . deepEqual ( ( await executeBundle ( bundle , t ) ) . exports , 'esm' ) ;
807- t . deepEqual ( trackedTransforms , [ 'main.js' , 'dep.js' , 'main.js?commonjs-entry' ] ) ;
809+ t . deepEqual ( trackedTransforms , [ 'main.js' , 'dep.js' ] ) ;
808810 trackedTransforms . length = 0 ;
809811 const esCode = await getCodeFromBundle ( bundle ) ;
810812 t . snapshot ( esCode ) ;
@@ -889,7 +891,7 @@ test('handles when a dynamically imported dependency of an ES module changes typ
889891 let bundle = await rollup ( options ) ;
890892 t . is ( meta . isCommonJS , false ) ;
891893 t . deepEqual ( await ( await executeBundle ( bundle , t ) ) . exports , 'esm' ) ;
892- t . deepEqual ( trackedTransforms , [ 'main.js' , 'main.js?commonjs-entry' , ' dep.js'] ) ;
894+ t . deepEqual ( trackedTransforms , [ 'main.js' , 'dep.js' ] ) ;
893895 trackedTransforms . length = 0 ;
894896
895897 modules [ 'dep.js' ] = "exports.dep = 'cjs';" ;
@@ -1057,7 +1059,6 @@ test('handles when a required dependency of a mixed ES module changes type', asy
10571059 t . deepEqual ( trackedTransforms , [
10581060 'dep.js' ,
10591061 'main.js' ,
1060- 'main.js?commonjs-entry' ,
10611062 '\0commonjsHelpers.js' ,
10621063 '\0dep.js?commonjs-proxy'
10631064 ] ) ;
@@ -1201,11 +1202,11 @@ test('allows the config to be reused', async (t) => {
12011202 let bundle = await rollup ( { input : 'foo.js' , ...config } ) ;
12021203 t . deepEqual (
12031204 bundle . cache . modules . map ( ( { id } ) => id ) ,
1204- [ 'foo.js' , 'foo.js?commonjs-entry' ]
1205+ [ 'foo.js' ]
12051206 ) ;
12061207 bundle = await rollup ( { input : 'bar.js' , ...config } ) ;
12071208 t . deepEqual (
12081209 bundle . cache . modules . map ( ( { id } ) => id ) ,
1209- [ 'bar.js' , 'bar.js?commonjs-entry' ]
1210+ [ 'bar.js' ]
12101211 ) ;
12111212} ) ;
0 commit comments