// NOTE(Zhen): Ignore CoreModule for now to enable a more flexible semantic modeling
// if (NodejsRequiredCoreModule.isCoreModule(target)) return NodejsRequiredCoreModule.make(target);
public static SourceFileModule resolve(File rootDir, File dir, String target) throws IOException, JSONException {
        // NOTE(Zhen): Ignore CoreModule for now to enable a more flexible semantic modeling
        // if (NodejsRequiredCoreModule.isCoreModule(target)) return NodejsRequiredCoreModule.make(target);
        if (target.startsWith("./") || target.startsWith("/") || target.startsWith("../")) {
            SourceFileModule module = loadAsFile(rootDir, new File(dir, target));
            if (module != null) return module;
            module = loadAsDirectory(rootDir, new File(dir, target));
            if (module != null) return module;
        }
        // NOTE(Zhen): it is not very useful to throw exception...
        return loadNodeModules(rootDir, dir, target);
    }
public static SourceFileModule resolve(File rootDir, File dir, String target) throws IOException, JSONException {
// NOTE(Zhen): Ignore CoreModule for now to enable a more flexible semantic modeling
// if (NodejsRequiredCoreModule.isCoreModule(target)) return NodejsRequiredCoreModule.make(target);
if (target.startsWith("./") || target.startsWith("/") || target.startsWith("../")) {
SourceFileModule module = loadAsFile(rootDir, new File(dir, target));
public static SourceFileModule resolve(File rootDir, File dir, String target) throws IOException, JSONException {
// NOTE(Zhen): Ignore CoreModule for now to enable a more flexible semantic modeling
// if (NodejsRequiredCoreModule.isCoreModule(target)) return NodejsRequiredCoreModule.make(target);
if (target.startsWith("./") || target.startsWith("/") || target.startsWith("../")) {
SourceFileModule module = loadAsFile(rootDir, new File(dir, target));
if (module != null) return module;
module = loadAsDirectory(rootDir, new File(dir, target));
if (module != null) return module;
}
// NOTE(Zhen): it is not very useful to throw exception...
return loadNodeModules(rootDir, dir, target);
}
public static SourceFileModule resolve(File rootDir, File dir, String target) throws IOException, JSONException {
// NOTE(Zhen): Ignore CoreModule for now to enable a more flexible semantic modeling
// if (NodejsRequiredCoreModule.isCoreModule(target)) return NodejsRequiredCoreModule.make(target);
if (target.startsWith("./") || target.startsWith("/") || target.startsWith("../")) {
SourceFileModule module = loadAsFile(rootDir, new File(dir, target));
if (module != null) return module;
module = loadAsDirectory(rootDir, new File(dir, target));
if (module != null) return module;
}
// NOTE(Zhen): it is not very useful to throw exception...
return loadNodeModules(rootDir, dir, target);
}