@kosatyi/ejs 0.0.97 → 0.0.99

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.
@@ -1,337 +1,519 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ejs = {}));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ejs = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- var typeProp = function typeProp() {
8
- var args = [].slice.call(arguments);
9
- var callback = args.shift();
10
- return args.filter(callback).pop();
11
- };
12
- var isArray = function isArray(v) {
13
- return Array.isArray(v);
14
- };
15
- var isFunction = function isFunction(v) {
16
- return typeof v === 'function';
17
- };
18
- var isString = function isString(v) {
19
- return typeof v === 'string';
20
- };
21
- var isBoolean = function isBoolean(v) {
22
- return typeof v === 'boolean';
23
- };
24
- var isUndefined = function isUndefined(v) {
25
- return typeof v === 'undefined';
26
- };
27
-
28
- var isNodeEnv = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
29
- var isNode = function isNode() {
30
- return isNodeEnv;
31
- };
32
- var symbolEntities = {
33
- "'": "'",
34
- '\\': '\\',
35
- '\r': 'r',
36
- '\n': 'n',
37
- '\t': 't',
38
- "\u2028": 'u2028',
39
- "\u2029": 'u2029'
40
- };
41
- var htmlEntities = {
42
- '&': '&',
43
- '<': '&lt;',
44
- '>': '&gt;',
45
- '"': '&quot;',
46
- "'": '&#x27;'
47
- };
48
- var regexKeys = function regexKeys(obj) {
49
- return new RegExp(['[', Object.keys(obj).join(''), ']'].join(''), 'g');
50
- };
51
- var htmlEntitiesMatch = regexKeys(htmlEntities);
52
- var symbolEntitiesMatch = regexKeys(symbolEntities);
53
- var entities = function entities() {
54
- var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
55
- return ('' + string).replace(htmlEntitiesMatch, function (match) {
56
- return htmlEntities[match];
57
- });
58
- };
59
- var symbols = function symbols(string) {
60
- return ('' + string).replace(symbolEntitiesMatch, function (match) {
61
- return '\\' + symbolEntities[match];
62
- });
63
- };
64
- var safeValue = function safeValue(value, escape) {
65
- var check = value;
66
- return check == null ? '' : Boolean(escape) === true ? entities(check) : check;
67
- };
68
- var instanceOf = function instanceOf(object, instance) {
69
- return Boolean(object instanceof instance);
70
- };
71
- var getPath = function getPath(context, name, strict) {
72
- var data = context;
73
- var chunks = String(name).split('.');
74
- var prop = chunks.pop();
75
- for (var i = 0; i < chunks.length; i++) {
76
- var part = chunks[i];
77
- if (isFunction(data['toJSON'])) {
78
- data = data.toJSON();
79
- }
80
- if (strict && data.hasOwnProperty(part) === false) {
81
- data = {};
82
- break;
83
- }
84
- data = data[part] = data[part] || {};
7
+ function _assertClassBrand(e, t, n) {
8
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
9
+ throw new TypeError("Private element is not present on this object");
10
+ }
11
+ function _assertThisInitialized(e) {
12
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13
+ return e;
14
+ }
15
+ function _callSuper(t, o, e) {
16
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
17
+ }
18
+ function _checkPrivateRedeclaration(e, t) {
19
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
20
+ }
21
+ function _classCallCheck(a, n) {
22
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
23
+ }
24
+ function _classPrivateFieldGet2(s, a) {
25
+ return s.get(_assertClassBrand(s, a));
26
+ }
27
+ function _classPrivateFieldInitSpec(e, t, a) {
28
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
29
+ }
30
+ function _classPrivateFieldSet2(s, a, r) {
31
+ return s.set(_assertClassBrand(s, a), r), r;
32
+ }
33
+ function _classPrivateMethodInitSpec(e, a) {
34
+ _checkPrivateRedeclaration(e, a), a.add(e);
35
+ }
36
+ function _construct(t, e, r) {
37
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
38
+ var o = [null];
39
+ o.push.apply(o, e);
40
+ var p = new (t.bind.apply(t, o))();
41
+ return r && _setPrototypeOf(p, r.prototype), p;
42
+ }
43
+ function _defineProperties(e, r) {
44
+ for (var t = 0; t < r.length; t++) {
45
+ var o = r[t];
46
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
47
+ }
48
+ }
49
+ function _createClass(e, r, t) {
50
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
51
+ writable: !1
52
+ }), e;
53
+ }
54
+ function _defineProperty(e, r, t) {
55
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
56
+ value: t,
57
+ enumerable: !0,
58
+ configurable: !0,
59
+ writable: !0
60
+ }) : e[r] = t, e;
61
+ }
62
+ function _getPrototypeOf(t) {
63
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
64
+ return t.__proto__ || Object.getPrototypeOf(t);
65
+ }, _getPrototypeOf(t);
66
+ }
67
+ function _inherits(t, e) {
68
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
69
+ t.prototype = Object.create(e && e.prototype, {
70
+ constructor: {
71
+ value: t,
72
+ writable: !0,
73
+ configurable: !0
74
+ }
75
+ }), Object.defineProperty(t, "prototype", {
76
+ writable: !1
77
+ }), e && _setPrototypeOf(t, e);
78
+ }
79
+ function _isNativeFunction(t) {
80
+ try {
81
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
82
+ } catch (n) {
83
+ return "function" == typeof t;
84
+ }
85
+ }
86
+ function _isNativeReflectConstruct() {
87
+ try {
88
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
89
+ } catch (t) {}
90
+ return (_isNativeReflectConstruct = function () {
91
+ return !!t;
92
+ })();
93
+ }
94
+ function _possibleConstructorReturn(t, e) {
95
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
96
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
97
+ return _assertThisInitialized(t);
98
+ }
99
+ function _setPrototypeOf(t, e) {
100
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
101
+ return t.__proto__ = e, t;
102
+ }, _setPrototypeOf(t, e);
103
+ }
104
+ function _toPrimitive(t, r) {
105
+ if ("object" != typeof t || !t) return t;
106
+ var e = t[Symbol.toPrimitive];
107
+ if (void 0 !== e) {
108
+ var i = e.call(t, r);
109
+ if ("object" != typeof i) return i;
110
+ throw new TypeError("@@toPrimitive must return a primitive value.");
111
+ }
112
+ return (String )(t);
113
+ }
114
+ function _toPropertyKey(t) {
115
+ var i = _toPrimitive(t, "string");
116
+ return "symbol" == typeof i ? i : i + "";
117
+ }
118
+ function _wrapNativeSuper(t) {
119
+ var r = "function" == typeof Map ? new Map() : void 0;
120
+ return _wrapNativeSuper = function (t) {
121
+ if (null === t || !_isNativeFunction(t)) return t;
122
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
123
+ if (void 0 !== r) {
124
+ if (r.has(t)) return r.get(t);
125
+ r.set(t, Wrapper);
85
126
  }
127
+ function Wrapper() {
128
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
129
+ }
130
+ return Wrapper.prototype = Object.create(t.prototype, {
131
+ constructor: {
132
+ value: Wrapper,
133
+ enumerable: !1,
134
+ writable: !0,
135
+ configurable: !0
136
+ }
137
+ }), _setPrototypeOf(Wrapper, t);
138
+ }, _wrapNativeSuper(t);
139
+ }
140
+
141
+ var typeProp = function typeProp() {
142
+ var args = [].slice.call(arguments);
143
+ var callback = args.shift();
144
+ return args.filter(callback).pop();
145
+ };
146
+ var isArray = function isArray(v) {
147
+ return Array.isArray(v);
148
+ };
149
+ var isFunction = function isFunction(v) {
150
+ return typeof v === 'function';
151
+ };
152
+ var isString = function isString(v) {
153
+ return typeof v === 'string';
154
+ };
155
+ var isBoolean = function isBoolean(v) {
156
+ return typeof v === 'boolean';
157
+ };
158
+ var isUndefined = function isUndefined(v) {
159
+ return typeof v === 'undefined';
160
+ };
161
+
162
+ var isNodeEnv = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
163
+ var isNode = function isNode() {
164
+ return isNodeEnv;
165
+ };
166
+ var symbolEntities = {
167
+ "'": "'",
168
+ '\\': '\\',
169
+ '\r': 'r',
170
+ '\n': 'n',
171
+ '\t': 't',
172
+ "\u2028": 'u2028',
173
+ "\u2029": 'u2029'
174
+ };
175
+ var htmlEntities = {
176
+ '&': '&amp;',
177
+ '<': '&lt;',
178
+ '>': '&gt;',
179
+ '"': '&quot;',
180
+ "'": '&#x27;'
181
+ };
182
+ var regexKeys = function regexKeys(obj) {
183
+ return new RegExp(['[', Object.keys(obj).join(''), ']'].join(''), 'g');
184
+ };
185
+ var htmlEntitiesMatch = regexKeys(htmlEntities);
186
+ var symbolEntitiesMatch = regexKeys(symbolEntities);
187
+ var entities = function entities() {
188
+ var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
189
+ return ('' + string).replace(htmlEntitiesMatch, function (match) {
190
+ return htmlEntities[match];
191
+ });
192
+ };
193
+ var symbols = function symbols(string) {
194
+ return ('' + string).replace(symbolEntitiesMatch, function (match) {
195
+ return '\\' + symbolEntities[match];
196
+ });
197
+ };
198
+ var safeValue = function safeValue(value, escape) {
199
+ var check = value;
200
+ return check == null ? '' : Boolean(escape) === true ? entities(check) : check;
201
+ };
202
+ var instanceOf = function instanceOf(object, instance) {
203
+ return Boolean(object instanceof instance);
204
+ };
205
+ var assertInstanceOf = function assertInstanceOf(object, instance) {
206
+ if (instanceOf(object, instance) === false) throw new TypeError("".concat(object, " in not instance of ").concat(instance));
207
+ };
208
+ var getPath = function getPath(context, name, strict) {
209
+ var data = context;
210
+ var chunks = String(name).split('.');
211
+ var prop = chunks.pop();
212
+ for (var i = 0; i < chunks.length; i++) {
213
+ var part = chunks[i];
86
214
  if (isFunction(data['toJSON'])) {
87
215
  data = data.toJSON();
88
216
  }
89
- return [data, prop];
90
- };
91
- var ext = function ext(path, defaults) {
92
- var ext = path.split('.').pop();
93
- if (ext !== defaults) {
94
- path = [path, defaults].join('.');
217
+ if (strict && data.hasOwnProperty(part) === false) {
218
+ data = {};
219
+ break;
95
220
  }
96
- return path;
97
- };
221
+ data = data[part] = data[part] || {};
222
+ }
223
+ if (isFunction(data['toJSON'])) {
224
+ data = data.toJSON();
225
+ }
226
+ return [data, prop];
227
+ };
228
+ var bindContext = function bindContext(object) {
229
+ var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
230
+ methods.forEach(function (name) {
231
+ if (name in object) {
232
+ object[name] = object[name].bind(object);
233
+ }
234
+ });
235
+ };
236
+ var ext = function ext(path, defaults) {
237
+ var ext = path.split('.').pop();
238
+ if (ext !== defaults) {
239
+ path = [path, defaults].join('.');
240
+ }
241
+ return path;
242
+ };
98
243
 
