@kosatyi/ejs 0.0.54 → 0.0.56
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/README.md +1 -1
- package/dist/cjs/index.js +306 -264
- package/dist/esm/index.js +304 -289
- package/dist/umd/element.js +92 -0
- package/dist/umd/element.min.js +1 -0
- package/dist/umd/index.js +823 -781
- package/dist/umd/index.min.js +1 -1
- package/package.json +7 -8
- package/{global.d.ts → type/global.d.ts} +1 -48
- package/element.d.ts +0 -11
- /package/{index.d.ts → type/index.d.ts} +0 -0
package/dist/umd/index.js
CHANGED
|
@@ -1,800 +1,855 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ejs = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function _typeof(o) {
|
|
8
|
+
"@babel/helpers - typeof";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
SCOPE: 'ejs',
|
|
19
|
-
COMPONENT: 'ui',
|
|
20
|
-
EXTEND: '$$e',
|
|
21
|
-
BUFFER: '$$a',
|
|
22
|
-
LAYOUT: '$$l',
|
|
23
|
-
BLOCKS: '$$b',
|
|
24
|
-
MACRO: '$$m',
|
|
25
|
-
SAFE: '$$v'
|
|
26
|
-
};
|
|
27
|
-
defaults.token = {
|
|
28
|
-
start: '<%',
|
|
29
|
-
end: '%>',
|
|
30
|
-
regex: '([\\s\\S]+?)'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function _typeof(obj) {
|
|
34
|
-
"@babel/helpers - typeof";
|
|
35
|
-
|
|
36
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
37
|
-
return typeof obj;
|
|
38
|
-
} : function (obj) {
|
|
39
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
40
|
-
}, _typeof(obj);
|
|
10
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
11
|
+
return typeof o;
|
|
12
|
+
} : function (o) {
|
|
13
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
14
|
+
}, _typeof(o);
|
|
15
|
+
}
|
|
16
|
+
function _classCallCheck(instance, Constructor) {
|
|
17
|
+
if (!(instance instanceof Constructor)) {
|
|
18
|
+
throw new TypeError("Cannot call a class as a function");
|
|
41
19
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
}
|
|
21
|
+
function _defineProperties(target, props) {
|
|
22
|
+
for (var i = 0; i < props.length; i++) {
|
|
23
|
+
var descriptor = props[i];
|
|
24
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
25
|
+
descriptor.configurable = true;
|
|
26
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
27
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
46
28
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Object.defineProperty(
|
|
60
|
-
|
|
29
|
+
}
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
31
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
32
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
33
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
34
|
+
writable: false
|
|
35
|
+
});
|
|
36
|
+
return Constructor;
|
|
37
|
+
}
|
|
38
|
+
function _defineProperty(obj, key, value) {
|
|
39
|
+
key = _toPropertyKey(key);
|
|
40
|
+
if (key in obj) {
|
|
41
|
+
Object.defineProperty(obj, key, {
|
|
42
|
+
value: value,
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true
|
|
61
46
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function _defineProperty(obj, key, value) {
|
|
65
|
-
key = _toPropertyKey(key);
|
|
66
|
-
if (key in obj) {
|
|
67
|
-
Object.defineProperty(obj, key, {
|
|
68
|
-
value: value,
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true,
|
|
71
|
-
writable: true
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
obj[key] = value;
|
|
75
|
-
}
|
|
76
|
-
return obj;
|
|
77
|
-
}
|
|
78
|
-
function _toPrimitive(input, hint) {
|
|
79
|
-
if (typeof input !== "object" || input === null) return input;
|
|
80
|
-
var prim = input[Symbol.toPrimitive];
|
|
81
|
-
if (prim !== undefined) {
|
|
82
|
-
var res = prim.call(input, hint || "default");
|
|
83
|
-
if (typeof res !== "object") return res;
|
|
84
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
85
|
-
}
|
|
86
|
-
return (hint === "string" ? String : Number)(input);
|
|
47
|
+
} else {
|
|
48
|
+
obj[key] = value;
|
|
87
49
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
function _toPrimitive(input, hint) {
|
|
53
|
+
if (typeof input !== "object" || input === null) return input;
|
|
54
|
+
var prim = input[Symbol.toPrimitive];
|
|
55
|
+
if (prim !== undefined) {
|
|
56
|
+
var res = prim.call(input, hint || "default");
|
|
57
|
+
if (typeof res !== "object") return res;
|
|
58
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
91
59
|
}
|
|
60
|
+
return (hint === "string" ? String : Number)(input);
|
|
61
|
+
}
|
|
62
|
+
function _toPropertyKey(arg) {
|
|
63
|
+
var key = _toPrimitive(arg, "string");
|
|
64
|
+
return typeof key === "symbol" ? key : String(key);
|
|
65
|
+
}
|
|
92
66
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
67
|
+
var typeProp = function typeProp() {
|
|
68
|
+
var args = [].slice.call(arguments);
|
|
69
|
+
var callback = args.shift();
|
|
70
|
+
return args.filter(callback).pop();
|
|
71
|
+
};
|
|
72
|
+
var isFunction = function isFunction(v) {
|
|
73
|
+
return typeof v === 'function';
|
|
74
|
+
};
|
|
75
|
+
var isString = function isString(v) {
|
|
76
|
+
return typeof v === 'string';
|
|
77
|
+
};
|
|
78
|
+
var isBoolean = function isBoolean(v) {
|
|
79
|
+
return typeof v === 'boolean';
|
|
80
|
+
};
|
|
81
|
+
var isObject = function isObject(v) {
|
|
82
|
+
return _typeof(v) === 'object';
|
|
83
|
+
};
|
|
84
|
+
var isUndefined = function isUndefined(v) {
|
|
85
|
+
return typeof v === 'undefined';
|
|
86
|
+
};
|
|
113
87
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
88
|
+
var isNodeEnv = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
|
89
|
+
var isNode = function isNode() {
|
|
90
|
+
return isNodeEnv;
|
|
91
|
+
};
|
|
92
|
+
var symbolEntities = {
|
|
93
|
+
"'": "'",
|
|
94
|
+
'\\': '\\',
|
|
95
|
+
'\r': 'r',
|
|
96
|
+
'\n': 'n',
|
|
97
|
+
'\t': 't',
|
|
98
|
+
"\u2028": 'u2028',
|
|
99
|
+
"\u2029": 'u2029'
|
|
100
|
+
};
|
|
101
|
+
var htmlEntities = {
|
|
102
|
+
'&': '&',
|
|
103
|
+
'<': '<',
|
|
104
|
+
'>': '>',
|
|
105
|
+
'"': '"',
|
|
106
|
+
"'": '''
|
|
107
|
+
};
|
|
108
|
+
var regexKeys = function regexKeys(obj) {
|
|
109
|
+
return new RegExp(['[', Object.keys(obj).join(''), ']'].join(''), 'g');
|
|
110
|
+
};
|
|
111
|
+
var htmlEntitiesMatch = regexKeys(htmlEntities);
|
|
112
|
+
var symbolEntitiesMatch = regexKeys(symbolEntities);
|
|
113
|
+
var entities = function entities() {
|
|
114
|
+
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
115
|
+
return ('' + string).replace(htmlEntitiesMatch, function (match) {
|
|
116
|
+
return htmlEntities[match];
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
var symbols = function symbols(string) {
|
|
120
|
+
return ('' + string).replace(symbolEntitiesMatch, function (match) {
|
|
121
|
+
return '\\' + symbolEntities[match];
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
var safeValue = function safeValue(value, escape, check) {
|
|
125
|
+
return (check = value) == null ? '' : escape ? entities(check) : check;
|
|
126
|
+
};
|
|
127
|
+
var getPath = function getPath(context, name) {
|
|
128
|
+
var data = context;
|
|
129
|
+
var chunk = name.split('.');
|
|
130
|
+
var prop = chunk.pop();
|
|
131
|
+
chunk.forEach(function (part) {
|
|
132
|
+
data = data[part] = data[part] || {};
|
|
133
|
+
});
|
|
134
|
+
return [data, prop];
|
|
135
|
+
};
|
|
136
|
+
var bindContext = function bindContext(object, context) {
|
|
137
|
+
var methods = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
138
|
+
methods.forEach(function (name) {
|
|
139
|
+
if (name in object) {
|
|
140
|
+
object[name] = object[name].bind(context);
|
|
166
141
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
var ext = function ext(path, defaults) {
|
|
145
|
+
var ext = path.split('.').pop();
|
|
146
|
+
if (ext !== defaults) {
|
|
147
|
+
path = [path, defaults].join('.');
|
|
148
|
+
}
|
|
149
|
+
return path;
|
|
150
|
+
};
|
|
151
|
+
var extend = function extend() {
|
|
152
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
153
|
+
args[_key] = arguments[_key];
|
|
154
|
+
}
|
|
155
|
+
var target = args.shift();
|
|
156
|
+
return args.filter(function (source) {
|
|
157
|
+
return source;
|
|
158
|
+
}).reduce(function (target, source) {
|
|
159
|
+
return Object.assign(target, source);
|
|
160
|
+
}, target);
|
|
161
|
+
};
|
|
162
|
+
var noop = function noop() {};
|
|
163
|
+
var each = function each(object, callback) {
|
|
164
|
+
var prop;
|
|
165
|
+
for (prop in object) {
|
|
166
|
+
if (hasProp(object, prop)) {
|
|
167
|
+
callback(object[prop], prop, object);
|
|
187
168
|
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
var map = function map(object, callback, context) {
|
|
172
|
+
var result = [];
|
|
173
|
+
each(object, function (value, key, object) {
|
|
174
|
+
var item = callback(value, key, object);
|
|
175
|
+
if (isUndefined(item) === false) {
|
|
176
|
+
result.push(item);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
return result;
|
|
180
|
+
};
|
|
181
|
+
var filter = function filter(object, callback, context) {
|
|
182
|
+
var isArray = object instanceof Array;
|
|
183
|
+
var result = isArray ? [] : {};
|
|
184
|
+
each(object, function (value, key, object) {
|
|
185
|
+
var item = callback(value, key, object);
|
|
186
|
+
if (isUndefined(item) === false) {
|
|
187
|
+
if (isArray) {
|
|
194
188
|
result.push(item);
|
|
189
|
+
} else {
|
|
190
|
+
result[key] = item;
|
|
195
191
|
}
|
|
196
|
-
});
|
|
197
|
-
return result;
|
|
198
|
-
};
|
|
199
|
-
var filter = function filter(object, callback, context) {
|
|
200
|
-
var isArray = object instanceof Array;
|
|
201
|
-
var result = isArray ? [] : {};
|
|
202
|
-
each(object, function (value, key, object) {
|
|
203
|
-
var item = callback(value, key, object);
|
|
204
|
-
if (isUndefined(item) === false) {
|
|
205
|
-
if (isArray) {
|
|
206
|
-
result.push(item);
|
|
207
|
-
} else {
|
|
208
|
-
result[key] = item;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
return result;
|
|
213
|
-
};
|
|
214
|
-
var omit = function omit(object, list) {
|
|
215
|
-
return filter(object, function (value, key) {
|
|
216
|
-
if (list.indexOf(key) === -1) {
|
|
217
|
-
return value;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
|
-
var resolve$1 = function resolve(value, callback, context) {
|
|
222
|
-
return Promise.resolve(value).then(callback.bind(context));
|
|
223
|
-
};
|
|
224
|
-
var hasProp = function hasProp(object, prop) {
|
|
225
|
-
return object && object.hasOwnProperty(prop);
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
229
|
-
var space = ' ';
|
|
230
|
-
var quote = '"';
|
|
231
|
-
var equal = '=';
|
|
232
|
-
var slash = '/';
|
|
233
|
-
var lt = '<';
|
|
234
|
-
var gt = '>';
|
|
235
|
-
var element = function element(tag, attrs, content) {
|
|
236
|
-
var result = [];
|
|
237
|
-
var hasClosedTag = selfClosed.indexOf(tag) === -1;
|
|
238
|
-
var attributes = map(attrs, function (value, key) {
|
|
239
|
-
if (value !== null && value !== undefined) {
|
|
240
|
-
return [entities(key), [quote, entities(value), quote].join('')].join(equal);
|
|
241
|
-
}
|
|
242
|
-
}).join(space);
|
|
243
|
-
result.push([lt, tag, space, attributes, gt].join(''));
|
|
244
|
-
if (content) {
|
|
245
|
-
result.push(content instanceof Array ? content.join('') : content);
|
|
246
192
|
}
|
|
247
|
-
|
|
248
|
-
|
|
193
|
+
});
|
|
194
|
+
return result;
|
|
195
|
+
};
|
|
196
|
+
var omit = function omit(object, list) {
|
|
197
|
+
return filter(object, function (value, key) {
|
|
198
|
+
if (list.indexOf(key) === -1) {
|
|
199
|
+
return value;
|
|
249
200
|
}
|
|
250
|
-
|
|
251
|
-
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
var resolve$1 = function resolve(value, callback, context) {
|
|
204
|
+
return Promise.resolve(value).then(callback.bind(context));
|
|
205
|
+
};
|
|
206
|
+
var hasProp = function hasProp(object, prop) {
|
|
207
|
+
return object && object.hasOwnProperty(prop);
|
|
208
|
+
};
|
|
252
209
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var params = [].slice.call(arguments, 0, -1);
|
|
278
|
-
var offset = params.pop();
|
|
279
|
-
var match = params.shift();
|
|
280
|
-
callback(params, index, offset);
|
|
281
|
-
index = offset + match.length;
|
|
282
|
-
return match;
|
|
283
|
-
});
|
|
284
|
-
};
|
|
285
|
-
var Compiler = /*#__PURE__*/function () {
|
|
286
|
-
function Compiler(config) {
|
|
287
|
-
_classCallCheck(this, Compiler);
|
|
288
|
-
this.configure(config);
|
|
289
|
-
}
|
|
290
|
-
_createClass(Compiler, [{
|
|
291
|
-
key: "configure",
|
|
292
|
-
value: function configure(config) {
|
|
293
|
-
var _this = this;
|
|
294
|
-
this.withObject = config.withObject;
|
|
295
|
-
this.rmWhitespace = config.rmWhitespace;
|
|
296
|
-
this.token = config.token;
|
|
297
|
-
this.vars = config.vars;
|
|
298
|
-
this.matches = [];
|
|
299
|
-
this.formats = [];
|
|
300
|
-
this.slurp = {
|
|
301
|
-
match: '[ \\t]*',
|
|
302
|
-
start: [this.token.start, '_'],
|
|
303
|
-
end: ['_', this.token.end]
|
|
304
|
-
};
|
|
305
|
-
tagList.forEach(function (item) {
|
|
306
|
-
_this.matches.push(_this.token.start.concat(item.symbol).concat(_this.token.regex).concat(_this.token.end));
|
|
307
|
-
_this.formats.push(item.format.bind(_this.vars));
|
|
308
|
-
});
|
|
309
|
-
this.regex = new RegExp(this.matches.join('|').concat('|$'), 'g');
|
|
310
|
-
this.slurpStart = new RegExp([this.slurp.match, this.slurp.start.join('')].join(''), 'gm');
|
|
311
|
-
this.slurpEnd = new RegExp([this.slurp.end.join(''), this.slurp.match].join(''), 'gm');
|
|
312
|
-
}
|
|
313
|
-
}, {
|
|
314
|
-
key: "truncate",
|
|
315
|
-
value: function truncate(value) {
|
|
316
|
-
return value && value.replace(/^(?:\r\n|\r|\n)/, '');
|
|
317
|
-
}
|
|
318
|
-
}, {
|
|
319
|
-
key: "compile",
|
|
320
|
-
value: function compile(content, path) {
|
|
321
|
-
var _this2 = this;
|
|
322
|
-
var _this$vars = this.vars,
|
|
323
|
-
SCOPE = _this$vars.SCOPE,
|
|
324
|
-
SAFE = _this$vars.SAFE,
|
|
325
|
-
BUFFER = _this$vars.BUFFER,
|
|
326
|
-
COMPONENT = _this$vars.COMPONENT;
|
|
327
|
-
if (this.rmWhitespace) {
|
|
328
|
-
content = content.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
|
|
329
|
-
}
|
|
330
|
-
content = content.replace(this.slurpStart, this.token.start).replace(this.slurpEnd, this.token.end);
|
|
331
|
-
var source = "".concat(BUFFER, "('");
|
|
332
|
-
matchTokens(this.regex, content, function (params, index, offset) {
|
|
333
|
-
source += symbols(content.slice(index, offset));
|
|
334
|
-
params.forEach(function (value, index) {
|
|
335
|
-
if (value) {
|
|
336
|
-
source += _this2.formats[index](value);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
source += "');";
|
|
341
|
-
source = "try{".concat(source, "}catch(e){console.info(e)}");
|
|
342
|
-
if (this.withObject) {
|
|
343
|
-
source = "with(".concat(SCOPE, "){").concat(source, "}");
|
|
344
|
-
}
|
|
345
|
-
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
346
|
-
source += "\n//# sourceURL=".concat(path);
|
|
347
|
-
var result = null;
|
|
348
|
-
try {
|
|
349
|
-
result = new Function(SCOPE, COMPONENT, BUFFER, SAFE, source);
|
|
350
|
-
result.source = "(function(".concat(SCOPE, ",").concat(COMPONENT, ",").concat(BUFFER, ",").concat(SAFE, "){\n").concat(source, "\n})");
|
|
351
|
-
} catch (e) {
|
|
352
|
-
e.filename = path;
|
|
353
|
-
e.source = source;
|
|
354
|
-
throw e;
|
|
355
|
-
}
|
|
356
|
-
return result;
|
|
357
|
-
}
|
|
358
|
-
}]);
|
|
359
|
-
return Compiler;
|
|
360
|
-
}();
|
|
210
|
+
var defaults = {};
|
|
211
|
+
defaults["export"] = 'ejsPrecompiled';
|
|
212
|
+
defaults.watch = false;
|
|
213
|
+
defaults.chokidar = null;
|
|
214
|
+
defaults.path = 'views';
|
|
215
|
+
defaults.resolver = null;
|
|
216
|
+
defaults.extension = 'ejs';
|
|
217
|
+
defaults.rmWhitespace = true;
|
|
218
|
+
defaults.withObject = true;
|
|
219
|
+
defaults.vars = {
|
|
220
|
+
SCOPE: 'ejs',
|
|
221
|
+
COMPONENT: 'ui',
|
|
222
|
+
EXTEND: '$$e',
|
|
223
|
+
BUFFER: '$$a',
|
|
224
|
+
LAYOUT: '$$l',
|
|
225
|
+
BLOCKS: '$$b',
|
|
226
|
+
MACRO: '$$m',
|
|
227
|
+
SAFE: '$$v'
|
|
228
|
+
};
|
|
229
|
+
defaults.token = {
|
|
230
|
+
start: '<%',
|
|
231
|
+
end: '%>',
|
|
232
|
+
regex: '([\\s\\S]+?)'
|
|
233
|
+
};
|
|
361
234
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
235
|
+
var configSchema = function configSchema(config, options) {
|
|
236
|
+
extend(config, {
|
|
237
|
+
path: typeProp(isString, defaults.path, config.path, options.path),
|
|
238
|
+
"export": typeProp(isString, defaults["export"], config["export"], options["export"]),
|
|
239
|
+
resolver: typeProp(isFunction, defaults.resolver, config.resolver, options.resolver),
|
|
240
|
+
extension: typeProp(isString, defaults.extension, config.extension, options.extension),
|
|
241
|
+
withObject: typeProp(isBoolean, defaults.withObject, config.withObject, options.withObject),
|
|
242
|
+
rmWhitespace: typeProp(isBoolean, defaults.rmWhitespace, config.rmWhitespace, options.rmWhitespace),
|
|
243
|
+
watch: typeProp(isBoolean, defaults.watch, config.watch, options.watch),
|
|
244
|
+
chokidar: typeProp(isObject, defaults["export"], config["export"], options["export"]),
|
|
245
|
+
token: extend({}, defaults.token, config.token, options.token),
|
|
246
|
+
vars: extend({}, defaults.vars, config.vars, options.vars)
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
var path = {};
|
|
251
|
+
|
|
252
|
+
var resolvePath = function resolvePath(path, template) {
|
|
253
|
+
template = [path, template].join('/');
|
|
254
|
+
template = template.replace(/\/\//g, '/');
|
|
255
|
+
return template;
|
|
256
|
+
};
|
|
257
|
+
var httpRequest = function httpRequest(path, template) {
|
|
258
|
+
return fetch(resolvePath(path, template)).then(function (response) {
|
|
259
|
+
return response.text();
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
var fileSystem = function fileSystem(path$1, template) {
|
|
263
|
+
return new Promise(function (resolve, reject) {
|
|
264
|
+
path.readFile(resolvePath(path$1, template), function (error, data) {
|
|
265
|
+
if (error) {
|
|
266
|
+
reject(error);
|
|
267
|
+
} else {
|
|
268
|
+
resolve(data.toString());
|
|
269
|
+
}
|
|
370
270
|
});
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
var Template = /*#__PURE__*/function () {
|
|
274
|
+
function Template(config, cache, compiler) {
|
|
275
|
+
_classCallCheck(this, Template);
|
|
276
|
+
this.cache = cache;
|
|
277
|
+
this.watcher = {
|
|
278
|
+
unwatch: function unwatch() {},
|
|
279
|
+
on: function on() {}
|
|
280
|
+
};
|
|
281
|
+
this.compiler = compiler;
|
|
282
|
+
this.configure(config);
|
|
283
|
+
}
|
|
284
|
+
_createClass(Template, [{
|
|
285
|
+
key: "configure",
|
|
286
|
+
value: function configure(config) {
|
|
287
|
+
var _this = this;
|
|
288
|
+
this.path = config.path;
|
|
289
|
+
this.chokidar = config.chokidar;
|
|
290
|
+
this.resolver = isFunction(config.resolver) ? config.resolver : isNode() ? fileSystem : httpRequest;
|
|
291
|
+
if (config.watch && isNode()) {
|
|
292
|
+
if (this.watcher) {
|
|
293
|
+
this.watcher.unwatch('.');
|
|
379
294
|
}
|
|
380
|
-
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
var Template = /*#__PURE__*/function () {
|
|
384
|
-
function Template(config, cache, compiler) {
|
|
385
|
-
_classCallCheck(this, Template);
|
|
386
|
-
this.cache = cache;
|
|
387
|
-
this.watcher = null;
|
|
388
|
-
this.compiler = compiler;
|
|
389
|
-
this.configure(config);
|
|
390
|
-
}
|
|
391
|
-
_createClass(Template, [{
|
|
392
|
-
key: "configure",
|
|
393
|
-
value: function configure(config) {
|
|
394
|
-
var _this = this;
|
|
395
|
-
this.path = config.path;
|
|
396
|
-
this.chokidar = config.chokidar;
|
|
397
|
-
this.resolver = isFunction(config.resolver) ? config.resolver : isNode() ? fileSystem : httpRequest;
|
|
398
|
-
if (config.watch && config.chokidar && isNode()) {
|
|
399
|
-
if (this.watcher) {
|
|
400
|
-
this.watcher.unwatch('.');
|
|
401
|
-
}
|
|
295
|
+
if (this.chokidar) {
|
|
402
296
|
this.watcher = this.chokidar.watch('.', {
|
|
403
297
|
cwd: this.path
|
|
404
298
|
}).on('change', function (name) {
|
|
405
299
|
_this.cache.remove(name);
|
|
406
|
-
}).on('error', function (error) {
|
|
407
|
-
console.log('watcher error: ' + error);
|
|
408
300
|
});
|
|
409
301
|
}
|
|
410
302
|
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
key: "resolve",
|
|
306
|
+
value: function resolve(template) {
|
|
307
|
+
return this.resolver(this.path, template);
|
|
308
|
+
}
|
|
309
|
+
}, {
|
|
310
|
+
key: "result",
|
|
311
|
+
value: function result(template, content) {
|
|
312
|
+
this.cache.set(template, content);
|
|
313
|
+
return content;
|
|
314
|
+
}
|
|
315
|
+
}, {
|
|
316
|
+
key: "compile",
|
|
317
|
+
value: function compile(content, template) {
|
|
318
|
+
if (isFunction(content)) {
|
|
420
319
|
return content;
|
|
320
|
+
} else {
|
|
321
|
+
return this.compiler.compile(content, template);
|
|
421
322
|
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "get",
|
|
326
|
+
value: function get(template) {
|
|
327
|
+
var _this2 = this;
|
|
328
|
+
if (this.cache.exist(template)) {
|
|
329
|
+
return this.cache.resolve(template);
|
|
430
330
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
331
|
+
var content = this.resolve(template).then(function (content) {
|
|
332
|
+
return _this2.result(template, _this2.compile(content, template));
|
|
333
|
+
});
|
|
334
|
+
return this.result(template, content);
|
|
335
|
+
}
|
|
336
|
+
}]);
|
|
337
|
+
return Template;
|
|
338
|
+
}();
|
|
339
|
+
|
|
340
|
+
var tagList = [{
|
|
341
|
+
symbol: '-',
|
|
342
|
+
format: function format(value) {
|
|
343
|
+
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, ",1))\n").concat(this.BUFFER, "('");
|
|
344
|
+
}
|
|
345
|
+
}, {
|
|
346
|
+
symbol: '=',
|
|
347
|
+
format: function format(value) {
|
|
348
|
+
return "')\n".concat(this.BUFFER, "(").concat(this.SAFE, "(").concat(value, "))\n").concat(this.BUFFER, "('");
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
symbol: '#',
|
|
352
|
+
format: function format(value) {
|
|
353
|
+
return "')\n/**".concat(value, "**/\n").concat(this.BUFFER, "('");
|
|
354
|
+
}
|
|
355
|
+
}, {
|
|
356
|
+
symbol: '',
|
|
357
|
+
format: function format(value) {
|
|
358
|
+
return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
|
|
359
|
+
}
|
|
360
|
+
}];
|
|
361
|
+
var matchTokens = function matchTokens(regex, text, callback) {
|
|
362
|
+
var index = 0;
|
|
363
|
+
text.replace(regex, function () {
|
|
364
|
+
var params = [].slice.call(arguments, 0, -1);
|
|
365
|
+
var offset = params.pop();
|
|
366
|
+
var match = params.shift();
|
|
367
|
+
callback(params, index, offset);
|
|
368
|
+
index = offset + match.length;
|
|
369
|
+
return match;
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
var Compiler = /*#__PURE__*/function () {
|
|
373
|
+
function Compiler(config) {
|
|
374
|
+
_classCallCheck(this, Compiler);
|
|
375
|
+
this.configure(config);
|
|
376
|
+
}
|
|
377
|
+
_createClass(Compiler, [{
|
|
378
|
+
key: "configure",
|
|
379
|
+
value: function configure(config) {
|
|
380
|
+
var _this = this;
|
|
381
|
+
this.withObject = config.withObject;
|
|
382
|
+
this.rmWhitespace = config.rmWhitespace;
|
|
383
|
+
this.token = config.token;
|
|
384
|
+
this.vars = config.vars;
|
|
385
|
+
this.matches = [];
|
|
386
|
+
this.formats = [];
|
|
387
|
+
this.slurp = {
|
|
388
|
+
match: '[ \\t]*',
|
|
389
|
+
start: [this.token.start, '_'],
|
|
390
|
+
end: ['_', this.token.end]
|
|
391
|
+
};
|
|
392
|
+
tagList.forEach(function (item) {
|
|
393
|
+
_this.matches.push(_this.token.start.concat(item.symbol).concat(_this.token.regex).concat(_this.token.end));
|
|
394
|
+
_this.formats.push(item.format.bind(_this.vars));
|
|
395
|
+
});
|
|
396
|
+
this.regex = new RegExp(this.matches.join('|').concat('|$'), 'g');
|
|
397
|
+
this.slurpStart = new RegExp([this.slurp.match, this.slurp.start.join('')].join(''), 'gm');
|
|
398
|
+
this.slurpEnd = new RegExp([this.slurp.end.join(''), this.slurp.match].join(''), 'gm');
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
key: "truncate",
|
|
402
|
+
value: function truncate(value) {
|
|
403
|
+
return value && value.replace(/^(?:\r\n|\r|\n)/, '');
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "compile",
|
|
407
|
+
value: function compile(content, path) {
|
|
408
|
+
var _this2 = this;
|
|
409
|
+
var _this$vars = this.vars,
|
|
410
|
+
SCOPE = _this$vars.SCOPE,
|
|
411
|
+
SAFE = _this$vars.SAFE,
|
|
412
|
+
BUFFER = _this$vars.BUFFER,
|
|
413
|
+
COMPONENT = _this$vars.COMPONENT;
|
|
414
|
+
if (this.rmWhitespace) {
|
|
415
|
+
content = content.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
|
|
416
|
+
}
|
|
417
|
+
content = content.replace(this.slurpStart, this.token.start).replace(this.slurpEnd, this.token.end);
|
|
418
|
+
var source = "".concat(BUFFER, "('");
|
|
419
|
+
matchTokens(this.regex, content, function (params, index, offset) {
|
|
420
|
+
source += symbols(content.slice(index, offset));
|
|
421
|
+
params.forEach(function (value, index) {
|
|
422
|
+
if (value) {
|
|
423
|
+
source += _this2.formats[index](value);
|
|
424
|
+
}
|
|
440
425
|
});
|
|
441
|
-
|
|
426
|
+
});
|
|
427
|
+
source += "');";
|
|
428
|
+
source = "try{".concat(source, "}catch(e){console.info(e)}");
|
|
429
|
+
if (this.withObject) {
|
|
430
|
+
source = "with(".concat(SCOPE, "){").concat(source, "}");
|
|
431
|
+
}
|
|
432
|
+
source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
|
|
433
|
+
source += "\n//# sourceURL=".concat(path);
|
|
434
|
+
var result = null;
|
|
435
|
+
try {
|
|
436
|
+
result = new Function(SCOPE, COMPONENT, BUFFER, SAFE, source);
|
|
437
|
+
result.source = "(function(".concat(SCOPE, ",").concat(COMPONENT, ",").concat(BUFFER, ",").concat(SAFE, "){\n").concat(source, "\n})");
|
|
438
|
+
} catch (e) {
|
|
439
|
+
e.filename = path;
|
|
440
|
+
e.source = source;
|
|
441
|
+
throw e;
|
|
442
442
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
443
|
+
return result;
|
|
444
|
+
}
|
|
445
|
+
}]);
|
|
446
|
+
return Compiler;
|
|
447
|
+
}();
|
|
446
448
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
|
|
450
|
+
var Cache = /*#__PURE__*/function () {
|
|
451
|
+
function Cache(config) {
|
|
452
|
+
_classCallCheck(this, Cache);
|
|
453
|
+
_defineProperty(this, "list", {});
|
|
454
|
+
this.configure(config);
|
|
455
|
+
if (isNode() === false) {
|
|
456
|
+
this.load(global[this.namespace]);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
_createClass(Cache, [{
|
|
460
|
+
key: "configure",
|
|
461
|
+
value: function configure(config) {
|
|
462
|
+
this.list = {};
|
|
463
|
+
this.namespace = config["export"];
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "load",
|
|
467
|
+
value: function load(data) {
|
|
468
|
+
extend(this.list, data);
|
|
469
|
+
return this;
|
|
470
|
+
}
|
|
471
|
+
}, {
|
|
472
|
+
key: "exist",
|
|
473
|
+
value: function exist(key) {
|
|
474
|
+
return hasProp(this.list, key);
|
|
475
|
+
}
|
|
476
|
+
}, {
|
|
477
|
+
key: "get",
|
|
478
|
+
value: function get(key) {
|
|
479
|
+
return this.list[key];
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "remove",
|
|
483
|
+
value: function remove(key) {
|
|
484
|
+
delete this.list[key];
|
|
485
|
+
}
|
|
486
|
+
}, {
|
|
487
|
+
key: "resolve",
|
|
488
|
+
value: function resolve(key) {
|
|
489
|
+
return Promise.resolve(this.get(key));
|
|
490
|
+
}
|
|
491
|
+
}, {
|
|
492
|
+
key: "set",
|
|
493
|
+
value: function set(key, value) {
|
|
494
|
+
this.list[key] = value;
|
|
495
|
+
return this;
|
|
496
|
+
}
|
|
497
|
+
}]);
|
|
498
|
+
return Cache;
|
|
499
|
+
}();
|
|
500
|
+
|
|
501
|
+
var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
502
|
+
var space = ' ';
|
|
503
|
+
var quote = '"';
|
|
504
|
+
var equal = '=';
|
|
505
|
+
var slash = '/';
|
|
506
|
+
var lt = '<';
|
|
507
|
+
var gt = '>';
|
|
508
|
+
var element = function element(tag, attrs, content) {
|
|
509
|
+
var result = [];
|
|
510
|
+
var hasClosedTag = selfClosed.indexOf(tag) === -1;
|
|
511
|
+
var attributes = map(attrs, function (value, key) {
|
|
512
|
+
if (value !== null && value !== undefined) {
|
|
513
|
+
return [entities(key), [quote, entities(value), quote].join('')].join(equal);
|
|
514
|
+
}
|
|
515
|
+
}).join(space);
|
|
516
|
+
result.push([lt, tag, space, attributes, gt].join(''));
|
|
517
|
+
if (content) {
|
|
518
|
+
result.push(content instanceof Array ? content.join('') : content);
|
|
519
|
+
}
|
|
520
|
+
if (hasClosedTag) {
|
|
521
|
+
result.push([lt, slash, tag, gt].join(''));
|
|
522
|
+
}
|
|
523
|
+
return result.join('');
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
var resolve = function resolve(list) {
|
|
527
|
+
return Promise.all(list).then(function (list) {
|
|
528
|
+
return list.join('');
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
var createBuffer = function createBuffer() {
|
|
532
|
+
var store = [],
|
|
533
|
+
array = [];
|
|
534
|
+
function buffer(value) {
|
|
535
|
+
array.push(value);
|
|
536
|
+
}
|
|
537
|
+
buffer.start = function () {
|
|
538
|
+
array = [];
|
|
451
539
|
};
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
};
|
|
461
|
-
buffer.backup = function () {
|
|
462
|
-
store.push(array.concat());
|
|
463
|
-
array = [];
|
|
464
|
-
};
|
|
465
|
-
buffer.restore = function () {
|
|
466
|
-
var result = array.concat();
|
|
467
|
-
array = store.pop();
|
|
468
|
-
return resolve(result);
|
|
469
|
-
};
|
|
470
|
-
buffer.error = function (e) {
|
|
471
|
-
throw e;
|
|
472
|
-
};
|
|
473
|
-
buffer.end = function () {
|
|
474
|
-
return resolve(array);
|
|
475
|
-
};
|
|
476
|
-
return buffer;
|
|
540
|
+
buffer.backup = function () {
|
|
541
|
+
store.push(array.concat());
|
|
542
|
+
array = [];
|
|
543
|
+
};
|
|
544
|
+
buffer.restore = function () {
|
|
545
|
+
var result = array.concat();
|
|
546
|
+
array = store.pop();
|
|
547
|
+
return resolve(result);
|
|
477
548
|
};
|
|
549
|
+
buffer.error = function (e) {
|
|
550
|
+
throw e;
|
|
551
|
+
};
|
|
552
|
+
buffer.end = function () {
|
|
553
|
+
return resolve(array);
|
|
554
|
+
};
|
|
555
|
+
return buffer;
|
|
556
|
+
};
|
|
478
557
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
558
|
+
var Context = /*#__PURE__*/function () {
|
|
559
|
+
function Context(config) {
|
|
560
|
+
_classCallCheck(this, Context);
|
|
561
|
+
this.configure(config);
|
|
562
|
+
}
|
|
563
|
+
_createClass(Context, [{
|
|
564
|
+
key: "configure",
|
|
565
|
+
value: function configure(config, methods) {
|
|
566
|
+
var _config$vars = config.vars,
|
|
567
|
+
EXTEND = _config$vars.EXTEND,
|
|
568
|
+
LAYOUT = _config$vars.LAYOUT,
|
|
569
|
+
BLOCKS = _config$vars.BLOCKS,
|
|
570
|
+
BUFFER = _config$vars.BUFFER,
|
|
571
|
+
MACRO = _config$vars.MACRO,
|
|
572
|
+
COMPONENT = _config$vars.COMPONENT;
|
|
573
|
+
this.create = function (data) {
|
|
574
|
+
return new Scope(data);
|
|
575
|
+
};
|
|
576
|
+
this.helpers = function (methods) {
|
|
577
|
+
extend(Scope.prototype, methods);
|
|
578
|
+
};
|
|
579
|
+
function Scope() {
|
|
580
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
581
|
+
this.initBlocks();
|
|
582
|
+
this.initMacro();
|
|
583
|
+
extend(this, data);
|
|
584
|
+
}
|
|
585
|
+
Scope.prototype = extend({}, methods || {});
|
|
586
|
+
/**
|
|
587
|
+
* @param {string} name
|
|
588
|
+
* @param {*} value
|
|
589
|
+
* @param {boolean} [writable]
|
|
590
|
+
* @param {boolean} [configurable]
|
|
591
|
+
* @param {boolean} [enumerable]
|
|
592
|
+
*/
|
|
593
|
+
Scope.define = Scope.method = function (name, value, writable, configurable, enumerable) {
|
|
594
|
+
return Object.defineProperty(Scope.prototype, name, {
|
|
595
|
+
value: value,
|
|
596
|
+
writable: writable || false,
|
|
597
|
+
configurable: configurable || false,
|
|
598
|
+
enumerable: enumerable || false
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
Scope.define(BUFFER, createBuffer());
|
|
602
|
+
Scope.define(BLOCKS, {}, true);
|
|
603
|
+
Scope.define(MACRO, {}, true);
|
|
604
|
+
Scope.define(LAYOUT, false, true);
|
|
605
|
+
Scope.define(EXTEND, false, true);
|
|
606
|
+
Scope.method('initBlocks', function () {
|
|
607
|
+
this[BLOCKS] = {};
|
|
608
|
+
});
|
|
609
|
+
Scope.method('initMacro', function () {
|
|
610
|
+
this[MACRO] = {};
|
|
611
|
+
});
|
|
612
|
+
Scope.method('getMacro', function () {
|
|
613
|
+
return this[MACRO];
|
|
614
|
+
});
|
|
615
|
+
Scope.method('getBuffer', function () {
|
|
616
|
+
return this[BUFFER];
|
|
617
|
+
});
|
|
618
|
+
Scope.method('getComponent', function () {
|
|
619
|
+
var context = this;
|
|
620
|
+
if (COMPONENT in context) {
|
|
621
|
+
return function () {
|
|
622
|
+
return context[COMPONENT].apply(context, arguments);
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
return function () {
|
|
626
|
+
console.log('%s function not defined', COMPONENT);
|
|
496
627
|
};
|
|
497
|
-
|
|
498
|
-
|
|
628
|
+
});
|
|
629
|
+
Scope.method('getBlocks', function () {
|
|
630
|
+
return this[BLOCKS];
|
|
631
|
+
});
|
|
632
|
+
Scope.method('setExtend', function (value) {
|
|
633
|
+
this[EXTEND] = value;
|
|
634
|
+
});
|
|
635
|
+
Scope.method('getExtend', function () {
|
|
636
|
+
return this[EXTEND];
|
|
637
|
+
});
|
|
638
|
+
Scope.method('setLayout', function (layout) {
|
|
639
|
+
this[LAYOUT] = layout;
|
|
640
|
+
});
|
|
641
|
+
Scope.method('getLayout', function () {
|
|
642
|
+
return this[LAYOUT];
|
|
643
|
+
});
|
|
644
|
+
Scope.method('clone', function (exclude_blocks) {
|
|
645
|
+
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
646
|
+
if (exclude_blocks === true) {
|
|
647
|
+
filter.push(BLOCKS);
|
|
648
|
+
}
|
|
649
|
+
return omit(this, filter);
|
|
650
|
+
});
|
|
651
|
+
Scope.method('extend', function (layout) {
|
|
652
|
+
this.setExtend(true);
|
|
653
|
+
this.setLayout(layout);
|
|
654
|
+
});
|
|
655
|
+
Scope.method('echo', function () {
|
|
656
|
+
var buffer = this.getBuffer();
|
|
657
|
+
var params = [].slice.call(arguments);
|
|
658
|
+
params.forEach(buffer);
|
|
659
|
+
});
|
|
660
|
+
Scope.method('fn', function (callback) {
|
|
661
|
+
var buffer = this.getBuffer();
|
|
662
|
+
var context = this;
|
|
663
|
+
return function () {
|
|
664
|
+
buffer.backup();
|
|
665
|
+
if (isFunction(callback)) {
|
|
666
|
+
callback.apply(context, arguments);
|
|
667
|
+
}
|
|
668
|
+
return buffer.restore();
|
|
499
669
|
};
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
670
|
+
});
|
|
671
|
+
Scope.method('get', function (name, defaults) {
|
|
672
|
+
var path = getPath(this, name);
|
|
673
|
+
var result = path.shift();
|
|
674
|
+
var prop = path.pop();
|
|
675
|
+
return hasProp(result, prop) ? result[prop] : defaults;
|
|
676
|
+
});
|
|
677
|
+
Scope.method('set', function (name, value) {
|
|
678
|
+
var path = getPath(this, name);
|
|
679
|
+
var result = path.shift();
|
|
680
|
+
var prop = path.pop();
|
|
681
|
+
if (this.getExtend() && hasProp(result, prop)) {
|
|
682
|
+
return result[prop];
|
|
505
683
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
Scope.define = Scope.method = function (name, value, writable, configurable, enumerable) {
|
|
515
|
-
return Object.defineProperty(Scope.prototype, name, {
|
|
516
|
-
value: value,
|
|
517
|
-
writable: writable || false,
|
|
518
|
-
configurable: configurable || false,
|
|
519
|
-
enumerable: enumerable || false
|
|
520
|
-
});
|
|
684
|
+
return result[prop] = value;
|
|
685
|
+
});
|
|
686
|
+
Scope.method('macro', function (name, callback) {
|
|
687
|
+
var list = this.getMacro();
|
|
688
|
+
var macro = this.fn(callback);
|
|
689
|
+
var context = this;
|
|
690
|
+
list[name] = function () {
|
|
691
|
+
return context.echo(macro.apply(undefined, arguments));
|
|
521
692
|
};
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
693
|
+
});
|
|
694
|
+
Scope.method('call', function (name) {
|
|
695
|
+
var list = this.getMacro();
|
|
696
|
+
var macro = list[name];
|
|
697
|
+
var params = [].slice.call(arguments, 1);
|
|
698
|
+
if (isFunction(macro)) {
|
|
699
|
+
return macro.apply(macro, params);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
Scope.method('block', function (name, callback) {
|
|
703
|
+
var _this = this;
|
|
704
|
+
var blocks = this.getBlocks();
|
|
705
|
+
blocks[name] = blocks[name] || [];
|
|
706
|
+
blocks[name].push(this.fn(callback));
|
|
707
|
+
if (this.getExtend()) return;
|
|
708
|
+
var list = Object.assign([], blocks[name]);
|
|
709
|
+
var current = function current() {
|
|
710
|
+
return list.shift();
|
|
711
|
+
};
|
|
712
|
+
var next = function next() {
|
|
713
|
+
var parent = current();
|
|
714
|
+
if (parent) {
|
|
542
715
|
return function () {
|
|
543
|
-
|
|
716
|
+
_this.echo(parent(next()));
|
|
544
717
|
};
|
|
718
|
+
} else {
|
|
719
|
+
return noop;
|
|
545
720
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
});
|
|
559
|
-
Scope.method('setLayout', function (layout) {
|
|
560
|
-
this[LAYOUT] = layout;
|
|
561
|
-
});
|
|
562
|
-
Scope.method('getLayout', function () {
|
|
563
|
-
return this[LAYOUT];
|
|
564
|
-
});
|
|
565
|
-
Scope.method('clone', function (exclude_blocks) {
|
|
566
|
-
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
567
|
-
if (exclude_blocks === true) {
|
|
568
|
-
filter.push(BLOCKS);
|
|
569
|
-
}
|
|
570
|
-
return omit(this, filter);
|
|
571
|
-
});
|
|
572
|
-
Scope.method('extend', function (layout) {
|
|
573
|
-
this.setExtend(true);
|
|
574
|
-
this.setLayout(layout);
|
|
575
|
-
});
|
|
576
|
-
Scope.method('echo', function () {
|
|
577
|
-
var buffer = this.getBuffer();
|
|
578
|
-
var params = [].slice.call(arguments);
|
|
579
|
-
params.forEach(buffer);
|
|
580
|
-
});
|
|
581
|
-
Scope.method('fn', function (callback) {
|
|
582
|
-
var buffer = this.getBuffer();
|
|
583
|
-
var context = this;
|
|
584
|
-
return function () {
|
|
585
|
-
buffer.backup();
|
|
586
|
-
if (isFunction(callback)) {
|
|
587
|
-
callback.apply(context, arguments);
|
|
588
|
-
}
|
|
589
|
-
return buffer.restore();
|
|
590
|
-
};
|
|
591
|
-
});
|
|
592
|
-
Scope.method('get', function (name, defaults) {
|
|
593
|
-
var path = getPath(this, name);
|
|
594
|
-
var result = path.shift();
|
|
595
|
-
var prop = path.pop();
|
|
596
|
-
return hasProp(result, prop) ? result[prop] : defaults;
|
|
597
|
-
});
|
|
598
|
-
Scope.method('set', function (name, value) {
|
|
599
|
-
var path = getPath(this, name);
|
|
600
|
-
var result = path.shift();
|
|
601
|
-
var prop = path.pop();
|
|
602
|
-
if (this.getExtend() && hasProp(result, prop)) {
|
|
603
|
-
return result[prop];
|
|
604
|
-
}
|
|
605
|
-
return result[prop] = value;
|
|
606
|
-
});
|
|
607
|
-
Scope.method('macro', function (name, callback) {
|
|
608
|
-
var list = this.getMacro();
|
|
609
|
-
var macro = this.fn(callback);
|
|
610
|
-
var context = this;
|
|
611
|
-
list[name] = function () {
|
|
612
|
-
return context.echo(macro.apply(undefined, arguments));
|
|
613
|
-
};
|
|
614
|
-
});
|
|
615
|
-
Scope.method('call', function (name) {
|
|
721
|
+
};
|
|
722
|
+
this.echo(current()(next()));
|
|
723
|
+
});
|
|
724
|
+
Scope.method('include', function (path, data, cx) {
|
|
725
|
+
var context = cx === false ? {} : this.clone(true);
|
|
726
|
+
var params = extend(context, data || {});
|
|
727
|
+
var promise = this.render(path, params);
|
|
728
|
+
this.echo(promise);
|
|
729
|
+
});
|
|
730
|
+
Scope.method('use', function (path, namespace) {
|
|
731
|
+
var promise = this.require(path);
|
|
732
|
+
this.echo(resolve$1(promise, function (exports) {
|
|
616
733
|
var list = this.getMacro();
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
if (parent) {
|
|
636
|
-
return function () {
|
|
637
|
-
_this.echo(parent(next()));
|
|
638
|
-
};
|
|
639
|
-
} else {
|
|
640
|
-
return noop;
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
this.echo(current()(next()));
|
|
644
|
-
});
|
|
645
|
-
Scope.method('include', function (path, data, cx) {
|
|
646
|
-
var context = cx === false ? {} : this.clone(true);
|
|
647
|
-
var params = extend(context, data || {});
|
|
648
|
-
var promise = this.render(path, params);
|
|
649
|
-
this.echo(promise);
|
|
650
|
-
});
|
|
651
|
-
Scope.method('use', function (path, namespace) {
|
|
652
|
-
var promise = this.require(path);
|
|
653
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
654
|
-
var list = this.getMacro();
|
|
655
|
-
each(exports, function (macro, name) {
|
|
656
|
-
list[[namespace, name].join('.')] = macro;
|
|
657
|
-
});
|
|
658
|
-
}, this));
|
|
659
|
-
});
|
|
660
|
-
Scope.method('async', function (promise, callback) {
|
|
661
|
-
this.echo(resolve$1(promise, function (data) {
|
|
662
|
-
return this.fn(callback)(data);
|
|
663
|
-
}, this));
|
|
664
|
-
});
|
|
665
|
-
Scope.method('node', function (tag, attr, content) {
|
|
734
|
+
each(exports, function (macro, name) {
|
|
735
|
+
list[[namespace, name].join('.')] = macro;
|
|
736
|
+
});
|
|
737
|
+
}, this));
|
|
738
|
+
});
|
|
739
|
+
Scope.method('async', function (promise, callback) {
|
|
740
|
+
this.echo(resolve$1(promise, function (data) {
|
|
741
|
+
return this.fn(callback)(data);
|
|
742
|
+
}, this));
|
|
743
|
+
});
|
|
744
|
+
Scope.method('node', function (tag, attr, content) {
|
|
745
|
+
return element(tag, attr, content);
|
|
746
|
+
});
|
|
747
|
+
Scope.method('el', function (tag, attr, content) {
|
|
748
|
+
if (isFunction(content)) {
|
|
749
|
+
content = this.fn(content)();
|
|
750
|
+
}
|
|
751
|
+
this.echo(resolve$1(content, function (content) {
|
|
666
752
|
return element(tag, attr, content);
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
});
|
|
676
|
-
Scope.method('each', function (object, callback) {
|
|
677
|
-
if (isString(object)) {
|
|
678
|
-
object = this.get(object, []);
|
|
679
|
-
}
|
|
680
|
-
each(object, callback);
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
}]);
|
|
684
|
-
return Context;
|
|
685
|
-
}();
|
|
686
|
-
|
|
687
|
-
var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
|
|
688
|
-
var Cache = /*#__PURE__*/function () {
|
|
689
|
-
function Cache(config) {
|
|
690
|
-
_classCallCheck(this, Cache);
|
|
691
|
-
_defineProperty(this, "list", {});
|
|
692
|
-
this.configure(config);
|
|
693
|
-
if (isNode() === false) {
|
|
694
|
-
this.load(global[this.namespace]);
|
|
695
|
-
}
|
|
753
|
+
}, this));
|
|
754
|
+
});
|
|
755
|
+
Scope.method('each', function (object, callback) {
|
|
756
|
+
if (isString(object)) {
|
|
757
|
+
object = this.get(object, []);
|
|
758
|
+
}
|
|
759
|
+
each(object, callback);
|
|
760
|
+
});
|
|
696
761
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
this.list = {};
|
|
701
|
-
this.namespace = config["export"];
|
|
702
|
-
}
|
|
703
|
-
}, {
|
|
704
|
-
key: "load",
|
|
705
|
-
value: function load(data) {
|
|
706
|
-
extend(this.list, data);
|
|
707
|
-
return this;
|
|
708
|
-
}
|
|
709
|
-
}, {
|
|
710
|
-
key: "exist",
|
|
711
|
-
value: function exist(key) {
|
|
712
|
-
return hasProp(this.list, key);
|
|
713
|
-
}
|
|
714
|
-
}, {
|
|
715
|
-
key: "get",
|
|
716
|
-
value: function get(key) {
|
|
717
|
-
return this.list[key];
|
|
718
|
-
}
|
|
719
|
-
}, {
|
|
720
|
-
key: "remove",
|
|
721
|
-
value: function remove(key) {
|
|
722
|
-
delete this.list[key];
|
|
723
|
-
}
|
|
724
|
-
}, {
|
|
725
|
-
key: "resolve",
|
|
726
|
-
value: function resolve(key) {
|
|
727
|
-
return Promise.resolve(this.get(key));
|
|
728
|
-
}
|
|
729
|
-
}, {
|
|
730
|
-
key: "set",
|
|
731
|
-
value: function set(key, value) {
|
|
732
|
-
this.list[key] = value;
|
|
733
|
-
return this;
|
|
734
|
-
}
|
|
735
|
-
}]);
|
|
736
|
-
return Cache;
|
|
737
|
-
}();
|
|
762
|
+
}]);
|
|
763
|
+
return Context;
|
|
764
|
+
}();
|
|
738
765
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
766
|
+
var EJS = /*#__PURE__*/function () {
|
|
767
|
+
function EJS() {
|
|
768
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
769
|
+
_classCallCheck(this, EJS);
|
|
770
|
+
_defineProperty(this, "export", ['cache', 'render', 'require', 'helpers', 'configure', 'preload', 'compiler', '__express']);
|
|
771
|
+
this.config = {};
|
|
772
|
+
this.scope = {};
|
|
773
|
+
configSchema(this.config, options);
|
|
774
|
+
bindContext(this, this, this["export"]);
|
|
775
|
+
this.context = new Context(this.config);
|
|
776
|
+
this.compiler = new Compiler(this.config);
|
|
777
|
+
this.cache = new Cache(this.config);
|
|
778
|
+
this.template = new Template(this.config, this.cache, this.compiler);
|
|
779
|
+
this.helpers({
|
|
780
|
+
require: this.require,
|
|
781
|
+
render: this.render
|
|
751
782
|
});
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
return
|
|
768
|
-
};
|
|
769
|
-
var output = function output(path, scope) {
|
|
770
|
-
return template.get(path).then(function (callback) {
|
|
783
|
+
}
|
|
784
|
+
_createClass(EJS, [{
|
|
785
|
+
key: "configure",
|
|
786
|
+
value: function configure() {
|
|
787
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
788
|
+
configSchema(this.config, options);
|
|
789
|
+
this.context.configure(this.config, this.scope);
|
|
790
|
+
this.compiler.configure(this.config);
|
|
791
|
+
this.cache.configure(this.config);
|
|
792
|
+
this.template.configure(this.config);
|
|
793
|
+
return this.config;
|
|
794
|
+
}
|
|
795
|
+
}, {
|
|
796
|
+
key: "output",
|
|
797
|
+
value: function output(path, scope) {
|
|
798
|
+
return this.template.get(path).then(function (callback) {
|
|
771
799
|
return callback.call(scope, scope, scope.getComponent(), scope.getBuffer(), safeValue);
|
|
772
800
|
});
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
var render = function render(name, data) {
|
|
782
|
-
var filepath = ext(name, config.extension);
|
|
783
|
-
var scope = context.create(data);
|
|
784
|
-
return output(filepath, scope).then(function (content) {
|
|
801
|
+
}
|
|
802
|
+
}, {
|
|
803
|
+
key: "render",
|
|
804
|
+
value: function render(name, data) {
|
|
805
|
+
var _this = this;
|
|
806
|
+
var filepath = ext(name, this.config.extension);
|
|
807
|
+
var scope = this.context.create(data);
|
|
808
|
+
return this.output(filepath, scope).then(function (content) {
|
|
785
809
|
if (scope.getExtend()) {
|
|
786
810
|
scope.setExtend(false);
|
|
787
811
|
var layout = scope.getLayout();
|
|
788
812
|
var _data = scope.clone();
|
|
789
|
-
return render(layout, _data);
|
|
813
|
+
return _this.render(layout, _data);
|
|
790
814
|
}
|
|
791
815
|
return content;
|
|
792
816
|
});
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
817
|
+
}
|
|
818
|
+
}, {
|
|
819
|
+
key: "require",
|
|
820
|
+
value: function require(name) {
|
|
821
|
+
var filepath = ext(name, this.config.extension);
|
|
822
|
+
var scope = this.context.create({});
|
|
823
|
+
return this.output(filepath, scope).then(function () {
|
|
824
|
+
return scope.getMacro();
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}, {
|
|
828
|
+
key: "create",
|
|
829
|
+
value: function create() {
|
|
830
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
831
|
+
return new EJS(options);
|
|
832
|
+
}
|
|
833
|
+
}, {
|
|
834
|
+
key: "helpers",
|
|
835
|
+
value: function helpers() {
|
|
836
|
+
var methods = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
837
|
+
this.context.helpers(extend(this.scope, methods));
|
|
838
|
+
}
|
|
839
|
+
}, {
|
|
840
|
+
key: "preload",
|
|
841
|
+
value: function preload() {
|
|
842
|
+
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
843
|
+
return this.cache.load(list);
|
|
844
|
+
}
|
|
845
|
+
}, {
|
|
846
|
+
key: "compile",
|
|
847
|
+
value: function compile(content, path) {
|
|
848
|
+
return this.compiler.compile(content, path);
|
|
849
|
+
}
|
|
850
|
+
}, {
|
|
851
|
+
key: "__express",
|
|
852
|
+
value: function __express(name, options, callback) {
|
|
798
853
|
if (isFunction(options)) {
|
|
799
854
|
callback = options;
|
|
800
855
|
options = {};
|
|
@@ -807,52 +862,39 @@
|
|
|
807
862
|
var filename = path.relative(viewPath, name);
|
|
808
863
|
viewOptions.path = viewPath;
|
|
809
864
|
viewOptions.cache = viewCache;
|
|
810
|
-
configure(viewOptions);
|
|
811
|
-
return render(filename, options).then(function (content) {
|
|
865
|
+
this.configure(viewOptions);
|
|
866
|
+
return this.render(filename, options).then(function (content) {
|
|
812
867
|
callback(null, content);
|
|
813
868
|
})["catch"](function (error) {
|
|
814
869
|
callback(error);
|
|
815
870
|
});
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
compile: compile,
|
|
833
|
-
create: create,
|
|
834
|
-
preload: preload,
|
|
835
|
-
__express: __express
|
|
836
|
-
};
|
|
837
|
-
};
|
|
838
|
-
var _create = create({}),
|
|
839
|
-
context = _create.context,
|
|
840
|
-
render = _create.render,
|
|
841
|
-
helpers = _create.helpers,
|
|
842
|
-
configure = _create.configure,
|
|
843
|
-
compile = _create.compile,
|
|
844
|
-
preload = _create.preload,
|
|
845
|
-
__express = _create.__express;
|
|
871
|
+
}
|
|
872
|
+
}]);
|
|
873
|
+
return EJS;
|
|
874
|
+
}();
|
|
875
|
+
|
|
876
|
+
var ejs = new EJS({
|
|
877
|
+
/** defaults options **/
|
|
878
|
+
});
|
|
879
|
+
var __express = ejs.__express,
|
|
880
|
+
render = ejs.render,
|
|
881
|
+
context = ejs.context,
|
|
882
|
+
compile = ejs.compile,
|
|
883
|
+
helpers = ejs.helpers,
|
|
884
|
+
preload = ejs.preload,
|
|
885
|
+
configure = ejs.configure,
|
|
886
|
+
create = ejs.create;
|
|
846
887
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
888
|
+
exports.EJS = EJS;
|
|
889
|
+
exports.__express = __express;
|
|
890
|
+
exports.compile = compile;
|
|
891
|
+
exports.configure = configure;
|
|
892
|
+
exports.context = context;
|
|
893
|
+
exports.create = create;
|
|
894
|
+
exports.element = element;
|
|
895
|
+
exports.helpers = helpers;
|
|
896
|
+
exports.preload = preload;
|
|
897
|
+
exports.render = render;
|
|
898
|
+
exports.safeValue = safeValue;
|
|
857
899
|
|
|
858
900
|
}));
|