File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed
Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ let req = require('./req.js')
1515async function load ( plugin , options , file ) {
1616 try {
1717 if (
18- options === null ||
19- options === undefined ||
18+ options == null ||
2019 Object . keys ( options ) . length === 0
2120 ) {
2221 return await req ( plugin , file )
Original file line number Diff line number Diff line change @@ -4,9 +4,7 @@ let { pathToFileURL } = require('node:url')
44
55let TS_EXT_RE = / \. [ m c ] ? t s $ /
66
7- let tsx
8-
9- let jiti
7+ let tsx , jiti
108
119let importError = [ ]
1210
@@ -21,10 +19,8 @@ async function req(name, rootFile = __filename) {
2119 try {
2220 return ( await import ( `${ pathToFileURL ( url ) } ?t=${ Date . now ( ) } ` ) ) . default
2321 } catch ( err ) {
24- if ( ! TS_EXT_RE . test ( url ) ) {
25- /* c8 ignore start */
26- throw err
27- }
22+ /* c8 ignore start */
23+ if ( ! TS_EXT_RE . test ( url ) ) throw err
2824 /* c8 ignore stop */
2925 }
3026
@@ -33,7 +29,7 @@ async function req(name, rootFile = __filename) {
3329 tsx = await import ( 'tsx/cjs/api' )
3430 } catch ( error ) {
3531 /* c8 ignore start */
36- importError . push ( error )
32+ importError . push ( error . message )
3733 }
3834 /* c8 ignore stop */
3935 }
@@ -48,18 +44,14 @@ async function req(name, rootFile = __filename) {
4844 try {
4945 jiti = ( await import ( 'jiti' ) ) . default
5046 } catch ( error ) {
51- importError . push ( error )
47+ importError . push ( error . message )
5248 }
5349 }
5450
55- if ( jiti ) {
56- return jiti ( rootFile , { interopDefault : true } ) ( name )
57- }
51+ if ( jiti ) return jiti ( rootFile , { interopDefault : true } ) ( name )
5852
5953 throw new Error (
60- `'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${ importError
61- . map ( error => error . message )
62- . join ( '\n' ) } `
54+ `'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${ importError . join ( '\n' ) } `
6355 )
6456 /* c8 ignore stop */
6557}
You can’t perform that action at this time.
0 commit comments