99
- /**
100
- * @type {<T extends {}, U, V, W,Y>(T,U,V,W,Y)=> T & U & V & W & Y}
101
- */
102
- var extend = function extend(target) {
103
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
104
- args[_key - 1] = arguments[_key];
105
- }
106
- return args.filter(function (source) {
107
- return source;
108
- }).reduce(function (target, source) {
109
- return Object.assign(target, source);
110
- }, target);
111
- };
112
- var noop = function noop() {};
113
- var each = function each(object, callback) {
114
- var prop;
115
- for (prop in object) {
116
- if (hasProp(object, prop)) {
117
- callback(object[prop], prop, object);
118
- }
244
+ /**
245
+ * @type {<T extends {}, U, V, W,Y>(T,U,V,W,Y)=> T & U & V & W & Y}
246
+ */
247
+ var extend = function extend(target) {
248
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
249
+ args[_key - 1] = arguments[_key];
250
+ }
251
+ return args.filter(function (source) {
252
+ return source;
253
+ }).reduce(function (target, source) {
254
+ return Object.assign(target, source);
255
+ }, target);
256
+ };
257
+ var noop = function noop() {};
258
+ var each = function each(object, callback) {
259
+ var prop;
260
+ for (prop in object) {
261
+ if (hasProp(object, prop)) {
262
+ callback(object[prop], prop, object);
119
263
  }
120
- };
121
- var map = function map(object, callback, context) {
122
- var result = [];
123
- each(object, function (value, key, object) {
124
- var item = callback(value, key, object);
125
- if (isUndefined(item) === false) {
264
+ }
265
+ };
266
+ var map = function map(object, callback, context) {
267
+ var result = [];
268
+ each(object, function (value, key, object) {
269
+ var item = callback(value, key, object);
270
+ if (isUndefined(item) === false) {
271
+ result.push(item);
272
+ }
273
+ });
274
+ return result;
275
+ };
276
+ var filter = function filter(object, callback, context) {
277
+ var isArray = object instanceof Array;
278
+ var result = isArray ? [] : {};
279
+ each(object, function (value, key, object) {
280
+ var item = callback(value, key, object);
281
+ if (isUndefined(item) === false) {
282
+ if (isArray) {
126
283
  result.push(item);
284
+ } else {
285
+ result[key] = item;
127
286
  }
128
- });
129
- return result;
130
- };
131
- var filter = function filter(object, callback, context) {
132
- var isArray = object instanceof Array;
133
- var result = isArray ? [] : {};
134
- each(object, function (value, key, object) {
135
- var item = callback(value, key, object);
136
- if (isUndefined(item) === false) {
137
- if (isArray) {
138
- result.push(item);
139
- } else {
140
- result[key] = item;
141
- }
142
- }
143
- });
144
- return result;
145
- };
146
- var omit = function omit(object, list) {
147
- return filter(object, function (value, key) {
148
- if (list.indexOf(key) === -1) {
149
- return value;
150
- }
151
- });
152
- };
153
- var hasProp = function hasProp(object, prop) {
154
- return object && object.hasOwnProperty(prop);
155
- };
156
- var joinPath = function joinPath(path, template) {
157
- template = [path, template].join('/');
158
- template = template.replace(/\/\//g, '/');
159
- return template;
160
- };
287
+ }
288
+ });
289
+ return result;
290
+ };
291
+ var omit = function omit(object, list) {
292
+ return filter(object, function (value, key) {
293
+ if (list.indexOf(key) === -1) {
294
+ return value;
295
+ }
296
+ });
297
+ };
161
298
 
162
- var defaults = {};
163
- defaults["export"] = 'ejsPrecompiled';
164
- defaults.cache = true;
165
- defaults.chokidar = null;
166
- defaults.path = 'views';
167
- defaults.resolver = function (path, template) {
168
- return Promise.resolve(['resolver is not defined', path, template].join(' '));
169
- };
170
- defaults.extension = 'ejs';
171
- defaults.rmWhitespace = true;
172
- defaults.withObject = true;
173
- defaults.globalHelpers = [];
174
- defaults.vars = {
175
- SCOPE: 'ejs',
176
- COMPONENT: 'ui',
177
- EXTEND: '$$e',
178
- BUFFER: '$$a',
179
- LAYOUT: '$$l',
180
- BLOCKS: '$$b',
181
- MACRO: '$$m',
182
- SAFE: '$$v'
183
- };
184
- defaults.token = {
185
- start: '<%',
186
- end: '%>',
187
- regex: '([\\s\\S]+?)'
188
- };
299
+ /**
300
+ *
301
+ * @param object
302
+ * @param prop
303
+ * @return {boolean}
304
+ */
305
+ var hasProp = function hasProp(object, prop) {
306
+ return object && object.hasOwnProperty(prop);
307
+ };
308
+ var joinPath = function joinPath(path, template) {
309
+ template = [path, template].join('/');
310
+ template = template.replace(/\/\//g, '/');
311
+ return template;
312
+ };
313
+ var matchTokens = function matchTokens(regex, text, callback) {
314
+ var index = 0;
315
+ text.replace(regex, function () {
316
+ var params = [].slice.call(arguments, 0, -1);
317
+ var offset = params.pop();
318
+ var match = params.shift();
319
+ callback(params, index, offset);
320
+ index = offset + match.length;
321
+ return match;
322
+ });
323
+ };
189
324
 
190
- var configSchema = function configSchema(config, options) {
191
- extend(config, {
192
- path: typeProp(isString, defaults.path, config.path, options.path),
193
- "export": typeProp(isString, defaults["export"], config["export"], options["export"]),
194
- resolver: typeProp(isFunction, defaults.resolver, config.resolver, options.resolver),
195
- extension: typeProp(isString, defaults.extension, config.extension, options.extension),
196
- withObject: typeProp(isBoolean, defaults.withObject, config.withObject, options.withObject),
197
- rmWhitespace: typeProp(isBoolean, defaults.rmWhitespace, config.rmWhitespace, options.rmWhitespace),
198
- cache: typeProp(isBoolean, defaults.cache, config.cache, options.cache),
199
- token: extend({}, defaults.token, config.token, options.token),
200
- vars: extend({}, defaults.vars, config.vars, options.vars),
201
- globalHelpers: typeProp(isArray, defaults.globalHelpers, config.globalHelpers, options.globalHelpers)
202
- });
203
- };
325
+ var defaults = {};
326
+ defaults["export"] = 'ejsPrecompiled';
327
+ defaults.cache = true;
328
+ defaults.chokidar = null;
329
+ defaults.path = 'views';
330
+ defaults.resolver = function (path, template) {
331
+ return Promise.resolve(['resolver is not defined', path, template].join(' '));
332
+ };
333
+ defaults.extension = 'ejs';
334
+ defaults.rmWhitespace = true;
335
+ defaults.withObject = true;
336
+ defaults.globalHelpers = [];
337
+ defaults.vars = {
338
+ SCOPE: 'ejs',
339
+ COMPONENT: 'ui',
340
+ ELEMENT: 'el',
341
+ EXTEND: '$$e',
342
+ BUFFER: '$$a',
343
+ LAYOUT: '$$l',
344
+ BLOCKS: '$$b',
345
+ MACRO: '$$m',
346
+ SAFE: '$$v'
347
+ };
348
+ defaults.token = {
349
+ start: '<%',
350
+ end: '%>',
351
+ regex: '([\\s\\S]+?)'
352
+ };
353
+
354
+ var configSchema = function configSchema(config, options) {
355
+ extend(config, {
356
+ path: typeProp(isString, defaults.path, config.path, options.path),
357
+ "export": typeProp(isString, defaults["export"], config["export"], options["export"]),
358
+ resolver: typeProp(isFunction, defaults.resolver, config.resolver, options.resolver),
359
+ extension: typeProp(isString, defaults.extension, config.extension, options.extension),
360
+ withObject: typeProp(isBoolean, defaults.withObject, config.withObject, options.withObject),
361
+ rmWhitespace: typeProp(isBoolean, defaults.rmWhitespace, config.rmWhitespace, options.rmWhitespace),
362
+ cache: typeProp(isBoolean, defaults.cache, config.cache, options.cache),
363
+ token: extend({}, defaults.token, config.token, options.token),
364
+ vars: extend({}, defaults.vars, config.vars, options.vars),
365
+ globalHelpers: typeProp(isArray, defaults.globalHelpers, config.globalHelpers, options.globalHelpers)
366
+ });
367
+ };
204
368
 
205
- var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
369
+ var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
370
+ var _enabled = /*#__PURE__*/new WeakMap();
371
+ var _list = /*#__PURE__*/new WeakMap();
372
+ var Cache = /*#__PURE__*/function () {
206
373
  function Cache(config) {
207
- if (instanceOf(this, Cache) === false) return new Cache();
208
- var cache = {
209
- enabled: true,
210
- list: {}
211
- };
212
- this.configure = function (config) {
213
- cache.enabled = config.cache;
214
- if (isNode() === false) {
215
- this.load(global[config["export"]]);
216
- }
217
- };
218
- this.clear = function () {
219
- cache.list = {};
220
- };
221
- this.load = function (data) {
222
- if (cache.enabled) {
223
- extend(cache.list, data || {});
374
+ _classCallCheck(this, Cache);
375
+ _classPrivateFieldInitSpec(this, _enabled, true);
376
+ _classPrivateFieldInitSpec(this, _list, {});
377
+ this.configure(config);
378
+ }
379
+ return _createClass(Cache, [{
380
+ key: "load",
381
+ value: function load(data) {
382
+ if (_classPrivateFieldGet2(_enabled, this)) {
383
+ extend(_classPrivateFieldGet2(_list, this), data || {});
224
384
  }
225
- return this;
226
- };
227
- this.get = function (key) {
228
- if (cache.enabled) {
229
- return cache.list[key];
385
+ }
386
+ }, {
387
+ key: "get",
388
+ value: function get(key) {
389
+ if (_classPrivateFieldGet2(_enabled, this)) {
390
+ return _classPrivateFieldGet2(_list, this)[key];
230
391
  }
231
- };
232
- this.set = function (key, value) {
233
- if (cache.enabled) {
234
- cache.list[key] = value;
392
+ }
393
+ }, {
394
+ key: "set",
395
+ value: function set(key, value) {
396
+ if (_classPrivateFieldGet2(_enabled, this)) {
397
+ _classPrivateFieldGet2(_list, this)[key] = value;
235
398
  }
236
- return this;
237
- };
238
- this.resolve = function (key) {
239
- return Promise.resolve(this.get(key));
240
- };
241
- this.remove = function (key) {
242
- delete cache.list[key];
243
- };
244
- this.exist = function (key) {
245
- return hasProp(cache.list, key);
246
- };
247
- }
248
-
249
- var tagList = [{
250
- symbol: '-',
251
- format: function format(value) {
252
- return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, ",1))\n").concat(this.BUFFER, "('");
253
399
  }
254
400
  }, {
255
- symbol: '=',
256
- format: function format(value) {
257
- return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, "))\n").concat(this.BUFFER, "('");
401
+ key: "exist",
402
+ value: function exist(key) {
403
+ return hasProp(_classPrivateFieldGet2(_list, this), key);
258
404
  }
259
405
  }, {
260
- symbol: '#',
261
- format: function format(value) {
262
- return "')\n/**".concat(value, "**/\n").concat(this.BUFFER, "('");
406
+ key: "clear",
407
+ value: function clear() {
408
+ _classPrivateFieldSet2(_list, this, {});
263
409
  }
264
410
  }, {
265
- symbol: '',
266
- format: function format(value) {
267
- return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
268
- }
269
- }];
270
- function matchTokens(regex, text, callback) {
271
- var index = 0;
272
- text.replace(regex, function () {
273
- var params = [].slice.call(arguments, 0, -1);
274
- var offset = params.pop();
275
- var match = params.shift();
276
- callback(params, index, offset);
277
- index = offset + match.length;
278
- return match;
279
- });
280
- }
411
+ key: "remove",
412
+ value: function remove(key) {
413
+ delete _classPrivateFieldGet2(_list, this)[key];
414
+ }
415
+ }, {
416
+ key: "resolve",
417
+ value: function resolve(key) {
418
+ return Promise.resolve(this.get(key));
419
+ }
420
+ }, {
421
+ key: "configure",
422
+ value: function configure(config) {
423
+ _classPrivateFieldSet2(_enabled, this, config.cache);
424
+ if (isNode() === false) {
425
+ this.load(global[config["export"]]);
426
+ }
427
+ }
428
+ }]);
429
+ }();
430
+
431
+ var _config$1 = /*#__PURE__*/new WeakMap();
432
+ var _symbols = /*#__PURE__*/new WeakMap();
433
+ var Compiler = /*#__PURE__*/function () {
281
434
  function Compiler(config) {
282
- if (instanceOf(this, Compiler) === false) return new Compiler(config);
283
- var compiler = {};
284
- this.configure = function (config) {
285
- compiler.withObject = config.withObject;
286
- compiler.rmWhitespace = config.rmWhitespace;
287
- compiler.token = config.token;
288
- compiler.vars = config.vars;
289
- compiler.globalHelpers = config.globalHelpers;
290
- compiler.matches = [];
291
- compiler.formats = [];
292
- compiler.slurp = {
293
- match: '[\s\t\n]*',
294
- start: [compiler.token.start, '_'],
295
- end: ['_', compiler.token.end]
435
+ _classCallCheck(this, Compiler);
436
+ _classPrivateFieldInitSpec(this, _config$1, {});
437
+ _classPrivateFieldInitSpec(this, _symbols, [{
438
+ symbol: '-',
439
+ format: function format(value) {
440
+ return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, ",1))\n").concat(this.BUFFER, "('");
441
+ }
442
+ }, {
443
+ symbol: '=',
444
+ format: function format(value) {
445
+ return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, "))\n").concat(this.BUFFER, "('");
446
+ }
447
+ }, {
448
+ symbol: '#',
449
+ format: function format(value) {
450
+ return "')\n/**".concat(value, "**/\n").concat(this.BUFFER, "('");
451
+ }
452
+ }, {
453
+ symbol: '',
454
+ format: function format(value) {
455
+ return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
456
+ }
457
+ }]);
458
+ this.configure(config);
459
+ }
460
+ return _createClass(Compiler, [{
461
+ key: "configure",
462
+ value: function configure(config) {
463
+ var _this = this;
464
+ _classPrivateFieldGet2(_config$1, this).withObject = config.withObject;
465
+ _classPrivateFieldGet2(_config$1, this).rmWhitespace = config.rmWhitespace;
466
+ _classPrivateFieldGet2(_config$1, this).token = config.token;
467
+ _classPrivateFieldGet2(_config$1, this).vars = config.vars;
468
+ _classPrivateFieldGet2(_config$1, this).globalHelpers = config.globalHelpers;
469
+ _classPrivateFieldGet2(_config$1, this).matches = [];
470
+ _classPrivateFieldGet2(_config$1, this).formats = [];
471
+ _classPrivateFieldGet2(_config$1, this).slurp = {
472
+ match: '[s\t\n]*',
473
+ start: [_classPrivateFieldGet2(_config$1, this).token.start, '_'],
474
+ end: ['_', _classPrivateFieldGet2(_config$1, this).token.end]
296
475
  };
297
- tagList.forEach(function (item) {
298
- compiler.matches.push(compiler.token.start.concat(item.symbol).concat(compiler.token.regex).concat(compiler.token.end));
299
- compiler.formats.push(item.format.bind(compiler.vars));
476
+ _classPrivateFieldGet2(_symbols, this).forEach(function (item) {
477
+ _classPrivateFieldGet2(_config$1, _this).matches.push(_classPrivateFieldGet2(_config$1, _this).token.start.concat(item.symbol).concat(_classPrivateFieldGet2(_config$1, _this).token.regex).concat(_classPrivateFieldGet2(_config$1, _this).token.end));
478
+ _classPrivateFieldGet2(_config$1, _this).formats.push(item.format.bind(_classPrivateFieldGet2(_config$1, _this).vars));
300
479
  });
301
- compiler.regex = new RegExp(compiler.matches.join('|').concat('|$'), 'g');
302
- compiler.slurpStart = new RegExp([compiler.slurp.match, compiler.slurp.start.join('')].join(''), 'gm');
303
- compiler.slurpEnd = new RegExp([compiler.slurp.end.join(''), compiler.slurp.match].join(''), 'gm');
304
- };
305
- this.compile = function (content, path) {
306
- var _compiler$vars = compiler.vars,
307
- SCOPE = _compiler$vars.SCOPE,
308
- SAFE = _compiler$vars.SAFE,
309
- BUFFER = _compiler$vars.BUFFER,
310
- COMPONENT = _compiler$vars.COMPONENT;
311
- var GLOBALS = compiler.globalHelpers;
312
- content = String(content);
313
- if (compiler.rmWhitespace) {
314
- content = content.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
480
+ _classPrivateFieldGet2(_config$1, this).regex = new RegExp(_classPrivateFieldGet2(_config$1, this).matches.join('|').concat('|$'), 'g');
481
+ _classPrivateFieldGet2(_config$1, this).slurpStart = new RegExp([_classPrivateFieldGet2(_config$1, this).slurp.match, _classPrivateFieldGet2(_config$1, this).slurp.start.join('')].join(''), 'gm');
482
+ _classPrivateFieldGet2(_config$1, this).slurpEnd = new RegExp([_classPrivateFieldGet2(_config$1, this).slurp.end.join(''), _classPrivateFieldGet2(_config$1, this).slurp.match].join(''), 'gm');
483
+ }
484
+ }, {
485
+ key: "compile",
486
+ value: function compile(content, path) {
487
+ var _this2 = this;
488
+ var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config$1, this).vars,
489
+ SCOPE = _classPrivateFieldGet2$1.SCOPE,
490
+ SAFE = _classPrivateFieldGet2$1.SAFE,
491
+ BUFFER = _classPrivateFieldGet2$1.BUFFER,
492
+ COMPONENT = _classPrivateFieldGet2$1.COMPONENT,
493
+ ELEMENT = _classPrivateFieldGet2$1.ELEMENT;
494
+ var GLOBALS = _classPrivateFieldGet2(_config$1, this).globalHelpers;
495
+ if (_classPrivateFieldGet2(_config$1, this).rmWhitespace) {
496
+ content = String(content).replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
315
497
  }
316
- content = content.replace(compiler.slurpStart, compiler.token.start).replace(compiler.slurpEnd, compiler.token.end);
498
+ content = String(content).replace(_classPrivateFieldGet2(_config$1, this).slurpStart, _classPrivateFieldGet2(_config$1, this).token.start).replace(_classPrivateFieldGet2(_config$1, this).slurpEnd, _classPrivateFieldGet2(_config$1, this).token.end);
317
499
  var source = "".concat(BUFFER, "('");
318
- matchTokens(compiler.regex, content, function (params, index, offset) {
500
+ matchTokens(_classPrivateFieldGet2(_config$1, this).regex, content, function (params, index, offset) {
319
501
  source += symbols(content.slice(index, offset));
320
502
  params.forEach(function (value, index) {
321
503
  if (value) {
322
- source += compiler.formats[index](value);
504
+ source += _classPrivateFieldGet2(_config$1, _this2).formats[index](value);
323
505
  }
324
506
  });
325
507
  });
326
508
  source += "');";
327
509
  source = "try{".concat(source, "}catch(e){return ").concat(BUFFER, ".error(e)}");
328
- if (compiler.withObject) {
510
+ if (_classPrivateFieldGet2(_config$1, this).withObject) {
329
511
  source = "with(".concat(SCOPE, "){").concat(source, "}");
330
512
  }
331
513
  source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
332
514
  source += "\n//# sourceURL=".concat(path);
333
515
  var result = null;
334
- var params = [SCOPE, COMPONENT, BUFFER, SAFE].concat(GLOBALS);
516
+ var params = [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT].concat(GLOBALS);
335
517
  try {
336
518
  result = Function.apply(null, params.concat(source));
337
519
  result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
@@ -341,620 +523,571 @@
341
523
  throw e;
342
524
  }
343
525
  return result;
344
- };
345
- this.configure(config);
346
- }
526
+ }
527
+ }]);
528
+ }();
347
529
 
530
+ var _path = /*#__PURE__*/new WeakMap();
531
+ var _cache$1 = /*#__PURE__*/new WeakMap();
532
+ var _compiler$1 = /*#__PURE__*/new WeakMap();
533
+ var _resolver = /*#__PURE__*/new WeakMap();
534
+ var _Template_brand = /*#__PURE__*/new WeakSet();
535
+ var Template = /*#__PURE__*/function () {
348
536
  function Template(config, cache, compiler) {
349
- if (instanceOf(this, Template) === false) return new Template(config, cache, compiler);
350
- if (instanceOf(cache, Cache) === false) throw new TypeError('cache is not instance of Cache');
351
- if (instanceOf(compiler, Compiler) === false) throw new TypeError('compiler is not instance of Compiler');
352
- var template = {};
353
- var result = function result(template, content) {
354
- cache.set(template, content);
355
- return content;
356
- };
357
- var resolve = function resolve(path) {
358
- return template.resolver(template.path, path);
359
- };
360
- var compile = function compile(content, template) {
361
- if (isFunction(content)) {
362
- return content;
363
- } else {
364
- return compiler.compile(content, template);
365
- }
366
- };
367
- this.configure = function (config) {
368
- template.path = config.path;
369
- template.cache = config.cache;
537
+ _classCallCheck(this, Template);
538
+ _classPrivateMethodInitSpec(this, _Template_brand);
539
+ _classPrivateFieldInitSpec(this, _path, void 0);
540
+ _classPrivateFieldInitSpec(this, _cache$1, void 0);
541
+ _classPrivateFieldInitSpec(this, _compiler$1, void 0);
542
+ _classPrivateFieldInitSpec(this, _resolver, void 0);
543
+ assertInstanceOf(cache, Cache);
544
+ assertInstanceOf(compiler, Compiler);
545
+ _classPrivateFieldSet2(_cache$1, this, cache);
546
+ _classPrivateFieldSet2(_compiler$1, this, compiler);
547
+ this.configure(config);
548
+ }
549
+ return _createClass(Template, [{
550
+ key: "configure",
551
+ value: function configure(config) {
552
+ _classPrivateFieldSet2(_path, this, config.path);
370
553
  if (isFunction(config.resolver)) {
371
- template.resolver = config.resolver;
554
+ _classPrivateFieldSet2(_resolver, this, config.resolver);
372
555
  }
373
- };
374
- this.get = function (template) {
375
- if (cache.exist(template)) {
376
- return cache.resolve(template);
556
+ }
557
+ }, {
558
+ key: "get",
559
+ value: function get(template) {
560
+ var _this = this;
561
+ if (_classPrivateFieldGet2(_cache$1, this).exist(template)) {
562
+ return _classPrivateFieldGet2(_cache$1, this).resolve(template);
377
563
  }
378
- return resolve(template).then(function (content) {
379
- return result(template, compile(content, template));
564
+ return _assertClassBrand(_Template_brand, this, _resolve).call(this, template).then(function (content) {
565
+ return _assertClassBrand(_Template_brand, _this, _result).call(_this, template, _assertClassBrand(_Template_brand, _this, _compile).call(_this, content, template));
380
566
  });
381
- };
382
- this.configure(config);
567
+ }
568
+ }]);
569
+ }();
570
+ function _resolve(path) {
571
+ return _classPrivateFieldGet2(_resolver, this).call(this, _classPrivateFieldGet2(_path, this), path);
572
+ }
573
+ function _result(template, content) {
574
+ _classPrivateFieldGet2(_cache$1, this).set(template, content);
575
+ return content;
576
+ }
577
+ function _compile(content, template) {
578
+ if (isFunction(content)) {
579
+ return content;
580
+ } else {
581
+ return _classPrivateFieldGet2(_compiler$1, this).compile(content, template);
383
582
  }
583
+ }
384
584
 
385
- function _defineProperty(e, r, t) {
386
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
387
- value: t,
388
- enumerable: !0,
389
- configurable: !0,
390
- writable: !0
391
- }) : e[r] = t, e;
392
- }
393
- function _toPrimitive(t, r) {
394
- if ("object" != typeof t || !t) return t;
395
- var e = t[Symbol.toPrimitive];
396
- if (void 0 !== e) {
397
- var i = e.call(t, r || "default");
398
- if ("object" != typeof i) return i;
399
- throw new TypeError("@@toPrimitive must return a primitive value.");
400
- }
401
- return ("string" === r ? String : Number)(t);
585
+ var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
586
+ var space = ' ';
587
+ var quote = '"';
588
+ var equal = '=';
589
+ var slash = '/';
590
+ var lt = '<';
591
+ var gt = '>';
592
+ var element = function element(tag, attrs, content) {
593
+ var result = [];
594
+ var hasClosedTag = selfClosed.indexOf(tag) === -1;
595
+ var attributes = map(attrs, function (value, key) {
596
+ if (value !== null && value !== undefined) {
597
+ return [entities(key), [quote, entities(value), quote].join('')].join(equal);
598
+ }
599
+ }).join(space);
600
+ result.push([lt, tag, space, attributes, gt].join(''));
601
+ if (content && hasClosedTag) {
602
+ result.push(content instanceof Array ? content.join('') : content);
402
603
  }
403
- function _toPropertyKey(t) {
404
- var i = _toPrimitive(t, "string");
405
- return "symbol" == typeof i ? i : i + "";
604
+ if (hasClosedTag) {
605
+ result.push([lt, slash, tag, gt].join(''));
406
606
  }
607
+ return result.join('');
608
+ };
407
609
 
408
- var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
409
- var space = ' ';
410
- var quote = '"';
411
- var equal = '=';
412
- var slash = '/';
413
- var lt = '<';
414
- var gt = '>';
415
- var element = function element(tag, attrs, content) {
416
- var result = [];
417
- var hasClosedTag = selfClosed.indexOf(tag) === -1;
418
- var attributes = map(attrs, function (value, key) {
419
- if (value !== null && value !== undefined) {
420
- return [entities(key), [quote, entities(value), quote].join('')].join(equal);
421
- }
422
- }).join(space);
423
- result.push([lt, tag, space, attributes, gt].join(''));
424
- if (content && hasClosedTag) {
425
- result.push(content instanceof Array ? content.join('') : content);
610
+ var TemplateError = /*#__PURE__*/function (_Error) {
611
+ function TemplateError(message) {
612
+ var _this;
613
+ _classCallCheck(this, TemplateError);
614
+ _this = _callSuper(this, TemplateError);
615
+ _defineProperty(_this, "code", 0);
616
+ _this.message = message;
617
+ return _this;
618
+ }
619
+ _inherits(TemplateError, _Error);
620
+ return _createClass(TemplateError, [{
621
+ key: "getCode",
622
+ value: function getCode() {
623
+ return this.code;
426
624
  }
427
- if (hasClosedTag) {
428
- result.push([lt, slash, tag, gt].join(''));
625
+ }, {
626
+ key: "getMessage",
627
+ value: function getMessage() {
628
+ return this.message;
429
629
  }
430
- return result.join('');
431
- };
432
-
433
- /**
434
- * @extends Error
435
- * @property code
436
- * @param {string} message
437
- * @constructor
438
- */
439
- function TemplateError(message) {
440
- this.name = 'TemplateError';
441
- this.message = message;
442
- Error.call(this);
630
+ }, {
631
+ key: "toString",
632
+ value: function toString() {
633
+ return this.getMessage();
634
+ }
635
+ }]);
636
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
637
+ var TemplateNotFound = /*#__PURE__*/function (_TemplateError2) {
638
+ function TemplateNotFound() {
639
+ var _this2;
640
+ _classCallCheck(this, TemplateNotFound);
641
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
642
+ args[_key] = arguments[_key];
643
+ }
644
+ _this2 = _callSuper(this, TemplateNotFound, [].concat(args));
645
+ _defineProperty(_this2, "code", 404);
646
+ return _this2;
647
+ }
648
+ _inherits(TemplateNotFound, _TemplateError2);
649
+ return _createClass(TemplateNotFound);
650
+ }(TemplateError);
651
+ var TemplateSyntaxError = /*#__PURE__*/function (_TemplateError3) {
652
+ function TemplateSyntaxError() {
653
+ var _this3;
654
+ _classCallCheck(this, TemplateSyntaxError);
655
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
656
+ args[_key2] = arguments[_key2];
657
+ }
658
+ _this3 = _callSuper(this, TemplateSyntaxError, [].concat(args));
659
+ _defineProperty(_this3, "code", 500);
660
+ return _this3;
443
661
  }
662
+ _inherits(TemplateSyntaxError, _TemplateError3);
663
+ return _createClass(TemplateSyntaxError);
664
+ }(TemplateError);
444
665
 
445
- /**
446
- *
447
- */
448
- Object.setPrototypeOf(TemplateError.prototype, Error.prototype);
449
- Object.assign(TemplateError.prototype, {
450
- code: 1
666
+ function resolve(list) {
667
+ return Promise.all(list || []).then(function (list) {
668
+ return list.join('');
669
+ })["catch"](function (e) {
670
+ return e;
451
671
  });
452
- /**
453
- *
454
- * @return {number}
455
- */
456
- TemplateError.prototype.getCode = function () {
457
- return this.code;
672
+ }
673
+ function reject(error) {
674
+ return Promise.reject(new TemplateSyntaxError(error.message));
675
+ }
676
+
677
+ /**
678
+ *
679
+ * @return {buffer}
680
+ */
681
+ function createBuffer() {
682
+ var store = [],
683
+ array = [];
684
+ var buffer = function buffer(value) {
685
+ array.push(value);
458
686
  };
459
- /**
460
- *
461
- * @return {string}
462
- */
463
- TemplateError.prototype.getMessage = function () {
464
- return this.message;
687
+ buffer.start = function () {
688
+ array = [];
465
689
  };
466
- /**
467
- * @return {string}
468
- */
469
- TemplateError.prototype.toString = function () {
470
- return this.getMessage();
690
+ buffer.backup = function () {
691
+ store.push(array.concat());
692
+ array = [];
471
693
  };
694
+ buffer.restore = function () {
695
+ var result = array.concat();
696
+ array = store.pop();
697
+ return resolve(result);
698
+ };
699
+ buffer.error = function (e) {
700
+ return reject(e);
701
+ };
702
+ buffer.end = function () {
703
+ return resolve(array);
704
+ };
705
+ return buffer;
706
+ }
472
707
 
708
+ var createContextScope = function createContextScope(config, methods) {
709
+ var _Object$definePropert;
710
+ var _config$vars = config.vars,
711
+ BLOCKS = _config$vars.BLOCKS,
712
+ MACRO = _config$vars.MACRO,
713
+ EXTEND = _config$vars.EXTEND,
714
+ LAYOUT = _config$vars.LAYOUT,
715
+ BUFFER = _config$vars.BUFFER,
716
+ SAFE = _config$vars.SAFE,
717
+ SCOPE = _config$vars.SCOPE,
718
+ COMPONENT = _config$vars.COMPONENT,
719
+ ELEMENT = _config$vars.ELEMENT;
473
720
  /**
474
- * @extends TemplateError
475
- * @param {string} message
476
- * @constructor
477
- */
478
- function TemplateNotFound(message) {
479
- TemplateError.call(this);
480
- this.name = 'TemplateNotFound';
481
- this.message = message;
482
- }
483
-
484
- /**
485
- *
486
- */
487
- Object.setPrototypeOf(TemplateNotFound.prototype, TemplateError.prototype);
488
- Object.assign(TemplateNotFound.prototype, {
489
- code: 404
490
- });
491
- /**
492
- * @extends TemplateError
493
- * @param {string} message
721
+ * @name ContextScope
722
+ * @param data
494
723
  * @constructor
495
724
  */
496
- function TemplateSyntaxError(message) {
497
- TemplateError.call(this);
498
- this.name = 'TemplateSyntaxError';
499
- this.message = message;
500
- }
501
-
502
- /**
503
- *
504
- */
505
- Object.setPrototypeOf(TemplateSyntaxError.prototype, TemplateError.prototype);
506
- Object.assign(TemplateSyntaxError.prototype, {
507
- code: 500
508
- });
509
-
510
- function resolve(list) {
511
- return Promise.all(list || []).then(function (list) {
512
- return list.join('');
513
- })["catch"](function (e) {
514
- return e;
515
- });
725
+ function ContextScope(data) {
726
+ this[BLOCKS] = {};
727
+ this[MACRO] = {};
728
+ Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT]));
516
729
  }
517
- function reject(error) {
518
- return Promise.reject(new TemplateSyntaxError(error.message));
519
- }
520
- function createBuffer() {
521
- var store = [],
522
- array = [];
523
- function buffer(value) {
524
- array.push(value);
525
- }
526
- buffer.start = function () {
527
- array = [];
528
- };
529
- buffer.backup = function () {
530
- store.push(array.concat());
531
- array = [];
532
- };
533
- buffer.restore = function () {
534
- var result = array.concat();
535
- array = store.pop();
536
- return resolve(result);
537
- };
538
- buffer.error = function (e) {
539
- return reject(e);
540
- };
541
- buffer.end = function () {
542
- return resolve(array);
543
- };
544
- return buffer;
545
- }
546
-
547
- function Context(config) {
548
- if (instanceOf(this, Context) === false) return new Context(config);
549
- this.configure = function (config, methods) {
550
- var _Object$definePropert;
551
- var _config$vars = config.vars,
552
- BLOCKS = _config$vars.BLOCKS,
553
- MACRO = _config$vars.MACRO,
554
- EXTEND = _config$vars.EXTEND,
555
- LAYOUT = _config$vars.LAYOUT,
556
- BUFFER = _config$vars.BUFFER,
557
- COMPONENT = _config$vars.COMPONENT;
558
- this.create = function (data) {
559
- return new Scope(data);
730
+ Object.assign(ContextScope.prototype, methods);
731
+ Object.defineProperties(ContextScope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
732
+ value: createBuffer()
733
+ }), BLOCKS, {
734
+ value: {},
735
+ writable: true
736
+ }), MACRO, {
737
+ value: {},
738
+ writable: true
739
+ }), LAYOUT, {
740
+ value: false,
741
+ writable: true
742
+ }), EXTEND, {
743
+ value: false,
744
+ writable: true
745
+ }), "useSafeValue", {
746
+ get: function get() {
747
+ return safeValue;
748
+ }
749
+ }), "useComponent", {
750
+ get: function get() {
751
+ if (isFunction(this[COMPONENT])) {
752
+ return this[COMPONENT].bind(this);
753
+ } else {
754
+ return function () {
755
+ throw new Error("".concat(COMPONENT, " must be a function"));
756
+ };
757
+ }
758
+ }
759
+ }), "useElement", {
760
+ get: function get() {
761
+ if (isFunction(this[ELEMENT])) {
762
+ return this[ELEMENT].bind(this);
763
+ } else {
764
+ return function () {
765
+ throw new Error("".concat(ELEMENT, " must be a function"));
766
+ };
767
+ }
768
+ }
769
+ }), "getMacro", {
770
+ value: function value() {
771
+ return this[MACRO];
772
+ }
773
+ }), "getBuffer", {
774
+ value: function value() {
775
+ return this[BUFFER];
776
+ }
777
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getBlocks", {
778
+ value: function value() {
779
+ return this[BLOCKS];
780
+ }
781
+ }), "setExtend", {
782
+ value: function value(_value) {
783
+ this[EXTEND] = _value;
784
+ }
785
+ }), "getExtend", {
786
+ value: function value() {
787
+ return this[EXTEND];
788
+ }
789
+ }), "setLayout", {
790
+ value: function value(layout) {
791
+ this[LAYOUT] = layout;
792
+ }
793
+ }), "getLayout", {
794
+ value: function value() {
795
+ return this[LAYOUT];
796
+ }
797
+ }), "clone", {
798
+ value: function value(exclude_blocks) {
799
+ var filter = [LAYOUT, EXTEND, BUFFER];
800
+ if (exclude_blocks === true) {
801
+ filter.push(BLOCKS);
802
+ }
803
+ return omit(this, filter);
804
+ }
805
+ }), "extend", {
806
+ value: function value(layout) {
807
+ this.setExtend(true);
808
+ this.setLayout(layout);
809
+ }
810
+ }), "echo", {
811
+ value: function value(layout) {
812
+ var buffer = this.getBuffer();
813
+ var params = [].slice.call(arguments);
814
+ params.forEach(buffer);
815
+ }
816
+ }), "fn", {
817
+ value: function value(callback) {
818
+ var buffer = this.getBuffer();
819
+ var context = this;
820
+ return function () {
821
+ if (isFunction(callback)) {
822
+ buffer.backup();
823
+ buffer(callback.apply(context, arguments));
824
+ return buffer.restore();
825
+ }
560
826
  };
561
- this.helpers = function (methods) {
562
- extend(Scope.prototype, methods || {});
827
+ }
828
+ }), "macro", {
829
+ value: function value(name, callback) {
830
+ var list = this.getMacro();
831
+ var macro = this.fn(callback);
832
+ var context = this;
833
+ list[name] = function () {
834
+ return context.echo(macro.apply(undefined, arguments));
563
835
  };
564
- /**
565
- * @name ContextScope
566
- * @param data
567
- * @constructor
568
- */
569
- function Scope(data) {
570
- this[BLOCKS] = {};
571
- this[MACRO] = {};
572
- extend(this, data || {});
836
+ }
837
+ }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
838
+ value: function value(name) {
839
+ var list = this.getMacro();
840
+ var macro = list[name];
841
+ var params = [].slice.call(arguments, 1);
842
+ if (isFunction(macro)) {
843
+ return macro.apply(macro, params);
573
844
  }
574
- Scope.prototype = extend({}, methods || {});
575
- Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
576
- value: createBuffer(),
577
- writable: true,
578
- configurable: false,
579
- enumerable: false
580
- }), BLOCKS, {
581
- value: {},
582
- writable: true,
583
- configurable: false,
584
- enumerable: false
585
- }), MACRO, {
586
- value: {},
587
- writable: true,
588
- configurable: false,
589
- enumerable: false
590
- }), LAYOUT, {
591
- value: false,
592
- writable: true,
593
- configurable: false,
594
- enumerable: false
595
- }), EXTEND, {
596
- value: false,
597
- writable: true,
598
- configurable: false,
599
- enumerable: false
600
- }), "getMacro", {
601
- value: function value() {
602
- return this[MACRO];
603
- },
604
- writable: false,
605
- configurable: false,
606
- enumerable: false
607
- }), "getBuffer", {
608
- value: function value() {
609
- return this[BUFFER];
610
- },
611
- writable: false,
612
- configurable: false,
613
- enumerable: false
614
- }), "getComponent", {
615
- value: function value() {
616
- var context = this;
617
- if (COMPONENT in context) {
618
- return function () {
619
- return context[COMPONENT].apply(context, arguments);
620
- };
621
- }
622
- return function () {
623
- console.log('%s function not defined', COMPONENT);
624
- };
625
- },
626
- writable: false,
627
- configurable: false,
628
- enumerable: false
629
- }), "getBlocks", {
630
- value: function value() {
631
- return this[BLOCKS];
632
- },
633
- writable: false,
634
- configurable: false,
635
- enumerable: false
636
- }), "setExtend", {
637
- value: function value(_value) {
638
- this[EXTEND] = _value;
639
- },
640
- writable: false,
641
- configurable: false,
642
- enumerable: false
643
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
644
- value: function value() {
645
- return this[EXTEND];
646
- },
647
- writable: false,
648
- configurable: false,
649
- enumerable: false
650
- }), "setLayout", {
651
- value: function value(layout) {
652
- this[LAYOUT] = layout;
653
- },
654
- writable: false,
655
- configurable: false,
656
- enumerable: false
657
- }), "getLayout", {
658
- value: function value() {
659
- return this[LAYOUT];
660
- },
661
- writable: false,
662
- configurable: false,
663
- enumerable: false
664
- }), "clone", {
665
- value: function value(exclude_blocks) {
666
- var filter = [LAYOUT, EXTEND, BUFFER];
667
- if (exclude_blocks === true) {
668
- filter.push(BLOCKS);
669
- }
670
- return omit(this, filter);
671
- },
672
- writable: false,
673
- configurable: false,
674
- enumerable: false
675
- }), "extend", {
676
- value: function value(layout) {
677
- this.setExtend(true);
678
- this.setLayout(layout);
679
- },
680
- writable: false,
681
- configurable: false,
682
- enumerable: false
683
- }), "echo", {
684
- value: function value(layout) {
685
- var buffer = this.getBuffer();
686
- var params = [].slice.call(arguments);
687
- params.forEach(buffer);
688
- },
689
- writable: false,
690
- configurable: false,
691
- enumerable: false
692
- }), "fn", {
693
- value: function value(callback) {
694
- var buffer = this.getBuffer();
695
- var context = this;
845
+ }
846
+ }), "block", {
847
+ value: function value(name, callback) {
848
+ var _this = this;
849
+ var blocks = this.getBlocks();
850
+ blocks[name] = blocks[name] || [];
851
+ blocks[name].push(this.fn(callback));
852
+ if (this.getExtend()) return;
853
+ var list = Object.assign([], blocks[name]);
854
+ var current = function current() {
855
+ return list.shift();
856
+ };
857
+ var _next = function next() {
858
+ var parent = current();
859
+ if (parent) {
696
860
  return function () {
697
- buffer.backup();
698
- if (isFunction(callback)) {
699
- callback.apply(context, arguments);
700
- }
701
- return buffer.restore();
702
- };
703
- },
704
- writable: false,
705
- configurable: false,
706
- enumerable: false
707
- }), "get", {
708
- value: function value(name, defaults) {
709
- var path = getPath(this, name, true);
710
- var result = path.shift();
711
- var prop = path.pop();
712
- return hasProp(result, prop) ? result[prop] : defaults;
713
- },
714
- writable: true,
715
- configurable: true,
716
- enumerable: false
717
- }), "set", {
718
- value: function value(name, _value2) {
719
- var path = getPath(this, name, false);
720
- var result = path.shift();
721
- var prop = path.pop();
722
- if (this.getExtend() && hasProp(result, prop)) {
723
- return result[prop];
724
- }
725
- return result[prop] = _value2;
726
- },
727
- writable: false,
728
- configurable: false,
729
- enumerable: false
730
- }), "macro", {
731
- value: function value(name, callback) {
732
- var list = this.getMacro();
733
- var macro = this.fn(callback);
734
- var context = this;
735
- list[name] = function () {
736
- return context.echo(macro.apply(undefined, arguments));
737
- };
738
- },
739
- writable: false,
740
- configurable: false,
741
- enumerable: false
742
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
743
- value: function value(name) {
744
- var list = this.getMacro();
745
- var macro = list[name];
746
- var params = [].slice.call(arguments, 1);
747
- if (isFunction(macro)) {
748
- return macro.apply(macro, params);
749
- }
750
- },
751
- writable: false,
752
- configurable: false,
753
- enumerable: false
754
- }), "block", {
755
- value: function value(name, callback) {
756
- var _this = this;
757
- var blocks = this.getBlocks();
758
- blocks[name] = blocks[name] || [];
759
- blocks[name].push(this.fn(callback));
760
- if (this.getExtend()) return;
761
- var list = Object.assign([], blocks[name]);
762
- var current = function current() {
763
- return list.shift();
764
- };
765
- var _next = function next() {
766
- var parent = current();
767
- if (parent) {
768
- return function () {
769
- _this.echo(parent(_next()));
770
- };
771
- } else {
772
- return noop;
773
- }
861
+ _this.echo(parent(_next()));
774
862
  };
775
- this.echo(current()(_next()));
776
- },
777
- writable: false,
778
- configurable: false,
779
- enumerable: false
780
- }), "hasBlock", {
781
- value: function value(name) {
782
- return this.getBlocks().hasOwnProperty(name);
783
- },
784
- writable: false,
785
- configurable: false,
786
- enumerable: false
787
- }), "include", {
788
- value: function value(path, data, cx) {
789
- var context = cx === false ? {} : this.clone(true);
790
- var params = extend(context, data || {});
791
- var promise = this.render(path, params);
792
- this.echo(promise);
793
- },
794
- writable: false,
795
- configurable: false,
796
- enumerable: false
797
- }), "promiseResolve", {
798
- value: function value(_value3, callback) {
799
- return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
800
- },
801
- writable: false,
802
- configurable: false,
803
- enumerable: false
804
- }), "use", {
805
- value: function value(path, namespace) {
806
- this.echo(this.promiseResolve(this.require(path), function (exports) {
807
- var list = this.getMacro();
808
- each(exports, function (macro, name) {
809
- list[[namespace, name].join('.')] = macro;
810
- });
811
- }));
812
- },
813
- writable: false,
814
- configurable: false,
815
- enumerable: false
816
- }), "async", {
817
- value: function value(promise, callback) {
818
- this.echo(this.promiseResolve(promise, function (data) {
819
- return this.fn(callback)(data);
820
- }));
821
- },
822
- writable: false,
823
- configurable: false,
824
- enumerable: false
825
- }), "each", {
826
- value: function value(object, callback) {
827
- if (isString(object)) {
828
- object = this.get(object, []);
829
- }
830
- each(object, callback);
831
- },
832
- writable: false,
833
- configurable: false,
834
- enumerable: false
835
- }), "element", {
836
- value: function value(tag, attr, content) {
837
- return element(tag, attr, content);
838
- },
839
- writable: false,
840
- configurable: false,
841
- enumerable: false
842
- }), "el", {
843
- value: function value(tag, attr, content) {
844
- this.echo(this.promiseResolve(content, function (content) {
845
- return this.element(tag, attr, content);
846
- }));
847
- },
848
- writable: false,
849
- configurable: false,
850
- enumerable: false
851
- })));
852
- };
853
- this.configure(config);
863
+ } else {
864
+ return noop;
865
+ }
866
+ };
867
+ this.echo(current()(_next()));
868
+ }
869
+ }), "hasBlock", {
870
+ value: function value(name) {
871
+ return this.getBlocks().hasOwnProperty(name);
872
+ }
873
+ }), "include", {
874
+ value: function value(path, data, cx) {
875
+ var context = cx === false ? {} : this.clone(true);
876
+ var params = extend(context, data || {});
877
+ var promise = this.render(path, params);
878
+ this.echo(promise);
879
+ }
880
+ }), "use", {
881
+ value: function value(path, namespace) {
882
+ var _this2 = this;
883
+ this.echo(Promise.resolve(this.require(path)).then(function (exports) {
884
+ var list = _this2.getMacro();
885
+ each(exports, function (macro, name) {
886
+ list[[namespace, name].join('.')] = macro;
887
+ });
888
+ }));
889
+ }
890
+ }), "async", {
891
+ value: function value(promise, callback) {
892
+ this.echo(Promise.resolve(promise).then(callback));
893
+ }
894
+ }), "get", {
895
+ value: function value(name, defaults) {
896
+ var path = getPath(this, name, true);
897
+ var result = path.shift();
898
+ var prop = path.pop();
899
+ return hasProp(result, prop) ? result[prop] : defaults;
900
+ }
901
+ }), "set", {
902
+ value: function value(name, _value2) {
903
+ var path = getPath(this, name, false);
904
+ var result = path.shift();
905
+ var prop = path.pop();
906
+ if (this.getExtend() && hasProp(result, prop)) {
907
+ return result[prop];
908
+ }
909
+ return result[prop] = _value2;
910
+ }
911
+ }), "each", {
912
+ value: function value(object, callback) {
913
+ if (isString(object)) {
914
+ object = this.get(object, []);
915
+ }
916
+ each(object, callback);
917
+ },
918
+ writable: true
919
+ }), "el", {
920
+ value: function value(tag, attr, content) {
921
+ content = isFunction(content) ? this.fn(content)() : content;
922
+ this.echo(Promise.resolve(content).then(function (content) {
923
+ return element(tag, attr, content);
924
+ }));
925
+ },
926
+ writable: true
927
+ }), _defineProperty(_Object$definePropert, "ui", {
928
+ value: function value(layout) {},
929
+ writable: true
930
+ })));
931
+ return ContextScope;
932
+ };
933
+ var _scope = /*#__PURE__*/new WeakMap();
934
+ var Context = /*#__PURE__*/function () {
935
+ function Context(config, methods) {
936
+ _classCallCheck(this, Context);
937
+ _classPrivateFieldInitSpec(this, _scope, void 0);
938
+ this.configure(config, methods);
854
939
  }
940
+ return _createClass(Context, [{
941
+ key: "create",
942
+ value: function create(data) {
943
+ return new (_classPrivateFieldGet2(_scope, this))(data);
944
+ }
945
+ }, {
946
+ key: "configure",
947
+ value: function configure(config, methods) {
948
+ _classPrivateFieldSet2(_scope, this, createContextScope(config, methods));
949
+ }
950
+ }, {
951
+ key: "helpers",
952
+ value: function helpers(methods) {
953
+ extend(_classPrivateFieldGet2(_scope, this).prototype, methods || {});
954
+ }
955
+ }]);
956
+ }();
855
957
 
