Skip to content

Commit 1ef7fd0

Browse files
committed
Remove require search fallback
1 parent a49bf6b commit 1ef7fd0

File tree

2 files changed

+129
-140
lines changed

2 files changed

+129
-140
lines changed

dist/index.js

Lines changed: 128 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports =
4040
/******/ // the startup function
4141
/******/ function startup() {
4242
/******/ // Load entry module and return exports
43-
/******/ return __webpack_require__(720);
43+
/******/ return __webpack_require__(272);
4444
/******/ };
4545
/******/ // initialize runtime
4646
/******/ runtime(__webpack_require__);
@@ -2424,6 +2424,114 @@ exports.request = request;
24242424
//# sourceMappingURL=index.js.map
24252425

24262426

2427+
/***/ }),
2428+
2429+
/***/ 272:
2430+
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
2431+
2432+
"use strict";
2433+
__webpack_require__.r(__webpack_exports__);
2434+
2435+
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
2436+
var core = __webpack_require__(186);
2437+
2438+
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
2439+
var lib_github = __webpack_require__(438);
2440+
2441+
// EXTERNAL MODULE: ./node_modules/@actions/glob/lib/glob.js
2442+
var glob = __webpack_require__(90);
2443+
2444+
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
2445+
var io = __webpack_require__(436);
2446+
2447+
// CONCATENATED MODULE: ./src/async-function.ts
2448+
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
2449+
function callAsyncFunction(args, source) {
2450+
const fn = new AsyncFunction(...Object.keys(args), source);
2451+
return fn(...Object.values(args));
2452+
}
2453+
2454+
// EXTERNAL MODULE: external "path"
2455+
var external_path_ = __webpack_require__(622);
2456+
2457+
// CONCATENATED MODULE: ./src/wrap-require.ts
2458+
2459+
const wrapRequire = new Proxy(require, {
2460+
apply: (target, thisArg, [moduleID]) => {
2461+
if (moduleID.startsWith('.')) {
2462+
moduleID = Object(external_path_.resolve)(moduleID);
2463+
return target.apply(thisArg, [moduleID]);
2464+
}
2465+
const modulePath = target.resolve.apply(thisArg, [
2466+
moduleID,
2467+
{
2468+
// Webpack does not have an escape hatch for getting the actual
2469+
// module, other than `eval`.
2470+
paths: [process.cwd()]
2471+
}
2472+
]);
2473+
return target.apply(thisArg, [modulePath]);
2474+
},
2475+
get: (target, prop, receiver) => {
2476+
Reflect.get(target, prop, receiver);
2477+
}
2478+
});
2479+
2480+
// CONCATENATED MODULE: ./src/main.ts
2481+
2482+
2483+
2484+
2485+
2486+
2487+
process.on('unhandledRejection', handleError);
2488+
main().catch(handleError);
2489+
async function main() {
2490+
const token = Object(core.getInput)('github-token', { required: true });
2491+
const debug = Object(core.getInput)('debug');
2492+
const userAgent = Object(core.getInput)('user-agent');
2493+
const previews = Object(core.getInput)('previews');
2494+
const opts = {};
2495+
if (debug === 'true')
2496+
opts.log = console;
2497+
if (userAgent != null)
2498+
opts.userAgent = userAgent;
2499+
if (previews != null)
2500+
opts.previews = previews.split(',');
2501+
const github = Object(lib_github.getOctokit)(token, opts);
2502+
const script = Object(core.getInput)('script', { required: true });
2503+
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
2504+
const result = await callAsyncFunction({
2505+
require: wrapRequire,
2506+
__original_require__: require,
2507+
github,
2508+
context: lib_github.context,
2509+
core: core,
2510+
glob: glob,
2511+
io: io
2512+
}, script);
2513+
let encoding = Object(core.getInput)('result-encoding');
2514+
encoding = encoding ? encoding : 'json';
2515+
let output;
2516+
switch (encoding) {
2517+
case 'json':
2518+
output = JSON.stringify(result);
2519+
break;
2520+
case 'string':
2521+
output = String(result);
2522+
break;
2523+
default:
2524+
throw new Error('"result-encoding" must be either "string" or "json"');
2525+
}
2526+
Object(core.setOutput)('result', output);
2527+
}
2528+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2529+
function handleError(err) {
2530+
console.error(err);
2531+
Object(core.setFailed)(`Unhandled error: ${err}`);
2532+
}
2533+
2534+
24272535
/***/ }),
24282536

