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