web-node
Version:
High level javaScript backend plugin system and configuration merger.
320 lines (298 loc) • 91.8 kB
JavaScript
#!/usr/bin/env node
// -*- coding: utf-8 -*-
if(import.meta.main)module.paths.unshift('/application/node_modules');import {fileURLToPath as __webpack_fileURLToPath__} from "node:url";
var __webpack_dirname__ = __webpack_fileURLToPath__(import.meta.url.replace(/\/(?:[^\/]*)$/, ""));
import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
import * as __WEBPACK_EXTERNAL_MODULE_clientnode__ from "clientnode";
import * as __WEBPACK_EXTERNAL_MODULE_core_js_modules_es_array_includes_js_66c3fd7d__ from "core-js/modules/es.array.includes.js";
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
import * as __WEBPACK_EXTERNAL_MODULE_node_url_50af3bb5__ from "node:url";
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
/******/ var __webpack_modules__ = ([
/* 0 */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Ad: () => (/* binding */ hotReloadFiles),
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ GH: () => (/* binding */ isInLocations),
/* harmony export */ Gy: () => (/* binding */ determineInternalName),
/* harmony export */ Hh: () => (/* binding */ load),
/* harmony export */ MM: () => (/* binding */ pluginAPI),
/* harmony export */ Vx: () => (/* binding */ hotReloadConfigurationFile),
/* harmony export */ ZN: () => (/* binding */ loadFile),
/* harmony export */ dw: () => (/* binding */ hotReloadAPIFile),
/* harmony export */ gh: () => (/* binding */ loadAll),
/* harmony export */ gl: () => (/* binding */ callStackSynchronous),
/* harmony export */ i9: () => (/* binding */ loadConfigurations),
/* harmony export */ lT: () => (/* binding */ _callStack),
/* harmony export */ m7: () => (/* binding */ determineLocations),
/* harmony export */ nQ: () => (/* binding */ loadAPI),
/* harmony export */ u2: () => (/* binding */ evaluateConfiguration),
/* harmony export */ vF: () => (/* binding */ loadConfiguration)
/* harmony export */ });
/* unused harmony export log */
/* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4);
/* harmony import */ var _configurator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
/* module decorator */ module = __webpack_require__.hmd(module);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_configurator_js__WEBPACK_IMPORTED_MODULE_5__]);
var __webpack_async_dependencies_result__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
_configurator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_async_dependencies_result__[0];
// #!/usr/bin/env babel-node
// -*- coding: utf-8 -*-
/** @module pluginAPI *//* !
region header
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stands under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
endregion
*/// region imports
function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)};function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof Generator?n:Generator,u=Object.create(c.prototype);return _regeneratorDefine2(u,"_invoke",function(r,n,o){var i,c,u,f=0,p=o||[],y=!1,G={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function d(t,r){return i=t,c=0,u=e,G.n=r,a}};function d(r,n){for(c=r,u=n,t=0;!y&&f&&!o&&t<p.length;t++){var o,i=p[t],d=G.p,l=i[2];r>3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(c=0,G.v=n,G.n=i[1]):d<l&&(o=r<3||i[0]>n||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine2(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(u,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,o,"GeneratorFunction"),_regeneratorDefine2(u),_regeneratorDefine2(u,o,"Generator"),_regeneratorDefine2(u,n,function(){return this}),_regeneratorDefine2(u,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine2=function _regeneratorDefine(e,r,n,t){function o(r,n){_regeneratorDefine2(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(e,r,n,t)}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var _n=0,F=function F(){};return{s:F,n:function n(){return _n>=r.length?{done:!0}:{done:!1,value:r[_n++]}},e:function e(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function s(){t=t.call(r)},n:function n(){var r=t.next();return a=r.done,r},e:function e(r){u=!0,o=r},f:function f(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}};// endregion
var log=new clientnode__WEBPACK_IMPORTED_MODULE_2__.Logger({name:"web-node.plugin-api"});await (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.importFilesystemAPI)();var currentRequire=await (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.getCurrentRequire)();if(currentRequire===null)throw new Error("Missing synchronous module loading mechanism (require method).");// region allow plugins to import "web-node" as already loaded main module
/*
Commonjs specific logic to deduplicate the main module's scope for plugins
to avoid loading it twice and therefore having two different scopes of the
same module in memory:
import {Module} from 'module'
type ModuleType =
typeof Module &
{_resolveFilename: (
request: string, module: typeof Module, isMain: boolean
) => string}
const oldResolveFilename = (Module as ModuleType)._resolveFilename
;(Module as ModuleType)._resolveFilename = (
request: string, parent: typeof Module, isMain: boolean
): string => {
if (request === 'main-module' && currentRequire.main?.id)
return oldResolveFilename(currentRequire.main.id, parent, isMain)
return oldResolveFilename(request, parent, isMain)
}
*//*
Esmodule specific logic to deduplicate the main module's scope for plugins
to avoid loading it twice and therefore having two different scopes of the
same module in memory:
// main-module-hook.ts (must compile/run as a standalone module)
import type {ResolveHook, InitializeHook} from 'node:module'
let mainModuleURL: string | undefined
export const initialize: InitializeHook = (
data: {mainModuleURL?: string}
): void => {
mainModuleURL = data.mainModuleURL
}
export const resolve: ResolveHook = (specifier, context, nextResolve) => {
if (specifier === 'main-module' && mainModuleURL)
// Redirect to the entry module's URL; the ESM cache is keyed by
// resolved URL, so every importer shares that one instance.
return nextResolve(mainModuleURL, context)
return nextResolve(specifier, context)
}
Registering it
// setup.ts (imported first, before anything does import 'main-module')
import {register} from 'node:module'
import {pathToFileURL} from 'node:url'
register('./main-module-hook.js', {
parentURL: import.meta.url,
data: {mainModuleURL: pathToFileURL(process.argv[1]).href}
})
*/// endregion
/**
* Calls all plugin methods for given trigger description asynchronous and
* waits for their resolved promises.
* @param givenState - Contains runtime information about current hook.
* @param parameters - Additional parameters to forward into plugin api.
* @returns A promise which resolves when all callbacks have resolved their
* promise holding given potentially modified data.
*/var _callStack=/*#__PURE__*/function(){var _callStack2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(givenState){var state,configuration,hook,plugins,isConfigurationHook,pluginsWithChangedConfiguration,localState,pluginsWithChangedAPIFiles,data,_len,parameters,_key,_iterator,_step,plugin,result,_message,_args=arguments,_t,_t2;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:state=_objectSpread(_objectSpread({},givenState),{},{pluginAPI:pluginAPI});configuration=state.configuration,hook=state.hook,plugins=state.plugins;isConfigurationHook=hook.endsWith("ConfigurationLoaded")||hook.endsWith("ConfigurationHotLoaded");if(!configuration.core.plugin.hotReloading){_context.n=4;break}if(isConfigurationHook){_context.n=3;break}pluginsWithChangedConfiguration=hotReloadConfigurationFile(plugins,configuration.core.plugin.configuration.propertyNames);if(!pluginsWithChangedConfiguration.length){_context.n=3;break}log.info("Configuration for \""+pluginsWithChangedConfiguration.map(function(plugin){return plugin.name}).join("\", \"")+"\" has been changed: reloading initialized.");localState=_objectSpread(_objectSpread({},state),{},{triggerHook:state.hook,pluginsWithChangedConfiguration:pluginsWithChangedConfiguration});_context.n=1;return _callStack(_objectSpread(_objectSpread({},localState),{},{hook:"preConfigurationHotLoaded"}));case 1:_context.n=2;return loadConfigurations(plugins,configuration);case 2:_context.n=3;return _callStack(_objectSpread(_objectSpread({},localState),{},{hook:"postConfigurationHotLoaded"}));case 3:if(!(hook!=="apiFileReloaded")){_context.n=4;break}pluginsWithChangedAPIFiles=hotReloadAPIFile(plugins);if(!pluginsWithChangedAPIFiles.length){_context.n=4;break}log.info("API-file for \""+"".concat(pluginsWithChangedAPIFiles.map(function(plugin){return plugin.name}).join("\", \""),"\""),"has been changed: reloading initialized.");_context.n=4;return _callStack(_objectSpread(_objectSpread({},state),{},{hook:"apiFileReloaded",pluginsWithChangedAPIFiles:pluginsWithChangedAPIFiles,triggerHook:state.hook}));case 4:data=givenState.data;for(_len=_args.length,parameters=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){parameters[_key-1]=_args[_key]}_iterator=_createForOfIteratorHelper(plugins);_context.p=5;_iterator.s();case 6:if((_step=_iterator.n()).done){_context.n=13;break}plugin=_step.value;if(!plugin.api){_context.n=12;break}result=void 0;_context.p=7;_context.n=8;return plugin.api.apply(plugin,[state].concat(parameters));case 8:result=_context.v;_context.n=11;break;case 9:_context.p=9;_t=_context.v;if(!((_message=_t.message)!==null&&_message!==void 0&&_message.startsWith("NotImplemented:"))){_context.n=10;break}return _context.a(3,12);case 10:throw new Error("Plugin \"".concat(plugin.internalName,"\" ")+(plugin.internalName===plugin.name?"":"(".concat(plugin.name,") "))+"throws: ".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(_t)," during asynchronous ")+"hook \"".concat(hook,"\"."),{cause:_t});case 11:data=result;log.info("Ran asynchronous hook \"".concat(hook,"\" for plugin \"").concat(plugin.name,"\"."));case 12:_context.n=6;break;case 13:_context.n=15;break;case 14:_context.p=14;_t2=_context.v;_iterator.e(_t2);case 15:_context.p=15;_iterator.f();return _context.f(15);case 16:if(!(data!==null&&_typeof(data)==="object"&&"then"in data)){_context.n=17;break}return _context.a(2,{promise:data});case 17:return _context.a(2,data)}},_callee,null,[[7,9],[5,14,15,16]])}));function callStack(_x){return _callStack2.apply(this,arguments)}return callStack}();/**
* Calls all plugin methods for given trigger description synchronous.
* @param givenState - Contains runtime information about current hook.
* @param parameters - Additional parameters to forward into plugin api.
* @returns Given potentially modified data.
*/var callStackSynchronous=function callStackSynchronous(givenState){var state=_objectSpread(_objectSpread({},givenState),{},{pluginAPI:pluginAPI});var configuration=state.configuration,hook=state.hook,plugins=state.plugins;var data=givenState.data;for(var _len2=arguments.length,parameters=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){parameters[_key2-1]=arguments[_key2]}var _iterator2=_createForOfIteratorHelper(plugins),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var plugin=_step2.value;if(plugin.api){var result=void 0;try{result=plugin.api.apply(plugin,[state].concat(parameters))}catch(error){var _message2;if((_message2=error.message)!==null&&_message2!==void 0&&_message2.startsWith("NotImplemented:"))continue;throw new Error("Plugin \"".concat(plugin.internalName,"\" ")+(plugin.internalName===plugin.name?"":"(".concat(plugin.name,") "))+"throws: ".concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(error)," during synchronous hook")+"\"".concat(hook,"\"."),{cause:error})}data=result;if(configuration.core.debug)log.info("Ran synchronous hook \"".concat(hook,"\" for plugin"),"\"".concat(plugin.name,"\"."))}}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}return data};/**
* Converts given plugin name into the corresponding internal representation.
* @param name - Name to convert.
* @param regularExpression - Regular expression pattern which extracts
* relevant name path as first match group.
* @returns Transformed name.
*/var determineInternalName=function determineInternalName(name,regularExpression){return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.delimitedToCamelCase)(name.replace(regularExpression,function(fullMatch,firstMatch){return typeof firstMatch==="string"?firstMatch:fullMatch}))};/**
* Evaluates given configuration object by letting plugins package sub
* structure untouched.
* @param configuration - Evaluable configuration structure.
* @returns Resolved configuration.
*/var evaluateConfiguration=/*#__PURE__*/function(){var _evaluateConfiguration=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(configuration){var pluginPackageConfigurationBackup,_i,_Object$entries,_Object$entries$_i,name,subConfiguration,now,evaluationOptions,_i2,_Object$entries2,_Object$entries2$_i,_name,pluginPackageConfiguration;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:/*
NOTE: We have to back up, remove and restore all plugin specific
package configuration to avoid evaluation non web node#
configuration structures.
*/pluginPackageConfigurationBackup={};for(_i=0,_Object$entries=Object.entries(configuration);_i<_Object$entries.length;_i++){_Object$entries$_i=_slicedToArray(_Object$entries[_i],2),name=_Object$entries$_i[0],subConfiguration=_Object$entries$_i[1];if(subConfiguration.package){pluginPackageConfigurationBackup[name]=subConfiguration.package;delete subConfiguration.package}}now=new Date;evaluationOptions={scope:_objectSpread(_objectSpread({},clientnode__WEBPACK_IMPORTED_MODULE_2__.UTILITY_SCOPE),{},{currentPath:process.cwd(),fs:fs__WEBPACK_IMPORTED_MODULE_3__["default"],path:path__WEBPACK_IMPORTED_MODULE_4__["default"],module:module,webNodePath:__webpack_dirname__,now:now,nowUTCTimestamp:(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.getUTCTimestamp)(now)})};_context2.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.evaluateAsyncDynamicData)((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.evaluateDynamicData)((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.removeKeysInEvaluation)(configuration),evaluationOptions),evaluationOptions);case 1:configuration=_context2.v;for(_i2=0,_Object$entries2=Object.entries(pluginPackageConfigurationBackup);_i2<_Object$entries2.length;_i2++){_Object$entries2$_i=_slicedToArray(_Object$entries2[_i2],2),_name=_Object$entries2$_i[0],pluginPackageConfiguration=_Object$entries2$_i[1];configuration[_name].package=pluginPackageConfiguration}return _context2.a(2,configuration)}},_callee2)}));function evaluateConfiguration(_x2){return _evaluateConfiguration.apply(this,arguments)}return evaluateConfiguration}();/**
* Checks for changed plugin api file in given plugins and reloads them if
* necessary (new timestamp).
* @param plugins - List of plugins to search for updates in.
* @returns A list with plugins which have a changed api scope.
*/var hotReloadAPIFile=function hotReloadAPIFile(plugins){var pluginsWithChangedFiles=[];var pluginChanges=hotReloadFiles("api","scope",plugins);for(var _i3=0,_pluginChanges=pluginChanges;_i3<_pluginChanges.length;_i3++){var pluginChange=_pluginChanges[_i3];if(pluginChange.oldScope){// NOTE: We have to migrate old plugin api's scope state.
for(var _i4=0,_Object$entries3=Object.entries(pluginChange.oldScope);_i4<_Object$entries3.length;_i4++){var _Object$entries3$_i=_slicedToArray(_Object$entries3[_i4],2),name=_Object$entries3$_i[0],value=_Object$entries3$_i[1];if(Object.prototype.hasOwnProperty.call(pluginChange.newScope,name)&&!(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFunction)(pluginChange.newScope[name])){var propertyDescriptor=Object.getOwnPropertyDescriptor(pluginChange.newScope,name);var isWritable=true;if(propertyDescriptor){isWritable=propertyDescriptor.writable!==false;if(propertyDescriptor.configurable&&!isWritable)Object.defineProperties(pluginChange.newScope,_defineProperty({},name,{writable:true}))}try{pluginChange.newScope[name]=value}catch(_unused){log.warn("Could not update new constant value for","variable \"".concat(name,"\"."))}if(!isWritable&&propertyDescriptor!==null&&propertyDescriptor!==void 0&&propertyDescriptor.configurable)Object.defineProperties(pluginChange.newScope,_defineProperty({},name,{writable:false}))}}pluginsWithChangedFiles.push(pluginChange.plugin)}}return pluginsWithChangedFiles};/**
* Checks for changed plugin configurations in given plugins and reloads them
* if necessary (new timestamp).
* @param plugins - List of plugins to search for updates in.
* @param configurationPropertyNames - Property names to search for to use as
* entry in plugin configuration file.
* @returns A list with plugins which have a changed configurations.
*/var hotReloadConfigurationFile=function hotReloadConfigurationFile(plugins,configurationPropertyNames){var pluginsWithChangedFiles=[];var pluginChanges=hotReloadFiles("configuration","packageConfiguration",plugins);for(var _i5=0,_pluginChanges2=pluginChanges;_i5<_pluginChanges2.length;_i5++){var change=_pluginChanges2[_i5];change.plugin.configuration=loadConfiguration(change.plugin.internalName,change.plugin.packageConfiguration,configurationPropertyNames);pluginsWithChangedFiles.push(change.plugin)}return pluginsWithChangedFiles};/**
* Checks for changed plugin file type in given plugins and reloads them if
* necessary (timestamp has changed).
* @param type - Plugin file type to search for updates.
* @param target - Property name existing in plugin meta information objects
* which should be updated.
* @param plugins - List of plugins to search for updates in.
* @returns A list with plugin changes.
*/var hotReloadFiles=function hotReloadFiles(type,target,plugins){var pluginChanges=[];var _iterator3=_createForOfIteratorHelper(plugins),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var plugin=_step3.value;if(plugin[target]){var index=0;var _iterator4=_createForOfIteratorHelper(plugin["".concat(type,"FilePaths")]),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var filePath=_step4.value;var timestamp=(0,fs__WEBPACK_IMPORTED_MODULE_3__.statSync)(filePath).mtime.getTime();if(plugin["".concat(type,"FileLoadTimestamps")][index]<timestamp){log.info("Determined updated file \"".concat(filePath,"\"."),"Doing a reload.");// Enforce to reload new file version.
delete currentRequire.cache[currentRequire.resolve(filePath)];var oldScope=plugin[target];plugin[target]=loadFile(filePath,plugin.name,plugin[target]);log.info("File \"".concat(filePath,"\" reloaded."));pluginChanges.push({newScope:plugin[target],oldScope:oldScope,plugin:plugin,target:target})}plugin["".concat(type,"FileLoadTimestamps")][index]=timestamp;index+=1}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}return pluginChanges};/**
* Extends given configuration object with given plugin specific ones and
* returns a plugin specific meta information object.
* @param name - Name of plugin to extend.
* @param internalName - Internal name of plugin to extend.
* @param plugins - List of all yet determined plugin information.
* @param metaConfiguration - Configuration file configuration.
* @param pluginPath - Path to given plugin.
* @param encoding - Encoding to use to read and write from child process's.
* @returns An object of plugin specific meta information.
*/var load=/*#__PURE__*/function(){var _load=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(name,internalName,plugins,metaConfiguration,pluginPath,encoding){var configurationFilePaths,packageConfiguration,_iterator5,_step5,fileName,filePath,sourceConfiguration,apiFilePaths,configuration,_t3;return _regenerator().w(function(_context3){while(1)switch(_context3.p=_context3.n){case 0:if(encoding===void 0){encoding="utf8"}configurationFilePaths=[];packageConfiguration={};_iterator5=_createForOfIteratorHelper(metaConfiguration.fileNames);_context3.p=1;_iterator5.s();case 2:if((_step5=_iterator5.n()).done){_context3.n=5;break}fileName=_step5.value;filePath=(0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(pluginPath,fileName);_context3.n=3;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 3:if(!_context3.v){_context3.n=4;break}sourceConfiguration=loadFile(filePath,name);(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,/*
NOTE: Source and target configuration got modified.
While the target configuration receives the modifications
the source configuration will lose their modification
expressions therefore we can use the source configuration
afterward to extend the target configuration.
*/(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.modifyObject)(packageConfiguration,sourceConfiguration),sourceConfiguration);configurationFilePaths.push(filePath);case 4:_context3.n=2;break;case 5:_context3.n=7;break;case 6:_context3.p=6;_t3=_context3.v;_iterator5.e(_t3);case 7:_context3.p=7;_iterator5.f();return _context3.f(7);case 8:apiFilePaths=["index.js"];if(!Object.keys(packageConfiguration).length){_context3.n=10;break}internalName=packageConfiguration.webNodeInternalName||internalName;configuration=loadConfiguration(internalName,packageConfiguration,metaConfiguration.propertyNames);if(configuration[internalName].package.main)apiFilePaths[0]=configuration[internalName].package.main;_context3.n=9;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths);case 9:return _context3.a(2,_context3.v);case 10:_context3.n=11;return loadAPI(apiFilePaths,pluginPath,name,internalName,plugins,encoding);case 11:return _context3.a(2,_context3.v)}},_callee3,null,[[1,6,7,8]])}));function load(_x3,_x4,_x5,_x6,_x7,_x8){return _load.apply(this,arguments)}return load}();/**
* Load given plugin api file in given path and generates a plugin specific
* data structure with useful meta information.
* @param relativeFilePaths - Paths to file to load relatively from given
* plugin path.
* @param pluginPath - Path to plugin directory.
* @param name - Plugin name to use for proper error messages.
* @param internalName - Internal plugin name to use for proper error messages.
* @param plugins - List of plugins to search for trigger callbacks in.
* @param encoding - Encoding to use to read and write from child process.
* @param configuration - Plugin specific configurations.
* @param configurationFilePaths - Plugin specific configuration file paths.
* @returns Plugin meta information object.
*/var loadAPI=/*#__PURE__*/function(){var _loadAPI=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(relativeFilePaths,pluginPath,name,internalName,plugins,encoding,configuration,configurationFilePaths){var filePath,_iterator6,_step6,fileName,api,nativeAPI,pluginConfiguration,_t4,_t5,_t6;return _regenerator().w(function(_context4){while(1)switch(_context4.p=_context4.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_4__.resolve)(pluginPath,relativeFilePaths[0]);_context4.n=1;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 1:if(_context4.v){_context4.n=10;break}// Determine entry file if given one does not exist.
_iterator6=_createForOfIteratorHelper((0,fs__WEBPACK_IMPORTED_MODULE_3__.readdirSync)(pluginPath));_context4.p=2;_iterator6.s();case 3:if((_step6=_iterator6.n()).done){_context4.n=7;break}fileName=_step6.value;_t4=!configurationFilePaths.map(function(filePath){return (0,path__WEBPACK_IMPORTED_MODULE_4__.basename)(filePath)}).includes(fileName);if(!_t4){_context4.n=5;break}_context4.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)((0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(pluginPath,fileName));case 4:_t4=_context4.v;case 5:if(!_t4){_context4.n=6;break}filePath=(0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(pluginPath,filePath);if(!["index","main"].includes((0,path__WEBPACK_IMPORTED_MODULE_4__.basename)(filePath,(0,path__WEBPACK_IMPORTED_MODULE_4__.extname)(fileName)))){_context4.n=6;break}return _context4.a(3,7);case 6:_context4.n=3;break;case 7:_context4.n=9;break;case 8:_context4.p=8;_t5=_context4.v;_iterator6.e(_t5);case 9:_context4.p=9;_iterator6.f();return _context4.f(9);case 10:api=null;nativeAPI=false;_t6=configuration&&(/*
NOTE: Check if a webNode plugin configuration is available
indicating a backend responsibility for api file.
NOTE: One key is always there representing the whole package
configuration.
*/Object.keys(configuration).length>1||Object.prototype.hasOwnProperty.call(configuration,internalName)&&Object.keys(configuration[internalName]).length>1);if(!_t6){_context4.n=12;break}_context4.n=11;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isFile)(filePath);case 11:_t6=_context4.v;case 12:if(!_t6){_context4.n=13;break}if(filePath.endsWith(".js")){nativeAPI=true;api=function api(state){var _ref;for(var _len3=arguments.length,parameters=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){parameters[_key3-1]=arguments[_key3]}if(plugins[name].scope&&state.hook in plugins[name].scope)return(_ref=plugins[name].scope)[state.hook].apply(_ref,[state].concat(parameters,[module]));throw new Error("NotImplemented: API method \"".concat(state.hook,"\" is not ")+"implemented in plugin \"".concat(name,"\"."))}}else// NOTE: Any executable file can represent an api.
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 13:pluginConfiguration=configuration!==null&&configuration!==void 0?configuration:_defineProperty({},internalName,{package:{}});return _context4.a(2,{api:api,apiFileLoadTimestamps:api?[(0,fs__WEBPACK_IMPORTED_MODULE_3__.statSync)(filePath).mtime.getTime()]:[],apiFilePaths:api?[filePath]:[],configuration:pluginConfiguration,configurationFilePaths:configurationFilePaths,configurationFileLoadTimestamps:configurationFilePaths.map(function(filePath){return (0,fs__WEBPACK_IMPORTED_MODULE_3__.statSync)(filePath).mtime.getTime()}),dependencies:Object.prototype.hasOwnProperty.call(pluginConfiguration,internalName)&&pluginConfiguration[internalName].dependencies?pluginConfiguration[internalName].dependencies:[],internalName:internalName,name:name,packageConfiguration:pluginConfiguration[internalName].package,path:pluginPath,scope:nativeAPI?loadFile(filePath,name):null})}},_callee4,null,[[2,8,9,10]])}));function loadAPI(_x9,_x0,_x1,_x10,_x11,_x12,_x13,_x14){return _loadAPI.apply(this,arguments)}return loadAPI}();/**
* Loads plugin specific configuration object.
* @param name - Property name where to inject resolved configuration into
* global one.
* @param packageConfiguration - Plugin specific package configuration object.
* @param configurationPropertyNames - Property names to search for to use as
* entry in plugin configuration file.
* @returns Determined configuration object.
*/var loadConfiguration=function loadConfiguration(name,packageConfiguration,configurationPropertyNames){/*
No plugin specific configuration found. Only provide package
configuration.
Removing comments (default key prefix to delete is "#").
*/var packageConfigurationCopy=(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.removeKeyPrefixes)((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(packageConfiguration));var result=_defineProperty({},name,{package:packageConfigurationCopy});var _iterator7=_createForOfIteratorHelper(configurationPropertyNames),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var propertyName=_step7.value;if(packageConfiguration[propertyName]){(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,result,packageConfiguration[propertyName]);/*
NOTE: We should break the cycle here to avoid endless loops
when traversing this data structure.
*/delete result[name].package[propertyName];break}}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}return result};/**
* Loads given plugin configurations into global configuration.
* @param plugins - Topological sorted list of plugins to check for
* configurations.
* @param configuration - Global configuration to extend with.
* @returns Updated given configuration object.
*/var loadConfigurations=function loadConfigurations(plugins,configuration){/*
First clear current configuration content key by key to let old top
level configuration object instance untouched.
*/for(var _i6=0,_Object$keys=Object.keys(configuration);_i6<_Object$keys.length;_i6++){var key=_Object$keys[_i6];delete configuration[key]};(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(configuration,(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.copy)(_configurator_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Ay));var _iterator8=_createForOfIteratorHelper(plugins),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var plugin=_step8.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),/*
NOTE: Should be resolved via preceding
"object.modifyObject" call.
*/pluginConfiguration);/*
NOTE: We apply provided runtime configuration after each plugin
specific configuration set to give runtime configuration always
the highest priority when resolving intermediate configuration
states.
*/if(configuration.core.runtimeConfiguration)(0,clientnode__WEBPACK_IMPORTED_MODULE_2__.extend)(true,configuration,configuration.core.runtimeConfiguration)}}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}return evaluateConfiguration(configuration)};/**
* Load given api file path and returns exported scope.
* @param filePath - Path to file to load.
* @param name - Plugin name to use for proper error messages.
* @param fallbackScope - Scope to return if an error occurs during loading.
* If a "null" is given an error will be thrown.
* @param doLogging - Enables logging.
* @returns Exported api file scope.
*/var loadFile=function loadFile(filePath,name,fallbackScope,doLogging){if(fallbackScope===void 0){fallbackScope=null}if(doLogging===void 0){doLogging=true}var reference;try{reference=currentRequire.resolve(filePath)}catch(_unused2){// Ignore error.
}// Clear module cache to get actual new module scope.
if(reference&&reference in currentRequire.cache)delete currentRequire.cache[reference];var scope;try{// TODO: Will not work for esmodules i guess.
scope=currentRequire(filePath)}catch(error){if(fallbackScope){scope=fallbackScope;if(doLogging)log.warn("Couldn't load new api plugin file \"".concat(filePath,"\" for"),"plugin \"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(error),". Using"),"fallback one.")}else throw new Error("Couldn't load plugin file \"".concat(filePath,"\" for plugin ")+"\"".concat(name,"\": ").concat((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.represent)(error)),{cause:error})}if(Object.prototype.hasOwnProperty.call(scope,"default")&&scope.default)return scope.default;return scope};/**
* Extends given configuration object with all plugin specific ones and returns
* a topological sorted list of plugins with plugins specific meta information
* stored.
* @param configuration - Configuration object to extend and use.
* @returns A topological sorted list of plugins objects.
*/var loadAll=/*#__PURE__*/function(){var _loadAll=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(configuration){var plugins,_i7,_Object$values,directory,compiledRegularExpression,_iterator9,_step9,pluginName,currentPluginPath,internalName,temporaryPlugins,_i8,_Object$values2,plugin,_iterator0,_step0,name,sortedPlugins,_iterator1,_step1,_pluginName,_i9,_Object$entries4,_Object$entries4$_i,_name2,_plugin,_t7,_t8,_t9,_t0;return _regenerator().w(function(_context5){while(1)switch(_context5.p=_context5.n){case 0:plugins={};/*
Load main plugin configuration at first.
NOTE: If application's main is this itself avoid loading it twice.
*/if(!(configuration.name!=="web-node")){_context5.n=2;break}_context5.n=1;return load(configuration.name,determineInternalName(configuration.name,new RegExp(configuration.core.plugin.directories.external.nameRegularExpressionPattern)),plugins,configuration.core.plugin.configuration,configuration.core.context.path,configuration.core.encoding);case 1:plugins[configuration.name]=_context5.v;case 2:_i7=0,_Object$values=Object.values(configuration.core.plugin.directories);case 3:if(!(_i7<_Object$values.length)){_context5.n=14;break}directory=_Object$values[_i7];_context5.n=4;return (0,clientnode__WEBPACK_IMPORTED_MODULE_2__.isDirectory)(directory.path);case 4:if(!_context5.v){_context5.n=13;break}compiledRegularExpression=new RegExp(directory.nameRegularExpressionPattern);_iterator9=_createForOfIteratorHelper((0,fs__WEBPACK_IMPORTED_MODULE_3__.readdirSync)(directory.path));_context5.p=5;_iterator9.s();case 6:if((_step9=_iterator9.n()).done){_context5.n=10;break}pluginName=_step9.value;if(compiledRegularExpression.test(pluginName)){_context5.n=7;break}return _context5.a(3,9);case 7:currentPluginPath=(0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(directory.path,pluginName);internalName=determineInternalName(pluginName,compiledRegularExpression);_context5.n=8;return load(pluginName,internalName,plugins,configuration.core.plugin.configuration,currentPluginPath,configuration.core.encoding);case 8:plugins[pluginName]=_context5.v;case 9:_context5.n=6;break;case 10:_context5.n=12;break;case 11:_context5.p=11;_t7=_context5.v;_iterator9.e(_t7);case 12:_context5.p=12;_iterator9.f();return _context5.f(12);case 13:_i7++;_context5.n=3;break;case 14: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)){_iterator0=_createForOfIteratorHelper([].concat(configuration.core.interDependencies[plugin.internalName]));try{for(_iterator0.s();!(_step0=_iterator0.n()).done;){name=_step0.value;if(!temporaryPlugins[plugin.internalName].includes(name))temporaryPlugins[plugin.internalName].push(name)}}catch(err){_iterator0.e(err)}finally{_iterator0.f()}}}sortedPlugins=[];_iterator1=_createForOfIteratorHelper((0,clientnode__WEBPACK_IMPORTED_MODULE_2__.sortTopological)(temporaryPlugins));_context5.p=15;_iterator1.s();case 16:if((_step1=_iterator1.n()).done){_context5.n=20;break}_pluginName=_step1.value;_i9=0,_Object$entries4=Object.entries(plugins);case 17:if(!(_i9<_Object$entries4.length)){_context5.n=19;break}_Object$entries4$_i=_slicedToArray(_Object$entries4[_i9],2),_name2=_Object$entries4$_i[0],_plugin=_Object$entries4$_i[1];if(![_plugin.internalName,_name2].includes(_pluginName)){_context5.n=18;break}sortedPlugins.push(_plugin);return _context5.a(3,19);case 18:_i9++;_context5.n=17;break;case 19:_context5.n=16;break;case 20:_context5.n=22;break;case 21:_context5.p=21;_t8=_context5.v;_iterator1.e(_t8);case 22:_context5.p=22;_iterator1.f();return _context5.f(22);case 23:_context5.n=24;return loadConfigurations(sortedPlugins,configuration);case 24:_t9=_context5.v;_t0=sortedPlugins;return _context5.a(2,{configuration:_t9,plugins:_t0})}},_callee5,null,[[15,21,22,23],[5,11,12,13]])}));function loadAll(_x15){return _loadAll.apply(this,arguments)}return loadAll}();/**
* Transform a list of absolute paths respecting the application context.
* @param configuration - Configuration object.
* @param configuration.core - Sub configuration web-node.
* @param configuration.core.context - Sub web-node context configurations.
* @param configuration.core.context.path - Current web-nodes path.
* @param locations - Locations to process.
* @returns Given and processed locations.
*/var determineLocations=function determineLocations(_ref4,locations){var contextPath=_ref4.core.context.path;if(locations===void 0){locations=[]}locations=[].concat(locations);return locations.length?locations.map(function(location){return (0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(contextPath,location)}):[contextPath]};/**
* Checks whether given file path is in provided locations.
* @param configuration - Configuration object.
* @param plugins - List of active plugins.
* @param filePath - Path to search for.
* @param locations - Locations to search in.
* @returns A boolean indicating whether given file path is in provided
* locations.
*/var isInLocations=function isInLocations(configuration,plugins,filePath,locations){var pluginPaths=plugins.map(function(plugin){return plugin.path});var _iterator10=_createForOfIteratorHelper([].concat(locations)),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var location=_step10.value;if(location.startsWith("/")){if(filePath.startsWith((0,path__WEBPACK_IMPORTED_MODULE_4__.join)(configuration.core.context.path,location)))return true}else{var _iterator11=_createForOfIteratorHelper(pluginPaths),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var pluginPath=_step11.value;if(filePath.startsWith((0,path__WEBPACK_IMPORTED_MODULE_4__.resolve)(pluginPath,location)))return true}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}}}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}return false};var pluginAPI={callStack:_callStack,callStackSynchronous:callStackSynchronous,determineInternalName:determineInternalName,determineLocations:determineLocations,evaluateConfiguration:evaluateConfiguration,hotReloadAPIFile:hotReloadAPIFile,hotReloadConfigurationFile:hotReloadConfigurationFile,hotReloadFiles:hotReloadFiles,isInLocations:isInLocations,load:load,loadAll:loadAll,loadAPI:loadAPI,loadConfiguration:loadConfiguration,loadConfigurations:loadConfigurations,loadFile:loadFile};/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (pluginAPI);
__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } }, 1);
/***/ }),
/* 1 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const x = (y) => {
const x = {}; __webpack_require__.d(x, y); return x
}
const y = (x) => (() => (x))
module.exports = x({ ["CLOSE_EVENT_NAMES"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.CLOSE_EVENT_NAMES), ["Logger"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.Logger), ["MAXIMAL_NUMBER_OF_ITERATIONS"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.MAXIMAL_NUMBER_OF_ITERATIONS), ["UTILITY_SCOPE"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.UTILITY_SCOPE), ["capitalize"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.capitalize), ["copy"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.copy), ["delimitedToCamelCase"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.delimitedToCamelCase), ["evaluateAsyncDynamicData"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.evaluateAsyncDynamicData), ["evaluateDynamicData"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.evaluateDynamicData), ["extend"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.extend), ["getCurrentRequire"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.getCurrentRequire), ["getUTCTimestamp"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.getUTCTimestamp), ["importFilesystemAPI"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.importFilesystemAPI), ["isDirectory"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.isDirectory), ["isFile"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.isFile), ["isFunction"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.isFunction), ["isObject"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.isObject), ["isPlainObject"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.isPlainObject), ["modifyObject"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.modifyObject), ["parseEncodedObject"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.parseEncodedObject), ["removeKeyPrefixes"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.removeKeyPrefixes), ["removeKeysInEvaluation"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.removeKeysInEvaluation), ["represent"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.represent), ["sortTopological"]: () => (__WEBPACK_EXTERNAL_MODULE_clientnode__.sortTopological) });
/***/ }),
/* 2 */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Ay: () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */ HF: () => (/* binding */ configuration),
/* harmony export */ lE: () => (/* binding */ currentRequire)
/* harmony export */ });
/* harmony import */ var clientnode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
/* harmony import */ var _pluginAPI_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_pluginAPI_js__WEBPACK_IMPORTED_MODULE_4__]);
var __webpack_async_dependencies_result__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
_pluginAPI_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_async_dependencies_result__[0];
// #!/usr/bin/env node
// -*- coding: utf-8 -*-
/* !
region header
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
-------
This library written by Torben Sickert stands under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
endregion
*/// region imports
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.protot