Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use non-Webpack-require in evaluated scripts #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
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