mirror of
https://github.com/actions/github-script.git
synced 2025-12-09 20:36:20 +00:00
Add a catch to support requiring installed modules
This commit is contained in:
36
dist/index.js
vendored
36
dist/index.js
vendored
@@ -2427,7 +2427,7 @@ exports.request = request;
|
|||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 272:
|
/***/ 272:
|
||||||
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
@@ -2455,13 +2455,20 @@ function callAsyncFunction(args, source) {
|
|||||||
var external_path_ = __webpack_require__(622);
|
var external_path_ = __webpack_require__(622);
|
||||||
|
|
||||||
// CONCATENATED MODULE: ./src/wrap-require.ts
|
// CONCATENATED MODULE: ./src/wrap-require.ts
|
||||||
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
||||||
|
|
||||||
const wrapRequire = new Proxy(require, {
|
const wrapRequire = new Proxy(require, {
|
||||||
apply: (target, thisArg, [moduleID]) => {
|
apply: (target, thisArg, [moduleID]) => {
|
||||||
if (moduleID.startsWith('.')) {
|
if (moduleID.startsWith('.')) {
|
||||||
moduleID = Object(external_path_.join)(process.cwd(), moduleID);
|
moduleID = Object(external_path_.join)(process.cwd(), moduleID);
|
||||||
|
return target.apply(thisArg, [moduleID]);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return target.apply(thisArg, [moduleID]);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return target.resolve(moduleID, { paths: [...module.paths, process.cwd()] });
|
||||||
}
|
}
|
||||||
return target.apply(thisArg, [moduleID]);
|
|
||||||
},
|
},
|
||||||
get: (target, prop, receiver) => {
|
get: (target, prop, receiver) => {
|
||||||
Reflect.get(target, prop, receiver);
|
Reflect.get(target, prop, receiver);
|
||||||
@@ -2494,7 +2501,7 @@ async function main() {
|
|||||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
||||||
const result = await callAsyncFunction({
|
const result = await callAsyncFunction({
|
||||||
require: wrapRequire,
|
require: wrapRequire,
|
||||||
nativeRequire: require,
|
__original_require__: require,
|
||||||
github,
|
github,
|
||||||
context: lib_github.context,
|
context: lib_github.context,
|
||||||
core: core,
|
core: core,
|
||||||
@@ -8803,5 +8810,28 @@ function regExpEscape (s) {
|
|||||||
/******/ };
|
/******/ };
|
||||||
/******/ }();
|
/******/ }();
|
||||||
/******/
|
/******/
|
||||||
|
/******/ /* webpack/runtime/harmony module decorator */
|
||||||
|
/******/ !function() {
|
||||||
|
/******/ __webpack_require__.hmd = function(module) {
|
||||||
|
/******/ module = Object.create(module);
|
||||||
|
/******/ if (!module.children) module.children = [];
|
||||||
|
/******/ Object.defineProperty(module, 'loaded', {
|
||||||
|
/******/ enumerable: true,
|
||||||
|
/******/ get: function () { return module.l; }
|
||||||
|
/******/ });
|
||||||
|
/******/ Object.defineProperty(module, 'id', {
|
||||||
|
/******/ enumerable: true,
|
||||||
|
/******/ get: function () { return module.i; }
|
||||||
|
/******/ });
|
||||||
|
/******/ Object.defineProperty(module, 'exports', {
|
||||||
|
/******/ enumerable: true,
|
||||||
|
/******/ set: function () {
|
||||||
|
/******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);
|
||||||
|
/******/ }
|
||||||
|
/******/ });
|
||||||
|
/******/ return module;
|
||||||
|
/******/ };
|
||||||
|
/******/ }();
|
||||||
|
/******/
|
||||||
/******/ }
|
/******/ }
|
||||||
);
|
);
|
||||||
@@ -4,8 +4,14 @@ export const wrapRequire = new Proxy(__non_webpack_require__, {
|
|||||||
apply: (target, thisArg, [moduleID]) => {
|
apply: (target, thisArg, [moduleID]) => {
|
||||||
if (moduleID.startsWith('.')) {
|
if (moduleID.startsWith('.')) {
|
||||||
moduleID = path.join(process.cwd(), moduleID)
|
moduleID = path.join(process.cwd(), moduleID)
|
||||||
|
return target.apply(thisArg, [moduleID])
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return target.apply(thisArg, [moduleID])
|
||||||
|
} catch (err) {
|
||||||
|
return target.resolve(moduleID, {paths: [...module.paths, process.cwd()]})
|
||||||
}
|
}
|
||||||
return target.apply(thisArg, [moduleID])
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get: (target, prop, receiver) => {
|
get: (target, prop, receiver) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user