Skip to content

add benchmark#4

Merged
Boshen merged 1 commit into
mainfrom
12-06-add_benchmark
Dec 6, 2023
Merged

add benchmark#4
Boshen merged 1 commit into
mainfrom
12-06-add_benchmark

Conversation

@Boshen

@Boshen Boshen commented Dec 6, 2023

Copy link
Copy Markdown
Member

No description provided.

Boshen commented Dec 6, 2023

Copy link
Copy Markdown
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@Boshen
Boshen merged commit e4c358b into main Dec 6, 2023

Boshen commented Dec 6, 2023

Copy link
Copy Markdown
Member Author

Merge activity

@Boshen
Boshen deleted the 12-06-add_benchmark branch December 6, 2023 06:54
@codspeed-hq

codspeed-hq Bot commented Dec 6, 2023

Copy link
Copy Markdown

CodSpeed Performance Report

Congrats! CodSpeed is installed 🎉

🆕 2 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks

  • resolver[single-thread] (1.9 ms)
  • resolver[multi-thread] (2.1 ms)

Boshen added a commit that referenced this pull request Jul 2, 2026
)

The "return the last array entry's error" branch in
`package_target_resolve` was dead code: `i` comes from `enumerate()`, so
`i == targets.len()` could never be true. Errors from array entries were
always swallowed like `undefined`, so an invalid target in the last
fallback entry surfaced as a generic `PackagePathNotExported` instead of
the specific error — despite the comment right below claiming "Return or
throw the last fallback resolution null return or error".

This fixes the off-by-one (`i + 1 == targets.len()`) so the last entry's
error now propagates, matching the documented intent and Node's
`lastException` behavior for arrays.

One deliberate exemption: `ResolveError::NotFound` still falls through.
It only arises from re-resolving a bare `imports` target (e.g. `\"#a\":
[{\"import\": [\"#b/import.js\"]}]`) through the module system, and
enhanced-resolve treats an unresolvable candidate there as a soft
failure, not a hard error — the ported "Direct and conditional mapping
#4" test pins that behavior. Node would actually throw immediately on
any non-`ERR_INVALID_PACKAGE_TARGET` error inside the array loop, which
is stricter than enhanced-resolve; the exemption keeps us compatible
with the latter.

Adds two imports-field tests: an invalid target in the **last** array
entry now errors (previously `Ok(None)`), and an invalid target in a
**non-last** entry still falls through to the next entry.

Split out of #1263.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant