Skip to content

Commit 63248d0

Browse files
authored
Merge pull request #30 from cspotcode/sourceMapSupportRedirect-followup
Amendment to #1496: redirect subsequent imports of "source-map-support" to this package
2 parents c7db746 + fc4fc9f commit 63248d0

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

source-map-support.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ export interface Options {
3939
* Callback will be called every time we redirect due to `redirectConflictingLibrary`
4040
* This allows consumers to log helpful warnings if they choose.
4141
* @param parent NodeJS.Module which made the require() or require.resolve() call
42+
* @param options options object internally passed to node's `_resolveFilename` hook
4243
*/
43-
onConflictingLibraryRedirect?: (request: string, parent: any, isMain: boolean, redirectedRequest: string) => void;
44+
onConflictingLibraryRedirect?: (request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void;
4445
}
4546

4647
export interface Position {

source-map-support.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function dynamicRequire(mod, request) {
3535
// Increment this if the format of sharedData changes in a breaking way.
3636
var sharedDataVersion = 1;
3737

38+
/**
39+
* @template T
40+
* @param {T} defaults
41+
* @returns {T}
42+
*/
3843
function initializeSharedData(defaults) {
3944
var sharedDataKey = 'source-map-support/sharedData';
4045
if (typeof Symbol !== 'undefined') {
@@ -80,7 +85,7 @@ var sharedData = initializeSharedData({
8085
/** @type {HookState} */
8186
moduleResolveFilenameHook: undefined,
8287

83-
/** @type {Array<(request: string, parent: any, isMain: boolean, redirectedRequest: string) => void>} */
88+
/** @type {Array<(request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void>} */
8489
onConflictingLibraryRedirectArr: [],
8590

8691
// If true, the caches are reset before a stack trace formatting operation

0 commit comments

Comments
 (0)