@kosatyi/ejs 0.0.79 → 0.0.81
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 +54 -60
- package/dist/cjs/index.js +54 -60
- package/dist/cjs/worker.js +84 -95
- package/dist/umd/browser.js +54 -60
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +54 -60
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +84 -95
- package/dist/umd/worker.min.js +1 -1
- package/package.json +11 -3
package/dist/cjs/worker.js
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
4
|
+
try {
|
|
5
|
+
var i = n[a](c),
|
|
6
|
+
u = i.value;
|
|
7
|
+
} catch (n) {
|
|
8
|
+
return void e(n);
|
|
9
|
+
}
|
|
10
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
11
|
+
}
|
|
12
|
+
function _asyncToGenerator(n) {
|
|
13
|
+
return function () {
|
|
14
|
+
var t = this,
|
|
15
|
+
e = arguments;
|
|
16
|
+
return new Promise(function (r, o) {
|
|
17
|
+
var a = n.apply(t, e);
|
|
18
|
+
function _next(n) {
|
|
19
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
20
|
+
}
|
|
21
|
+
function _throw(n) {
|
|
22
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
23
|
+
}
|
|
24
|
+
_next(void 0);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function _defineProperty(e, r, t) {
|
|
29
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
30
|
+
value: t,
|
|
31
|
+
enumerable: !0,
|
|
32
|
+
configurable: !0,
|
|
33
|
+
writable: !0
|
|
34
|
+
}) : e[r] = t, e;
|
|
35
|
+
}
|
|
3
36
|
function _regeneratorRuntime() {
|
|
4
37
|
_regeneratorRuntime = function () {
|
|
5
38
|
return e;
|
|
@@ -108,7 +141,7 @@ function _regeneratorRuntime() {
|
|
|
108
141
|
function makeInvokeMethod(e, r, n) {
|
|
109
142
|
var o = h;
|
|
110
143
|
return function (i, a) {
|
|
111
|
-
if (o === f) throw
|
|
144
|
+
if (o === f) throw Error("Generator is already running");
|
|
112
145
|
if (o === s) {
|
|
113
146
|
if ("throw" === i) throw a;
|
|
114
147
|
return {
|
|
@@ -250,7 +283,7 @@ function _regeneratorRuntime() {
|
|
|
250
283
|
} else if (c) {
|
|
251
284
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
252
285
|
} else {
|
|
253
|
-
if (!u) throw
|
|
286
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
254
287
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
255
288
|
}
|
|
256
289
|
}
|
|
@@ -290,7 +323,7 @@ function _regeneratorRuntime() {
|
|
|
290
323
|
return o;
|
|
291
324
|
}
|
|
292
325
|
}
|
|
293
|
-
throw
|
|
326
|
+
throw Error("illegal catch attempt");
|
|
294
327
|
},
|
|
295
328
|
delegateYield: function (e, r, n) {
|
|
296
329
|
return this.delegate = {
|
|
@@ -301,63 +334,19 @@ function _regeneratorRuntime() {
|
|
|
301
334
|
}
|
|
302
335
|
}, e;
|
|
303
336
|
}
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (info.done) {
|
|
313
|
-
resolve(value);
|
|
314
|
-
} else {
|
|
315
|
-
Promise.resolve(value).then(_next, _throw);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function _asyncToGenerator(fn) {
|
|
319
|
-
return function () {
|
|
320
|
-
var self = this,
|
|
321
|
-
args = arguments;
|
|
322
|
-
return new Promise(function (resolve, reject) {
|
|
323
|
-
var gen = fn.apply(self, args);
|
|
324
|
-
function _next(value) {
|
|
325
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
326
|
-
}
|
|
327
|
-
function _throw(err) {
|
|
328
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
329
|
-
}
|
|
330
|
-
_next(undefined);
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
function _defineProperty(obj, key, value) {
|
|
335
|
-
key = _toPropertyKey(key);
|
|
336
|
-
if (key in obj) {
|
|
337
|
-
Object.defineProperty(obj, key, {
|
|
338
|
-
value: value,
|
|
339
|
-
enumerable: true,
|
|
340
|
-
configurable: true,
|
|
341
|
-
writable: true
|
|
342
|
-
});
|
|
343
|
-
} else {
|
|
344
|
-
obj[key] = value;
|
|
345
|
-
}
|
|
346
|
-
return obj;
|
|
347
|
-
}
|
|
348
|
-
function _toPrimitive(input, hint) {
|
|
349
|
-
if (typeof input !== "object" || input === null) return input;
|
|
350
|
-
var prim = input[Symbol.toPrimitive];
|
|
351
|
-
if (prim !== undefined) {
|
|
352
|
-
var res = prim.call(input, hint || "default");
|
|
353
|
-
if (typeof res !== "object") return res;
|
|
337
|
+
function _toPrimitive(t, r) {
|
|
338
|
+
if ("object" != typeof t || !t) return t;
|
|
339
|
+
var e = t[Symbol.toPrimitive];
|
|
340
|
+
if (void 0 !== e) {
|
|
341
|
+
var i = e.call(t, r || "default");
|
|
342
|
+
if ("object" != typeof i) return i;
|
|
354
343
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
355
344
|
}
|
|
356
|
-
return (
|
|
345
|
+
return ("string" === r ? String : Number)(t);
|
|
357
346
|
}
|
|
358
|
-
function _toPropertyKey(
|
|
359
|
-
var
|
|
360
|
-
return
|
|
347
|
+
function _toPropertyKey(t) {
|
|
348
|
+
var i = _toPrimitive(t, "string");
|
|
349
|
+
return "symbol" == typeof i ? i : i + "";
|
|
361
350
|
}
|
|
362
351
|
|
|
363
352
|
var typeProp = function typeProp() {
|
|
@@ -846,46 +835,46 @@ function Context(config) {
|
|
|
846
835
|
extend(this, data || {});
|
|
847
836
|
}
|
|
848
837
|
Scope.prototype = extend({}, methods || {});
|
|
849
|
-
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, BUFFER, {
|
|
838
|
+
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
|
|
850
839
|
value: createBuffer(),
|
|
851
840
|
writable: true,
|
|
852
841
|
configurable: false,
|
|
853
842
|
enumerable: false
|
|
854
|
-
}),
|
|
843
|
+
}), BLOCKS, {
|
|
855
844
|
value: {},
|
|
856
845
|
writable: true,
|
|
857
846
|
configurable: false,
|
|
858
847
|
enumerable: false
|
|
859
|
-
}),
|
|
848
|
+
}), MACRO, {
|
|
860
849
|
value: {},
|
|
861
850
|
writable: true,
|
|
862
851
|
configurable: false,
|
|
863
852
|
enumerable: false
|
|
864
|
-
}),
|
|
853
|
+
}), LAYOUT, {
|
|
865
854
|
value: false,
|
|
866
855
|
writable: true,
|
|
867
856
|
configurable: false,
|
|
868
857
|
enumerable: false
|
|
869
|
-
}),
|
|
858
|
+
}), EXTEND, {
|
|
870
859
|
value: false,
|
|
871
860
|
writable: true,
|
|
872
861
|
configurable: false,
|
|
873
862
|
enumerable: false
|
|
874
|
-
}),
|
|
863
|
+
}), "getMacro", {
|
|
875
864
|
value: function value() {
|
|
876
865
|
return this[MACRO];
|
|
877
866
|
},
|
|
878
867
|
writable: false,
|
|
879
868
|
configurable: false,
|
|
880
869
|
enumerable: false
|
|
881
|
-
}),
|
|
870
|
+
}), "getBuffer", {
|
|
882
871
|
value: function value() {
|
|
883
872
|
return this[BUFFER];
|
|
884
873
|
},
|
|
885
874
|
writable: false,
|
|
886
875
|
configurable: false,
|
|
887
876
|
enumerable: false
|
|
888
|
-
}),
|
|
877
|
+
}), "getComponent", {
|
|
889
878
|
value: function value() {
|
|
890
879
|
var context = this;
|
|
891
880
|
if (COMPONENT in context) {
|
|
@@ -900,42 +889,42 @@ function Context(config) {
|
|
|
900
889
|
writable: false,
|
|
901
890
|
configurable: false,
|
|
902
891
|
enumerable: false
|
|
903
|
-
}),
|
|
892
|
+
}), "getBlocks", {
|
|
904
893
|
value: function value() {
|
|
905
894
|
return this[BLOCKS];
|
|
906
895
|
},
|
|
907
896
|
writable: false,
|
|
908
897
|
configurable: false,
|
|
909
898
|
enumerable: false
|
|
910
|
-
}),
|
|
899
|
+
}), "setExtend", {
|
|
911
900
|
value: function value(_value) {
|
|
912
901
|
this[EXTEND] = _value;
|
|
913
902
|
},
|
|
914
903
|
writable: false,
|
|
915
904
|
configurable: false,
|
|
916
905
|
enumerable: false
|
|
917
|
-
}), _defineProperty(_Object$definePropert, "getExtend", {
|
|
906
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
|
|
918
907
|
value: function value() {
|
|
919
908
|
return this[EXTEND];
|
|
920
909
|
},
|
|
921
910
|
writable: false,
|
|
922
911
|
configurable: false,
|
|
923
912
|
enumerable: false
|
|
924
|
-
}),
|
|
913
|
+
}), "setLayout", {
|
|
925
914
|
value: function value(layout) {
|
|
926
915
|
this[LAYOUT] = layout;
|
|
927
916
|
},
|
|
928
917
|
writable: false,
|
|
929
918
|
configurable: false,
|
|
930
919
|
enumerable: false
|
|
931
|
-
}),
|
|
920
|
+
}), "getLayout", {
|
|
932
921
|
value: function value() {
|
|
933
922
|
return this[LAYOUT];
|
|
934
923
|
},
|
|
935
924
|
writable: false,
|
|
936
925
|
configurable: false,
|
|
937
926
|
enumerable: false
|
|
938
|
-
}),
|
|
927
|
+
}), "clone", {
|
|
939
928
|
value: function value(exclude_blocks) {
|
|
940
929
|
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
941
930
|
if (exclude_blocks === true) {
|
|
@@ -946,7 +935,7 @@ function Context(config) {
|
|
|
946
935
|
writable: false,
|
|
947
936
|
configurable: false,
|
|
948
937
|
enumerable: false
|
|
949
|
-
}),
|
|
938
|
+
}), "extend", {
|
|
950
939
|
value: function value(layout) {
|
|
951
940
|
this.setExtend(true);
|
|
952
941
|
this.setLayout(layout);
|
|
@@ -954,7 +943,7 @@ function Context(config) {
|
|
|
954
943
|
writable: false,
|
|
955
944
|
configurable: false,
|
|
956
945
|
enumerable: false
|
|
957
|
-
}),
|
|
946
|
+
}), "echo", {
|
|
958
947
|
value: function value(layout) {
|
|
959
948
|
var buffer = this.getBuffer();
|
|
960
949
|
var params = [].slice.call(arguments);
|
|
@@ -963,7 +952,7 @@ function Context(config) {
|
|
|
963
952
|
writable: false,
|
|
964
953
|
configurable: false,
|
|
965
954
|
enumerable: false
|
|
966
|
-
}),
|
|
955
|
+
}), "fn", {
|
|
967
956
|
value: function value(callback) {
|
|
968
957
|
var buffer = this.getBuffer();
|
|
969
958
|
var context = this;
|
|
@@ -978,7 +967,7 @@ function Context(config) {
|
|
|
978
967
|
writable: false,
|
|
979
968
|
configurable: false,
|
|
980
969
|
enumerable: false
|
|
981
|
-
}),
|
|
970
|
+
}), "get", {
|
|
982
971
|
value: function value(name, defaults) {
|
|
983
972
|
var path = getPath(this, name, true);
|
|
984
973
|
var result = path.shift();
|
|
@@ -988,7 +977,7 @@ function Context(config) {
|
|
|
988
977
|
writable: true,
|
|
989
978
|
configurable: true,
|
|
990
979
|
enumerable: false
|
|
991
|
-
}),
|
|
980
|
+
}), "set", {
|
|
992
981
|
value: function value(name, _value2) {
|
|
993
982
|
var path = getPath(this, name, false);
|
|
994
983
|
var result = path.shift();
|
|
@@ -1001,7 +990,7 @@ function Context(config) {
|
|
|
1001
990
|
writable: false,
|
|
1002
991
|
configurable: false,
|
|
1003
992
|
enumerable: false
|
|
1004
|
-
}),
|
|
993
|
+
}), "macro", {
|
|
1005
994
|
value: function value(name, callback) {
|
|
1006
995
|
var list = this.getMacro();
|
|
1007
996
|
var macro = this.fn(callback);
|
|
@@ -1013,7 +1002,7 @@ function Context(config) {
|
|
|
1013
1002
|
writable: false,
|
|
1014
1003
|
configurable: false,
|
|
1015
1004
|
enumerable: false
|
|
1016
|
-
}), _defineProperty(_Object$definePropert, "call", {
|
|
1005
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
1017
1006
|
value: function value(name) {
|
|
1018
1007
|
var list = this.getMacro();
|
|
1019
1008
|
var macro = list[name];
|
|
@@ -1025,7 +1014,7 @@ function Context(config) {
|
|
|
1025
1014
|
writable: false,
|
|
1026
1015
|
configurable: false,
|
|
1027
1016
|
enumerable: false
|
|
1028
|
-
}),
|
|
1017
|
+
}), "block", {
|
|
1029
1018
|
value: function value(name, callback) {
|
|
1030
1019
|
var _this = this;
|
|
1031
1020
|
var blocks = this.getBlocks();
|
|
@@ -1036,29 +1025,29 @@ function Context(config) {
|
|
|
1036
1025
|
var current = function current() {
|
|
1037
1026
|
return list.shift();
|
|
1038
1027
|
};
|
|
1039
|
-
var
|
|
1028
|
+
var _next = function next() {
|
|
1040
1029
|
var parent = current();
|
|
1041
1030
|
if (parent) {
|
|
1042
1031
|
return function () {
|
|
1043
|
-
_this.echo(parent(
|
|
1032
|
+
_this.echo(parent(_next()));
|
|
1044
1033
|
};
|
|
1045
1034
|
} else {
|
|
1046
1035
|
return noop;
|
|
1047
1036
|
}
|
|
1048
1037
|
};
|
|
1049
|
-
this.echo(current()(
|
|
1038
|
+
this.echo(current()(_next()));
|
|
1050
1039
|
},
|
|
1051
1040
|
writable: false,
|
|
1052
1041
|
configurable: false,
|
|
1053
1042
|
enumerable: false
|
|
1054
|
-
}),
|
|
1043
|
+
}), "hasBlock", {
|
|
1055
1044
|
value: function value(name) {
|
|
1056
1045
|
return this.getBlocks().hasOwnProperty(name);
|
|
1057
1046
|
},
|
|
1058
1047
|
writable: false,
|
|
1059
1048
|
configurable: false,
|
|
1060
1049
|
enumerable: false
|
|
1061
|
-
}),
|
|
1050
|
+
}), "include", {
|
|
1062
1051
|
value: function value(path, data, cx) {
|
|
1063
1052
|
var context = cx === false ? {} : this.clone(true);
|
|
1064
1053
|
var params = extend(context, data || {});
|
|
@@ -1068,7 +1057,7 @@ function Context(config) {
|
|
|
1068
1057
|
writable: false,
|
|
1069
1058
|
configurable: false,
|
|
1070
1059
|
enumerable: false
|
|
1071
|
-
}),
|
|
1060
|
+
}), "use", {
|
|
1072
1061
|
value: function value(path, namespace) {
|
|
1073
1062
|
var promise = this.require(path);
|
|
1074
1063
|
this.echo(resolve$1(promise, function (exports) {
|
|
@@ -1081,7 +1070,7 @@ function Context(config) {
|
|
|
1081
1070
|
writable: false,
|
|
1082
1071
|
configurable: false,
|
|
1083
1072
|
enumerable: false
|
|
1084
|
-
}),
|
|
1073
|
+
}), "async", {
|
|
1085
1074
|
value: function value(promise, callback) {
|
|
1086
1075
|
this.echo(resolve$1(promise, function (data) {
|
|
1087
1076
|
return this.fn(callback)(data);
|
|
@@ -1090,7 +1079,7 @@ function Context(config) {
|
|
|
1090
1079
|
writable: false,
|
|
1091
1080
|
configurable: false,
|
|
1092
1081
|
enumerable: false
|
|
1093
|
-
}),
|
|
1082
|
+
}), "each", {
|
|
1094
1083
|
value: function value(object, callback) {
|
|
1095
1084
|
if (isString(object)) {
|
|
1096
1085
|
object = this.get(object, []);
|
|
@@ -1100,14 +1089,14 @@ function Context(config) {
|
|
|
1100
1089
|
writable: false,
|
|
1101
1090
|
configurable: false,
|
|
1102
1091
|
enumerable: false
|
|
1103
|
-
}),
|
|
1092
|
+
}), "element", {
|
|
1104
1093
|
value: function value(tag, attr, content) {
|
|
1105
1094
|
return element(tag, attr, content);
|
|
1106
1095
|
},
|
|
1107
1096
|
writable: false,
|
|
1108
1097
|
configurable: false,
|
|
1109
1098
|
enumerable: false
|
|
1110
|
-
}),
|
|
1099
|
+
}), "el", {
|
|
1111
1100
|
value: function value(tag, attr, content) {
|
|
1112
1101
|
if (isFunction(content)) {
|
|
1113
1102
|
content = this.fn(content)();
|
|
@@ -1119,7 +1108,7 @@ function Context(config) {
|
|
|
1119
1108
|
writable: false,
|
|
1120
1109
|
configurable: false,
|
|
1121
1110
|
enumerable: false
|
|
1122
|
-
})
|
|
1111
|
+
})));
|
|
1123
1112
|
};
|
|
1124
1113
|
this.configure(config);
|
|
1125
1114
|
}
|
|
@@ -1151,7 +1140,7 @@ function EJS(options) {
|
|
|
1151
1140
|
return scope.getMacro();
|
|
1152
1141
|
});
|
|
1153
1142
|
};
|
|
1154
|
-
var
|
|
1143
|
+
var _render = function render(name, data) {
|
|
1155
1144
|
var filepath = ext(name, config.extension);
|
|
1156
1145
|
var scope = context.create(data);
|
|
1157
1146
|
return output(filepath, scope).then(function (content) {
|
|
@@ -1159,7 +1148,7 @@ function EJS(options) {
|
|
|
1159
1148
|
scope.setExtend(false);
|
|
1160
1149
|
var layout = scope.getLayout();
|
|
1161
1150
|
var _data = scope.clone();
|
|
1162
|
-
return
|
|
1151
|
+
return _render(layout, _data);
|
|
1163
1152
|
}
|
|
1164
1153
|
return content;
|
|
1165
1154
|
});
|
|
@@ -1174,7 +1163,7 @@ function EJS(options) {
|
|
|
1174
1163
|
return config;
|
|
1175
1164
|
};
|
|
1176
1165
|
this.render = function (name, data) {
|
|
1177
|
-
return
|
|
1166
|
+
return _render(name, data);
|
|
1178
1167
|
};
|
|
1179
1168
|
this.helpers = function (methods) {
|
|
1180
1169
|
context.helpers(extend(scope, methods));
|
|
@@ -1193,7 +1182,7 @@ function EJS(options) {
|
|
|
1193
1182
|
};
|
|
1194
1183
|
this.helpers({
|
|
1195
1184
|
require: require,
|
|
1196
|
-
render:
|
|
1185
|
+
render: _render
|
|
1197
1186
|
});
|
|
1198
1187
|
return this;
|
|
1199
1188
|
}
|
|
@@ -1240,7 +1229,7 @@ function setRenderer(_ref) {
|
|
|
1240
1229
|
_ref$version = _ref.version,
|
|
1241
1230
|
version = _ref$version === void 0 ? '1.0' : _ref$version;
|
|
1242
1231
|
return /*#__PURE__*/function () {
|
|
1243
|
-
var _ref2 = _asyncToGenerator(
|
|
1232
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(c, next) {
|
|
1244
1233
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1245
1234
|
while (1) switch (_context.prev = _context.next) {
|
|
1246
1235
|
case 0:
|