web-node 1.0.610 → 1.0.611
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 +10 -23
- package/main.js +10 -20
- package/package.json +1 -1
- package/pluginAPI.d.ts +0 -12
- package/type.d.ts +3 -2
package/index.js
CHANGED
|
@@ -21,7 +21,6 @@ __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 */ My: () => (/* binding */ determineInternalNameFromConfiguration),
|
|
25
24
|
/* harmony export */ Oy: () => (/* binding */ createNativeAPIFactory),
|
|
26
25
|
/* harmony export */ Vx: () => (/* binding */ hotReloadConfigurationFile),
|
|
27
26
|
/* harmony export */ ZN: () => (/* binding */ loadFile),
|
|
@@ -163,16 +162,6 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
163
162
|
therefore we can use the source configuration afterward to
|
|
164
163
|
extend the target configuration.
|
|
165
164
|
*/(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(packageConfiguration,configuration),configuration)}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}name=packageConfiguration.webNodeInternalName||name;return{name:name,configuration:loadConfiguration(name,packageConfiguration,propertyNames)}};/**
|
|
166
|
-
* Determines a plugins internal name from its already loaded configuration.
|
|
167
|
-
* NOTE: Plugins can specify an internal name deviating from their name via
|
|
168
|
-
* their "webNodeInternalName" package configuration property. Since only the
|
|
169
|
-
* plugin specific configuration section carries the corresponding package
|
|
170
|
-
* configuration we can use it to identify the plugin specific section.
|
|
171
|
-
* @param configuration - Already loaded plugin configuration.
|
|
172
|
-
* @param fallbackName - Internal name to use if given configuration does not
|
|
173
|
-
* provide any hint.
|
|
174
|
-
* @returns Determined internal name.
|
|
175
|
-
*/var determineInternalNameFromConfiguration=function determineInternalNameFromConfiguration(configuration,fallbackName){var hasPackageConfiguration=function hasPackageConfiguration(name){var subConfiguration=configuration[name];return _typeof(subConfiguration)==="object"&&subConfiguration!==null&&Object.prototype.hasOwnProperty.call(subConfiguration,"package")};if(hasPackageConfiguration(fallbackName))return fallbackName;for(var _i4=0,_Object$keys=Object.keys(configuration);_i4<_Object$keys.length;_i4++){var name=_Object$keys[_i4];if(hasPackageConfiguration(name))return name}return fallbackName};/**
|
|
176
165
|
* Extends given configuration object with given plugin specific ones and
|
|
177
166
|
* returns a plugin specific meta information object.
|
|
178
167
|
* @param name - Name of plugin to extend.
|
|
@@ -201,14 +190,14 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
201
190
|
* @param configuration - Plugin specific configurations.
|
|
202
191
|
* @param configurationFilePaths - Plugin specific configuration file paths.
|
|
203
192
|
* @returns Plugin meta information object.
|
|
204
|
-
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
193
|
+
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
205
194
|
NOTE: Check if a webNode plugin configuration is available
|
|
206
195
|
indicating a backend responsibility for api file.
|
|
207
196
|
|
|
208
197
|
NOTE: One key is always there representing the whole package
|
|
209
198
|
configuration.
|
|
210
199
|
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t0){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t0=_context8.v;case 13:if(!_t0){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
211
|
-
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:{}});_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=
|
|
200
|
+
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
212
201
|
* Loads plugin specific configuration object.
|
|
213
202
|
* @param name - Property name where to inject resolved configuration into
|
|
214
203
|
* global one.
|
|
@@ -232,7 +221,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
232
221
|
*/var loadConfigurations=function loadConfigurations(plugins,configuration){/*
|
|
233
222
|
First clear current configuration content key by key to let old top
|
|
234
223
|
level configuration object instance untouched.
|
|
235
|
-
*/for(var
|
|
224
|
+
*/for(var _i4=0,_Object$keys=Object.keys(configuration);_i4<_Object$keys.length;_i4++){var key=_Object$keys[_i4];delete configuration[key]};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(configuration,(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(_configurator_js__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A));var _iterator1=_createForOfIteratorHelper(plugins),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var plugin=_step1.value;if(Object.prototype.hasOwnProperty.call(plugin,"configuration")){var pluginConfiguration=(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(plugin.configuration);(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(configuration,pluginConfiguration),/*
|
|
236
225
|
NOTE: Should be resolved via preceding
|
|
237
226
|
"object.modifyObject" call.
|
|
238
227
|
*/pluginConfiguration);/*
|
|
@@ -265,11 +254,11 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
265
254
|
* stored.
|
|
266
255
|
* @param configuration - Configuration object to extend and use.
|
|
267
256
|
* @returns A topological sorted list of plugins objects.
|
|
268
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
257
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,_i5,_Object$entries4,_Object$entries4$_i,name,plugin,_combinePluginConfigu2,internalName,pluginConfiguration,hasPluginConfiguration,_i6,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator10,_step10,pluginName,currentPluginPath,_internalName,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator11,_step11,_name2,sortedPlugins,_iterator12,_step12,_pluginName,_i8,_Object$entries5,_Object$entries5$_i,_name3,_plugin2,_t25,_t26,_t27,_t28,_t29;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:plugins={};for(_i5=0,_Object$entries4=Object.entries(PLUGIN_LOADER);_i5<_Object$entries4.length;_i5++){_Object$entries4$_i=_slicedToArray(_Object$entries4[_i5],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_combinePluginConfigu2=combinePluginConfigurations(plugin.name,[].concat(plugin.configurations)),internalName=_combinePluginConfigu2.name,pluginConfiguration=_combinePluginConfigu2.configuration;hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:[],apiFilePaths:[],configuration:pluginConfiguration,configurationFilePaths:[],configurationFileLoadTimestamps:[],dependencies:hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[],internalName:internalName,name:name,packageConfiguration:hasPluginConfiguration?pluginConfiguration[internalName].package:{},path:"",scope:plugin.scope}}/*
|
|
258
|
+
Load main plugin configuration at first.
|
|
259
|
+
|
|
260
|
+
NOTE: If application's main is this itself avoid loading it twice.
|
|
261
|
+
*/if(!(configuration.name!=="web-node"&&Object.prototype.hasOwnProperty.call(plugins,configuration.name))){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp((_configuration$core$p=configuration.core.plugin.directories.external.nameRegularExpressionPattern)!==null&&_configuration$core$p!==void 0?_configuration$core$p:configuration.core.plugin.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i6=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i6<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i6];_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$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t25=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator10=_t25(_context0.v);_context0.p=6;_iterator10.s();case 7:if((_step10=_iterator10.n()).done){_context0.n=11;break}pluginName=_step10.value;if(!(Object.prototype.hasOwnProperty.call(plugins,pluginName)||!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;_t26=_context0.v;_iterator10.e(_t26);case 13:_context0.p=13;_iterator10.f();return _context0.f(13);case 14:_i6++;_context0.n=3;break;case 15: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)){_iterator11=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){_name2=_step11.value;if(!temporaryPlugins[_plugin.internalName].includes(_name2))temporaryPlugins[_plugin.internalName].push(_name2)}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}}}sortedPlugins=[];_iterator12=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context0.p=16;_iterator12.s();case 17:if((_step12=_iterator12.n()).done){_context0.n=21;break}_pluginName=_step12.value;_i8=0,_Object$entries5=Object.entries(plugins);case 18:if(!(_i8<_Object$entries5.length)){_context0.n=20;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName)){_context0.n=19;break}sortedPlugins.push(_plugin2);return _context0.a(3,20);case 19:_i8++;_context0.n=18;break;case 20:_context0.n=17;break;case 21:_context0.n=23;break;case 22:_context0.p=22;_t27=_context0.v;_iterator12.e(_t27);case 23:_context0.p=23;_iterator12.f();return _context0.f(23);case 24:_context0.n=25;return loadConfigurations(sortedPlugins,configuration);case 25:_t28=_context0.v;_t29=sortedPlugins;return _context0.a(2,{configuration:_t28,plugins:_t29})}},_callee0,null,[[16,22,23,24],[6,12,13,14]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
273
262
|
* Transform a list of absolute paths respecting the application context.
|
|
274
263
|
* @param configuration - Configuration object.
|
|
275
264
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -396,7 +385,6 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
396
385
|
/* harmony export */ HF: () => (/* reexport safe */ _configurator_js__WEBPACK_IMPORTED_MODULE_0__.H),
|
|
397
386
|
/* harmony export */ Hh: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Hh),
|
|
398
387
|
/* harmony export */ MM: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.MM),
|
|
399
|
-
/* harmony export */ My: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.My),
|
|
400
388
|
/* harmony export */ Oy: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Oy),
|
|
401
389
|
/* harmony export */ Rm: () => (/* binding */ log),
|
|
402
390
|
/* harmony export */ Vx: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Vx),
|
|
@@ -470,7 +458,7 @@ __webpack_async_result__();
|
|
|
470
458
|
/* 7 */
|
|
471
459
|
/***/ ((module) => {
|
|
472
460
|
|
|
473
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
461
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.611","description":"High level javaScript backend plugin system and configuration merger.","keywords":["api","backend","management","plugin","web"],"homepage":"https://torben.website/web-node","bugs":{"email":"info@torben.website","url":"https://github.com/thaibault/web-node/issues"},"license":"CC-BY-3.0","author":{"email":"info@torben.website","name":"Torben Sickert","url":"https://torben.website"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"type":"module","bin":"main.js","exports":{".":"./index.js","./main":"./main.js","./main.js":"./main.js","./package.json":"./package.json","./unixCrypt":"./unixCrypt.js","./unixCrypt.js":"./unixCrypt.js","./type":"./type.d.ts"},"files":["configurator.d.ts","index.d.ts","index.js","main.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"sideEffects":true,"scripts":{"build":"yarn build:types; yarn build:plain","build:plain":"weboptimizer build","build:types":"weboptimizer build:types","check":"yarn check:types; yarn lint","check:types":"weboptimizer check:types","clear":"weboptimizer clear","document":"weboptimizer document","lint":"weboptimizer lint","prepare":"yarn build","prepare:test":"yarn clear && cd dummyPlugin && shx touch yarn.lock && yarn build && cd ..","serve":"yarn build:plain && yarn start","start":"./main.js \'{plugin: {hotReloading: true}}\'","test":"yarn prepare:test && weboptimizer test","test:coverage":"yarn prepare:test && weboptimizer test:coverage","test:coverage:report":"yarn prepare:test && weboptimizer test:coverage:report","update:documentation":"web-documentation","watch":"weboptimizer build --watch"},"devDependencies":{"@babel/cli":"^8.0.4","@babel/eslint-parser":"^8.0.1","@eslint/js":"^10.0.1","@stylistic/eslint-plugin":"^5.10.0","@types/node":"^26.4.1","@types/webpack-env":"^1.18.8","@typescript-eslint/eslint-plugin":"^8.69.0","@typescript-eslint/parser":"^8.69.0","clientnode":"^4.0.1512","eslint":"^10.10.0","eslint-config-google":"^0.14.0","eslint-plugin-jsdoc":"^64.3.6","jest":"^30.5.1","jsdoc":"^4.0.5","shx":"^0.4.0","typescript-eslint":"^8.69.0","web-documentation":"^1.0.52","weboptimizer":"^4.0.78"},"peerDependencies":{"clientnode":"*"},"resolutions":{"colors":"1.4.0","globals@npm:^11.1.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^14.0.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^9.18.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch"},"engines":{"node":">=26","npm":">=12","yarn":">=4"},"webDocumentation":{"trackingCode":"UA-40192634-9"},"webNode":{"core":{"context":{"path":"./","type":"relative"},"debug":false,"encoding":"utf8","interDependencies":{},"name":"web-node","plugin":{"configuration":{"fileNames":["package.json","private-package.json"],"propertyNames":["webNode","webnode","web-node"]},"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","directories":{"external":{"path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?main\\\\.js$","pattern":{"#":"This is how we can make our main exported artefact executable.","__evaluate__":"`#!/usr/bin/env node\\n// -*- coding: utf-8 -*-\\n${self.generic.assetPattern?.javaScript?.pattern ?? \'\'}\\n{1}`"}}},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', main: \'./main.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"terser":{"terserOptions":{"compress":{"#":"To provide a logging output we need to exclude this feature.","drop_console":{"__evaluate__":"false"},"drop_debugger":{"__evaluate__":"false"}}}}}},"targetTechnology":{"boilerplate":"node","payload":"node"}},"packageManager":"yarn@4.18.0"}');
|
|
474
462
|
|
|
475
463
|
/***/ }),
|
|
476
464
|
/* 8 */
|
|
@@ -670,7 +658,6 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
670
658
|
/******/ const __webpack_exports__createNativeAPIFactory = __webpack_exports__.Oy;
|
|
671
659
|
/******/ const __webpack_exports__default = __webpack_exports__.Ay;
|
|
672
660
|
/******/ const __webpack_exports__determineInternalName = __webpack_exports__.Gy;
|
|
673
|
-
/******/ const __webpack_exports__determineInternalNameFromConfiguration = __webpack_exports__.My;
|
|
674
661
|
/******/ const __webpack_exports__determineLocations = __webpack_exports__.m7;
|
|
675
662
|
/******/ const __webpack_exports__evaluateConfiguration = __webpack_exports__.u2;
|
|
676
663
|
/******/ const __webpack_exports__hotReloadAPIFile = __webpack_exports__.dw;
|
|
@@ -688,5 +675,5 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
688
675
|
/******/ const __webpack_exports__log = __webpack_exports__.Rm;
|
|
689
676
|
/******/ const __webpack_exports__main = __webpack_exports__.iW;
|
|
690
677
|
/******/ const __webpack_exports__pluginAPI = __webpack_exports__.MM;
|
|
691
|
-
/******/ export { __webpack_exports__PLUGIN_LOADER as PLUGIN_LOADER, __webpack_exports__callStack as callStack, __webpack_exports__callStackSynchronous as callStackSynchronous, __webpack_exports__combinePluginConfigurations as combinePluginConfigurations, __webpack_exports__configuration as configuration, __webpack_exports__createNativeAPIFactory as createNativeAPIFactory, __webpack_exports__default as default, __webpack_exports__determineInternalName as determineInternalName,
|
|
678
|
+
/******/ export { __webpack_exports__PLUGIN_LOADER as PLUGIN_LOADER, __webpack_exports__callStack as callStack, __webpack_exports__callStackSynchronous as callStackSynchronous, __webpack_exports__combinePluginConfigurations as combinePluginConfigurations, __webpack_exports__configuration as configuration, __webpack_exports__createNativeAPIFactory as createNativeAPIFactory, __webpack_exports__default as default, __webpack_exports__determineInternalName as determineInternalName, __webpack_exports__determineLocations as determineLocations, __webpack_exports__evaluateConfiguration as evaluateConfiguration, __webpack_exports__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 };
|
|
692
679
|
/******/
|
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, combinePluginConfigurations,
|
|
26
|
+
/* unused harmony exports log, determineInternalName, evaluateConfiguration, hotReloadAPIFile, hotReloadConfigurationFile, hotReloadFiles, combinePluginConfigurations, 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);
|
|
@@ -150,16 +150,6 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
150
150
|
therefore we can use the source configuration afterward to
|
|
151
151
|
extend the target configuration.
|
|
152
152
|
*/(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(packageConfiguration,configuration),configuration)}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}name=packageConfiguration.webNodeInternalName||name;return{name:name,configuration:loadConfiguration(name,packageConfiguration,propertyNames)}};/**
|
|
153
|
-
* Determines a plugins internal name from its already loaded configuration.
|
|
154
|
-
* NOTE: Plugins can specify an internal name deviating from their name via
|
|
155
|
-
* their "webNodeInternalName" package configuration property. Since only the
|
|
156
|
-
* plugin specific configuration section carries the corresponding package
|
|
157
|
-
* configuration we can use it to identify the plugin specific section.
|
|
158
|
-
* @param configuration - Already loaded plugin configuration.
|
|
159
|
-
* @param fallbackName - Internal name to use if given configuration does not
|
|
160
|
-
* provide any hint.
|
|
161
|
-
* @returns Determined internal name.
|
|
162
|
-
*/var determineInternalNameFromConfiguration=function determineInternalNameFromConfiguration(configuration,fallbackName){var hasPackageConfiguration=function hasPackageConfiguration(name){var subConfiguration=configuration[name];return _typeof(subConfiguration)==="object"&&subConfiguration!==null&&Object.prototype.hasOwnProperty.call(subConfiguration,"package")};if(hasPackageConfiguration(fallbackName))return fallbackName;for(var _i4=0,_Object$keys=Object.keys(configuration);_i4<_Object$keys.length;_i4++){var name=_Object$keys[_i4];if(hasPackageConfiguration(name))return name}return fallbackName};/**
|
|
163
153
|
* Extends given configuration object with given plugin specific ones and
|
|
164
154
|
* returns a plugin specific meta information object.
|
|
165
155
|
* @param name - Name of plugin to extend.
|
|
@@ -188,14 +178,14 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
188
178
|
* @param configuration - Plugin specific configurations.
|
|
189
179
|
* @param configurationFilePaths - Plugin specific configuration file paths.
|
|
190
180
|
* @returns Plugin meta information object.
|
|
191
|
-
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
181
|
+
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator9,_step9,fileName,api,nativeAPI,pluginConfiguration,hasPluginConfiguration,_t7,_t8,_t9,_t0,_t1,_t10,_t11,_t12,_t13,_t14,_t15,_t16,_t17,_t18,_t19,_t20,_t21,_t22,_t23;return _regenerator().w(function(_context8){while(1)switch(_context8.p=_context8.n){case 0:if(encoding===void 0){encoding="utf8"}if(configuration===void 0){configuration=null}if(configurationFilePaths===void 0){configurationFilePaths=[]}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,relativeFilePaths[0]);_context8.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context8.v){_context8.n=11;break}_t7=_createForOfIteratorHelper;_context8.n=2;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(pluginPath);case 2:_iterator9=_t7(_context8.v);_context8.p=3;_iterator9.s();case 4:if((_step9=_iterator9.n()).done){_context8.n=8;break}fileName=_step9.value;_t8=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath)}).includes(fileName);if(!_t8){_context8.n=6;break}_context8.n=5;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,fileName));case 5:_t8=_context8.v;case 6:if(!_t8){_context8.n=7;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_5__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_5__.extname)(fileName)))){_context8.n=7;break}return _context8.a(3,8);case 7:_context8.n=4;break;case 8:_context8.n=10;break;case 9:_context8.p=9;_t9=_context8.v;_iterator9.e(_t9);case 10:_context8.p=10;_iterator9.f();return _context8.f(10);case 11:api=null;nativeAPI=false;_t0=configuration&&(/*
|
|
192
182
|
NOTE: Check if a webNode plugin configuration is available
|
|
193
183
|
indicating a backend responsibility for api file.
|
|
194
184
|
|
|
195
185
|
NOTE: One key is always there representing the whole package
|
|
196
186
|
configuration.
|
|
197
187
|
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t0){_context8.n=13;break}_context8.n=12;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 12:_t0=_context8.v;case 13:if(!_t0){_context8.n=14;break}if(filePath.endsWith(".js")){nativeAPI=true;api=createNativeAPIFactory(plugins,name)}else// NOTE: Any executable file can represent an api.
|
|
198
|
-
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:{}});_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=
|
|
188
|
+
api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=arguments.length,parameters=new Array(_len4>1?_len4-1:0),_key4=1;_key4<_len4;_key4++){parameters[_key4-1]=arguments[_key4]}var childProcessResult=(0,child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)(filePath,[hook].concat(_toConsumableArray(parameters.map(function(item){return JSON.stringify(item)}))),{cwd:process.cwd(),encoding:encoding,env:process.env,input:JSON.stringify(data),shell:true,stdio:"inherit"});if(childProcessResult.status===404)return data;var jsonIndicatorPrefix="##!JSON!##";if(childProcessResult.stdout.startsWith(jsonIndicatorPrefix))return JSON.parse(childProcessResult.stdout.substring(jsonIndicatorPrefix.length));return data};case 14:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);_t1=api;if(!api){_context8.n=16;break}_context8.n=15;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 15:_t11=_context8.v.mtime.getTime();_t10=[_t11];_context8.n=17;break;case 16:_t10=[];case 17:_t12=_t10;_t13=api?[filePath]:[];_t14=pluginConfiguration;_t15=configurationFilePaths;_context8.n=18;return Promise.all(configurationFilePaths.map(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(filePath){return _regenerator().w(function(_context7){while(1)switch(_context7.n){case 0:_context7.n=1;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.stat)(filePath);case 1:return _context7.a(2,_context7.v.mtime.getTime())}},_callee7)}))));case 18:_t16=_context8.v;_t17=hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[];_t18=internalName;_t19=name;_t20=hasPluginConfiguration?pluginConfiguration[internalName].package:{};_t21=pluginPath;if(!nativeAPI){_context8.n=20;break}_context8.n=19;return loadFile(filePath,name);case 19:_t22=_context8.v;_context8.n=21;break;case 20:_t22=null;case 21:_t23=_t22;return _context8.a(2,{api:_t1,apiFileLoadTimestamps:_t12,apiFilePaths:_t13,configuration:_t14,configurationFilePaths:_t15,configurationFileLoadTimestamps:_t16,dependencies:_t17,internalName:_t18,name:_t19,packageConfiguration:_t20,path:_t21,scope:_t23})}},_callee8,null,[[3,9,10,11]])}));function loadAPI(_x13,_x14,_x15,_x16,_x17,_x18,_x19,_x20){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
|
|
199
189
|
* Loads plugin specific configuration object.
|
|
200
190
|
* @param name - Property name where to inject resolved configuration into
|
|
201
191
|
* global one.
|
|
@@ -219,7 +209,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
219
209
|
*/var loadConfigurations=function loadConfigurations(plugins,configuration){/*
|
|
220
210
|
First clear current configuration content key by key to let old top
|
|
221
211
|
level configuration object instance untouched.
|
|
222
|
-
*/for(var
|
|
212
|
+
*/for(var _i4=0,_Object$keys=Object.keys(configuration);_i4<_Object$keys.length;_i4++){var key=_Object$keys[_i4];delete configuration[key]};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(configuration,(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(_configurator_js__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A));var _iterator1=_createForOfIteratorHelper(plugins),_step1;try{for(_iterator1.s();!(_step1=_iterator1.n()).done;){var plugin=_step1.value;if(Object.prototype.hasOwnProperty.call(plugin,"configuration")){var pluginConfiguration=(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(plugin.configuration);(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(configuration,pluginConfiguration),/*
|
|
223
213
|
NOTE: Should be resolved via preceding
|
|
224
214
|
"object.modifyObject" call.
|
|
225
215
|
*/pluginConfiguration);/*
|
|
@@ -252,11 +242,11 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
252
242
|
* stored.
|
|
253
243
|
* @param configuration - Configuration object to extend and use.
|
|
254
244
|
* @returns A topological sorted list of plugins objects.
|
|
255
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,_i5,_Object$entries4,_Object$entries4$_i,name,plugin,_combinePluginConfigu2,internalName,pluginConfiguration,hasPluginConfiguration,_i6,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator10,_step10,pluginName,currentPluginPath,_internalName,temporaryPlugins,_i7,_Object$values2,_plugin,_iterator11,_step11,_name2,sortedPlugins,_iterator12,_step12,_pluginName,_i8,_Object$entries5,_Object$entries5$_i,_name3,_plugin2,_t25,_t26,_t27,_t28,_t29;return _regenerator().w(function(_context0){while(1)switch(_context0.p=_context0.n){case 0:plugins={};for(_i5=0,_Object$entries4=Object.entries(PLUGIN_LOADER);_i5<_Object$entries4.length;_i5++){_Object$entries4$_i=_slicedToArray(_Object$entries4[_i5],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_combinePluginConfigu2=combinePluginConfigurations(plugin.name,[].concat(plugin.configurations)),internalName=_combinePluginConfigu2.name,pluginConfiguration=_combinePluginConfigu2.configuration;hasPluginConfiguration=Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName);plugins[name]={api:createNativeAPIFactory(plugins,name),apiFileLoadTimestamps:[],apiFilePaths:[],configuration:pluginConfiguration,configurationFilePaths:[],configurationFileLoadTimestamps:[],dependencies:hasPluginConfiguration&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[],internalName:internalName,name:name,packageConfiguration:hasPluginConfiguration?pluginConfiguration[internalName].package:{},path:"",scope:plugin.scope}}/*
|
|
246
|
+
Load main plugin configuration at first.
|
|
247
|
+
|
|
248
|
+
NOTE: If application's main is this itself avoid loading it twice.
|
|
249
|
+
*/if(!(configuration.name!=="web-node"&&Object.prototype.hasOwnProperty.call(plugins,configuration.name))){_context0.n=2;break}_context0.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp((_configuration$core$p=configuration.core.plugin.directories.external.nameRegularExpressionPattern)!==null&&_configuration$core$p!==void 0?_configuration$core$p:configuration.core.plugin.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context0.v;case 2:_i6=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i6<_Object$values.length)){_context0.n=15;break}directory=_Object$values[_i6];_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$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t25=_createForOfIteratorHelper;_context0.n=5;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 5:_iterator10=_t25(_context0.v);_context0.p=6;_iterator10.s();case 7:if((_step10=_iterator10.n()).done){_context0.n=11;break}pluginName=_step10.value;if(!(Object.prototype.hasOwnProperty.call(plugins,pluginName)||!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;_t26=_context0.v;_iterator10.e(_t26);case 13:_context0.p=13;_iterator10.f();return _context0.f(13);case 14:_i6++;_context0.n=3;break;case 15: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)){_iterator11=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[_plugin.internalName]));try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){_name2=_step11.value;if(!temporaryPlugins[_plugin.internalName].includes(_name2))temporaryPlugins[_plugin.internalName].push(_name2)}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}}}sortedPlugins=[];_iterator12=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context0.p=16;_iterator12.s();case 17:if((_step12=_iterator12.n()).done){_context0.n=21;break}_pluginName=_step12.value;_i8=0,_Object$entries5=Object.entries(plugins);case 18:if(!(_i8<_Object$entries5.length)){_context0.n=20;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i8],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName)){_context0.n=19;break}sortedPlugins.push(_plugin2);return _context0.a(3,20);case 19:_i8++;_context0.n=18;break;case 20:_context0.n=17;break;case 21:_context0.n=23;break;case 22:_context0.p=22;_t27=_context0.v;_iterator12.e(_t27);case 23:_context0.p=23;_iterator12.f();return _context0.f(23);case 24:_context0.n=25;return loadConfigurations(sortedPlugins,configuration);case 25:_t28=_context0.v;_t29=sortedPlugins;return _context0.a(2,{configuration:_t28,plugins:_t29})}},_callee0,null,[[16,22,23,24],[6,12,13,14]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
260
250
|
* Transform a list of absolute paths respecting the application context.
|
|
261
251
|
* @param configuration - Configuration object.
|
|
262
252
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -434,7 +424,7 @@ __webpack_async_result__();
|
|
|
434
424
|
/* 7 */
|
|
435
425
|
/***/ ((module) => {
|
|
436
426
|
|
|
437
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
427
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.611","description":"High level javaScript backend plugin system and configuration merger.","keywords":["api","backend","management","plugin","web"],"homepage":"https://torben.website/web-node","bugs":{"email":"info@torben.website","url":"https://github.com/thaibault/web-node/issues"},"license":"CC-BY-3.0","author":{"email":"info@torben.website","name":"Torben Sickert","url":"https://torben.website"},"repository":{"type":"git","url":"https://github.com/thaibault/web-node.git"},"type":"module","bin":"main.js","exports":{".":"./index.js","./main":"./main.js","./main.js":"./main.js","./package.json":"./package.json","./unixCrypt":"./unixCrypt.js","./unixCrypt.js":"./unixCrypt.js","./type":"./type.d.ts"},"files":["configurator.d.ts","index.d.ts","index.js","main.js","pluginAPI.d.ts","type.d.ts","unixCrypt.d.ts","unixCrypt.js"],"sideEffects":true,"scripts":{"build":"yarn build:types; yarn build:plain","build:plain":"weboptimizer build","build:types":"weboptimizer build:types","check":"yarn check:types; yarn lint","check:types":"weboptimizer check:types","clear":"weboptimizer clear","document":"weboptimizer document","lint":"weboptimizer lint","prepare":"yarn build","prepare:test":"yarn clear && cd dummyPlugin && shx touch yarn.lock && yarn build && cd ..","serve":"yarn build:plain && yarn start","start":"./main.js \'{plugin: {hotReloading: true}}\'","test":"yarn prepare:test && weboptimizer test","test:coverage":"yarn prepare:test && weboptimizer test:coverage","test:coverage:report":"yarn prepare:test && weboptimizer test:coverage:report","update:documentation":"web-documentation","watch":"weboptimizer build --watch"},"devDependencies":{"@babel/cli":"^8.0.4","@babel/eslint-parser":"^8.0.1","@eslint/js":"^10.0.1","@stylistic/eslint-plugin":"^5.10.0","@types/node":"^26.4.1","@types/webpack-env":"^1.18.8","@typescript-eslint/eslint-plugin":"^8.69.0","@typescript-eslint/parser":"^8.69.0","clientnode":"^4.0.1512","eslint":"^10.10.0","eslint-config-google":"^0.14.0","eslint-plugin-jsdoc":"^64.3.6","jest":"^30.5.1","jsdoc":"^4.0.5","shx":"^0.4.0","typescript-eslint":"^8.69.0","web-documentation":"^1.0.52","weboptimizer":"^4.0.78"},"peerDependencies":{"clientnode":"*"},"resolutions":{"colors":"1.4.0","globals@npm:^11.1.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^14.0.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch","globals@npm:^9.18.0":"patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch"},"engines":{"node":">=26","npm":">=12","yarn":">=4"},"webDocumentation":{"trackingCode":"UA-40192634-9"},"webNode":{"core":{"context":{"path":"./","type":"relative"},"debug":false,"encoding":"utf8","interDependencies":{},"name":"web-node","plugin":{"configuration":{"fileNames":["package.json","private-package.json"],"propertyNames":["webNode","webnode","web-node"]},"nameRegularExpressionPattern":"^([a-zA-Z0-9-]+?)-?[wW]eb-?[nN]ode-?[pP]lugin$","directories":{"external":{"path":{"__evaluate__":"`${currentPath}/node_modules/`"}},"internal":{"nameRegularExpressionPattern":"^([a-zA-Z0-9-_].*)$","path":{"__evaluate__":"`${currentPath}/plugins/`"}}},"hotReloading":false}}},"webOptimizer":{"assetPattern":{"javaScript":{"includeFilePathRegularExpression":"^(.+/)?main\\\\.js$","pattern":{"#":"This is how we can make our main exported artefact executable.","__evaluate__":"`#!/usr/bin/env node\\n// -*- coding: utf-8 -*-\\n${self.generic.assetPattern?.javaScript?.pattern ?? \'\'}\\n{1}`"}}},"injection":{"entry":{"__evaluate__":"2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2].startsWith(\'test\') ? {testBundle: \'test\'} : {index: \'./index.ts\', main: \'./main.ts\', unixCrypt: \'./unixCrypt.ts\'}"}},"module":{"optimizer":{"terser":{"terserOptions":{"compress":{"#":"To provide a logging output we need to exclude this feature.","drop_console":{"__evaluate__":"false"},"drop_debugger":{"__evaluate__":"false"}}}}}},"targetTechnology":{"boilerplate":"node","payload":"node"}},"packageManager":"yarn@4.18.0"}');
|
|
438
428
|
|
|
439
429
|
/***/ }),
|
|
440
430
|
/* 8 */
|
package/package.json
CHANGED
package/pluginAPI.d.ts
CHANGED
|
@@ -73,18 +73,6 @@ export declare const combinePluginConfigurations: (name: string, configurations:
|
|
|
73
73
|
name: string;
|
|
74
74
|
configuration: EvaluateablePartialConfiguration;
|
|
75
75
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Determines a plugins internal name from its already loaded configuration.
|
|
78
|
-
* NOTE: Plugins can specify an internal name deviating from their name via
|
|
79
|
-
* their "webNodeInternalName" package configuration property. Since only the
|
|
80
|
-
* plugin specific configuration section carries the corresponding package
|
|
81
|
-
* configuration we can use it to identify the plugin specific section.
|
|
82
|
-
* @param configuration - Already loaded plugin configuration.
|
|
83
|
-
* @param fallbackName - Internal name to use if given configuration does not
|
|
84
|
-
* provide any hint.
|
|
85
|
-
* @returns Determined internal name.
|
|
86
|
-
*/
|
|
87
|
-
export declare const determineInternalNameFromConfiguration: (configuration: EvaluateablePartialConfiguration, fallbackName: string) => string;
|
|
88
76
|
/**
|
|
89
77
|
* Extends given configuration object with given plugin specific ones and
|
|
90
78
|
* returns a plugin specific meta information object.
|
package/type.d.ts
CHANGED
|
@@ -86,8 +86,9 @@ export type HookPromiseResult<Type> = Promise<Type | {
|
|
|
86
86
|
}>;
|
|
87
87
|
export type PluginPromises<Type extends Promise<unknown> = Promise<unknown>> = Mapping<null | Type>;
|
|
88
88
|
export type PluginLoaderMapping = Mapping<{
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
name: string;
|
|
90
|
+
configurations: (Array<EvaluateablePartialConfiguration> | EvaluateablePartialConfiguration);
|
|
91
|
+
scope: object;
|
|
91
92
|
}>;
|
|
92
93
|
export type Services<PluginServiceType = Mapping<unknown>> = Mapping<unknown> & PluginServiceType;
|
|
93
94
|
export type ServicePromises<PluginPromiseType = Mapping<unknown>> = Mapping<Promise<unknown>> & PluginPromiseType;
|