-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: fix loader hooks accepting too many arguments
PR-URL: #44109 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
- Loading branch information
1 parent
e6db809
commit ae157d9
Showing
4 changed files
with
64 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 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,28 @@ | ||
export async function resolve(...args) { | ||
console.log(`resolve arg count: ${args.length}`); | ||
console.log({ | ||
specifier: args[0], | ||
context: args[1], | ||
next: args[2], | ||
}); | ||
|
||
return { | ||
shortCircuit: true, | ||
url: args[0], | ||
}; | ||
} | ||
|
||
export async function load(...args) { | ||
console.log(`load arg count: ${args.length}`); | ||
console.log({ | ||
url: args[0], | ||
context: args[1], | ||
next: args[2], | ||
}); | ||
|
||
return { | ||
format: 'module', | ||
source: '', | ||
shortCircuit: true, | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
test/fixtures/es-module-loaders/loader-with-too-many-args.mjs
This file contains 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,7 @@ | ||
export async function resolve(specifier, context, next) { | ||
return next(specifier, context, 'resolve-extra-arg'); | ||
} | ||
|
||
export async function load(url, context, next) { | ||
return next(url, context, 'load-extra-arg'); | ||
} |