24292537
/***/ 278:
@@ -2883,39 +2991,6 @@ function escapeProperty(s) {
28832991

28842992
module.exports = require("assert");
28852993

2886-
/***/ }),
2887-
2888-
/***/ 366:
2889-
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
2890-
2891-
"use strict";
2892-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapRequire", function() { return wrapRequire; });
2893-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(622);
2894-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
2895-
2896-
const wrapRequire = new Proxy(require, {
2897-
apply: (target, thisArg, [moduleID]) => {
2898-
if (moduleID.startsWith('.')) {
2899-
moduleID = path__WEBPACK_IMPORTED_MODULE_0__.resolve(moduleID);
2900-
return target.apply(thisArg, [moduleID]);
2901-
}
2902-
const modulePath = target.resolve.apply(thisArg, [
2903-
moduleID,
2904-
{
2905-
// Search the current working directory first, then the existing paths.
2906-
// Webpack does not have an escape hatch for getting the actual
2907-
// module, other than `eval`.
2908-
paths: [process.cwd(), ...eval('module').paths]
2909-
}
2910-
]);
2911-
return target.apply(thisArg, [modulePath]);
2912-
},
2913-
get: (target, prop, receiver) => {
2914-
Reflect.get(target, prop, receiver);
2915-
}
2916-
});
2917-
2918-
29192994
/***/ }),
29202995

29212996
/***/ 413:
@@ -6127,91 +6202,6 @@ function issueCommand(command, message) {
61276202
exports.issueCommand = issueCommand;
61286203
//# sourceMappingURL=file-command.js.map
61296204

6130-
/***/ }),
6131-
6132-
/***/ 720:
6133-
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
6134-
6135-
"use strict";
6136-
__webpack_require__.r(__webpack_exports__);
6137-
6138-
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
6139-
var core = __webpack_require__(186);
6140-
6141-
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
6142-
var lib_github = __webpack_require__(438);
6143-
6144-
// EXTERNAL MODULE: ./node_modules/@actions/glob/lib/glob.js
6145-
var glob = __webpack_require__(90);
6146-
6147-
// EXTERNAL MODULE: ./node_modules/@actions/io/lib/io.js
6148-
var io = __webpack_require__(436);
6149-
6150-
// CONCATENATED MODULE: ./src/async-function.ts
6151-
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor;
6152-
function callAsyncFunction(args, source) {
6153-
const fn = new AsyncFunction(...Object.keys(args), source);
6154-
return fn(...Object.values(args));
6155-
}
6156-
6157-
// EXTERNAL MODULE: ./src/wrap-require.ts
6158-
var wrap_require = __webpack_require__(366);
6159-
6160-
// CONCATENATED MODULE: ./src/main.ts
6161-
6162-
6163-
6164-
6165-
6166-
6167-
process.on('unhandledRejection', handleError);
6168-
main().catch(handleError);
6169-
async function main() {
6170-
const token = Object(core.getInput)('github-token', { required: true });
6171-
const debug = Object(core.getInput)('debug');
6172-
const userAgent = Object(core.getInput)('user-agent');
6173-
const previews = Object(core.getInput)('previews');
6174-
const opts = {};
6175-
if (debug === 'true')
6176-
opts.log = console;
6177-
if (userAgent != null)
6178-
opts.userAgent = userAgent;
6179-
if (previews != null)
6180-
opts.previews = previews.split(',');
6181-
const github = Object(lib_github.getOctokit)(token, opts);
6182-
const script = Object(core.getInput)('script', { required: true });
6183-
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
6184-
const result = await callAsyncFunction({
6185-
require: wrap_require.wrapRequire,
6186-
__original_require__: require,
6187-
github,
6188-
context: lib_github.context,
6189-
core: core,
6190-
glob: glob,
6191-
io: io
6192-
}, script);
6193-
let encoding = Object(core.getInput)('result-encoding');
6194-
encoding = encoding ? encoding : 'json';
6195-
let output;
6196-
switch (encoding) {
6197-
case 'json':
6198-
output = JSON.stringify(result);
6199-
break;
6200-
case 'string':
6201-
output = String(result);
6202-
break;
6203-
default:
6204-
throw new Error('"result-encoding" must be either "string" or "json"');
6205-
}
6206-
Object(core.setOutput)('result', output);
6207-
}
6208-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6209-
function handleError(err) {
6210-
console.error(err);
6211-
Object(core.setFailed)(`Unhandled error: ${err}`);
6212-
}
6213-
6214-
62156205
/***/ }),
62166206