958
+ var _config = /*#__PURE__*/new WeakMap();
959
+ var _extend = /*#__PURE__*/new WeakMap();
960
+ var _context = /*#__PURE__*/new WeakMap();
961
+ var _compiler = /*#__PURE__*/new WeakMap();
962
+ var _cache = /*#__PURE__*/new WeakMap();
963
+ var _template = /*#__PURE__*/new WeakMap();
964
+ var _EJS_brand = /*#__PURE__*/new WeakSet();
965
+ var EJS = /*#__PURE__*/function () {
856
966
  function EJS(options) {
857
- if (instanceOf(this, EJS) === false) return new EJS(options);
858
- var scope = {};
859
- var config = {};
860
- configSchema(config, options || {});
861
- var context = new Context(config);
862
- var compiler = new Compiler(config);
863
- var cache = new Cache();
864
- var template = new Template(config, cache, compiler);
865
- var output = function output(path, scope) {
866
- var globalHelpers = config.globalHelpers;
867
- var params = [scope, scope.getComponent(), scope.getBuffer(), safeValue].concat(globalHelpers.filter(function (name) {
868
- return isFunction(scope[name]);
869
- }).map(function (name) {
870
- return scope[name].bind(scope);
871
- }));
872
- return template.get(path).then(function (callback) {
873
- return callback.apply(scope, params);
874
- });
875
- };
876
- var require = function require(name) {
877
- var filepath = ext(name, config.extension);
878
- var scope = context.create({});
879
- return output(filepath, scope).then(function () {
880
- return scope.getMacro();
881
- });
882
- };
883
- var _render = function render(name, data) {
884
- var filepath = ext(name, config.extension);
885
- var scope = context.create(data);
886
- return output(filepath, scope).then(function (content) {
967
+ _classCallCheck(this, EJS);
968
+ _classPrivateMethodInitSpec(this, _EJS_brand);
969
+ _classPrivateFieldInitSpec(this, _config, {});
970
+ _classPrivateFieldInitSpec(this, _extend, {});
971
+ _classPrivateFieldInitSpec(this, _context, void 0);
972
+ _classPrivateFieldInitSpec(this, _compiler, void 0);
973
+ _classPrivateFieldInitSpec(this, _cache, void 0);
974
+ _classPrivateFieldInitSpec(this, _template, void 0);
975
+ configSchema(_classPrivateFieldGet2(_config, this), options || {});
976
+ _classPrivateFieldSet2(_context, this, new Context(_classPrivateFieldGet2(_config, this), _classPrivateFieldGet2(_extend, this)));
977
+ _classPrivateFieldSet2(_compiler, this, new Compiler(_classPrivateFieldGet2(_config, this)));
978
+ _classPrivateFieldSet2(_cache, this, new Cache(_classPrivateFieldGet2(_config, this)));
979
+ _classPrivateFieldSet2(_template, this, new Template(_classPrivateFieldGet2(_config, this), _classPrivateFieldGet2(_cache, this), _classPrivateFieldGet2(_compiler, this)));
980
+ //
981
+ bindContext(this, ['configure', 'create', 'render', 'require', 'context', 'preload', 'compile', 'helpers']);
982
+ //
983
+ this.helpers({
984
+ require: this.require,
985
+ render: this.render
986
+ });
987
+ }
988
+ return _createClass(EJS, [{
989
+ key: "configure",
990
+ value: function configure(options) {
991
+ configSchema(_classPrivateFieldGet2(_config, this), options || {});
992
+ _classPrivateFieldGet2(_context, this).configure(_classPrivateFieldGet2(_config, this), _classPrivateFieldGet2(_extend, this));
993
+ _classPrivateFieldGet2(_compiler, this).configure(_classPrivateFieldGet2(_config, this));
994
+ _classPrivateFieldGet2(_cache, this).configure(_classPrivateFieldGet2(_config, this));
995
+ _classPrivateFieldGet2(_template, this).configure(_classPrivateFieldGet2(_config, this));
996
+ return _classPrivateFieldGet2(_config, this);
997
+ }
998
+ }, {
999
+ key: "render",
1000
+ value: function render(name, data) {
1001
+ var _this = this;
1002
+ var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1003
+ var scope = this.context(data);
1004
+ return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function (content) {
887
1005
  if (scope.getExtend()) {
888
1006
  scope.setExtend(false);
889
1007
  var layout = scope.getLayout();
890
1008
  var _data = scope.clone();
891
- return _render(layout, _data);
1009
+ return _this.render(layout, _data);
892
1010
  }
893
1011
  return content;
894
1012
  });
895
- };
896
- this.configure = function (options) {
897
- options = options || {};
898
- configSchema(config, options);
899
- context.configure(config, scope);
900
- compiler.configure(config);
901
- cache.configure(config);
902
- template.configure(config);
903
- return config;
904
- };
905
- this.render = function (name, data) {
906
- return _render(name, data);
907
- };
908
- this.helpers = function (methods) {
909
- context.helpers(extend(scope, methods));
910
- };
911
- this.preload = function (list) {
912
- return cache.load(list || {});
913
- };
914
- this.create = function (options) {
915
- return new EJS(options);
916
- };
917
- this.compile = function (content, path) {
918
- return compiler.compile(content, path);
919
- };
920
- this.context = function (data) {
921
- return context.create(data);
922
- };
923
- this.helpers({
924
- require: require,
925
- render: _render
926
- });
927
- return this;
928
- }
1013
+ }
1014
+ }, {
1015
+ key: "helpers",
1016
+ value: function helpers(methods) {
1017
+ _classPrivateFieldGet2(_context, this).helpers(extend(_classPrivateFieldGet2(_extend, this), methods));
1018
+ }
1019
+ }, {
1020
+ key: "context",
1021
+ value: function context(data) {
1022
+ return _classPrivateFieldGet2(_context, this).create(data);
1023
+ }
1024
+ }, {
1025
+ key: "compile",
1026
+ value: function compile(content, path) {
1027
+ return _classPrivateFieldGet2(_compiler, this).compile(content, path);
1028
+ }
1029
+ }, {
1030
+ key: "preload",
1031
+ value: function preload(list) {
1032
+ return _classPrivateFieldGet2(_cache, this).load(list || {});
1033
+ }
1034
+ }, {
1035
+ key: "create",
1036
+ value: function create(options) {
1037
+ return new this.constructor(options);
1038
+ }
1039
+ }, {
1040
+ key: "require",
1041
+ value: function require(name) {
1042
+ var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1043
+ var scope = this.context({});
1044
+ return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
1045
+ return scope.getMacro();
1046
+ });
1047
+ }
1048
+ }]);
1049
+ }();
1050
+ function _output(path, scope) {
1051
+ var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
1052
+ globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
1053
+ var params = [scope, scope.getBuffer(), scope.useSafeValue, scope.useComponent, scope.useElement].concat(globalHelpers.filter(function (name) {
1054
+ return isFunction(scope[name]);
1055
+ }).map(function (name) {
1056
+ return scope[name].bind(scope);
1057
+ }));
1058
+ return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
1059
+ return callback.apply(scope, params);
1060
+ });
1061
+ }
929
1062
 
