Resolve NodeNext TypeScript `.js` imports to TypeScript source files
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python, typescript
調査の方向性
まず CoderMind/scripts/rpg/dep_graph.py の issue で示されている resolver と invoke-resolution の範囲から始め、続いて CoderMind/tests/test_multilingual_dep_graph.py にある拡張子なしの TypeScript invoke テストを読みます。提供された a.ts と b.ts の repro を使って NodeNext スタイルのテストを追加します。.js import が b.ts に解決され、ファイル間の import エッジと invoke エッジの両方が存在すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In a NodeNext/ESM TypeScript repo, relative imports such as import { b } from "./b.js" (the TypeScript-mandated form) remain unresolved, so the graph misses cross-file import and invoke edges. The resolver tries only the literal path when a specifier has an extension, so ./b.js is never tried as b.ts (resolver: https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/scripts/rpg/dep_graph.py#L2154-L2172 and invoke resolution: https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/scripts/rpg/dep_graph.py#L2225-L2239).
Minimal resolver-derived repro (not run):
repo/
tsconfig.json
src/a.ts
src/b.ts
tsconfig.json: {"compilerOptions":{"module":"NodeNext","moduleResolution":"NodeNext"}}
src/a.ts: import { b } from "./b.js"; export function a() { return b(); }
src/b.ts: export function b() { return 1; }
Expected: import and invoke edges from src/a.ts to src/b.ts and from src/a.ts:a to src/b.ts:b. Actual: unresolved import and no cross-file invoke edge, as derived from reading the resolver, not from a run.
Suggested change:
if extension:
candidates.append(raw_path)
+ if extension in {".js", ".jsx", ".mjs", ".cjs"}:
+ stem = raw_path[:-len(extension)]
+ candidates.extend(
+ f"{stem}{ext}" for ext in (".ts", ".tsx", ".mts", ".cts")
+ )
Please add a NodeNext-style test next to the existing extensionless TypeScript invoke test (https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/tests/test_multilingual_dep_graph.py#L156-L199). The audit report counted 241 relative .js imports as unresolved in the inspected repo. I can open a PR with the small resolver fix and test if useful.
This issue was AI-generated at the human operator's direction and reviewed by the operator before submission.
- 主要言語
- Python
- スター
- 553
- フォーク
- 42
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/RPG-ZeroRepo のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
microsoft/RPG-ZeroRepo#101 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
microsoft/RPG-ZeroRepo#5 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
microsoft/RPG-ZeroRepo#3 · リアクション 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
microsoft/RPG-ZeroRepo#2 · コメント 3 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
microsoft/RPG-ZeroRepo#1 · コメント 7 件 ·
microsoft/RPG-ZeroRepo の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
UKGovernmentBEIS/inspect_ai#5802 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
no-human-ai/no_human#660 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
documentation need help question
難易度 1/5 1〜3時間 初心者へのやさしさ 66/100
phonology024/babelscribe#26 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100