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
Next Next commit
Use non-Webpack-require in evaluated scripts
  • Loading branch information
jclem committed Apr 21, 2021
commit ddba1b195df0a72d684224e037a854574145e15c
21 changes: 1 addition & 20 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6144,7 +6144,7 @@ async function main() {
const github = Object(lib_github.getOctokit)(token, opts);
const script = Object(core.getInput)('script', { required: true });
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
const result = await callAsyncFunction({ require: __webpack_require__(875), github, context: lib_github.context, core: core, glob: glob, io: io }, script);
const result = await callAsyncFunction({ require: require, github, context: lib_github.context, core: core, glob: glob, io: io }, script);
let encoding = Object(core.getInput)('result-encoding');
encoding = encoding ? encoding : 'json';
let output;
Expand Down Expand Up @@ -6901,25 +6901,6 @@ function expand(str, isTop) {



/***/ }),

/***/ 875:
/***/ (function(module) {

function webpackEmptyContext(req) {
if (typeof req === 'number' && __webpack_require__.m[req])
return __webpack_require__(req);
try { return require(req) }
catch (e) { if (e.code !== 'MODULE_NOT_FOUND') throw e }
var e = new Error("Cannot find module '" + req + "'");
e.code = 'MODULE_NOT_FOUND';
throw e;
}
webpackEmptyContext.keys = function() { return []; };
webpackEmptyContext.resolve = webpackEmptyContext;
module.exports = webpackEmptyContext;
webpackEmptyContext.id = 875;

/***/ }),

/***/ 877:
Expand Down
4 changes: 2 additions & 2 deletions src/async-function.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as core from '@actions/core'
import {Context} from '@actions/github/lib/context'
import {GitHub} from '@actions/github/lib/utils'
import { Context } from '@actions/github/lib/context'
import { GitHub } from '@actions/github/lib/utils'
import * as glob from '@actions/glob'
import * as io from '@actions/io'

Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import * as glob from '@actions/glob'
import * as io from '@actions/io'
import {callAsyncFunction} from './async-function'

declare const __non_webpack_require__: typeof require

process.on('unhandledRejection', handleError)
main().catch(handleError)

Expand All @@ -29,7 +31,7 @@ async function main(): Promise<void> {

// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
const result = await callAsyncFunction(
{require: require, github, context, core, glob, io},
{require: __non_webpack_require__, github, context, core, glob, io},
script
)

Expand Down