@kosatyi/ejs 0.0.64 → 0.0.65

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/index.js CHANGED
@@ -62,7 +62,7 @@ var safeValue = function safeValue(value, escape) {
62
62
  return check == null ? '' : escape === true ? entities(check) : check;
63
63
  };
64
64
  var instanceOf = function instanceOf(object, instance) {
65
- return object instanceof instance;
65
+ return Boolean(object instanceof instance);
66
66
  };
67
67
  var getPath = function getPath(context, name, strict) {
68
68
  var data = context;
@@ -208,67 +208,54 @@ var configSchema = function configSchema(config, options) {
208
208
  extension: typeProp(isString, defaults.extension, config.extension, options.extension),
209
209
  withObject: typeProp(isBoolean, defaults.withObject, config.withObject, options.withObject),
210
210
  rmWhitespace: typeProp(isBoolean, defaults.rmWhitespace, config.rmWhitespace, options.rmWhitespace),
211
- cache: typeProp(isBoolean, defaults.watch, config.watch, options.watch),
211
+ cache: typeProp(isBoolean, defaults.cache, config.cache, options.cache),
212
212
  token: extend({}, defaults.token, config.token, options.token),
213
213
  vars: extend({}, defaults.vars, config.vars, options.vars)
214
214
  });
215
215
  };
216
216
 
