web-node 1.0.604 → 1.0.606
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.js +15 -6
- package/main.js +12 -6
- package/package.json +3 -3
- package/pluginAPI.d.ts +10 -2
- package/type.d.ts +5 -1
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
21
21
|
/* harmony export */ Gy: () => (/* binding */ determineInternalName),
|
|
22
22
|
/* harmony export */ Hh: () => (/* binding */ load),
|
|
23
23
|
/* harmony export */ MM: () => (/* binding */ pluginAPI),
|
|
24
|
+
/* harmony export */ Oy: () => (/* binding */ createNativeAPIFactory),
|
|
24
25
|
/* harmony export */ Vx: () => (/* binding */ hotReloadConfigurationFile),
|
|
25
26
|
/* harmony export */ ZN: () => (/* binding */ loadFile),
|
|
26
27
|
/* harmony export */ dw: () => (/* binding */ hotReloadAPIFile),
|
|
@@ -162,6 +163,12 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
162
163
|
expressions therefore we can use the source configuration
|
|
163
164
|
afterward to extend the target configuration.
|
|
164
165
|
*/(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(packageConfiguration,sourceConfiguration),sourceConfiguration);configurationFilePaths.push(filePath);case 5:_context6.n=2;break;case 6:_context6.n=8;break;case 7:_context6.p=7;_t5=_context6.v;_iterator7.e(_t5);case 8:_context6.p=8;_iterator7.f();return _context6.f(8);case 9:apiFilePaths=["index.js"];if(!Object.keys(packageConfiguration).length){_context6.n=11;break}internalName=packageConfiguration.webNodeInternalName||internalName;configuration=loadConfiguration(internalName,packageConfiguration,metaConfiguration.propertyNames);if(configuration[internalName].package.main)apiFilePaths[0]=configuration[internalName].package.main;_context6.n=10;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths);case 10:return _context6.a(2,_context6.v);case 11:_context6.n=12;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding);case 12:return _context6.a(2,_context6.v)}},_callee6,null,[[1,7,8,9]])}));function load(_x9,_x0,_x1,_x10,_x11,_x12){return _load.apply(this,arguments)}return load}();/**
|
|
166
|
+
* Creates a function callable by plugin api which calls the corresponding
|
|
167
|
+
* plugin scope method.
|
|
168
|
+
* @param plugins - To search for plugin scope in.
|
|
169
|
+
* @param name - Name of plugin to search for.
|
|
170
|
+
* @returns A function which calls the corresponding plugin scope method.
|
|
171
|
+
*/var createNativeAPIFactory=function createNativeAPIFactory(plugins,name){return function(state){var _ref;for(var _len3=arguments.length,parameters=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){parameters[_key3-1]=arguments[_key3]}if(plugins[name].scope&&state.hook in plugins[name].scope)return(_ref=plugins[name].scope)[state.hook].apply(_ref,[state].concat(parameters,[module]));throw new Error("NotImplemented: API method \"".concat(state.hook,"\" is not ")+"implemented in plugin \"".concat(name,"\"."))}};/**
|
|
165
172
|
* Load given plugin api file in given path and generates a plugin specific
|
|
166
173
|
* data structure with useful meta information.
|
|
167
174
|
* @param relativeFilePaths - Paths to file to load relatively from given
|
|
@@ -180,7 +187,7 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
180
187
|
|
|
181
188
|
NOTE: One key is always there representing the whole package
|
|
182
189
|
configuration.
|
|
183
|
-
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t9){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t9=_context8.v;case 13:if(!_t9){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=
|
|
190
|
+
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t9){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t9=_context8.v;case 13:if(!_t9){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
184
191
|
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:{}});_t0=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t10=_context8.v.mtime.getTime();_t1=[_t10];_context8.n=17;break;case 16:_t1=[];case 17:_t11=_t1;_t12=api?[filePath]:[];_t13=pluginConfiguration;_t14=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:_t15=_context8.v;_t16=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName)&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t17=internalName;_t18=name;_t19=pluginConfiguration[internalName].package;_t20=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t21=_context8.v;_context8.n=21;break;case 20:_t21=null;case 21:_t22=_t21;return _context8.a(2,{api:_t0,apiFileLoadTimestamps:_t11,apiFilePaths:_t12,configuration:_t13,configurationFilePaths:_t14,configurationFileLoadTimestamps:_t15,dependencies:_t16,internalName:_t17,name:_t18,packageConfiguration:_t19,path:_t20,scope:_t22})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
185
192
|
* Loads plugin specific configuration object.
|
|
186
193
|
* @param name - Property name where to inject resolved configuration into
|
|
@@ -232,17 +239,17 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
232
239
|
|
|
233
240
|
if (reference)
|
|
234
241
|
// Clear the module cache.
|
|
235
|
-
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};
|
|
242
|
+
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context9.p=1;_context9.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context9.v;_context9.n=5;break;case 3:_context9.p=3;_t23=_context9.v;if(!fallbackScope){_context9.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)(_t23),". Using"),"fallback one.");_context9.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)(_t23)),{cause:_t23});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context9.n=6;break}return _context9.a(2,scope.default);case 6:return _context9.a(2,scope)}},_callee9,null,[[1,3]])}));function loadFile(_x22,_x23,_x24,_x25){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
236
243
|
* Extends given configuration object with all plugin specific ones and returns
|
|
237
244
|
* a topological sorted list of plugins with plugins specific meta information
|
|
238
245
|
* stored.
|
|
239
246
|
* @param configuration - Configuration object to extend and use.
|
|
240
247
|
* @returns A topological sorted list of plugins objects.
|
|
241
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var plugins,_i5,_Object$values,directory,compiledRegularExpression,_iterator1,_step1,pluginName,currentPluginPath,internalName,temporaryPlugins,
|
|
248
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var plugins,_i5,_Object$values,directory,compiledRegularExpression,_iterator1,_step1,pluginName,currentPluginPath,internalName,_i6,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfiguration,scope,_pluginName,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator10,_step10,_name2,sortedPlugins,_iterator11,_step11,_pluginName2,_i8,_Object$entries5,_Object$entries5$_i,_name3,_plugin2,_t24,_t25,_t26,_t27,_t28;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:plugins={};/*
|
|
242
249
|
Load main plugin configuration at first.
|
|
243
250
|
|
|
244
251
|
NOTE: If application's main is this itself avoid loading it twice.
|
|
245
|
-
*/if(!(configuration.name!=="web-node")){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp(configuration.core.plugin.directories.external.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i5=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i5<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i5];_context0.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context0.v){_context0.n=14;break}compiledRegularExpression=new RegExp(directory.nameRegularExpressionPattern);_t24=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator1=_t24(_context0.v);_context0.p=6;_iterator1.s();case 7:if((_step1=_iterator1.n()).done){_context0.n=11;break}pluginName=_step1.value;if(compiledRegularExpression.test(pluginName)){_context0.n=8;break}return _context0.a(3,10);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=9;return load(pluginName,internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 9:plugins[pluginName]=_context0.v;case 10:_context0.n=7;break;case 11:_context0.n=13;break;case 12:_context0.p=12;_t25=_context0.v;_iterator1.e(_t25);case 13:_context0.p=13;_iterator1.f();return _context0.f(13);case 14:_i5++;_context0.n=3;break;case 15:temporaryPlugins={};for(
|
|
252
|
+
*/if(!(configuration.name!=="web-node")){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp(configuration.core.plugin.directories.external.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i5=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i5<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i5];_context0.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context0.v){_context0.n=14;break}compiledRegularExpression=new RegExp(directory.nameRegularExpressionPattern);_t24=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator1=_t24(_context0.v);_context0.p=6;_iterator1.s();case 7:if((_step1=_iterator1.n()).done){_context0.n=11;break}pluginName=_step1.value;if(compiledRegularExpression.test(pluginName)){_context0.n=8;break}return _context0.a(3,10);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=9;return load(pluginName,internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 9:plugins[pluginName]=_context0.v;case 10:_context0.n=7;break;case 11:_context0.n=13;break;case 12:_context0.p=12;_t25=_context0.v;_iterator1.e(_t25);case 13:_context0.p=13;_iterator1.f();return _context0.f(13);case 14:_i5++;_context0.n=3;break;case 15:_i6=0,_Object$entries4=Object.entries(PLUGIN_LOADER);case 16:if(!(_i6<_Object$entries4.length)){_context0.n=20;break}_Object$entries4$_i=_slicedToArray(_Object$entries4[_i6],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_context0.n=17;return plugin.loadConfiguration();case 17:pluginConfiguration=_context0.v;_context0.n=18;return plugin.loadScope();case 18:scope=_context0.v;_pluginName=plugin.name||name;plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:[],apiFilePaths:[],configuration:pluginConfiguration,configurationFilePaths:[],configurationFileLoadTimestamps:[],dependencies:Object.prototype.hasOwnProperty.call(pluginConfiguration,_pluginName)&&pluginConfiguration[_pluginName].dependencies?pluginConfiguration[_pluginName].dependencies:[],internalName:_pluginName,name:name,packageConfiguration:pluginConfiguration[_pluginName].package,path:"",scope:scope};case 19:_i6++;_context0.n=16;break;case 20: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)){_iterator10=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){_name2=_step10.value;if(!temporaryPlugins[_plugin.internalName].includes(_name2))temporaryPlugins[_plugin.internalName].push(_name2)}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}}}sortedPlugins=[];_iterator11=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context0.p=21;_iterator11.s();case 22:if((_step11=_iterator11.n()).done){_context0.n=26;break}_pluginName2=_step11.value;_i8=0,_Object$entries5=Object.entries(plugins);case 23:if(!(_i8<_Object$entries5.length)){_context0.n=25;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName2)){_context0.n=24;break}sortedPlugins.push(_plugin2);return _context0.a(3,25);case 24:_i8++;_context0.n=23;break;case 25:_context0.n=22;break;case 26:_context0.n=28;break;case 27:_context0.p=27;_t26=_context0.v;_iterator11.e(_t26);case 28:_context0.p=28;_iterator11.f();return _context0.f(28);case 29:_context0.n=30;return loadConfigurations(sortedPlugins,configuration);case 30:_t27=_context0.v;_t28=sortedPlugins;return _context0.a(2,{configuration:_t27,plugins:_t28})}},_callee0,null,[[21,27,28,29],[6,12,13,14]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
246
253
|
* Transform a list of absolute paths respecting the application context.
|
|
247
254
|
* @param configuration - Configuration object.
|
|
248
255
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -369,6 +376,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
369
376
|
/* harmony export */ HF: () => (/* reexport safe */ _configurator_js__WEBPACK_IMPORTED_MODULE_0__.H),
|
|
370
377
|
/* harmony export */ Hh: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Hh),
|
|
371
378
|
/* harmony export */ MM: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.MM),
|
|
379
|
+
/* harmony export */ Oy: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Oy),
|
|
372
380
|
/* harmony export */ Rm: () => (/* binding */ log),
|
|
373
381
|
/* harmony export */ Vx: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Vx),
|
|
374
382
|
/* harmony export */ ZN: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.ZN),
|
|
@@ -440,7 +448,7 @@ __webpack_async_result__();
|
|
|
440
448
|
/* 7 */
|
|
441
449
|
/***/ ((module) => {
|
|
442
450
|
|
|
443
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
451
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.606","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"]},"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":"^(.+/)?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"}');
|
|
444
452
|
|
|
445
453
|
/***/ }),
|
|
446
454
|
/* 8 */
|
|
@@ -636,6 +644,7 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
636
644
|
/******/ const __webpack_exports__callStack = __webpack_exports__.lT;
|
|
637
645
|
/******/ const __webpack_exports__callStackSynchronous = __webpack_exports__.gl;
|
|
638
646
|
/******/ const __webpack_exports__configuration = __webpack_exports__.HF;
|
|
647
|
+
/******/ const __webpack_exports__createNativeAPIFactory = __webpack_exports__.Oy;
|
|
639
648
|
/******/ const __webpack_exports__default = __webpack_exports__.Ay;
|
|
640
649
|
/******/ const __webpack_exports__determineInternalName = __webpack_exports__.Gy;
|
|
641
650
|
/******/ const __webpack_exports__determineLocations = __webpack_exports__.m7;
|
|
@@ -655,5 +664,5 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
655
664
|
/******/ const __webpack_exports__log = __webpack_exports__.Rm;
|
|
656
665
|
/******/ const __webpack_exports__main = __webpack_exports__.iW;
|
|
657
666
|
/******/ const __webpack_exports__pluginAPI = __webpack_exports__.MM;
|
|
658
|
-
/******/ export { __webpack_exports__PLUGIN_LOADER as PLUGIN_LOADER, __webpack_exports__callStack as callStack, __webpack_exports__callStackSynchronous as callStackSynchronous, __webpack_exports__configuration as configuration, __webpack_exports__default as default, __webpack_exports__determineInternalName as determineInternalName, __webpack_exports__determineLocations as determineLocations, __webpack_exports__evaluateConfiguration as evaluateConfiguration, __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 };
|
|
667
|
+
/******/ export { __webpack_exports__PLUGIN_LOADER as PLUGIN_LOADER, __webpack_exports__callStack as callStack, __webpack_exports__callStackSynchronous as callStackSynchronous, __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__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 };
|
|
659
668
|
/******/
|
package/main.js
CHANGED
|
@@ -23,7 +23,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
23
23
|
/* harmony export */ gl: () => (/* binding */ callStackSynchronous),
|
|
24
24
|
/* harmony export */ lT: () => (/* binding */ _callStack)
|
|
25
25
|
/* harmony export */ });
|
|
26
|
-
/* unused harmony exports log, determineInternalName, evaluateConfiguration, hotReloadAPIFile, hotReloadConfigurationFile, hotReloadFiles, load, loadAPI, loadConfiguration, loadConfigurations, loadFile, determineLocations, isInLocations, pluginAPI */
|
|
26
|
+
/* unused harmony exports log, determineInternalName, evaluateConfiguration, hotReloadAPIFile, hotReloadConfigurationFile, hotReloadFiles, load, createNativeAPIFactory, loadAPI, loadConfiguration, loadConfigurations, loadFile, determineLocations, isInLocations, pluginAPI */
|
|
27
27
|
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
28
28
|
/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
29
29
|
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
|
|
@@ -152,6 +152,12 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
152
152
|
expressions therefore we can use the source configuration
|
|
153
153
|
afterward to extend the target configuration.
|
|
154
154
|
*/(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(packageConfiguration,sourceConfiguration),sourceConfiguration);configurationFilePaths.push(filePath);case 5:_context6.n=2;break;case 6:_context6.n=8;break;case 7:_context6.p=7;_t5=_context6.v;_iterator7.e(_t5);case 8:_context6.p=8;_iterator7.f();return _context6.f(8);case 9:apiFilePaths=["index.js"];if(!Object.keys(packageConfiguration).length){_context6.n=11;break}internalName=packageConfiguration.webNodeInternalName||internalName;configuration=loadConfiguration(internalName,packageConfiguration,metaConfiguration.propertyNames);if(configuration[internalName].package.main)apiFilePaths[0]=configuration[internalName].package.main;_context6.n=10;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths);case 10:return _context6.a(2,_context6.v);case 11:_context6.n=12;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding);case 12:return _context6.a(2,_context6.v)}},_callee6,null,[[1,7,8,9]])}));function load(_x9,_x0,_x1,_x10,_x11,_x12){return _load.apply(this,arguments)}return load}();/**
|
|
155
|
+
* Creates a function callable by plugin api which calls the corresponding
|
|
156
|
+
* plugin scope method.
|
|
157
|
+
* @param plugins - To search for plugin scope in.
|
|
158
|
+
* @param name - Name of plugin to search for.
|
|
159
|
+
* @returns A function which calls the corresponding plugin scope method.
|
|
160
|
+
*/var createNativeAPIFactory=function createNativeAPIFactory(plugins,name){return function(state){var _ref;for(var _len3=arguments.length,parameters=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){parameters[_key3-1]=arguments[_key3]}if(plugins[name].scope&&state.hook in plugins[name].scope)return(_ref=plugins[name].scope)[state.hook].apply(_ref,[state].concat(parameters,[module]));throw new Error("NotImplemented: API method \"".concat(state.hook,"\" is not ")+"implemented in plugin \"".concat(name,"\"."))}};/**
|
|
155
161
|
* Load given plugin api file in given path and generates a plugin specific
|
|
156
162
|
* data structure with useful meta information.
|
|
157
163
|
* @param relativeFilePaths - Paths to file to load relatively from given
|
|
@@ -170,7 +176,7 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
170
176
|
|
|
171
177
|
NOTE: One key is always there representing the whole package
|
|
172
178
|
configuration.
|
|
173
|
-
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t9){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t9=_context8.v;case 13:if(!_t9){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=
|
|
179
|
+
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t9){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t9=_context8.v;case 13:if(!_t9){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
174
180
|
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:{}});_t0=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t10=_context8.v.mtime.getTime();_t1=[_t10];_context8.n=17;break;case 16:_t1=[];case 17:_t11=_t1;_t12=api?[filePath]:[];_t13=pluginConfiguration;_t14=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:_t15=_context8.v;_t16=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName)&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t17=internalName;_t18=name;_t19=pluginConfiguration[internalName].package;_t20=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t21=_context8.v;_context8.n=21;break;case 20:_t21=null;case 21:_t22=_t21;return _context8.a(2,{api:_t0,apiFileLoadTimestamps:_t11,apiFilePaths:_t12,configuration:_t13,configurationFilePaths:_t14,configurationFileLoadTimestamps:_t15,dependencies:_t16,internalName:_t17,name:_t18,packageConfiguration:_t19,path:_t20,scope:_t22})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
175
181
|
* Loads plugin specific configuration object.
|
|
176
182
|
* @param name - Property name where to inject resolved configuration into
|
|
@@ -222,17 +228,17 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
222
228
|
|
|
223
229
|
if (reference)
|
|
224
230
|
// Clear the module cache.
|
|
225
|
-
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};
|
|
231
|
+
*/options={};if((0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(filePath)===".json")options.with={type:"json"};_context9.p=1;_context9.n=2;return import(/* webpackIgnore: true */"".concat(filePath,"?timestamp=").concat(String(Date.now())),options);case 2:scope=_context9.v;_context9.n=5;break;case 3:_context9.p=3;_t23=_context9.v;if(!fallbackScope){_context9.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)(_t23),". Using"),"fallback one.");_context9.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)(_t23)),{cause:_t23});case 5:if(!(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)){_context9.n=6;break}return _context9.a(2,scope.default);case 6:return _context9.a(2,scope)}},_callee9,null,[[1,3]])}));function loadFile(_x22,_x23,_x24,_x25){return _loadFile.apply(this,arguments)}return loadFile}();/**
|
|
226
232
|
* Extends given configuration object with all plugin specific ones and returns
|
|
227
233
|
* a topological sorted list of plugins with plugins specific meta information
|
|
228
234
|
* stored.
|
|
229
235
|
* @param configuration - Configuration object to extend and use.
|
|
230
236
|
* @returns A topological sorted list of plugins objects.
|
|
231
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var plugins,_i5,_Object$values,directory,compiledRegularExpression,_iterator1,_step1,pluginName,currentPluginPath,internalName,temporaryPlugins,
|
|
237
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var plugins,_i5,_Object$values,directory,compiledRegularExpression,_iterator1,_step1,pluginName,currentPluginPath,internalName,_i6,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfiguration,scope,_pluginName,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator10,_step10,_name2,sortedPlugins,_iterator11,_step11,_pluginName2,_i8,_Object$entries5,_Object$entries5$_i,_name3,_plugin2,_t24,_t25,_t26,_t27,_t28;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:plugins={};/*
|
|
232
238
|
Load main plugin configuration at first.
|
|
233
239
|
|
|
234
240
|
NOTE: If application's main is this itself avoid loading it twice.
|
|
235
|
-
*/if(!(configuration.name!=="web-node")){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp(configuration.core.plugin.directories.external.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i5=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i5<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i5];_context0.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context0.v){_context0.n=14;break}compiledRegularExpression=new RegExp(directory.nameRegularExpressionPattern);_t24=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator1=_t24(_context0.v);_context0.p=6;_iterator1.s();case 7:if((_step1=_iterator1.n()).done){_context0.n=11;break}pluginName=_step1.value;if(compiledRegularExpression.test(pluginName)){_context0.n=8;break}return _context0.a(3,10);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=9;return load(pluginName,internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 9:plugins[pluginName]=_context0.v;case 10:_context0.n=7;break;case 11:_context0.n=13;break;case 12:_context0.p=12;_t25=_context0.v;_iterator1.e(_t25);case 13:_context0.p=13;_iterator1.f();return _context0.f(13);case 14:_i5++;_context0.n=3;break;case 15:temporaryPlugins={};for(
|
|
241
|
+
*/if(!(configuration.name!=="web-node")){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp(configuration.core.plugin.directories.external.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i5=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i5<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i5];_context0.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context0.v){_context0.n=14;break}compiledRegularExpression=new RegExp(directory.nameRegularExpressionPattern);_t24=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator1=_t24(_context0.v);_context0.p=6;_iterator1.s();case 7:if((_step1=_iterator1.n()).done){_context0.n=11;break}pluginName=_step1.value;if(compiledRegularExpression.test(pluginName)){_context0.n=8;break}return _context0.a(3,10);case 8:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=9;return load(pluginName,internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 9:plugins[pluginName]=_context0.v;case 10:_context0.n=7;break;case 11:_context0.n=13;break;case 12:_context0.p=12;_t25=_context0.v;_iterator1.e(_t25);case 13:_context0.p=13;_iterator1.f();return _context0.f(13);case 14:_i5++;_context0.n=3;break;case 15:_i6=0,_Object$entries4=Object.entries(PLUGIN_LOADER);case 16:if(!(_i6<_Object$entries4.length)){_context0.n=20;break}_Object$entries4$_i=_slicedToArray(_Object$entries4[_i6],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_context0.n=17;return plugin.loadConfiguration();case 17:pluginConfiguration=_context0.v;_context0.n=18;return plugin.loadScope();case 18:scope=_context0.v;_pluginName=plugin.name||name;plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:[],apiFilePaths:[],configuration:pluginConfiguration,configurationFilePaths:[],configurationFileLoadTimestamps:[],dependencies:Object.prototype.hasOwnProperty.call(pluginConfiguration,_pluginName)&&pluginConfiguration[_pluginName].dependencies?pluginConfiguration[_pluginName].dependencies:[],internalName:_pluginName,name:name,packageConfiguration:pluginConfiguration[_pluginName].package,path:"",scope:scope};case 19:_i6++;_context0.n=16;break;case 20: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)){_iterator10=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){_name2=_step10.value;if(!temporaryPlugins[_plugin.internalName].includes(_name2))temporaryPlugins[_plugin.internalName].push(_name2)}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}}}sortedPlugins=[];_iterator11=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context0.p=21;_iterator11.s();case 22:if((_step11=_iterator11.n()).done){_context0.n=26;break}_pluginName2=_step11.value;_i8=0,_Object$entries5=Object.entries(plugins);case 23:if(!(_i8<_Object$entries5.length)){_context0.n=25;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName2)){_context0.n=24;break}sortedPlugins.push(_plugin2);return _context0.a(3,25);case 24:_i8++;_context0.n=23;break;case 25:_context0.n=22;break;case 26:_context0.n=28;break;case 27:_context0.p=27;_t26=_context0.v;_iterator11.e(_t26);case 28:_context0.p=28;_iterator11.f();return _context0.f(28);case 29:_context0.n=30;return loadConfigurations(sortedPlugins,configuration);case 30:_t27=_context0.v;_t28=sortedPlugins;return _context0.a(2,{configuration:_t27,plugins:_t28})}},_callee0,null,[[21,27,28,29],[6,12,13,14]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
236
242
|
* Transform a list of absolute paths respecting the application context.
|
|
237
243
|
* @param configuration - Configuration object.
|
|
238
244
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -410,7 +416,7 @@ __webpack_async_result__();
|
|
|
410
416
|
/* 7 */
|
|
411
417
|
/***/ ((module) => {
|
|
412
418
|
|
|
413
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
419
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.606","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"]},"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":"^(.+/)?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"}');
|
|
414
420
|
|
|
415
421
|
/***/ }),
|
|
416
422
|
/* 8 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.606",
|
|
4
4
|
"description": "High level javaScript backend plugin system and configuration merger.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/webpack-env": "^1.18.8",
|
|
75
75
|
"@typescript-eslint/eslint-plugin": "^8.69.0",
|
|
76
76
|
"@typescript-eslint/parser": "^8.69.0",
|
|
77
|
-
"clientnode": "^4.0.
|
|
77
|
+
"clientnode": "^4.0.1512",
|
|
78
78
|
"eslint": "^10.10.0",
|
|
79
79
|
"eslint-config-google": "^0.14.0",
|
|
80
80
|
"eslint-plugin-jsdoc": "^64.3.6",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"shx": "^0.4.0",
|
|
84
84
|
"typescript-eslint": "^8.69.0",
|
|
85
85
|
"web-documentation": "^1.0.52",
|
|
86
|
-
"weboptimizer": "^4.0.
|
|
86
|
+
"weboptimizer": "^4.0.78"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"clientnode": "*"
|
package/pluginAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Encoding, Mapping, RecursiveEvaluateable } from 'clientnode';
|
|
2
|
-
import type { BaseState, Configuration, EvaluateablePartialConfiguration, HookPromiseResult, MetaPluginConfiguration, PackageConfiguration, Plugin, PluginChange, PluginLoaderMapping, ServicePromisesState } from './type';
|
|
1
|
+
import type { Encoding, FirstParameter, Mapping, RecursiveEvaluateable } from 'clientnode';
|
|
2
|
+
import type { APIFunction, BaseState, Configuration, EvaluateablePartialConfiguration, HookPromiseResult, MetaPluginConfiguration, PackageConfiguration, Plugin, PluginChange, PluginLoaderMapping, ServicePromisesState } from './type';
|
|
3
3
|
import { Logger } from 'clientnode';
|
|
4
4
|
export declare const log: Logger;
|
|
5
5
|
export declare const PLUGIN_LOADER: PluginLoaderMapping;
|
|
@@ -72,6 +72,14 @@ export declare const hotReloadFiles: (type: 'api' | 'configuration', target: 'pa
|
|
|
72
72
|
* @returns An object of plugin specific meta information.
|
|
73
73
|
*/
|
|
74
74
|
export declare const load: (name: string, internalName: string, plugins: Mapping<Plugin>, metaConfiguration: MetaPluginConfiguration, pluginPath: string, encoding?: Encoding) => Promise<Plugin>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a function callable by plugin api which calls the corresponding
|
|
77
|
+
* plugin scope method.
|
|
78
|
+
* @param plugins - To search for plugin scope in.
|
|
79
|
+
* @param name - Name of plugin to search for.
|
|
80
|
+
* @returns A function which calls the corresponding plugin scope method.
|
|
81
|
+
*/
|
|
82
|
+
export declare const createNativeAPIFactory: (plugins: Mapping<Plugin>, name: string) => (state: FirstParameter<APIFunction>, ...parameters: Array<unknown>) => unknown;
|
|
75
83
|
/**
|
|
76
84
|
* Load given plugin api file in given path and generates a plugin specific
|
|
77
85
|
* data structure with useful meta information.
|
package/type.d.ts
CHANGED
|
@@ -84,7 +84,11 @@ export type HookPromiseResult<Type> = Promise<Type | {
|
|
|
84
84
|
promise: Type;
|
|
85
85
|
}>;
|
|
86
86
|
export type PluginPromises<Type extends Promise<unknown> = Promise<unknown>> = Mapping<null | Type>;
|
|
87
|
-
export type PluginLoaderMapping = Mapping<
|
|
87
|
+
export type PluginLoaderMapping = Mapping<{
|
|
88
|
+
name?: string;
|
|
89
|
+
loadConfiguration: () => Promise<EvaluateablePartialConfiguration>;
|
|
90
|
+
loadScope: () => Promise<object>;
|
|
91
|
+
}>;
|
|
88
92
|
export type Services<PluginServiceType = Mapping<unknown>> = Mapping<unknown> & PluginServiceType;
|
|
89
93
|
export type ServicePromises<PluginPromiseType = Mapping<unknown>> = Mapping<Promise<unknown>> & PluginPromiseType;
|
|
90
94
|
export interface BaseState<Type = undefined, ConfigurationType extends Configuration = Configuration> {
|