-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable VM ESM loading for sidecar-dump util (#17)
- Loading branch information
Showing
8 changed files
with
86 additions
and
38 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
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
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,36 @@ | ||
import vm from 'vm' | ||
|
||
/** | ||
* importModuleDynamically for vm module is cached #36351 | ||
* https://github.com/nodejs/node/issues/36351 | ||
*/ | ||
declare module 'vm' { | ||
export interface SourceTextModuleOptions { | ||
importModuleDynamically: ( | ||
specifier: string, | ||
module?: any, | ||
) => any | ||
context?: vm.Context | ||
} | ||
|
||
export type Linker = ( | ||
specifier: string, | ||
extra: Object, | ||
referencingModule: any, | ||
) => any | ||
|
||
export class SourceTextModule { | ||
|
||
constructor ( | ||
code: string, | ||
options?: SourceTextModuleOptions, | ||
) | ||
|
||
link (linker: Linker): Promise<void> | ||
evaluate (): Promise<void> | ||
|
||
} | ||
} | ||
|
||
export { vm } | ||
export default vm |