web-node 1.0.434 → 1.0.435
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/configurator.d.ts +3 -0
- package/index.d.ts +5 -0
- package/index.js +1 -1
- package/package.json +2 -2
- package/pluginAPI.d.ts +195 -0
- package/type.d.ts +256 -0
- package/unixCrypt.d.ts +12 -0
package/index.d.ts
ADDED
package/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(module===eval('require.main'))module.paths.unshift('/application/node_modules');(()=>{"use strict";var __webpack_modules__=[(e,_,r)=>{r.d(_,{D:()=>m,Z:()=>D});var t=r(5),n=r.n(t),a=r(6),o=r.n(a),i=r(7),c=r.n(i),l=r(1);const u=JSON.parse('{"name":"web-node","version":"1.0.434","description":"High level javaScript backend plugin system and configuration merger.","keywords":["web","backend","api","plugin","management"],"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":{"name":"Torben Sickert","email":"info@torben.website","url":"https://torben.website"},"files":["configurator.d.ts","index.d.ts","index.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"bin":{"web-node":"index.js"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"scripts":{"build":"weboptimizer build","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","serve":"weboptimizer build && yarn serve","start":"./index.js \'{plugin: {hotReloading: true}}\'","prepare:test":"yarn clear && cd dummyPlugin && yarn build && cd ..","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":"yarn version --patch && yarn publish","update:documentation":"documentationWebsite --log-level info","watch":"weboptimizer build --watch"},"dependencies":{"@types/webpack":"https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"},"devDependencies":{"@babel/cli":"*","@babel/eslint-parser":"*","@types/jest":"*","@types/node":"*","@typescript-eslint/eslint-plugin":"*","@typescript-eslint/parser":"*","clientnode":"*","documentation-website":"*","eslint":"*","eslint-config-google":"*","eslint-plugin-jsdoc":"*","jest":"*","jsdoc":"*","weboptimizer":"*"},"peerDependencies":{"@babel/runtime":"*","clientnode":"*"},"peerDependenciesMeta":{"@babel/runtime":{"optional":true}},"engines":{"node":">=17","npm":">=7"},"resolutions":{"@types/webpack":"https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz","colors":"1.4.0"},"sideEffects":true,"documentationWebsite":{"name":"web-node","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"]},"directories":{"external":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?index\\\\.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}if(module===eval(\'require.main\'))module.paths.unshift(\'/application/node_modules\');{1}`"}}},"exportFormat":{"external":"commonjs2","self":"commonjs2"},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"babelMinify":{"#":"To provide a logging output we need to exclude this feature.","__evaluate__":"self.debug ? {bundle: null, module: null} : {bundle: {transform: {removeConsole: false}}, module: {removeConsole: false}}"}}},"targetTechnology":{"boilerplate":"node","payload":"node"}}}');var s,p;for(u.webNode.core.context={path:"/",type:"relative"};u.webNode.core.context.path=c().resolve(u.webNode.core.context.path,"../../"),"node_modules"===c().basename(c().dirname(u.webNode.core.context.path)););if("/"===u.webNode.core.context.path||"node_modules"===c().basename(c().dirname(process.cwd()))||".staging"===c().basename(c().dirname(process.cwd()))&&"node_modules"===c().basename(c().dirname(c().dirname(process.cwd()))))u.webNode.core.context.path=process.cwd();else try{o().lstatSync(c().join(process.cwd(),"node_modules")).isSymbolicLink()&&(u.webNode.core.context.path=process.cwd())}catch(e){}var d={name:"main"};try{d=(0,t.currentRequire)(c().join(u.webNode.core.context.path,"package"))}catch(e){u.webNode.core.context.path=process.cwd()}var E=(null==(s=d.documentationWebsite)?void 0:s.name)||d.name||"main",f=d.webNode||((p={})[E]={name:E,package:d},p);u.webNode.core.name=u.documentationWebsite.name;var b=new Date,P={currentPath:process.cwd(),fileSystem:o(),path:c(),PluginAPI:l.ZP,require:t.currentRequire,Tools:n(),webNodePath:"/",now:b,nowUTCTimestamp:n().numberGetUTCTimestamp(b)},m=n().evaluateDynamicData(u.webNode,P);if(delete u.webNode,n().extend(!0,n().modifyObject(m,f),f),2<process.argv.length){var O=n().stringParseEncodedObject(process.argv[process.argv.length-1],m,"configuration");n().isPlainObject(O)&&(n().extend(!0,n().modifyObject(m,O),O),m.core.runtimeConfiguration=O)}(m=n().evaluateDynamicData(n().removeKeysInEvaluation(m),P)).name=E,m.core.package=u;const D=m},(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{var __dirname="/";__webpack_require__.d(__webpack_exports__,{Jf:()=>currentRequire,Sw:()=>PluginAPI,ZP:()=>__WEBPACK_DEFAULT_EXPORT__});var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__),child_process__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(8),child_process__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_2__),clientnode__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(5),clientnode__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(clientnode__WEBPACK_IMPORTED_MODULE_3__),fs__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(6),fs__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__),module__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(9),module__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(module__WEBPACK_IMPORTED_MODULE_5__),path__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(7),path__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__),_configurator__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(0);function _createForOfIteratorHelperLoose(e,_){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||_&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,_){if(e){if("string"==typeof e)return _arrayLikeToArray(e,_);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,_):void 0}}function _arrayLikeToArray(e,_){(null==_||_>e.length)&&(_=e.length);for(var r=0,t=Array(_);r<_;r++)t[r]=e[r];return t}var currentRequire=eval("require"),oldResolveFilename=module__WEBPACK_IMPORTED_MODULE_5__.Module._resolveFilename;module__WEBPACK_IMPORTED_MODULE_5__.Module._resolveFilename=function(e,_,r){return oldResolveFilename("web-node"===e?currentRequire.main.id:e,_,r)};var PluginAPI=function(){function e(){}return e.callStack=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a){var o,i,c,l,u,s,p,d,E,f,b=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(void 0===a&&(a=null),!n.core.plugin.hotReloading){_.next=15;break}if(!(o=e.hotReloadConfigurationFile(t,n.core.plugin.configuration.propertyNames)).length){_.next=10;break}return n.core.debug&&console.info('Configuration for "'+o.map((function(e){return e.name})).join('", "')+'" has been changed: reloading initialized.'),_.next=7,e.callStack("preConfigurationLoaded",t,n,n,o);case 7:return e.loadConfigurations(t,n),_.next=10,e.callStack("postConfigurationLoaded",t,n,n,o);case 10:if(!(i=e.hotReloadAPIFile(t)).length){_.next=15;break}return n.core.debug&&console.info('API-file for "'+i.map((function(e){return e.name})).join('", "')+'" has been changed: reloading initialized.'),_.next=15,e.callStack("apiFileReloaded",t,n,i);case 15:for(c=b.length,l=Array(4<c?c-4:0),u=4;u<c;u++)l[u-4]=b[u];s=_createForOfIteratorHelperLoose(t);case 17:if((p=s()).done){_.next=36;break}if(!(d=p.value).api){_.next=34;break}return E=void 0,_.prev=21,_.next=24,d.api.apply(d,[r,a].concat(l.concat(r.endsWith("ConfigurationLoaded")?[]:n,[t])));case 24:E=_.sent,_.next=32;break;case 27:if(_.prev=27,_.t0=_.catch(21),null==(f=_.t0.message)||!f.startsWith("NotImplemented:")){_.next=31;break}return _.abrupt("continue",34);case 31:throw new Error('Plugin "'+d.internalName+'" '+(d.internalName===d.name?"":"("+d.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(_.t0)+' during asynchronous hook "'+r+'".');case 32:a=E,n.core.debug&&console.info('Ran asynchronous hook "'+r+'" for plugin "'+d.name+'".');case 34:_.next=17;break;case 36:return _.abrupt("return",a);case 37:case"end":return _.stop()}}),_,null,[[21,27]])})));return function(){return _.apply(this,arguments)}}(),e.callStackSynchronous=function(e,_,r,t){void 0===t&&(t=null);for(var n=arguments.length,a=Array(4<n?n-4:0),o=4;o<n;o++)a[o-4]=arguments[o];for(var i,c,l=_createForOfIteratorHelperLoose(_);!(i=l()).done;)if((c=i.value).api){var u=void 0;try{u=c.api.apply(c,[e,t].concat(a.concat(r,_)))}catch(_){var s;if(null!=(s=_.message)&&s.startsWith("NotImplemented:"))continue;throw new Error('Plugin "'+c.internalName+'" '+(c.internalName===c.name?"":"("+c.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(_)+' during synchronous hook "'+e+'".')}t=u,r.core.debug&&console.info('Ran synchronous hook "'+e+'" for plugin "'+c.name+'".')}return t},e.determineInternalName=function(e,_){return clientnode__WEBPACK_IMPORTED_MODULE_3___default().stringDelimitedToCamelCase(e.replace(_,(function(e,_){return"string"==typeof _?_:e})))},e.evaluateConfiguration=function(_){for(var r={},t=0,n=Object.entries(_);t<n.length;t++){var a=n[t],o=a[0],i=a[1];i.package&&(r[o]=i.package,delete i.package)}var c=new Date;_=clientnode__WEBPACK_IMPORTED_MODULE_3___default().evaluateDynamicData(clientnode__WEBPACK_IMPORTED_MODULE_3___default().removeKeysInEvaluation(_),{currentPath:process.cwd(),fileSystem:fs__WEBPACK_IMPORTED_MODULE_4___default(),path:path__WEBPACK_IMPORTED_MODULE_6___default(),PluginAPI:e,require:currentRequire,Tools:clientnode__WEBPACK_IMPORTED_MODULE_3___default(),webNodePath:__dirname,now:c,nowUTCTimestamp:clientnode__WEBPACK_IMPORTED_MODULE_3___default().numberGetUTCTimestamp(c)});for(var l=0,u=Object.entries(r);l<u.length;l++){var s=u[l],p=s[0],d=s[1];_[p].package=d}return _},e.hotReloadAPIFile=function(_){for(var r,t,n=[],a=_createForOfIteratorHelperLoose(e.hotReloadFiles("api","scope",_));!(r=a()).done;){for(var o in(t=r.value).oldScope)Object.prototype.hasOwnProperty.call(t.oldScope,o)&&Object.prototype.hasOwnProperty.call(t.newScope,o)&&!clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFunction(t.oldScope[o])&&!clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFunction(t.newScope[o])&&(t.newScope=t.oldScope);n.push(t.plugin)}return n},e.hotReloadConfigurationFile=function(_,r){for(var t,n,a=[],o=_createForOfIteratorHelperLoose(e.hotReloadFiles("configuration","packageConfiguration",_));!(t=o()).done;)(n=t.value).plugin.configuration=e.loadConfiguration(n.plugin.internalName,n.plugin.packageConfiguration,r),a.push(n.plugin);return a},e.hotReloadFiles=function(_,r,t){for(var n,a,o=[],i=_createForOfIteratorHelperLoose(t);!(n=i()).done;)if((a=n.value)[r])for(var c,l=0,u=_createForOfIteratorHelperLoose(a[_+"FilePaths"]);!(c=u()).done;){var s=c.value,p=(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(s).mtime.getTime();if(a[_+"FileLoadTimestamps"][l]<p){delete currentRequire.cache[currentRequire.resolve(s)];var d=a[r];a[r]=e.loadFile(s,a.name,a[r]),o.push({newScope:a[r],oldScope:d,plugin:a,target:r})}a[_+"FileLoadTimestamps"][l]=p,l+=1}return o},e.load=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a,o,i){var c,l,u,s,p,d,E,f;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:void 0===i&&(i="utf8"),c=[],l={},u=_createForOfIteratorHelperLoose(a.fileNames);case 4:if((s=u()).done){_.next=14;break}return p=s.value,d=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(o,p),_.next=9,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(d);case 9:if(!_.sent){_.next=12;break}clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,l,e.loadFile(d,r)),c.push(d);case 12:_.next=4;break;case 14:if(E=["index.js"],!Object.keys(l).length){_.next=22;break}return t=l.webNodeInternalName||t,(f=e.loadConfiguration(t,l,a.propertyNames))[t].package.main&&(E[0]=f[t].package.main),_.next=21,e.loadAPI(E,o,r,t,n,i,f,c);case 21:return _.abrupt("return",_.sent);case 22:return _.next=24,e.loadAPI(E,o,r,t,n,i);case 24:return _.abrupt("return",_.sent);case 25:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.loadAPI=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a,o,i,c,l){var u,s,p,d,E,f,b,P,m,O,D;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:return void 0===i&&(i="utf8"),void 0===c&&(c=null),void 0===l&&(l=[]),E=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,r[0]),_.next=6,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(E);case 6:if(_.sent){_.next=21;break}f=_createForOfIteratorHelperLoose((0,fs__WEBPACK_IMPORTED_MODULE_4__.readdirSync)(t));case 8:if((b=f()).done){_.next=21;break}if(P=b.value,_.t0=!l.map((function(e){return(0,path__WEBPACK_IMPORTED_MODULE_6__.basename)(e)})).includes(P),!_.t0){_.next=15;break}return _.next=14,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile((0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,P));case 14:_.t0=_.sent;case 15:if(!_.t0){_.next=19;break}if(E=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,E),!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_6__.basename)(E,(0,path__WEBPACK_IMPORTED_MODULE_6__.extname)(P)))){_.next=19;break}return _.abrupt("break",21);case 19:_.next=8;break;case 21:if(m=null,O=!1,_.t1=c&&(1<Object.keys(c).length||c[a]&&1<Object.keys(c[a]).length),!_.t1){_.next=28;break}return _.next=27,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(E);case 27:_.t1=_.sent;case 28:if(!_.t1){_.next=30;break}E.endsWith(".js")?(O=!0,m=function(_,r){for(var t,a=arguments.length,i=Array(2<a?a-2:0),c=2;c<a;c++)i[c-2]=arguments[c];if(_ in o[n].scope)return(t=o[n].scope)[_].apply(t,[r].concat(i,[e]));throw new Error('NotImplemented: API method "'+_+'" is not implemented in plugin "'+n+'".')}):m=function(e){for(var _=arguments.length,r=Array(1<_?_-1:0),t=1;t<_;t++)r[t-1]=arguments[t];var n=(0,child_process__WEBPACK_IMPORTED_MODULE_2__.spawnSync)(E,clientnode__WEBPACK_IMPORTED_MODULE_3___default().arrayMake(r),{cwd:process.cwd(),encoding:i,env:process.env,input:clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(e),shell:!0,stdio:"inherit"});return n.stdout.startsWith("##")&&n.stdout.endsWith("##")&&(e=JSON.parse(e)),e};case 30:return D=null!==(u=c)&&void 0!==u?u:((s={})[a]={package:{}},s),_.abrupt("return",{api:m,apiFileLoadTimestamps:m?[(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(E).mtime.getTime()]:[],apiFilePaths:m?[E]:[],configuration:D,configurationFilePaths:l,configurationFileLoadTimestamps:l.map((function(e){return(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(e).mtime.getTime()})),dependencies:(null==(p=D[a])?void 0:p.dependencies)||[],internalName:a,name:n,packageConfiguration:null==(d=D[a])?void 0:d.package,path:t,scope:O?e.loadFile(E,n):null});case 32:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.loadConfiguration=function(e,_,r){for(var t,n,a,o=clientnode__WEBPACK_IMPORTED_MODULE_3___default().removeKeyPrefixes(clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(_)),i=((t={})[e]={package:o},t),c=_createForOfIteratorHelperLoose(r);!(n=c()).done;)if(_[a=n.value]){clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,i,_[a]),delete i[e].package[a];break}return i},e.loadConfigurations=function(_,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&delete r[t];clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(r,clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(_configurator__WEBPACK_IMPORTED_MODULE_7__.Z));for(var n,a,o=_createForOfIteratorHelperLoose(_);!(n=o()).done;)if((a=n.value).configuration){var i=clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(a.configuration);clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,clientnode__WEBPACK_IMPORTED_MODULE_3___default().modifyObject(r,i),i),r.core.runtimeConfiguration&&clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,r,r.core.runtimeConfiguration)}return e.evaluateConfiguration(r)},e.loadFile=function(e,_,r,t){var n,a;void 0===r&&(r=null),void 0===t&&(t=!0);try{n=currentRequire.resolve(e)}catch(e){}n&&n in currentRequire.cache&&delete currentRequire.cache[n];try{a=currentRequire(e)}catch(n){if(!r)throw new Error("Couln't load plugin file \""+e+'" for plugin "'+_+'": '+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(n));a=r,t&&console.warn("Couln't load new api plugin file \""+e+'" for plugin "'+_+'": '+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(n)+". Using fallback one.")}return Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},e.loadAll=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r){var t,n,a,o,i,c,l,u,s,p,d,E,f,b,P,m,O,D;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(t={},"web-node"===r.name){_.next=5;break}return _.next=4,e.load(r.name,e.determineInternalName(r.name,new RegExp(r.core.plugin.directories.external.nameRegularExpressionPattern)),t,r.core.plugin.configuration,r.core.context.path,r.core.encoding);case 4:t[r.name]=_.sent;case 5:_.t0=_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().keys(r.core.plugin.directories);case 6:if((_.t1=_.t0()).done){_.next=29;break}if(n=_.t1.value,_.t2=Object.prototype.hasOwnProperty.call(r.core.plugin.directories,n),!_.t2){_.next=13;break}return _.next=12,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isDirectory(r.core.plugin.directories[n].path);case 12:_.t2=_.sent;case 13:if(!_.t2){_.next=27;break}a=new RegExp(r.core.plugin.directories[n].nameRegularExpressionPattern),o=_createForOfIteratorHelperLoose((0,fs__WEBPACK_IMPORTED_MODULE_4__.readdirSync)(r.core.plugin.directories[n].path));case 16:if((i=o()).done){_.next=27;break}if(c=i.value,a.test(c)){_.next=20;break}return _.abrupt("continue",25);case 20:return l=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(r.core.plugin.directories[n].path,c),u=e.determineInternalName(c,a),_.next=24,e.load(c,u,t,r.core.plugin.configuration,l,r.core.encoding);case 24:t[c]=_.sent;case 25:_.next=16;break;case 27:_.next=6;break;case 29:for(p in s={},t)if(Object.prototype.hasOwnProperty.call(t,p)&&(s[t[p].internalName]=t[p].dependencies,Object.prototype.hasOwnProperty.call(r.core.interDependencies,t[p].internalName)))for(d=_createForOfIteratorHelperLoose([].concat(r.core.interDependencies[t[p].internalName]));!(E=d()).done;)f=E.value,s[t[p].internalName].includes(f)||s[t[p].internalName].push(f);b=[],P=_createForOfIteratorHelperLoose(clientnode__WEBPACK_IMPORTED_MODULE_3___default().arraySortTopological(s));case 33:if((m=P()).done){_.next=46;break}O=m.value,_.t3=_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().keys(t);case 36:if((_.t4=_.t3()).done){_.next=44;break}if(D=_.t4.value,!Object.prototype.hasOwnProperty.call(t,D)){_.next=42;break}if(![t[D].internalName,D].includes(O)){_.next=42;break}return b.push(t[D]),_.abrupt("break",44);case 42:_.next=36;break;case 44:_.next=33;break;case 46:return _.abrupt("return",{configuration:e.loadConfigurations(b,r),plugins:b});case 47:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.determineLocations=function(e,_){return void 0===_&&(_=[]),(_=[].concat(_)).length?_.map((function(_){return(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(e.core.context.path,_)})):[e.core.context.path]},e.isInLocations=function(e,_,r,t){for(var n,a,o=_.map((function(e){return e.path})),i=_createForOfIteratorHelperLoose([].concat(t));!(n=i()).done;)if((a=n.value).startsWith("/")){if(r.startsWith((0,path__WEBPACK_IMPORTED_MODULE_6__.join)(e.core.context.path,a)))return!0}else for(var c,l,u=_createForOfIteratorHelperLoose(o);!(c=u()).done;)if(l=c.value,r.startsWith((0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(l,a)))return!0;return!1},e}();const __WEBPACK_DEFAULT_EXPORT__=PluginAPI},(module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{PluginAPI:()=>_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.Sw,configuration:()=>_configurator__WEBPACK_IMPORTED_MODULE_2__.D,currentRequire:()=>_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.Jf,default:()=>__WEBPACK_DEFAULT_EXPORT__,main:()=>main});var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__),_configurator__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(0),_pluginAPI__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(1),clientnode__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(5),clientnode__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(clientnode__WEBPACK_IMPORTED_MODULE_4__);function _createForOfIteratorHelperLoose(e,_){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||_&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,_){if(e){if("string"==typeof e)return _arrayLikeToArray(e,_);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,_):void 0}}function _arrayLikeToArray(e,_){(null==_||_>e.length)&&(_=e.length);for(var r=0,t=Array(_);r<_;r++)t[r]=e[r];return t}module=__webpack_require__.hmd(module);var handleError=function(){var e=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function e(_,r,t,n){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("error",_,r,t,n);case 3:e.next=12;break;case 5:if(e.prev=5,e.t0=e.catch(0),!r.core.debug){e.next=11;break}throw e.t0;case 11:console.error(e.t0);case 12:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),main=function(){var e=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function e(){var _,r,t,n,a,o,i,c,l,u,s,p,d,E,f,b,P,m,O,D,M,g;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.loadAll(clientnode__WEBPACK_IMPORTED_MODULE_4___default().copy(_configurator__WEBPACK_IMPORTED_MODULE_2__.Z));case 2:return _=e.sent,r=_.configuration,t=_.plugins,e.next=7,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("initialize",t,r);case 7:t.length&&console.info('Loaded plugins: "'+t.map((function(e){return e.internalName})).join('", "')+'".'),n=_createForOfIteratorHelperLoose(["pre","post"]);case 9:if((a=n()).done){e.next=15;break}return o=a.value,e.next=13,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack(o+"ConfigurationLoaded",t,r,r,t.filter((function(e){return!!e.configurationFilePaths.length})));case 13:e.next=9;break;case 15:return i={},c={},l=!1,e.prev=18,e.next=21,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("preLoadService",t,r,i);case 21:for(u in i=e.sent)Object.prototype.hasOwnProperty.call(i,u)&&console.info('Service "'+u+'" initialized.');s=_createForOfIteratorHelperLoose(t);case 24:if((p=s()).done){e.next=47;break}if(!(d=p.value).api){e.next=45;break}return e.next=29,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("preLoad"+clientnode__WEBPACK_IMPORTED_MODULE_4___default().stringCapitalize(d.internalName)+"Service",t,r,i);case 29:return i=e.sent,f=null,e.prev=31,e.next=34,d.api.call(_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP,"loadService",c,i,r,t);case 34:f=e.sent,e.next=41;break;case 37:if(e.prev=37,e.t0=e.catch(31),null!=e.t0&&null!=(b=e.t0.message)&&b.startsWith("NotImplemented:")){e.next=41;break}throw new Error('Plugin "'+d.internalName+'" '+(d.internalName===d.name?"":"("+d.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_4___default().represent(e.t0)+' during asynchrone hook "loadService".');case 41:return"string"==typeof(null==(E=f)?void 0:E.name)&&(null!==f.promise&&"object"==typeof f.promise&&"then"in f.promise?(console.info('Service "'+f.name+'" started.'),c[f.name]=f.promise):console.info('Service "'+f.name+'" loaded.')),e.next=44,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("postLoad"+clientnode__WEBPACK_IMPORTED_MODULE_4___default().stringCapitalize(d.internalName)+"Service",t,r,i,c);case 44:i=e.sent;case 45:e.next=24;break;case 47:return e.next=49,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("postLoadService",t,r,c,i);case 49:for(c=e.sent,P=!1,m=function(){P||_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStackSynchronous("exit",t.slice().reverse(),r,i),P=!0},O=_createForOfIteratorHelperLoose(clientnode__WEBPACK_IMPORTED_MODULE_4__.CloseEventNames);!(D=O()).done;)M=D.value,process.on(M,m);return g=!1,process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(r.core.encoding),process.stdin.on("data",(function(e){_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(""!==e){_.next=10;break}if(!g){_.next=5;break}console.warn("Stopping ungracefully."),_.next=9;break;case 5:return g=!0,console.info("You have requested to shut down all services. A second request will force to stop ungracefully."),_.next=9,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 9:process.exit();case 10:process.stdout.write(e);case 11:case"end":return _.stop()}}),_)})))()})),e.prev=58,e.next=61,Promise.all(Object.keys(c).map((function(e){return c[e]})));case 61:e.next=65;break;case 63:e.prev=63,e.t1=e.catch(58);case 65:return l=!0,e.next=68,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 68:process.exit(),e.next=91;break;case 71:return e.prev=71,e.t2=e.catch(18),e.next=75,handleError(t,r,e.t2,i);case 75:if(l){e.next=85;break}return e.prev=76,e.next=79,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 79:e.next=85;break;case 81:return e.prev=81,e.t3=e.catch(76),e.next=85,handleError(t,r,e.t3,i);case 85:if(!r.core.debug){e.next=89;break}throw e.t2;case 89:console.error(e.t2);case 90:process.exit(1);case 91:case"end":return e.stop()}}),e,null,[[18,71],[31,37],[58,63],[76,81]])})));return function(){return e.apply(this,arguments)}}();(__webpack_require__.c[__webpack_require__.s]===module||eval("require.main")!==__webpack_require__.c[__webpack_require__.s]&&"undefined"!=typeof ORIGINAL_MAIN_MODULE&&ORIGINAL_MAIN_MODULE===eval("require.main"))&&main();const __WEBPACK_DEFAULT_EXPORT__=main},e=>{e.exports=require("@babel/runtime/helpers/asyncToGenerator")},e=>{e.exports=require("@babel/runtime/regenerator")},e=>{e.exports=require("clientnode")},e=>{e.exports=require("fs")},e=>{e.exports=require("path")},e=>{e.exports=require("child_process")},e=>{e.exports=require("module")}],__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.c=__webpack_module_cache__,__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(__webpack_require__.s=2);module.exports=__webpack_exports__})();
|
|
3
|
+
'use strict';if(typeof module!=='undefined'&&module!==null&&eval('typeof require')!=='undefined'&&eval('require')!==null&&'main'in eval('require')&&eval('typeof require.main')!=='undefined'&&eval('require.main')!==null){var ORIGINAL_MAIN_MODULE=module;if(module!==eval('require.main')&&'paths'in module&&'paths'in eval('require.main')&&typeof __dirname!=='undefined'&&__dirname!==null)module.paths=eval('require.main.paths').concat(module.paths.filter(function(path){return eval('require.main.paths').includes(path)}))};if(module===eval('require.main'))module.paths.unshift('/application/node_modules');(()=>{"use strict";var __webpack_modules__=[(e,_,r)=>{r.d(_,{D:()=>O,Z:()=>D});var t=r(5),n=r.n(t),a=r(6),o=r.n(a),i=r(7),c=r.n(i),l=r(1);const u=JSON.parse('{"name":"web-node","version":"1.0.435","description":"High level javaScript backend plugin system and configuration merger.","keywords":["web","backend","api","plugin","management"],"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":{"name":"Torben Sickert","email":"info@torben.website","url":"https://torben.website"},"files":["configurator.d.ts","index.d.ts","index.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"bin":{"web-node":"index.js"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"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","serve":"weboptimizer build && yarn serve","start":"./index.js \'{plugin: {hotReloading: true}}\'","prepare:test":"yarn clear && cd dummyPlugin && yarn build && cd ..","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":"yarn version --patch && yarn publish","update:documentation":"documentationWebsite --log-level info","watch":"weboptimizer build --watch"},"dependencies":{"@types/webpack":"https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"},"devDependencies":{"@babel/cli":"*","@babel/eslint-parser":"*","@types/jest":"*","@types/node":"*","@typescript-eslint/eslint-plugin":"*","@typescript-eslint/parser":"*","clientnode":"*","documentation-website":"*","eslint":"*","eslint-config-google":"*","eslint-plugin-jsdoc":"*","jest":"*","jsdoc":"*","weboptimizer":"*"},"peerDependencies":{"@babel/runtime":"*","clientnode":"*"},"peerDependenciesMeta":{"@babel/runtime":{"optional":true}},"engines":{"node":">=17","npm":">=7"},"resolutions":{"@types/webpack":"https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz","colors":"1.4.0"},"sideEffects":true,"documentationWebsite":{"name":"web-node","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"]},"directories":{"external":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?index\\\\.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}if(module===eval(\'require.main\'))module.paths.unshift(\'/application/node_modules\');{1}`"}}},"exportFormat":{"external":"commonjs2","self":"commonjs2"},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"babelMinify":{"#":"To provide a logging output we need to exclude this feature.","__evaluate__":"self.debug ? {bundle: null, module: null} : {bundle: {transform: {removeConsole: false}}, module: {removeConsole: false}}"}}},"targetTechnology":{"boilerplate":"node","payload":"node"}}}');var s,p;for(u.webNode.core.context={path:"/",type:"relative"};u.webNode.core.context.path=c().resolve(u.webNode.core.context.path,"../../"),"node_modules"===c().basename(c().dirname(u.webNode.core.context.path)););if("/"===u.webNode.core.context.path||"node_modules"===c().basename(c().dirname(process.cwd()))||".staging"===c().basename(c().dirname(process.cwd()))&&"node_modules"===c().basename(c().dirname(c().dirname(process.cwd()))))u.webNode.core.context.path=process.cwd();else try{o().lstatSync(c().join(process.cwd(),"node_modules")).isSymbolicLink()&&(u.webNode.core.context.path=process.cwd())}catch(e){}var d={name:"main"};try{d=(0,t.currentRequire)(c().join(u.webNode.core.context.path,"package"))}catch(e){u.webNode.core.context.path=process.cwd()}var E=(null==(s=d.documentationWebsite)?void 0:s.name)||d.name||"main",f=d.webNode||((p={})[E]={name:E,package:d},p);u.webNode.core.name=u.documentationWebsite.name;var b=new Date,P={currentPath:process.cwd(),fileSystem:o(),path:c(),PluginAPI:l.ZP,require:t.currentRequire,Tools:n(),webNodePath:"/",now:b,nowUTCTimestamp:n().numberGetUTCTimestamp(b)},O=n().evaluateDynamicData(u.webNode,P);if(delete u.webNode,n().extend(!0,n().modifyObject(O,f),f),2<process.argv.length){var m=n().stringParseEncodedObject(process.argv[process.argv.length-1],O,"configuration");n().isPlainObject(m)&&(n().extend(!0,n().modifyObject(O,m),m),O.core.runtimeConfiguration=m)}(O=n().evaluateDynamicData(n().removeKeysInEvaluation(O),P)).name=E,O.core.package=u;const D=O},(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{var __dirname="/";__webpack_require__.d(__webpack_exports__,{Jf:()=>currentRequire,Sw:()=>PluginAPI,ZP:()=>__WEBPACK_DEFAULT_EXPORT__});var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__),child_process__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(8),child_process__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_2__),clientnode__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(5),clientnode__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(clientnode__WEBPACK_IMPORTED_MODULE_3__),fs__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(6),fs__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__),module__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(9),module__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(module__WEBPACK_IMPORTED_MODULE_5__),path__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(7),path__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__),_configurator__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(0);function _createForOfIteratorHelperLoose(e,_){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||_&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,_){if(e){if("string"==typeof e)return _arrayLikeToArray(e,_);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,_):void 0}}function _arrayLikeToArray(e,_){(null==_||_>e.length)&&(_=e.length);for(var r=0,t=Array(_);r<_;r++)t[r]=e[r];return t}var currentRequire=eval("require"),oldResolveFilename=module__WEBPACK_IMPORTED_MODULE_5__.Module._resolveFilename;module__WEBPACK_IMPORTED_MODULE_5__.Module._resolveFilename=function(e,_,r){return oldResolveFilename("web-node"===e?currentRequire.main.id:e,_,r)};var PluginAPI=function(){function e(){}return e.callStack=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a){var o,i,c,l,u,s,p,d,E,f,b=arguments;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(void 0===a&&(a=null),!n.core.plugin.hotReloading){_.next=15;break}if(!(o=e.hotReloadConfigurationFile(t,n.core.plugin.configuration.propertyNames)).length){_.next=10;break}return n.core.debug&&console.info('Configuration for "'+o.map((function(e){return e.name})).join('", "')+'" has been changed: reloading initialized.'),_.next=7,e.callStack("preConfigurationLoaded",t,n,n,o);case 7:return e.loadConfigurations(t,n),_.next=10,e.callStack("postConfigurationLoaded",t,n,n,o);case 10:if(!(i=e.hotReloadAPIFile(t)).length){_.next=15;break}return n.core.debug&&console.info('API-file for "'+i.map((function(e){return e.name})).join('", "')+'" has been changed: reloading initialized.'),_.next=15,e.callStack("apiFileReloaded",t,n,i);case 15:for(c=b.length,l=Array(4<c?c-4:0),u=4;u<c;u++)l[u-4]=b[u];s=_createForOfIteratorHelperLoose(t);case 17:if((p=s()).done){_.next=36;break}if(!(d=p.value).api){_.next=34;break}return E=void 0,_.prev=21,_.next=24,d.api.apply(d,[r,a].concat(l.concat(r.endsWith("ConfigurationLoaded")?[]:n,[t])));case 24:E=_.sent,_.next=32;break;case 27:if(_.prev=27,_.t0=_.catch(21),null==(f=_.t0.message)||!f.startsWith("NotImplemented:")){_.next=31;break}return _.abrupt("continue",34);case 31:throw new Error('Plugin "'+d.internalName+'" '+(d.internalName===d.name?"":"("+d.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(_.t0)+' during asynchronous hook "'+r+'".');case 32:a=E,n.core.debug&&console.info('Ran asynchronous hook "'+r+'" for plugin "'+d.name+'".');case 34:_.next=17;break;case 36:return _.abrupt("return",a);case 37:case"end":return _.stop()}}),_,null,[[21,27]])})));return function(){return _.apply(this,arguments)}}(),e.callStackSynchronous=function(e,_,r,t){void 0===t&&(t=null);for(var n=arguments.length,a=Array(4<n?n-4:0),o=4;o<n;o++)a[o-4]=arguments[o];for(var i,c,l=_createForOfIteratorHelperLoose(_);!(i=l()).done;)if((c=i.value).api){var u=void 0;try{u=c.api.apply(c,[e,t].concat(a.concat(r,_)))}catch(_){var s;if(null!=(s=_.message)&&s.startsWith("NotImplemented:"))continue;throw new Error('Plugin "'+c.internalName+'" '+(c.internalName===c.name?"":"("+c.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(_)+' during synchronous hook "'+e+'".')}t=u,r.core.debug&&console.info('Ran synchronous hook "'+e+'" for plugin "'+c.name+'".')}return t},e.determineInternalName=function(e,_){return clientnode__WEBPACK_IMPORTED_MODULE_3___default().stringDelimitedToCamelCase(e.replace(_,(function(e,_){return"string"==typeof _?_:e})))},e.evaluateConfiguration=function(_){for(var r={},t=0,n=Object.entries(_);t<n.length;t++){var a=n[t],o=a[0],i=a[1];i.package&&(r[o]=i.package,delete i.package)}var c=new Date;_=clientnode__WEBPACK_IMPORTED_MODULE_3___default().evaluateDynamicData(clientnode__WEBPACK_IMPORTED_MODULE_3___default().removeKeysInEvaluation(_),{currentPath:process.cwd(),fileSystem:fs__WEBPACK_IMPORTED_MODULE_4___default(),path:path__WEBPACK_IMPORTED_MODULE_6___default(),PluginAPI:e,require:currentRequire,Tools:clientnode__WEBPACK_IMPORTED_MODULE_3___default(),webNodePath:__dirname,now:c,nowUTCTimestamp:clientnode__WEBPACK_IMPORTED_MODULE_3___default().numberGetUTCTimestamp(c)});for(var l=0,u=Object.entries(r);l<u.length;l++){var s=u[l],p=s[0],d=s[1];_[p].package=d}return _},e.hotReloadAPIFile=function(_){for(var r,t,n=[],a=_createForOfIteratorHelperLoose(e.hotReloadFiles("api","scope",_));!(r=a()).done;){for(var o in(t=r.value).oldScope)Object.prototype.hasOwnProperty.call(t.oldScope,o)&&Object.prototype.hasOwnProperty.call(t.newScope,o)&&!clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFunction(t.oldScope[o])&&!clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFunction(t.newScope[o])&&(t.newScope=t.oldScope);n.push(t.plugin)}return n},e.hotReloadConfigurationFile=function(_,r){for(var t,n,a=[],o=_createForOfIteratorHelperLoose(e.hotReloadFiles("configuration","packageConfiguration",_));!(t=o()).done;)(n=t.value).plugin.configuration=e.loadConfiguration(n.plugin.internalName,n.plugin.packageConfiguration,r),a.push(n.plugin);return a},e.hotReloadFiles=function(_,r,t){for(var n,a,o=[],i=_createForOfIteratorHelperLoose(t);!(n=i()).done;)if((a=n.value)[r])for(var c,l=0,u=_createForOfIteratorHelperLoose(a[_+"FilePaths"]);!(c=u()).done;){var s=c.value,p=(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(s).mtime.getTime();if(a[_+"FileLoadTimestamps"][l]<p){delete currentRequire.cache[currentRequire.resolve(s)];var d=a[r];a[r]=e.loadFile(s,a.name,a[r]),o.push({newScope:a[r],oldScope:d,plugin:a,target:r})}a[_+"FileLoadTimestamps"][l]=p,l+=1}return o},e.load=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a,o,i){var c,l,u,s,p,d,E,f;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:void 0===i&&(i="utf8"),c=[],l={},u=_createForOfIteratorHelperLoose(a.fileNames);case 4:if((s=u()).done){_.next=14;break}return p=s.value,d=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(o,p),_.next=9,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(d);case 9:if(!_.sent){_.next=12;break}clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,l,e.loadFile(d,r)),c.push(d);case 12:_.next=4;break;case 14:if(E=["index.js"],!Object.keys(l).length){_.next=22;break}return t=l.webNodeInternalName||t,(f=e.loadConfiguration(t,l,a.propertyNames))[t].package.main&&(E[0]=f[t].package.main),_.next=21,e.loadAPI(E,o,r,t,n,i,f,c);case 21:return _.abrupt("return",_.sent);case 22:return _.next=24,e.loadAPI(E,o,r,t,n,i);case 24:return _.abrupt("return",_.sent);case 25:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.loadAPI=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r,t,n,a,o,i,c,l){var u,s,p,d,E,f,b,P,O,m,D;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:return void 0===i&&(i="utf8"),void 0===c&&(c=null),void 0===l&&(l=[]),E=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,r[0]),_.next=6,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(E);case 6:if(_.sent){_.next=21;break}f=_createForOfIteratorHelperLoose((0,fs__WEBPACK_IMPORTED_MODULE_4__.readdirSync)(t));case 8:if((b=f()).done){_.next=21;break}if(P=b.value,_.t0=!l.map((function(e){return(0,path__WEBPACK_IMPORTED_MODULE_6__.basename)(e)})).includes(P),!_.t0){_.next=15;break}return _.next=14,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile((0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,P));case 14:_.t0=_.sent;case 15:if(!_.t0){_.next=19;break}if(E=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(t,E),!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_6__.basename)(E,(0,path__WEBPACK_IMPORTED_MODULE_6__.extname)(P)))){_.next=19;break}return _.abrupt("break",21);case 19:_.next=8;break;case 21:if(O=null,m=!1,_.t1=c&&(1<Object.keys(c).length||c[a]&&1<Object.keys(c[a]).length),!_.t1){_.next=28;break}return _.next=27,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isFile(E);case 27:_.t1=_.sent;case 28:if(!_.t1){_.next=30;break}E.endsWith(".js")?(m=!0,O=function(_,r){for(var t,a=arguments.length,i=Array(2<a?a-2:0),c=2;c<a;c++)i[c-2]=arguments[c];if(_ in o[n].scope)return(t=o[n].scope)[_].apply(t,[r].concat(i,[e]));throw new Error('NotImplemented: API method "'+_+'" is not implemented in plugin "'+n+'".')}):O=function(e){for(var _=arguments.length,r=Array(1<_?_-1:0),t=1;t<_;t++)r[t-1]=arguments[t];var n=(0,child_process__WEBPACK_IMPORTED_MODULE_2__.spawnSync)(E,clientnode__WEBPACK_IMPORTED_MODULE_3___default().arrayMake(r),{cwd:process.cwd(),encoding:i,env:process.env,input:clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(e),shell:!0,stdio:"inherit"});return n.stdout.startsWith("##")&&n.stdout.endsWith("##")&&(e=JSON.parse(e)),e};case 30:return D=null!==(u=c)&&void 0!==u?u:((s={})[a]={package:{}},s),_.abrupt("return",{api:O,apiFileLoadTimestamps:O?[(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(E).mtime.getTime()]:[],apiFilePaths:O?[E]:[],configuration:D,configurationFilePaths:l,configurationFileLoadTimestamps:l.map((function(e){return(0,fs__WEBPACK_IMPORTED_MODULE_4__.statSync)(e).mtime.getTime()})),dependencies:(null==(p=D[a])?void 0:p.dependencies)||[],internalName:a,name:n,packageConfiguration:null==(d=D[a])?void 0:d.package,path:t,scope:m?e.loadFile(E,n):null});case 32:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.loadConfiguration=function(e,_,r){for(var t,n,a,o=clientnode__WEBPACK_IMPORTED_MODULE_3___default().removeKeyPrefixes(clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(_)),i=((t={})[e]={package:o},t),c=_createForOfIteratorHelperLoose(r);!(n=c()).done;)if(_[a=n.value]){clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,i,_[a]),delete i[e].package[a];break}return i},e.loadConfigurations=function(_,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&delete r[t];clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(r,clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(_configurator__WEBPACK_IMPORTED_MODULE_7__.Z));for(var n,a,o=_createForOfIteratorHelperLoose(_);!(n=o()).done;)if((a=n.value).configuration){var i=clientnode__WEBPACK_IMPORTED_MODULE_3___default().copy(a.configuration);clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,clientnode__WEBPACK_IMPORTED_MODULE_3___default().modifyObject(r,i),i),r.core.runtimeConfiguration&&clientnode__WEBPACK_IMPORTED_MODULE_3___default().extend(!0,r,r.core.runtimeConfiguration)}return e.evaluateConfiguration(r)},e.loadFile=function(e,_,r,t){var n,a;void 0===r&&(r=null),void 0===t&&(t=!0);try{n=currentRequire.resolve(e)}catch(e){}n&&n in currentRequire.cache&&delete currentRequire.cache[n];try{a=currentRequire(e)}catch(n){if(!r)throw new Error("Couln't load plugin file \""+e+'" for plugin "'+_+'": '+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(n));a=r,t&&console.warn("Couln't load new api plugin file \""+e+'" for plugin "'+_+'": '+clientnode__WEBPACK_IMPORTED_MODULE_3___default().represent(n)+". Using fallback one.")}return Object.prototype.hasOwnProperty.call(a,"default")?a.default:a},e.loadAll=function(){var _=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(r){var t,n,a,o,i,c,l,u,s,p,d,E,f,b,P,O,m,D;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(t={},"web-node"===r.name){_.next=5;break}return _.next=4,e.load(r.name,e.determineInternalName(r.name,new RegExp(r.core.plugin.directories.external.nameRegularExpressionPattern)),t,r.core.plugin.configuration,r.core.context.path,r.core.encoding);case 4:t[r.name]=_.sent;case 5:_.t0=_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().keys(r.core.plugin.directories);case 6:if((_.t1=_.t0()).done){_.next=29;break}if(n=_.t1.value,_.t2=Object.prototype.hasOwnProperty.call(r.core.plugin.directories,n),!_.t2){_.next=13;break}return _.next=12,clientnode__WEBPACK_IMPORTED_MODULE_3___default().isDirectory(r.core.plugin.directories[n].path);case 12:_.t2=_.sent;case 13:if(!_.t2){_.next=27;break}a=new RegExp(r.core.plugin.directories[n].nameRegularExpressionPattern),o=_createForOfIteratorHelperLoose((0,fs__WEBPACK_IMPORTED_MODULE_4__.readdirSync)(r.core.plugin.directories[n].path));case 16:if((i=o()).done){_.next=27;break}if(c=i.value,a.test(c)){_.next=20;break}return _.abrupt("continue",25);case 20:return l=(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(r.core.plugin.directories[n].path,c),u=e.determineInternalName(c,a),_.next=24,e.load(c,u,t,r.core.plugin.configuration,l,r.core.encoding);case 24:t[c]=_.sent;case 25:_.next=16;break;case 27:_.next=6;break;case 29:for(p in s={},t)if(Object.prototype.hasOwnProperty.call(t,p)&&(s[t[p].internalName]=t[p].dependencies,Object.prototype.hasOwnProperty.call(r.core.interDependencies,t[p].internalName)))for(d=_createForOfIteratorHelperLoose([].concat(r.core.interDependencies[t[p].internalName]));!(E=d()).done;)f=E.value,s[t[p].internalName].includes(f)||s[t[p].internalName].push(f);b=[],P=_createForOfIteratorHelperLoose(clientnode__WEBPACK_IMPORTED_MODULE_3___default().arraySortTopological(s));case 33:if((O=P()).done){_.next=46;break}m=O.value,_.t3=_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().keys(t);case 36:if((_.t4=_.t3()).done){_.next=44;break}if(D=_.t4.value,!Object.prototype.hasOwnProperty.call(t,D)){_.next=42;break}if(![t[D].internalName,D].includes(m)){_.next=42;break}return b.push(t[D]),_.abrupt("break",44);case 42:_.next=36;break;case 44:_.next=33;break;case 46:return _.abrupt("return",{configuration:e.loadConfigurations(b,r),plugins:b});case 47:case"end":return _.stop()}}),_)})));return function(){return _.apply(this,arguments)}}(),e.determineLocations=function(e,_){return void 0===_&&(_=[]),(_=[].concat(_)).length?_.map((function(_){return(0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(e.core.context.path,_)})):[e.core.context.path]},e.isInLocations=function(e,_,r,t){for(var n,a,o=_.map((function(e){return e.path})),i=_createForOfIteratorHelperLoose([].concat(t));!(n=i()).done;)if((a=n.value).startsWith("/")){if(r.startsWith((0,path__WEBPACK_IMPORTED_MODULE_6__.join)(e.core.context.path,a)))return!0}else for(var c,l,u=_createForOfIteratorHelperLoose(o);!(c=u()).done;)if(l=c.value,r.startsWith((0,path__WEBPACK_IMPORTED_MODULE_6__.resolve)(l,a)))return!0;return!1},e}();const __WEBPACK_DEFAULT_EXPORT__=PluginAPI},(module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{PluginAPI:()=>_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.Sw,configuration:()=>_configurator__WEBPACK_IMPORTED_MODULE_2__.D,currentRequire:()=>_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.Jf,default:()=>__WEBPACK_DEFAULT_EXPORT__,main:()=>main});var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__),_configurator__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(0),_pluginAPI__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(1),clientnode__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(5),clientnode__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(clientnode__WEBPACK_IMPORTED_MODULE_4__);function _createForOfIteratorHelperLoose(e,_){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||_&&e&&"number"==typeof e.length){r&&(e=r);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,_){if(e){if("string"==typeof e)return _arrayLikeToArray(e,_);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,_):void 0}}function _arrayLikeToArray(e,_){(null==_||_>e.length)&&(_=e.length);for(var r=0,t=Array(_);r<_;r++)t[r]=e[r];return t}module=__webpack_require__.hmd(module);var handleError=function(){var e=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function e(_,r,t,n){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("error",_,r,t,n);case 3:e.next=12;break;case 5:if(e.prev=5,e.t0=e.catch(0),!r.core.debug){e.next=11;break}throw e.t0;case 11:console.error(e.t0);case 12:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),main=function(){var e=_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function e(){var _,r,t,n,a,o,i,c,l,u,s,p,d,E,f,b,P,O,m,D,M,g;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.loadAll(clientnode__WEBPACK_IMPORTED_MODULE_4___default().copy(_configurator__WEBPACK_IMPORTED_MODULE_2__.Z));case 2:return _=e.sent,r=_.configuration,t=_.plugins,e.next=7,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("initialize",t,r);case 7:t.length&&console.info('Loaded plugins: "'+t.map((function(e){return e.internalName})).join('", "')+'".'),n=_createForOfIteratorHelperLoose(["pre","post"]);case 9:if((a=n()).done){e.next=15;break}return o=a.value,e.next=13,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack(o+"ConfigurationLoaded",t,r,r,t.filter((function(e){return!!e.configurationFilePaths.length})));case 13:e.next=9;break;case 15:return i={},c={},l=!1,e.prev=18,e.next=21,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("preLoadService",t,r,i);case 21:for(u in i=e.sent)Object.prototype.hasOwnProperty.call(i,u)&&console.info('Service "'+u+'" initialized.');s=_createForOfIteratorHelperLoose(t);case 24:if((p=s()).done){e.next=47;break}if(!(d=p.value).api){e.next=45;break}return e.next=29,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("preLoad"+clientnode__WEBPACK_IMPORTED_MODULE_4___default().stringCapitalize(d.internalName)+"Service",t,r,i);case 29:return i=e.sent,f=null,e.prev=31,e.next=34,d.api.call(_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP,"loadService",c,i,r,t);case 34:f=e.sent,e.next=41;break;case 37:if(e.prev=37,e.t0=e.catch(31),null!=e.t0&&null!=(b=e.t0.message)&&b.startsWith("NotImplemented:")){e.next=41;break}throw new Error('Plugin "'+d.internalName+'" '+(d.internalName===d.name?"":"("+d.name+") ")+"throws: "+clientnode__WEBPACK_IMPORTED_MODULE_4___default().represent(e.t0)+' during asynchrone hook "loadService".');case 41:return"string"==typeof(null==(E=f)?void 0:E.name)&&(null!==f.promise&&"object"==typeof f.promise&&"then"in f.promise?(console.info('Service "'+f.name+'" started.'),c[f.name]=f.promise):console.info('Service "'+f.name+'" loaded.')),e.next=44,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("postLoad"+clientnode__WEBPACK_IMPORTED_MODULE_4___default().stringCapitalize(d.internalName)+"Service",t,r,i,c);case 44:i=e.sent;case 45:e.next=24;break;case 47:return e.next=49,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("postLoadService",t,r,c,i);case 49:for(c=e.sent,P=!1,O=function(){P||_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStackSynchronous("exit",t.slice().reverse(),r,i),P=!0},m=_createForOfIteratorHelperLoose(clientnode__WEBPACK_IMPORTED_MODULE_4__.CloseEventNames);!(D=m()).done;)M=D.value,process.on(M,O);return g=!1,process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding(r.core.encoding),process.stdin.on("data",(function(e){_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().mark((function _(){return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default().wrap((function(_){for(;;)switch(_.prev=_.next){case 0:if(""!==e){_.next=10;break}if(!g){_.next=5;break}console.warn("Stopping ungracefully."),_.next=9;break;case 5:return g=!0,console.info("You have requested to shut down all services. A second request will force to stop ungracefully."),_.next=9,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 9:process.exit();case 10:process.stdout.write(e);case 11:case"end":return _.stop()}}),_)})))()})),e.prev=58,e.next=61,Promise.all(Object.keys(c).map((function(e){return c[e]})));case 61:e.next=65;break;case 63:e.prev=63,e.t1=e.catch(58);case 65:return l=!0,e.next=68,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 68:process.exit(),e.next=91;break;case 71:return e.prev=71,e.t2=e.catch(18),e.next=75,handleError(t,r,e.t2,i);case 75:if(l){e.next=85;break}return e.prev=76,e.next=79,_pluginAPI__WEBPACK_IMPORTED_MODULE_3__.ZP.callStack("shouldExit",t,r,i);case 79:e.next=85;break;case 81:return e.prev=81,e.t3=e.catch(76),e.next=85,handleError(t,r,e.t3,i);case 85:if(!r.core.debug){e.next=89;break}throw e.t2;case 89:console.error(e.t2);case 90:process.exit(1);case 91:case"end":return e.stop()}}),e,null,[[18,71],[31,37],[58,63],[76,81]])})));return function(){return e.apply(this,arguments)}}();(__webpack_require__.c[__webpack_require__.s]===module||eval("require.main")!==__webpack_require__.c[__webpack_require__.s]&&"undefined"!=typeof ORIGINAL_MAIN_MODULE&&ORIGINAL_MAIN_MODULE===eval("require.main"))&&main();const __WEBPACK_DEFAULT_EXPORT__=main},e=>{e.exports=require("@babel/runtime/helpers/asyncToGenerator")},e=>{e.exports=require("@babel/runtime/regenerator")},e=>{e.exports=require("clientnode")},e=>{e.exports=require("fs")},e=>{e.exports=require("path")},e=>{e.exports=require("child_process")},e=>{e.exports=require("module")}],__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.c=__webpack_module_cache__,__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(__webpack_require__.s=2);module.exports=__webpack_exports__})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.435",
|
|
4
4
|
"description": "High level javaScript backend plugin system and configuration merger.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/thaibault/web-node.git"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "
|
|
40
|
+
"build": "yarn build:types; yarn build:plain",
|
|
41
41
|
"build:plain": "weboptimizer build",
|
|
42
42
|
"build:types": "weboptimizer build:types",
|
|
43
43
|
"check": "yarn check:types; yarn lint",
|
package/pluginAPI.d.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Encoding, Mapping, RecursiveEvaluateable } from 'clientnode/type';
|
|
3
|
+
import { Configuration, EvaluateablePartialConfiguration, MetaPluginConfiguration, PackageConfiguration, Plugin, PluginChange } from './type';
|
|
4
|
+
export declare const currentRequire: NodeRequire;
|
|
5
|
+
/**
|
|
6
|
+
* A dumm plugin interface with all available hooks.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PluginAPI {
|
|
9
|
+
/**
|
|
10
|
+
* Calls all plugin methods for given trigger description asynchronous and
|
|
11
|
+
* waits for their resolved promises.
|
|
12
|
+
* @param this - Nothing.
|
|
13
|
+
* @param hook - Type of trigger.
|
|
14
|
+
* @param plugins - List of plugins to search for trigger callbacks in.
|
|
15
|
+
* @param configuration - Plugin extendable configuration object.
|
|
16
|
+
* @param data - Data to pipe throw all plugins and resolve after all
|
|
17
|
+
* plugins have been resolved.
|
|
18
|
+
* @param parameters - Additional parameters to forward into plugin api.
|
|
19
|
+
*
|
|
20
|
+
* @returns A promise which resolves when all callbacks have resolved their
|
|
21
|
+
* promise holding given potentially modified data.
|
|
22
|
+
*/
|
|
23
|
+
static callStack<Input = unknown, Result = unknown>(this: void, hook: string, plugins: Array<Plugin>, configuration: Configuration, data?: Input, ...parameters: Array<unknown>): Promise<Result>;
|
|
24
|
+
/**
|
|
25
|
+
* Calls all plugin methods for given trigger description synchronous.
|
|
26
|
+
* @param this - Nothing.
|
|
27
|
+
* @param hook - Hook to trigger.
|
|
28
|
+
* @param plugins - List of plugins to search for trigger callbacks in.
|
|
29
|
+
* @param configuration - Plugin extendable configuration object.
|
|
30
|
+
* @param data - Data to pipe throw all plugins and resolve after all
|
|
31
|
+
* plugins have been resolved.
|
|
32
|
+
* @param parameters - Additional parameters to forward into plugin api.
|
|
33
|
+
*
|
|
34
|
+
* @returns Given potentially modified data.
|
|
35
|
+
*/
|
|
36
|
+
static callStackSynchronous<Input = unknown, Result = unknown>(this: void, hook: string, plugins: Array<Plugin>, configuration: Configuration, data?: Input, ...parameters: Array<unknown>): Result;
|
|
37
|
+
/**
|
|
38
|
+
* Converts given plugin name into the corresponding internal
|
|
39
|
+
* representation.
|
|
40
|
+
* @param this - Nothing.
|
|
41
|
+
* @param name - Name to convert.
|
|
42
|
+
* @param regularExpression - Regular expression pattern which extracts
|
|
43
|
+
* relevant name path as first match group.
|
|
44
|
+
*
|
|
45
|
+
* @returns Transformed name.
|
|
46
|
+
*/
|
|
47
|
+
static determineInternalName(this: void, name: string, regularExpression: RegExp): string;
|
|
48
|
+
/**
|
|
49
|
+
* Evaluates given configuration object by letting plugins package sub
|
|
50
|
+
* structure untouched.
|
|
51
|
+
* @param this - Nothing.
|
|
52
|
+
* @param configuration - Evaluateable configuration structure.
|
|
53
|
+
*
|
|
54
|
+
* @returns Resolved configuration.
|
|
55
|
+
*/
|
|
56
|
+
static evaluateConfiguration<Type = Configuration>(this: void, configuration: RecursiveEvaluateable<Type> | Type): Type;
|
|
57
|
+
/**
|
|
58
|
+
* Checks for changed plugin api file in given plugins and reloads them
|
|
59
|
+
* if necessary (new timestamp).
|
|
60
|
+
* @param this - Nothing.
|
|
61
|
+
* @param plugins - List of plugins to search for updates in.
|
|
62
|
+
*
|
|
63
|
+
* @returns A list with plugins which have a changed api scope.
|
|
64
|
+
*/
|
|
65
|
+
static hotReloadAPIFile(this: void, plugins: Array<Plugin>): Array<Plugin>;
|
|
66
|
+
/**
|
|
67
|
+
* Checks for changed plugin configurations in given plugins and reloads
|
|
68
|
+
* them if necessary (new timestamp).
|
|
69
|
+
* @param this - Nothing.
|
|
70
|
+
* @param plugins - List of plugins to search for updates in.
|
|
71
|
+
* @param configurationPropertyNames - Property names to search for to use
|
|
72
|
+
* as entry in plugin configuration file.
|
|
73
|
+
*
|
|
74
|
+
* @returns A list with plugins which have a changed configurations.
|
|
75
|
+
*/
|
|
76
|
+
static hotReloadConfigurationFile(this: void, plugins: Array<Plugin>, configurationPropertyNames: Array<string>): Array<Plugin>;
|
|
77
|
+
/**
|
|
78
|
+
* Checks for changed plugin file type in given plugins and reloads them
|
|
79
|
+
* if necessary (timestamp has changed).
|
|
80
|
+
* @param this - Nothing.
|
|
81
|
+
* @param type - Plugin file type to search for updates.
|
|
82
|
+
* @param target - Property name existing in plugin meta informations
|
|
83
|
+
* objects which should be updated.
|
|
84
|
+
* @param plugins - List of plugins to search for updates in.
|
|
85
|
+
*
|
|
86
|
+
* @returns A list with plugin changes.
|
|
87
|
+
*/
|
|
88
|
+
static hotReloadFiles(this: void, type: 'api' | 'configuration', target: 'packageConfiguration' | 'scope', plugins: Array<Plugin>): Array<PluginChange>;
|
|
89
|
+
/**
|
|
90
|
+
* Extends given configuration object with given plugin specific ones and
|
|
91
|
+
* returns a plugin specific meta information object.
|
|
92
|
+
* @param this - Nothing.
|
|
93
|
+
* @param name - Name of plugin to extend.
|
|
94
|
+
* @param internalName - Internal name of plugin to extend.
|
|
95
|
+
* @param plugins - List of all yet determined plugin informations.
|
|
96
|
+
* @param metaConfiguration - Configuration file configuration.
|
|
97
|
+
* @param pluginPath - Path to given plugin.
|
|
98
|
+
* @param encoding - Encoding to use to read and write from child
|
|
99
|
+
* process's.
|
|
100
|
+
*
|
|
101
|
+
* @returns An object of plugin specific meta informations.
|
|
102
|
+
*/
|
|
103
|
+
static load(this: void, name: string, internalName: string, plugins: Mapping<Plugin>, metaConfiguration: MetaPluginConfiguration, pluginPath: string, encoding?: Encoding): Promise<Plugin>;
|
|
104
|
+
/**
|
|
105
|
+
* Load given plugin api file in given path and generates a plugin
|
|
106
|
+
* specific data structure with useful meta informations.
|
|
107
|
+
* @param this - Nothing.
|
|
108
|
+
* @param relativeFilePaths - Paths to file to load relatively from given
|
|
109
|
+
* plugin path.
|
|
110
|
+
* @param pluginPath - Path to plugin directory.
|
|
111
|
+
* @param name - Plugin name to use for proper error messages.
|
|
112
|
+
* @param internalName - Internal plugin name to use for proper error
|
|
113
|
+
* messages.
|
|
114
|
+
* @param plugins - List of plugins to search for trigger callbacks in.
|
|
115
|
+
* @param encoding - Encoding to use to read and write from child
|
|
116
|
+
* process.
|
|
117
|
+
* @param configuration - Plugin specific configurations.
|
|
118
|
+
* @param configurationFilePaths - Plugin specific configuration file
|
|
119
|
+
* paths.
|
|
120
|
+
*
|
|
121
|
+
* @returns Plugin meta informations object.
|
|
122
|
+
*/
|
|
123
|
+
static loadAPI(this: void, relativeFilePaths: Array<string>, pluginPath: string, name: string, internalName: string, plugins: Mapping<Plugin>, encoding?: Encoding, configuration?: null | EvaluateablePartialConfiguration, configurationFilePaths?: Array<string>): Promise<Plugin>;
|
|
124
|
+
/**
|
|
125
|
+
* Loads plugin specific configuration object.
|
|
126
|
+
* @param this - Nothing.
|
|
127
|
+
* @param name - Property name where to inject resolved configuration into
|
|
128
|
+
* global one.
|
|
129
|
+
* @param packageConfiguration - Plugin specific package configuration
|
|
130
|
+
* object.
|
|
131
|
+
* @param configurationPropertyNames - Property names to search for to use
|
|
132
|
+
* as entry in plugin configuration file.
|
|
133
|
+
*
|
|
134
|
+
* @returns Determined configuration object.
|
|
135
|
+
*/
|
|
136
|
+
static loadConfiguration(this: void, name: string, packageConfiguration: PackageConfiguration, configurationPropertyNames: Array<string>): EvaluateablePartialConfiguration;
|
|
137
|
+
/**
|
|
138
|
+
* Loads given plugin configurations into global configuration.
|
|
139
|
+
* @param this - Nothing.
|
|
140
|
+
* @param plugins - Topological sorted list of plugins to check for
|
|
141
|
+
* configurations.
|
|
142
|
+
* @param configuration - Global configuration to extend with.
|
|
143
|
+
*
|
|
144
|
+
* @returns Updated given configuration object.
|
|
145
|
+
*/
|
|
146
|
+
static loadConfigurations(this: void, plugins: Array<Plugin>, configuration: Configuration): Configuration;
|
|
147
|
+
/**
|
|
148
|
+
* Load given api file path and returns exported scope.
|
|
149
|
+
* @param this - Nothing.
|
|
150
|
+
* @param filePath - Path to file to load.
|
|
151
|
+
* @param name - Plugin name to use for proper error messages.
|
|
152
|
+
* @param fallbackScope - Scope to return if an error occurs during
|
|
153
|
+
* loading. If a "null" is given an error will be thrown.
|
|
154
|
+
* @param log - Enables logging.
|
|
155
|
+
*
|
|
156
|
+
* @returns Exported api file scope.
|
|
157
|
+
*/
|
|
158
|
+
static loadFile(this: void, filePath: string, name: string, fallbackScope?: null | object, log?: boolean): object;
|
|
159
|
+
/**
|
|
160
|
+
* Extends given configuration object with all plugin specific ones and
|
|
161
|
+
* returns a topological sorted list of plugins with plugins specific
|
|
162
|
+
* meta informations stored.
|
|
163
|
+
* @param this - Nothing.
|
|
164
|
+
* @param configuration - Configuration object to extend and use.
|
|
165
|
+
*
|
|
166
|
+
* @returns A topological sorted list of plugins objects.
|
|
167
|
+
*/
|
|
168
|
+
static loadAll(this: void, configuration: Configuration): Promise<{
|
|
169
|
+
configuration: Configuration;
|
|
170
|
+
plugins: Array<Plugin>;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Transform a list of absolute paths respecting the application context.
|
|
174
|
+
* @param this - Nothing.
|
|
175
|
+
* @param configuration - Configuration object.
|
|
176
|
+
* @param locations - Locations to process.
|
|
177
|
+
*
|
|
178
|
+
* @returns Given and processed locations.
|
|
179
|
+
*/
|
|
180
|
+
static determineLocations(this: void, configuration: Configuration, locations?: Array<string> | string): Array<string>;
|
|
181
|
+
/**
|
|
182
|
+
* Ignore absolute defined locations (relativ to application context) and
|
|
183
|
+
* relative defined in each loaded plugin location.
|
|
184
|
+
* @param this - Nothing.
|
|
185
|
+
* @param configuration - Configuration object.
|
|
186
|
+
* @param plugins - List of acctive plugins.
|
|
187
|
+
* @param filePath - Path to search for.
|
|
188
|
+
* @param locations - Locations to search in.
|
|
189
|
+
*
|
|
190
|
+
* @returns A boolean indicating whether given file path is in provided
|
|
191
|
+
* locations.
|
|
192
|
+
*/
|
|
193
|
+
static isInLocations(this: void, configuration: Configuration, plugins: Array<Plugin>, filePath: string, locations: Array<string> | string): boolean;
|
|
194
|
+
}
|
|
195
|
+
export default PluginAPI;
|
package/type.d.ts
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Tools from 'clientnode';
|
|
3
|
+
import { Encoding, Mapping, RecursiveEvaluateable, RecursivePartial } from 'clientnode/type';
|
|
4
|
+
import { PluginAPI } from './pluginAPI';
|
|
5
|
+
export interface EvaluateConfigurationScope {
|
|
6
|
+
currentPath: string;
|
|
7
|
+
fileSystem: typeof import('fs');
|
|
8
|
+
path: typeof import('path');
|
|
9
|
+
PluginAPI: PluginAPI;
|
|
10
|
+
require: typeof require;
|
|
11
|
+
Tools: typeof Tools;
|
|
12
|
+
webNodePath: string;
|
|
13
|
+
now: Date;
|
|
14
|
+
nowUTCTimestamp: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MetaPluginConfiguration {
|
|
17
|
+
fileNames: Array<string>;
|
|
18
|
+
propertyNames: Array<string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* NOTE: This interface should be extended by plugins to specify their
|
|
22
|
+
* configuration schema.
|
|
23
|
+
* Can be recursive evaluateable.
|
|
24
|
+
*/
|
|
25
|
+
export interface PluginConfiguration {
|
|
26
|
+
dependencies?: Array<string>;
|
|
27
|
+
name?: string;
|
|
28
|
+
package: PackageConfiguration;
|
|
29
|
+
}
|
|
30
|
+
export interface WebNodeConfiguration extends PluginConfiguration {
|
|
31
|
+
context: {
|
|
32
|
+
path: string;
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
debug: boolean;
|
|
36
|
+
encoding: Encoding;
|
|
37
|
+
interDependencies: Mapping<Array<string> | string>;
|
|
38
|
+
name: string;
|
|
39
|
+
plugin: {
|
|
40
|
+
configuration: MetaPluginConfiguration;
|
|
41
|
+
directories: Mapping<{
|
|
42
|
+
nameRegularExpressionPattern: string;
|
|
43
|
+
path: string;
|
|
44
|
+
}>;
|
|
45
|
+
hotReloading: boolean;
|
|
46
|
+
};
|
|
47
|
+
runtimeConfiguration?: EvaluateablePartialConfiguration;
|
|
48
|
+
}
|
|
49
|
+
export declare type Configuration<PluginConfigurationType = Mapping<unknown>> = {
|
|
50
|
+
core: WebNodeConfiguration;
|
|
51
|
+
name: string;
|
|
52
|
+
} & PluginConfigurationType & Mapping<PluginConfiguration>;
|
|
53
|
+
export declare type EvaluateablePartialConfiguration = {
|
|
54
|
+
core?: RecursiveEvaluateable<RecursivePartial<WebNodeConfiguration>>;
|
|
55
|
+
name?: string;
|
|
56
|
+
} & Mapping<PluginConfiguration>;
|
|
57
|
+
export declare type PackageConfiguration = Mapping<unknown> & {
|
|
58
|
+
documentationWebsite?: {
|
|
59
|
+
name?: string;
|
|
60
|
+
};
|
|
61
|
+
main?: string;
|
|
62
|
+
name?: string;
|
|
63
|
+
webnode?: EvaluateablePartialConfiguration;
|
|
64
|
+
webNode?: EvaluateablePartialConfiguration;
|
|
65
|
+
webNodeInternalName?: string;
|
|
66
|
+
'web-node'?: EvaluateablePartialConfiguration;
|
|
67
|
+
};
|
|
68
|
+
export declare type APIFunction = null | ((_hook: string, _data: unknown, ..._parameters: Array<unknown>) => unknown);
|
|
69
|
+
export interface Plugin {
|
|
70
|
+
api: APIFunction;
|
|
71
|
+
apiFilePaths: Array<string>;
|
|
72
|
+
apiFileLoadTimestamps: Array<number>;
|
|
73
|
+
configuration: EvaluateablePartialConfiguration;
|
|
74
|
+
configurationFilePaths: Array<string>;
|
|
75
|
+
configurationFileLoadTimestamps: Array<number>;
|
|
76
|
+
dependencies: Array<string>;
|
|
77
|
+
internalName: string;
|
|
78
|
+
name: string;
|
|
79
|
+
packageConfiguration: PackageConfiguration;
|
|
80
|
+
path: string;
|
|
81
|
+
scope: null | object;
|
|
82
|
+
}
|
|
83
|
+
export interface PluginChange {
|
|
84
|
+
newScope: object;
|
|
85
|
+
oldScope: null | object;
|
|
86
|
+
plugin: Plugin;
|
|
87
|
+
target: 'packageConfiguration' | 'scope';
|
|
88
|
+
}
|
|
89
|
+
export interface Service<Type = unknown> {
|
|
90
|
+
name: string;
|
|
91
|
+
promise: null | Promise<Type>;
|
|
92
|
+
}
|
|
93
|
+
export declare type Services<PluginServiceType = Mapping<unknown>> = Mapping<unknown> & PluginServiceType;
|
|
94
|
+
export declare type ServicePromises<PluginPromiseType = Mapping<unknown>> = Mapping<Promise<unknown>> & PluginPromiseType;
|
|
95
|
+
export interface PluginHandler {
|
|
96
|
+
/**
|
|
97
|
+
* Application started, static configuration loaded and all available
|
|
98
|
+
* plugins are determined and sorted in there dependency specific
|
|
99
|
+
* typological order. Asynchronous tasks are allowed and a returning
|
|
100
|
+
* promise will be respected.
|
|
101
|
+
* @param _configuration - Mutable configuration object. Extended by each
|
|
102
|
+
* plugin specific configuration.
|
|
103
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
104
|
+
* @param _pluginAPI - Plugin api reference.
|
|
105
|
+
*
|
|
106
|
+
* @returns Will be ignored.
|
|
107
|
+
*/
|
|
108
|
+
initialize?(_configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Array<Plugin>>;
|
|
109
|
+
/**
|
|
110
|
+
* Triggered hook when at least one plugin has a new configuration file and
|
|
111
|
+
* configuration object has been changed. Asynchronous tasks are allowed
|
|
112
|
+
* and a returning promise will be respected.
|
|
113
|
+
* @param _configuration - Configuration object to update.
|
|
114
|
+
* @param _pluginsWithChangedConfiguration - List of plugins which have a
|
|
115
|
+
* changed plugin configuration.
|
|
116
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
117
|
+
* @param _pluginAPI - Plugin api reference.
|
|
118
|
+
*
|
|
119
|
+
* @returns New configuration object to use.
|
|
120
|
+
*/
|
|
121
|
+
preConfigurationLoaded?(_configuration: Configuration, _pluginsWithChangedConfiguration: Array<Plugin>, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Configuration>;
|
|
122
|
+
/**
|
|
123
|
+
* Triggered hook when at least one plugin has a new configuration file and
|
|
124
|
+
* configuration object has been changed. Asynchronous tasks are allowed
|
|
125
|
+
* and a returning promise will be respected.
|
|
126
|
+
* @param _configuration - Updated configuration object.
|
|
127
|
+
* @param _pluginsWithChangedConfiguration - List of plugins which have a
|
|
128
|
+
* changed plugin configuration.
|
|
129
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
130
|
+
* @param _pluginAPI - Plugin api reference.
|
|
131
|
+
*
|
|
132
|
+
* @returns New configuration object to use.
|
|
133
|
+
*/
|
|
134
|
+
postConfigurationLoaded?(_configuration: Configuration, _pluginsWithChangedConfiguration: Array<Plugin>, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Configuration>;
|
|
135
|
+
/**
|
|
136
|
+
* Plugins are initialized now and plugins should initialize their
|
|
137
|
+
* continues running services (if they have one). Asynchronous tasks are
|
|
138
|
+
* allowed and a returning promise will be respected.
|
|
139
|
+
* @param _services - An object with stored service instances.
|
|
140
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
141
|
+
* specific configuration.
|
|
142
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
143
|
+
* @param _pluginAPI - Plugin api reference.
|
|
144
|
+
*
|
|
145
|
+
* @returns Given and maybe extended object of services.
|
|
146
|
+
*/
|
|
147
|
+
preLoadService?(_services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Services>;
|
|
148
|
+
/**
|
|
149
|
+
* Plugins are initialized now and plugins should initialize their
|
|
150
|
+
* continues running services (if they have one). Asynchronous tasks are
|
|
151
|
+
* allowed and a returning promise will be respected.
|
|
152
|
+
* @param _services - An object with stored service instances.
|
|
153
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
154
|
+
* specific configuration.
|
|
155
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
156
|
+
* @param _pluginAPI - Plugin api reference.
|
|
157
|
+
*
|
|
158
|
+
* @returns Given and maybe extended object of services.
|
|
159
|
+
*/
|
|
160
|
+
/**
|
|
161
|
+
* Plugins have initialized their continues running service and should
|
|
162
|
+
* start them now. A Promise which observes this service should be
|
|
163
|
+
* returned. Asynchronous tasks are allowed and a returning promise will be
|
|
164
|
+
* respected NOTE: You have to wrap a promise in a promise if a continues
|
|
165
|
+
* service should be registered.
|
|
166
|
+
* @param _servicePromises - An intermediate object with yet stored service
|
|
167
|
+
* promise instances.
|
|
168
|
+
* @param _services - An object with stored service instances.
|
|
169
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
170
|
+
* specific configuration.
|
|
171
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
172
|
+
* @param _pluginAPI - Plugin api reference.
|
|
173
|
+
*
|
|
174
|
+
* @returns A promise which correspond to the plugin specific continues
|
|
175
|
+
* service.
|
|
176
|
+
*/
|
|
177
|
+
loadService?(_servicePromises: ServicePromises, _services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<null | Service>;
|
|
178
|
+
/**
|
|
179
|
+
* Plugins have launched their continues running services and returned a
|
|
180
|
+
* corresponding promise which can be observed here.
|
|
181
|
+
* @param _services - An object with stored service instances.
|
|
182
|
+
* @param _servicePromises - An object with stored service promise
|
|
183
|
+
* instances.
|
|
184
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
185
|
+
* specific configuration.
|
|
186
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
187
|
+
* @param _pluginAPI - Plugin api reference.
|
|
188
|
+
*
|
|
189
|
+
* @returns Given and maybe extended object of services.
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Plugins have launched their continues running services and returned a
|
|
193
|
+
* corresponding promise which can be observed here.
|
|
194
|
+
* @param _servicePromises - An object with stored service promise
|
|
195
|
+
* instances.
|
|
196
|
+
* @param _services - An object with stored service instances.
|
|
197
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
198
|
+
* specific configuration.
|
|
199
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
200
|
+
* @param _pluginAPI - Plugin api reference.
|
|
201
|
+
*
|
|
202
|
+
* @returns Given and maybe extended object of services.
|
|
203
|
+
*/
|
|
204
|
+
postLoadService?(_servicePromises: ServicePromises, _services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<ServicePromises>;
|
|
205
|
+
/**
|
|
206
|
+
* Triggered hook when at least one plugin has an api file which has been
|
|
207
|
+
* changed and is reloaded. Asynchronous tasks are allowed and a returning
|
|
208
|
+
* promise will be respected.
|
|
209
|
+
* @param _pluginsWithChangedAPIFiles - List of plugins which have a
|
|
210
|
+
* changed plugin api file.
|
|
211
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
212
|
+
* specific configuration.
|
|
213
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
214
|
+
* @param _pluginAPI - Plugin api reference.
|
|
215
|
+
*
|
|
216
|
+
* @returns Will be ignored.
|
|
217
|
+
*/
|
|
218
|
+
apiFileReloaded?(_pluginsWithChangedAPIFiles: Array<Plugin>, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Array<Plugin>>;
|
|
219
|
+
/**
|
|
220
|
+
* Application has thrown an error and will be closed soon. Asynchronous
|
|
221
|
+
* tasks are allowed and a returning promise will be respected.
|
|
222
|
+
* @param _error - An object with stored informations why an error occurs.
|
|
223
|
+
* @param _services - An object with stored service instances.
|
|
224
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
225
|
+
* specific configuration.
|
|
226
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
227
|
+
* @param _pluginAPI - Plugin api reference.
|
|
228
|
+
*
|
|
229
|
+
* @returns Given and maybe changed object of services.
|
|
230
|
+
*/
|
|
231
|
+
error?(_error: object, _services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Services>;
|
|
232
|
+
/**
|
|
233
|
+
* Triggers if application will be closed soon. Asynchronous tasks are
|
|
234
|
+
* allowed and a returning promise will be respected.
|
|
235
|
+
* @param _services - An object with stored service instances.
|
|
236
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
237
|
+
* specific configuration.
|
|
238
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
239
|
+
* @param _pluginAPI - Plugin api reference.
|
|
240
|
+
*
|
|
241
|
+
* @returns Given and maybe changed object of services.
|
|
242
|
+
*/
|
|
243
|
+
shouldExit?(_services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Promise<Services>;
|
|
244
|
+
/**
|
|
245
|
+
* Triggers if application will be closed immediately no asynchronous tasks
|
|
246
|
+
* allowed anymore.
|
|
247
|
+
* @param _services - An object with stored service instances.
|
|
248
|
+
* @param _configuration - Configuration object extended by each plugin
|
|
249
|
+
* specific configuration.
|
|
250
|
+
* @param _plugins - Topological sorted list of plugins.
|
|
251
|
+
* @param _pluginAPI - Plugin api reference.
|
|
252
|
+
*
|
|
253
|
+
* @returns Given and maybe changed object of services.
|
|
254
|
+
*/
|
|
255
|
+
exit?(_services: Services, _configuration: Configuration, _plugins: Array<Plugin>, _pluginAPI: typeof PluginAPI): Services;
|
|
256
|
+
}
|
package/unixCrypt.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implements the Unix crypt(3) DES-based hash.
|
|
3
|
+
* @param givenPassword - The string to hash.
|
|
4
|
+
* @param givenSalt - The salt to use (two character string from
|
|
5
|
+
* [a-zA-Z0-9./]).
|
|
6
|
+
* @param returnBytes - If "true", return an array of bytes or a string
|
|
7
|
+
* otherwise.
|
|
8
|
+
*
|
|
9
|
+
* @returns Returns crypted or encrypted buffer or string.
|
|
10
|
+
*/
|
|
11
|
+
export declare function unixCrypt(givenPassword: Array<number> | string, givenSalt?: Array<number> | string, returnBytes?: boolean): Array<number> | string;
|
|
12
|
+
export default unixCrypt;
|