@kosatyi/ejs 0.0.104 → 0.0.106
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/bin/bundler.js +1 -1
- package/dist/cjs/browser.js +329 -554
- package/dist/cjs/bundler.js +61 -68
- package/dist/cjs/index.js +333 -558
- package/dist/cjs/worker.js +549 -830
- package/dist/esm/browser.js +276 -276
- package/dist/esm/bundler.js +62 -69
- package/dist/esm/index.js +280 -280
- package/dist/esm/worker.js +276 -276
- package/dist/umd/browser.js +868 -1093
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +901 -1126
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +549 -830
- package/dist/umd/worker.min.js +3 -1
- package/package.json +2 -2
package/dist/cjs/worker.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
|
|
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;
|
|
3
|
+
function _OverloadYield(e, d) {
|
|
4
|
+
this.v = e, this.k = d;
|
|
10
5
|
}
|
|
11
6
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
12
7
|
try {
|
|
@@ -33,431 +28,246 @@ function _asyncToGenerator(n) {
|
|
|
33
28
|
});
|
|
34
29
|
};
|
|
35
30
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
31
|
+
function _regenerator() {
|
|
32
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
33
|
+
var e,
|
|
34
|
+
t,
|
|
35
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
36
|
+
n = r.iterator || "@@iterator",
|
|
37
|
+
o = r.toStringTag || "@@toStringTag";
|
|
38
|
+
function i(r, n, o, i) {
|
|
39
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
40
|
+
u = Object.create(c.prototype);
|
|
41
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
42
|
+
var i,
|
|
43
|
+
c,
|
|
44
|
+
u,
|
|
45
|
+
f = 0,
|
|
46
|
+
p = o || [],
|
|
47
|
+
y = !1,
|
|
48
|
+
G = {
|
|
49
|
+
p: 0,
|
|
50
|
+
n: 0,
|
|
51
|
+
v: e,
|
|
52
|
+
a: d,
|
|
53
|
+
f: d.bind(e, 4),
|
|
54
|
+
d: function (t, r) {
|
|
55
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
function d(r, n) {
|
|
59
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
60
|
+
var o,
|
|
61
|
+
i = p[t],
|
|
62
|
+
d = G.p,
|
|
63
|
+
l = i[2];
|
|
64
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
65
|
+
}
|
|
66
|
+
if (o || r > 1) return a;
|
|
67
|
+
throw y = !0, n;
|
|
68
|
+
}
|
|
69
|
+
return function (o, p, l) {
|
|
70
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
71
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
72
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
73
|
+
try {
|
|
74
|
+
if (f = 2, i) {
|
|
75
|
+
if (c || (o = "next"), t = i[o]) {
|
|
76
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
77
|
+
if (!t.done) return t;
|
|
78
|
+
u = t.value, c < 2 && (c = 0);
|
|
79
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
80
|
+
i = e;
|
|
81
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
82
|
+
} catch (t) {
|
|
83
|
+
i = e, c = 1, u = t;
|
|
84
|
+
} finally {
|
|
85
|
+
f = 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
value: t,
|
|
90
|
+
done: y
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}(r, o, i), !0), u;
|
|
68
94
|
}
|
|
69
|
-
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
writable: !0
|
|
81
|
-
}) : e[r] = t, e;
|
|
82
|
-
}
|
|
83
|
-
function _getPrototypeOf(t) {
|
|
84
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
85
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
86
|
-
}, _getPrototypeOf(t);
|
|
87
|
-
}
|
|
88
|
-
function _inherits(t, e) {
|
|
89
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
90
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
91
|
-
constructor: {
|
|
92
|
-
value: t,
|
|
93
|
-
writable: !0,
|
|
94
|
-
configurable: !0
|
|
95
|
-
}
|
|
96
|
-
}), Object.defineProperty(t, "prototype", {
|
|
97
|
-
writable: !1
|
|
98
|
-
}), e && _setPrototypeOf(t, e);
|
|
99
|
-
}
|
|
100
|
-
function _isNativeFunction(t) {
|
|
101
|
-
try {
|
|
102
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
103
|
-
} catch (n) {
|
|
104
|
-
return "function" == typeof t;
|
|
95
|
+
var a = {};
|
|
96
|
+
function Generator() {}
|
|
97
|
+
function GeneratorFunction() {}
|
|
98
|
+
function GeneratorFunctionPrototype() {}
|
|
99
|
+
t = Object.getPrototypeOf;
|
|
100
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
101
|
+
return this;
|
|
102
|
+
}), t),
|
|
103
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
104
|
+
function f(e) {
|
|
105
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
108
|
+
return this;
|
|
109
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
110
|
+
return "[object Generator]";
|
|
111
|
+
}), (_regenerator = function () {
|
|
112
|
+
return {
|
|
113
|
+
w: i,
|
|
114
|
+
m: f
|
|
115
|
+
};
|
|
113
116
|
})();
|
|
114
117
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
function _regeneratorAsync(n, e, r, t, o) {
|
|
119
|
+
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
120
|
+
return a.next().then(function (n) {
|
|
121
|
+
return n.done ? n.value : a.next();
|
|
122
|
+
});
|
|
119
123
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
e = {},
|
|
126
|
-
r = Object.prototype,
|
|
127
|
-
n = r.hasOwnProperty,
|
|
128
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
129
|
-
t[e] = r.value;
|
|
130
|
-
},
|
|
131
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
132
|
-
a = i.iterator || "@@iterator",
|
|
133
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
134
|
-
u = i.toStringTag || "@@toStringTag";
|
|
135
|
-
function define(t, e, r) {
|
|
136
|
-
return Object.defineProperty(t, e, {
|
|
137
|
-
value: r,
|
|
138
|
-
enumerable: !0,
|
|
139
|
-
configurable: !0,
|
|
140
|
-
writable: !0
|
|
141
|
-
}), t[e];
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
define({}, "");
|
|
145
|
-
} catch (t) {
|
|
146
|
-
define = function (t, e, r) {
|
|
147
|
-
return t[e] = r;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function wrap(t, e, r, n) {
|
|
151
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
152
|
-
a = Object.create(i.prototype),
|
|
153
|
-
c = new Context(n || []);
|
|
154
|
-
return o(a, "_invoke", {
|
|
155
|
-
value: makeInvokeMethod(t, r, c)
|
|
156
|
-
}), a;
|
|
157
|
-
}
|
|
158
|
-
function tryCatch(t, e, r) {
|
|
124
|
+
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
125
|
+
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
126
|
+
}
|
|
127
|
+
function _regeneratorAsyncIterator(t, e) {
|
|
128
|
+
function n(r, o, i, f) {
|
|
159
129
|
try {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
130
|
+
var c = t[r](o),
|
|
131
|
+
u = c.value;
|
|
132
|
+
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
133
|
+
n("next", t, i, f);
|
|
134
|
+
}, function (t) {
|
|
135
|
+
n("throw", t, i, f);
|
|
136
|
+
}) : e.resolve(u).then(function (t) {
|
|
137
|
+
c.value = t, i(c);
|
|
138
|
+
}, function (t) {
|
|
139
|
+
return n("throw", t, i, f);
|
|
140
|
+
});
|
|
164
141
|
} catch (t) {
|
|
165
|
-
|
|
166
|
-
type: "throw",
|
|
167
|
-
arg: t
|
|
168
|
-
};
|
|
142
|
+
f(t);
|
|
169
143
|
}
|
|
170
144
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
l = "suspendedYield",
|
|
174
|
-
f = "executing",
|
|
175
|
-
s = "completed",
|
|
176
|
-
y = {};
|
|
177
|
-
function Generator() {}
|
|
178
|
-
function GeneratorFunction() {}
|
|
179
|
-
function GeneratorFunctionPrototype() {}
|
|
180
|
-
var p = {};
|
|
181
|
-
define(p, a, function () {
|
|
145
|
+
var r;
|
|
146
|
+
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
182
147
|
return this;
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
188
|
-
function defineIteratorMethods(t) {
|
|
189
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
190
|
-
define(t, e, function (t) {
|
|
191
|
-
return this._invoke(e, t);
|
|
148
|
+
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
149
|
+
function f() {
|
|
150
|
+
return new e(function (e, r) {
|
|
151
|
+
n(t, i, e, r);
|
|
192
152
|
});
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function AsyncIterator(t, e) {
|
|
196
|
-
function invoke(r, o, i, a) {
|
|
197
|
-
var c = tryCatch(t[r], t, o);
|
|
198
|
-
if ("throw" !== c.type) {
|
|
199
|
-
var u = c.arg,
|
|
200
|
-
h = u.value;
|
|
201
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
202
|
-
invoke("next", t, i, a);
|
|
203
|
-
}, function (t) {
|
|
204
|
-
invoke("throw", t, i, a);
|
|
205
|
-
}) : e.resolve(h).then(function (t) {
|
|
206
|
-
u.value = t, i(u);
|
|
207
|
-
}, function (t) {
|
|
208
|
-
return invoke("throw", t, i, a);
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
a(c.arg);
|
|
212
153
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
});
|
|
154
|
+
return r = r ? r.then(f, f) : f();
|
|
155
|
+
}, !0);
|
|
156
|
+
}
|
|
157
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
158
|
+
var i = Object.defineProperty;
|
|
159
|
+
try {
|
|
160
|
+
i({}, "", {});
|
|
161
|
+
} catch (e) {
|
|
162
|
+
i = 0;
|
|
224
163
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
164
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
165
|
+
function o(r, n) {
|
|
166
|
+
_regeneratorDefine(e, r, function (e) {
|
|
167
|
+
return this._invoke(r, n, e);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
r ? i ? i(e, r, {
|
|
171
|
+
value: n,
|
|
172
|
+
enumerable: !t,
|
|
173
|
+
configurable: !t,
|
|
174
|
+
writable: !t
|
|
175
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
176
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
177
|
+
}
|
|
178
|
+
function _regeneratorKeys(e) {
|
|
179
|
+
var n = Object(e),
|
|
180
|
+
r = [];
|
|
181
|
+
for (var t in n) r.unshift(t);
|
|
182
|
+
return function e() {
|
|
183
|
+
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
184
|
+
return e.done = !0, e;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function _regeneratorValues(e) {
|
|
188
|
+
if (null != e) {
|
|
189
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
190
|
+
r = 0;
|
|
191
|
+
if (t) return t.call(e);
|
|
192
|
+
if ("function" == typeof e.next) return e;
|
|
193
|
+
if (!isNaN(e.length)) return {
|
|
194
|
+
next: function () {
|
|
195
|
+
return e && r >= e.length && (e = void 0), {
|
|
196
|
+
value: e && e[r++],
|
|
197
|
+
done: !e
|
|
234
198
|
};
|
|
235
199
|
}
|
|
236
|
-
for (n.method = i, n.arg = a;;) {
|
|
237
|
-
var c = n.delegate;
|
|
238
|
-
if (c) {
|
|
239
|
-
var u = maybeInvokeDelegate(c, n);
|
|
240
|
-
if (u) {
|
|
241
|
-
if (u === y) continue;
|
|
242
|
-
return u;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
246
|
-
if (o === h) throw o = s, n.arg;
|
|
247
|
-
n.dispatchException(n.arg);
|
|
248
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
249
|
-
o = f;
|
|
250
|
-
var p = tryCatch(e, r, n);
|
|
251
|
-
if ("normal" === p.type) {
|
|
252
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
253
|
-
return {
|
|
254
|
-
value: p.arg,
|
|
255
|
-
done: n.done
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
259
|
-
}
|
|
260
200
|
};
|
|
261
201
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
var e = {
|
|
273
|
-
tryLoc: t[0]
|
|
274
|
-
};
|
|
275
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
276
|
-
}
|
|
277
|
-
function resetTryEntry(t) {
|
|
278
|
-
var e = t.completion || {};
|
|
279
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
280
|
-
}
|
|
281
|
-
function Context(t) {
|
|
282
|
-
this.tryEntries = [{
|
|
283
|
-
tryLoc: "root"
|
|
284
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
285
|
-
}
|
|
286
|
-
function values(e) {
|
|
287
|
-
if (e || "" === e) {
|
|
288
|
-
var r = e[a];
|
|
289
|
-
if (r) return r.call(e);
|
|
290
|
-
if ("function" == typeof e.next) return e;
|
|
291
|
-
if (!isNaN(e.length)) {
|
|
292
|
-
var o = -1,
|
|
293
|
-
i = function next() {
|
|
294
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
295
|
-
return next.value = t, next.done = !0, next;
|
|
296
|
-
};
|
|
297
|
-
return i.next = i;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
202
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
203
|
+
}
|
|
204
|
+
function _regeneratorRuntime() {
|
|
205
|
+
|
|
206
|
+
var r = _regenerator(),
|
|
207
|
+
e = r.m(_regeneratorRuntime),
|
|
208
|
+
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
209
|
+
function n(r) {
|
|
210
|
+
var e = "function" == typeof r && r.constructor;
|
|
211
|
+
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
301
212
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
var e
|
|
310
|
-
return
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return this;
|
|
327
|
-
}), define(g, "toString", function () {
|
|
328
|
-
return "[object Generator]";
|
|
329
|
-
}), e.keys = function (t) {
|
|
330
|
-
var e = Object(t),
|
|
331
|
-
r = [];
|
|
332
|
-
for (var n in e) r.push(n);
|
|
333
|
-
return r.reverse(), function next() {
|
|
334
|
-
for (; r.length;) {
|
|
335
|
-
var t = r.pop();
|
|
336
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
337
|
-
}
|
|
338
|
-
return next.done = !0, next;
|
|
339
|
-
};
|
|
340
|
-
}, e.values = values, Context.prototype = {
|
|
341
|
-
constructor: Context,
|
|
342
|
-
reset: function (e) {
|
|
343
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
344
|
-
},
|
|
345
|
-
stop: function () {
|
|
346
|
-
this.done = !0;
|
|
347
|
-
var t = this.tryEntries[0].completion;
|
|
348
|
-
if ("throw" === t.type) throw t.arg;
|
|
349
|
-
return this.rval;
|
|
350
|
-
},
|
|
351
|
-
dispatchException: function (e) {
|
|
352
|
-
if (this.done) throw e;
|
|
353
|
-
var r = this;
|
|
354
|
-
function handle(n, o) {
|
|
355
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
356
|
-
}
|
|
357
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
358
|
-
var i = this.tryEntries[o],
|
|
359
|
-
a = i.completion;
|
|
360
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
361
|
-
if (i.tryLoc <= this.prev) {
|
|
362
|
-
var c = n.call(i, "catchLoc"),
|
|
363
|
-
u = n.call(i, "finallyLoc");
|
|
364
|
-
if (c && u) {
|
|
365
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
366
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
367
|
-
} else if (c) {
|
|
368
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
369
|
-
} else {
|
|
370
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
371
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
abrupt: function (t, e) {
|
|
377
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
378
|
-
var o = this.tryEntries[r];
|
|
379
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
380
|
-
var i = o;
|
|
381
|
-
break;
|
|
213
|
+
var o = {
|
|
214
|
+
throw: 1,
|
|
215
|
+
return: 2,
|
|
216
|
+
break: 3,
|
|
217
|
+
continue: 3
|
|
218
|
+
};
|
|
219
|
+
function a(r) {
|
|
220
|
+
var e, t;
|
|
221
|
+
return function (n) {
|
|
222
|
+
e || (e = {
|
|
223
|
+
stop: function () {
|
|
224
|
+
return t(n.a, 2);
|
|
225
|
+
},
|
|
226
|
+
catch: function () {
|
|
227
|
+
return n.v;
|
|
228
|
+
},
|
|
229
|
+
abrupt: function (r, e) {
|
|
230
|
+
return t(n.a, o[r], e);
|
|
231
|
+
},
|
|
232
|
+
delegateYield: function (r, o, a) {
|
|
233
|
+
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
234
|
+
},
|
|
235
|
+
finish: function (r) {
|
|
236
|
+
return t(n.f, r);
|
|
382
237
|
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if ("throw" === t.type) throw t.arg;
|
|
390
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
391
|
-
},
|
|
392
|
-
finish: function (t) {
|
|
393
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
394
|
-
var r = this.tryEntries[e];
|
|
395
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
catch: function (t) {
|
|
399
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
400
|
-
var r = this.tryEntries[e];
|
|
401
|
-
if (r.tryLoc === t) {
|
|
402
|
-
var n = r.completion;
|
|
403
|
-
if ("throw" === n.type) {
|
|
404
|
-
var o = n.arg;
|
|
405
|
-
resetTryEntry(r);
|
|
406
|
-
}
|
|
407
|
-
return o;
|
|
238
|
+
}, t = function (r, t, o) {
|
|
239
|
+
n.p = e.prev, n.n = e.next;
|
|
240
|
+
try {
|
|
241
|
+
return r(t, o);
|
|
242
|
+
} finally {
|
|
243
|
+
e.next = n.n;
|
|
408
244
|
}
|
|
245
|
+
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
246
|
+
try {
|
|
247
|
+
return r.call(this, e);
|
|
248
|
+
} finally {
|
|
249
|
+
n.p = e.prev, n.n = e.next;
|
|
409
250
|
}
|
|
410
|
-
|
|
411
|
-
},
|
|
412
|
-
delegateYield: function (e, r, n) {
|
|
413
|
-
return this.delegate = {
|
|
414
|
-
iterator: values(e),
|
|
415
|
-
resultName: r,
|
|
416
|
-
nextLoc: n
|
|
417
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
418
|
-
}
|
|
419
|
-
}, e;
|
|
420
|
-
}
|
|
421
|
-
function _setPrototypeOf(t, e) {
|
|
422
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
423
|
-
return t.__proto__ = e, t;
|
|
424
|
-
}, _setPrototypeOf(t, e);
|
|
425
|
-
}
|
|
426
|
-
function _toPrimitive(t, r) {
|
|
427
|
-
if ("object" != typeof t || !t) return t;
|
|
428
|
-
var e = t[Symbol.toPrimitive];
|
|
429
|
-
if (void 0 !== e) {
|
|
430
|
-
var i = e.call(t, r);
|
|
431
|
-
if ("object" != typeof i) return i;
|
|
432
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
251
|
+
};
|
|
433
252
|
}
|
|
434
|
-
return (
|
|
435
|
-
|
|
436
|
-
function
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
return Wrapper.prototype = Object.create(t.prototype, {
|
|
453
|
-
constructor: {
|
|
454
|
-
value: Wrapper,
|
|
455
|
-
enumerable: !1,
|
|
456
|
-
writable: !0,
|
|
457
|
-
configurable: !0
|
|
458
|
-
}
|
|
459
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
460
|
-
}, _wrapNativeSuper(t);
|
|
253
|
+
return (_regeneratorRuntime = function () {
|
|
254
|
+
return {
|
|
255
|
+
wrap: function (e, t, n, o) {
|
|
256
|
+
return r.w(a(e), t, n, o && o.reverse());
|
|
257
|
+
},
|
|
258
|
+
isGeneratorFunction: n,
|
|
259
|
+
mark: r.m,
|
|
260
|
+
awrap: function (r, e) {
|
|
261
|
+
return new _OverloadYield(r, e);
|
|
262
|
+
},
|
|
263
|
+
AsyncIterator: _regeneratorAsyncIterator,
|
|
264
|
+
async: function (r, e, t, o, u) {
|
|
265
|
+
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
266
|
+
},
|
|
267
|
+
keys: _regeneratorKeys,
|
|
268
|
+
values: _regeneratorValues
|
|
269
|
+
};
|
|
270
|
+
})();
|
|
461
271
|
}
|
|
462
272
|
|
|
463
273
|
var typeProp = function typeProp() {
|
|
@@ -521,12 +331,6 @@ var safeValue = function safeValue(value, escape) {
|
|
|
521
331
|
var check = value;
|
|
522
332
|
return check == null ? '' : Boolean(escape) === true ? entities(check) : check;
|
|
523
333
|
};
|
|
524
|
-
var instanceOf = function instanceOf(object, instance) {
|
|
525
|
-
return Boolean(object instanceof instance);
|
|
526
|
-
};
|
|
527
|
-
var assertInstanceOf = function assertInstanceOf(object, instance) {
|
|
528
|
-
if (instanceOf(object, instance) === false) throw new TypeError("".concat(object, " in not instance of ").concat(instance));
|
|
529
|
-
};
|
|
530
334
|
var getPath = function getPath(context, name, strict) {
|
|
531
335
|
var data = context;
|
|
532
336
|
var chunks = String(name).split('.');
|
|
@@ -547,14 +351,6 @@ var getPath = function getPath(context, name, strict) {
|
|
|
547
351
|
}
|
|
548
352
|
return [data, prop];
|
|
549
353
|
};
|
|
550
|
-
var bindContext = function bindContext(object) {
|
|
551
|
-
var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
552
|
-
methods.forEach(function (name) {
|
|
553
|
-
if (name in object) {
|
|
554
|
-
object[name] = object[name].bind(object);
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
};
|
|
558
354
|
var ext = function ext(path, defaults) {
|
|
559
355
|
var ext = path.split('.').pop();
|
|
560
356
|
if (ext !== defaults) {
|
|
@@ -669,7 +465,7 @@ defaults.token = {
|
|
|
669
465
|
};
|
|
670
466
|
|
|
671
467
|
var configSchema = function configSchema(config, options) {
|
|
672
|
-
extend(config, {
|
|
468
|
+
return extend(config, {
|
|
673
469
|
path: typeProp(isString, defaults.path, config.path, options.path),
|
|
674
470
|
"export": typeProp(isString, defaults["export"], config["export"], options["export"]),
|
|
675
471
|
resolver: typeProp(isFunction, defaults.resolver, config.resolver, options.resolver),
|
|
@@ -683,223 +479,192 @@ var configSchema = function configSchema(config, options) {
|
|
|
683
479
|
});
|
|
684
480
|
};
|
|
685
481
|
|
|
686
|
-
var
|
|
687
|
-
var
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}, {
|
|
704
|
-
key: "get",
|
|
705
|
-
value: function get(key) {
|
|
706
|
-
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
707
|
-
return _classPrivateFieldGet2(_list, this)[key];
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}, {
|
|
711
|
-
key: "set",
|
|
712
|
-
value: function set(key, value) {
|
|
713
|
-
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
714
|
-
_classPrivateFieldGet2(_list, this)[key] = value;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}, {
|
|
718
|
-
key: "exist",
|
|
719
|
-
value: function exist(key) {
|
|
720
|
-
if (_classPrivateFieldGet2(_enabled, this)) {
|
|
721
|
-
return hasProp(_classPrivateFieldGet2(_list, this), key);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}, {
|
|
725
|
-
key: "clear",
|
|
726
|
-
value: function clear() {
|
|
727
|
-
_classPrivateFieldSet2(_list, this, {});
|
|
728
|
-
}
|
|
729
|
-
}, {
|
|
730
|
-
key: "remove",
|
|
731
|
-
value: function remove(key) {
|
|
732
|
-
delete _classPrivateFieldGet2(_list, this)[key];
|
|
482
|
+
var Template = function Template(options, cache, compiler) {
|
|
483
|
+
var config = {
|
|
484
|
+
path: null,
|
|
485
|
+
resolver: null
|
|
486
|
+
};
|
|
487
|
+
var resolve = function resolve(path) {
|
|
488
|
+
return config.resolver(config.path, path);
|
|
489
|
+
};
|
|
490
|
+
var result = function result(template, content) {
|
|
491
|
+
cache.set(template, content);
|
|
492
|
+
return content;
|
|
493
|
+
};
|
|
494
|
+
var compile = function compile(content, template) {
|
|
495
|
+
if (isFunction(content)) {
|
|
496
|
+
return content;
|
|
497
|
+
} else {
|
|
498
|
+
return compiler.compile(content, template);
|
|
733
499
|
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
return
|
|
500
|
+
};
|
|
501
|
+
var get = function get(template) {
|
|
502
|
+
if (cache.exist(template)) {
|
|
503
|
+
return cache.resolve(template);
|
|
738
504
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
505
|
+
return resolve(template).then(function (content) {
|
|
506
|
+
return result(template, compile(content, template));
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
var configure = function configure(options) {
|
|
510
|
+
config.path = options.path;
|
|
511
|
+
if (isFunction(options.resolver)) {
|
|
512
|
+
config.resolver = options.resolver;
|
|
746
513
|
}
|
|
747
|
-
}
|
|
748
|
-
|
|
514
|
+
};
|
|
515
|
+
configure(options);
|
|
516
|
+
return {
|
|
517
|
+
get: get,
|
|
518
|
+
configure: configure,
|
|
519
|
+
compile: compile
|
|
520
|
+
};
|
|
521
|
+
};
|
|
749
522
|
|
|
750
|
-
var
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
_classCallCheck(this, Compiler);
|
|
755
|
-
_classPrivateFieldInitSpec(this, _config$1, {});
|
|
756
|
-
_classPrivateFieldInitSpec(this, _symbols, [{
|
|
757
|
-
symbol: '-',
|
|
758
|
-
format: function format(value) {
|
|
759
|
-
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, ",1))\n").concat(this.BUFFER, "('");
|
|
760
|
-
}
|
|
761
|
-
}, {
|
|
762
|
-
symbol: '=',
|
|
763
|
-
format: function format(value) {
|
|
764
|
-
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, "))\n").concat(this.BUFFER, "('");
|
|
765
|
-
}
|
|
766
|
-
}, {
|
|
767
|
-
symbol: '#',
|
|
768
|
-
format: function format(value) {
|
|
769
|
-
return "')\n/**".concat(value, "**/\n").concat(this.BUFFER, "('");
|
|
770
|
-
}
|
|
771
|
-
}, {
|
|
772
|
-
symbol: '',
|
|
773
|
-
format: function format(value) {
|
|
774
|
-
return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
|
|
775
|
-
}
|
|
776
|
-
}]);
|
|
777
|
-
this.configure(config);
|
|
523
|
+
var configSymbols = [{
|
|
524
|
+
symbol: '-',
|
|
525
|
+
format: function format(value) {
|
|
526
|
+
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, ",1))\n").concat(this.BUFFER, "('");
|
|
778
527
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
528
|
+
}, {
|
|
529
|
+
symbol: '=',
|
|
530
|
+
format: function format(value) {
|
|
531
|
+
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, "))\n").concat(this.BUFFER, "('");
|
|
532
|
+
}
|
|
533
|
+
}, {
|
|
534
|
+
symbol: '#',
|
|
535
|
+
format: function format(value) {
|
|
536
|
+
return "')\n/**".concat(value, "**/\n").concat(this.BUFFER, "('");
|
|
537
|
+
}
|
|
538
|
+
}, {
|
|
539
|
+
symbol: '',
|
|
540
|
+
format: function format(value) {
|
|
541
|
+
return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
|
|
542
|
+
}
|
|
543
|
+
}];
|
|
544
|
+
var Compiler = function Compiler(options) {
|
|
545
|
+
var config = {};
|
|
546
|
+
var configure = function configure(options) {
|
|
547
|
+
config.withObject = options.withObject;
|
|
548
|
+
config.rmWhitespace = options.rmWhitespace;
|
|
549
|
+
config.token = options.token;
|
|
550
|
+
config.vars = options.vars;
|
|
551
|
+
config.globalHelpers = options.globalHelpers;
|
|
552
|
+
config.matches = [];
|
|
553
|
+
config.formats = [];
|
|
554
|
+
config.slurp = {
|
|
555
|
+
match: '[s\t\n]*',
|
|
556
|
+
start: [config.token.start, '_'],
|
|
557
|
+
end: ['_', config.token.end]
|
|
558
|
+
};
|
|
559
|
+
configSymbols.forEach(function (item) {
|
|
560
|
+
config.matches.push(config.token.start.concat(item.symbol).concat(config.token.regex).concat(config.token.end));
|
|
561
|
+
config.formats.push(item.format.bind(config.vars));
|
|
562
|
+
});
|
|
563
|
+
config.regex = new RegExp(config.matches.join('|').concat('|$'), 'g');
|
|
564
|
+
config.slurpStart = new RegExp([config.slurp.match, config.slurp.start.join('')].join(''), 'gm');
|
|
565
|
+
config.slurpEnd = new RegExp([config.slurp.end.join(''), config.slurp.match].join(''), 'gm');
|
|
566
|
+
};
|
|
567
|
+
var compile = function compile(content, path) {
|
|
568
|
+
var _config$vars = config.vars,
|
|
569
|
+
SCOPE = _config$vars.SCOPE,
|
|
570
|
+
SAFE = _config$vars.SAFE,
|
|
571
|
+
BUFFER = _config$vars.BUFFER,
|
|
572
|
+
COMPONENT = _config$vars.COMPONENT,
|
|
573
|
+
ELEMENT = _config$vars.ELEMENT;
|
|
574
|
+
var GLOBALS = config.globalHelpers;
|
|
575
|
+
if (config.rmWhitespace) {
|
|
576
|
+
content = String(content).replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
|
|
802
577
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
COMPONENT = _classPrivateFieldGet2$1.COMPONENT,
|
|
812
|
-
ELEMENT = _classPrivateFieldGet2$1.ELEMENT;
|
|
813
|
-
var GLOBALS = _classPrivateFieldGet2(_config$1, this).globalHelpers;
|
|
814
|
-
if (_classPrivateFieldGet2(_config$1, this).rmWhitespace) {
|
|
815
|
-
content = String(content).replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
|
|
816
|
-
}
|
|
817
|
-
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);
|
|
818
|
-
var source = "".concat(BUFFER, "('");
|
|
819
|
-
matchTokens(_classPrivateFieldGet2(_config$1, this).regex, content, function (params, index, offset) {
|
|
820
|
-
source += symbols(content.slice(index, offset));
|
|
821
|
-
params.forEach(function (value, index) {
|
|
822
|
-
if (value) {
|
|
823
|
-
source += _classPrivateFieldGet2(_config$1, _this2).formats[index](value);
|
|
824
|
-
}
|
|
825
|
-
});
|
|
578
|
+
content = String(content).replace(config.slurpStart, config.token.start).replace(config.slurpEnd, config.token.end);
|
|
579
|
+
var source = "".concat(BUFFER, "('");
|
|
580
|
+
matchTokens(config.regex, content, function (params, index, offset) {
|
|
581
|
+
source += symbols(content.slice(index, offset));
|
|
582
|
+
params.forEach(function (value, index) {
|
|
583
|
+
if (value) {
|
|
584
|
+
source += config.formats[index](value);
|
|
585
|
+
}
|
|
826
586
|
});
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
}
|
|
832
|
-
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
833
|
-
source += "\n//# sourceURL=".concat(path);
|
|
834
|
-
var result = null;
|
|
835
|
-
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
836
|
-
try {
|
|
837
|
-
result = Function.apply(null, params.concat(source));
|
|
838
|
-
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
839
|
-
} catch (e) {
|
|
840
|
-
e.filename = path;
|
|
841
|
-
e.source = source;
|
|
842
|
-
throw e;
|
|
843
|
-
}
|
|
844
|
-
return result;
|
|
587
|
+
});
|
|
588
|
+
source += "');";
|
|
589
|
+
source = "try{".concat(source, "}catch(e){return ").concat(BUFFER, ".error(e)}");
|
|
590
|
+
if (config.withObject) {
|
|
591
|
+
source = "with(".concat(SCOPE, "){").concat(source, "}");
|
|
845
592
|
}
|
|
846
|
-
|
|
847
|
-
|
|
593
|
+
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
594
|
+
source += "\n//# sourceURL=".concat(path);
|
|
595
|
+
var result = null;
|
|
596
|
+
var params = [SCOPE, COMPONENT, ELEMENT, BUFFER, SAFE].concat(GLOBALS);
|
|
597
|
+
try {
|
|
598
|
+
result = Function.apply(null, params.concat(source));
|
|
599
|
+
result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
|
|
600
|
+
} catch (e) {
|
|
601
|
+
e.filename = path;
|
|
602
|
+
e.source = source;
|
|
603
|
+
throw e;
|
|
604
|
+
}
|
|
605
|
+
return result;
|
|
606
|
+
};
|
|
607
|
+
configure(options);
|
|
608
|
+
return {
|
|
609
|
+
configure: configure,
|
|
610
|
+
compile: compile
|
|
611
|
+
};
|
|
612
|
+
};
|
|
848
613
|
|
|
849
|
-
var
|
|
850
|
-
var
|
|
851
|
-
var
|
|
852
|
-
var
|
|
853
|
-
var
|
|
854
|
-
var
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
_classPrivateMethodInitSpec(this, _Template_brand);
|
|
858
|
-
_classPrivateFieldInitSpec(this, _path, void 0);
|
|
859
|
-
_classPrivateFieldInitSpec(this, _cache$1, void 0);
|
|
860
|
-
_classPrivateFieldInitSpec(this, _compiler$1, void 0);
|
|
861
|
-
_classPrivateFieldInitSpec(this, _resolver, void 0);
|
|
862
|
-
assertInstanceOf(cache, Cache);
|
|
863
|
-
assertInstanceOf(compiler, Compiler);
|
|
864
|
-
_classPrivateFieldSet2(_cache$1, this, cache);
|
|
865
|
-
_classPrivateFieldSet2(_compiler$1, this, compiler);
|
|
866
|
-
this.configure(config);
|
|
867
|
-
}
|
|
868
|
-
return _createClass(Template, [{
|
|
869
|
-
key: "configure",
|
|
870
|
-
value: function configure(config) {
|
|
871
|
-
_classPrivateFieldSet2(_path, this, config.path);
|
|
872
|
-
if (isFunction(config.resolver)) {
|
|
873
|
-
_classPrivateFieldSet2(_resolver, this, config.resolver);
|
|
874
|
-
}
|
|
614
|
+
var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
|
|
615
|
+
var Cache = function Cache() {
|
|
616
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
617
|
+
var config = {};
|
|
618
|
+
var list = {};
|
|
619
|
+
var load = function load(data) {
|
|
620
|
+
if (config.enabled) {
|
|
621
|
+
extend(list, data || {});
|
|
875
622
|
}
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
if (_classPrivateFieldGet2(_cache$1, this).exist(template)) {
|
|
881
|
-
return _classPrivateFieldGet2(_cache$1, this).resolve(template);
|
|
882
|
-
}
|
|
883
|
-
return _assertClassBrand(_Template_brand, this, _resolve).call(this, template).then(function (content) {
|
|
884
|
-
return _assertClassBrand(_Template_brand, _this, _result).call(_this, template, _assertClassBrand(_Template_brand, _this, _compile).call(_this, content, template));
|
|
885
|
-
});
|
|
623
|
+
};
|
|
624
|
+
var get = function get(key) {
|
|
625
|
+
if (config.enabled) {
|
|
626
|
+
return list[key];
|
|
886
627
|
}
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
628
|
+
};
|
|
629
|
+
var set = function set(key, value) {
|
|
630
|
+
if (config.enabled) {
|
|
631
|
+
list[key] = value;
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
var exist = function exist(key) {
|
|
635
|
+
if (config.enabled) {
|
|
636
|
+
return hasProp(list, key);
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
var clear = function clear() {
|
|
640
|
+
Object.keys(list).forEach(remove);
|
|
641
|
+
};
|
|
642
|
+
var remove = function remove(key) {
|
|
643
|
+
delete list[key];
|
|
644
|
+
};
|
|
645
|
+
var resolve = function resolve(key) {
|
|
646
|
+
return Promise.resolve(get(key));
|
|
647
|
+
};
|
|
648
|
+
var configure = function configure() {
|
|
649
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
650
|
+
config.enabled = options.cache;
|
|
651
|
+
config["export"] = options["export"];
|
|
652
|
+
if (isNode() === false) {
|
|
653
|
+
load(global[config["export"]]);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
configure(options);
|
|
657
|
+
return {
|
|
658
|
+
configure: configure,
|
|
659
|
+
load: load,
|
|
660
|
+
set: set,
|
|
661
|
+
get: get,
|
|
662
|
+
exist: exist,
|
|
663
|
+
clear: clear,
|
|
664
|
+
remove: remove,
|
|
665
|
+
resolve: resolve
|
|
666
|
+
};
|
|
667
|
+
};
|
|
903
668
|
|
|
904
669
|
var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
905
670
|
var space = ' ';
|
|
@@ -926,61 +691,50 @@ var element = function element(tag, attrs, content) {
|
|
|
926
691
|
return result.join('');
|
|
927
692
|
};
|
|
928
693
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
},
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
return this.message;
|
|
948
|
-
}
|
|
949
|
-
}, {
|
|
950
|
-
key: "toString",
|
|
951
|
-
value: function toString() {
|
|
952
|
-
return this.getMessage();
|
|
953
|
-
}
|
|
954
|
-
}]);
|
|
955
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
956
|
-
var TemplateNotFound = /*#__PURE__*/function (_TemplateError2) {
|
|
957
|
-
function TemplateNotFound() {
|
|
958
|
-
var _this2;
|
|
959
|
-
_classCallCheck(this, TemplateNotFound);
|
|
960
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
961
|
-
args[_key] = arguments[_key];
|
|
962
|
-
}
|
|
963
|
-
_this2 = _callSuper(this, TemplateNotFound, [].concat(args));
|
|
964
|
-
_defineProperty(_this2, "code", 404);
|
|
965
|
-
return _this2;
|
|
966
|
-
}
|
|
967
|
-
_inherits(TemplateNotFound, _TemplateError2);
|
|
968
|
-
return _createClass(TemplateNotFound);
|
|
969
|
-
}(TemplateError);
|
|
970
|
-
var TemplateSyntaxError = /*#__PURE__*/function (_TemplateError3) {
|
|
971
|
-
function TemplateSyntaxError() {
|
|
972
|
-
var _this3;
|
|
973
|
-
_classCallCheck(this, TemplateSyntaxError);
|
|
974
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
975
|
-
args[_key2] = arguments[_key2];
|
|
976
|
-
}
|
|
977
|
-
_this3 = _callSuper(this, TemplateSyntaxError, [].concat(args));
|
|
978
|
-
_defineProperty(_this3, "code", 500);
|
|
979
|
-
return _this3;
|
|
694
|
+
/**
|
|
695
|
+
*
|
|
696
|
+
* @constructor
|
|
697
|
+
*/
|
|
698
|
+
function TemplateError() {
|
|
699
|
+
TemplateError.call(this);
|
|
700
|
+
}
|
|
701
|
+
Object.setPrototypeOf(TemplateError.prototype, Error.prototype);
|
|
702
|
+
Object.assign(TemplateError.prototype, {
|
|
703
|
+
code: 0,
|
|
704
|
+
getCode: function getCode() {
|
|
705
|
+
return this.code;
|
|
706
|
+
},
|
|
707
|
+
getMessage: function getMessage() {
|
|
708
|
+
return this.message;
|
|
709
|
+
},
|
|
710
|
+
toString: function toString() {
|
|
711
|
+
return this.getMessage();
|
|
980
712
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
*
|
|
717
|
+
* @constructor
|
|
718
|
+
*/
|
|
719
|
+
function TemplateNotFound() {
|
|
720
|
+
TemplateError.call(this);
|
|
721
|
+
}
|
|
722
|
+
Object.setPrototypeOf(TemplateNotFound.prototype, TemplateError.prototype);
|
|
723
|
+
Object.assign(TemplateNotFound.prototype, {
|
|
724
|
+
code: 404
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
*
|
|
729
|
+
* @constructor
|
|
730
|
+
*/
|
|
731
|
+
function TemplateSyntaxError() {
|
|
732
|
+
TemplateError.call(this);
|
|
733
|
+
}
|
|
734
|
+
Object.setPrototypeOf(TemplateSyntaxError.prototype, TemplateError.prototype);
|
|
735
|
+
Object.assign(TemplateSyntaxError.prototype, {
|
|
736
|
+
code: 500
|
|
737
|
+
});
|
|
984
738
|
|
|
985
739
|
function resolve(list) {
|
|
986
740
|
return Promise.all(list || []).then(function (list) {
|
|
@@ -1036,6 +790,7 @@ var createContextScope = function createContextScope(config, methods) {
|
|
|
1036
790
|
SCOPE = _config$vars.SCOPE,
|
|
1037
791
|
COMPONENT = _config$vars.COMPONENT,
|
|
1038
792
|
ELEMENT = _config$vars.ELEMENT;
|
|
793
|
+
|
|
1039
794
|
/**
|
|
1040
795
|
*
|
|
1041
796
|
* @type {symbol}
|
|
@@ -1332,149 +1087,113 @@ var createContextScope = function createContextScope(config, methods) {
|
|
|
1332
1087
|
});
|
|
1333
1088
|
return ContextScope;
|
|
1334
1089
|
};
|
|
1335
|
-
var
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
}
|
|
1357
|
-
}]);
|
|
1358
|
-
}();
|
|
1090
|
+
var Context = function Context(options, methods) {
|
|
1091
|
+
/**
|
|
1092
|
+
* @type {InstanceType<ContextScope>}
|
|
1093
|
+
*/
|
|
1094
|
+
var Scope;
|
|
1095
|
+
var create = function create(data) {
|
|
1096
|
+
return new Scope(data);
|
|
1097
|
+
};
|
|
1098
|
+
var helpers = function helpers(methods) {
|
|
1099
|
+
extend(Scope.prototype, methods || {});
|
|
1100
|
+
};
|
|
1101
|
+
var configure = function configure(options, methods) {
|
|
1102
|
+
Scope = createContextScope(options, methods);
|
|
1103
|
+
};
|
|
1104
|
+
configure(options, methods);
|
|
1105
|
+
return {
|
|
1106
|
+
configure: configure,
|
|
1107
|
+
create: create,
|
|
1108
|
+
helpers: helpers
|
|
1109
|
+
};
|
|
1110
|
+
};
|
|
1359
1111
|
|
|
1360
|
-
var
|
|
1361
|
-
var
|
|
1362
|
-
var
|
|
1363
|
-
var
|
|
1364
|
-
var
|
|
1365
|
-
var
|
|
1366
|
-
var
|
|
1367
|
-
var
|
|
1368
|
-
function
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
//
|
|
1385
|
-
this.helpers({
|
|
1386
|
-
require: this.require,
|
|
1387
|
-
render: this.render
|
|
1112
|
+
var _EJS$1 = function EJS() {
|
|
1113
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1114
|
+
var config = configSchema({}, options);
|
|
1115
|
+
var methods = {};
|
|
1116
|
+
var context = Context(config, methods);
|
|
1117
|
+
var compiler = Compiler(config);
|
|
1118
|
+
var cache = Cache(config);
|
|
1119
|
+
var template = Template(config, cache, compiler);
|
|
1120
|
+
var configure = function configure() {
|
|
1121
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1122
|
+
configSchema(config, options || {});
|
|
1123
|
+
context.configure(config, methods);
|
|
1124
|
+
compiler.configure(config);
|
|
1125
|
+
cache.configure(config);
|
|
1126
|
+
template.configure(config);
|
|
1127
|
+
return config;
|
|
1128
|
+
};
|
|
1129
|
+
var filePath = function filePath(name) {
|
|
1130
|
+
return ext(name, config.extension);
|
|
1131
|
+
};
|
|
1132
|
+
var require = function require(name) {
|
|
1133
|
+
var scope = createContext({});
|
|
1134
|
+
return output(filePath(name), scope).then(function () {
|
|
1135
|
+
return scope.getMacro();
|
|
1388
1136
|
});
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
}
|
|
1438
|
-
}, {
|
|
1439
|
-
key: "helpers",
|
|
1440
|
-
value: function helpers(methods) {
|
|
1441
|
-
_classPrivateFieldGet2(_context, this).helpers(extend(_classPrivateFieldGet2(_extend, this), methods));
|
|
1442
|
-
}
|
|
1443
|
-
}, {
|
|
1444
|
-
key: "context",
|
|
1445
|
-
value: function context(data) {
|
|
1446
|
-
return _classPrivateFieldGet2(_context, this).create(data);
|
|
1447
|
-
}
|
|
1448
|
-
}, {
|
|
1449
|
-
key: "compile",
|
|
1450
|
-
value: function compile(content, path) {
|
|
1451
|
-
return _classPrivateFieldGet2(_compiler, this).compile(content, path);
|
|
1452
|
-
}
|
|
1453
|
-
}, {
|
|
1454
|
-
key: "preload",
|
|
1455
|
-
value: function preload(list) {
|
|
1456
|
-
return _classPrivateFieldGet2(_cache, this).load(list || {});
|
|
1457
|
-
}
|
|
1458
|
-
}, {
|
|
1459
|
-
key: "create",
|
|
1460
|
-
value: function create(options) {
|
|
1461
|
-
return new this.constructor(options);
|
|
1462
|
-
}
|
|
1463
|
-
}]);
|
|
1464
|
-
}();
|
|
1465
|
-
function _output(path, scope) {
|
|
1466
|
-
var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
|
|
1467
|
-
globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
|
|
1468
|
-
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1469
|
-
var globals = globalHelpers.filter(function (name) {
|
|
1470
|
-
return isFunction(scope[name]);
|
|
1471
|
-
}).map(function (name) {
|
|
1472
|
-
return scope[name].bind(scope);
|
|
1473
|
-
});
|
|
1474
|
-
return _classPrivateFieldGet2(_template, this).get(path).then(function (callback) {
|
|
1475
|
-
return callback.apply(scope, params.concat(globals));
|
|
1137
|
+
};
|
|
1138
|
+
var render = function render(name, data) {
|
|
1139
|
+
var scope = createContext(data);
|
|
1140
|
+
return output(filePath(name), scope).then(outputContent(name, scope));
|
|
1141
|
+
};
|
|
1142
|
+
var outputContent = function outputContent(name, scope) {
|
|
1143
|
+
return function (content) {
|
|
1144
|
+
if (scope.getExtend()) {
|
|
1145
|
+
scope.setExtend(false);
|
|
1146
|
+
return renderLayout(scope.getLayout(), scope, name);
|
|
1147
|
+
}
|
|
1148
|
+
return content;
|
|
1149
|
+
};
|
|
1150
|
+
};
|
|
1151
|
+
var renderLayout = function renderLayout(name, data, parent) {
|
|
1152
|
+
var scope = createContext(data);
|
|
1153
|
+
if (parent) scope.setParentTemplate(parent);
|
|
1154
|
+
return output(filePath(name), scope).then(outputContent(name, scope));
|
|
1155
|
+
};
|
|
1156
|
+
var helpers = function helpers(extendMethods) {
|
|
1157
|
+
context.helpers(extend(methods, extendMethods));
|
|
1158
|
+
};
|
|
1159
|
+
var createContext = function createContext(data) {
|
|
1160
|
+
return context.create(data);
|
|
1161
|
+
};
|
|
1162
|
+
var compile = function compile(content, path) {
|
|
1163
|
+
return compiler.compile(content, path);
|
|
1164
|
+
};
|
|
1165
|
+
var preload = function preload(list) {
|
|
1166
|
+
return cache.load(list || {});
|
|
1167
|
+
};
|
|
1168
|
+
var create = function create(config) {
|
|
1169
|
+
return _EJS$1(config);
|
|
1170
|
+
};
|
|
1171
|
+
var output = function output(path, scope) {
|
|
1172
|
+
var params = [scope, scope.useComponent, scope.useElement, scope.getBuffer(), scope.useSafeValue];
|
|
1173
|
+
var globals = config.globalHelpers.filter(function (name) {
|
|
1174
|
+
return isFunction(scope[name]);
|
|
1175
|
+
}).map(function (name) {
|
|
1176
|
+
return scope[name].bind(scope);
|
|
1177
|
+
});
|
|
1178
|
+
return template.get(path).then(function (callback) {
|
|
1179
|
+
return callback.apply(scope, params.concat(globals));
|
|
1180
|
+
});
|
|
1181
|
+
};
|
|
1182
|
+
helpers({
|
|
1183
|
+
render: render,
|
|
1184
|
+
require: require
|
|
1476
1185
|
});
|
|
1477
|
-
|
|
1186
|
+
return {
|
|
1187
|
+
configure: configure,
|
|
1188
|
+
create: create,
|
|
1189
|
+
createContext: createContext,
|
|
1190
|
+
render: render,
|
|
1191
|
+
require: require,
|
|
1192
|
+
preload: preload,
|
|
1193
|
+
compile: compile,
|
|
1194
|
+
helpers: helpers
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1478
1197
|
|
|
1479
1198
|
var templateCache = {};
|
|
1480
1199
|
var getOrigin = function getOrigin(url, secure) {
|
|
@@ -1482,7 +1201,7 @@ var getOrigin = function getOrigin(url, secure) {
|
|
|
1482
1201
|
url.protocol = secure ? 'https:' : 'http:';
|
|
1483
1202
|
return url.origin;
|
|
1484
1203
|
};
|
|
1485
|
-
var _EJS =
|
|
1204
|
+
var _EJS = _EJS$1({
|
|
1486
1205
|
cache: false,
|
|
1487
1206
|
withObject: false,
|
|
1488
1207
|
resolver: function resolver(path, name) {
|
|
@@ -1490,13 +1209,13 @@ var _EJS = new EJS({
|
|
|
1490
1209
|
if (isFunction(templateCache[name])) {
|
|
1491
1210
|
resolve(templateCache[name]);
|
|
1492
1211
|
} else {
|
|
1493
|
-
reject(new TemplateNotFound(
|
|
1212
|
+
reject(new TemplateNotFound());
|
|
1494
1213
|
}
|
|
1495
1214
|
});
|
|
1496
1215
|
}
|
|
1497
1216
|
}),
|
|
1498
1217
|
render = _EJS.render,
|
|
1499
|
-
|
|
1218
|
+
createContext = _EJS.createContext,
|
|
1500
1219
|
helpers = _EJS.helpers,
|
|
1501
1220
|
configure = _EJS.configure;
|
|
1502
1221
|
function useTemplates() {
|
|
@@ -1537,7 +1256,7 @@ function useRenderer() {
|
|
|
1537
1256
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1538
1257
|
while (1) switch (_context.prev = _context.next) {
|
|
1539
1258
|
case 0:
|
|
1540
|
-
c.data =
|
|
1259
|
+
c.data = createContext({});
|
|
1541
1260
|
c.data.set('version', version);
|
|
1542
1261
|
c.data.set('origin', getOrigin(c.req.url, secure));
|
|
1543
1262
|
c.data.set('path', c.req.path);
|
|
@@ -1576,7 +1295,7 @@ exports.TemplateError = TemplateError;
|
|
|
1576
1295
|
exports.TemplateNotFound = TemplateNotFound;
|
|
1577
1296
|
exports.TemplateSyntaxError = TemplateSyntaxError;
|
|
1578
1297
|
exports.configure = configure;
|
|
1579
|
-
exports.
|
|
1298
|
+
exports.createContext = createContext;
|
|
1580
1299
|
exports.helpers = helpers;
|
|
1581
1300
|
exports.render = render;
|
|
1582
1301
|
exports.setRenderer = setRenderer;
|