web-node 1.0.614 → 1.0.616
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -2
- package/index.js +16 -64
- package/main.js +12 -60
- package/package.json +1 -1
- package/pluginAPI.d.ts +2 -2
- package/type.d.ts +3 -2
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './configurator';
|
|
2
2
|
export * from './pluginAPI';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PluginPreloader } from './type';
|
|
4
4
|
import { Logger } from 'clientnode';
|
|
5
5
|
export declare const log: Logger;
|
|
6
|
-
export declare const main: (pluginLoaderMapping?:
|
|
6
|
+
export declare const main: (pluginLoaderMapping?: PluginPreloader) => Promise<void>;
|
|
7
7
|
export declare let isMainModulePositiveCalls: number;
|
|
8
8
|
export declare const isMainModule: (filename?: string, onlyOnce?: boolean) => Promise<boolean>;
|
|
9
9
|
export default main;
|
package/index.js
CHANGED
|
@@ -17,7 +17,6 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
17
17
|
/* harmony export */ Ad: () => (/* binding */ hotReloadFiles),
|
|
18
18
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
19
19
|
/* harmony export */ GH: () => (/* binding */ isInLocations),
|
|
20
|
-
/* harmony export */ GU: () => (/* binding */ PLUGIN_LOADER),
|
|
21
20
|
/* harmony export */ Gy: () => (/* binding */ determineInternalName),
|
|
22
21
|
/* harmony export */ Hh: () => (/* binding */ load),
|
|
23
22
|
/* harmony export */ MM: () => (/* binding */ pluginAPI),
|
|
@@ -34,7 +33,8 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
34
33
|
/* harmony export */ m7: () => (/* binding */ determineLocations),
|
|
35
34
|
/* harmony export */ nQ: () => (/* binding */ loadAPI),
|
|
36
35
|
/* harmony export */ u2: () => (/* binding */ evaluateConfiguration),
|
|
37
|
-
/* harmony export */ vF: () => (/* binding */ loadConfiguration)
|
|
36
|
+
/* harmony export */ vF: () => (/* binding */ loadConfiguration),
|
|
37
|
+
/* harmony export */ zW: () => (/* binding */ PLUGIN_PRELOADER)
|
|
38
38
|
/* harmony export */ });
|
|
39
39
|
/* unused harmony export log */
|
|
40
40
|
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
@@ -63,44 +63,7 @@ _configurator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_async_dependencies_res
|
|
|
63
63
|
endregion
|
|
64
64
|
*/// region imports
|
|
65
65
|
function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)};function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}};// endregion
|
|
66
|
-
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node.plugin-api"});var
|
|
67
|
-
/*
|
|
68
|
-
ES module specific logic to deduplicate the main module's scope for plugins
|
|
69
|
-
to avoid loading it twice and therefore having two different scopes of the
|
|
70
|
-
same module in memory:
|
|
71
|
-
|
|
72
|
-
// main-module-hook.ts (must compile/run as a standalone module)
|
|
73
|
-
import type {ResolveHook, InitializeHook} from 'node:module'
|
|
74
|
-
|
|
75
|
-
let mainModuleURL: string | undefined
|
|
76
|
-
|
|
77
|
-
export const initialize: InitializeHook = (
|
|
78
|
-
data: {mainModuleURL?: string}
|
|
79
|
-
): void => {
|
|
80
|
-
mainModuleURL = data.mainModuleURL
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const resolve: ResolveHook = (specifier, context, nextResolve) => {
|
|
84
|
-
if (specifier === 'main-module' && mainModuleURL)
|
|
85
|
-
// Redirect to the entry module's URL; the ESM cache is keyed by
|
|
86
|
-
// resolved URL, so every importer shares that one instance.
|
|
87
|
-
return nextResolve(mainModuleURL, context)
|
|
88
|
-
|
|
89
|
-
return nextResolve(specifier, context)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Registering it
|
|
93
|
-
|
|
94
|
-
// setup.ts (imported first, before anything does import 'main-module')
|
|
95
|
-
import {register} from 'node:module'
|
|
96
|
-
import {pathToFileURL} from 'node:url'
|
|
97
|
-
|
|
98
|
-
register('./main-module-hook.js', {
|
|
99
|
-
parentURL: import.meta.url,
|
|
100
|
-
data: {mainModuleURL: pathToFileURL(process.argv[1]).href}
|
|
101
|
-
})
|
|
102
|
-
*/// endregion
|
|
103
|
-
/**
|
|
66
|
+
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node.plugin-api"});var PLUGIN_PRELOADER={};await (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.importFilesystemAPI)();/**
|
|
104
67
|
* Calls all plugin methods for given trigger description asynchronous and
|
|
105
68
|
* waits for their resolved promises.
|
|
106
69
|
* @param givenState - Contains runtime information about current hook.
|
|
@@ -191,14 +154,14 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
191
154
|
* @param configuration - Plugin specific configurations.
|
|
192
155
|
* @param configurationFilePaths - Plugin specific configuration file paths.
|
|
193
156
|
* @returns Plugin meta information object.
|
|
194
|
-
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
157
|
+
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var _ref5;var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
195
158
|
NOTE: Check if a webNode plugin configuration is available
|
|
196
159
|
indicating a backend responsibility for api file.
|
|
197
160
|
|
|
198
161
|
NOTE: One key is always there representing the whole package
|
|
199
162
|
configuration.
|
|
200
163
|
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t0){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t0=_context8.v;case 13:if(!_t0){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
201
|
-
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
164
|
+
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!((_ref5=plugins[name])!==null&&_ref5!==void 0?_ref5:nativeAPI)){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
202
165
|
* Loads plugin specific configuration object.
|
|
203
166
|
* @param name - Property name where to inject resolved configuration into
|
|
204
167
|
* global one.
|
|
@@ -236,7 +199,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
236
199
|
* @param pluginPath - Path to the plugin directory.
|
|
237
200
|
* @param fileNames - List of configuration file names to check.
|
|
238
201
|
* @returns A list of existing configuration file paths.
|
|
239
|
-
*/var gatherConfigurationFilePaths=/*#__PURE__*/function(){var _gatherConfigurationFilePaths=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(pluginPath,fileNames){var result,_iterator10,_step10,fileName,filePath,_t24;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:result=[];_iterator10=_createForOfIteratorHelper(fileNames);_context9.p=1;_iterator10.s();case 2:if((_step10=_iterator10.n()).done){_context9.n=5;break}fileName=_step10.value;filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName);_context9.n=3;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 3:if(!_context9.v){_context9.n=4;break}result.push(filePath);case 4:_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t24=_context9.v;_iterator10.e(_t24);case 7:_context9.p=7;_iterator10.f();return _context9.f(7);case 8:return _context9.a(2,result)}},_callee9,null,[[1,6,7,8]])}));function gatherConfigurationFilePaths(_x22,_x23){return _gatherConfigurationFilePaths.apply(this,arguments)}return gatherConfigurationFilePaths}();/**
|
|
202
|
+
*/var gatherConfigurationFilePaths=/*#__PURE__*/function(){var _gatherConfigurationFilePaths=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(pluginPath,fileNames){var result,_iterator10,_step10,fileName,filePath,_t24;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:result=[];_iterator10=_createForOfIteratorHelper(fileNames);_context9.p=1;_iterator10.s();case 2:if((_step10=_iterator10.n()).done){_context9.n=5;break}fileName=_step10.value;filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName);_context9.n=3;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 3:if(!_context9.v){_context9.n=4;break}result.push(filePath);case 4:_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t24=_context9.v;_iterator10.e(_t24);case 7:_context9.p=7;_iterator10.f();return _context9.f(7);case 8:return _context9.a(2,result.sort())}},_callee9,null,[[1,6,7,8]])}));function gatherConfigurationFilePaths(_x22,_x23){return _gatherConfigurationFilePaths.apply(this,arguments)}return gatherConfigurationFilePaths}();/**
|
|
240
203
|
* Load given api file path and returns exported scope.
|
|
241
204
|
* @param filePath - Path to file to load.
|
|
242
205
|
* @param name - Plugin name to use for proper error messages.
|
|
@@ -244,28 +207,17 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
244
207
|
* If a "null" is given an error will be thrown.
|
|
245
208
|
* @param doLogging - Enables logging.
|
|
246
209
|
* @returns Exported api file scope.
|
|
247
|
-
*/var loadFile=/*#__PURE__*/function(){var _loadFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(filePath,name,fallbackScope,doLogging){var options,scope,_t25;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:if(fallbackScope===void 0){fallbackScope=null}if(doLogging===void 0){doLogging=true}
|
|
248
|
-
/*
|
|
249
|
-
let reference: string | undefined
|
|
250
|
-
try {
|
|
251
|
-
reference = import.meta.resolve(filePath)
|
|
252
|
-
} catch {
|
|
253
|
-
// Ignore error.
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (reference)
|
|
257
|
-
// Clear the module cache.
|
|
258
|
-
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context0.p=1;_context0.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context0.v;_context0.n=5;break;case 3:_context0.p=3;_t25=_context0.v;if(!fallbackScope){_context0.n=4;break}scope=fallbackScope;if(doLogging)log.warn("Couldn't load new api plugin file \"".concat(filePath,"\" for"),"plugin \"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25),". Using"),"fallback one.");_context0.n=5;break;case 4:throw new Error("Couldn't load plugin file \"".concat(filePath,"\" for plugin ")+"\"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25)),{cause:_t25});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context0.n=6;break}return _context0.a(2,scope.default);case 6:return _context0.a(2,scope)}},_callee0,null,[[1,3]])}));function loadFile(_x24,_x25,_x26,_x27){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
210
|
+
*/var loadFile=/*#__PURE__*/function(){var _loadFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(filePath,name,fallbackScope,doLogging){var options,scope,_t25;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:if(fallbackScope===void 0){fallbackScope=null}if(doLogging===void 0){doLogging=true}options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context0.p=1;_context0.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context0.v;_context0.n=5;break;case 3:_context0.p=3;_t25=_context0.v;if(!fallbackScope){_context0.n=4;break}scope=fallbackScope;if(doLogging)log.warn("Couldn't load new api plugin file \"".concat(filePath,"\" for"),"plugin \"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25),". Using"),"fallback one.");_context0.n=5;break;case 4:throw new Error("Couldn't load plugin file \"".concat(filePath,"\" for plugin ")+"\"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25)),{cause:_t25});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context0.n=6;break}return _context0.a(2,scope.default);case 6:return _context0.a(2,scope)}},_callee0,null,[[1,3]])}));function loadFile(_x24,_x25,_x26,_x27){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
259
211
|
* Extends given configuration object with all plugin specific ones and returns
|
|
260
212
|
* a topological sorted list of plugins with plugins specific meta information
|
|
261
213
|
* stored.
|
|
262
214
|
* @param configuration - Configuration object to extend and use.
|
|
263
215
|
* @returns A topological sorted list of plugins objects.
|
|
264
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(configuration){var
|
|
216
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(configuration){var plugins,_i5,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfigurations,_combinePluginConfigu2,internalName,pluginConfiguration,hasPluginConfiguration,_configuration$core$p,_name2,_internalName,_i6,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator11,_step11,pluginName,currentPluginPath,_internalName2,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator12,_step12,_name3,sortedPlugins,_iterator13,_step13,_pluginName,_i8,_Object$entries5,_Object$entries5$_i,_name4,_plugin2,_t26,_t27,_t28,_t29,_t30;return _regenerator().w(function(_context1){while(1)switch(_context1.p=_context1.n){case 0:plugins={};for(_i5=0,_Object$entries4=Object.entries(PLUGIN_PRELOADER);_i5<_Object$entries4.length;_i5++){_Object$entries4$_i=_slicedToArray(_Object$entries4[_i5],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];pluginConfigurations=[].concat(plugin.configurations||[]);_combinePluginConfigu2=combinePluginConfigurations(plugin.name||name,pluginConfigurations),internalName=_combinePluginConfigu2.name,pluginConfiguration=_combinePluginConfigu2.configuration;hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:plugin.scope?[0]:[],apiFilePaths:plugin.scope?[""]:[],configuration:pluginConfiguration,configurationFilePaths:pluginConfigurations.map(function(){return""}),configurationFileLoadTimestamps:pluginConfigurations.map(function(){return 0}),dependencies:hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[],internalName:internalName,name:name,packageConfiguration:hasPluginConfiguration?pluginConfiguration[internalName].package:{},path:"",scope:plugin.scope||{}}}/*
|
|
265
217
|
Load main plugin configuration at first.
|
|
266
218
|
|
|
267
219
|
NOTE: If application's main is this itself avoid loading it twice.
|
|
268
|
-
*/if(!(configuration.name!=="web-node")){_context1.n=
|
|
220
|
+
*/if(!(configuration.name!=="web-node")){_context1.n=2;break}_name2=configuration.name;_internalName=determineInternalName(_name2,new RegExp((_configuration$core$p=configuration.core.plugin.directories.external.nameRegularExpressionPattern)!==null&&_configuration$core$p!==void 0?_configuration$core$p:configuration.core.plugin.nameRegularExpressionPattern));_context1.n=1;return load(_name2,_internalName,plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[_name2]=_context1.v;case 2:_i6=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i6<_Object$values.length)){_context1.n=17;break}directory=_Object$values[_i6];_context1.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context1.v){_context1.n=16;break}compiledRegularExpression=new RegExp((_directory$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t26=_createForOfIteratorHelper;_context1.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator11=_t26(_context1.v);_context1.p=6;_iterator11.s();case 7:if((_step11=_iterator11.n()).done){_context1.n=13;break}pluginName=_step11.value;if(compiledRegularExpression.test(pluginName)){_context1.n=8;break}return _context1.a(3,12);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);if(!Object.prototype.hasOwnProperty.call(plugins,pluginName)){_context1.n=10;break}plugins[pluginName].path=currentPluginPath;_context1.n=9;return gatherConfigurationFilePaths(currentPluginPath,configuration.core.plugin.configuration.fileNames);case 9:plugins[pluginName].configurationFilePaths=_context1.v;return _context1.a(3,12);case 10:_internalName2=determineInternalName(pluginName,compiledRegularExpression);_context1.n=11;return load(pluginName,_internalName2,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 11:plugins[pluginName]=_context1.v;case 12:_context1.n=7;break;case 13:_context1.n=15;break;case 14:_context1.p=14;_t27=_context1.v;_iterator11.e(_t27);case 15:_context1.p=15;_iterator11.f();return _context1.f(15);case 16:_i6++;_context1.n=3;break;case 17:temporaryPlugins={};for(_i7=0,_Object$values2=Object.values(plugins);_i7<_Object$values2.length;_i7++){_plugin=_Object$values2[_i7];temporaryPlugins[_plugin.internalName]=_plugin.dependencies;if(Object.prototype.hasOwnProperty.call(configuration.core.interDependencies,_plugin.internalName)){_iterator12=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){_name3=_step12.value;if(!temporaryPlugins[_plugin.internalName].includes(_name3))temporaryPlugins[_plugin.internalName].push(_name3)}}catch(err){_iterator12.e(err)}finally{_iterator12.f()}}}sortedPlugins=[];_iterator13=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context1.p=18;_iterator13.s();case 19:if((_step13=_iterator13.n()).done){_context1.n=23;break}_pluginName=_step13.value;_i8=0,_Object$entries5=Object.entries(plugins);case 20:if(!(_i8<_Object$entries5.length)){_context1.n=22;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name4=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name4].includes(_pluginName)){_context1.n=21;break}sortedPlugins.push(_plugin2);return _context1.a(3,22);case 21:_i8++;_context1.n=20;break;case 22:_context1.n=19;break;case 23:_context1.n=25;break;case 24:_context1.p=24;_t28=_context1.v;_iterator13.e(_t28);case 25:_context1.p=25;_iterator13.f();return _context1.f(25);case 26:_context1.n=27;return loadConfigurations(sortedPlugins,configuration);case 27:_t29=_context1.v;_t30=sortedPlugins;return _context1.a(2,{configuration:_t29,plugins:_t30})}},_callee1,null,[[18,24,25,26],[6,14,15,16]])}));function loadAll(_x28){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
269
221
|
* Transform a list of absolute paths respecting the application context.
|
|
270
222
|
* @param configuration - Configuration object.
|
|
271
223
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -273,7 +225,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
273
225
|
* @param configuration.core.context.path - Current web-nodes path.
|
|
274
226
|
* @param locations - Locations to process.
|
|
275
227
|
* @returns Given and processed locations.
|
|
276
|
-
*/var determineLocations=function determineLocations(
|
|
228
|
+
*/var determineLocations=function determineLocations(_ref6,locations){var contextPath=_ref6.core.context.path;if(locations===void 0){locations=[]}locations=[].concat(locations);return locations.length?locations.map(function(location){return (0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(contextPath,location)}):[contextPath]};/**
|
|
277
229
|
* Checks whether given file path is in provided locations.
|
|
278
230
|
* @param configuration - Configuration object.
|
|
279
231
|
* @param plugins - List of active plugins.
|
|
@@ -387,7 +339,6 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
387
339
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
388
340
|
/* harmony export */ Ad: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Ad),
|
|
389
341
|
/* harmony export */ GH: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.GH),
|
|
390
|
-
/* harmony export */ GU: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.GU),
|
|
391
342
|
/* harmony export */ Gy: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Gy),
|
|
392
343
|
/* harmony export */ HF: () => (/* reexport safe */ _configurator_js__WEBPACK_IMPORTED_MODULE_0__.H),
|
|
393
344
|
/* harmony export */ Hh: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Hh),
|
|
@@ -409,7 +360,8 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
409
360
|
/* harmony export */ nQ: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.nQ),
|
|
410
361
|
/* harmony export */ oB: () => (/* binding */ isMainModulePositiveCalls),
|
|
411
362
|
/* harmony export */ u2: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.u2),
|
|
412
|
-
/* harmony export */ vF: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.vF)
|
|
363
|
+
/* harmony export */ vF: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.vF),
|
|
364
|
+
/* harmony export */ zW: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.zW)
|
|
413
365
|
/* harmony export */ });
|
|
414
366
|
/* harmony import */ var _configurator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
415
367
|
/* harmony import */ var _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
@@ -435,7 +387,7 @@ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_con
|
|
|
435
387
|
endregion
|
|
436
388
|
*/function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}// region imports
|
|
437
389
|
;// endregion
|
|
438
|
-
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node"});clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger.configureAllInstances();var handleError=/*#__PURE__*/function(){var _handleError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(state){var _t;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:_context.p=0;_context.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)(_objectSpread(_objectSpread({},state),{},{hook:"error"}));case 1:_context.n=4;break;case 2:_context.p=2;_t=_context.v;if(!state.configuration.core.debug){_context.n=3;break}throw _t;case 3:log.error(_t);case 4:return _context.a(2)}},_callee,null,[[0,2]])}));function handleError(_x){return _handleError.apply(this,arguments)}return handleError}();var main=/*#__PURE__*/function(){var _main=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(pluginLoaderMapping){var _yield$loadAll,configuration,plugins,pluginsWithChangedConfiguration,_iterator,_step,type,services,servicePromises,exitTriggered,_i,_Object$keys,name,_iterator2,_step2,plugin,result,_message,_i2,_Object$entries,_Object$entries$_i,_name,promise,finished,closeHandler,_iterator3,_step3,closeEventName,cancelTriggered,_t2,_t3,_t4,_t5,_t6,_t7;return _regenerator().w(function(_context3){while(1)switch(_context3.p=_context3.n){case 0:if(pluginLoaderMapping===void 0){pluginLoaderMapping={}};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .
|
|
390
|
+
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node"});clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger.configureAllInstances();var handleError=/*#__PURE__*/function(){var _handleError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(state){var _t;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:_context.p=0;_context.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)(_objectSpread(_objectSpread({},state),{},{hook:"error"}));case 1:_context.n=4;break;case 2:_context.p=2;_t=_context.v;if(!state.configuration.core.debug){_context.n=3;break}throw _t;case 3:log.error(_t);case 4:return _context.a(2)}},_callee,null,[[0,2]])}));function handleError(_x){return _handleError.apply(this,arguments)}return handleError}();var main=/*#__PURE__*/function(){var _main=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(pluginLoaderMapping){var _yield$loadAll,configuration,plugins,pluginsWithChangedConfiguration,_iterator,_step,type,services,servicePromises,exitTriggered,_i,_Object$keys,name,_iterator2,_step2,plugin,result,_message,_i2,_Object$entries,_Object$entries$_i,_name,promise,finished,closeHandler,_iterator3,_step3,closeEventName,cancelTriggered,_t2,_t3,_t4,_t5,_t6,_t7;return _regenerator().w(function(_context3){while(1)switch(_context3.p=_context3.n){case 0:if(pluginLoaderMapping===void 0){pluginLoaderMapping={}};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .PLUGIN_PRELOADER */ .zW,pluginLoaderMapping);// region load plugins
|
|
439
391
|
_context3.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .loadAll */ .gh)((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(_configurator_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A));case 1:_yield$loadAll=_context3.v;configuration=_yield$loadAll.configuration;plugins=_yield$loadAll.plugins;_context3.n=2;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"initialize",plugins:plugins});case 2:if(plugins.length)log.info("Loaded plugins: \""+plugins.map(function(plugin){return plugin.internalName}).join("\", \"")+"\".");pluginsWithChangedConfiguration=plugins.filter(function(plugin){return Boolean(plugin.configurationFilePaths.length)});_iterator=_createForOfIteratorHelper(["pre","post"]);_context3.p=3;_iterator.s();case 4:if((_step=_iterator.n()).done){_context3.n=6;break}type=_step.value;_context3.n=5;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"".concat(type,"ConfigurationLoaded"),plugins:plugins,pluginsWithChangedConfiguration:pluginsWithChangedConfiguration});case 5:_context3.n=4;break;case 6:_context3.n=8;break;case 7:_context3.p=7;_t2=_context3.v;_iterator.e(_t2);case 8:_context3.p=8;_iterator.f();return _context3.f(8);case 9:// endregion
|
|
440
392
|
services={};servicePromises={};exitTriggered=false;_context3.p=10;_context3.n=11;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"preLoadService",plugins:plugins,services:services});case 11:for(_i=0,_Object$keys=Object.keys(services);_i<_Object$keys.length;_i++){name=_Object$keys[_i];log.info("Service \"".concat(name,"\" initialized."))}_iterator2=_createForOfIteratorHelper(plugins);_context3.p=12;_iterator2.s();case 13:if((_step2=_iterator2.n()).done){_context3.n=20;break}plugin=_step2.value;if(!plugin.api){_context3.n=19;break}_context3.n=14;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"preLoad".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.capitalize)(plugin.internalName),"Service"),plugins:plugins,services:services});case 14:result=null;_context3.p=15;_context3.n=16;return plugin.api({configuration:configuration,hook:"loadService",pluginAPI:_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Ay,plugins:plugins,servicePromises:servicePromises,services:services});case 16:result=_context3.v;_context3.n=18;break;case 17:_context3.p=17;_t3=_context3.v;if(_t3!==null&&_t3!==void 0&&(_message=_t3.message)!==null&&_message!==void 0&&_message.startsWith("NotImplemented:")){_context3.n=18;break}throw new Error("Plugin \"".concat(plugin.internalName,"\" ")+(plugin.internalName===plugin.name?"":"(".concat(plugin.name,") "))+"throws: ".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t3)," 'during asynchrone ")+"hook \"loadService\".",{cause:_t3});case 18:if(result)for(_i2=0,_Object$entries=Object.entries(result);_i2<_Object$entries.length;_i2++){_Object$entries$_i=_slicedToArray(_Object$entries[_i2],2),_name=_Object$entries$_i[0],promise=_Object$entries$_i[1];if((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isObject)(promise)&&"then"in promise){log.info("Service \"".concat(_name,"\" started."));servicePromises[_name]=promise}else log.info("Service \"".concat(_name,"\" loaded."))}_context3.n=19;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"postLoad".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.capitalize)(plugin.internalName),"Service"),plugins:plugins,servicePromises:servicePromises,services:services});case 19:_context3.n=13;break;case 20:_context3.n=22;break;case 21:_context3.p=21;_t4=_context3.v;_iterator2.e(_t4);case 22:_context3.p=22;_iterator2.f();return _context3.f(22);case 23:_context3.n=24;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"postLoadService",plugins:plugins,servicePromises:servicePromises,services:services});case 24:// endregion
|
|
441
393
|
// region register close handler
|
|
@@ -466,7 +418,7 @@ __webpack_async_result__();
|
|
|
466
418
|
/* 7 */
|
|
467
419
|
/***/ ((module) => {
|
|
468
420
|
|
|
469
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
421
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.616","description":"High level javaScript backend plugin system and configuration merger.","keywords":["api","backend","management","plugin","web"],"homepage":"https://torben.website/web-node","bugs":{"email":"info@torben.website","url":"https://github.com/thaibault/web-node/issues"},"license":"CC-BY-3.0","author":{"email":"info@torben.website","name":"Torben Sickert","url":"https://torben.website"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"type":"module","bin":"main.js","exports":{".":"./index.js","./main":"./main.js","./main.js":"./main.js","./package.json":"./package.json","./unixCrypt":"./unixCrypt.js","./unixCrypt.js":"./unixCrypt.js","./type":"./type.d.ts"},"files":["configurator.d.ts","index.d.ts","index.js","main.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"sideEffects":true,"scripts":{"build":"yarn build:types; yarn build:plain","build:plain":"weboptimizer build","build:types":"weboptimizer build:types","check":"yarn check:types; yarn lint","check:types":"weboptimizer check:types","clear":"weboptimizer clear","document":"weboptimizer document","lint":"weboptimizer lint","prepare":"yarn build","prepare:test":"yarn clear && cd dummyPlugin && shx touch yarn.lock && yarn build && cd ..","serve":"yarn build:plain && yarn start","start":"./main.js \'{plugin: {hotReloading: true}}\'","test":"yarn prepare:test && weboptimizer test","test:coverage":"yarn prepare:test && weboptimizer test:coverage","test:coverage:report":"yarn prepare:test && weboptimizer test:coverage:report","update:documentation":"web-documentation","watch":"weboptimizer build --watch"},"devDependencies":{"@babel/cli":"^8.0.4","@babel/eslint-parser":"^8.0.1","@eslint/js":"^10.0.1","@stylistic/eslint-plugin":"^5.10.0","@types/node":"^26.4.1","@types/webpack-env":"^1.18.8","@typescript-eslint/eslint-plugin":"^8.69.0","@typescript-eslint/parser":"^8.69.0","clientnode":"^4.0.1512","eslint":"^10.10.0","eslint-config-google":"^0.14.0","eslint-plugin-jsdoc":"^64.3.6","jest":"^30.5.1","jsdoc":"^4.0.5","shx":"^0.4.0","typescript-eslint":"^8.69.0","web-documentation":"^1.0.52","weboptimizer":"^4.0.78"},"peerDependencies":{"clientnode":"*"},"resolutions":{"colors":"1.4.0","globals@npm:^11.1.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^14.0.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^9.18.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch"},"engines":{"node":">=26","npm":">=12","yarn":">=4"},"webDocumentation":{"trackingCode":"UA-40192634-9"},"webNode":{"core":{"context":{"path":"./","type":"relative"},"debug":false,"encoding":"utf8","interDependencies":{},"name":"web-node","plugin":{"configuration":{"fileNames":["package.json","private-package.json"],"propertyNames":["webNode","webnode","web-node"]},"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","directories":{"external":{"path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?main\\\\.js$","pattern":{"#":"This is how we can make our main exported artefact executable.","__evaluate__":"`#!/usr/bin/env node\\n// -*- coding: utf-8 -*-\\n${self.generic.assetPattern?.javaScript?.pattern ?? \'\'}\\n{1}`"}}},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', main: \'./main.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"terser":{"terserOptions":{"compress":{"#":"To provide a logging output we need to exclude this feature.","drop_console":{"__evaluate__":"false"},"drop_debugger":{"__evaluate__":"false"}}}}}},"targetTechnology":{"boilerplate":"node","payload":"node"}},"packageManager":"yarn@4.18.0"}');
|
|
470
422
|
|
|
471
423
|
/***/ }),
|
|
472
424
|
/* 8 */
|
|
@@ -658,7 +610,7 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
658
610
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
659
611
|
/******/ let __webpack_exports__ = __webpack_require__(6);
|
|
660
612
|
/******/ __webpack_exports__ = await __webpack_exports__;
|
|
661
|
-
/******/ const
|
|
613
|
+
/******/ const __webpack_exports__PLUGIN_PRELOADER = __webpack_exports__.zW;
|
|
662
614
|
/******/ const __webpack_exports__callStack = __webpack_exports__.lT;
|
|
663
615
|
/******/ const __webpack_exports__callStackSynchronous = __webpack_exports__.gl;
|
|
664
616
|
/******/ const __webpack_exports__combinePluginConfigurations = __webpack_exports__.c0;
|
|
@@ -684,5 +636,5 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
684
636
|
/******/ const __webpack_exports__log = __webpack_exports__.Rm;
|
|
685
637
|
/******/ const __webpack_exports__main = __webpack_exports__.iW;
|
|
686
638
|
/******/ const __webpack_exports__pluginAPI = __webpack_exports__.MM;
|
|
687
|
-
/******/ export {
|
|
639
|
+
/******/ export { __webpack_exports__PLUGIN_PRELOADER as PLUGIN_PRELOADER, __webpack_exports__callStack as callStack, __webpack_exports__callStackSynchronous as callStackSynchronous, __webpack_exports__combinePluginConfigurations as combinePluginConfigurations, __webpack_exports__configuration as configuration, __webpack_exports__createNativeAPIFactory as createNativeAPIFactory, __webpack_exports__default as default, __webpack_exports__determineInternalName as determineInternalName, __webpack_exports__determineLocations as determineLocations, __webpack_exports__evaluateConfiguration as evaluateConfiguration, __webpack_exports__gatherConfigurationFilePaths as gatherConfigurationFilePaths, __webpack_exports__hotReloadAPIFile as hotReloadAPIFile, __webpack_exports__hotReloadConfigurationFile as hotReloadConfigurationFile, __webpack_exports__hotReloadFiles as hotReloadFiles, __webpack_exports__isInLocations as isInLocations, __webpack_exports__isMainModule as isMainModule, __webpack_exports__isMainModulePositiveCalls as isMainModulePositiveCalls, __webpack_exports__load as load, __webpack_exports__loadAPI as loadAPI, __webpack_exports__loadAll as loadAll, __webpack_exports__loadConfiguration as loadConfiguration, __webpack_exports__loadConfigurations as loadConfigurations, __webpack_exports__loadFile as loadFile, __webpack_exports__log as log, __webpack_exports__main as main, __webpack_exports__pluginAPI as pluginAPI };
|
|
688
640
|
/******/
|
package/main.js
CHANGED
|
@@ -18,10 +18,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
|
18
18
|
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
19
19
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20
20
|
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
21
|
-
/* harmony export */ GU: () => (/* binding */ PLUGIN_LOADER),
|
|
22
21
|
/* harmony export */ gh: () => (/* binding */ loadAll),
|
|
23
22
|
/* harmony export */ gl: () => (/* binding */ callStackSynchronous),
|
|
24
|
-
/* harmony export */ lT: () => (/* binding */ _callStack)
|
|
23
|
+
/* harmony export */ lT: () => (/* binding */ _callStack),
|
|
24
|
+
/* harmony export */ zW: () => (/* binding */ PLUGIN_PRELOADER)
|
|
25
25
|
/* harmony export */ });
|
|
26
26
|
/* unused harmony exports log, determineInternalName, evaluateConfiguration, hotReloadAPIFile, hotReloadConfigurationFile, hotReloadFiles, combinePluginConfigurations, load, createNativeAPIFactory, loadAPI, loadConfiguration, loadConfigurations, gatherConfigurationFilePaths, loadFile, determineLocations, isInLocations, pluginAPI */
|
|
27
27
|
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
@@ -50,44 +50,7 @@ _configurator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_async_dependencies_res
|
|
|
50
50
|
endregion
|
|
51
51
|
*/// region imports
|
|
52
52
|
function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)};function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}};// endregion
|
|
53
|
-
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node.plugin-api"});var
|
|
54
|
-
/*
|
|
55
|
-
ES module specific logic to deduplicate the main module's scope for plugins
|
|
56
|
-
to avoid loading it twice and therefore having two different scopes of the
|
|
57
|
-
same module in memory:
|
|
58
|
-
|
|
59
|
-
// main-module-hook.ts (must compile/run as a standalone module)
|
|
60
|
-
import type {ResolveHook, InitializeHook} from 'node:module'
|
|
61
|
-
|
|
62
|
-
let mainModuleURL: string | undefined
|
|
63
|
-
|
|
64
|
-
export const initialize: InitializeHook = (
|
|
65
|
-
data: {mainModuleURL?: string}
|
|
66
|
-
): void => {
|
|
67
|
-
mainModuleURL = data.mainModuleURL
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export const resolve: ResolveHook = (specifier, context, nextResolve) => {
|
|
71
|
-
if (specifier === 'main-module' && mainModuleURL)
|
|
72
|
-
// Redirect to the entry module's URL; the ESM cache is keyed by
|
|
73
|
-
// resolved URL, so every importer shares that one instance.
|
|
74
|
-
return nextResolve(mainModuleURL, context)
|
|
75
|
-
|
|
76
|
-
return nextResolve(specifier, context)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Registering it
|
|
80
|
-
|
|
81
|
-
// setup.ts (imported first, before anything does import 'main-module')
|
|
82
|
-
import {register} from 'node:module'
|
|
83
|
-
import {pathToFileURL} from 'node:url'
|
|
84
|
-
|
|
85
|
-
register('./main-module-hook.js', {
|
|
86
|
-
parentURL: import.meta.url,
|
|
87
|
-
data: {mainModuleURL: pathToFileURL(process.argv[1]).href}
|
|
88
|
-
})
|
|
89
|
-
*/// endregion
|
|
90
|
-
/**
|
|
53
|
+
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node.plugin-api"});var PLUGIN_PRELOADER={};await (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.importFilesystemAPI)();/**
|
|
91
54
|
* Calls all plugin methods for given trigger description asynchronous and
|
|
92
55
|
* waits for their resolved promises.
|
|
93
56
|
* @param givenState - Contains runtime information about current hook.
|
|
@@ -178,14 +141,14 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
178
141
|
* @param configuration - Plugin specific configurations.
|
|
179
142
|
* @param configurationFilePaths - Plugin specific configuration file paths.
|
|
180
143
|
* @returns Plugin meta information object.
|
|
181
|
-
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
144
|
+
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var _ref5;var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
182
145
|
NOTE: Check if a webNode plugin configuration is available
|
|
183
146
|
indicating a backend responsibility for api file.
|
|
184
147
|
|
|
185
148
|
NOTE: One key is always there representing the whole package
|
|
186
149
|
configuration.
|
|
187
150
|
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t0){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t0=_context8.v;case 13:if(!_t0){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
188
|
-
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
151
|
+
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!((_ref5=plugins[name])!==null&&_ref5!==void 0?_ref5:nativeAPI)){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
189
152
|
* Loads plugin specific configuration object.
|
|
190
153
|
* @param name - Property name where to inject resolved configuration into
|
|
191
154
|
* global one.
|
|
@@ -223,7 +186,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
223
186
|
* @param pluginPath - Path to the plugin directory.
|
|
224
187
|
* @param fileNames - List of configuration file names to check.
|
|
225
188
|
* @returns A list of existing configuration file paths.
|
|
226
|
-
*/var gatherConfigurationFilePaths=/*#__PURE__*/function(){var _gatherConfigurationFilePaths=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(pluginPath,fileNames){var result,_iterator10,_step10,fileName,filePath,_t24;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:result=[];_iterator10=_createForOfIteratorHelper(fileNames);_context9.p=1;_iterator10.s();case 2:if((_step10=_iterator10.n()).done){_context9.n=5;break}fileName=_step10.value;filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName);_context9.n=3;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 3:if(!_context9.v){_context9.n=4;break}result.push(filePath);case 4:_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t24=_context9.v;_iterator10.e(_t24);case 7:_context9.p=7;_iterator10.f();return _context9.f(7);case 8:return _context9.a(2,result)}},_callee9,null,[[1,6,7,8]])}));function gatherConfigurationFilePaths(_x22,_x23){return _gatherConfigurationFilePaths.apply(this,arguments)}return gatherConfigurationFilePaths}();/**
|
|
189
|
+
*/var gatherConfigurationFilePaths=/*#__PURE__*/function(){var _gatherConfigurationFilePaths=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(pluginPath,fileNames){var result,_iterator10,_step10,fileName,filePath,_t24;return _regenerator().w(function(_context9){while(1)switch(_context9.p=_context9.n){case 0:result=[];_iterator10=_createForOfIteratorHelper(fileNames);_context9.p=1;_iterator10.s();case 2:if((_step10=_iterator10.n()).done){_context9.n=5;break}fileName=_step10.value;filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName);_context9.n=3;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 3:if(!_context9.v){_context9.n=4;break}result.push(filePath);case 4:_context9.n=2;break;case 5:_context9.n=7;break;case 6:_context9.p=6;_t24=_context9.v;_iterator10.e(_t24);case 7:_context9.p=7;_iterator10.f();return _context9.f(7);case 8:return _context9.a(2,result.sort())}},_callee9,null,[[1,6,7,8]])}));function gatherConfigurationFilePaths(_x22,_x23){return _gatherConfigurationFilePaths.apply(this,arguments)}return gatherConfigurationFilePaths}();/**
|
|
227
190
|
* Load given api file path and returns exported scope.
|
|
228
191
|
* @param filePath - Path to file to load.
|
|
229
192
|
* @param name - Plugin name to use for proper error messages.
|
|
@@ -231,28 +194,17 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
231
194
|
* If a "null" is given an error will be thrown.
|
|
232
195
|
* @param doLogging - Enables logging.
|
|
233
196
|
* @returns Exported api file scope.
|
|
234
|
-
*/var loadFile=/*#__PURE__*/function(){var _loadFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(filePath,name,fallbackScope,doLogging){var options,scope,_t25;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:if(fallbackScope===void 0){fallbackScope=null}if(doLogging===void 0){doLogging=true}
|
|
235
|
-
/*
|
|
236
|
-
let reference: string | undefined
|
|
237
|
-
try {
|
|
238
|
-
reference = import.meta.resolve(filePath)
|
|
239
|
-
} catch {
|
|
240
|
-
// Ignore error.
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (reference)
|
|
244
|
-
// Clear the module cache.
|
|
245
|
-
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context0.p=1;_context0.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context0.v;_context0.n=5;break;case 3:_context0.p=3;_t25=_context0.v;if(!fallbackScope){_context0.n=4;break}scope=fallbackScope;if(doLogging)log.warn("Couldn't load new api plugin file \"".concat(filePath,"\" for"),"plugin \"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25),". Using"),"fallback one.");_context0.n=5;break;case 4:throw new Error("Couldn't load plugin file \"".concat(filePath,"\" for plugin ")+"\"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25)),{cause:_t25});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context0.n=6;break}return _context0.a(2,scope.default);case 6:return _context0.a(2,scope)}},_callee0,null,[[1,3]])}));function loadFile(_x24,_x25,_x26,_x27){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
197
|
+
*/var loadFile=/*#__PURE__*/function(){var _loadFile=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(filePath,name,fallbackScope,doLogging){var options,scope,_t25;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:if(fallbackScope===void 0){fallbackScope=null}if(doLogging===void 0){doLogging=true}options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context0.p=1;_context0.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context0.v;_context0.n=5;break;case 3:_context0.p=3;_t25=_context0.v;if(!fallbackScope){_context0.n=4;break}scope=fallbackScope;if(doLogging)log.warn("Couldn't load new api plugin file \"".concat(filePath,"\" for"),"plugin \"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25),". Using"),"fallback one.");_context0.n=5;break;case 4:throw new Error("Couldn't load plugin file \"".concat(filePath,"\" for plugin ")+"\"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t25)),{cause:_t25});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context0.n=6;break}return _context0.a(2,scope.default);case 6:return _context0.a(2,scope)}},_callee0,null,[[1,3]])}));function loadFile(_x24,_x25,_x26,_x27){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
246
198
|
* Extends given configuration object with all plugin specific ones and returns
|
|
247
199
|
* a topological sorted list of plugins with plugins specific meta information
|
|
248
200
|
* stored.
|
|
249
201
|
* @param configuration - Configuration object to extend and use.
|
|
250
202
|
* @returns A topological sorted list of plugins objects.
|
|
251
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(configuration){var
|
|
203
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(configuration){var plugins,_i5,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfigurations,_combinePluginConfigu2,internalName,pluginConfiguration,hasPluginConfiguration,_configuration$core$p,_name2,_internalName,_i6,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator11,_step11,pluginName,currentPluginPath,_internalName2,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator12,_step12,_name3,sortedPlugins,_iterator13,_step13,_pluginName,_i8,_Object$entries5,_Object$entries5$_i,_name4,_plugin2,_t26,_t27,_t28,_t29,_t30;return _regenerator().w(function(_context1){while(1)switch(_context1.p=_context1.n){case 0:plugins={};for(_i5=0,_Object$entries4=Object.entries(PLUGIN_PRELOADER);_i5<_Object$entries4.length;_i5++){_Object$entries4$_i=_slicedToArray(_Object$entries4[_i5],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];pluginConfigurations=[].concat(plugin.configurations||[]);_combinePluginConfigu2=combinePluginConfigurations(plugin.name||name,pluginConfigurations),internalName=_combinePluginConfigu2.name,pluginConfiguration=_combinePluginConfigu2.configuration;hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:plugin.scope?[0]:[],apiFilePaths:plugin.scope?[""]:[],configuration:pluginConfiguration,configurationFilePaths:pluginConfigurations.map(function(){return""}),configurationFileLoadTimestamps:pluginConfigurations.map(function(){return 0}),dependencies:hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[],internalName:internalName,name:name,packageConfiguration:hasPluginConfiguration?pluginConfiguration[internalName].package:{},path:"",scope:plugin.scope||{}}}/*
|
|
252
204
|
Load main plugin configuration at first.
|
|
253
205
|
|
|
254
206
|
NOTE: If application's main is this itself avoid loading it twice.
|
|
255
|
-
*/if(!(configuration.name!=="web-node")){_context1.n=
|
|
207
|
+
*/if(!(configuration.name!=="web-node")){_context1.n=2;break}_name2=configuration.name;_internalName=determineInternalName(_name2,new RegExp((_configuration$core$p=configuration.core.plugin.directories.external.nameRegularExpressionPattern)!==null&&_configuration$core$p!==void 0?_configuration$core$p:configuration.core.plugin.nameRegularExpressionPattern));_context1.n=1;return load(_name2,_internalName,plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[_name2]=_context1.v;case 2:_i6=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i6<_Object$values.length)){_context1.n=17;break}directory=_Object$values[_i6];_context1.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context1.v){_context1.n=16;break}compiledRegularExpression=new RegExp((_directory$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t26=_createForOfIteratorHelper;_context1.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator11=_t26(_context1.v);_context1.p=6;_iterator11.s();case 7:if((_step11=_iterator11.n()).done){_context1.n=13;break}pluginName=_step11.value;if(compiledRegularExpression.test(pluginName)){_context1.n=8;break}return _context1.a(3,12);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);if(!Object.prototype.hasOwnProperty.call(plugins,pluginName)){_context1.n=10;break}plugins[pluginName].path=currentPluginPath;_context1.n=9;return gatherConfigurationFilePaths(currentPluginPath,configuration.core.plugin.configuration.fileNames);case 9:plugins[pluginName].configurationFilePaths=_context1.v;return _context1.a(3,12);case 10:_internalName2=determineInternalName(pluginName,compiledRegularExpression);_context1.n=11;return load(pluginName,_internalName2,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 11:plugins[pluginName]=_context1.v;case 12:_context1.n=7;break;case 13:_context1.n=15;break;case 14:_context1.p=14;_t27=_context1.v;_iterator11.e(_t27);case 15:_context1.p=15;_iterator11.f();return _context1.f(15);case 16:_i6++;_context1.n=3;break;case 17:temporaryPlugins={};for(_i7=0,_Object$values2=Object.values(plugins);_i7<_Object$values2.length;_i7++){_plugin=_Object$values2[_i7];temporaryPlugins[_plugin.internalName]=_plugin.dependencies;if(Object.prototype.hasOwnProperty.call(configuration.core.interDependencies,_plugin.internalName)){_iterator12=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){_name3=_step12.value;if(!temporaryPlugins[_plugin.internalName].includes(_name3))temporaryPlugins[_plugin.internalName].push(_name3)}}catch(err){_iterator12.e(err)}finally{_iterator12.f()}}}sortedPlugins=[];_iterator13=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context1.p=18;_iterator13.s();case 19:if((_step13=_iterator13.n()).done){_context1.n=23;break}_pluginName=_step13.value;_i8=0,_Object$entries5=Object.entries(plugins);case 20:if(!(_i8<_Object$entries5.length)){_context1.n=22;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name4=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name4].includes(_pluginName)){_context1.n=21;break}sortedPlugins.push(_plugin2);return _context1.a(3,22);case 21:_i8++;_context1.n=20;break;case 22:_context1.n=19;break;case 23:_context1.n=25;break;case 24:_context1.p=24;_t28=_context1.v;_iterator13.e(_t28);case 25:_context1.p=25;_iterator13.f();return _context1.f(25);case 26:_context1.n=27;return loadConfigurations(sortedPlugins,configuration);case 27:_t29=_context1.v;_t30=sortedPlugins;return _context1.a(2,{configuration:_t29,plugins:_t30})}},_callee1,null,[[18,24,25,26],[6,14,15,16]])}));function loadAll(_x28){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
256
208
|
* Transform a list of absolute paths respecting the application context.
|
|
257
209
|
* @param configuration - Configuration object.
|
|
258
210
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -260,7 +212,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
260
212
|
* @param configuration.core.context.path - Current web-nodes path.
|
|
261
213
|
* @param locations - Locations to process.
|
|
262
214
|
* @returns Given and processed locations.
|
|
263
|
-
*/var determineLocations=function determineLocations(
|
|
215
|
+
*/var determineLocations=function determineLocations(_ref6,locations){var contextPath=_ref6.core.context.path;if(locations===void 0){locations=[]}locations=[].concat(locations);return locations.length?locations.map(function(location){return (0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(contextPath,location)}):[contextPath]};/**
|
|
264
216
|
* Checks whether given file path is in provided locations.
|
|
265
217
|
* @param configuration - Configuration object.
|
|
266
218
|
* @param plugins - List of active plugins.
|
|
@@ -399,7 +351,7 @@ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_con
|
|
|
399
351
|
endregion
|
|
400
352
|
*/function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}// region imports
|
|
401
353
|
;// endregion
|
|
402
|
-
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node"});clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger.configureAllInstances();var handleError=/*#__PURE__*/function(){var _handleError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(state){var _t;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:_context.p=0;_context.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)(_objectSpread(_objectSpread({},state),{},{hook:"error"}));case 1:_context.n=4;break;case 2:_context.p=2;_t=_context.v;if(!state.configuration.core.debug){_context.n=3;break}throw _t;case 3:log.error(_t);case 4:return _context.a(2)}},_callee,null,[[0,2]])}));function handleError(_x){return _handleError.apply(this,arguments)}return handleError}();var main=/*#__PURE__*/function(){var _main=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(pluginLoaderMapping){var _yield$loadAll,configuration,plugins,pluginsWithChangedConfiguration,_iterator,_step,type,services,servicePromises,exitTriggered,_i,_Object$keys,name,_iterator2,_step2,plugin,result,_message,_i2,_Object$entries,_Object$entries$_i,_name,promise,finished,closeHandler,_iterator3,_step3,closeEventName,cancelTriggered,_t2,_t3,_t4,_t5,_t6,_t7;return _regenerator().w(function(_context3){while(1)switch(_context3.p=_context3.n){case 0:if(pluginLoaderMapping===void 0){pluginLoaderMapping={}};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .
|
|
354
|
+
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node"});clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger.configureAllInstances();var handleError=/*#__PURE__*/function(){var _handleError=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(state){var _t;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:_context.p=0;_context.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)(_objectSpread(_objectSpread({},state),{},{hook:"error"}));case 1:_context.n=4;break;case 2:_context.p=2;_t=_context.v;if(!state.configuration.core.debug){_context.n=3;break}throw _t;case 3:log.error(_t);case 4:return _context.a(2)}},_callee,null,[[0,2]])}));function handleError(_x){return _handleError.apply(this,arguments)}return handleError}();var main=/*#__PURE__*/function(){var _main=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(pluginLoaderMapping){var _yield$loadAll,configuration,plugins,pluginsWithChangedConfiguration,_iterator,_step,type,services,servicePromises,exitTriggered,_i,_Object$keys,name,_iterator2,_step2,plugin,result,_message,_i2,_Object$entries,_Object$entries$_i,_name,promise,finished,closeHandler,_iterator3,_step3,closeEventName,cancelTriggered,_t2,_t3,_t4,_t5,_t6,_t7;return _regenerator().w(function(_context3){while(1)switch(_context3.p=_context3.n){case 0:if(pluginLoaderMapping===void 0){pluginLoaderMapping={}};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .PLUGIN_PRELOADER */ .zW,pluginLoaderMapping);// region load plugins
|
|
403
355
|
_context3.n=1;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .loadAll */ .gh)((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(_configurator_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A));case 1:_yield$loadAll=_context3.v;configuration=_yield$loadAll.configuration;plugins=_yield$loadAll.plugins;_context3.n=2;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"initialize",plugins:plugins});case 2:if(plugins.length)log.info("Loaded plugins: \""+plugins.map(function(plugin){return plugin.internalName}).join("\", \"")+"\".");pluginsWithChangedConfiguration=plugins.filter(function(plugin){return Boolean(plugin.configurationFilePaths.length)});_iterator=_createForOfIteratorHelper(["pre","post"]);_context3.p=3;_iterator.s();case 4:if((_step=_iterator.n()).done){_context3.n=6;break}type=_step.value;_context3.n=5;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"".concat(type,"ConfigurationLoaded"),plugins:plugins,pluginsWithChangedConfiguration:pluginsWithChangedConfiguration});case 5:_context3.n=4;break;case 6:_context3.n=8;break;case 7:_context3.p=7;_t2=_context3.v;_iterator.e(_t2);case 8:_context3.p=8;_iterator.f();return _context3.f(8);case 9:// endregion
|
|
404
356
|
services={};servicePromises={};exitTriggered=false;_context3.p=10;_context3.n=11;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"preLoadService",plugins:plugins,services:services});case 11:for(_i=0,_Object$keys=Object.keys(services);_i<_Object$keys.length;_i++){name=_Object$keys[_i];log.info("Service \"".concat(name,"\" initialized."))}_iterator2=_createForOfIteratorHelper(plugins);_context3.p=12;_iterator2.s();case 13:if((_step2=_iterator2.n()).done){_context3.n=20;break}plugin=_step2.value;if(!plugin.api){_context3.n=19;break}_context3.n=14;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"preLoad".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.capitalize)(plugin.internalName),"Service"),plugins:plugins,services:services});case 14:result=null;_context3.p=15;_context3.n=16;return plugin.api({configuration:configuration,hook:"loadService",pluginAPI:_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Ay,plugins:plugins,servicePromises:servicePromises,services:services});case 16:result=_context3.v;_context3.n=18;break;case 17:_context3.p=17;_t3=_context3.v;if(_t3!==null&&_t3!==void 0&&(_message=_t3.message)!==null&&_message!==void 0&&_message.startsWith("NotImplemented:")){_context3.n=18;break}throw new Error("Plugin \"".concat(plugin.internalName,"\" ")+(plugin.internalName===plugin.name?"":"(".concat(plugin.name,") "))+"throws: ".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t3)," 'during asynchrone ")+"hook \"loadService\".",{cause:_t3});case 18:if(result)for(_i2=0,_Object$entries=Object.entries(result);_i2<_Object$entries.length;_i2++){_Object$entries$_i=_slicedToArray(_Object$entries[_i2],2),_name=_Object$entries$_i[0],promise=_Object$entries$_i[1];if((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isObject)(promise)&&"then"in promise){log.info("Service \"".concat(_name,"\" started."));servicePromises[_name]=promise}else log.info("Service \"".concat(_name,"\" loaded."))}_context3.n=19;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"postLoad".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.capitalize)(plugin.internalName),"Service"),plugins:plugins,servicePromises:servicePromises,services:services});case 19:_context3.n=13;break;case 20:_context3.n=22;break;case 21:_context3.p=21;_t4=_context3.v;_iterator2.e(_t4);case 22:_context3.p=22;_iterator2.f();return _context3.f(22);case 23:_context3.n=24;return (0,_pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__/* .callStack */ .lT)({configuration:configuration,data:undefined,hook:"postLoadService",plugins:plugins,servicePromises:servicePromises,services:services});case 24:// endregion
|
|
405
357
|
// region register close handler
|
|
@@ -430,7 +382,7 @@ __webpack_async_result__();
|
|
|
430
382
|
/* 7 */
|
|
431
383
|
/***/ ((module) => {
|
|
432
384
|
|
|
433
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
385
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.616","description":"High level javaScript backend plugin system and configuration merger.","keywords":["api","backend","management","plugin","web"],"homepage":"https://torben.website/web-node","bugs":{"email":"info@torben.website","url":"https://github.com/thaibault/web-node/issues"},"license":"CC-BY-3.0","author":{"email":"info@torben.website","name":"Torben Sickert","url":"https://torben.website"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"type":"module","bin":"main.js","exports":{".":"./index.js","./main":"./main.js","./main.js":"./main.js","./package.json":"./package.json","./unixCrypt":"./unixCrypt.js","./unixCrypt.js":"./unixCrypt.js","./type":"./type.d.ts"},"files":["configurator.d.ts","index.d.ts","index.js","main.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"sideEffects":true,"scripts":{"build":"yarn build:types; yarn build:plain","build:plain":"weboptimizer build","build:types":"weboptimizer build:types","check":"yarn check:types; yarn lint","check:types":"weboptimizer check:types","clear":"weboptimizer clear","document":"weboptimizer document","lint":"weboptimizer lint","prepare":"yarn build","prepare:test":"yarn clear && cd dummyPlugin && shx touch yarn.lock && yarn build && cd ..","serve":"yarn build:plain && yarn start","start":"./main.js \'{plugin: {hotReloading: true}}\'","test":"yarn prepare:test && weboptimizer test","test:coverage":"yarn prepare:test && weboptimizer test:coverage","test:coverage:report":"yarn prepare:test && weboptimizer test:coverage:report","update:documentation":"web-documentation","watch":"weboptimizer build --watch"},"devDependencies":{"@babel/cli":"^8.0.4","@babel/eslint-parser":"^8.0.1","@eslint/js":"^10.0.1","@stylistic/eslint-plugin":"^5.10.0","@types/node":"^26.4.1","@types/webpack-env":"^1.18.8","@typescript-eslint/eslint-plugin":"^8.69.0","@typescript-eslint/parser":"^8.69.0","clientnode":"^4.0.1512","eslint":"^10.10.0","eslint-config-google":"^0.14.0","eslint-plugin-jsdoc":"^64.3.6","jest":"^30.5.1","jsdoc":"^4.0.5","shx":"^0.4.0","typescript-eslint":"^8.69.0","web-documentation":"^1.0.52","weboptimizer":"^4.0.78"},"peerDependencies":{"clientnode":"*"},"resolutions":{"colors":"1.4.0","globals@npm:^11.1.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^14.0.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^9.18.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch"},"engines":{"node":">=26","npm":">=12","yarn":">=4"},"webDocumentation":{"trackingCode":"UA-40192634-9"},"webNode":{"core":{"context":{"path":"./","type":"relative"},"debug":false,"encoding":"utf8","interDependencies":{},"name":"web-node","plugin":{"configuration":{"fileNames":["package.json","private-package.json"],"propertyNames":["webNode","webnode","web-node"]},"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","directories":{"external":{"path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?main\\\\.js$","pattern":{"#":"This is how we can make our main exported artefact executable.","__evaluate__":"`#!/usr/bin/env node\\n// -*- coding: utf-8 -*-\\n${self.generic.assetPattern?.javaScript?.pattern ?? \'\'}\\n{1}`"}}},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', main: \'./main.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"terser":{"terserOptions":{"compress":{"#":"To provide a logging output we need to exclude this feature.","drop_console":{"__evaluate__":"false"},"drop_debugger":{"__evaluate__":"false"}}}}}},"targetTechnology":{"boilerplate":"node","payload":"node"}},"packageManager":"yarn@4.18.0"}');
|
|
434
386
|
|
|
435
387
|
/***/ }),
|
|
436
388
|
/* 8 */
|
package/package.json
CHANGED
package/pluginAPI.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Encoding, FirstParameter, Mapping, RecursiveEvaluateable } from 'clientnode';
|
|
2
|
-
import type { APIFunction, BaseState, Configuration, EvaluateablePartialConfiguration, HookPromiseResult, MetaPluginConfiguration, PackageConfiguration, Plugin, PluginChange,
|
|
2
|
+
import type { APIFunction, BaseState, Configuration, EvaluateablePartialConfiguration, HookPromiseResult, MetaPluginConfiguration, PackageConfiguration, Plugin, PluginChange, PluginPreloader, ServicePromisesState } from './type';
|
|
3
3
|
import { Logger } from 'clientnode';
|
|
4
4
|
export declare const log: Logger;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const PLUGIN_PRELOADER: PluginPreloader;
|
|
6
6
|
/**
|
|
7
7
|
* Calls all plugin methods for given trigger description asynchronous and
|
|
8
8
|
* waits for their resolved promises.
|
package/type.d.ts
CHANGED
|
@@ -85,11 +85,12 @@ export type HookPromiseResult<Type> = Promise<Type | {
|
|
|
85
85
|
promise: Type;
|
|
86
86
|
}>;
|
|
87
87
|
export type PluginPromises<Type extends Promise<unknown> = Promise<unknown>> = Mapping<null | Type>;
|
|
88
|
-
export
|
|
88
|
+
export interface PluginPreload {
|
|
89
89
|
name?: string;
|
|
90
90
|
configurations?: (Array<EvaluateablePartialConfiguration> | EvaluateablePartialConfiguration);
|
|
91
91
|
scope?: object;
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
|
+
export type PluginPreloader = Mapping<PluginPreload>;
|
|
93
94
|
export type Services<PluginServiceType = Mapping<unknown>> = Mapping<unknown> & PluginServiceType;
|
|
94
95
|
export type ServicePromises<PluginPromiseType = Mapping<unknown>> = Mapping<Promise<unknown>> & PluginPromiseType;
|
|
95
96
|
export interface BaseState<Type = undefined, ConfigurationType extends Configuration = Configuration> {
|