nginxwebnodeplugin 1.0.372 → 1.0.373
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 +1 -85
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,85 +1 @@
|
|
|
1
|
-
if(
|
|
2
|
-
import "core-js/modules/es.iterator.constructor.js";
|
|
3
|
-
import "core-js/modules/es.iterator.filter.js";
|
|
4
|
-
import "core-js/modules/es.iterator.for-each.js";
|
|
5
|
-
import { exec as __WEBPACK_EXTERNAL_MODULE_child_process_exec__, spawn as __WEBPACK_EXTERNAL_MODULE_child_process_spawn__ } from "child_process";
|
|
6
|
-
import { CLOSE_EVENT_NAMES as __WEBPACK_EXTERNAL_MODULE_clientnode_CLOSE_EVENT_NAMES__, Logger as __WEBPACK_EXTERNAL_MODULE_clientnode_Logger__, checkReachability as __WEBPACK_EXTERNAL_MODULE_clientnode_checkReachability__, checkUnreachability as __WEBPACK_EXTERNAL_MODULE_clientnode_checkUnreachability__, getProcessCloseHandler as __WEBPACK_EXTERNAL_MODULE_clientnode_getProcessCloseHandler__, represent as __WEBPACK_EXTERNAL_MODULE_clientnode_represent__ } from "clientnode";
|
|
7
|
-
import { Agent as __WEBPACK_EXTERNAL_MODULE_https_Agent__ } from "https";
|
|
8
|
-
|
|
9
|
-
;// external "core-js/modules/es.array.push.js"
|
|
10
|
-
|
|
11
|
-
;// external "core-js/modules/es.iterator.constructor.js"
|
|
12
|
-
|
|
13
|
-
;// external "core-js/modules/es.iterator.filter.js"
|
|
14
|
-
|
|
15
|
-
;// external "core-js/modules/es.iterator.for-each.js"
|
|
16
|
-
|
|
17
|
-
;// external "child_process"
|
|
18
|
-
|
|
19
|
-
;// external "clientnode"
|
|
20
|
-
|
|
21
|
-
;// external "https"
|
|
22
|
-
|
|
23
|
-
;// ./index.ts
|
|
24
|
-
// #!/usr/bin/env babel-node
|
|
25
|
-
// -*- coding: utf-8 -*-
|
|
26
|
-
/** @module nginx-web-node-plugin *//* !
|
|
27
|
-
region header
|
|
28
|
-
[Project page](https://tsickert.com/nginx-web-node-plugin)
|
|
29
|
-
|
|
30
|
-
Copyright Torben Sickert (info["~at~"]tsickert.com) 16.12.2012
|
|
31
|
-
|
|
32
|
-
License
|
|
33
|
-
-------
|
|
34
|
-
|
|
35
|
-
This library written by Torben Sickert stands under a creative commons
|
|
36
|
-
naming 4.0 international license.
|
|
37
|
-
See https://creativecommons.org/licenses/by/4.0/deed.de
|
|
38
|
-
endregion
|
|
39
|
-
*/// region imports
|
|
40
|
-
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 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(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach(function(t){_defineProperty(r,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function _defineProperty(r,t,o){return(t=_toPropertyKey(t))in r?Object.defineProperty(r,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[t]=o,r}function _toPropertyKey(r){var o=_toPrimitive(r,"string");return"symbol"==_typeof(o)?o:o+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r;if("undefined"!=typeof Symbol&&void 0!==(r=t[Symbol.toPrimitive])){var i=r.call(t,e||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function _regenerator(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,o="function"==typeof Symbol?Symbol:{},n=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function i(o,n,a,i){var u=n&&n.prototype instanceof Generator?n:Generator,f=Object.create(u.prototype);return _regeneratorDefine2(f,"_invoke",function(t,o,n){var a,i,u,f=0,p=n||[],y=!1,G={p:0,n:0,v:r,a:l,f:l.bind(r,4),d:function d(t,e){return a=t,i=0,u=r,G.n=e,c}};function l(t,o){for(i=t,u=o,e=0;!y&&f&&!n&&e<p.length;e++){var n,a=p[e],l=G.p,F=a[2];t>3?(n=F===o)&&(u=a[(i=a[4])?5:(i=3,3)],a[4]=a[5]=r):a[0]<=l&&((n=t<2&&l<a[1])?(i=0,G.v=o,G.n=a[1]):l<F&&(n=t<3||a[0]>o||o>F)&&(a[4]=t,a[5]=o,G.n=F,i=0))}if(n||t>1)return c;throw y=!0,o}return function(n,p,F){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&l(p,F),i=p,u=F;(e=i<2?r:u)||!y;){a||(i?(i>1&&(G.n=i<3?-1:u),l(i,u)):G.v=u);try{if(f=2,a){if(i||(n="next"),e=a[n]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,i<2&&(i=0)}else 1===i&&(e=a.return)&&e.call(a),i<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),i=1);a=r}else if((e=(y=G.n<0)?u:t.call(o,G))!==c)break}catch(t){a=r,i=1,u=t}finally{f=1}}return{value:e,done:y}}}(o,a,i),!0),f}var c={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(_regeneratorDefine2(e={},n,function(){return this}),e),f=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(u);function p(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,GeneratorFunctionPrototype):(r.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(r,a,"GeneratorFunction")),r.prototype=Object.create(f),r}return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(f,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,a,"GeneratorFunction"),_regeneratorDefine2(f),_regeneratorDefine2(f,a,"Generator"),_regeneratorDefine2(f,n,function(){return this}),_regeneratorDefine2(f,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:p}})()}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 _createForOfIteratorHelper(e,t){var _n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!_n){if(Array.isArray(e)||(_n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){_n&&(e=_n);var o=0,F=function F(){};return{s:F,n:function n(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},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 a,u,i=!0;return{s:function s(){_n=_n.call(e)},n:function n(){i=!0;var r=_n.next();return r.done?{done:!0}:{value:r.value,done:i=!1}},e:function e(r){a=!0,u=r},f:function f(){try{i||null==_n.return||_n.return()}finally{if(a)throw u}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):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 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
|
|
41
|
-
var log=new __WEBPACK_EXTERNAL_MODULE_clientnode_Logger__({name:"web-node.nginx"});// region plugins/classes
|
|
42
|
-
/**
|
|
43
|
-
* Launches an application server und triggers all some pluginable hooks on
|
|
44
|
-
* an event.
|
|
45
|
-
*/// region api
|
|
46
|
-
/**
|
|
47
|
-
* Start nginx's child process and return a Promise which observes this
|
|
48
|
-
* service.
|
|
49
|
-
* @param state - Application state.
|
|
50
|
-
* @param state.configuration - Applications configuration.
|
|
51
|
-
* @param state.configuration.applicationServer - Plugins configuration.
|
|
52
|
-
* @param state.services - An object with stored service instances.
|
|
53
|
-
* @returns A mapping to promises which correspond to the plugin specific
|
|
54
|
-
* continues services.
|
|
55
|
-
*/var loadService=/*#__PURE__*/function(){var _loadService=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref){var configuration,services,nginx,promise,_t;return _regenerator().w(function(_context){while(1)switch(_context.p=_context.n){case 0:configuration=_ref.configuration.applicationServer,services=_ref.services;if(!services.nginx){_context.n=1;break}return _context.a(2,null);case 1:nginx=__WEBPACK_EXTERNAL_MODULE_child_process_spawn__("nginx",[],{cwd:process.cwd(),env:process.env,/*
|
|
56
|
-
NOTE: No shell here since e.g. "dash" (default "/bin/sh" on
|
|
57
|
-
debian) does not forward signals to its child so nginx could
|
|
58
|
-
not be stopped.
|
|
59
|
-
*/stdio:"inherit"});services.nginx=nginx;nginx.reload=function(){return new Promise(function(resolve,reject){return __WEBPACK_EXTERNAL_MODULE_child_process_exec__("nginx -s reload",{env:process.env},function(error,standardOutput,standardErrorOutput){if(error){error.standardErrorOutput=standardErrorOutput;/*
|
|
60
|
-
eslint-disable
|
|
61
|
-
@typescript-eslint/prefer-promise-reject-errors
|
|
62
|
-
*/reject(error);/*
|
|
63
|
-
eslint-enable
|
|
64
|
-
@typescript-eslint/prefer-promise-reject-errors
|
|
65
|
-
*/}else resolve(standardOutput)})})};promise=new Promise(function(resolve,reject){var _iterator=_createForOfIteratorHelper(__WEBPACK_EXTERNAL_MODULE_clientnode_CLOSE_EVENT_NAMES__),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var closeEventName=_step.value;nginx.on(closeEventName,__WEBPACK_EXTERNAL_MODULE_clientnode_getProcessCloseHandler__(resolve,configuration.proxy.optional?resolve:reject,{reason:nginx,process:nginx}))}}catch(err){_iterator.e(err)}finally{_iterator.f()}});_context.p=2;_context.n=3;return checkReachability(configuration);case 3:_context.n=6;break;case 4:_context.p=4;_t=_context.v;if(!configuration.proxy.optional){_context.n=5;break}void log.warn("Nginx couldn't be started (or at least","\"".concat(configuration.proxy.url,"\" could not be reached) but was"),"marked as optional.");services.nginx=null;promise=null;_context.n=6;break;case 5:throw new Error("Could not acknowledge that nginx is running because "+"\"".concat(configuration.proxy.url,"\" is not reachable: ")+__WEBPACK_EXTERNAL_MODULE_clientnode_represent__(_t),{cause:_t});case 6:return _context.a(2,{nginx:promise})}},_callee,null,[[2,4]])}));function loadService(_x){return _loadService.apply(this,arguments)}return loadService}();/**
|
|
66
|
-
* Application will be closed soon.
|
|
67
|
-
* @param state - Application state.
|
|
68
|
-
* @param state.configuration - Applications configuration.
|
|
69
|
-
* @param state.services - Application services.
|
|
70
|
-
* @returns Given object of services.
|
|
71
|
-
*/var shouldExit=/*#__PURE__*/function(){var _shouldExit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2){var _services$nginx;var configuration,services;return _regenerator().w(function(_context2){while(1)switch(_context2.n){case 0:configuration=_ref2.configuration,services=_ref2.services;if(!((_services$nginx=services.nginx)!==null&&_services$nginx!==void 0&&_services$nginx.kill)){_context2.n=1;break}services.nginx.kill("SIGINT");_context2.n=1;return checkReachability(configuration.applicationServer,true);case 1:delete services.nginx;case 2:return _context2.a(2)}},_callee2)}));function shouldExit(_x2){return _shouldExit.apply(this,arguments)}return shouldExit}();// endregion
|
|
72
|
-
// region helper
|
|
73
|
-
/**
|
|
74
|
-
* Check if a nginx server is currently (not) running.
|
|
75
|
-
* @param serverConfiguration - Mutable by plugins extended configuration
|
|
76
|
-
* object.
|
|
77
|
-
* @param inverse - Boolean indicating if we should check for reachability or
|
|
78
|
-
* un-reachability.
|
|
79
|
-
* @param givenOptions - Tools reachability options to configure how to check
|
|
80
|
-
* for reachability.
|
|
81
|
-
* @returns A promise which will be resolved if a request to given url has
|
|
82
|
-
* (not) finished, otherwise returned promise will be rejected.
|
|
83
|
-
*/var checkReachability=function checkReachability(serverConfiguration,inverse,givenOptions){if(inverse===void 0){inverse=false}if(givenOptions===void 0){givenOptions={}}if(serverConfiguration.proxy.url){var isSSL=serverConfiguration.proxy.url.startsWith("https://");var options=_objectSpread({options:_objectSpread({redirect:"manual"},isSSL?{agent:new __WEBPACK_EXTERNAL_MODULE_https_Agent__({rejectUnauthorized:false})}:{}),pollIntervalInSeconds:.1,statusCodes:[100,101,102,200,201,202,203,204,205,206,207,208,226,300,301,302,303,304,305,306,307,308],timeoutInSeconds:3,wait:true},givenOptions);return(inverse?__WEBPACK_EXTERNAL_MODULE_clientnode_checkUnreachability__:__WEBPACK_EXTERNAL_MODULE_clientnode_checkReachability__)(serverConfiguration.proxy.url,options)}return Promise.resolve(null)};// endregion
|
|
84
|
-
var nginx={loadService:loadService,shouldExit:shouldExit,checkReachability:checkReachability};/* harmony default export */ const index = (nginx);// endregion
|
|
85
|
-
export { checkReachability, index as default, loadService, log, nginx, shouldExit };
|
|
1
|
+
if(null==r)var r="undefined"==typeof globalThis||null===globalThis?{}:globalThis;import"core-js/modules/es.array.push.js";import"core-js/modules/es.iterator.constructor.js";import"core-js/modules/es.iterator.filter.js";import"core-js/modules/es.iterator.for-each.js";import{exec as t,spawn as e}from"child_process";import{CLOSE_EVENT_NAMES as n,Logger as o,checkReachability as i,checkUnreachability as a,getProcessCloseHandler as u,represent as c}from"clientnode";import{Agent as l}from"https";function s(r){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},s(r)}function f(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})),e.push.apply(e,n)}return e}function p(r){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?f(Object(e),!0).forEach(function(t){y(r,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):f(Object(e)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))})}return r}function y(r,t,e){return(t=function(r){var t=function(r,t){if("object"!=s(r)||!r)return r;var e;if("undefined"!=typeof Symbol&&void 0!==(e=r[Symbol.toPrimitive])){var n=e.call(r,t||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==s(t)?t:t+""}(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function b(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,t,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof u?n:u,l=Object.create(c.prototype);return v(l,"_invoke",function(e,n,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:r,a:y,f:y.bind(r,4),d:function(t,e){return i=t,u=0,c=r,p.n=e,a}};function y(e,n){for(u=e,c=n,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],y=p.p,b=i[2];e>3?(o=b===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=r):i[0]<=y&&((o=e<2&&y<i[1])?(u=0,p.v=n,p.n=i[1]):y<b&&(o=e<3||i[0]>n||n>b)&&(i[4]=e,i[5]=n,p.n=b,u=0))}if(o||e>1)return a;throw f=!0,n}return function(o,s,b){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,b),u=s,c=b;(t=u<2?r:c)||!f;){i||(u?(u>1&&(p.n=u<3?-1:c),y(u,c)):p.v=c);try{if(l=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=r}else if((t=(f=p.n<0)?c:e.call(n,p))!==a)break}catch(t){i=r,u=1,c=t}finally{l=1}}return{value:t,done:f}}}(e,o,i),!0),l}var a={};function u(){}function c(){}function l(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(v(t={},n,function(){return this}),t),f=l.prototype=u.prototype=Object.create(s);function p(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,l):(r.__proto__=l,v(r,o,"GeneratorFunction")),r.prototype=Object.create(f),r}return c.prototype=l,v(f,"constructor",l),v(l,"constructor",c),c.displayName="GeneratorFunction",v(l,o,"GeneratorFunction"),v(f),v(f,o,"Generator"),v(f,n,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function v(r,t,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(r){o=0}v=function(r,t,e,n){function i(t,e){v(r,t,function(r){return this._invoke(t,e,r)})}t?o?o(r,t,{value:e,enumerable:!n,configurable:!n,writable:!n}):r[t]=e:(i("next",0),i("throw",1),i("return",2))},v(r,t,e,n)}function d(r,t){var e="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=function(r,t){if(r){if("string"==typeof r)return m(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(r,t):void 0}}(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var n=0,o=function(){};return{s:o,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:o}}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 i,a,u=!0;return{s:function(){e=e.call(r)},n:function(){u=!0;var r=e.next();return r.done?{done:!0}:{value:r.value,done:u=!1}},e:function(r){i=!0,a=r},f:function(){try{u||null==e.return||e.return()}finally{if(i)throw a}}}}function m(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function h(r,t,e,n,o,i,a){try{var u=r[i](a),c=u.value}catch(r){return void e(r)}u.done?t(c):Promise.resolve(c).then(n,o)}function g(r){return function(){var t=this,e=arguments;return new Promise(function(n,o){var i=r.apply(t,e);function a(r){h(i,n,o,a,u,"next",r)}function u(r){h(i,n,o,a,u,"throw",r)}a(void 0)})}}var w=new o({name:"web-node.nginx"}),j=function(){var r=g(b().m(function r(o){var i,a,l,s,f;return b().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i=o.configuration.applicationServer,!(a=o.services).nginx){r.n=1;break}return r.a(2,null);case 1:return l=e("nginx",[],{cwd:process.cwd(),env:process.env,stdio:"inherit"}),a.nginx=l,l.reload=function(){return new Promise(function(r,e){return t("nginx -s reload",{env:process.env},function(t,n,o){t?(t.standardErrorOutput=o,e(t)):r(n)})})},s=new Promise(function(r,t){var e,o=d(n);try{for(o.s();!(e=o.n()).done;){var a=e.value;l.on(a,u(r,i.proxy.optional?r:t,{reason:l,process:l}))}}catch(r){o.e(r)}finally{o.f()}}),r.p=2,r.n=3,S(i);case 3:r.n=6;break;case 4:if(r.p=4,f=r.v,!i.proxy.optional){r.n=5;break}w.warn("Nginx couldn't be started (or at least",'"'.concat(i.proxy.url,'" could not be reached) but was'),"marked as optional."),a.nginx=null,s=null,r.n=6;break;case 5:throw new Error("Could not acknowledge that nginx is running because "+'"'.concat(i.proxy.url,'" is not reachable: ')+c(f),{cause:f});case 6:return r.a(2,{nginx:s})}},r,null,[[2,4]])}));return function(t){return r.apply(this,arguments)}}(),O=function(){var r=g(b().m(function r(t){var e,n,o;return b().w(function(r){for(;;)switch(r.n){case 0:if(n=t.configuration,o=t.services,null===(e=o.nginx)||void 0===e||!e.kill){r.n=1;break}return o.nginx.kill("SIGINT"),r.n=1,S(n.applicationServer,!0);case 1:delete o.nginx;case 2:return r.a(2)}},r)}));return function(t){return r.apply(this,arguments)}}(),S=function(r,t,e){if(void 0===t&&(t=!1),void 0===e&&(e={}),r.proxy.url){var n=p({options:p({redirect:"manual"},r.proxy.url.startsWith("https://")?{agent:new l({rejectUnauthorized:!1})}:{}),pollIntervalInSeconds:.1,statusCodes:[100,101,102,200,201,202,203,204,205,206,207,208,226,300,301,302,303,304,305,306,307,308],timeoutInSeconds:3,wait:!0},e);return(t?a:i)(r.proxy.url,n)}return Promise.resolve(null)},x={loadService:j,shouldExit:O,checkReachability:S};const P=x;export{S as checkReachability,P as default,j as loadService,w as log,x as nginx,O as shouldExit};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nginxwebnodeplugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.373",
|
|
4
4
|
"description": "A nginx proxy server configuration template for webNode.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@babel/core": "^8.1.2",
|
|
54
54
|
"@babel/eslint-parser": "^8.1.2",
|
|
55
55
|
"@eslint/js": "^10.0.1",
|
|
56
|
-
"@stylistic/eslint-plugin": "^
|
|
56
|
+
"@stylistic/eslint-plugin": "^6.0.1",
|
|
57
57
|
"@types/node": "^26.6.6",
|
|
58
58
|
"@types/webpack-env": "^1.18.8",
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^8.72.2",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"jsdoc": "^4.0.5",
|
|
69
69
|
"node-fetch": "^3.3.2",
|
|
70
70
|
"typescript-eslint": "^8.72.2",
|
|
71
|
-
"web-documentation": "^1.0.
|
|
71
|
+
"web-documentation": "^1.0.76",
|
|
72
72
|
"web-node": "^1.0.641",
|
|
73
|
-
"weboptimizer": "^4.0.
|
|
73
|
+
"weboptimizer": "^4.0.121"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"application-server-web-node-plugin": "*",
|