@kosatyi/ejs 0.0.95 → 0.0.97
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 +16 -16
- package/dist/cjs/element.js +1 -1
- package/dist/cjs/index.js +16 -16
- package/dist/cjs/worker.js +16 -16
- package/dist/esm/browser.js +21 -28
- package/dist/esm/element.js +1 -1
- package/dist/esm/index.js +21 -28
- package/dist/esm/worker.js +21 -28
- package/dist/umd/browser.js +16 -16
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/element.js +1 -1
- package/dist/umd/element.min.js +1 -1
- package/dist/umd/index.js +16 -16
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +16 -16
- package/dist/umd/worker.min.js +1 -1
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -146,9 +146,6 @@ var omit = function omit(object, list) {
|
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
150
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
151
|
-
};
|
|
152
149
|
var hasProp = function hasProp(object, prop) {
|
|
153
150
|
return object && object.hasOwnProperty(prop);
|
|
154
151
|
};
|
|
@@ -289,7 +286,7 @@ function Compiler(config) {
|
|
|
289
286
|
compiler.matches = [];
|
|
290
287
|
compiler.formats = [];
|
|
291
288
|
compiler.slurp = {
|
|
292
|
-
match: '[
|
|
289
|
+
match: '[\s\t\n]*',
|
|
293
290
|
start: [compiler.token.start, '_'],
|
|
294
291
|
end: ['_', compiler.token.end]
|
|
295
292
|
};
|
|
@@ -420,7 +417,7 @@ var element = function element(tag, attrs, content) {
|
|
|
420
417
|
}
|
|
421
418
|
}).join(space);
|
|
422
419
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
423
|
-
if (content) {
|
|
420
|
+
if (content && hasClosedTag) {
|
|
424
421
|
result.push(content instanceof Array ? content.join('') : content);
|
|
425
422
|
}
|
|
426
423
|
if (hasClosedTag) {
|
|
@@ -738,7 +735,7 @@ function Context(config) {
|
|
|
738
735
|
writable: false,
|
|
739
736
|
configurable: false,
|
|
740
737
|
enumerable: false
|
|
741
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
738
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
742
739
|
value: function value(name) {
|
|
743
740
|
var list = this.getMacro();
|
|
744
741
|
var macro = list[name];
|
|
@@ -793,24 +790,30 @@ function Context(config) {
|
|
|
793
790
|
writable: false,
|
|
794
791
|
configurable: false,
|
|
795
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
|
|
796
800
|
}), "use", {
|
|
797
801
|
value: function value(path, namespace) {
|
|
798
|
-
|
|
799
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
802
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
800
803
|
var list = this.getMacro();
|
|
801
804
|
each(exports, function (macro, name) {
|
|
802
805
|
list[[namespace, name].join('.')] = macro;
|
|
803
806
|
});
|
|
804
|
-
}
|
|
807
|
+
}));
|
|
805
808
|
},
|
|
806
809
|
writable: false,
|
|
807
810
|
configurable: false,
|
|
808
811
|
enumerable: false
|
|
809
812
|
}), "async", {
|
|
810
813
|
value: function value(promise, callback) {
|
|
811
|
-
this.echo(
|
|
814
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
812
815
|
return this.fn(callback)(data);
|
|
813
|
-
}
|
|
816
|
+
}));
|
|
814
817
|
},
|
|
815
818
|
writable: false,
|
|
816
819
|
configurable: false,
|
|
@@ -834,12 +837,9 @@ function Context(config) {
|
|
|
834
837
|
enumerable: false
|
|
835
838
|
}), "el", {
|
|
836
839
|
value: function value(tag, attr, content) {
|
|
837
|
-
|
|
838
|
-
content = this.fn(content)();
|
|
839
|
-
}
|
|
840
|
-
this.echo(resolve$1(content, function (content) {
|
|
840
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
841
841
|
return this.element(tag, attr, content);
|
|
842
|
-
}
|
|
842
|
+
}));
|
|
843
843
|
},
|
|
844
844
|
writable: false,
|
|
845
845
|
configurable: false,
|
package/dist/cjs/element.js
CHANGED
|
@@ -74,7 +74,7 @@ var element = function element(tag, attrs, content) {
|
|
|
74
74
|
}
|
|
75
75
|
}).join(space);
|
|
76
76
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
77
|
-
if (content) {
|
|
77
|
+
if (content && hasClosedTag) {
|
|
78
78
|
result.push(content instanceof Array ? content.join('') : content);
|
|
79
79
|
}
|
|
80
80
|
if (hasClosedTag) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -149,9 +149,6 @@ var omit = function omit(object, list) {
|
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
};
|
|
152
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
153
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
154
|
-
};
|
|
155
152
|
var hasProp = function hasProp(object, prop) {
|
|
156
153
|
return object && object.hasOwnProperty(prop);
|
|
157
154
|
};
|
|
@@ -292,7 +289,7 @@ function Compiler(config) {
|
|
|
292
289
|
compiler.matches = [];
|
|
293
290
|
compiler.formats = [];
|
|
294
291
|
compiler.slurp = {
|
|
295
|
-
match: '[
|
|
292
|
+
match: '[\s\t\n]*',
|
|
296
293
|
start: [compiler.token.start, '_'],
|
|
297
294
|
end: ['_', compiler.token.end]
|
|
298
295
|
};
|
|
@@ -423,7 +420,7 @@ var element = function element(tag, attrs, content) {
|
|
|
423
420
|
}
|
|
424
421
|
}).join(space);
|
|
425
422
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
426
|
-
if (content) {
|
|
423
|
+
if (content && hasClosedTag) {
|
|
427
424
|
result.push(content instanceof Array ? content.join('') : content);
|
|
428
425
|
}
|
|
429
426
|
if (hasClosedTag) {
|
|
@@ -741,7 +738,7 @@ function Context(config) {
|
|
|
741
738
|
writable: false,
|
|
742
739
|
configurable: false,
|
|
743
740
|
enumerable: false
|
|
744
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
741
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
745
742
|
value: function value(name) {
|
|
746
743
|
var list = this.getMacro();
|
|
747
744
|
var macro = list[name];
|
|
@@ -796,24 +793,30 @@ function Context(config) {
|
|
|
796
793
|
writable: false,
|
|
797
794
|
configurable: false,
|
|
798
795
|
enumerable: false
|
|
796
|
+
}), "promiseResolve", {
|
|
797
|
+
value: function value(_value3, callback) {
|
|
798
|
+
return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
|
|
799
|
+
},
|
|
800
|
+
writable: false,
|
|
801
|
+
configurable: false,
|
|
802
|
+
enumerable: false
|
|
799
803
|
}), "use", {
|
|
800
804
|
value: function value(path, namespace) {
|
|
801
|
-
|
|
802
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
805
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
803
806
|
var list = this.getMacro();
|
|
804
807
|
each(exports, function (macro, name) {
|
|
805
808
|
list[[namespace, name].join('.')] = macro;
|
|
806
809
|
});
|
|
807
|
-
}
|
|
810
|
+
}));
|
|
808
811
|
},
|
|
809
812
|
writable: false,
|
|
810
813
|
configurable: false,
|
|
811
814
|
enumerable: false
|
|
812
815
|
}), "async", {
|
|
813
816
|
value: function value(promise, callback) {
|
|
814
|
-
this.echo(
|
|
817
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
815
818
|
return this.fn(callback)(data);
|
|
816
|
-
}
|
|
819
|
+
}));
|
|
817
820
|
},
|
|
818
821
|
writable: false,
|
|
819
822
|
configurable: false,
|
|
@@ -837,12 +840,9 @@ function Context(config) {
|
|
|
837
840
|
enumerable: false
|
|
838
841
|
}), "el", {
|
|
839
842
|
value: function value(tag, attr, content) {
|
|
840
|
-
|
|
841
|
-
content = this.fn(content)();
|
|
842
|
-
}
|
|
843
|
-
this.echo(resolve$1(content, function (content) {
|
|
843
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
844
844
|
return this.element(tag, attr, content);
|
|
845
|
-
}
|
|
845
|
+
}));
|
|
846
846
|
},
|
|
847
847
|
writable: false,
|
|
848
848
|
configurable: false,
|
package/dist/cjs/worker.js
CHANGED
|
@@ -495,9 +495,6 @@ var omit = function omit(object, list) {
|
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
497
|
};
|
|
498
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
499
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
500
|
-
};
|
|
501
498
|
var hasProp = function hasProp(object, prop) {
|
|
502
499
|
return object && object.hasOwnProperty(prop);
|
|
503
500
|
};
|
|
@@ -633,7 +630,7 @@ function Compiler(config) {
|
|
|
633
630
|
compiler.matches = [];
|
|
634
631
|
compiler.formats = [];
|
|
635
632
|
compiler.slurp = {
|
|
636
|
-
match: '[
|
|
633
|
+
match: '[\s\t\n]*',
|
|
637
634
|
start: [compiler.token.start, '_'],
|
|
638
635
|
end: ['_', compiler.token.end]
|
|
639
636
|
};
|
|
@@ -741,7 +738,7 @@ var element = function element(tag, attrs, content) {
|
|
|
741
738
|
}
|
|
742
739
|
}).join(space);
|
|
743
740
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
744
|
-
if (content) {
|
|
741
|
+
if (content && hasClosedTag) {
|
|
745
742
|
result.push(content instanceof Array ? content.join('') : content);
|
|
746
743
|
}
|
|
747
744
|
if (hasClosedTag) {
|
|
@@ -1059,7 +1056,7 @@ function Context(config) {
|
|
|
1059
1056
|
writable: false,
|
|
1060
1057
|
configurable: false,
|
|
1061
1058
|
enumerable: false
|
|
1062
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
1059
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
1063
1060
|
value: function value(name) {
|
|
1064
1061
|
var list = this.getMacro();
|
|
1065
1062
|
var macro = list[name];
|
|
@@ -1114,24 +1111,30 @@ function Context(config) {
|
|
|
1114
1111
|
writable: false,
|
|
1115
1112
|
configurable: false,
|
|
1116
1113
|
enumerable: false
|
|
1114
|
+
}), "promiseResolve", {
|
|
1115
|
+
value: function value(_value3, callback) {
|
|
1116
|
+
return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
|
|
1117
|
+
},
|
|
1118
|
+
writable: false,
|
|
1119
|
+
configurable: false,
|
|
1120
|
+
enumerable: false
|
|
1117
1121
|
}), "use", {
|
|
1118
1122
|
value: function value(path, namespace) {
|
|
1119
|
-
|
|
1120
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
1123
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
1121
1124
|
var list = this.getMacro();
|
|
1122
1125
|
each(exports, function (macro, name) {
|
|
1123
1126
|
list[[namespace, name].join('.')] = macro;
|
|
1124
1127
|
});
|
|
1125
|
-
}
|
|
1128
|
+
}));
|
|
1126
1129
|
},
|
|
1127
1130
|
writable: false,
|
|
1128
1131
|
configurable: false,
|
|
1129
1132
|
enumerable: false
|
|
1130
1133
|
}), "async", {
|
|
1131
1134
|
value: function value(promise, callback) {
|
|
1132
|
-
this.echo(
|
|
1135
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
1133
1136
|
return this.fn(callback)(data);
|
|
1134
|
-
}
|
|
1137
|
+
}));
|
|
1135
1138
|
},
|
|
1136
1139
|
writable: false,
|
|
1137
1140
|
configurable: false,
|
|
@@ -1155,12 +1158,9 @@ function Context(config) {
|
|
|
1155
1158
|
enumerable: false
|
|
1156
1159
|
}), "el", {
|
|
1157
1160
|
value: function value(tag, attr, content) {
|
|
1158
|
-
|
|
1159
|
-
content = this.fn(content)();
|
|
1160
|
-
}
|
|
1161
|
-
this.echo(resolve$1(content, function (content) {
|
|
1161
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
1162
1162
|
return this.element(tag, attr, content);
|
|
1163
|
-
}
|
|
1163
|
+
}));
|
|
1164
1164
|
},
|
|
1165
1165
|
writable: false,
|
|
1166
1166
|
configurable: false,
|
package/dist/esm/browser.js
CHANGED
|
@@ -152,9 +152,6 @@ const omit = (object, list) => {
|
|
|
152
152
|
})
|
|
153
153
|
};
|
|
154
154
|
|
|
155
|
-
const resolve$1 = (value, callback, context) =>
|
|
156
|
-
Promise.resolve(value).then(callback.bind(context));
|
|
157
|
-
|
|
158
155
|
const hasProp = (object, prop) => {
|
|
159
156
|
return object && object.hasOwnProperty(prop)
|
|
160
157
|
};
|
|
@@ -339,7 +336,7 @@ function Compiler(config) {
|
|
|
339
336
|
compiler.matches = [];
|
|
340
337
|
compiler.formats = [];
|
|
341
338
|
compiler.slurp = {
|
|
342
|
-
match: '[
|
|
339
|
+
match: '[\s\t\n]*',
|
|
343
340
|
start: [compiler.token.start, '_'],
|
|
344
341
|
end: ['_', compiler.token.end],
|
|
345
342
|
};
|
|
@@ -494,7 +491,7 @@ const element = (tag, attrs, content) => {
|
|
|
494
491
|
}
|
|
495
492
|
}).join(space);
|
|
496
493
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
497
|
-
if (content) {
|
|
494
|
+
if (content && hasClosedTag) {
|
|
498
495
|
result.push(content instanceof Array ? content.join('') : content);
|
|
499
496
|
}
|
|
500
497
|
if (hasClosedTag) {
|
|
@@ -750,7 +747,6 @@ function Context(config) {
|
|
|
750
747
|
configurable: false,
|
|
751
748
|
enumerable: false,
|
|
752
749
|
},
|
|
753
|
-
|
|
754
750
|
extend: {
|
|
755
751
|
value(layout) {
|
|
756
752
|
this.setExtend(true);
|
|
@@ -882,19 +878,27 @@ function Context(config) {
|
|
|
882
878
|
configurable: false,
|
|
883
879
|
enumerable: false,
|
|
884
880
|
},
|
|
881
|
+
promiseResolve: {
|
|
882
|
+
value(value, callback) {
|
|
883
|
+
return Promise.resolve(
|
|
884
|
+
isFunction(value) ? this.fn(value)() : value
|
|
885
|
+
).then(callback.bind(this))
|
|
886
|
+
},
|
|
887
|
+
writable: false,
|
|
888
|
+
configurable: false,
|
|
889
|
+
enumerable: false,
|
|
890
|
+
},
|
|
885
891
|
use: {
|
|
886
892
|
value(path, namespace) {
|
|
887
|
-
const promise = this.require(path);
|
|
888
893
|
this.echo(
|
|
889
|
-
|
|
890
|
-
|
|
894
|
+
this.promiseResolve(
|
|
895
|
+
this.require(path),
|
|
891
896
|
function (exports) {
|
|
892
897
|
const list = this.getMacro();
|
|
893
898
|
each(exports, function (macro, name) {
|
|
894
899
|
list[[namespace, name].join('.')] = macro;
|
|
895
900
|
});
|
|
896
|
-
}
|
|
897
|
-
this
|
|
901
|
+
}
|
|
898
902
|
)
|
|
899
903
|
);
|
|
900
904
|
},
|
|
@@ -905,13 +909,9 @@ function Context(config) {
|
|
|
905
909
|
async: {
|
|
906
910
|
value(promise, callback) {
|
|
907
911
|
this.echo(
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
return this.fn(callback)(data)
|
|
912
|
-
},
|
|
913
|
-
this
|
|
914
|
-
)
|
|
912
|
+
this.promiseResolve(promise, function (data) {
|
|
913
|
+
return this.fn(callback)(data)
|
|
914
|
+
})
|
|
915
915
|
);
|
|
916
916
|
},
|
|
917
917
|
writable: false,
|
|
@@ -939,17 +939,10 @@ function Context(config) {
|
|
|
939
939
|
},
|
|
940
940
|
el: {
|
|
941
941
|
value(tag, attr, content) {
|
|
942
|
-
if (isFunction(content)) {
|
|
943
|
-
content = this.fn(content)();
|
|
944
|
-
}
|
|
945
942
|
this.echo(
|
|
946
|
-
|
|
947
|
-
content
|
|
948
|
-
|
|
949
|
-
return this.element(tag, attr, content)
|
|
950
|
-
},
|
|
951
|
-
this
|
|
952
|
-
)
|
|
943
|
+
this.promiseResolve(content, function (content) {
|
|
944
|
+
return this.element(tag, attr, content)
|
|
945
|
+
})
|
|
953
946
|
);
|
|
954
947
|
},
|
|
955
948
|
writable: false,
|
package/dist/esm/element.js
CHANGED
|
@@ -103,7 +103,7 @@ const element = (tag, attrs, content) => {
|
|
|
103
103
|
}
|
|
104
104
|
}).join(space);
|
|
105
105
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
106
|
-
if (content) {
|
|
106
|
+
if (content && hasClosedTag) {
|
|
107
107
|
result.push(content instanceof Array ? content.join('') : content);
|
|
108
108
|
}
|
|
109
109
|
if (hasClosedTag) {
|
package/dist/esm/index.js
CHANGED
|
@@ -155,9 +155,6 @@ const omit = (object, list) => {
|
|
|
155
155
|
})
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
const resolve$1 = (value, callback, context) =>
|
|
159
|
-
Promise.resolve(value).then(callback.bind(context));
|
|
160
|
-
|
|
161
158
|
const hasProp = (object, prop) => {
|
|
162
159
|
return object && object.hasOwnProperty(prop)
|
|
163
160
|
};
|
|
@@ -342,7 +339,7 @@ function Compiler(config) {
|
|
|
342
339
|
compiler.matches = [];
|
|
343
340
|
compiler.formats = [];
|
|
344
341
|
compiler.slurp = {
|
|
345
|
-
match: '[
|
|
342
|
+
match: '[\s\t\n]*',
|
|
346
343
|
start: [compiler.token.start, '_'],
|
|
347
344
|
end: ['_', compiler.token.end],
|
|
348
345
|
};
|
|
@@ -497,7 +494,7 @@ const element = (tag, attrs, content) => {
|
|
|
497
494
|
}
|
|
498
495
|
}).join(space);
|
|
499
496
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
500
|
-
if (content) {
|
|
497
|
+
if (content && hasClosedTag) {
|
|
501
498
|
result.push(content instanceof Array ? content.join('') : content);
|
|
502
499
|
}
|
|
503
500
|
if (hasClosedTag) {
|
|
@@ -753,7 +750,6 @@ function Context(config) {
|
|
|
753
750
|
configurable: false,
|
|
754
751
|
enumerable: false,
|
|
755
752
|
},
|
|
756
|
-
|
|
757
753
|
extend: {
|
|
758
754
|
value(layout) {
|
|
759
755
|
this.setExtend(true);
|
|
@@ -885,19 +881,27 @@ function Context(config) {
|
|
|
885
881
|
configurable: false,
|
|
886
882
|
enumerable: false,
|
|
887
883
|
},
|
|
884
|
+
promiseResolve: {
|
|
885
|
+
value(value, callback) {
|
|
886
|
+
return Promise.resolve(
|
|
887
|
+
isFunction(value) ? this.fn(value)() : value
|
|
888
|
+
).then(callback.bind(this))
|
|
889
|
+
},
|
|
890
|
+
writable: false,
|
|
891
|
+
configurable: false,
|
|
892
|
+
enumerable: false,
|
|
893
|
+
},
|
|
888
894
|
use: {
|
|
889
895
|
value(path, namespace) {
|
|
890
|
-
const promise = this.require(path);
|
|
891
896
|
this.echo(
|
|
892
|
-
|
|
893
|
-
|
|
897
|
+
this.promiseResolve(
|
|
898
|
+
this.require(path),
|
|
894
899
|
function (exports) {
|
|
895
900
|
const list = this.getMacro();
|
|
896
901
|
each(exports, function (macro, name) {
|
|
897
902
|
list[[namespace, name].join('.')] = macro;
|
|
898
903
|
});
|
|
899
|
-
}
|
|
900
|
-
this
|
|
904
|
+
}
|
|
901
905
|
)
|
|
902
906
|
);
|
|
903
907
|
},
|
|
@@ -908,13 +912,9 @@ function Context(config) {
|
|
|
908
912
|
async: {
|
|
909
913
|
value(promise, callback) {
|
|
910
914
|
this.echo(
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
return this.fn(callback)(data)
|
|
915
|
-
},
|
|
916
|
-
this
|
|
917
|
-
)
|
|
915
|
+
this.promiseResolve(promise, function (data) {
|
|
916
|
+
return this.fn(callback)(data)
|
|
917
|
+
})
|
|
918
918
|
);
|
|
919
919
|
},
|
|
920
920
|
writable: false,
|
|
@@ -942,17 +942,10 @@ function Context(config) {
|
|
|
942
942
|
},
|
|
943
943
|
el: {
|
|
944
944
|
value(tag, attr, content) {
|
|
945
|
-
if (isFunction(content)) {
|
|
946
|
-
content = this.fn(content)();
|
|
947
|
-
}
|
|
948
945
|
this.echo(
|
|
949
|
-
|
|
950
|
-
content
|
|
951
|
-
|
|
952
|
-
return this.element(tag, attr, content)
|
|
953
|
-
},
|
|
954
|
-
this
|
|
955
|
-
)
|
|
946
|
+
this.promiseResolve(content, function (content) {
|
|
947
|
+
return this.element(tag, attr, content)
|
|
948
|
+
})
|
|
956
949
|
);
|
|
957
950
|
},
|
|
958
951
|
writable: false,
|
package/dist/esm/worker.js
CHANGED
|
@@ -152,9 +152,6 @@ const omit = (object, list) => {
|
|
|
152
152
|
})
|
|
153
153
|
};
|
|
154
154
|
|
|
155
|
-
const resolve$1 = (value, callback, context) =>
|
|
156
|
-
Promise.resolve(value).then(callback.bind(context));
|
|
157
|
-
|
|
158
155
|
const hasProp = (object, prop) => {
|
|
159
156
|
return object && object.hasOwnProperty(prop)
|
|
160
157
|
};
|
|
@@ -333,7 +330,7 @@ function Compiler(config) {
|
|
|
333
330
|
compiler.matches = [];
|
|
334
331
|
compiler.formats = [];
|
|
335
332
|
compiler.slurp = {
|
|
336
|
-
match: '[
|
|
333
|
+
match: '[\s\t\n]*',
|
|
337
334
|
start: [compiler.token.start, '_'],
|
|
338
335
|
end: ['_', compiler.token.end],
|
|
339
336
|
};
|
|
@@ -488,7 +485,7 @@ const element = (tag, attrs, content) => {
|
|
|
488
485
|
}
|
|
489
486
|
}).join(space);
|
|
490
487
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
491
|
-
if (content) {
|
|
488
|
+
if (content && hasClosedTag) {
|
|
492
489
|
result.push(content instanceof Array ? content.join('') : content);
|
|
493
490
|
}
|
|
494
491
|
if (hasClosedTag) {
|
|
@@ -744,7 +741,6 @@ function Context(config) {
|
|
|
744
741
|
configurable: false,
|
|
745
742
|
enumerable: false,
|
|
746
743
|
},
|
|
747
|
-
|
|
748
744
|
extend: {
|
|
749
745
|
value(layout) {
|
|
750
746
|
this.setExtend(true);
|
|
@@ -876,19 +872,27 @@ function Context(config) {
|
|
|
876
872
|
configurable: false,
|
|
877
873
|
enumerable: false,
|
|
878
874
|
},
|
|
875
|
+
promiseResolve: {
|
|
876
|
+
value(value, callback) {
|
|
877
|
+
return Promise.resolve(
|
|
878
|
+
isFunction(value) ? this.fn(value)() : value
|
|
879
|
+
).then(callback.bind(this))
|
|
880
|
+
},
|
|
881
|
+
writable: false,
|
|
882
|
+
configurable: false,
|
|
883
|
+
enumerable: false,
|
|
884
|
+
},
|
|
879
885
|
use: {
|
|
880
886
|
value(path, namespace) {
|
|
881
|
-
const promise = this.require(path);
|
|
882
887
|
this.echo(
|
|
883
|
-
|
|
884
|
-
|
|
888
|
+
this.promiseResolve(
|
|
889
|
+
this.require(path),
|
|
885
890
|
function (exports) {
|
|
886
891
|
const list = this.getMacro();
|
|
887
892
|
each(exports, function (macro, name) {
|
|
888
893
|
list[[namespace, name].join('.')] = macro;
|
|
889
894
|
});
|
|
890
|
-
}
|
|
891
|
-
this
|
|
895
|
+
}
|
|
892
896
|
)
|
|
893
897
|
);
|
|
894
898
|
},
|
|
@@ -899,13 +903,9 @@ function Context(config) {
|
|
|
899
903
|
async: {
|
|
900
904
|
value(promise, callback) {
|
|
901
905
|
this.echo(
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return this.fn(callback)(data)
|
|
906
|
-
},
|
|
907
|
-
this
|
|
908
|
-
)
|
|
906
|
+
this.promiseResolve(promise, function (data) {
|
|
907
|
+
return this.fn(callback)(data)
|
|
908
|
+
})
|
|
909
909
|
);
|
|
910
910
|
},
|
|
911
911
|
writable: false,
|
|
@@ -933,17 +933,10 @@ function Context(config) {
|
|
|
933
933
|
},
|
|
934
934
|
el: {
|
|
935
935
|
value(tag, attr, content) {
|
|
936
|
-
if (isFunction(content)) {
|
|
937
|
-
content = this.fn(content)();
|
|
938
|
-
}
|
|
939
936
|
this.echo(
|
|
940
|
-
|
|
941
|
-
content
|
|
942
|
-
|
|
943
|
-
return this.element(tag, attr, content)
|
|
944
|
-
},
|
|
945
|
-
this
|
|
946
|
-
)
|
|
937
|
+
this.promiseResolve(content, function (content) {
|
|
938
|
+
return this.element(tag, attr, content)
|
|
939
|
+
})
|
|
947
940
|
);
|
|
948
941
|
},
|
|
949
942
|
writable: false,
|
package/dist/umd/browser.js
CHANGED
|
@@ -150,9 +150,6 @@
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
154
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
155
|
-
};
|
|
156
153
|
var hasProp = function hasProp(object, prop) {
|
|
157
154
|
return object && object.hasOwnProperty(prop);
|
|
158
155
|
};
|
|
@@ -293,7 +290,7 @@
|
|
|
293
290
|
compiler.matches = [];
|
|
294
291
|
compiler.formats = [];
|
|
295
292
|
compiler.slurp = {
|
|
296
|
-
match: '[
|
|
293
|
+
match: '[\s\t\n]*',
|
|
297
294
|
start: [compiler.token.start, '_'],
|
|
298
295
|
end: ['_', compiler.token.end]
|
|
299
296
|
};
|
|
@@ -424,7 +421,7 @@
|
|
|
424
421
|
}
|
|
425
422
|
}).join(space);
|
|
426
423
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
427
|
-
if (content) {
|
|
424
|
+
if (content && hasClosedTag) {
|
|
428
425
|
result.push(content instanceof Array ? content.join('') : content);
|
|
429
426
|
}
|
|
430
427
|
if (hasClosedTag) {
|
|
@@ -742,7 +739,7 @@
|
|
|
742
739
|
writable: false,
|
|
743
740
|
configurable: false,
|
|
744
741
|
enumerable: false
|
|
745
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
742
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
746
743
|
value: function value(name) {
|
|
747
744
|
var list = this.getMacro();
|
|
748
745
|
var macro = list[name];
|
|
@@ -797,24 +794,30 @@
|
|
|
797
794
|
writable: false,
|
|
798
795
|
configurable: false,
|
|
799
796
|
enumerable: false
|
|
797
|
+
}), "promiseResolve", {
|
|
798
|
+
value: function value(_value3, callback) {
|
|
799
|
+
return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
|
|
800
|
+
},
|
|
801
|
+
writable: false,
|
|
802
|
+
configurable: false,
|
|
803
|
+
enumerable: false
|
|
800
804
|
}), "use", {
|
|
801
805
|
value: function value(path, namespace) {
|
|
802
|
-
|
|
803
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
806
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
804
807
|
var list = this.getMacro();
|
|
805
808
|
each(exports, function (macro, name) {
|
|
806
809
|
list[[namespace, name].join('.')] = macro;
|
|
807
810
|
});
|
|
808
|
-
}
|
|
811
|
+
}));
|
|
809
812
|
},
|
|
810
813
|
writable: false,
|
|
811
814
|
configurable: false,
|
|
812
815
|
enumerable: false
|
|
813
816
|
}), "async", {
|
|
814
817
|
value: function value(promise, callback) {
|
|
815
|
-
this.echo(
|
|
818
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
816
819
|
return this.fn(callback)(data);
|
|
817
|
-
}
|
|
820
|
+
}));
|
|
818
821
|
},
|
|
819
822
|
writable: false,
|
|
820
823
|
configurable: false,
|
|
@@ -838,12 +841,9 @@
|
|
|
838
841
|
enumerable: false
|
|
839
842
|
}), "el", {
|
|
840
843
|
value: function value(tag, attr, content) {
|
|
841
|
-
|
|
842
|
-
content = this.fn(content)();
|
|
843
|
-
}
|
|
844
|
-
this.echo(resolve$1(content, function (content) {
|
|
844
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
845
845
|
return this.element(tag, attr, content);
|
|
846
|
-
}
|
|
846
|
+
}));
|
|
847
847
|
},
|
|
848
848
|
writable: false,
|
|
849
849
|
configurable: false,
|
package/dist/umd/browser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},o=function(e){return"string"==typeof e},i=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=l(s),h=l(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return s[e]}))},b=function(e,t){var n=e;return null==n?"":!0===Boolean(t)?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var o=e,i=String(t).split("."),u=i.pop(),c=0;c<i.length;c++){var a=i[c];if(r(o.toJSON)&&(o=o.toJSON()),n&&!1===o.hasOwnProperty(a)){o={};break}o=o[a]=o[a]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)O(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,o,i){var c=t(e,o,i);!1===u(c)&&(n?r.push(c):r[o]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},O=function(e,t){return e&&e.hasOwnProperty(t)},x={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},k=function(e,u){d(e,{path:t(o,x.path,e.path,u.path),export:t(o,x.export,e.export,u.export),resolver:t(r,x.resolver,e.resolver,u.resolver),extension:t(o,x.extension,e.extension,u.extension),withObject:t(i,x.withObject,e.withObject,u.withObject),rmWhitespace:t(i,x.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(i,x.cache,e.cache,u.cache),token:d({},x.token,e.token,u.token),vars:d({},x.vars,e.vars,u.vars),globalHelpers:t(n,x.globalHelpers,e.globalHelpers,u.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function S(e){if(!1===g(this,S))return new S;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(F[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return O(t.list,e)}}var B=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function P(e){if(!1===g(this,P))return new P(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},B.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,o=r.SCOPE,i=r.SAFE,u=r.BUFFER,c=r.COMPONENT,s=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var l,f,p,b="".concat(u,"('");l=t.regex,f=function(n,r,o){b+=(""+e.slice(r,o)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(o,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[o,c,u,i].concat(s);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n});")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function T(e,t,n){if(!1===g(this,T))return new T(e,t,n);if(!1===g(t,S))throw new TypeError("cache is not instance of Cache");if(!1===g(n,P))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(e){return o.resolver(o.path,e)};this.configure=function(e){o.path=e.path,o.cache=e.cache,r(e.resolver)&&(o.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):i(e).then((function(o){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(o,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],C=" ",$='"',A="/",M="<",U=">",H=function(e,t,n){var r=[],o=-1===N.indexOf(e),i=function(e,t){var n=[];return y(e,(function(e,r,o){var i=t(e,r,o);!1===u(i)&&n.push(i)})),n}(t,(function(e,t){if(null!=e)return[p(t),[$,p(e),$].join("")].join("=")})).join(C);return r.push([M,e,C,i,U].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([M,A,e,U].join("")),r.join("")};function L(e){this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.name="TemplateSyntaxError",this.message=e}function q(e){return Promise.all(e||[]).then((function(e){return e.join("")})).catch((function(e){return e}))}function D(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),q(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return q(t)},n}function K(e){if(!1===g(this,K))return new K(e);this.configure=function(e,t){var n,i=e.vars,u=i.BLOCKS,c=i.MACRO,a=i.EXTEND,s=i.LAYOUT,l=i.BUFFER,f=i.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(R(R(R(R(R(R(R(R(R(n={},l,{value:D(),writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(e){this[s]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[s,a,l];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),o=n.pop();return O(r,o)?r[o]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),o=n.pop();return this.getExtend()&&O(r,o)?r[o]:r[o]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),o=this;n[e]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var o=Object.assign([],r[e]),i=function(){return o.shift()},u=function(){var e=i();return e?function(){n.echo(e(u()))}:w};this.echo(i()(u()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),o=d(r,t||{}),i=this.render(e,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){o(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(L.prototype,Error.prototype),Object.assign(L.prototype,{code:1}),L.prototype.getCode=function(){return this.code},L.prototype.getMessage=function(){return this.message},L.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(W.prototype,L.prototype),Object.assign(W.prototype,{code:404}),Object.setPrototypeOf(J.prototype,L.prototype),Object.assign(J.prototype,{code:500});var X=new function e(t){if(!1===g(this,e))return new e(t);var n={},o={};k(o,t||{});var i=new K(o),u=new P(o),c=new S,a=new T(o,c,u),s=function(e,t){var n=o.globalHelpers,i=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,i)}))},l=function(e,t){var n=m(e,o.extension),r=i.create(t);return s(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return l(t,n)}return e}))};return this.configure=function(e){return k(o,e=e||{}),i.configure(o,n),u.configure(o),c.configure(o),a.configure(o),o},this.render=function(e,t){return l(e,t)},this.helpers=function(e){i.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return i.create(e)},this.helpers({require:function(e){var t=m(e,o.extension),n=i.create({});return s(t,n).then((function(){return n.getMacro()}))},render:l}),this}({resolver:function(e,t){return fetch(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t)).then((function(e){return e.text()}),(function(e){return new L(e)}))}}),Y=X.render,_=X.context,z=X.compile,G=X.helpers,I=X.preload,Q=X.configure,V=X.create;e.TemplateError=L,e.TemplateNotFound=W,e.TemplateSyntaxError=J,e.compile=z,e.configure=Q,e.context=_,e.create=V,e.helpers=G,e.preload=I,e.render=Y}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},o=function(e){return"string"==typeof e},i=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=l(s),h=l(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return s[e]}))},b=function(e,t){var n=e;return null==n?"":!0===Boolean(t)?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var o=e,i=String(t).split("."),u=i.pop(),c=0;c<i.length;c++){var a=i[c];if(r(o.toJSON)&&(o=o.toJSON()),n&&!1===o.hasOwnProperty(a)){o={};break}o=o[a]=o[a]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)E(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,o,i){var c=t(e,o,i);!1===u(c)&&(n?r.push(c):r[o]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t){return e&&e.hasOwnProperty(t)},O={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},x=function(e,u){d(e,{path:t(o,O.path,e.path,u.path),export:t(o,O.export,e.export,u.export),resolver:t(r,O.resolver,e.resolver,u.resolver),extension:t(o,O.extension,e.extension,u.extension),withObject:t(i,O.withObject,e.withObject,u.withObject),rmWhitespace:t(i,O.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(i,O.cache,e.cache,u.cache),token:d({},O.token,e.token,u.token),vars:d({},O.vars,e.vars,u.vars),globalHelpers:t(n,O.globalHelpers,e.globalHelpers,u.globalHelpers)})},k="undefined"!=typeof globalThis?globalThis:window||self;function F(e){if(!1===g(this,F))return new F;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(k[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return E(t.list,e)}}var S=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===g(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[s\t\n]*",start:[t.token.start,"_"],end:["_",t.token.end]},S.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,o=r.SCOPE,i=r.SAFE,u=r.BUFFER,c=r.COMPONENT,s=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var l,f,p,b="".concat(u,"('");l=t.regex,f=function(n,r,o){b+=(""+e.slice(r,o)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(o,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[o,c,u,i].concat(s);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n});")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function P(e,t,n){if(!1===g(this,P))return new P(e,t,n);if(!1===g(t,F))throw new TypeError("cache is not instance of Cache");if(!1===g(n,B))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(e){return o.resolver(o.path,e)};this.configure=function(e){o.path=e.path,o.cache=e.cache,r(e.resolver)&&(o.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):i(e).then((function(o){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(o,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],N=" ",C='"',$="/",A="<",M=">",U=function(e,t,n){var r=[],o=-1===T.indexOf(e),i=function(e,t){var n=[];return y(e,(function(e,r,o){var i=t(e,r,o);!1===u(i)&&n.push(i)})),n}(t,(function(e,t){if(null!=e)return[p(t),[C,p(e),C].join("")].join("=")})).join(N);return r.push([A,e,N,i,M].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([A,$,e,M].join("")),r.join("")};function H(e){this.name="TemplateError",this.message=e,Error.call(this)}function L(e){H.call(this),this.name="TemplateNotFound",this.message=e}function W(e){H.call(this),this.name="TemplateSyntaxError",this.message=e}function J(e){return Promise.all(e||[]).then((function(e){return e.join("")})).catch((function(e){return e}))}function q(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),J(n)},n.error=function(e){return t=e,Promise.reject(new W(t.message));var t},n.end=function(){return J(t)},n}function D(e){if(!1===g(this,D))return new D(e);this.configure=function(e,t){var n,i=e.vars,u=i.BLOCKS,c=i.MACRO,a=i.EXTEND,s=i.LAYOUT,l=i.BUFFER,f=i.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(R(R(R(R(R(R(R(R(R(n={},l,{value:q(),writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(e){this[s]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[s,a,l];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),o=n.pop();return E(r,o)?r[o]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),o=n.pop();return this.getExtend()&&E(r,o)?r[o]:r[o]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),o=this;n[e]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var o=Object.assign([],r[e]),i=function(){return o.shift()},u=function(){var e=i();return e?function(){n.echo(e(u()))}:w};this.echo(i()(u()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),o=d(r,t||{}),i=this.render(e,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"promiseResolve",{value:function(e,t){return Promise.resolve(r(e)?this.fn(e)():e).then(t.bind(this))},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){this.echo(this.promiseResolve(this.require(e),(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))})))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(this.promiseResolve(e,(function(e){return this.fn(t)(e)})))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){o(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return U(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){this.echo(this.promiseResolve(n,(function(n){return this.element(e,t,n)})))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(H.prototype,Error.prototype),Object.assign(H.prototype,{code:1}),H.prototype.getCode=function(){return this.code},H.prototype.getMessage=function(){return this.message},H.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(L.prototype,H.prototype),Object.assign(L.prototype,{code:404}),Object.setPrototypeOf(W.prototype,H.prototype),Object.assign(W.prototype,{code:500});var K=new function e(t){if(!1===g(this,e))return new e(t);var n={},o={};x(o,t||{});var i=new D(o),u=new B(o),c=new F,a=new P(o,c,u),s=function(e,t){var n=o.globalHelpers,i=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,i)}))},l=function(e,t){var n=m(e,o.extension),r=i.create(t);return s(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return l(t,n)}return e}))};return this.configure=function(e){return x(o,e=e||{}),i.configure(o,n),u.configure(o),c.configure(o),a.configure(o),o},this.render=function(e,t){return l(e,t)},this.helpers=function(e){i.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return i.create(e)},this.helpers({require:function(e){var t=m(e,o.extension),n=i.create({});return s(t,n).then((function(){return n.getMacro()}))},render:l}),this}({resolver:function(e,t){return fetch(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t)).then((function(e){return e.text()}),(function(e){return new H(e)}))}}),X=K.render,Y=K.context,_=K.compile,z=K.helpers,G=K.preload,I=K.configure,Q=K.create;e.TemplateError=H,e.TemplateNotFound=L,e.TemplateSyntaxError=W,e.compile=_,e.configure=I,e.context=Y,e.create=Q,e.helpers=z,e.preload=G,e.render=X}));
|
package/dist/umd/element.js
CHANGED
package/dist/umd/element.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).element={})}(this,(function(n){"use strict";Object.prototype.toString.call("undefined"!=typeof process?process:0);var e={"&":"&","<":"<",">":">",'"':""","'":"'"},t=function(n){return new RegExp(["[",Object.keys(n).join(""),"]"].join(""),"g")},o=t(e);t({"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"});var r=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(o,(function(n){return e[n]}))},i=function(n,e,t){var o=[];return function(n,e){var t;for(t in n)u(n,t)&&e(n[t],t,n)}(n,(function(n,t,r){var i=e(n,t,r);!1==(void 0===i)&&o.push(i)})),o},u=function(n,e){return n&&n.hasOwnProperty(e)},f=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],a=" ",c='"',s="/",p="<",l=">";n.element=function(n,e,t){var o=[],u=-1===f.indexOf(n),d=i(e,(function(n,e){if(null!=n)return[r(e),[c,r(n),c].join("")].join("=")})).join(a);return o.push([p,n,a,d,l].join("")),t&&o.push(t instanceof Array?t.join(""):t),u&&o.push([p,s,n,l].join("")),o.join("")},n.safeValue=function(n,e){var t=n;return null==t?"":!0===Boolean(e)?r(t):t}}));
|
|
1
|
+
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).element={})}(this,(function(n){"use strict";Object.prototype.toString.call("undefined"!=typeof process?process:0);var e={"&":"&","<":"<",">":">",'"':""","'":"'"},t=function(n){return new RegExp(["[",Object.keys(n).join(""),"]"].join(""),"g")},o=t(e);t({"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"});var r=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(o,(function(n){return e[n]}))},i=function(n,e,t){var o=[];return function(n,e){var t;for(t in n)u(n,t)&&e(n[t],t,n)}(n,(function(n,t,r){var i=e(n,t,r);!1==(void 0===i)&&o.push(i)})),o},u=function(n,e){return n&&n.hasOwnProperty(e)},f=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],a=" ",c='"',s="/",p="<",l=">";n.element=function(n,e,t){var o=[],u=-1===f.indexOf(n),d=i(e,(function(n,e){if(null!=n)return[r(e),[c,r(n),c].join("")].join("=")})).join(a);return o.push([p,n,a,d,l].join("")),t&&u&&o.push(t instanceof Array?t.join(""):t),u&&o.push([p,s,n,l].join("")),o.join("")},n.safeValue=function(n,e){var t=n;return null==t?"":!0===Boolean(e)?r(t):t}}));
|
package/dist/umd/index.js
CHANGED
|
@@ -150,9 +150,6 @@
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
154
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
155
|
-
};
|
|
156
153
|
var hasProp = function hasProp(object, prop) {
|
|
157
154
|
return object && object.hasOwnProperty(prop);
|
|
158
155
|
};
|
|
@@ -293,7 +290,7 @@
|
|
|
293
290
|
compiler.matches = [];
|
|
294
291
|
compiler.formats = [];
|
|
295
292
|
compiler.slurp = {
|
|
296
|
-
match: '[
|
|
293
|
+
match: '[\s\t\n]*',
|
|
297
294
|
start: [compiler.token.start, '_'],
|
|
298
295
|
end: ['_', compiler.token.end]
|
|
299
296
|
};
|
|
@@ -424,7 +421,7 @@
|
|
|
424
421
|
}
|
|
425
422
|
}).join(space);
|
|
426
423
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
427
|
-
if (content) {
|
|
424
|
+
if (content && hasClosedTag) {
|
|
428
425
|
result.push(content instanceof Array ? content.join('') : content);
|
|
429
426
|
}
|
|
430
427
|
if (hasClosedTag) {
|
|
@@ -742,7 +739,7 @@
|
|
|
742
739
|
writable: false,
|
|
743
740
|
configurable: false,
|
|
744
741
|
enumerable: false
|
|
745
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
742
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
746
743
|
value: function value(name) {
|
|
747
744
|
var list = this.getMacro();
|
|
748
745
|
var macro = list[name];
|
|
@@ -797,24 +794,30 @@
|
|
|
797
794
|
writable: false,
|
|
798
795
|
configurable: false,
|
|
799
796
|
enumerable: false
|
|
797
|
+
}), "promiseResolve", {
|
|
798
|
+
value: function value(_value3, callback) {
|
|
799
|
+
return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
|
|
800
|
+
},
|
|
801
|
+
writable: false,
|
|
802
|
+
configurable: false,
|
|
803
|
+
enumerable: false
|
|
800
804
|
}), "use", {
|
|
801
805
|
value: function value(path, namespace) {
|
|
802
|
-
|
|
803
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
806
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
804
807
|
var list = this.getMacro();
|
|
805
808
|
each(exports, function (macro, name) {
|
|
806
809
|
list[[namespace, name].join('.')] = macro;
|
|
807
810
|
});
|
|
808
|
-
}
|
|
811
|
+
}));
|
|
809
812
|
},
|
|
810
813
|
writable: false,
|
|
811
814
|
configurable: false,
|
|
812
815
|
enumerable: false
|
|
813
816
|
}), "async", {
|
|
814
817
|
value: function value(promise, callback) {
|
|
815
|
-
this.echo(
|
|
818
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
816
819
|
return this.fn(callback)(data);
|
|
817
|
-
}
|
|
820
|
+
}));
|
|
818
821
|
},
|
|
819
822
|
writable: false,
|
|
820
823
|
configurable: false,
|
|
@@ -838,12 +841,9 @@
|
|
|
838
841
|
enumerable: false
|
|
839
842
|
}), "el", {
|
|
840
843
|
value: function value(tag, attr, content) {
|
|
841
|
-
|
|
842
|
-
content = this.fn(content)();
|
|
843
|
-
}
|
|
844
|
-
this.echo(resolve$1(content, function (content) {
|
|
844
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
845
845
|
return this.element(tag, attr, content);
|
|
846
|
-
}
|
|
846
|
+
}));
|
|
847
847
|
},
|
|
848
848
|
writable: false,
|
|
849
849
|
configurable: false,
|
package/dist/umd/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},o=function(e){return"string"==typeof e},i=function(e){return"boolean"==typeof e},c=function(e){return void 0===e},u="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=l(s),h=l(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return s[e]}))},b=function(e,t){var n=e;return null==n?"":!0===Boolean(t)?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var o=e,i=String(t).split("."),c=i.pop(),u=0;u<i.length;u++){var a=i[u];if(r(o.toJSON)&&(o=o.toJSON()),n&&!1===o.hasOwnProperty(a)){o={};break}o=o[a]=o[a]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,c]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)O(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,o,i){var u=t(e,o,i);!1===c(u)&&(n?r.push(u):r[o]=u)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t,n){return Promise.resolve(e).then(t.bind(n))},O=function(e,t){return e&&e.hasOwnProperty(t)},x={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},k=function(e,c){d(e,{path:t(o,x.path,e.path,c.path),export:t(o,x.export,e.export,c.export),resolver:t(r,x.resolver,e.resolver,c.resolver),extension:t(o,x.extension,e.extension,c.extension),withObject:t(i,x.withObject,e.withObject,c.withObject),rmWhitespace:t(i,x.rmWhitespace,e.rmWhitespace,c.rmWhitespace),cache:t(i,x.cache,e.cache,c.cache),token:d({},x.token,e.token,c.token),vars:d({},x.vars,e.vars,c.vars),globalHelpers:t(n,x.globalHelpers,e.globalHelpers,c.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function S(e){if(!1===g(this,S))return new S;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===u&&this.load(F[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return O(t.list,e)}}var P=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function B(e){if(!1===g(this,B))return new B(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[ \\t]*",start:[t.token.start,"_"],end:["_",t.token.end]},P.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,o=r.SCOPE,i=r.SAFE,c=r.BUFFER,u=r.COMPONENT,s=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var l,f,p,b="".concat(c,"('");l=t.regex,f=function(n,r,o){b+=(""+e.slice(r,o)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(c,".error(e)}"),t.withObject&&(b="with(".concat(o,"){").concat(b,"}")),b="".concat(c,".start();").concat(b,"return ").concat(c,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[o,u,c,i].concat(s);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n});")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function T(e,t,n){if(!1===g(this,T))return new T(e,t,n);if(!1===g(t,S))throw new TypeError("cache is not instance of Cache");if(!1===g(n,B))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(e){return o.resolver(o.path,e)};this.configure=function(e){o.path=e.path,o.cache=e.cache,r(e.resolver)&&(o.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):i(e).then((function(o){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(o,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],C=" ",$='"',A="/",M="<",U=">",H=function(e,t,n){var r=[],o=-1===N.indexOf(e),i=function(e,t){var n=[];return y(e,(function(e,r,o){var i=t(e,r,o);!1===c(i)&&n.push(i)})),n}(t,(function(e,t){if(null!=e)return[p(t),[$,p(e),$].join("")].join("=")})).join(C);return r.push([M,e,C,i,U].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([M,A,e,U].join("")),r.join("")};function L(e){this.name="TemplateError",this.message=e,Error.call(this)}function W(e){L.call(this),this.name="TemplateNotFound",this.message=e}function J(e){L.call(this),this.name="TemplateSyntaxError",this.message=e}function _(e){return Promise.all(e||[]).then((function(e){return e.join("")})).catch((function(e){return e}))}function q(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),_(n)},n.error=function(e){return t=e,Promise.reject(new J(t.message));var t},n.end=function(){return _(t)},n}function D(e){if(!1===g(this,D))return new D(e);this.configure=function(e,t){var n,i=e.vars,c=i.BLOCKS,u=i.MACRO,a=i.EXTEND,s=i.LAYOUT,l=i.BUFFER,f=i.COMPONENT;function h(e){this[c]={},this[u]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(R(R(R(R(R(R(R(R(R(n={},l,{value:q(),writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(e){this[s]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[s,a,l];return!0===e&&t.push(c),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),o=n.pop();return O(r,o)?r[o]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),o=n.pop();return this.getExtend()&&O(r,o)?r[o]:r[o]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),o=this;n[e]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var o=Object.assign([],r[e]),i=function(){return o.shift()},c=function(){var e=i();return e?function(){n.echo(e(c()))}:w};this.echo(i()(c()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),o=d(r,t||{}),i=this.render(e,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){var n=this.require(e);this.echo(E(n,(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(E(e,(function(e){return this.fn(t)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){o(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return H(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){r(n)&&(n=this.fn(n)()),this.echo(E(n,(function(n){return this.element(e,t,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(L.prototype,Error.prototype),Object.assign(L.prototype,{code:1}),L.prototype.getCode=function(){return this.code},L.prototype.getMessage=function(){return this.message},L.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(W.prototype,L.prototype),Object.assign(W.prototype,{code:404}),Object.setPrototypeOf(J.prototype,L.prototype),Object.assign(J.prototype,{code:500});var K={};var X=new function e(t){if(!1===g(this,e))return new e(t);var n={},o={};k(o,t||{});var i=new D(o),c=new B(o),u=new S,a=new T(o,u,c),s=function(e,t){var n=o.globalHelpers,i=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,i)}))},l=function(e,t){var n=m(e,o.extension),r=i.create(t);return s(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return l(t,n)}return e}))};return this.configure=function(e){return k(o,e=e||{}),i.configure(o,n),c.configure(o),u.configure(o),a.configure(o),o},this.render=function(e,t){return l(e,t)},this.helpers=function(e){i.helpers(d(n,e))},this.preload=function(e){return u.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return c.compile(e,t)},this.context=function(e){return i.create(e)},this.helpers({require:function(e){var t=m(e,o.extension),n=i.create({});return s(t,n).then((function(){return n.getMacro()}))},render:l}),this}({resolver:function(e,t){return new Promise((function(n,r){K.readFile(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t),(function(e,t){e?r(new L(e)):n(t.toString())}))}))}}),Y=X.render,z=X.context,G=X.compile,I=X.helpers,Q=X.preload,V=X.configure,Z=X.create,ee=function(e){return function(n,c,u){r(c)&&(u=c,c={});var a=d({},(c=c||{}).settings),s=t(o,x.path,a.views),l=t(i,x.cache,a["view cache"]),f=d({},a["view options"]),h=K.relative(s,n);return f.path=s,f.cache=l,e.configure(f),e.render(h,c).then((function(e){u(null,e)})).catch((function(e){u(e)}))}}(X);e.TemplateError=L,e.TemplateNotFound=W,e.TemplateSyntaxError=J,e.__express=ee,e.compile=G,e.configure=V,e.context=z,e.create=Z,e.helpers=I,e.preload=Q,e.render=Y}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var t=function(){var e=[].slice.call(arguments),t=e.shift();return e.filter(t).pop()},n=function(e){return Array.isArray(e)},r=function(e){return"function"==typeof e},o=function(e){return"string"==typeof e},i=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&","<":"<",">":">",'"':""","'":"'"},l=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},f=l(s),h=l(a),p=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(f,(function(e){return s[e]}))},b=function(e,t){var n=e;return null==n?"":!0===Boolean(t)?p(n):n},g=function(e,t){return Boolean(e instanceof t)},v=function(e,t,n){for(var o=e,i=String(t).split("."),u=i.pop(),c=0;c<i.length;c++){var a=i[c];if(r(o.toJSON)&&(o=o.toJSON()),n&&!1===o.hasOwnProperty(a)){o={};break}o=o[a]=o[a]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,u]},m=function(e,t){var n=e.split(".").pop();return n!==t&&(e=[e,t].join(".")),e},d=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return e})).reduce((function(e,t){return Object.assign(e,t)}),e)},w=function(){},y=function(e,t){var n;for(n in e)E(e,n)&&t(e[n],n,e)},j=function(e,t){return function(e,t){var n=e instanceof Array,r=n?[]:{};return y(e,(function(e,o,i){var c=t(e,o,i);!1===u(c)&&(n?r.push(c):r[o]=c)})),r}(e,(function(e,n){if(-1===t.indexOf(n))return e}))},E=function(e,t){return e&&e.hasOwnProperty(t)},O={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(e,t){return Promise.resolve(["resolver is not defined",e,t].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},x=function(e,u){d(e,{path:t(o,O.path,e.path,u.path),export:t(o,O.export,e.export,u.export),resolver:t(r,O.resolver,e.resolver,u.resolver),extension:t(o,O.extension,e.extension,u.extension),withObject:t(i,O.withObject,e.withObject,u.withObject),rmWhitespace:t(i,O.rmWhitespace,e.rmWhitespace,u.rmWhitespace),cache:t(i,O.cache,e.cache,u.cache),token:d({},O.token,e.token,u.token),vars:d({},O.vars,e.vars,u.vars),globalHelpers:t(n,O.globalHelpers,e.globalHelpers,u.globalHelpers)})},k="undefined"!=typeof globalThis?globalThis:window||self;function F(e){if(!1===g(this,F))return new F;var t={enabled:!0,list:{}};this.configure=function(e){t.enabled=e.cache,!1===c&&this.load(k[e.export])},this.clear=function(){t.list={}},this.load=function(e){return t.enabled&&d(t.list,e||{}),this},this.get=function(e){if(t.enabled)return t.list[e]},this.set=function(e,n){return t.enabled&&(t.list[e]=n),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete t.list[e]},this.exist=function(e){return E(t.list,e)}}var S=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function P(e){if(!1===g(this,P))return new P(e);var t={};this.configure=function(e){t.withObject=e.withObject,t.rmWhitespace=e.rmWhitespace,t.token=e.token,t.vars=e.vars,t.globalHelpers=e.globalHelpers,t.matches=[],t.formats=[],t.slurp={match:"[s\t\n]*",start:[t.token.start,"_"],end:["_",t.token.end]},S.forEach((function(e){t.matches.push(t.token.start.concat(e.symbol).concat(t.token.regex).concat(t.token.end)),t.formats.push(e.format.bind(t.vars))})),t.regex=new RegExp(t.matches.join("|").concat("|$"),"g"),t.slurpStart=new RegExp([t.slurp.match,t.slurp.start.join("")].join(""),"gm"),t.slurpEnd=new RegExp([t.slurp.end.join(""),t.slurp.match].join(""),"gm")},this.compile=function(e,n){var r=t.vars,o=r.SCOPE,i=r.SAFE,u=r.BUFFER,c=r.COMPONENT,s=t.globalHelpers;e=String(e),t.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(t.slurpStart,t.token.start).replace(t.slurpEnd,t.token.end);var l,f,p,b="".concat(u,"('");l=t.regex,f=function(n,r,o){b+=(""+e.slice(r,o)).replace(h,(function(e){return"\\"+a[e]})),n.forEach((function(e,n){e&&(b+=t.formats[n](e))}))},p=0,e.replace(l,(function(){var e=[].slice.call(arguments,0,-1),t=e.pop(),n=e.shift();return f(e,p,t),p=t+n.length,n})),b="try{".concat(b+="');","}catch(e){return ").concat(u,".error(e)}"),t.withObject&&(b="with(".concat(o,"){").concat(b,"}")),b="".concat(u,".start();").concat(b,"return ").concat(u,".end();"),b+="\n//# sourceURL=".concat(n);var g=null,v=[o,c,u,i].concat(s);try{(g=Function.apply(null,v.concat(b))).source="(function(".concat(v.join(","),"){\n").concat(b,"\n});")}catch(e){throw e.filename=n,e.source=b,e}return g},this.configure(e)}function B(e,t,n){if(!1===g(this,B))return new B(e,t,n);if(!1===g(t,F))throw new TypeError("cache is not instance of Cache");if(!1===g(n,P))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(e){return o.resolver(o.path,e)};this.configure=function(e){o.path=e.path,o.cache=e.cache,r(e.resolver)&&(o.resolver=e.resolver)},this.get=function(e){return t.exist(e)?t.resolve(e):i(e).then((function(o){return function(e,n){return t.set(e,n),n}(e,function(e,t){return r(e)?e:n.compile(e,t)}(o,e))}))},this.configure(e)}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],N=" ",C='"',$="/",A="<",M=">",U=function(e,t,n){var r=[],o=-1===T.indexOf(e),i=function(e,t){var n=[];return y(e,(function(e,r,o){var i=t(e,r,o);!1===u(i)&&n.push(i)})),n}(t,(function(e,t){if(null!=e)return[p(t),[C,p(e),C].join("")].join("=")})).join(N);return r.push([A,e,N,i,M].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([A,$,e,M].join("")),r.join("")};function H(e){this.name="TemplateError",this.message=e,Error.call(this)}function L(e){H.call(this),this.name="TemplateNotFound",this.message=e}function W(e){H.call(this),this.name="TemplateSyntaxError",this.message=e}function J(e){return Promise.all(e||[]).then((function(e){return e.join("")})).catch((function(e){return e}))}function _(){var e=[],t=[];function n(e){t.push(e)}return n.start=function(){t=[]},n.backup=function(){e.push(t.concat()),t=[]},n.restore=function(){var n=t.concat();return t=e.pop(),J(n)},n.error=function(e){return t=e,Promise.reject(new W(t.message));var t},n.end=function(){return J(t)},n}function q(e){if(!1===g(this,q))return new q(e);this.configure=function(e,t){var n,i=e.vars,u=i.BLOCKS,c=i.MACRO,a=i.EXTEND,s=i.LAYOUT,l=i.BUFFER,f=i.COMPONENT;function h(e){this[u]={},this[c]={},d(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){d(h.prototype,e||{})},h.prototype=d({},t||{}),Object.defineProperties(h.prototype,(R(R(R(R(R(R(R(R(R(R(n={},l,{value:_(),writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),c,{value:{},writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(e){this[s]=e},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(e){var t=[s,a,l];return!0===e&&t.push(u),j(this,t)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(e){var t=this.getBuffer();[].slice.call(arguments).forEach(t)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(e){var t=this.getBuffer(),n=this;return function(){return t.backup(),r(e)&&e.apply(n,arguments),t.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(e,t){var n=v(this,e,!0),r=n.shift(),o=n.pop();return E(r,o)?r[o]:t},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(e,t){var n=v(this,e,!1),r=n.shift(),o=n.pop();return this.getExtend()&&E(r,o)?r[o]:r[o]=t},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(e,t){var n=this.getMacro(),r=this.fn(t),o=this;n[e]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),R(R(R(R(R(R(R(R(R(R(n,"call",{value:function(e){var t=this.getMacro()[e],n=[].slice.call(arguments,1);if(r(t))return t.apply(t,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(e,t){var n=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(t)),!this.getExtend()){var o=Object.assign([],r[e]),i=function(){return o.shift()},u=function(){var e=i();return e?function(){n.echo(e(u()))}:w};this.echo(i()(u()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(e){return this.getBlocks().hasOwnProperty(e)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(e,t,n){var r=!1===n?{}:this.clone(!0),o=d(r,t||{}),i=this.render(e,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"promiseResolve",{value:function(e,t){return Promise.resolve(r(e)?this.fn(e)():e).then(t.bind(this))},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(e,t){this.echo(this.promiseResolve(this.require(e),(function(e){var n=this.getMacro();y(e,(function(e,r){n[[t,r].join(".")]=e}))})))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(e,t){this.echo(this.promiseResolve(e,(function(e){return this.fn(t)(e)})))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(e,t){o(e)&&(e=this.get(e,[])),y(e,t)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(e,t,n){return U(e,t,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(e,t,n){this.echo(this.promiseResolve(n,(function(n){return this.element(e,t,n)})))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(e)}Object.setPrototypeOf(H.prototype,Error.prototype),Object.assign(H.prototype,{code:1}),H.prototype.getCode=function(){return this.code},H.prototype.getMessage=function(){return this.message},H.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(L.prototype,H.prototype),Object.assign(L.prototype,{code:404}),Object.setPrototypeOf(W.prototype,H.prototype),Object.assign(W.prototype,{code:500});var D={};var K=new function e(t){if(!1===g(this,e))return new e(t);var n={},o={};x(o,t||{});var i=new q(o),u=new P(o),c=new F,a=new B(o,c,u),s=function(e,t){var n=o.globalHelpers,i=[t,t.getComponent(),t.getBuffer(),b].concat(n.filter((function(e){return r(t[e])})).map((function(e){return t[e].bind(t)})));return a.get(e).then((function(e){return e.apply(t,i)}))},l=function(e,t){var n=m(e,o.extension),r=i.create(t);return s(n,r).then((function(e){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),n=r.clone();return l(t,n)}return e}))};return this.configure=function(e){return x(o,e=e||{}),i.configure(o,n),u.configure(o),c.configure(o),a.configure(o),o},this.render=function(e,t){return l(e,t)},this.helpers=function(e){i.helpers(d(n,e))},this.preload=function(e){return c.load(e||{})},this.create=function(t){return new e(t)},this.compile=function(e,t){return u.compile(e,t)},this.context=function(e){return i.create(e)},this.helpers({require:function(e){var t=m(e,o.extension),n=i.create({});return s(t,n).then((function(){return n.getMacro()}))},render:l}),this}({resolver:function(e,t){return new Promise((function(n,r){D.readFile(function(e,t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(e,t),(function(e,t){e?r(new H(e)):n(t.toString())}))}))}}),X=K.render,Y=K.context,z=K.compile,G=K.helpers,I=K.preload,Q=K.configure,V=K.create,Z=function(e){return function(n,u,c){r(u)&&(c=u,u={});var a=d({},(u=u||{}).settings),s=t(o,O.path,a.views),l=t(i,O.cache,a["view cache"]),f=d({},a["view options"]),h=D.relative(s,n);return f.path=s,f.cache=l,e.configure(f),e.render(h,u).then((function(e){c(null,e)})).catch((function(e){c(e)}))}}(K);e.TemplateError=H,e.TemplateNotFound=L,e.TemplateSyntaxError=W,e.__express=Z,e.compile=z,e.configure=Q,e.context=Y,e.create=V,e.helpers=G,e.preload=I,e.render=X}));
|
package/dist/umd/worker.js
CHANGED
|
@@ -499,9 +499,6 @@
|
|
|
499
499
|
}
|
|
500
500
|
});
|
|
501
501
|
};
|
|
502
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
503
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
504
|
-
};
|
|
505
502
|
var hasProp = function hasProp(object, prop) {
|
|
506
503
|
return object && object.hasOwnProperty(prop);
|
|
507
504
|
};
|
|
@@ -637,7 +634,7 @@
|
|
|
637
634
|
compiler.matches = [];
|
|
638
635
|
compiler.formats = [];
|
|
639
636
|
compiler.slurp = {
|
|
640
|
-
match: '[
|
|
637
|
+
match: '[\s\t\n]*',
|
|
641
638
|
start: [compiler.token.start, '_'],
|
|
642
639
|
end: ['_', compiler.token.end]
|
|
643
640
|
};
|
|
@@ -745,7 +742,7 @@
|
|
|
745
742
|
}
|
|
746
743
|
}).join(space);
|
|
747
744
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
748
|
-
if (content) {
|
|
745
|
+
if (content && hasClosedTag) {
|
|
749
746
|
result.push(content instanceof Array ? content.join('') : content);
|
|
750
747
|
}
|
|
751
748
|
if (hasClosedTag) {
|
|
@@ -1063,7 +1060,7 @@
|
|
|
1063
1060
|
writable: false,
|
|
1064
1061
|
configurable: false,
|
|
1065
1062
|
enumerable: false
|
|
1066
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
1063
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
1067
1064
|
value: function value(name) {
|
|
1068
1065
|
var list = this.getMacro();
|
|
1069
1066
|
var macro = list[name];
|
|
@@ -1118,24 +1115,30 @@
|
|
|
1118
1115
|
writable: false,
|
|
1119
1116
|
configurable: false,
|
|
1120
1117
|
enumerable: false
|
|
1118
|
+
}), "promiseResolve", {
|
|
1119
|
+
value: function value(_value3, callback) {
|
|
1120
|
+
return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
|
|
1121
|
+
},
|
|
1122
|
+
writable: false,
|
|
1123
|
+
configurable: false,
|
|
1124
|
+
enumerable: false
|
|
1121
1125
|
}), "use", {
|
|
1122
1126
|
value: function value(path, namespace) {
|
|
1123
|
-
|
|
1124
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
1127
|
+
this.echo(this.promiseResolve(this.require(path), function (exports) {
|
|
1125
1128
|
var list = this.getMacro();
|
|
1126
1129
|
each(exports, function (macro, name) {
|
|
1127
1130
|
list[[namespace, name].join('.')] = macro;
|
|
1128
1131
|
});
|
|
1129
|
-
}
|
|
1132
|
+
}));
|
|
1130
1133
|
},
|
|
1131
1134
|
writable: false,
|
|
1132
1135
|
configurable: false,
|
|
1133
1136
|
enumerable: false
|
|
1134
1137
|
}), "async", {
|
|
1135
1138
|
value: function value(promise, callback) {
|
|
1136
|
-
this.echo(
|
|
1139
|
+
this.echo(this.promiseResolve(promise, function (data) {
|
|
1137
1140
|
return this.fn(callback)(data);
|
|
1138
|
-
}
|
|
1141
|
+
}));
|
|
1139
1142
|
},
|
|
1140
1143
|
writable: false,
|
|
1141
1144
|
configurable: false,
|
|
@@ -1159,12 +1162,9 @@
|
|
|
1159
1162
|
enumerable: false
|
|
1160
1163
|
}), "el", {
|
|
1161
1164
|
value: function value(tag, attr, content) {
|
|
1162
|
-
|
|
1163
|
-
content = this.fn(content)();
|
|
1164
|
-
}
|
|
1165
|
-
this.echo(resolve$1(content, function (content) {
|
|
1165
|
+
this.echo(this.promiseResolve(content, function (content) {
|
|
1166
1166
|
return this.element(tag, attr, content);
|
|
1167
|
-
}
|
|
1167
|
+
}));
|
|
1168
1168
|
},
|
|
1169
1169
|
writable: false,
|
|
1170
1170
|
configurable: false,
|
package/dist/umd/worker.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),c=new N(r||[]);return i(a,"_invoke",{value:P(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function y(){}function d(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(B([])));j&&j!==n&&o.call(j,c)&&(E=j);var O=w.prototype=y.prototype=Object.create(E);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,c){var u=h(t[r],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(e,n,r){var o=p;return function(i,a){if(o===g)throw Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=F(c,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?b:v,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=b,r.method="throw",r.arg=s.arg)}}}function F(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,F(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return d.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:d,configurable:!0}),d.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),l(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=B,N.prototype={constructor:N,reset:function(e){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(T),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;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),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},c=function(t){return"string"==typeof t},u=function(t){return"boolean"==typeof t},s=function(t){return void 0===t},l="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},h={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},v=p(h),g=p(f),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(v,(function(t){return h[t]}))},m=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?b(n):n},y=function(t,e){return Boolean(t instanceof e)},d=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),c=0;c<o.length;c++){var u=o[c];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},w=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},E=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},x=function(){},j=function(t,e){var n;for(n in t)k(t,n)&&e(t[n],n,t)},O=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return j(t,(function(t,o,i){var a=e(t,o,i);!1===s(a)&&(n?r.push(a):r[o]=a)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e,n){return Promise.resolve(t).then(e.bind(n))},k=function(t,e){return t&&t.hasOwnProperty(e)},P={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},F=function(t,e){E(t,{path:o(c,P.path,t.path,e.path),export:o(c,P.export,t.export,e.export),resolver:o(a,P.resolver,t.resolver,e.resolver),extension:o(c,P.extension,t.extension,e.extension),withObject:o(u,P.withObject,t.withObject,e.withObject),rmWhitespace:o(u,P.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(u,P.cache,t.cache,e.cache),token:E({},P.token,t.token,e.token),vars:E({},P.vars,t.vars,e.vars),globalHelpers:o(i,P.globalHelpers,t.globalHelpers,e.globalHelpers)})},S="undefined"!=typeof globalThis?globalThis:window||self;function T(t){if(!1===y(this,T))return new T;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===l&&this.load(S[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&E(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return k(e.list,t)}}var N=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function B(t){if(!1===y(this,B))return new B(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[ \\t]*",start:[e.token.start,"_"],end:["_",e.token.end]},N.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,u=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var s,l,h,p="".concat(a,"('");s=e.regex,l=function(n,r,o){p+=(""+t.slice(r,o)).replace(g,(function(t){return"\\"+f[t]})),n.forEach((function(t,n){t&&(p+=e.formats[n](t))}))},h=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,h,e),h=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(a,".error(e)}"),e.withObject&&(p="with(".concat(o,"){").concat(p,"}")),p="".concat(a,".start();").concat(p,"return ").concat(a,".end();"),p+="\n//# sourceURL=".concat(n);var v=null,b=[o,c,a,i].concat(u);try{(v=Function.apply(null,b.concat(p))).source="(function(".concat(b.join(","),"){\n").concat(p,"\n});")}catch(t){throw t.filename=n,t.source=p,t}return v},this.configure(t)}function R(t,e,n){if(!1===y(this,R))return new R(t,e,n);if(!1===y(e,T))throw new TypeError("cache is not instance of Cache");if(!1===y(n,B))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var _=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=" ",C='"',M="/",$="<",U=">",q=function(t,e,n){var r=[],o=-1===_.indexOf(t),i=function(t,e){var n=[];return j(t,(function(t,r,o){var i=e(t,r,o);!1===s(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[b(e),[C,b(t),C].join("")].join("=")})).join(A);return r.push([$,t,A,i,U].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([$,M,t,U].join("")),r.join("")};function H(t){this.name="TemplateError",this.message=t,Error.call(this)}function G(t){H.call(this),this.name="TemplateNotFound",this.message=t}function W(t){H.call(this),this.name="TemplateSyntaxError",this.message=t}function J(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function Y(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),J(n)},n.error=function(t){return e=t,Promise.reject(new W(e.message));var e},n.end=function(){return J(e)},n}function I(t){if(!1===y(this,I))return new I(t);this.configure=function(t,e){var r,o=t.vars,i=o.BLOCKS,u=o.MACRO,s=o.EXTEND,l=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[u]={},E(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){E(p.prototype,t||{})},p.prototype=E({},e||{}),Object.defineProperties(p.prototype,(n(n(n(n(n(n(n(n(n(n(r={},f,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),i,{value:{},writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(n(r,"getExtend",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(t){var e=[l,s,f];return!0===t&&e.push(i),O(this,e)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(t,e){var n=d(this,t,!0),r=n.shift(),o=n.pop();return k(r,o)?r[o]:e},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(t,e){var n=d(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(r,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},a=function(){var t=i();return t?function(){n.echo(t(a()))}:x};this.echo(i()(a()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=E(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(t,e){var n=this.require(t);this.echo(L(n,(function(t){var n=this.getMacro();j(t,(function(t,r){n[[e,r].join(".")]=t}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(t,e){this.echo(L(t,(function(t){return this.fn(e)(t)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(t,e){c(t)&&(t=this.get(t,[])),j(t,e)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(t,e,n){return q(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(t,e,n){a(n)&&(n=this.fn(n)()),this.echo(L(n,(function(n){return this.element(t,e,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(t)}Object.setPrototypeOf(H.prototype,Error.prototype),Object.assign(H.prototype,{code:1}),H.prototype.getCode=function(){return this.code},H.prototype.getMessage=function(){return this.message},H.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(G.prototype,H.prototype),Object.assign(G.prototype,{code:404}),Object.setPrototypeOf(W.prototype,H.prototype),Object.assign(W.prototype,{code:500});var D=Math.floor(1e12*Math.random()).toString(36),K={},X=new function t(e){if(!1===y(this,t))return new t(e);var n={},r={};F(r,e||{});var o=new I(r),i=new B(r),c=new T,u=new R(r,c,i),s=function(t,e){var n=r.globalHelpers,o=[e,e.getComponent(),e.getBuffer(),m].concat(n.filter((function(t){return a(e[t])})).map((function(t){return e[t].bind(e)})));return u.get(t).then((function(t){return t.apply(e,o)}))},l=function(t,e){var n=w(t,r.extension),i=o.create(e);return s(n,i).then((function(t){if(i.getExtend()){i.setExtend(!1);var e=i.getLayout(),n=i.clone();return l(e,n)}return t}))};return this.configure=function(t){return F(r,t=t||{}),o.configure(r,n),i.configure(r),c.configure(r),u.configure(r),r},this.render=function(t,e){return l(t,e)},this.helpers=function(t){o.helpers(E(n,t))},this.preload=function(t){return c.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=w(t,r.extension),n=o.create({});return s(e,n).then((function(){return n.getMacro()}))},render:l}),this}({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){K.hasOwnProperty(e)?t(K[e]):n(new G("template ".concat(e," not found")))}))}}),z=X.render,Q=X.context,V=X.helpers,Z=X.configure,tt=X.create,et=function(t,e){return t=new URL(t),e&&(t.protocol="https:"),t.origin};var nt=D;t.TemplateError=H,t.TemplateNotFound=G,t.TemplateSyntaxError=W,t.configure=Z,t.context=Q,t.create=tt,t.helpers=V,t.render=z,t.setRenderer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.version,o=void 0===n?D:n,i=t.secure,a=void 0===i||i;return function(){var t,n=(t=r().mark((function t(e,n){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.data=Q({}),e.data.set("version",o),e.data.set("origin",et(e.req.url,a)),e.data.set("path",e.req.path),e.data.set("query",e.req.query()),e.ejs=function(t,n){return z(t,Object.assign({param:e.req.param()},e.data,n))},e.helpers=function(t){return V(t)},e.render=function(t,n){return e.html(e.ejs(t,n))},t.next=10,n();case 10:case"end":return t.stop()}}),t)})),function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return n.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(K,t||{})},t.version=nt}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),c=new N(r||[]);return i(a,"_invoke",{value:P(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function y(){}function d(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(R([])));j&&j!==n&&o.call(j,c)&&(E=j);var O=w.prototype=y.prototype=Object.create(E);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,c){var u=h(t[r],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(e,n,r){var o=p;return function(i,a){if(o===g)throw Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=F(c,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?b:v,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=b,r.method="throw",r.arg=s.arg)}}}function F(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,F(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function R(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return d.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:d,configurable:!0}),d.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),l(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=R,N.prototype={constructor:N,reset:function(e){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(T),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;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),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},c=function(t){return"string"==typeof t},u=function(t){return"boolean"==typeof t},s=function(t){return void 0===t},l="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},h={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},v=p(h),g=p(f),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(v,(function(t){return h[t]}))},m=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?b(n):n},y=function(t,e){return Boolean(t instanceof e)},d=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),c=0;c<o.length;c++){var u=o[c];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},w=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},E=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},x=function(){},j=function(t,e){var n;for(n in t)L(t,n)&&e(t[n],n,t)},O=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return j(t,(function(t,o,i){var a=e(t,o,i);!1===s(a)&&(n?r.push(a):r[o]=a)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e){return t&&t.hasOwnProperty(e)},k={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},P=function(t,e){E(t,{path:o(c,k.path,t.path,e.path),export:o(c,k.export,t.export,e.export),resolver:o(a,k.resolver,t.resolver,e.resolver),extension:o(c,k.extension,t.extension,e.extension),withObject:o(u,k.withObject,t.withObject,e.withObject),rmWhitespace:o(u,k.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(u,k.cache,t.cache,e.cache),token:E({},k.token,t.token,e.token),vars:E({},k.vars,t.vars,e.vars),globalHelpers:o(i,k.globalHelpers,t.globalHelpers,e.globalHelpers)})},F="undefined"!=typeof globalThis?globalThis:window||self;function S(t){if(!1===y(this,S))return new S;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===l&&this.load(F[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&E(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return L(e.list,t)}}var T=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function N(t){if(!1===y(this,N))return new N(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[s\t\n]*",start:[e.token.start,"_"],end:["_",e.token.end]},T.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,u=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var s,l,h,p="".concat(a,"('");s=e.regex,l=function(n,r,o){p+=(""+t.slice(r,o)).replace(g,(function(t){return"\\"+f[t]})),n.forEach((function(t,n){t&&(p+=e.formats[n](t))}))},h=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,h,e),h=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(a,".error(e)}"),e.withObject&&(p="with(".concat(o,"){").concat(p,"}")),p="".concat(a,".start();").concat(p,"return ").concat(a,".end();"),p+="\n//# sourceURL=".concat(n);var v=null,b=[o,c,a,i].concat(u);try{(v=Function.apply(null,b.concat(p))).source="(function(".concat(b.join(","),"){\n").concat(p,"\n});")}catch(t){throw t.filename=n,t.source=p,t}return v},this.configure(t)}function R(t,e,n){if(!1===y(this,R))return new R(t,e,n);if(!1===y(e,S))throw new TypeError("cache is not instance of Cache");if(!1===y(n,N))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var B=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],_=" ",A='"',C="/",M="<",$=">",U=function(t,e,n){var r=[],o=-1===B.indexOf(t),i=function(t,e){var n=[];return j(t,(function(t,r,o){var i=e(t,r,o);!1===s(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[b(e),[A,b(t),A].join("")].join("=")})).join(_);return r.push([M,t,_,i,$].join("")),n&&o&&r.push(n instanceof Array?n.join(""):n),o&&r.push([M,C,t,$].join("")),r.join("")};function q(t){this.name="TemplateError",this.message=t,Error.call(this)}function H(t){q.call(this),this.name="TemplateNotFound",this.message=t}function G(t){q.call(this),this.name="TemplateSyntaxError",this.message=t}function W(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function J(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),W(n)},n.error=function(t){return e=t,Promise.reject(new G(e.message));var e},n.end=function(){return W(e)},n}function Y(t){if(!1===y(this,Y))return new Y(t);this.configure=function(t,e){var r,o=t.vars,i=o.BLOCKS,u=o.MACRO,s=o.EXTEND,l=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[u]={},E(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){E(p.prototype,t||{})},p.prototype=E({},e||{}),Object.defineProperties(p.prototype,(n(n(n(n(n(n(n(n(n(n(r={},f,{value:J(),writable:!0,configurable:!1,enumerable:!1}),i,{value:{},writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(n(r,"getExtend",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(t){var e=[l,s,f];return!0===t&&e.push(i),O(this,e)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(t,e){var n=d(this,t,!0),r=n.shift(),o=n.pop();return L(r,o)?r[o]:e},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(t,e){var n=d(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&L(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(n(r,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},a=function(){var t=i();return t?function(){n.echo(t(a()))}:x};this.echo(i()(a()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=E(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"promiseResolve",{value:function(t,e){return Promise.resolve(a(t)?this.fn(t)():t).then(e.bind(this))},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(t,e){this.echo(this.promiseResolve(this.require(t),(function(t){var n=this.getMacro();j(t,(function(t,r){n[[e,r].join(".")]=t}))})))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(t,e){this.echo(this.promiseResolve(t,(function(t){return this.fn(e)(t)})))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(t,e){c(t)&&(t=this.get(t,[])),j(t,e)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(t,e,n){return U(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(t,e,n){this.echo(this.promiseResolve(n,(function(n){return this.element(t,e,n)})))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(t)}Object.setPrototypeOf(q.prototype,Error.prototype),Object.assign(q.prototype,{code:1}),q.prototype.getCode=function(){return this.code},q.prototype.getMessage=function(){return this.message},q.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(H.prototype,q.prototype),Object.assign(H.prototype,{code:404}),Object.setPrototypeOf(G.prototype,q.prototype),Object.assign(G.prototype,{code:500});var I=Math.floor(1e12*Math.random()).toString(36),D={},K=new function t(e){if(!1===y(this,t))return new t(e);var n={},r={};P(r,e||{});var o=new Y(r),i=new N(r),c=new S,u=new R(r,c,i),s=function(t,e){var n=r.globalHelpers,o=[e,e.getComponent(),e.getBuffer(),m].concat(n.filter((function(t){return a(e[t])})).map((function(t){return e[t].bind(e)})));return u.get(t).then((function(t){return t.apply(e,o)}))},l=function(t,e){var n=w(t,r.extension),i=o.create(e);return s(n,i).then((function(t){if(i.getExtend()){i.setExtend(!1);var e=i.getLayout(),n=i.clone();return l(e,n)}return t}))};return this.configure=function(t){return P(r,t=t||{}),o.configure(r,n),i.configure(r),c.configure(r),u.configure(r),r},this.render=function(t,e){return l(t,e)},this.helpers=function(t){o.helpers(E(n,t))},this.preload=function(t){return c.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=w(t,r.extension),n=o.create({});return s(e,n).then((function(){return n.getMacro()}))},render:l}),this}({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){D.hasOwnProperty(e)?t(D[e]):n(new H("template ".concat(e," not found")))}))}}),X=K.render,z=K.context,Q=K.helpers,V=K.configure,Z=K.create,tt=function(t,e){return t=new URL(t),e&&(t.protocol="https:"),t.origin};var et=I;t.TemplateError=q,t.TemplateNotFound=H,t.TemplateSyntaxError=G,t.configure=V,t.context=z,t.create=Z,t.helpers=Q,t.render=X,t.setRenderer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.version,o=void 0===n?I:n,i=t.secure,a=void 0===i||i;return function(){var t,n=(t=r().mark((function t(e,n){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.data=z({}),e.data.set("version",o),e.data.set("origin",tt(e.req.url,a)),e.data.set("path",e.req.path),e.data.set("query",e.req.query()),e.ejs=function(t,n){return X(t,Object.assign({param:e.req.param()},e.data,n))},e.helpers=function(t){return Q(t)},e.render=function(t,n){return e.html(e.ejs(t,n))},t.next=10,n();case 10:case"end":return t.stop()}}),t)})),function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return n.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(D,t||{})},t.version=et}));
|
package/package.json
CHANGED