Pass nativeRequire, as well

This commit is contained in:
Jonathan Clem 2021-04-21 16:40:48 -04:00
parent 75e3a5b35d
commit c416f56b51
No known key found for this signature in database
GPG key ID: 2159A758355F0178
5 changed files with 4 additions and 2 deletions

1
dist/index.js vendored
View file

@ -2494,6 +2494,7 @@ async function main() {
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
const result = await callAsyncFunction({
require: wrapRequire,
nativeRequire: require,
github,
context: lib_github.context,
core: core,

View file

@ -13,6 +13,7 @@ type AsyncFunctionArguments = {
glob: typeof glob
io: typeof io
require: NodeRequire
nativeRequire: NodeRequire
}
export function callAsyncFunction<T>(

View file

@ -32,6 +32,7 @@ async function main(): Promise<void> {
const result = await callAsyncFunction(
{
require: wrapRequire,
nativeRequire: __non_webpack_require__,
github,
context,
core,

View file

@ -1,7 +1,5 @@
import * as path from 'path'
declare const __non_webpack_require__: NodeRequire
export const wrapRequire = new Proxy(__non_webpack_require__, {
apply: (target, thisArg, [moduleID]) => {
if (moduleID.startsWith('.')) {

View file

@ -0,0 +1 @@
declare const __non_webpack_require__: NodeRequire