Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pass nativeRequire, as well
  • Loading branch information
jclem committed Apr 21, 2021
commit c416f56b51c47a3aa24eb34cd72e72116711d289
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/async-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type AsyncFunctionArguments = {
glob: typeof glob
io: typeof io
require: NodeRequire
nativeRequire: NodeRequire
}

export function callAsyncFunction<T>(
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async function main(): Promise<void> {
const result = await callAsyncFunction(
{
require: wrapRequire,
nativeRequire: __non_webpack_require__,
github,
context,
core,
Expand Down
2 changes: 0 additions & 2 deletions src/wrap-require.ts
Original file line number Diff line number Diff line change
@@ -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('.')) {
Expand Down
1 change: 1 addition & 0 deletions types/non-webpack-require.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const __non_webpack_require__: NodeRequire