@@ -91,8 +91,6 @@ import {
9191 mangleInternalPath
9292} from "./ast" ;
9393
94- import { fs , path , process } from "../util/node.js" ;
95-
9694/** Represents a dependee. */
9795class Dependee {
9896 constructor (
@@ -2797,13 +2795,6 @@ export class Parser extends DiagnosticEmitter {
27972795 } else {
27982796 ret = Node . createImportStatement ( members , path , tn . range ( startPos , tn . pos ) ) ;
27992797 }
2800- // Resolve package.json for non-relative imports
2801- if ( ! path . value . startsWith ( "." ) ) {
2802- const resolvedPath = this . resolvePackagePath ( path . value ) ;
2803- if ( resolvedPath ) {
2804- ret . internalPath = resolvedPath ;
2805- }
2806- }
28072798 let internalPath = ret . internalPath ;
28082799 if ( ! this . seenlog . has ( internalPath ) ) {
28092800 this . dependees . set ( internalPath , new Dependee ( assert ( this . currentSource ) , path ) ) ;
@@ -2867,32 +2858,6 @@ export class Parser extends DiagnosticEmitter {
28672858 return null ;
28682859 }
28692860
2870- /** Resolves a package name to its internal path via package.json. */
2871- private resolvePackagePath ( packageName : string ) : string | null {
2872- try {
2873- const nodeModulesPath = path . join ( this . baseDir , 'node_modules' ) ;
2874- const packageJsonPath = path . join ( nodeModulesPath , packageName , 'package.json' ) ;
2875- if ( fs . existsSync ( packageJsonPath ) ) {
2876- const content = fs . readFileSync ( packageJsonPath , 'utf8' ) ;
2877- const pkg = JSON . parse ( content ) ;
2878- let entry = pkg . ascMain || pkg . assembly || pkg . main || pkg . module ;
2879- if ( ! entry && pkg . exports && pkg . exports [ "." ] && pkg . exports [ "." ] . default ) {
2880- entry = pkg . exports [ "." ] . default ;
2881- }
2882- if ( entry ) {
2883- if ( entry . startsWith ( "./" ) ) entry = entry . substring ( 2 ) ;
2884- // Remove .ts extension if present
2885- const entryPath = entry . replace ( / \. t s $ / , '' ) ;
2886- const result = mangleInternalPath ( LIBRARY_PREFIX + packageName + '/' + entryPath ) ;
2887- return result ;
2888- }
2889- }
2890- } catch ( e ) {
2891- // Ignore errors
2892- }
2893- return null ;
2894- }
2895-
28962861 parseExportImport (
28972862 tn : Tokenizer ,
28982863 startPos : i32
0 commit comments