Fix dotted code imports before asset fallback#160
Open
hvp17 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Tomas Gadliauskas <troliukass@gmail.com>
|
@hvp17 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #133.
Authored asset imports currently claim relative specifiers with dotted basenames before the normal code resolver can append TypeScript/JavaScript extensions. That makes code imports like
./Reflect.getPrototypeOfand../helpers/mock-registry.schemasfail as missing assets even when matching.jsor.tsfiles exist.This changes the asset import plugin to check for an adjacent authored code file with Eve's normal resolver extensions before falling back to asset handling. It also adds a scenario regression for both a CommonJS dotted-basename require and a local TypeScript dotted-basename import.
How did you test your changes?
pnpm exec vitest run --config vitest.scenario.config.ts src/internal/authored-module-loader.scenario.test.tspnpm --filter eve run typecheckpnpm exec oxfmt -- packages/eve/src/internal/authored-asset-import-plugin.ts packages/eve/src/internal/authored-module-loader.scenario.test.ts .changeset/dotted-code-imports.mdgit diff --checkNote: the local machine is running Node
v22.22.3, while Eve requires Node>=24, so the pnpm commands emit engine warnings. The focused scenario regression and package typecheck pass.PR Checklist
CONTRIBUTING.mdevepackagegit commit --signoff)