930
- var httpRequest = function httpRequest(path, template) {
931
- return fetch(joinPath(path, template)).then(function (response) {
932
- return response.text();
933
- }, function (reason) {
934
- return new TemplateError(reason);
935
- });
936
- };
1063
+ var httpRequest = function httpRequest(path, template) {
1064
+ return fetch(joinPath(path, template)).then(function (response) {
1065
+ return response.text();
1066
+ }, function (reason) {
1067
+ return new TemplateError(reason);
1068
+ });
1069
+ };
937
1070
 
938
- var ejs = new EJS({
1071
+ var _EJS = new EJS({
939
1072
  resolver: httpRequest
940
- });
941
- var render = ejs.render,
942
- context = ejs.context,
943
- compile = ejs.compile,
944
- helpers = ejs.helpers,
945
- preload = ejs.preload,
946
- configure = ejs.configure,
947
- create = ejs.create;
1073
+ }),
1074
+ render = _EJS.render,
1075
+ context = _EJS.context,
1076
+ compile = _EJS.compile,
1077
+ helpers = _EJS.helpers,
1078
+ preload = _EJS.preload,
1079
+ configure = _EJS.configure,
1080
+ create = _EJS.create;
948
1081
 
949
- exports.TemplateError = TemplateError;
950
- exports.TemplateNotFound = TemplateNotFound;
951
- exports.TemplateSyntaxError = TemplateSyntaxError;
952
- exports.compile = compile;
953
- exports.configure = configure;
954
- exports.context = context;
955
- exports.create = create;
956
- exports.helpers = helpers;
957
- exports.preload = preload;
958
- exports.render = render;
1082
+ exports.TemplateError = TemplateError;
1083
+ exports.TemplateNotFound = TemplateNotFound;
1084
+ exports.TemplateSyntaxError = TemplateSyntaxError;
1085
+ exports.compile = compile;
1086
+ exports.configure = configure;
1087
+ exports.context = context;
1088
+ exports.create = create;
1089
+ exports.helpers = helpers;
1090
+ exports.preload = preload;
1091
+ exports.render = render;
959
1092
 
960
1093
  }));