217
- var resolvePath = function resolvePath(path, template) {
218
- template = [path, template].join('/');
219
- template = template.replace(/\/\//g, '/');
220
- return template;
221
- };
222
- var httpRequest = function httpRequest(path, template) {
223
- return fetch(resolvePath(path, template)).then(function (response) {
224
- return response.text();
225
- });
226
- };
227
- var fileSystem = function fileSystem(path, template) {
228
- return new Promise(function (resolve, reject) {
229
- fs.readFile(resolvePath(path, template), function (error, data) {
230
- if (error) {
231
- reject(error);
232
- } else {
233
- resolve(data.toString());
234
- }
235
- });
236
- });
237
- };
238
- var fileResolver = function fileResolver(resolver) {
239
- return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest;
240
- };
241
- function Template(config, cache, compiler) {
242
- if (instanceOf(this, Template) === false) return new Template(config, cache, compiler);
243
- var template = {};
244
- var result = function result(template, content) {
245
- cache.set(template, content);
246
- return content;
217
+ var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
218
+ function Cache(config) {
219
+ if (instanceOf(this, Cache) === false) return new Cache();
220
+ var cache = {
221
+ enabled: true,
222
+ list: {}
247
223
  };
248
- var resolve = function resolve(path) {
249
- return template.resolver(template.path, path);
224
+ this.configure = function (config) {
225
+ cache.enabled = config.cache;
226
+ if (isNode() === false) {
227
+ this.load(global[config["export"]]);
228
+ }
250
229
  };
251
- var compile = function compile(content, template) {
252
- if (isFunction(content)) {
253
- return content;
254
- } else {
255
- return compiler.compile(content, template);
230
+ this.clear = function () {
231
+ cache.list = {};
232
+ };
233
+ this.load = function (data) {
234
+ if (cache.enabled) {
235
+ extend(cache.list, data || {});
256
236
  }
237
+ return this;
257
238
  };
258
- this.configure = function (config) {
259
- template.path = config.path;
260
- template.cache = config.cache;
261
- template.resolver = fileResolver(config.resolver);
239
+ this.get = function (key) {
240
+ if (cache.enabled) {
241
+ return cache.list[key];
242
+ }
262
243
  };
263
- this.get = function (template) {
264
- if (cache.exist(template)) {
265
- return cache.resolve(template);
244
+ this.set = function (key, value) {
245
+ if (cache.enabled) {
246
+ cache.list[key] = value;
266
247
  }
267
- return result(template, resolve(template).then(function (content) {
268
- return result(template, compile(content, template));
269
- }));
248
+ return this;
249
+ };
250
+ this.resolve = function (key) {
251
+ return Promise.resolve(this.get(key));
252
+ };
253
+ this.remove = function (key) {
254
+ delete cache.list[key];
255
+ };
256
+ this.exist = function (key) {
257
+ return hasProp(cache.list, key);
270
258
  };
271
- this.configure(config);
272
259
  }
273
260
 
274
261
  var tagList = [{
@@ -366,46 +353,63 @@ function Compiler(config) {
366
353
  this.configure(config);
367
354
  }
368
355
 
369
- var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
370
- function Cache(config) {
371
- if (instanceOf(this, Cache) === false) return new Cache();
372
- var cache = {
373
- enabled: true,
374
- list: {}
356
+ var resolvePath = function resolvePath(path, template) {
357
+ template = [path, template].join('/');
358
+ template = template.replace(/\/\//g, '/');
359
+ return template;
360
+ };
361
+ var httpRequest = function httpRequest(path, template) {
362
+ return fetch(resolvePath(path, template)).then(function (response) {
363
+ return response.text();
364
+ });
365
+ };
366
+ var fileSystem = function fileSystem(path, template) {
367
+ return new Promise(function (resolve, reject) {
368
+ fs.readFile(resolvePath(path, template), function (error, data) {
369
+ if (error) {
370
+ reject(error);
371
+ } else {
372
+ resolve(data.toString());
373
+ }
374
+ });
375
+ });
376
+ };
377
+ var fileResolver = function fileResolver(resolver) {
378
+ return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest;
379
+ };
380
+ function Template(config, cache, compiler) {
381
+ if (instanceOf(this, Template) === false) return new Template(config, cache, compiler);
382
+ if (instanceOf(cache, Cache) === false) throw new TypeError('cache is not instance of Cache');
383
+ if (instanceOf(compiler, Compiler) === false) throw new TypeError('compiler is not instance of Compiler');
384
+ var template = {};
385
+ var result = function result(template, content) {
386
+ cache.set(template, content);
387
+ return content;
375
388
  };
376
- this.configure = function (config) {
377
- cache.list = {};
378
- cache.enabled = config.cache;
379
- if (isNode() === false) {
380
- this.load(global[config["export"]]);
381
- }
389
+ var resolve = function resolve(path) {
390
+ return template.resolver(template.path, path);
382
391
  };
383
- this.load = function (data) {
384
- if (cache.enabled) {
385
- extend(cache.list, data || {});
392
+ var compile = function compile(content, template) {
393
+ if (isFunction(content)) {
394
+ return content;
395
+ } else {
396
+ return compiler.compile(content, template);
386
397
  }
387
- return this;
388
398
  };
389
- this.get = function (key) {
390
- if (cache.enabled) {
391
- return cache.list[key];
392
- }
399
+ this.configure = function (config) {
400
+ template.path = config.path;
401
+ template.cache = config.cache;
402
+ template.resolver = fileResolver(config.resolver);
393
403
  };
394
- this.set = function (key, value) {
395
- if (cache.enabled) {
396
- cache.list[key] = value;
404
+ this.get = function (template) {
405
+ if (cache.exist(template)) {
406
+ return cache.resolve(template);
397
407
  }
398
- return this;
399
- };
400
- this.resolve = function (key) {
401
- return Promise.resolve(this.get(key));
402
- };
403
- this.remove = function (key) {
404
- delete cache.list[key];
405
- };
406
- this.exist = function (key) {
407
- return hasProp(cache.list, key);
408
+ return result(template, resolve(template).then(function (content) {
409
+ return result(template, compile(content, template));
410
+ }));
408
411
  };
412
+ this.configure(config);
409
413
  }
410
414
 
411
415
  function resolve(list) {
@@ -718,7 +722,7 @@ function __express(name, options, callback) {
718
722
  viewOptions.path = viewPath;
719
723
  viewOptions.cache = viewCache;
720
724
  configure(viewOptions);
721
- return this.render(filename, options).then(function (content) {
725
+ return render(filename, options).then(function (content) {
722
726
  callback(null, content);
723
727
  })["catch"](function (error) {
724
728
  callback(error);
package/dist/esm/index.js CHANGED
@@ -63,7 +63,7 @@ const safeValue = (value, escape) => {
63
63
  };
64
64
 
65
65
  const instanceOf = (object, instance) => {
66
- return object instanceof instance
66
+ return Boolean(object instanceof instance)
67
67
  };
68
68
 
69
69
  const getPath = (context, name, strict) => {
@@ -262,79 +262,55 @@ const configSchema = (config, options) => {
262
262
  config.rmWhitespace,
263
263
  options.rmWhitespace
264
264
  ),
265
- cache: typeProp(isBoolean, defaults.watch, config.watch, options.watch),
265
+ cache: typeProp(isBoolean, defaults.cache, config.cache, options.cache),
266
266
  token: extend({}, defaults.token, config.token, options.token),
267
267
  vars: extend({}, defaults.vars, config.vars, options.vars),
268
268
  });
269
269
  };
270
270
 
271
- const resolvePath = (path, template) => {
272
- template = [path, template].join('/');
273
- template = template.replace(/\/\//g, '/');
274
- return template
275
- };
276
-
277
- const httpRequest = (path, template) => {
278
- return fetch(resolvePath(path, template)).then((response) =>
279
- response.text()
280
- )
281
- };
282
-
283
- const fileSystem = (path, template) => {
284
- return new Promise((resolve, reject) => {
285
- fs.readFile(resolvePath(path, template), (error, data) => {
286
- if (error) {
287
- reject(error);
288
- } else {
289
- resolve(data.toString());
290
- }
291
- });
292
- })
293
- };
294
-
295
- const fileResolver = (resolver) => {
296
- return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest
297
- };
298
-
299
- function Template(config, cache, compiler) {
300
- if (instanceOf(this, Template) === false)
301
- return new Template(config, cache, compiler)
302
-
303
- const template = {};
271
+ const global = typeof globalThis !== 'undefined' ? globalThis : window || self;
304
272
 
305
- const result = function (template, content) {
306
- cache.set(template, content);
307
- return content
273
+ function Cache(config) {
274
+ if (instanceOf(this, Cache) === false) return new Cache()
275
+ const cache = {
276
+ enabled: true,
277
+ list: {},
308
278
  };
309
-
310
- const resolve = function (path) {
311
- return template.resolver(template.path, path)
279
+ this.configure = function (config) {
280
+ cache.enabled = config.cache;
281
+ if (isNode() === false) {
282
+ this.load(global[config.export]);
283
+ }
312
284
  };
313
-
314
- const compile = function (content, template) {
315
- if (isFunction(content)) {
316
- return content
317
- } else {
318
- return compiler.compile(content, template)
285
+ this.clear = function () {
286
+ cache.list = {};
287
+ };
288
+ this.load = function (data) {
289
+ if (cache.enabled) {
290
+ extend(cache.list, data || {});
319
291
  }
292
+ return this
320
293
  };
321
- this.configure = function (config) {
322
- template.path = config.path;
323
- template.cache = config.cache;
324
- template.resolver = fileResolver(config.resolver);
294
+ this.get = function (key) {
295
+ if (cache.enabled) {
296
+ return cache.list[key]
297
+ }
325
298
  };
326
- this.get = function (template) {
327
- if (cache.exist(template)) {
328
- return cache.resolve(template)
299
+ this.set = function (key, value) {
300
+ if (cache.enabled) {
301
+ cache.list[key] = value;
329
302
  }
330
- return result(
331
- template,
332
- resolve(template).then((content) =>
333
- result(template, compile(content, template))
334
- )
335
- )
303
+ return this
304
+ };
305
+ this.resolve = function (key) {
306
+ return Promise.resolve(this.get(key))
307
+ };
308
+ this.remove = function (key) {
309
+ delete cache.list[key];
310
+ };
311
+ this.exist = function (key) {
312
+ return hasProp(cache.list, key)
336
313
  };
337
- this.configure(config);
338
314
  }
339
315
 
340
316
  const tagList = [
@@ -457,47 +433,73 @@ function Compiler(config) {
457
433
  this.configure(config);
458
434
  }
459
435
 
460
- const global = typeof globalThis !== 'undefined' ? globalThis : window || self;
436
+ const resolvePath = (path, template) => {
437
+ template = [path, template].join('/');
438
+ template = template.replace(/\/\//g, '/');
439
+ return template
440
+ };
461
441
 
462
- function Cache(config) {
463
- if (instanceOf(this, Cache) === false) return new Cache()
464
- const cache = {
465
- enabled: true,
466
- list: {},
442
+ const httpRequest = (path, template) => {
443
+ return fetch(resolvePath(path, template)).then((response) =>
444
+ response.text()
445
+ )
446
+ };
447
+
448
+ const fileSystem = (path, template) => {
449
+ return new Promise((resolve, reject) => {
450
+ fs.readFile(resolvePath(path, template), (error, data) => {
451
+ if (error) {
452
+ reject(error);
453
+ } else {
454
+ resolve(data.toString());
455
+ }
456
+ });
457
+ })
458
+ };
459
+
460
+ const fileResolver = (resolver) => {
461
+ return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest
462
+ };
463
+
464
+ function Template(config, cache, compiler) {
465
+ if (instanceOf(this, Template) === false)
466
+ return new Template(config, cache, compiler)
467
+ if (instanceOf(cache, Cache) === false)
468
+ throw new TypeError('cache is not instance of Cache')
469
+ if (instanceOf(compiler, Compiler) === false)
470
+ throw new TypeError('compiler is not instance of Compiler')
471
+ const template = {};
472
+ const result = function (template, content) {
473
+ cache.set(template, content);
474
+ return content
467
475
  };
468
- this.configure = function (config) {
469
- cache.list = {};
470
- cache.enabled = config.cache;
471
- if (isNode() === false) {
472
- this.load(global[config.export]);
473
- }
476
+ const resolve = function (path) {
477
+ return template.resolver(template.path, path)
474
478
  };
475
- this.load = function (data) {
476
- if (cache.enabled) {
477
- extend(cache.list, data || {});
479
+ const compile = function (content, template) {
480
+ if (isFunction(content)) {
481
+ return content
482
+ } else {
483
+ return compiler.compile(content, template)
478
484
  }
479
- return this
480
485
  };
481
- this.get = function (key) {
482
- if (cache.enabled) {
483
- return cache.list[key]
484
- }
486
+ this.configure = function (config) {
487
+ template.path = config.path;
488
+ template.cache = config.cache;
489
+ template.resolver = fileResolver(config.resolver);
485
490
  };
486
- this.set = function (key, value) {
487
- if (cache.enabled) {
488
- cache.list[key] = value;
491
+ this.get = function (template) {
492
+ if (cache.exist(template)) {
493
+ return cache.resolve(template)
489
494
  }
490
- return this
491
- };
492
- this.resolve = function (key) {
493
- return Promise.resolve(this.get(key))
494
- };
495
- this.remove = function (key) {
496
- delete cache.list[key];
497
- };
498
- this.exist = function (key) {
499
- return hasProp(cache.list, key)
495
+ return result(
496
+ template,
497
+ resolve(template).then((content) =>
498
+ result(template, compile(content, template))
499
+ )
500
+ )
500
501
  };
502
+ this.configure(config);
501
503
  }
502
504
 
503
505
  function resolve(list) {
@@ -767,17 +769,13 @@ function Context(config) {
767
769
 
768
770
  function EJS(options) {
769
771
  if (instanceOf(this, EJS) === false) return new EJS(options)
770
-
771
772
  const scope = {};
772
773
  const config = {};
773
-
774
774
  configSchema(config, options || {});
775
-
776
775
  const context = new Context(config);
777
776
  const compiler = new Compiler(config);
778
777
  const cache = new Cache();
779
778
  const template = new Template(config, cache, compiler);
780
-
781
779
  const output = function (path, scope) {
782
780
  return template.get(path).then(function (callback) {
783
781
  return callback.call(
@@ -789,7 +787,6 @@ function EJS(options) {
789
787
  )
790
788
  })
791
789
  };
792
-
793
790
  const require = function (name) {
794
791
  const filepath = ext(name, config.extension);
795
792
  const scope = context.create({});
@@ -872,7 +869,7 @@ function __express(name, options, callback) {
872
869
  viewOptions.path = viewPath;
873
870
  viewOptions.cache = viewCache;
874
871
  configure(viewOptions);
875
- return this.render(filename, options)
872
+ return render(filename, options)
876
873
  .then((content) => {
877
874
  callback(null, content);
878
875
  })
package/dist/umd/index.js CHANGED
@@ -65,7 +65,7 @@
65
65
  return check == null ? '' : escape === true ? entities(check) : check;
66
66
  };
67
67
  var instanceOf = function instanceOf(object, instance) {
68
- return object instanceof instance;
68
+ return Boolean(object instanceof instance);
69
69
  };
70
70
  var getPath = function getPath(context, name, strict) {
71
71
  var data = context;
@@ -211,67 +211,54 @@
211
211
  extension: typeProp(isString, defaults.extension, config.extension, options.extension),
212
212
  withObject: typeProp(isBoolean, defaults.withObject, config.withObject, options.withObject),
213
213
  rmWhitespace: typeProp(isBoolean, defaults.rmWhitespace, config.rmWhitespace, options.rmWhitespace),
214
- cache: typeProp(isBoolean, defaults.watch, config.watch, options.watch),
214
+ cache: typeProp(isBoolean, defaults.cache, config.cache, options.cache),
215
215
  token: extend({}, defaults.token, config.token, options.token),
216
216
  vars: extend({}, defaults.vars, config.vars, options.vars)
217
217
  });
218
218
  };
219
219
 
220
- var resolvePath = function resolvePath(path, template) {
221
- template = [path, template].join('/');
222
- template = template.replace(/\/\//g, '/');
223
- return template;
224
- };
225
- var httpRequest = function httpRequest(path, template) {
226
- return fetch(resolvePath(path, template)).then(function (response) {
227
- return response.text();
228
- });
229
- };
230
- var fileSystem = function fileSystem(path$1, template) {
231
- return new Promise(function (resolve, reject) {
232
- path.readFile(resolvePath(path$1, template), function (error, data) {
233
- if (error) {
234
- reject(error);
235
- } else {
236
- resolve(data.toString());
237
- }
238
- });
239
- });
240
- };
241
- var fileResolver = function fileResolver(resolver) {
242
- return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest;
243
- };
244
- function Template(config, cache, compiler) {
245
- if (instanceOf(this, Template) === false) return new Template(config, cache, compiler);
246
- var template = {};
247
- var result = function result(template, content) {
248
- cache.set(template, content);
249
- return content;
220
+ var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
221
+ function Cache(config) {
222
+ if (instanceOf(this, Cache) === false) return new Cache();
223
+ var cache = {
224
+ enabled: true,
225
+ list: {}
250
226
  };
251
- var resolve = function resolve(path) {
252
- return template.resolver(template.path, path);
227
+ this.configure = function (config) {
228
+ cache.enabled = config.cache;
229
+ if (isNode() === false) {
230
+ this.load(global[config["export"]]);
231
+ }
253
232
  };
254
- var compile = function compile(content, template) {
255
- if (isFunction(content)) {
256
- return content;
257
- } else {
258
- return compiler.compile(content, template);
233
+ this.clear = function () {
234
+ cache.list = {};
235
+ };
236
+ this.load = function (data) {
237
+ if (cache.enabled) {
238
+ extend(cache.list, data || {});
259
239
  }
240
+ return this;
260
241
  };
261
- this.configure = function (config) {
262
- template.path = config.path;
263
- template.cache = config.cache;
264
- template.resolver = fileResolver(config.resolver);
242
+ this.get = function (key) {
243
+ if (cache.enabled) {
244
+ return cache.list[key];
245
+ }
265
246
  };
266
- this.get = function (template) {
267
- if (cache.exist(template)) {
268
- return cache.resolve(template);
247
+ this.set = function (key, value) {
248
+ if (cache.enabled) {
249
+ cache.list[key] = value;
269
250
  }
270
- return result(template, resolve(template).then(function (content) {
271
- return result(template, compile(content, template));
272
- }));
251
+ return this;
252
+ };
253
+ this.resolve = function (key) {
254
+ return Promise.resolve(this.get(key));
255
+ };
256
+ this.remove = function (key) {
257
+ delete cache.list[key];
258
+ };
259
+ this.exist = function (key) {
260
+ return hasProp(cache.list, key);
273
261
  };
274
- this.configure(config);
275
262
  }
276
263
 
277
264
  var tagList = [{
@@ -369,46 +356,63 @@
369
356
  this.configure(config);
370
357
  }
371
358
 
372
- var global = typeof globalThis !== 'undefined' ? globalThis : window || self;
373
- function Cache(config) {
374
- if (instanceOf(this, Cache) === false) return new Cache();
375
- var cache = {
376
- enabled: true,
377
- list: {}
359
+ var resolvePath = function resolvePath(path, template) {
360
+ template = [path, template].join('/');
361
+ template = template.replace(/\/\//g, '/');
362
+ return template;
363
+ };
364
+ var httpRequest = function httpRequest(path, template) {
365
+ return fetch(resolvePath(path, template)).then(function (response) {
366
+ return response.text();
367
+ });
368
+ };
369
+ var fileSystem = function fileSystem(path$1, template) {
370
+ return new Promise(function (resolve, reject) {
371
+ path.readFile(resolvePath(path$1, template), function (error, data) {
372
+ if (error) {
373
+ reject(error);
374
+ } else {
375
+ resolve(data.toString());
376
+ }
377
+ });
378
+ });
379
+ };
380
+ var fileResolver = function fileResolver(resolver) {
381
+ return isFunction(resolver) ? resolver : isNode() ? fileSystem : httpRequest;
382
+ };
383
+ function Template(config, cache, compiler) {
384
+ if (instanceOf(this, Template) === false) return new Template(config, cache, compiler);
385
+ if (instanceOf(cache, Cache) === false) throw new TypeError('cache is not instance of Cache');
386
+ if (instanceOf(compiler, Compiler) === false) throw new TypeError('compiler is not instance of Compiler');
387
+ var template = {};
388
+ var result = function result(template, content) {
389
+ cache.set(template, content);
390
+ return content;
378
391
  };
379
- this.configure = function (config) {
380
- cache.list = {};
381
- cache.enabled = config.cache;
382
- if (isNode() === false) {
383
- this.load(global[config["export"]]);
384
- }
392
+ var resolve = function resolve(path) {
393
+ return template.resolver(template.path, path);
385
394
  };
386
- this.load = function (data) {
387
- if (cache.enabled) {
388
- extend(cache.list, data || {});
395
+ var compile = function compile(content, template) {
396
+ if (isFunction(content)) {
397
+ return content;
398
+ } else {
399
+ return compiler.compile(content, template);
389
400
  }
390
- return this;
391
401
  };
392
- this.get = function (key) {
393
- if (cache.enabled) {
394
- return cache.list[key];
395
- }
402
+ this.configure = function (config) {
403
+ template.path = config.path;
404
+ template.cache = config.cache;
405
+ template.resolver = fileResolver(config.resolver);
396
406
  };
397
- this.set = function (key, value) {
398
- if (cache.enabled) {
399
- cache.list[key] = value;
407
+ this.get = function (template) {
408
+ if (cache.exist(template)) {
409
+ return cache.resolve(template);
400
410
  }
401
- return this;
402
- };
403
- this.resolve = function (key) {
404
- return Promise.resolve(this.get(key));
405
- };
406
- this.remove = function (key) {
407
- delete cache.list[key];
408
- };
409
- this.exist = function (key) {
410
- return hasProp(cache.list, key);
411
+ return result(template, resolve(template).then(function (content) {
412
+ return result(template, compile(content, template));
413
+ }));
411
414
  };
415
+ this.configure(config);
412
416
  }
413
417
 
414
418
  function resolve(list) {
@@ -721,7 +725,7 @@
721
725
  viewOptions.path = viewPath;
722
726
  viewOptions.cache = viewCache;
723
727
  configure(viewOptions);
724
- return this.render(filename, options).then(function (content) {
728
+ return render(filename, options).then(function (content) {
725
729
  callback(null, content);
726
730
  })["catch"](function (error) {
727
731
  callback(error);
@@ -1 +1 @@
1
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";var n={},e=function(){var t=[].slice.call(arguments),n=t.shift();return t.filter(n).pop()},r=function(t){return"function"==typeof t},o=function(t){return"string"==typeof t},i=function(t){return"boolean"==typeof t},c=function(t){return void 0===t},u="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),s=function(){return u},a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},h=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},l=h(f),p=h(a),d=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(l,(function(t){return f[t]}))},m=function(t){return(""+t).replace(p,(function(t){return"\\"+a[t]}))},v=function(t,n){var e=t;return null==e?"":!0===n?d(e):e},g=function(t,n){return t instanceof n},b=function(t,n,e){for(var o=t,i=String(n).split("."),c=i.pop(),u=0;u<i.length;u++){var s=i[u];if(r(o.toJSON)&&(o=o.toJSON()),e&&!1===o.hasOwnProperty(s)){o={};break}o=o[s]=o[s]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,c]},w=function(t,n){var e=t.split(".").pop();return e!==n&&(t=[t,n].join(".")),t},x=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];var r=n.shift();return n.filter((function(t){return t})).reduce((function(t,n){return Object.assign(t,n)}),r)},E=function(){},j=function(t,n){var e;for(e in t)k(t,e)&&n(t[e],e,t)},y=function(t,n){return function(t,n,e){var r=t instanceof Array,o=r?[]:{};return j(t,(function(t,e,i){var u=n(t,e,i);!1===c(u)&&(r?o.push(u):o[e]=u)})),o}(t,(function(t,e){if(-1===n.indexOf(e))return t}))},O=function(t,n,e){return Promise.resolve(t).then(n.bind(e))},k=function(t,n){return t&&t.hasOwnProperty(n)},F={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:null,extension:"ejs",rmWhitespace:!0,withObject:!0,vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},S=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],B=" ",R='"',$="/",P="<",N=">",U=function(t,n,e){var r=[],o=-1===S.indexOf(t),i=function(t,n,e){var r=[];return j(t,(function(t,e,o){var i=n(t,e,o);!1===c(i)&&r.push(i)})),r}(n,(function(t,n){if(null!=t)return[d(n),[R,d(t),R].join("")].join("=")})).join(B);return r.push([P,t,B,i,N].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([P,$,t,N].join("")),r.join("")},A=function(t,n){x(t,{path:e(o,F.path,t.path,n.path),export:e(o,F.export,t.export,n.export),resolver:e(r,F.resolver,t.resolver,n.resolver),extension:e(o,F.extension,t.extension,n.extension),withObject:e(i,F.withObject,t.withObject,n.withObject),rmWhitespace:e(i,F.rmWhitespace,t.rmWhitespace,n.rmWhitespace),cache:e(i,F.watch,t.watch,n.watch),token:x({},F.token,t.token,n.token),vars:x({},F.vars,t.vars,n.vars)})},C=function(t,n){return n=(n=[t,n].join("/")).replace(/\/\//g,"/")},T=function(t,n){return fetch(C(t,n)).then((function(t){return t.text()}))},M=function(t,e){return new Promise((function(r,o){n.readFile(C(t,e),(function(t,n){t?o(t):r(n.toString())}))}))},L=function(t){return r(t)?t:s()?M:T};function W(t,n,e){if(!1===g(this,W))return new W(t,n,e);var o={},i=function(t,e){return n.set(t,e),e},c=function(t){return o.resolver(o.path,t)};this.configure=function(t){o.path=t.path,o.cache=t.cache,o.resolver=L(t.resolver)},this.get=function(t){return n.exist(t)?n.resolve(t):i(t,c(t).then((function(n){return i(t,function(t,n){return r(t)?t:e.compile(t,n)}(n,t))})))},this.configure(t)}var J=[{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 _(t){if(!1===g(this,_))return new _(t);var n={};this.configure=function(t){n.withObject=t.withObject,n.rmWhitespace=t.rmWhitespace,n.token=t.token,n.vars=t.vars,n.matches=[],n.formats=[],n.slurp={match:"[ \\t]*",start:[n.token.start,"_"],end:["_",n.token.end]},J.forEach((function(t){n.matches.push(n.token.start.concat(t.symbol).concat(n.token.regex).concat(n.token.end)),n.formats.push(t.format.bind(n.vars))})),n.regex=new RegExp(n.matches.join("|").concat("|$"),"g"),n.slurpStart=new RegExp([n.slurp.match,n.slurp.start.join("")].join(""),"gm"),n.slurpEnd=new RegExp([n.slurp.end.join(""),n.slurp.match].join(""),"gm")},this.compile=function(t,e){var r=n.vars,o=r.SCOPE,i=r.SAFE,c=r.BUFFER,u=r.COMPONENT;n.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(n.slurpStart,n.token.start).replace(n.slurpEnd,n.token.end);var s,a,f,h="".concat(c,"('");s=n.regex,a=function(e,r,o){h+=m(t.slice(r,o)),e.forEach((function(t,e){t&&(h+=n.formats[e](t))}))},f=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),n=t.pop(),e=t.shift();return a(t,f,n),f=n+e.length,e})),h="try{".concat(h+="');","}catch(e){console.info(e)}"),n.withObject&&(h="with(".concat(o,"){").concat(h,"}")),h="".concat(c,".start();").concat(h,"return ").concat(c,".end();"),h+="\n//# sourceURL=".concat(e);var l=null;try{(l=new Function(o,u,c,i,h)).source="(function(".concat(o,",").concat(u,",").concat(c,",").concat(i,"){\n").concat(h,"\n})")}catch(t){throw t.filename=e,t.source=h,t}return l},this.configure(t)}var q="undefined"!=typeof globalThis?globalThis:window||self;function D(t){if(!1===g(this,D))return new D;var n={enabled:!0,list:{}};this.configure=function(t){n.list={},n.enabled=t.cache,!1===s()&&this.load(q[t.export])},this.load=function(t){return n.enabled&&x(n.list,t||{}),this},this.get=function(t){if(n.enabled)return n.list[t]},this.set=function(t,e){return n.enabled&&(n.list[t]=e),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete n.list[t]},this.exist=function(t){return k(n.list,t)}}function K(t){return Promise.all(t||[]).then((function(t){return t.join("")}))}var X=function(){var t=[],n=[];function e(t){n.push(t)}return e.start=function(){n=[]},e.backup=function(){t.push(n.concat()),n=[]},e.restore=function(){var e=n.concat();return n=t.pop(),K(e)},e.error=function(t){throw t},e.end=function(){return K(n)},e};function Y(t){if(!1===g(this,Y))return new Y(t);this.configure=function(t,n){var e=t.vars,i=e.BLOCKS,c=e.MACRO,u=e.EXTEND,s=e.LAYOUT,a=e.BUFFER,f=e.COMPONENT;function h(t){this[i]={},this[c]={},x(this,t||{})}this.create=function(t){return new h(t)},this.helpers=function(t){x(h.prototype,t||{})},h.prototype=x({},n||{}),h.method=h.define=function(t,n,e,r,o){Object.defineProperty(h.prototype,t,{value:n,writable:e||!1,configurable:r||!1,enumerable:o||!1})},h.define(a,X()),h.define(i,{},!0),h.define(c,{},!0),h.define(s,!1,!0),h.define(u,!1,!0),h.method("getMacro",(function(){return this[c]})),h.method("getBuffer",(function(){return this[a]})),h.method("getComponent",(function(){var t=this;return f in t?function(){return t[f].apply(t,arguments)}:function(){console.log("%s function not defined",f)}})),h.method("getBlocks",(function(){return this[i]})),h.method("setExtend",(function(t){this[u]=t})),h.method("getExtend",(function(){return this[u]})),h.method("setLayout",(function(t){this[s]=t})),h.method("getLayout",(function(){return this[s]})),h.method("clone",(function(t){var n=[s,u,a];return!0===t&&n.push(i),y(this,n)})),h.method("extend",(function(t){this.setExtend(!0),this.setLayout(t)})),h.method("echo",(function(){var t=this.getBuffer();[].slice.call(arguments).forEach(t)})),h.method("fn",(function(t){var n=this.getBuffer(),e=this;return function(){return n.backup(),r(t)&&t.apply(e,arguments),n.restore()}})),h.method("get",(function(t,n){var e=b(this,t,!0),r=e.shift(),o=e.pop();return k(r,o)?r[o]:n})),h.method("set",(function(t,n){var e=b(this,t,!1),r=e.shift(),o=e.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=n})),h.method("macro",(function(t,n){var e=this.getMacro(),r=this.fn(n),o=this;e[t]=function(){return o.echo(r.apply(void 0,arguments))}})),h.method("call",(function(t){var n=this.getMacro()[t],e=[].slice.call(arguments,1);if(r(n))return n.apply(n,e)})),h.method("block",(function(t,n){var e=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(n)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var n=i();return n?function(){e.echo(n(t()))}:E}()))}})),h.method("include",(function(t,n,e){var r=!1===e?{}:this.clone(!0),o=x(r,n||{}),i=this.render(t,o);this.echo(i)})),h.method("use",(function(t,n){var e=this.require(t);this.echo(O(e,(function(t){var e=this.getMacro();j(t,(function(t,r){e[[n,r].join(".")]=t}))}),this))})),h.method("async",(function(t,n){this.echo(O(t,(function(t){return this.fn(n)(t)}),this))})),h.method("node",(function(t,n,e){return U(t,n,e)})),h.method("el",(function(t,n,e){r(e)&&(e=this.fn(e)()),this.echo(O(e,(function(e){return U(t,n,e)}),this))})),h.method("each",(function(t,n){o(t)&&(t=this.get(t,[])),j(t,n)}))},this.configure(t)}function V(t){if(!1===g(this,V))return new V(t);var n={},e={};A(e,t||{});var r=new Y(e),o=new _(e),i=new D,c=new W(e,i,o),u=function(t,n){return c.get(t).then((function(t){return t.call(n,n,n.getComponent(),n.getBuffer(),v)}))},s=function t(n,o){var i=w(n,e.extension),c=r.create(o);return u(i,c).then((function(n){if(c.getExtend()){c.setExtend(!1);var e=c.getLayout(),r=c.clone();return t(e,r)}return n}))};this.configure=function(t){return A(e,t=t||{}),r.configure(e,n),o.configure(e),i.configure(e),c.configure(e),e},this.render=function(t,n){return s(t,n)},this.helpers=function(t){r.helpers(Object.assign(n,t||{}))},this.preload=function(t){return i.load(t||{})},this.create=function(t){return new V(t)},this.compile=function(t,n){return o.compile(t,n)},this.context=function(t){return r.create(t)},this.helpers({require:function(t){var n=w(t,e.extension),o=r.create({});return u(n,o).then((function(){return o.getMacro()}))},render:s})}var z=new V,G=z.render,H=z.context,I=z.compile,Q=z.helpers,Z=z.preload,tt=z.configure,nt=z.create;t.EJS=V,t.__express=function(t,c,u){r(c)&&(u=c,c={});var s=x({},(c=c||{}).settings),a=e(o,F.path,s.views),f=e(i,F.cache,s["view cache"]),h=x({},s["view options"]),l=n.relative(a,t);return h.path=a,h.cache=f,tt(h),this.render(l,c).then((function(t){u(null,t)})).catch((function(t){u(t)}))},t.compile=I,t.configure=tt,t.context=H,t.create=nt,t.element=U,t.helpers=Q,t.preload=Z,t.render=G,t.safeValue=v}));
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";var n={},e=function(){var t=[].slice.call(arguments),n=t.shift();return t.filter(n).pop()},r=function(t){return"function"==typeof t},o=function(t){return"string"==typeof t},i=function(t){return"boolean"==typeof t},c=function(t){return void 0===t},u="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),s=function(){return u},a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},h=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},l=h(f),p=h(a),d=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(l,(function(t){return f[t]}))},m=function(t){return(""+t).replace(p,(function(t){return"\\"+a[t]}))},v=function(t,n){var e=t;return null==e?"":!0===n?d(e):e},g=function(t,n){return Boolean(t instanceof n)},b=function(t,n,e){for(var o=t,i=String(n).split("."),c=i.pop(),u=0;u<i.length;u++){var s=i[u];if(r(o.toJSON)&&(o=o.toJSON()),e&&!1===o.hasOwnProperty(s)){o={};break}o=o[s]=o[s]||{}}return r(o.toJSON)&&(o=o.toJSON()),[o,c]},w=function(t,n){var e=t.split(".").pop();return e!==n&&(t=[t,n].join(".")),t},x=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];var r=n.shift();return n.filter((function(t){return t})).reduce((function(t,n){return Object.assign(t,n)}),r)},E=function(){},j=function(t,n){var e;for(e in t)k(t,e)&&n(t[e],e,t)},y=function(t,n){return function(t,n,e){var r=t instanceof Array,o=r?[]:{};return j(t,(function(t,e,i){var u=n(t,e,i);!1===c(u)&&(r?o.push(u):o[e]=u)})),o}(t,(function(t,e){if(-1===n.indexOf(e))return t}))},O=function(t,n,e){return Promise.resolve(t).then(n.bind(e))},k=function(t,n){return t&&t.hasOwnProperty(n)},F={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:null,extension:"ejs",rmWhitespace:!0,withObject:!0,vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},S=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],B=" ",R='"',$="/",C="<",P=">",T=function(t,n,e){var r=[],o=-1===S.indexOf(t),i=function(t,n,e){var r=[];return j(t,(function(t,e,o){var i=n(t,e,o);!1===c(i)&&r.push(i)})),r}(n,(function(t,n){if(null!=t)return[d(n),[R,d(t),R].join("")].join("=")})).join(B);return r.push([C,t,B,i,P].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([C,$,t,P].join("")),r.join("")},N=function(t,n){x(t,{path:e(o,F.path,t.path,n.path),export:e(o,F.export,t.export,n.export),resolver:e(r,F.resolver,t.resolver,n.resolver),extension:e(o,F.extension,t.extension,n.extension),withObject:e(i,F.withObject,t.withObject,n.withObject),rmWhitespace:e(i,F.rmWhitespace,t.rmWhitespace,n.rmWhitespace),cache:e(i,F.cache,t.cache,n.cache),token:x({},F.token,t.token,n.token),vars:x({},F.vars,t.vars,n.vars)})},U="undefined"!=typeof globalThis?globalThis:window||self;function A(t){if(!1===g(this,A))return new A;var n={enabled:!0,list:{}};this.configure=function(t){n.enabled=t.cache,!1===s()&&this.load(U[t.export])},this.clear=function(){n.list={}},this.load=function(t){return n.enabled&&x(n.list,t||{}),this},this.get=function(t){if(n.enabled)return n.list[t]},this.set=function(t,e){return n.enabled&&(n.list[t]=e),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete n.list[t]},this.exist=function(t){return k(n.list,t)}}var M=[{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 L(t){if(!1===g(this,L))return new L(t);var n={};this.configure=function(t){n.withObject=t.withObject,n.rmWhitespace=t.rmWhitespace,n.token=t.token,n.vars=t.vars,n.matches=[],n.formats=[],n.slurp={match:"[ \\t]*",start:[n.token.start,"_"],end:["_",n.token.end]},M.forEach((function(t){n.matches.push(n.token.start.concat(t.symbol).concat(n.token.regex).concat(n.token.end)),n.formats.push(t.format.bind(n.vars))})),n.regex=new RegExp(n.matches.join("|").concat("|$"),"g"),n.slurpStart=new RegExp([n.slurp.match,n.slurp.start.join("")].join(""),"gm"),n.slurpEnd=new RegExp([n.slurp.end.join(""),n.slurp.match].join(""),"gm")},this.compile=function(t,e){var r=n.vars,o=r.SCOPE,i=r.SAFE,c=r.BUFFER,u=r.COMPONENT;n.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(n.slurpStart,n.token.start).replace(n.slurpEnd,n.token.end);var s,a,f,h="".concat(c,"('");s=n.regex,a=function(e,r,o){h+=m(t.slice(r,o)),e.forEach((function(t,e){t&&(h+=n.formats[e](t))}))},f=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),n=t.pop(),e=t.shift();return a(t,f,n),f=n+e.length,e})),h="try{".concat(h+="');","}catch(e){console.info(e)}"),n.withObject&&(h="with(".concat(o,"){").concat(h,"}")),h="".concat(c,".start();").concat(h,"return ").concat(c,".end();"),h+="\n//# sourceURL=".concat(e);var l=null;try{(l=new Function(o,u,c,i,h)).source="(function(".concat(o,",").concat(u,",").concat(c,",").concat(i,"){\n").concat(h,"\n})")}catch(t){throw t.filename=e,t.source=h,t}return l},this.configure(t)}var W=function(t,n){return n=(n=[t,n].join("/")).replace(/\/\//g,"/")},J=function(t,n){return fetch(W(t,n)).then((function(t){return t.text()}))},_=function(t,e){return new Promise((function(r,o){n.readFile(W(t,e),(function(t,n){t?o(t):r(n.toString())}))}))},q=function(t){return r(t)?t:s()?_:J};function D(t,n,e){if(!1===g(this,D))return new D(t,n,e);if(!1===g(n,A))throw new TypeError("cache is not instance of Cache");if(!1===g(e,L))throw new TypeError("compiler is not instance of Compiler");var o={},i=function(t,e){return n.set(t,e),e},c=function(t){return o.resolver(o.path,t)};this.configure=function(t){o.path=t.path,o.cache=t.cache,o.resolver=q(t.resolver)},this.get=function(t){return n.exist(t)?n.resolve(t):i(t,c(t).then((function(n){return i(t,function(t,n){return r(t)?t:e.compile(t,n)}(n,t))})))},this.configure(t)}function K(t){return Promise.all(t||[]).then((function(t){return t.join("")}))}var X=function(){var t=[],n=[];function e(t){n.push(t)}return e.start=function(){n=[]},e.backup=function(){t.push(n.concat()),n=[]},e.restore=function(){var e=n.concat();return n=t.pop(),K(e)},e.error=function(t){throw t},e.end=function(){return K(n)},e};function Y(t){if(!1===g(this,Y))return new Y(t);this.configure=function(t,n){var e=t.vars,i=e.BLOCKS,c=e.MACRO,u=e.EXTEND,s=e.LAYOUT,a=e.BUFFER,f=e.COMPONENT;function h(t){this[i]={},this[c]={},x(this,t||{})}this.create=function(t){return new h(t)},this.helpers=function(t){x(h.prototype,t||{})},h.prototype=x({},n||{}),h.method=h.define=function(t,n,e,r,o){Object.defineProperty(h.prototype,t,{value:n,writable:e||!1,configurable:r||!1,enumerable:o||!1})},h.define(a,X()),h.define(i,{},!0),h.define(c,{},!0),h.define(s,!1,!0),h.define(u,!1,!0),h.method("getMacro",(function(){return this[c]})),h.method("getBuffer",(function(){return this[a]})),h.method("getComponent",(function(){var t=this;return f in t?function(){return t[f].apply(t,arguments)}:function(){console.log("%s function not defined",f)}})),h.method("getBlocks",(function(){return this[i]})),h.method("setExtend",(function(t){this[u]=t})),h.method("getExtend",(function(){return this[u]})),h.method("setLayout",(function(t){this[s]=t})),h.method("getLayout",(function(){return this[s]})),h.method("clone",(function(t){var n=[s,u,a];return!0===t&&n.push(i),y(this,n)})),h.method("extend",(function(t){this.setExtend(!0),this.setLayout(t)})),h.method("echo",(function(){var t=this.getBuffer();[].slice.call(arguments).forEach(t)})),h.method("fn",(function(t){var n=this.getBuffer(),e=this;return function(){return n.backup(),r(t)&&t.apply(e,arguments),n.restore()}})),h.method("get",(function(t,n){var e=b(this,t,!0),r=e.shift(),o=e.pop();return k(r,o)?r[o]:n})),h.method("set",(function(t,n){var e=b(this,t,!1),r=e.shift(),o=e.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=n})),h.method("macro",(function(t,n){var e=this.getMacro(),r=this.fn(n),o=this;e[t]=function(){return o.echo(r.apply(void 0,arguments))}})),h.method("call",(function(t){var n=this.getMacro()[t],e=[].slice.call(arguments,1);if(r(n))return n.apply(n,e)})),h.method("block",(function(t,n){var e=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(n)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var n=i();return n?function(){e.echo(n(t()))}:E}()))}})),h.method("include",(function(t,n,e){var r=!1===e?{}:this.clone(!0),o=x(r,n||{}),i=this.render(t,o);this.echo(i)})),h.method("use",(function(t,n){var e=this.require(t);this.echo(O(e,(function(t){var e=this.getMacro();j(t,(function(t,r){e[[n,r].join(".")]=t}))}),this))})),h.method("async",(function(t,n){this.echo(O(t,(function(t){return this.fn(n)(t)}),this))})),h.method("node",(function(t,n,e){return T(t,n,e)})),h.method("el",(function(t,n,e){r(e)&&(e=this.fn(e)()),this.echo(O(e,(function(e){return T(t,n,e)}),this))})),h.method("each",(function(t,n){o(t)&&(t=this.get(t,[])),j(t,n)}))},this.configure(t)}function V(t){if(!1===g(this,V))return new V(t);var n={},e={};N(e,t||{});var r=new Y(e),o=new L(e),i=new A,c=new D(e,i,o),u=function(t,n){return c.get(t).then((function(t){return t.call(n,n,n.getComponent(),n.getBuffer(),v)}))},s=function t(n,o){var i=w(n,e.extension),c=r.create(o);return u(i,c).then((function(n){if(c.getExtend()){c.setExtend(!1);var e=c.getLayout(),r=c.clone();return t(e,r)}return n}))};this.configure=function(t){return N(e,t=t||{}),r.configure(e,n),o.configure(e),i.configure(e),c.configure(e),e},this.render=function(t,n){return s(t,n)},this.helpers=function(t){r.helpers(Object.assign(n,t||{}))},this.preload=function(t){return i.load(t||{})},this.create=function(t){return new V(t)},this.compile=function(t,n){return o.compile(t,n)},this.context=function(t){return r.create(t)},this.helpers({require:function(t){var n=w(t,e.extension),o=r.create({});return u(n,o).then((function(){return o.getMacro()}))},render:s})}var z=new V,G=z.render,H=z.context,I=z.compile,Q=z.helpers,Z=z.preload,tt=z.configure,nt=z.create;t.EJS=V,t.__express=function(t,c,u){r(c)&&(u=c,c={});var s=x({},(c=c||{}).settings),a=e(o,F.path,s.views),f=e(i,F.cache,s["view cache"]),h=x({},s["view options"]),l=n.relative(a,t);return h.path=a,h.cache=f,tt(h),G(l,c).then((function(t){u(null,t)})).catch((function(t){u(t)}))},t.compile=I,t.configure=tt,t.context=H,t.create=nt,t.element=T,t.helpers=Q,t.preload=Z,t.render=G,t.safeValue=v}));
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "EJS Templates",
4
4
  "homepage": "https://github.com/kosatyi/ejs",
5
5
  "type": "module",
6
- "version": "0.0.64",
6
+ "version": "0.0.65",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.js",
9
9
  "browser": "dist/umd/index.js",