stc icon indicating copy to clipboard operation
stc copied to clipboard

Implement more logic for file loader / resolver for multi-file tests

Open kdy1 opened this issue 2 years ago • 12 comments

https://github.com/dudykr/stc/pull/700 enabled a multi-file testing system, but the loader/resolver is not good enough. But I want to work on other things first, so I'm filing an issue instead.

If you run check.sh, you will see panic messages starting with not yet implemented: .

e.g.

========== Running test moduleResolution/importFromDot.ts
Source:
// @module: commonjs

// @Filename: a.ts
export const rootA = 0;

// @Filename: a/index.ts
export const indexInA = 0;

// @Filename: a/b.ts
import { indexInA, rootA } from ".";


[crates/stc_ts_type_checker/tests/tsc.rs:305] &libs = [
    Es5,
    Dom,
]
load_file: Real("a/b.ts")
resolve: Real("a/b.ts") "."
thread 'conformance::moduleResolution::importFromDot.ts' panicked at 'not yet implemented: resolve: Real("a/b.ts") "."', crates/stc_ts_type_checker/tests/tsc.rs:523:9
stack backtrace:
   0: rust_begin_unwind

Relevant code:

https://github.com/dudykr/stc/blob/86891e586d0162a7b737143910c8e2d30a1aefca/crates/stc_ts_type_checker/tests/tsc.rs#L506-L545

kdy1 avatar Feb 15 '23 11:02 kdy1

I'd love to work on this

infix avatar Feb 15 '23 23:02 infix

Thank you!

kdy1 avatar Feb 16 '23 00:02 kdy1

Note: Additionally, we need to handle resolving like node_modules/foo/bar. Maybe we can create a temporary directory and reuse NodeResolver instead of reimplementing a full resolver/loader for testing

kdy1 avatar Feb 23 '23 10:02 kdy1

That makes sense, I was extremely busy last week didn't have time to work on this, will try to find some time this weekend. Sorry for the delay man.

infix avatar Feb 23 '23 10:02 infix

No worries, really. It's definitely not something you should be sorry. I found that we need node_modules support while trying to make more good first issues.

kdy1 avatar Feb 23 '23 10:02 kdy1

@infix Are you still willing to work on this?

kdy1 avatar Mar 23 '23 13:03 kdy1

Sorry for the delay, I'm still interested and I'll dedicate some time this weekend!

infix avatar Mar 23 '23 13:03 infix

No worries, I'm just checking. And thank you!

kdy1 avatar Mar 23 '23 13:03 kdy1

Hi @kdy1! If this still needs attention, I'd be willing to work on it. I've already implemented the TypeScript Module Resolution system before (for my Turboprisma project), so it should be pretty easy to do.

DavidHancu avatar May 27 '23 19:05 DavidHancu

It will be really nice, thank you!

kdy1 avatar May 28 '23 02:05 kdy1

@DavidHancu go for it man. I can't really dedicate time to this.

infix avatar May 30 '23 07:05 infix

resolve import . at #1064 resolve emit error about not exist file #1076

sunrabbit123 avatar Sep 01 '23 17:09 sunrabbit123