fable 3.0.6 → 3.0.7
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/dist/fable.js +827 -45
- package/dist/fable.min.js +12 -12
- package/dist/fable.min.js.map +1 -1
- package/package.json +2 -1
- package/source/Fable-Utility-Template.js +9 -9
- package/source/Fable-Utility.js +6 -0
- package/test/FableUtility_tests.js +60 -3
package/dist/fable.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=t()}}((function(){return function t(e,r,n){function s
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=t()}}((function(){return function t(e,r,n){function o(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[s]={exports:{}};e[s][0].call(c.exports,(function(t){return o(e[s][1][t]||t)}),c,c.exports,t,e,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,i.isAsync)(t))return function(...e){const r=e.pop();return a(t.apply(this,e),r)};return(0,n.default)((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return a(n,r);r(null,n)}))};var n=s(t("./internal/initialParams.js")),o=s(t("./internal/setImmediate.js")),i=t("./internal/wrapAsync.js");function s(t){return t&&t.__esModule?t:{default:t}}function a(t,e){return t.then((t=>{u(e,null,t)}),(t=>{u(e,t&&t.message?t:new Error(t))}))}function u(t,e,r){try{t(e,r)}catch(t){(0,o.default)((t=>{throw t}),t)}}e.exports=r.default},{"./internal/initialParams.js":8,"./internal/setImmediate.js":13,"./internal/wrapAsync.js":15}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/eachOfLimit.js")),o=a(t("./internal/withoutIndex.js")),i=a(t("./internal/wrapAsync.js")),s=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e,r,s){return(0,n.default)(e)(t,(0,o.default)((0,i.default)(r)),s)}),4),e.exports=r.default},{"./internal/awaitify.js":4,"./internal/eachOfLimit.js":6,"./internal/withoutIndex.js":14,"./internal/wrapAsync.js":15}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e,r,n){let o=!1,s=!1,a=!1,u=0,l=0;function c(){u>=e||a||o||(a=!0,t.next().then((({value:t,done:e})=>{if(!s&&!o){if(a=!1,e)return o=!0,void(u<=0&&n(null));u++,r(t,l,f),l++,c()}})).catch(h))}function f(t,e){if(u-=1,!s)return t?h(t):!1===t?(o=!0,void(s=!0)):e===i.default||o&&u<=0?(o=!0,n(null)):void c()}function h(t){s||(a=!1,o=!0,n(t))}c()};var n,o=t("./breakLoop.js"),i=(n=o)&&n.__esModule?n:{default:n};e.exports=r.default},{"./breakLoop.js":5}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise(((n,o)=>{r[e-1]=(t,...e)=>{if(t)return o(t);n(e.length>1?e:e[0])},t.apply(this,r)}))}},e.exports=r.default},{}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={},e.exports=r.default},{}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=l(t("./once.js")),o=l(t("./iterator.js")),i=l(t("./onlyOnce.js")),s=t("./wrapAsync.js"),a=l(t("./asyncEachOfLimit.js")),u=l(t("./breakLoop.js"));function l(t){return t&&t.__esModule?t:{default:t}}r.default=t=>(e,r,l)=>{if(l=(0,n.default)(l),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return l(null);if((0,s.isAsyncGenerator)(e))return(0,a.default)(e,t,r,l);if((0,s.isAsyncIterable)(e))return(0,a.default)(e[Symbol.asyncIterator](),t,r,l);var c=(0,o.default)(e),f=!1,h=!1,p=0,d=!1;function g(t,e){if(!h)if(p-=1,t)f=!0,l(t);else if(!1===t)f=!0,h=!0;else{if(e===u.default||f&&p<=0)return f=!0,l(null);d||m()}}function m(){for(d=!0;p<t&&!f;){var e=c();if(null===e)return f=!0,void(p<=0&&l(null));p+=1,r(e.value,e.key,(0,i.default)(g))}d=!1}m()},e.exports=r.default},{"./asyncEachOfLimit.js":3,"./breakLoop.js":5,"./iterator.js":10,"./once.js":11,"./onlyOnce.js":12,"./wrapAsync.js":15}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()},e.exports=r.default},{}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){var r=e.pop();return t.call(this,e,r)}},e.exports=r.default},{}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0},e.exports=r.default},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,n.default)(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e=(0,o.default)(t);return e?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(e):(r=t,i=r?Object.keys(r):[],s=-1,a=i.length,function t(){var e=i[++s];return"__proto__"===e?t():s<a?{value:r[e],key:e}:null});var r,i,s,a};var n=i(t("./isArrayLike.js")),o=i(t("./getIterator.js"));function i(t){return t&&t.__esModule?t:{default:t}}e.exports=r.default},{"./getIterator.js":7,"./isArrayLike.js":9}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e},e.exports=r.default},{}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}},e.exports=r.default},{}],13:[function(t,e,r){(function(t,e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fallback=a,r.wrap=u;var n,o=r.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,i=r.hasSetImmediate="function"==typeof e&&e,s=r.hasNextTick="object"==typeof t&&"function"==typeof t.nextTick;function a(t){setTimeout(t,0)}function u(t){return(e,...r)=>t((()=>e(...r)))}n=o?queueMicrotask:i?e:s?t.nextTick:a,r.default=u(n)}).call(this)}).call(this,t("_process"),t("timers").setImmediate)},{_process:30,timers:31}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return(e,r,n)=>t(e,n)},e.exports=r.default},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isAsyncIterable=r.isAsyncGenerator=r.isAsync=void 0;var n,o=t("../asyncify.js"),i=(n=o)&&n.__esModule?n:{default:n};function s(t){return"AsyncFunction"===t[Symbol.toStringTag]}r.default=function(t){if("function"!=typeof t)throw new Error("expected a function");return s(t)?(0,i.default)(t):t},r.isAsync=s,r.isAsyncGenerator=function(t){return"AsyncGenerator"===t[Symbol.toStringTag]},r.isAsyncIterable=function(t){return"function"==typeof t[Symbol.asyncIterator]}},{"../asyncify.js":1}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/once.js")),o=a(t("./internal/onlyOnce.js")),i=a(t("./internal/wrapAsync.js")),s=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e){if(e=(0,n.default)(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function s(e){(0,i.default)(t[r++])(...e,(0,o.default)(a))}function a(n,...o){if(!1!==n)return n||r===t.length?e(n,...o):void s(o)}s([])})),e.exports=r.default},{"./internal/awaitify.js":4,"./internal/once.js":11,"./internal/onlyOnce.js":12,"./internal/wrapAsync.js":15}],17:[function(t,e,r){e.exports=
|
|
2
2
|
/**
|
|
3
3
|
* Base Logger Class
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @author Steven Velozo <steven@velozo.com>
|
|
8
8
|
*/
|
|
9
|
-
class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],
|
|
9
|
+
class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],18:[function(t,e,r){
|
|
10
10
|
/**
|
|
11
11
|
* Default Logger Provider Function
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUI
|
|
|
14
14
|
*
|
|
15
15
|
* @author Steven Velozo <steven@velozo.com>
|
|
16
16
|
*/
|
|
17
|
-
getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":
|
|
17
|
+
getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":20}],19:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],20:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!t.hasOwnProperty("showtimestamps")&&1==t.showtimestamps,this._FormattedTimeStamps=!!t.hasOwnProperty("formattedtimestamps")&&1==t.formattedtimestamps,this._ContextMessage=t.hasOwnProperty("Context")?`(${t.Context})`:e._Settings.hasOwnProperty("Product")?`(${e._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!t.hasOwnProperty("outputloglinestoconsole")||t.outputloglinestoconsole,this._OutputObjectsToConsole=!t.hasOwnProperty("outputobjectstoconsole")||t.outputobjectstoconsole,this.prefixCache={};for(let t=0;t<=this.levels.length;t++)this.prefixCache[this.levels[t]]=`[${this.levels[t]}] ${this._ContextMessage}: `,this._ShowTimeStamps&&(this.prefixCache[this.levels[t]]=" "+this.prefixCache[this.levels[t]])}write(t,e,r){let n="";this._ShowTimeStamps&&this._FormattedTimeStamps?n=(new Date).toISOString():this._ShowTimeStamps&&(n=+new Date);let o=`${n}${this.prefixCache[t]}${e}`;return this._OutputLogLinesToConsole&&console.log(o),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),o}}},{"./Fable-Log-BaseLogger.js":17}],21:[function(t,e,r){
|
|
18
18
|
/**
|
|
19
19
|
* Fable Logging Add-on
|
|
20
20
|
*
|
|
@@ -23,7 +23,7 @@ getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console
|
|
|
23
23
|
* @author Steven Velozo <steven@velozo.com>
|
|
24
24
|
* @module Fable Logger
|
|
25
25
|
*/
|
|
26
|
-
class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",
|
|
26
|
+
class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",o=+new Date;this.info(`${n} logged at (epoch ${+o}) took (${t}ms)`,r)}logTimeDeltaHuman(t,e,r){let n=void 0!==e?e:"Time Measurement",o=+new Date,i=parseInt(t%1e3),s=parseInt(t/1e3%60),a=parseInt(t/6e4%60),u=parseInt(t/36e5);i=i<10?"00"+i:i<100?"0"+i:i,s=s<10?"0"+s:s,a=a<10?"0"+a:a,u=u<10?"0"+u:u,this.info(`${n} logged at (epoch ${+o}) took (${t}ms) or (${u}:${a}:${s}.${i})`,r)}logTimeDeltaRelative(t,e,r){this.logTimeDelta(this.getTimeDelta(t),e,r)}logTimeDeltaRelativeHuman(t,e,r){this.logTimeDeltaHuman(this.getTimeDelta(t),e,r)}}e.exports={new:function(t){return new n(t)},FableLog:n}},{"./Fable-Log-DefaultProviders-Node.js":18,"./Fable-Log-DefaultStreams.json":19}],22:[function(t,e,r){e.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],23:[function(t,e,r){(function(t){(function(){e.exports=
|
|
27
27
|
/**
|
|
28
28
|
* Fable Settings Template Processor
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@ class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Pr
|
|
|
34
34
|
* @author Steven Velozo <steven@velozo.com>
|
|
35
35
|
* @module Fable Settings
|
|
36
36
|
*/
|
|
37
|
-
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),
|
|
37
|
+
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),o=r.substring(n+1),i=n>-1?r.substring(0,n):r;return t.env.hasOwnProperty(i)?t.env[i]:o}))}parseSetting(t){return this.templateProcessor.parseString(t)}}}).call(this)}).call(this,t("_process"))},{_process:30}],24:[function(t,e,r){
|
|
38
38
|
/**
|
|
39
39
|
* Fable Settings Add-on
|
|
40
40
|
*
|
|
@@ -43,7 +43,7 @@ class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcess
|
|
|
43
43
|
* @author Steven Velozo <steven@velozo.com>
|
|
44
44
|
* @module Fable Settings
|
|
45
45
|
*/
|
|
46
|
-
const n=t("precedent"),
|
|
46
|
+
const n=t("precedent"),o=t("./Fable-Settings-TemplateProcessor.js");class i{constructor(e){this.dependencies={precedent:n},this.settingsTemplateProcessor=new o(this.dependencies),this._configureEnvTemplating(e),this.default=this.buildDefaultSettings();let r=this.merge(e,this.buildDefaultSettings());if(this.base=JSON.parse(JSON.stringify(r)),r.DefaultConfigFile)try{r=this.merge(t(r.DefaultConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}if(r.ConfigFile)try{r=this.merge(t(r.ConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}this.settings=r}buildDefaultSettings(){return JSON.parse(JSON.stringify(t("./Fable-Settings-Default")))}_configureEnvTemplating(t){this._PerformEnvTemplating=!t||!0!==t.NoEnvReplacement}_resolveEnv(t){for(const e in t)"object"==typeof t[e]?this._resolveEnv(t[e]):"string"==typeof t[e]&&(t[e]=this.settingsTemplateProcessor.parseSetting(t[e]))}_isObject(t){return"object"==typeof t&&!Array.isArray(t)}_deepMergeObjects(t,e){if(e&&this._isObject(e))return Object.keys(e).forEach((r=>{const n=e[r];if(this._isObject(n)){const e=t[r];if(e&&this._isObject(e))return void this._deepMergeObjects(e,n)}t[r]=n})),t}merge(t,e){let r="object"==typeof t?t:{},n="object"==typeof e?e:this.settings,o=JSON.parse(JSON.stringify(r));return n=this._deepMergeObjects(n,o),this._PerformEnvTemplating&&this._resolveEnv(n),this._configureEnvTemplating(n),n}fill(t){let e="object"==typeof t?t:{},r=JSON.parse(JSON.stringify(e));return this.settings=this._deepMergeObjects(r,this.settings),this.settings}}e.exports={new:function(t){return new i(t)},FableSettings:i}},{"./Fable-Settings-Default":22,"./Fable-Settings-TemplateProcessor.js":23,precedent:27}],25:[function(t,e,r){e.exports=
|
|
47
47
|
/**
|
|
48
48
|
* Random Byte Generator - Browser version
|
|
49
49
|
*
|
|
@@ -51,7 +51,7 @@ const n=t("precedent"),s=t("./Fable-Settings-TemplateProcessor.js");class o{cons
|
|
|
51
51
|
*
|
|
52
52
|
* @author Steven Velozo <steven@velozo.com>
|
|
53
53
|
*/
|
|
54
|
-
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let t=new Uint8Array(16);return this.getRandomValues(t),t}generateRandomBytes(){let t=new Uint8Array(16);for(let e,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],
|
|
54
|
+
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let t=new Uint8Array(16);return this.getRandomValues(t),t}generateRandomBytes(){let t=new Uint8Array(16);for(let e,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],26:[function(t,e,r){
|
|
55
55
|
/**
|
|
56
56
|
* Fable UUID Generator
|
|
57
57
|
*
|
|
@@ -60,7 +60,7 @@ class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getR
|
|
|
60
60
|
* @author Steven Velozo <steven@velozo.com>
|
|
61
61
|
* @module Fable UUID
|
|
62
62
|
*/
|
|
63
|
-
var n=t("./Fable-UUID-Random.js");class
|
|
63
|
+
var n=t("./Fable-UUID-Random.js");class o{constructor(t){this._UUIDModeRandom=!("object"!=typeof t||!t.hasOwnProperty("UUIDModeRandom"))&&1==t.UUIDModeRandom,this._UUIDLength="object"==typeof t&&t.hasOwnProperty("UUIDLength")?t.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof t&&t.hasOwnProperty("UUIDDictionary")?t.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new n,this._HexLookup=[];for(let t=0;t<256;++t)this._HexLookup[t]=(t+256).toString(16).substr(1)}bytesToUUID(t){let e=0;return[this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]]].join("")}generateUUIDv4(){new Array(16);var t=this.randomByteGenerator.generate();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,this.bytesToUUID(t)}generateRandom(){let t="";for(let e=0;e<this._UUIDLength;e++)t+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return t}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}e.exports={new:function(t){return new o(t)},FableUUID:o}},{"./Fable-UUID-Random.js":25}],27:[function(t,e,r){
|
|
64
64
|
/**
|
|
65
65
|
* Precedent Meta-Templating
|
|
66
66
|
*
|
|
@@ -70,7 +70,7 @@ var n=t("./Fable-UUID-Random.js");class s{constructor(t){this._UUIDModeRandom=!(
|
|
|
70
70
|
*
|
|
71
71
|
* @description Process text streams, parsing out meta-template expressions.
|
|
72
72
|
*/
|
|
73
|
-
var n=t("./WordTree.js"),
|
|
73
|
+
var n=t("./WordTree.js"),o=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new o,this.ParseTree=this.WordTree.ParseTree}addPattern(t,e,r){return this.WordTree.addPattern(t,e,r)}parseString(t){return this.StringParser.parseString(t,this.ParseTree)}}},{"./StringParser.js":28,"./WordTree.js":29}],28:[function(t,e,r){e.exports=
|
|
74
74
|
/**
|
|
75
75
|
* String Parser
|
|
76
76
|
*
|
|
@@ -80,7 +80,7 @@ var n=t("./WordTree.js"),s=t("./StringParser.js");e.exports=class{constructor(){
|
|
|
80
80
|
*
|
|
81
81
|
* @description Parse a string, properly processing each matched token in the word tree.
|
|
82
82
|
*/
|
|
83
|
-
class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length))),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e)):e.Output+=t}parseString(t,e){let r=this.newParserState(e);for(var n=0;n<t.length;n++)this.parseCharacter(t[n],r);return this.flushOutputBuffer(r),r.Output}}},{}],
|
|
83
|
+
class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length))),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e)):e.Output+=t}parseString(t,e){let r=this.newParserState(e);for(var n=0;n<t.length;n++)this.parseCharacter(t[n],r);return this.flushOutputBuffer(r),r.Output}}},{}],29:[function(t,e,r){e.exports=
|
|
84
84
|
/**
|
|
85
85
|
* Word Tree
|
|
86
86
|
*
|
|
@@ -90,11 +90,11 @@ class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer
|
|
|
90
90
|
*
|
|
91
91
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
92
92
|
*/
|
|
93
|
-
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var
|
|
93
|
+
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var o=0;o<t.length;o++)n=this.addChild(n,t,o);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],30:[function(t,e,r){var n,o,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var l,c=[],f=!1,h=-1;function p(){f&&l&&(f=!1,l.length?c=l.concat(c):h=-1,c.length&&d())}function d(){if(!f){var t=u(p);f=!0;for(var e=c.length;e;){for(l=c,c=[];++h<e;)l&&l[h].run();h=-1,e=c.length}l=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new g(t,e)),1!==c.length||f||u(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],31:[function(t,e,r){(function(e,n){(function(){var o=t("process/browser.js").nextTick,i=Function.prototype.apply,s=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(i.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(i.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&s.call(arguments,1);return a[e]=!0,o((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":30,timers:31}],32:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":35}],33:[function(t,e,r){e.exports=class{constructor(t,e){this.fable=t,this.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,GuaranteedNonMatch:/.^/},this.templateEscapes={"\\":"\\","'":"'",r:"\r","\r":"r",n:"\n","\n":"n",t:"\t","\t":"t",u2028:"\u2028","\u2028":"u2028",u2029:"\u2029","\u2029":"u2029"},this.renderFunction=()=>""}extend(t,...e){return Object.assign(t,...e)}renderTemplate(t){return this.renderFunction(t)}templateFunction(t){return this.renderTemplate.bind(this)}buildTemplateFunction(t,e){return this.TemplateSource="__p+='"+t.replace(this.Matchers.Escaper,(t=>`\\${this.templateEscapes[t]}`)).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,((t,e)=>`'+\n(${decodeURIComponent(e)})+\n'`)).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,((t,e)=>`';\n${decodeURIComponent(e)}\n;__p+='`))+"';\n",this.TemplateSource=`with(pTemplateDataObject||{}){\n${this.TemplateSource}}\n`,this.TemplateSource=`var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n${this.TemplateSource}return __p;\n`,this.renderFunction=new Function("pTemplateDataObject",this.TemplateSource),void 0!==e?this.renderFunction(e):(this.TemplateSourceCompiled="function(obj){\n"+this.TemplateSource+"}",this.templateFunction())}}},{}],34:[function(t,e,r){const n=t("./Fable-Utility-Template.js"),o=t("async/waterfall"),i=t("async/eachLimit");e.exports=class{constructor(t){this.fable=t,this.waterfall=o,this.eachLimit=i}extend(t,...e){return Object.assign(t,...e)}template(t,e){return new n(this.fable,t).buildTemplateFunction(t,e)}chunk(t,e,r){let n=[...t],o="number"==typeof e?e:0,i=void 0!==r?r:[];if(o<=0)return i;for(;n.length;)i.push(n.splice(0,o));return i}}},{"./Fable-Utility-Template.js":33,"async/eachLimit":2,"async/waterfall":16}],35:[function(t,e,r){
|
|
94
94
|
/**
|
|
95
95
|
* Fable Application Services Support Library
|
|
96
96
|
* @license MIT
|
|
97
97
|
* @author <steven@velozo.com>
|
|
98
98
|
*/
|
|
99
|
-
const n=t("fable-settings").FableSettings,
|
|
99
|
+
const n=t("fable-settings").FableSettings,o=t("fable-uuid").FableUUID,i=t("fable-log").FableLog,s=t("./Fable-Utility.js");e.exports=class{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new o(this.settingsManager.settings),this.log=new i(this.settingsManager.settings),this.log.initialize(),this.Utility=new s(this)}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}},{"./Fable-Utility.js":34,"fable-log":21,"fable-settings":24,"fable-uuid":26}]},{},[32])(32)}));
|
|
100
100
|
//# sourceMappingURL=fable.min.js.map
|