web-node 1.0.609 → 1.0.610
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 +23 -10
- package/main.js +20 -10
- package/package.json +1 -1
- package/pluginAPI.d.ts +12 -0
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 */ My: () => (/* binding */ determineInternalNameFromConfiguration),
|
|
24
25
|
/* harmony export */ Oy: () => (/* binding */ createNativeAPIFactory),
|
|
25
26
|
/* harmony export */ Vx: () => (/* binding */ hotReloadConfigurationFile),
|
|
26
27
|
/* harmony export */ ZN: () => (/* binding */ loadFile),
|
|
@@ -158,10 +159,20 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
158
159
|
*/var combinePluginConfigurations=function combinePluginConfigurations(name,configurations,propertyNames){if(propertyNames===void 0){propertyNames=["webNode"]}var packageConfiguration={};var _iterator7=_createForOfIteratorHelper(configurations),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var configuration=_step7.value;(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,/*
|
|
159
160
|
NOTE: Source and target configuration got modified. While the
|
|
160
161
|
target configuration receives the modifications the source
|
|
161
|
-
configuration will lose their modification
|
|
162
|
+
configuration will lose their modification expressions
|
|
162
163
|
therefore we can use the source configuration afterward to
|
|
163
164
|
extend the target configuration.
|
|
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(
|
|
165
|
+
*/(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};/**
|
|
165
176
|
* Extends given configuration object with given plugin specific ones and
|
|
166
177
|
* returns a plugin specific meta information object.
|
|
167
178
|
* @param name - Name of plugin to extend.
|
|
@@ -221,7 +232,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
221
232
|
*/var loadConfigurations=function loadConfigurations(plugins,configuration){/*
|
|
222
233
|
First clear current configuration content key by key to let old top
|
|
223
234
|
level configuration object instance untouched.
|
|
224
|
-
*/for(var
|
|
235
|
+
*/for(var _i5=0,_Object$keys2=Object.keys(configuration);_i5<_Object$keys2.length;_i5++){var key=_Object$keys2[_i5];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),/*
|
|
225
236
|
NOTE: Should be resolved via preceding
|
|
226
237
|
"object.modifyObject" call.
|
|
227
238
|
*/pluginConfiguration);/*
|
|
@@ -254,11 +265,11 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
254
265
|
* stored.
|
|
255
266
|
* @param configuration - Configuration object to extend and use.
|
|
256
267
|
* @returns A topological sorted list of plugins objects.
|
|
257
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,_i6,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfiguration,scope,internalName,hasPluginConfiguration,_i7,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator10,_step10,pluginName,currentPluginPath,_internalName,temporaryPlugins,_i8,_Object$values2,_plugin,_iterator11,_step11,_name2,sortedPlugins,_iterator12,_step12,_pluginName,_i9,_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={};_i6=0,_Object$entries4=Object.entries(PLUGIN_LOADER);case 1:if(!(_i6<_Object$entries4.length)){_context0.n=5;break}_Object$entries4$_i=_slicedToArray(_Object$entries4[_i6],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_context0.n=2;return plugin.loadConfiguration();case 2:pluginConfiguration=_context0.v;_context0.n=3;return plugin.loadScope();case 3:scope=_context0.v;/*
|
|
269
|
+
NOTE: Plugins can specify an internal name deviating from their
|
|
270
|
+
name. Therefore, we cannot derive it from given plugin loader name
|
|
271
|
+
only (as the "load()" function does not either).
|
|
272
|
+
*/internalName=determineInternalNameFromConfiguration(pluginConfiguration,determineInternalName(name,new RegExp(configuration.core.plugin.nameRegularExpressionPattern)));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:scope};case 4:_i6++;_context0.n=1;break;case 5:if(!(configuration.name!=="web-node"&&Object.prototype.hasOwnProperty.call(plugins,configuration.name))){_context0.n=7;break}_context0.n=6;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 6:plugins[configuration.name]=_context0.v;case 7:_i7=0,_Object$values=Object.values(configuration.core.plugin.directories);case 8:if(!(_i7<_Object$values.length)){_context0.n=20;break}directory=_Object$values[_i7];_context0.n=9;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 9:if(!_context0.v){_context0.n=19;break}compiledRegularExpression=new RegExp((_directory$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t25=_createForOfIteratorHelper;_context0.n=10;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 10:_iterator10=_t25(_context0.v);_context0.p=11;_iterator10.s();case 12:if((_step10=_iterator10.n()).done){_context0.n=16;break}pluginName=_step10.value;if(!(Object.prototype.hasOwnProperty.call(plugins,pluginName)||!compiledRegularExpression.test(pluginName))){_context0.n=13;break}return _context0.a(3,15);case 13:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);_internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=14;return load(pluginName,_internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 14:plugins[pluginName]=_context0.v;case 15:_context0.n=12;break;case 16:_context0.n=18;break;case 17:_context0.p=17;_t26=_context0.v;_iterator10.e(_t26);case 18:_context0.p=18;_iterator10.f();return _context0.f(18);case 19:_i7++;_context0.n=8;break;case 20:temporaryPlugins={};for(_i8=0,_Object$values2=Object.values(plugins);_i8<_Object$values2.length;_i8++){_plugin=_Object$values2[_i8];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=21;_iterator12.s();case 22:if((_step12=_iterator12.n()).done){_context0.n=26;break}_pluginName=_step12.value;_i9=0,_Object$entries5=Object.entries(plugins);case 23:if(!(_i9<_Object$entries5.length)){_context0.n=25;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i9],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName)){_context0.n=24;break}sortedPlugins.push(_plugin2);return _context0.a(3,25);case 24:_i9++;_context0.n=23;break;case 25:_context0.n=22;break;case 26:_context0.n=28;break;case 27:_context0.p=27;_t27=_context0.v;_iterator12.e(_t27);case 28:_context0.p=28;_iterator12.f();return _context0.f(28);case 29:_context0.n=30;return loadConfigurations(sortedPlugins,configuration);case 30:_t28=_context0.v;_t29=sortedPlugins;return _context0.a(2,{configuration:_t28,plugins:_t29})}},_callee0,null,[[21,27,28,29],[11,17,18,19]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
262
273
|
* Transform a list of absolute paths respecting the application context.
|
|
263
274
|
* @param configuration - Configuration object.
|
|
264
275
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -385,6 +396,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
385
396
|
/* harmony export */ HF: () => (/* reexport safe */ _configurator_js__WEBPACK_IMPORTED_MODULE_0__.H),
|
|
386
397
|
/* harmony export */ Hh: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Hh),
|
|
387
398
|
/* 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),
|
|
388
400
|
/* harmony export */ Oy: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Oy),
|
|
389
401
|
/* harmony export */ Rm: () => (/* binding */ log),
|
|
390
402
|
/* harmony export */ Vx: () => (/* reexport safe */ _pluginAPI_js__WEBPACK_IMPORTED_MODULE_1__.Vx),
|
|
@@ -458,7 +470,7 @@ __webpack_async_result__();
|
|
|
458
470
|
/* 7 */
|
|
459
471
|
/***/ ((module) => {
|
|
460
472
|
|
|
461
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
473
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.610","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"}');
|
|
462
474
|
|
|
463
475
|
/***/ }),
|
|
464
476
|
/* 8 */
|
|
@@ -658,6 +670,7 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
658
670
|
/******/ const __webpack_exports__createNativeAPIFactory = __webpack_exports__.Oy;
|
|
659
671
|
/******/ const __webpack_exports__default = __webpack_exports__.Ay;
|
|
660
672
|
/******/ const __webpack_exports__determineInternalName = __webpack_exports__.Gy;
|
|
673
|
+
/******/ const __webpack_exports__determineInternalNameFromConfiguration = __webpack_exports__.My;
|
|
661
674
|
/******/ const __webpack_exports__determineLocations = __webpack_exports__.m7;
|
|
662
675
|
/******/ const __webpack_exports__evaluateConfiguration = __webpack_exports__.u2;
|
|
663
676
|
/******/ const __webpack_exports__hotReloadAPIFile = __webpack_exports__.dw;
|
|
@@ -675,5 +688,5 @@ module.exports = x({ ["fileURLToPath"]: () => (__WEBPACK_EXTERNAL_MODULE_node_ur
|
|
|
675
688
|
/******/ const __webpack_exports__log = __webpack_exports__.Rm;
|
|
676
689
|
/******/ const __webpack_exports__main = __webpack_exports__.iW;
|
|
677
690
|
/******/ const __webpack_exports__pluginAPI = __webpack_exports__.MM;
|
|
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 };
|
|
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, __webpack_exports__determineInternalNameFromConfiguration as determineInternalNameFromConfiguration, __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 };
|
|
679
692
|
/******/
|
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, load, createNativeAPIFactory, loadAPI, loadConfiguration, loadConfigurations, loadFile, determineLocations, isInLocations, pluginAPI */
|
|
26
|
+
/* unused harmony exports log, determineInternalName, evaluateConfiguration, hotReloadAPIFile, hotReloadConfigurationFile, hotReloadFiles, combinePluginConfigurations, determineInternalNameFromConfiguration, 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);
|
|
@@ -146,10 +146,20 @@ for(_i3=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i3<_Object$ent
|
|
|
146
146
|
*/var combinePluginConfigurations=function combinePluginConfigurations(name,configurations,propertyNames){if(propertyNames===void 0){propertyNames=["webNode"]}var packageConfiguration={};var _iterator7=_createForOfIteratorHelper(configurations),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var configuration=_step7.value;(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,/*
|
|
147
147
|
NOTE: Source and target configuration got modified. While the
|
|
148
148
|
target configuration receives the modifications the source
|
|
149
|
-
configuration will lose their modification
|
|
149
|
+
configuration will lose their modification expressions
|
|
150
150
|
therefore we can use the source configuration afterward to
|
|
151
151
|
extend the target configuration.
|
|
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(
|
|
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};/**
|
|
153
163
|
* Extends given configuration object with given plugin specific ones and
|
|
154
164
|
* returns a plugin specific meta information object.
|
|
155
165
|
* @param name - Name of plugin to extend.
|
|
@@ -209,7 +219,7 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
209
219
|
*/var loadConfigurations=function loadConfigurations(plugins,configuration){/*
|
|
210
220
|
First clear current configuration content key by key to let old top
|
|
211
221
|
level configuration object instance untouched.
|
|
212
|
-
*/for(var
|
|
222
|
+
*/for(var _i5=0,_Object$keys2=Object.keys(configuration);_i5<_Object$keys2.length;_i5++){var key=_Object$keys2[_i5];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),/*
|
|
213
223
|
NOTE: Should be resolved via preceding
|
|
214
224
|
"object.modifyObject" call.
|
|
215
225
|
*/pluginConfiguration);/*
|
|
@@ -242,11 +252,11 @@ api=function api(_ref2){var hook=_ref2.hook,data=_ref2.data;for(var _len4=argume
|
|
|
242
252
|
* stored.
|
|
243
253
|
* @param configuration - Configuration object to extend and use.
|
|
244
254
|
* @returns A topological sorted list of plugins objects.
|
|
245
|
-
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
255
|
+
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(configuration){var _configuration$core$p;var plugins,_i6,_Object$entries4,_Object$entries4$_i,name,plugin,pluginConfiguration,scope,internalName,hasPluginConfiguration,_i7,_Object$values,directory,_directory$nameRegula,compiledRegularExpression,_iterator10,_step10,pluginName,currentPluginPath,_internalName,temporaryPlugins,_i8,_Object$values2,_plugin,_iterator11,_step11,_name2,sortedPlugins,_iterator12,_step12,_pluginName,_i9,_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={};_i6=0,_Object$entries4=Object.entries(PLUGIN_LOADER);case 1:if(!(_i6<_Object$entries4.length)){_context0.n=5;break}_Object$entries4$_i=_slicedToArray(_Object$entries4[_i6],2),name=_Object$entries4$_i[0],plugin=_Object$entries4$_i[1];_context0.n=2;return plugin.loadConfiguration();case 2:pluginConfiguration=_context0.v;_context0.n=3;return plugin.loadScope();case 3:scope=_context0.v;/*
|
|
256
|
+
NOTE: Plugins can specify an internal name deviating from their
|
|
257
|
+
name. Therefore, we cannot derive it from given plugin loader name
|
|
258
|
+
only (as the "load()" function does not either).
|
|
259
|
+
*/internalName=determineInternalNameFromConfiguration(pluginConfiguration,determineInternalName(name,new RegExp(configuration.core.plugin.nameRegularExpressionPattern)));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:scope};case 4:_i6++;_context0.n=1;break;case 5:if(!(configuration.name!=="web-node"&&Object.prototype.hasOwnProperty.call(plugins,configuration.name))){_context0.n=7;break}_context0.n=6;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 6:plugins[configuration.name]=_context0.v;case 7:_i7=0,_Object$values=Object.values(configuration.core.plugin.directories);case 8:if(!(_i7<_Object$values.length)){_context0.n=20;break}directory=_Object$values[_i7];_context0.n=9;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 9:if(!_context0.v){_context0.n=19;break}compiledRegularExpression=new RegExp((_directory$nameRegula=directory.nameRegularExpressionPattern)!==null&&_directory$nameRegula!==void 0?_directory$nameRegula:configuration.core.plugin.nameRegularExpressionPattern);_t25=_createForOfIteratorHelper;_context0.n=10;return (0,fs_promises__WEBPACK_IMPORTED_MODULE_4__.readdir)(directory.path);case 10:_iterator10=_t25(_context0.v);_context0.p=11;_iterator10.s();case 12:if((_step10=_iterator10.n()).done){_context0.n=16;break}pluginName=_step10.value;if(!(Object.prototype.hasOwnProperty.call(plugins,pluginName)||!compiledRegularExpression.test(pluginName))){_context0.n=13;break}return _context0.a(3,15);case 13:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_5__.resolve)(directory.path,pluginName);_internalName=determineInternalName(pluginName,compiledRegularExpression);_context0.n=14;return load(pluginName,_internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 14:plugins[pluginName]=_context0.v;case 15:_context0.n=12;break;case 16:_context0.n=18;break;case 17:_context0.p=17;_t26=_context0.v;_iterator10.e(_t26);case 18:_context0.p=18;_iterator10.f();return _context0.f(18);case 19:_i7++;_context0.n=8;break;case 20:temporaryPlugins={};for(_i8=0,_Object$values2=Object.values(plugins);_i8<_Object$values2.length;_i8++){_plugin=_Object$values2[_i8];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=21;_iterator12.s();case 22:if((_step12=_iterator12.n()).done){_context0.n=26;break}_pluginName=_step12.value;_i9=0,_Object$entries5=Object.entries(plugins);case 23:if(!(_i9<_Object$entries5.length)){_context0.n=25;break}_Object$entries5$_i=_slicedToArray(_Object$entries5[_i9],2),_name3=_Object$entries5$_i[0],_plugin2=_Object$entries5$_i[1];if(![_plugin2.internalName,_name3].includes(_pluginName)){_context0.n=24;break}sortedPlugins.push(_plugin2);return _context0.a(3,25);case 24:_i9++;_context0.n=23;break;case 25:_context0.n=22;break;case 26:_context0.n=28;break;case 27:_context0.p=27;_t27=_context0.v;_iterator12.e(_t27);case 28:_context0.p=28;_iterator12.f();return _context0.f(28);case 29:_context0.n=30;return loadConfigurations(sortedPlugins,configuration);case 30:_t28=_context0.v;_t29=sortedPlugins;return _context0.a(2,{configuration:_t28,plugins:_t29})}},_callee0,null,[[21,27,28,29],[11,17,18,19]])}));function loadAll(_x26){return _loadAll.apply(this,arguments)}return loadAll}();/**
|
|
250
260
|
* Transform a list of absolute paths respecting the application context.
|
|
251
261
|
* @param configuration - Configuration object.
|
|
252
262
|
* @param configuration.core - Sub configuration web-node.
|
|
@@ -424,7 +434,7 @@ __webpack_async_result__();
|
|
|
424
434
|
/* 7 */
|
|
425
435
|
/***/ ((module) => {
|
|
426
436
|
|
|
427
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.
|
|
437
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"web-node","version":"1.0.610","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"}');
|
|
428
438
|
|
|
429
439
|
/***/ }),
|
|
430
440
|
/* 8 */
|
package/package.json
CHANGED
package/pluginAPI.d.ts
CHANGED
|
@@ -73,6 +73,18 @@ 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;
|
|
76
88
|
/**
|
|
77
89
|
* Extends given configuration object with given plugin specific ones and
|
|
78
90
|
* returns a plugin specific meta information object.
|