@@ -200,7 +200,7 @@ const addTypecellModuleToRuntime = async (
200
200
config . logger . log ( "adding typecell module" , path ) ;
201
201
config . addLibraryToRuntime (
202
202
content ,
203
- `file:/// node_modules/@types/${ mod } /${ path } `
203
+ `file://node_modules/@types/${ mod } /${ path } `
204
204
) ;
205
205
} ;
206
206
@@ -245,7 +245,7 @@ const addModuleToRuntime = async (
245
245
} else {
246
246
const typelessModule = mod . split ( "@types/" ) . slice ( - 1 ) ;
247
247
const wrapped = `declare module "${ typelessModule } " { ${ content } }` ;
248
- config . addLibraryToRuntime ( wrapped , `node_modules/${ mod } /${ path } ` ) ;
248
+ config . addLibraryToRuntime ( wrapped , `file:// node_modules/${ mod } /${ path } ` ) ;
249
249
}
250
250
} ;
251
251
@@ -316,7 +316,7 @@ const getModuleAndRootDefTypePath = async (
316
316
317
317
config . addLibraryToRuntime (
318
318
JSON . stringify ( responseJSON , null , " " ) ,
319
- `node_modules/${ packageName } /package.json`
319
+ `file:// node_modules/${ packageName } /package.json`
320
320
) ;
321
321
322
322
// Get the path of the root d.ts file
@@ -430,7 +430,7 @@ const getReferenceDependencies = async (
430
430
newPath ,
431
431
config
432
432
) ;
433
- const representationalPath = `node_modules/${ mod } /${ newPath } ` ;
433
+ const representationalPath = `file:// node_modules/${ mod } /${ newPath } ` ;
434
434
config . addLibraryToRuntime (
435
435
dtsReferenceResponseText ,
436
436
representationalPath
@@ -580,9 +580,18 @@ const getDependenciesForModule = async (
580
580
// So it doesn't run twice for a package
581
581
acquiredTypeDefs [ moduleID ] = null ;
582
582
583
- const resolvedFilepath = absolutePathForModule . endsWith ( ".ts" )
584
- ? absolutePathForModule
585
- : absolutePathForModule + ".d.ts" ;
583
+ let resolvedFilepath = absolutePathForModule ;
584
+
585
+ if ( ! resolvedFilepath . endsWith ( ".ts" ) ) {
586
+ if ( resolvedFilepath . endsWith ( ".js" ) ) {
587
+ // case: import apache-arrow
588
+ resolvedFilepath =
589
+ resolvedFilepath . substring ( 0 , resolvedFilepath . length - 3 ) +
590
+ ".d.ts" ;
591
+ } else {
592
+ resolvedFilepath += absolutePathForModule + ".d.ts" ;
593
+ }
594
+ }
586
595
587
596
if (
588
597
moduleName ?. startsWith ( "typecell" ) ||
0 commit comments