Importing a subpath of a scoped runtime package, such as /runtime/v1/@opendatacapture/runtime-core/constants, resolves to a nonexistent .../index.js
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- build-system
調査の方向性
packages/instrument-bundler/AGENTS.mdを読み、packages/instrument-bundler/src/plugin.ts:23-26のパスマッチングロジックを調べてください。packages/instrument-bundler/src/__tests__/plugin.test.tsに、スコープ付きサブパス、.jsで終わるサブパス、およびサブパスのないスコープ付きパッケージのケースを追加または更新し、そのユニットテストを実行してください。サブパスは.js付きで解決され、サブパスのないパッケージだけが/index.jsに解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The bundler rewrites any import of a subpath of a scoped runtime package to a URL that does not exist. For bare packages, the rule in plugin.ts appends /index.js to /runtime/v1/<pkg> and /runtime/v1/@scope/<pkg>. But its scope group is (@.*\/)?, and .* also matches /, so it swallows any number of path segments. /runtime/v1/@opendatacapture/runtime-core/constants therefore becomes /runtime/v1/@opendatacapture/runtime-core/constants/index.js instead of …/constants.js, and an import that already ends in .js gets /index.js appended after the .js. packages/instrument-bundler/AGENTS.md documents the opposite: only the bare package gets /index.js, and everything deeper gets .js. The import type-checks, because runtime/v1/dist/@opendatacapture/runtime-core/constants.d.ts exists. The bundle then fails to evaluate: on the API the subpath import does not resolve, and in the browser the module 404s. Today this affects FILE_TYPES from /runtime/v1/@opendatacapture/runtime-core/constants, and any future scoped package that ships a subpath.
Where
packages/instrument-bundler/src/plugin.ts:23-26:
} else if (/\/runtime\/v1\/(@.*\/)?[^/]+$/.test(args.path)) {
return { external: true, path: `${args.path}/index.js` };
} else if (args.path.startsWith('/runtime/v1/')) {
return { external: true, path: args.path.endsWith('.js') ? args.path : `${args.path}.js` };
Reproduce
- Bundle an instrument whose
index.tscontainsimport { FILE_TYPES } from '/runtime/v1/@opendatacapture/runtime-core/constants';.
Actual: the bundle contains __import("/runtime/v1/@opendatacapture/runtime-core/constants/index.js") (verified on main), which neither the API nor the browser can load. /runtime/v1/@opendatacapture/runtime-core/constants.js becomes …/constants.js/index.js.
Expected: __import("/runtime/v1/@opendatacapture/runtime-core/constants.js"), which is the file runtime/v1/dist serves.
Tests
packages/instrument-bundler/src/__tests__/plugin.test.ts: it('should append .js to a subpath of a scoped runtime package, so only the bare package resolves to index.js'). Cover @opendatacapture/runtime-core/constants, …/constants.js and the bare @opendatacapture/runtime-core.
e2e: none needed beyond the unit test, since no built-in instrument imports a scoped subpath yet.
Suggested fix
Stop the scope group at one segment and anchor the pattern: /^\/runtime\/v1\/(@[^/]+\/)?[^/]+$/.
- 主要言語
- TypeScript
- スター
- 119
- フォーク
- 19
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 36
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DouglasNeuroInformatics/OpenDataCapture のほかの issue
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
メンテナーはふだん 2 日以内に返信
-
Interactive With JSPsych example submits a DataCollection its own schema rejects対応中かも @Sanilas-ai が 3 日前に担当しました。 オープンArea: Playground Bug Difficulty: Low Good First Issue Priority: Medium
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
DouglasNeuroInformatics/OpenDataCapture#1833 ·
メンテナーはふだん 2 日以内に返信
-
Area: Instruments Bug Difficulty: Low Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DouglasNeuroInformatics/OpenDataCapture#1824 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Area: Shared Bug Difficulty: Low Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DouglasNeuroInformatics/OpenDataCapture#1813 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Multiple instructions show as one comma-joined paragraph ("questions., Conditional")対応中かも @Sanilas-ai が 3 日前に担当しました。 オープンArea: Shared Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DouglasNeuroInformatics/OpenDataCapture#1812 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
DouglasNeuroInformatics/OpenDataCapture の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
unocss/unocss#5421 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-area
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Azure/typespec-azure#5936 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
vercel-labs/scriptc#2910 ·
メンテナーはふだん 1 日以内に返信
-
automation missing-model model-sync provider:fireworks-ai
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/models.dev#12458 ·
メンテナーはふだん 1 日以内に返信