-
Notifications
You must be signed in to change notification settings - Fork 52
fix: fix a couple issues with duplicate entries and specifier (submodule) matching #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3ed5244
example that demonstrates the problem with 'experimentalPatchInternals'
trentm 747d2ca
fix: clarify the matching and fix a couple issues with duplicate entr…
trentm 5a299f0
remove play/dev files added earlier for a demo
trentm f61aee9
test fixes for running with older Node.js versions
trentm a083bc7
move the new tests to only test with Node.js v20 and later, for the i…
trentm 8506ccd
need at least v20.19 for these tests apparently
trentm 0e5f6be
fix lint
trentm 1cec328
only run these tests with Node.js v22 and later, ^20.19 is actually f…
trentm cadefca
since limiting to Node.js v22, can use top-level await in these tests
trentm 2f55c6e
Merge branch 'main' into trentm-clearer-match-block
trentm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { deepStrictEqual } from 'assert' | ||
| import { Hook } from '../../index.js' | ||
|
|
||
| const hits = [] | ||
| Hook(['some-external-module', 'some-external-module'], { internals: true }, (exports, name, baseDir) => { | ||
| hits.push(name) | ||
| }) | ||
|
|
||
| await import('../fixtures/load-external-modules.mjs') | ||
|
|
||
| // Should get hits for each of the two 'some-external-module' Hook entries. | ||
| deepStrictEqual(hits, [ | ||
| 'some-external-module/sub.mjs', | ||
| 'some-external-module/sub.mjs', | ||
| 'some-external-module/index.mjs', | ||
| 'some-external-module/index.mjs' | ||
| ]) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { deepStrictEqual } from 'assert' | ||
| import { Hook } from '../../index.js' | ||
|
|
||
| const hits = [] | ||
| Hook(['some-external-module', 'some-external-module/sub'], { internals: true }, (exports, name, baseDir) => { | ||
| hits.push(name) | ||
| }) | ||
|
|
||
| await import('../fixtures/load-external-modules.mjs') | ||
|
|
||
| deepStrictEqual(hits, [ | ||
| 'some-external-module/sub.mjs', // module name match, internals:true | ||
| 'some-external-module/sub', // specifier match | ||
| 'some-external-module/index.mjs' // module name match, internals:true | ||
| ]) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think matching this with RITM would be good. I would be fine to do that as a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BridgeAR Please see #239 which discusses this. I don't know how to fix this difference very easily.