62176207
/***/ 747:
@@ -8769,15 +8759,14 @@ function regExpEscape (s) {
87698759
/******/ function(__webpack_require__) { // webpackRuntimeModules
87708760
/******/ "use strict";
87718761
/******/
8772-
/******/ /* webpack/runtime/compat get default export */
8762+
/******/ /* webpack/runtime/make namespace object */
87738763
/******/ !function() {
8774-
/******/ // getDefaultExport function for compatibility with non-harmony modules
8775-
/******/ __webpack_require__.n = function(module) {
8776-
/******/ var getter = module && module.__esModule ?
8777-
/******/ function getDefault() { return module['default']; } :
8778-
/******/ function getModuleExports() { return module; };
8779-
/******/ __webpack_require__.d(getter, 'a', getter);
8780-
/******/ return getter;
8764+
/******/ // define __esModule on exports
8765+
/******/ __webpack_require__.r = function(exports) {
8766+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
8767+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
8768+
/******/ }
8769+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
87818770
/******/ };
87828771
/******/ }();
87838772
/******/
@@ -8792,17 +8781,6 @@ function regExpEscape (s) {
87928781
/******/ };
87938782
/******/ }();
87948783
/******/
8795-
/******/ /* webpack/runtime/make namespace object */
8796-
/******/ !function() {
8797-
/******/ // define __esModule on exports
8798-
/******/ __webpack_require__.r = function(exports) {
8799-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
8800-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
8801-
/******/ }
8802-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
8803-
/******/ };
8804-
/******/ }();
8805-
/******/
88068784
/******/ /* webpack/runtime/create fake namespace object */
88078785
/******/ !function() {
88088786
/******/ // create a fake namespace object
@@ -8822,5 +8800,17 @@ function regExpEscape (s) {
88228800
/******/ };
88238801
/******/ }();
88248802
/******/
8803+
/******/ /* webpack/runtime/compat get default export */
8804+
/******/ !function() {
8805+
/******/ // getDefaultExport function for compatibility with non-harmony modules
8806+
/******/ __webpack_require__.n = function(module) {
8807+
/******/ var getter = module && module.__esModule ?
8808+
/******/ function getDefault() { return module['default']; } :
8809+
/******/ function getModuleExports() { return module; };
8810+
/******/ __webpack_require__.d(getter, 'a', getter);
8811+
/******/ return getter;
8812+
/******/ };
8813+
/******/ }();
8814+
/******/
88258815
/******/ }
88268816
);

src/wrap-require.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ export const wrapRequire = new Proxy(__non_webpack_require__, {
1010
const modulePath = target.resolve.apply(thisArg, [
1111
moduleID,
1212
{
13-
// Search the current working directory first, then the existing paths.
1413
// Webpack does not have an escape hatch for getting the actual
1514
// module, other than `eval`.
16-
paths: [process.cwd(), ...eval('module').paths]
15+
paths: [process.cwd()]
1716
}
1817
])
1918

0 commit comments

Comments
 (0)