fable 3.0.21 → 3.0.23
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.compatible.js +97 -42
- package/dist/fable.compatible.min.js +13 -13
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +64 -20
- package/dist/fable.min.js +6 -6
- package/dist/fable.min.js.map +1 -1
- package/package.json +3 -2
- package/source/Fable-Service-MetaTemplate.js +41 -0
- package/source/Fable.js +4 -0
- package/test/FableMetaTemplating_tests.js +96 -0
- package/test/FableOperations_tests.js +0 -1
- package/test/FableUtility_tests.js +0 -1
package/dist/fable.compatible.js
CHANGED
|
@@ -2192,12 +2192,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2192
2192
|
* Parse a string with the existing parse tree
|
|
2193
2193
|
* @method parseString
|
|
2194
2194
|
* @param {string} pString - The string to parse
|
|
2195
|
+
* @param {object} pData - Data to pass in as the second argument
|
|
2195
2196
|
* @return {string} The result from the parser
|
|
2196
2197
|
*/
|
|
2197
2198
|
}, {
|
|
2198
2199
|
key: "parseString",
|
|
2199
|
-
value: function parseString(pString) {
|
|
2200
|
-
return this.StringParser.parseString(pString, this.ParseTree);
|
|
2200
|
+
value: function parseString(pString, pData) {
|
|
2201
|
+
return this.StringParser.parseString(pString, this.ParseTree, pData);
|
|
2201
2202
|
}
|
|
2202
2203
|
}]);
|
|
2203
2204
|
return Precedent;
|
|
@@ -2300,11 +2301,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2300
2301
|
*/
|
|
2301
2302
|
}, {
|
|
2302
2303
|
key: "checkPatternEnd",
|
|
2303
|
-
value: function checkPatternEnd(pParserState) {
|
|
2304
|
+
value: function checkPatternEnd(pParserState, pData) {
|
|
2304
2305
|
if (pParserState.OutputBuffer.length >= pParserState.Pattern.PatternEnd.length + pParserState.Pattern.PatternStart.length && pParserState.OutputBuffer.substr(-pParserState.Pattern.PatternEnd.length) === pParserState.Pattern.PatternEnd) {
|
|
2305
2306
|
// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2306
2307
|
// Trim the start and end tags off the output buffer now
|
|
2307
|
-
pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length + pParserState.Pattern.PatternEnd.length)));
|
|
2308
|
+
pParserState.OutputBuffer = pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStart.length, pParserState.OutputBuffer.length - (pParserState.Pattern.PatternStart.length + pParserState.Pattern.PatternEnd.length)), pData);
|
|
2308
2309
|
// Flush the output buffer.
|
|
2309
2310
|
this.flushOutputBuffer(pParserState);
|
|
2310
2311
|
// End pattern mode
|
|
@@ -2322,7 +2323,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2322
2323
|
*/
|
|
2323
2324
|
}, {
|
|
2324
2325
|
key: "parseCharacter",
|
|
2325
|
-
value: function parseCharacter(pCharacter, pParserState) {
|
|
2326
|
+
value: function parseCharacter(pCharacter, pParserState, pData) {
|
|
2326
2327
|
// (1) If we aren't in a pattern match, and we aren't potentially matching, and this may be the start of a new pattern....
|
|
2327
2328
|
if (!pParserState.PatternMatch && pParserState.ParseTree.hasOwnProperty(pCharacter)) {
|
|
2328
2329
|
// ... assign the node as the matched node.
|
|
@@ -2339,7 +2340,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2339
2340
|
this.appendOutputBuffer(pCharacter, pParserState);
|
|
2340
2341
|
if (pParserState.Pattern) {
|
|
2341
2342
|
// ... Check if this is the end of the pattern (if we are matching a valid pattern)...
|
|
2342
|
-
this.checkPatternEnd(pParserState);
|
|
2343
|
+
this.checkPatternEnd(pParserState, pData);
|
|
2343
2344
|
}
|
|
2344
2345
|
}
|
|
2345
2346
|
// (3) If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
@@ -2353,14 +2354,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2353
2354
|
* @method parseString
|
|
2354
2355
|
* @param {string} pString - The string to parse.
|
|
2355
2356
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
2357
|
+
* @param {Object} pData - The data to pass to the function as a second paramter
|
|
2356
2358
|
*/
|
|
2357
2359
|
}, {
|
|
2358
2360
|
key: "parseString",
|
|
2359
|
-
value: function parseString(pString, pParseTree) {
|
|
2361
|
+
value: function parseString(pString, pParseTree, pData) {
|
|
2360
2362
|
var tmpParserState = this.newParserState(pParseTree);
|
|
2361
2363
|
for (var i = 0; i < pString.length; i++) {
|
|
2362
2364
|
// TODO: This is not fast.
|
|
2363
|
-
this.parseCharacter(pString[i], tmpParserState);
|
|
2365
|
+
this.parseCharacter(pString[i], tmpParserState, pData);
|
|
2364
2366
|
}
|
|
2365
2367
|
this.flushOutputBuffer(tmpParserState);
|
|
2366
2368
|
return tmpParserState.Output;
|
|
@@ -2696,7 +2698,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2696
2698
|
}
|
|
2697
2699
|
module.exports = libNPMModuleWrapper;
|
|
2698
2700
|
}, {
|
|
2699
|
-
"./Fable.js":
|
|
2701
|
+
"./Fable.js": 43
|
|
2700
2702
|
}],
|
|
2701
2703
|
36: [function (require, module, exports) {
|
|
2702
2704
|
var _OperationStatePrototype = JSON.stringify({
|
|
@@ -2823,14 +2825,62 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2823
2825
|
}(libFableServiceBase);
|
|
2824
2826
|
module.exports = FableServiceDataArithmatic;
|
|
2825
2827
|
}, {
|
|
2826
|
-
"./Fable-ServiceProviderBase.js":
|
|
2828
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2827
2829
|
"data-arithmatic": 17
|
|
2828
2830
|
}],
|
|
2829
2831
|
38: [function (require, module, exports) {
|
|
2830
2832
|
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2831
|
-
var
|
|
2832
|
-
|
|
2833
|
-
|
|
2833
|
+
var libPrecedent = require('precedent');
|
|
2834
|
+
var FableServiceMetaTemplate = /*#__PURE__*/function (_libFableServiceBase2) {
|
|
2835
|
+
_inherits(FableServiceMetaTemplate, _libFableServiceBase2);
|
|
2836
|
+
var _super4 = _createSuper(FableServiceMetaTemplate);
|
|
2837
|
+
function FableServiceMetaTemplate(pFable, pOptions, pServiceHash) {
|
|
2838
|
+
var _this5;
|
|
2839
|
+
_classCallCheck(this, FableServiceMetaTemplate);
|
|
2840
|
+
_this5 = _super4.call(this, pFable, pOptions, pServiceHash);
|
|
2841
|
+
_this5.serviceType = 'MetaTemplate';
|
|
2842
|
+
_this5._MetaTemplateLibrary = new libPrecedent(_this5.options);
|
|
2843
|
+
return _this5;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
/**
|
|
2847
|
+
* Add a Pattern to the Parse Tree
|
|
2848
|
+
* @method addPattern
|
|
2849
|
+
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
2850
|
+
* @param {string} pPattern - The string to add to the tree
|
|
2851
|
+
* @param {number} pIndex - callback function
|
|
2852
|
+
* @return {bool} True if adding the pattern was successful
|
|
2853
|
+
*/
|
|
2854
|
+
_createClass(FableServiceMetaTemplate, [{
|
|
2855
|
+
key: "addPattern",
|
|
2856
|
+
value: function addPattern(pPatternStart, pPatternEnd, pParser) {
|
|
2857
|
+
return this._MetaTemplateLibrary.addPattern(pPatternStart, pPatternEnd, pParser);
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
* Parse a string with the existing parse tree
|
|
2862
|
+
* @method parseString
|
|
2863
|
+
* @param {string} pString - The string to parse
|
|
2864
|
+
* @return {string} The result from the parser
|
|
2865
|
+
*/
|
|
2866
|
+
}, {
|
|
2867
|
+
key: "parseString",
|
|
2868
|
+
value: function parseString(pString) {
|
|
2869
|
+
return this._MetaTemplateLibrary.parseString(pString, this.ParseTree);
|
|
2870
|
+
}
|
|
2871
|
+
}]);
|
|
2872
|
+
return FableServiceMetaTemplate;
|
|
2873
|
+
}(libFableServiceBase);
|
|
2874
|
+
module.exports = FableServiceMetaTemplate;
|
|
2875
|
+
}, {
|
|
2876
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
2877
|
+
"precedent": 30
|
|
2878
|
+
}],
|
|
2879
|
+
39: [function (require, module, exports) {
|
|
2880
|
+
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2881
|
+
var FableServiceTemplate = /*#__PURE__*/function (_libFableServiceBase3) {
|
|
2882
|
+
_inherits(FableServiceTemplate, _libFableServiceBase3);
|
|
2883
|
+
var _super5 = _createSuper(FableServiceTemplate);
|
|
2834
2884
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2835
2885
|
// string-based template with code snippets into simple executable pieces,
|
|
2836
2886
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -2841,14 +2891,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2841
2891
|
// This is an implementation of that.
|
|
2842
2892
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2843
2893
|
function FableServiceTemplate(pFable, pOptions, pServiceHash) {
|
|
2844
|
-
var
|
|
2894
|
+
var _this6;
|
|
2845
2895
|
_classCallCheck(this, FableServiceTemplate);
|
|
2846
|
-
|
|
2847
|
-
|
|
2896
|
+
_this6 = _super5.call(this, pFable, pOptions, pServiceHash);
|
|
2897
|
+
_this6.serviceType = 'Template';
|
|
2848
2898
|
|
|
2849
2899
|
// These are the exact regex's used in lodash/underscore
|
|
2850
2900
|
// TODO: Switch this to precedent
|
|
2851
|
-
|
|
2901
|
+
_this6.Matchers = {
|
|
2852
2902
|
Evaluate: /<%([\s\S]+?)%>/g,
|
|
2853
2903
|
Interpolate: /<%=([\s\S]+?)%>/g,
|
|
2854
2904
|
Escaper: /\\|'|\r|\n|\t|\u2028|\u2029/g,
|
|
@@ -2859,7 +2909,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2859
2909
|
|
|
2860
2910
|
// This is a helper for the escaper and unescaper functions.
|
|
2861
2911
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
2862
|
-
|
|
2912
|
+
_this6.templateEscapes = {
|
|
2863
2913
|
'\\': '\\',
|
|
2864
2914
|
"'": "'",
|
|
2865
2915
|
'r': '\r',
|
|
@@ -2876,9 +2926,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2876
2926
|
|
|
2877
2927
|
// This is defined as such to underscore that it is a dynamic programming
|
|
2878
2928
|
// function on this class.
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
return
|
|
2929
|
+
_this6.renderFunction = false;
|
|
2930
|
+
_this6.templateString = false;
|
|
2931
|
+
return _this6;
|
|
2882
2932
|
}
|
|
2883
2933
|
_createClass(FableServiceTemplate, [{
|
|
2884
2934
|
key: "renderTemplate",
|
|
@@ -2894,11 +2944,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2894
2944
|
}, {
|
|
2895
2945
|
key: "buildTemplateFunction",
|
|
2896
2946
|
value: function buildTemplateFunction(pTemplateText, pData) {
|
|
2897
|
-
var
|
|
2947
|
+
var _this7 = this;
|
|
2898
2948
|
// For now this is being kept in a weird form ... this is to mimic the old
|
|
2899
2949
|
// underscore code until this is rewritten using precedent.
|
|
2900
2950
|
this.TemplateSource = "__p+='" + pTemplateText.replace(this.Matchers.Escaper, function (pMatch) {
|
|
2901
|
-
return "\\".concat(
|
|
2951
|
+
return "\\".concat(_this7.templateEscapes[pMatch]);
|
|
2902
2952
|
}).replace(this.Matchers.Interpolate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
2903
2953
|
return "'+\n(".concat(decodeURIComponent(pCode), ")+\n'");
|
|
2904
2954
|
}).replace(this.Matchers.Evaluate || this.Matchers.GuaranteedNonMatch, function (pMatch, pCode) {
|
|
@@ -2921,17 +2971,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2921
2971
|
}(libFableServiceBase);
|
|
2922
2972
|
module.exports = FableServiceTemplate;
|
|
2923
2973
|
}, {
|
|
2924
|
-
"./Fable-ServiceProviderBase.js":
|
|
2974
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
2925
2975
|
}],
|
|
2926
|
-
|
|
2976
|
+
40: [function (require, module, exports) {
|
|
2927
2977
|
var libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2928
2978
|
|
|
2929
2979
|
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2930
2980
|
var libAsyncWaterfall = require('async.waterfall');
|
|
2931
2981
|
var libAsyncEachLimit = require('async.eachlimit');
|
|
2932
|
-
var FableServiceUtility = /*#__PURE__*/function (
|
|
2933
|
-
_inherits(FableServiceUtility,
|
|
2934
|
-
var
|
|
2982
|
+
var FableServiceUtility = /*#__PURE__*/function (_libFableServiceBase4) {
|
|
2983
|
+
_inherits(FableServiceUtility, _libFableServiceBase4);
|
|
2984
|
+
var _super6 = _createSuper(FableServiceUtility);
|
|
2935
2985
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2936
2986
|
// string-based template with code snippets into simple executable pieces,
|
|
2937
2987
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -2942,15 +2992,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2942
2992
|
// This is an implementation of that.
|
|
2943
2993
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2944
2994
|
function FableServiceUtility(pFable, pOptions, pServiceHash) {
|
|
2945
|
-
var
|
|
2995
|
+
var _this8;
|
|
2946
2996
|
_classCallCheck(this, FableServiceUtility);
|
|
2947
|
-
|
|
2948
|
-
|
|
2997
|
+
_this8 = _super6.call(this, pFable, pOptions, pServiceHash);
|
|
2998
|
+
_this8.templates = {};
|
|
2949
2999
|
|
|
2950
3000
|
// These two functions are used extensively throughout
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
return
|
|
3001
|
+
_this8.waterfall = libAsyncWaterfall;
|
|
3002
|
+
_this8.eachLimit = libAsyncEachLimit;
|
|
3003
|
+
return _this8;
|
|
2954
3004
|
}
|
|
2955
3005
|
|
|
2956
3006
|
// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
@@ -3008,11 +3058,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3008
3058
|
}(libFableServiceBase);
|
|
3009
3059
|
module.exports = FableServiceUtility;
|
|
3010
3060
|
}, {
|
|
3011
|
-
"./Fable-ServiceProviderBase.js":
|
|
3061
|
+
"./Fable-ServiceProviderBase.js": 42,
|
|
3012
3062
|
"async.eachlimit": 1,
|
|
3013
3063
|
"async.waterfall": 15
|
|
3014
3064
|
}],
|
|
3015
|
-
|
|
3065
|
+
41: [function (require, module, exports) {
|
|
3016
3066
|
/**
|
|
3017
3067
|
* Fable Application Services Management
|
|
3018
3068
|
* @license MIT
|
|
@@ -3090,9 +3140,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3090
3140
|
module.exports = FableService;
|
|
3091
3141
|
module.exports.ServiceProviderBase = libFableServiceBase;
|
|
3092
3142
|
}, {
|
|
3093
|
-
"./Fable-ServiceProviderBase.js":
|
|
3143
|
+
"./Fable-ServiceProviderBase.js": 42
|
|
3094
3144
|
}],
|
|
3095
|
-
|
|
3145
|
+
42: [function (require, module, exports) {
|
|
3096
3146
|
/**
|
|
3097
3147
|
* Fable Service Base
|
|
3098
3148
|
* @license MIT
|
|
@@ -3108,7 +3158,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3108
3158
|
});
|
|
3109
3159
|
module.exports = FableServiceProviderBase;
|
|
3110
3160
|
}, {}],
|
|
3111
|
-
|
|
3161
|
+
43: [function (require, module, exports) {
|
|
3112
3162
|
/**
|
|
3113
3163
|
* Fable Application Services Support Library
|
|
3114
3164
|
* @license MIT
|
|
@@ -3120,6 +3170,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3120
3170
|
var libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
3121
3171
|
var libFableServiceDataArithmatic = require('./Fable-Service-DataArithmatic.js');
|
|
3122
3172
|
var libFableServiceTemplate = require('./Fable-Service-Template.js');
|
|
3173
|
+
var libFableServiceMetaTemplate = require('./Fable-Service-MetaTemplate.js');
|
|
3123
3174
|
var libFableServiceUtility = require('./Fable-Service-Utility.js');
|
|
3124
3175
|
var libFableOperation = require('./Fable-Operation.js');
|
|
3125
3176
|
var Fable = /*#__PURE__*/function () {
|
|
@@ -3151,6 +3202,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3151
3202
|
// Initialize the template service
|
|
3152
3203
|
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
3153
3204
|
|
|
3205
|
+
// Initialize the metatemplate service
|
|
3206
|
+
this.serviceManager.addServiceType('MetaTemplate', libFableServiceMetaTemplate);
|
|
3207
|
+
|
|
3154
3208
|
// Initialize and instantiate the default baked-in Utility service
|
|
3155
3209
|
this.serviceManager.addServiceType('Utility', libFableServiceUtility);
|
|
3156
3210
|
this.fable.serviceManager.instantiateServiceProvider('Utility', {}, 'Default-Service-Utility');
|
|
@@ -3208,9 +3262,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3208
3262
|
}, {
|
|
3209
3263
|
"./Fable-Operation.js": 36,
|
|
3210
3264
|
"./Fable-Service-DataArithmatic.js": 37,
|
|
3211
|
-
"./Fable-Service-
|
|
3212
|
-
"./Fable-Service-
|
|
3213
|
-
"./Fable-
|
|
3265
|
+
"./Fable-Service-MetaTemplate.js": 38,
|
|
3266
|
+
"./Fable-Service-Template.js": 39,
|
|
3267
|
+
"./Fable-Service-Utility.js": 40,
|
|
3268
|
+
"./Fable-ServiceManager.js": 41,
|
|
3214
3269
|
"fable-log": 23,
|
|
3215
3270
|
"fable-settings": 26,
|
|
3216
3271
|
"fable-uuid": 28
|