@kosatyi/ejs 0.0.65 → 0.0.66
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 +2 -6
- package/dist/cjs/index.js +299 -162
- package/dist/esm/index.js +318 -223
- package/dist/umd/index.js +299 -162
- package/dist/umd/index.min.js +1 -1
- package/package.json +3 -9
package/dist/umd/index.js
CHANGED
|
@@ -94,11 +94,14 @@
|
|
|
94
94
|
}
|
|
95
95
|
return path;
|
|
96
96
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @type {<T extends {}, U, V, W,Y>(T,U,V,W,Y)=> T & U & V & W & Y}
|
|
100
|
+
*/
|
|
101
|
+
var extend = function extend(target) {
|
|
102
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
103
|
+
args[_key - 1] = arguments[_key];
|
|
100
104
|
}
|
|
101
|
-
var target = args.shift();
|
|
102
105
|
return args.filter(function (source) {
|
|
103
106
|
return source;
|
|
104
107
|
}).reduce(function (target, source) {
|
|
@@ -415,12 +418,41 @@
|
|
|
415
418
|
this.configure(config);
|
|
416
419
|
}
|
|
417
420
|
|
|
421
|
+
function _defineProperty(obj, key, value) {
|
|
422
|
+
key = _toPropertyKey(key);
|
|
423
|
+
if (key in obj) {
|
|
424
|
+
Object.defineProperty(obj, key, {
|
|
425
|
+
value: value,
|
|
426
|
+
enumerable: true,
|
|
427
|
+
configurable: true,
|
|
428
|
+
writable: true
|
|
429
|
+
});
|
|
430
|
+
} else {
|
|
431
|
+
obj[key] = value;
|
|
432
|
+
}
|
|
433
|
+
return obj;
|
|
434
|
+
}
|
|
435
|
+
function _toPrimitive(input, hint) {
|
|
436
|
+
if (typeof input !== "object" || input === null) return input;
|
|
437
|
+
var prim = input[Symbol.toPrimitive];
|
|
438
|
+
if (prim !== undefined) {
|
|
439
|
+
var res = prim.call(input, hint || "default");
|
|
440
|
+
if (typeof res !== "object") return res;
|
|
441
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
442
|
+
}
|
|
443
|
+
return (hint === "string" ? String : Number)(input);
|
|
444
|
+
}
|
|
445
|
+
function _toPropertyKey(arg) {
|
|
446
|
+
var key = _toPrimitive(arg, "string");
|
|
447
|
+
return typeof key === "symbol" ? key : String(key);
|
|
448
|
+
}
|
|
449
|
+
|
|
418
450
|
function resolve(list) {
|
|
419
451
|
return Promise.all(list || []).then(function (list) {
|
|
420
452
|
return list.join('');
|
|
421
453
|
});
|
|
422
454
|
}
|
|
423
|
-
|
|
455
|
+
function createBuffer() {
|
|
424
456
|
var store = [],
|
|
425
457
|
array = [];
|
|
426
458
|
function buffer(value) {
|
|
@@ -445,11 +477,12 @@
|
|
|
445
477
|
return resolve(array);
|
|
446
478
|
};
|
|
447
479
|
return buffer;
|
|
448
|
-
}
|
|
480
|
+
}
|
|
449
481
|
|
|
450
482
|
function Context(config) {
|
|
451
483
|
if (instanceOf(this, Context) === false) return new Context(config);
|
|
452
484
|
this.configure = function (config, methods) {
|
|
485
|
+
var _Object$definePropert;
|
|
453
486
|
var _config$vars = config.vars,
|
|
454
487
|
BLOCKS = _config$vars.BLOCKS,
|
|
455
488
|
MACRO = _config$vars.MACRO,
|
|
@@ -462,6 +495,7 @@
|
|
|
462
495
|
};
|
|
463
496
|
this.helpers = function (methods) {
|
|
464
497
|
extend(Scope.prototype, methods || {});
|
|
498
|
+
console.log('helpers', Scope.prototype);
|
|
465
499
|
};
|
|
466
500
|
function Scope(data) {
|
|
467
501
|
this[BLOCKS] = {};
|
|
@@ -469,168 +503,270 @@
|
|
|
469
503
|
extend(this, data || {});
|
|
470
504
|
}
|
|
471
505
|
Scope.prototype = extend({}, methods || {});
|
|
472
|
-
Scope.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
})
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
506
|
+
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, BUFFER, {
|
|
507
|
+
value: createBuffer(),
|
|
508
|
+
writable: true,
|
|
509
|
+
configurable: false,
|
|
510
|
+
enumerable: false
|
|
511
|
+
}), _defineProperty(_Object$definePropert, BLOCKS, {
|
|
512
|
+
value: {},
|
|
513
|
+
writable: true,
|
|
514
|
+
configurable: false,
|
|
515
|
+
enumerable: false
|
|
516
|
+
}), _defineProperty(_Object$definePropert, MACRO, {
|
|
517
|
+
value: {},
|
|
518
|
+
writable: true,
|
|
519
|
+
configurable: false,
|
|
520
|
+
enumerable: false
|
|
521
|
+
}), _defineProperty(_Object$definePropert, LAYOUT, {
|
|
522
|
+
value: false,
|
|
523
|
+
writable: true,
|
|
524
|
+
configurable: false,
|
|
525
|
+
enumerable: false
|
|
526
|
+
}), _defineProperty(_Object$definePropert, EXTEND, {
|
|
527
|
+
value: false,
|
|
528
|
+
writable: true,
|
|
529
|
+
configurable: false,
|
|
530
|
+
enumerable: false
|
|
531
|
+
}), _defineProperty(_Object$definePropert, "getMacro", {
|
|
532
|
+
value: function value() {
|
|
533
|
+
return this[MACRO];
|
|
534
|
+
},
|
|
535
|
+
writable: false,
|
|
536
|
+
configurable: false,
|
|
537
|
+
enumerable: false
|
|
538
|
+
}), _defineProperty(_Object$definePropert, "getBuffer", {
|
|
539
|
+
value: function value() {
|
|
540
|
+
return this[BUFFER];
|
|
541
|
+
},
|
|
542
|
+
writable: false,
|
|
543
|
+
configurable: false,
|
|
544
|
+
enumerable: false
|
|
545
|
+
}), _defineProperty(_Object$definePropert, "getComponent", {
|
|
546
|
+
value: function value() {
|
|
547
|
+
var context = this;
|
|
548
|
+
if (COMPONENT in context) {
|
|
549
|
+
return function () {
|
|
550
|
+
return context[COMPONENT].apply(context, arguments);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
494
553
|
return function () {
|
|
495
|
-
|
|
554
|
+
console.log('%s function not defined', COMPONENT);
|
|
496
555
|
};
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
})
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
556
|
+
},
|
|
557
|
+
writable: false,
|
|
558
|
+
configurable: false,
|
|
559
|
+
enumerable: false
|
|
560
|
+
}), _defineProperty(_Object$definePropert, "getBlocks", {
|
|
561
|
+
value: function value() {
|
|
562
|
+
return this[BLOCKS];
|
|
563
|
+
},
|
|
564
|
+
writable: false,
|
|
565
|
+
configurable: false,
|
|
566
|
+
enumerable: false
|
|
567
|
+
}), _defineProperty(_Object$definePropert, "setExtend", {
|
|
568
|
+
value: function value(_value) {
|
|
569
|
+
this[EXTEND] = _value;
|
|
570
|
+
},
|
|
571
|
+
writable: false,
|
|
572
|
+
configurable: false,
|
|
573
|
+
enumerable: false
|
|
574
|
+
}), _defineProperty(_Object$definePropert, "getExtend", {
|
|
575
|
+
value: function value() {
|
|
576
|
+
return this[EXTEND];
|
|
577
|
+
},
|
|
578
|
+
writable: false,
|
|
579
|
+
configurable: false,
|
|
580
|
+
enumerable: false
|
|
581
|
+
}), _defineProperty(_Object$definePropert, "setLayout", {
|
|
582
|
+
value: function value(layout) {
|
|
583
|
+
this[LAYOUT] = layout;
|
|
584
|
+
},
|
|
585
|
+
writable: false,
|
|
586
|
+
configurable: false,
|
|
587
|
+
enumerable: false
|
|
588
|
+
}), _defineProperty(_Object$definePropert, "getLayout", {
|
|
589
|
+
value: function value() {
|
|
590
|
+
return this[LAYOUT];
|
|
591
|
+
},
|
|
592
|
+
writable: false,
|
|
593
|
+
configurable: false,
|
|
594
|
+
enumerable: false
|
|
595
|
+
}), _defineProperty(_Object$definePropert, "clone", {
|
|
596
|
+
value: function value(exclude_blocks) {
|
|
597
|
+
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
598
|
+
if (exclude_blocks === true) {
|
|
599
|
+
filter.push(BLOCKS);
|
|
540
600
|
}
|
|
541
|
-
return
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
601
|
+
return omit(this, filter);
|
|
602
|
+
},
|
|
603
|
+
writable: false,
|
|
604
|
+
configurable: false,
|
|
605
|
+
enumerable: false
|
|
606
|
+
}), _defineProperty(_Object$definePropert, "extend", {
|
|
607
|
+
value: function value(layout) {
|
|
608
|
+
this.setExtend(true);
|
|
609
|
+
this.setLayout(layout);
|
|
610
|
+
},
|
|
611
|
+
writable: false,
|
|
612
|
+
configurable: false,
|
|
613
|
+
enumerable: false
|
|
614
|
+
}), _defineProperty(_Object$definePropert, "echo", {
|
|
615
|
+
value: function value(layout) {
|
|
616
|
+
var buffer = this.getBuffer();
|
|
617
|
+
var params = [].slice.call(arguments);
|
|
618
|
+
params.forEach(buffer);
|
|
619
|
+
},
|
|
620
|
+
writable: false,
|
|
621
|
+
configurable: false,
|
|
622
|
+
enumerable: false
|
|
623
|
+
}), _defineProperty(_Object$definePropert, "fn", {
|
|
624
|
+
value: function value(callback) {
|
|
625
|
+
var buffer = this.getBuffer();
|
|
626
|
+
var context = this;
|
|
627
|
+
return function () {
|
|
628
|
+
buffer.backup();
|
|
629
|
+
if (isFunction(callback)) {
|
|
630
|
+
callback.apply(context, arguments);
|
|
631
|
+
}
|
|
632
|
+
return buffer.restore();
|
|
633
|
+
};
|
|
634
|
+
},
|
|
635
|
+
writable: false,
|
|
636
|
+
configurable: false,
|
|
637
|
+
enumerable: false
|
|
638
|
+
}), _defineProperty(_Object$definePropert, "get", {
|
|
639
|
+
value: function value(name, defaults) {
|
|
640
|
+
var path = getPath(this, name, true);
|
|
641
|
+
var result = path.shift();
|
|
642
|
+
var prop = path.pop();
|
|
643
|
+
return hasProp(result, prop) ? result[prop] : defaults;
|
|
644
|
+
},
|
|
645
|
+
writable: false,
|
|
646
|
+
configurable: false,
|
|
647
|
+
enumerable: false
|
|
648
|
+
}), _defineProperty(_Object$definePropert, "set", {
|
|
649
|
+
value: function value(name, _value2) {
|
|
650
|
+
var path = getPath(this, name, false);
|
|
651
|
+
var result = path.shift();
|
|
652
|
+
var prop = path.pop();
|
|
653
|
+
if (this.getExtend() && hasProp(result, prop)) {
|
|
654
|
+
return result[prop];
|
|
593
655
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
this.echo(promise);
|
|
602
|
-
});
|
|
603
|
-
Scope.method('use', function (path, namespace) {
|
|
604
|
-
var promise = this.require(path);
|
|
605
|
-
this.echo(resolve$1(promise, function (exports) {
|
|
656
|
+
return result[prop] = _value2;
|
|
657
|
+
},
|
|
658
|
+
writable: false,
|
|
659
|
+
configurable: false,
|
|
660
|
+
enumerable: false
|
|
661
|
+
}), _defineProperty(_Object$definePropert, "macro", {
|
|
662
|
+
value: function value(name, callback) {
|
|
606
663
|
var list = this.getMacro();
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
})
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
664
|
+
var macro = this.fn(callback);
|
|
665
|
+
var context = this;
|
|
666
|
+
list[name] = function () {
|
|
667
|
+
return context.echo(macro.apply(undefined, arguments));
|
|
668
|
+
};
|
|
669
|
+
},
|
|
670
|
+
writable: false,
|
|
671
|
+
configurable: false,
|
|
672
|
+
enumerable: false
|
|
673
|
+
}), _defineProperty(_Object$definePropert, "call", {
|
|
674
|
+
value: function value(name) {
|
|
675
|
+
var list = this.getMacro();
|
|
676
|
+
var macro = list[name];
|
|
677
|
+
var params = [].slice.call(arguments, 1);
|
|
678
|
+
if (isFunction(macro)) {
|
|
679
|
+
return macro.apply(macro, params);
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
writable: false,
|
|
683
|
+
configurable: false,
|
|
684
|
+
enumerable: false
|
|
685
|
+
}), _defineProperty(_Object$definePropert, "block", {
|
|
686
|
+
value: function value(name, callback) {
|
|
687
|
+
var _this = this;
|
|
688
|
+
var blocks = this.getBlocks();
|
|
689
|
+
blocks[name] = blocks[name] || [];
|
|
690
|
+
blocks[name].push(this.fn(callback));
|
|
691
|
+
if (this.getExtend()) return;
|
|
692
|
+
var list = Object.assign([], blocks[name]);
|
|
693
|
+
var current = function current() {
|
|
694
|
+
return list.shift();
|
|
695
|
+
};
|
|
696
|
+
var next = function next() {
|
|
697
|
+
var parent = current();
|
|
698
|
+
if (parent) {
|
|
699
|
+
return function () {
|
|
700
|
+
_this.echo(parent(next()));
|
|
701
|
+
};
|
|
702
|
+
} else {
|
|
703
|
+
return noop;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
this.echo(current()(next()));
|
|
707
|
+
},
|
|
708
|
+
writable: false,
|
|
709
|
+
configurable: false,
|
|
710
|
+
enumerable: false
|
|
711
|
+
}), _defineProperty(_Object$definePropert, "include", {
|
|
712
|
+
value: function value(path, data, cx) {
|
|
713
|
+
var context = cx === false ? {} : this.clone(true);
|
|
714
|
+
var params = extend(context, data || {});
|
|
715
|
+
var promise = this.render(path, params);
|
|
716
|
+
this.echo(promise);
|
|
717
|
+
},
|
|
718
|
+
writable: false,
|
|
719
|
+
configurable: false,
|
|
720
|
+
enumerable: false
|
|
721
|
+
}), _defineProperty(_Object$definePropert, "use", {
|
|
722
|
+
value: function value(path, namespace) {
|
|
723
|
+
var promise = this.require(path);
|
|
724
|
+
this.echo(resolve$1(promise, function (exports) {
|
|
725
|
+
var list = this.getMacro();
|
|
726
|
+
each(exports, function (macro, name) {
|
|
727
|
+
list[[namespace, name].join('.')] = macro;
|
|
728
|
+
});
|
|
729
|
+
}, this));
|
|
730
|
+
},
|
|
731
|
+
writable: false,
|
|
732
|
+
configurable: false,
|
|
733
|
+
enumerable: false
|
|
734
|
+
}), _defineProperty(_Object$definePropert, "async", {
|
|
735
|
+
value: function value(promise, callback) {
|
|
736
|
+
this.echo(resolve$1(promise, function (data) {
|
|
737
|
+
return this.fn(callback)(data);
|
|
738
|
+
}, this));
|
|
739
|
+
},
|
|
740
|
+
writable: false,
|
|
741
|
+
configurable: false,
|
|
742
|
+
enumerable: false
|
|
743
|
+
}), _defineProperty(_Object$definePropert, "each", {
|
|
744
|
+
value: function value(object, callback) {
|
|
745
|
+
if (isString(object)) {
|
|
746
|
+
object = this.get(object, []);
|
|
747
|
+
}
|
|
748
|
+
each(object, callback);
|
|
749
|
+
},
|
|
750
|
+
writable: false,
|
|
751
|
+
configurable: false,
|
|
752
|
+
enumerable: false
|
|
753
|
+
}), _defineProperty(_Object$definePropert, "element", {
|
|
754
|
+
value: function value(tag, attr, content) {
|
|
625
755
|
return element(tag, attr, content);
|
|
626
|
-
}, this));
|
|
627
|
-
});
|
|
628
|
-
Scope.method('each', function (object, callback) {
|
|
629
|
-
if (isString(object)) {
|
|
630
|
-
object = this.get(object, []);
|
|
631
756
|
}
|
|
632
|
-
|
|
633
|
-
|
|
757
|
+
}), _defineProperty(_Object$definePropert, "el", {
|
|
758
|
+
value: function value(tag, attr, content) {
|
|
759
|
+
if (isFunction(content)) {
|
|
760
|
+
content = this.fn(content)();
|
|
761
|
+
}
|
|
762
|
+
this.echo(resolve$1(content, function (content) {
|
|
763
|
+
return this.element(tag, attr, content);
|
|
764
|
+
}, this));
|
|
765
|
+
},
|
|
766
|
+
writable: false,
|
|
767
|
+
configurable: false,
|
|
768
|
+
enumerable: false
|
|
769
|
+
}), _Object$definePropert));
|
|
634
770
|
};
|
|
635
771
|
this.configure(config);
|
|
636
772
|
}
|
|
@@ -682,7 +818,7 @@
|
|
|
682
818
|
return render(name, data);
|
|
683
819
|
};
|
|
684
820
|
this.helpers = function (methods) {
|
|
685
|
-
context.helpers(
|
|
821
|
+
context.helpers(extend(scope, methods));
|
|
686
822
|
};
|
|
687
823
|
this.preload = function (list) {
|
|
688
824
|
return cache.load(list || {});
|
|
@@ -700,6 +836,7 @@
|
|
|
700
836
|
require: require,
|
|
701
837
|
render: render
|
|
702
838
|
});
|
|
839
|
+
return this;
|
|
703
840
|
}
|
|
704
841
|
|
|
705
842
|
var ejs = new EJS();
|
package/dist/umd/index.min.js
CHANGED
|
@@ -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={"&":"&","<":"<",">":">",'"':""","'":"'"},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}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).ejs={})}(this,(function(e){"use strict";var n={},t=function(){var e=[].slice.call(arguments),n=e.shift();return e.filter(n).pop()},r=function(e){return"function"==typeof e},i=function(e){return"string"==typeof e},o=function(e){return"boolean"==typeof e},u=function(e){return void 0===e},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),a=function(){return c},l={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},s={"&":"&","<":"<",">":">",'"':""","'":"'"},f=function(e){return new RegExp(["[",Object.keys(e).join(""),"]"].join(""),"g")},h=f(s),p=f(l),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(h,(function(e){return s[e]}))},v=function(e){return(""+e).replace(p,(function(e){return"\\"+l[e]}))},g=function(e,n){var t=e;return null==t?"":!0===n?b(t):t},m=function(e,n){return Boolean(e instanceof n)},w=function(e,n,t){for(var i=e,o=String(n).split("."),u=o.pop(),c=0;c<o.length;c++){var a=o[c];if(r(i.toJSON)&&(i=i.toJSON()),t&&!1===i.hasOwnProperty(a)){i={};break}i=i[a]=i[a]||{}}return r(i.toJSON)&&(i=i.toJSON()),[i,u]},d=function(e,n){var t=e.split(".").pop();return t!==n&&(e=[e,n].join(".")),e},y=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];return t.filter((function(e){return e})).reduce((function(e,n){return Object.assign(e,n)}),e)},x=function(){},E=function(e,n){var t;for(t in e)k(e,t)&&n(e[t],t,e)},j=function(e,n){return function(e,n,t){var r=e instanceof Array,i=r?[]:{};return E(e,(function(e,t,o){var c=n(e,t,o);!1===u(c)&&(r?i.push(c):i[t]=c)})),i}(e,(function(e,t){if(-1===n.indexOf(t))return e}))},O=function(e,n,t){return Promise.resolve(e).then(n.bind(t))},k=function(e,n){return e&&e.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=" ",P='"',R="/",T="<",$=">",C=function(e,n,t){var r=[],i=-1===S.indexOf(e),o=function(e,n,t){var r=[];return E(e,(function(e,t,i){var o=n(e,t,i);!1===u(o)&&r.push(o)})),r}(n,(function(e,n){if(null!=e)return[b(n),[P,b(e),P].join("")].join("=")})).join(B);return r.push([T,e,B,o,$].join("")),t&&r.push(t instanceof Array?t.join(""):t),i&&r.push([T,R,e,$].join("")),r.join("")},N=function(e,n){y(e,{path:t(i,F.path,e.path,n.path),export:t(i,F.export,e.export,n.export),resolver:t(r,F.resolver,e.resolver,n.resolver),extension:t(i,F.extension,e.extension,n.extension),withObject:t(o,F.withObject,e.withObject,n.withObject),rmWhitespace:t(o,F.rmWhitespace,e.rmWhitespace,n.rmWhitespace),cache:t(o,F.cache,e.cache,n.cache),token:y({},F.token,e.token,n.token),vars:y({},F.vars,e.vars,n.vars)})},U="undefined"!=typeof globalThis?globalThis:window||self;function A(e){if(!1===m(this,A))return new A;var n={enabled:!0,list:{}};this.configure=function(e){n.enabled=e.cache,!1===a()&&this.load(U[e.export])},this.clear=function(){n.list={}},this.load=function(e){return n.enabled&&y(n.list,e||{}),this},this.get=function(e){if(n.enabled)return n.list[e]},this.set=function(e,t){return n.enabled&&(n.list[e]=t),this},this.resolve=function(e){return Promise.resolve(this.get(e))},this.remove=function(e){delete n.list[e]},this.exist=function(e){return k(n.list,e)}}var M=[{symbol:"-",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(e){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(e,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(e){return"')\n/**".concat(e,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(e){return"')\n".concat(e.trim(),"\n").concat(this.BUFFER,"('")}}];function L(e){if(!1===m(this,L))return new L(e);var n={};this.configure=function(e){n.withObject=e.withObject,n.rmWhitespace=e.rmWhitespace,n.token=e.token,n.vars=e.vars,n.matches=[],n.formats=[],n.slurp={match:"[ \\t]*",start:[n.token.start,"_"],end:["_",n.token.end]},M.forEach((function(e){n.matches.push(n.token.start.concat(e.symbol).concat(n.token.regex).concat(n.token.end)),n.formats.push(e.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(e,t){var r=n.vars,i=r.SCOPE,o=r.SAFE,u=r.BUFFER,c=r.COMPONENT;n.rmWhitespace&&(e=e.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),e=e.replace(n.slurpStart,n.token.start).replace(n.slurpEnd,n.token.end);var a,l,s,f="".concat(u,"('");a=n.regex,l=function(t,r,i){f+=v(e.slice(r,i)),t.forEach((function(e,t){e&&(f+=n.formats[t](e))}))},s=0,e.replace(a,(function(){var e=[].slice.call(arguments,0,-1),n=e.pop(),t=e.shift();return l(e,s,n),s=n+t.length,t})),f="try{".concat(f+="');","}catch(e){console.info(e)}"),n.withObject&&(f="with(".concat(i,"){").concat(f,"}")),f="".concat(u,".start();").concat(f,"return ").concat(u,".end();"),f+="\n//# sourceURL=".concat(t);var h=null;try{(h=new Function(i,c,u,o,f)).source="(function(".concat(i,",").concat(c,",").concat(u,",").concat(o,"){\n").concat(f,"\n})")}catch(e){throw e.filename=t,e.source=f,e}return h},this.configure(e)}var W=function(e,n){return n=(n=[e,n].join("/")).replace(/\/\//g,"/")},J=function(e,n){return fetch(W(e,n)).then((function(e){return e.text()}))},_=function(e,t){return new Promise((function(r,i){n.readFile(W(e,t),(function(e,n){e?i(e):r(n.toString())}))}))},q=function(e){return r(e)?e:a()?_:J};function D(e,n,t){if(!1===m(this,D))return new D(e,n,t);if(!1===m(n,A))throw new TypeError("cache is not instance of Cache");if(!1===m(t,L))throw new TypeError("compiler is not instance of Compiler");var i={},o=function(e,t){return n.set(e,t),t},u=function(e){return i.resolver(i.path,e)};this.configure=function(e){i.path=e.path,i.cache=e.cache,i.resolver=q(e.resolver)},this.get=function(e){return n.exist(e)?n.resolve(e):o(e,u(e).then((function(n){return o(e,function(e,n){return r(e)?e:t.compile(e,n)}(n,e))})))},this.configure(e)}function K(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function X(e){return Promise.all(e||[]).then((function(e){return e.join("")}))}function Y(){var e=[],n=[];function t(e){n.push(e)}return t.start=function(){n=[]},t.backup=function(){e.push(n.concat()),n=[]},t.restore=function(){var t=n.concat();return n=e.pop(),X(t)},t.error=function(e){throw e},t.end=function(){return X(n)},t}function V(e){if(!1===m(this,V))return new V(e);this.configure=function(e,n){var t,o=e.vars,u=o.BLOCKS,c=o.MACRO,a=o.EXTEND,l=o.LAYOUT,s=o.BUFFER,f=o.COMPONENT;function h(e){this[u]={},this[c]={},y(this,e||{})}this.create=function(e){return new h(e)},this.helpers=function(e){y(h.prototype,e||{}),console.log("helpers",h.prototype)},h.prototype=y({},n||{}),Object.defineProperties(h.prototype,(K(t={},s,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),K(t,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),K(t,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),K(t,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),K(t,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),K(t,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),K(t,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),K(t,"getComponent",{value:function(){var e=this;return f in e?function(){return e[f].apply(e,arguments)}:function(){console.log("%s function not defined",f)}},writable:!1,configurable:!1,enumerable:!1}),K(t,"getBlocks",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),K(t,"setExtend",{value:function(e){this[a]=e},writable:!1,configurable:!1,enumerable:!1}),K(t,"getExtend",{value:function(){return this[a]},writable:!1,configurable:!1,enumerable:!1}),K(t,"setLayout",{value:function(e){this[l]=e},writable:!1,configurable:!1,enumerable:!1}),K(t,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),K(t,"clone",{value:function(e){var n=[l,a,s];return!0===e&&n.push(u),j(this,n)},writable:!1,configurable:!1,enumerable:!1}),K(t,"extend",{value:function(e){this.setExtend(!0),this.setLayout(e)},writable:!1,configurable:!1,enumerable:!1}),K(t,"echo",{value:function(e){var n=this.getBuffer();[].slice.call(arguments).forEach(n)},writable:!1,configurable:!1,enumerable:!1}),K(t,"fn",{value:function(e){var n=this.getBuffer(),t=this;return function(){return n.backup(),r(e)&&e.apply(t,arguments),n.restore()}},writable:!1,configurable:!1,enumerable:!1}),K(t,"get",{value:function(e,n){var t=w(this,e,!0),r=t.shift(),i=t.pop();return k(r,i)?r[i]:n},writable:!1,configurable:!1,enumerable:!1}),K(t,"set",{value:function(e,n){var t=w(this,e,!1),r=t.shift(),i=t.pop();return this.getExtend()&&k(r,i)?r[i]:r[i]=n},writable:!1,configurable:!1,enumerable:!1}),K(t,"macro",{value:function(e,n){var t=this.getMacro(),r=this.fn(n),i=this;t[e]=function(){return i.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),K(t,"call",{value:function(e){var n=this.getMacro()[e],t=[].slice.call(arguments,1);if(r(n))return n.apply(n,t)},writable:!1,configurable:!1,enumerable:!1}),K(t,"block",{value:function(e,n){var t=this,r=this.getBlocks();if(r[e]=r[e]||[],r[e].push(this.fn(n)),!this.getExtend()){var i=Object.assign([],r[e]),o=function(){return i.shift()};this.echo(o()(function e(){var n=o();return n?function(){t.echo(n(e()))}:x}()))}},writable:!1,configurable:!1,enumerable:!1}),K(t,"include",{value:function(e,n,t){var r=!1===t?{}:this.clone(!0),i=y(r,n||{}),o=this.render(e,i);this.echo(o)},writable:!1,configurable:!1,enumerable:!1}),K(t,"use",{value:function(e,n){var t=this.require(e);this.echo(O(t,(function(e){var t=this.getMacro();E(e,(function(e,r){t[[n,r].join(".")]=e}))}),this))},writable:!1,configurable:!1,enumerable:!1}),K(t,"async",{value:function(e,n){this.echo(O(e,(function(e){return this.fn(n)(e)}),this))},writable:!1,configurable:!1,enumerable:!1}),K(t,"each",{value:function(e,n){i(e)&&(e=this.get(e,[])),E(e,n)},writable:!1,configurable:!1,enumerable:!1}),K(t,"element",{value:function(e,n,t){return C(e,n,t)}}),K(t,"el",{value:function(e,n,t){r(t)&&(t=this.fn(t)()),this.echo(O(t,(function(t){return this.element(e,n,t)}),this))},writable:!1,configurable:!1,enumerable:!1}),t))},this.configure(e)}function z(e){if(!1===m(this,z))return new z(e);var n={},t={};N(t,e||{});var r=new V(t),i=new L(t),o=new A,u=new D(t,o,i),c=function(e,n){return u.get(e).then((function(e){return e.call(n,n,n.getComponent(),n.getBuffer(),g)}))},a=function e(n,i){var o=d(n,t.extension),u=r.create(i);return c(o,u).then((function(n){if(u.getExtend()){u.setExtend(!1);var t=u.getLayout(),r=u.clone();return e(t,r)}return n}))};return this.configure=function(e){return N(t,e=e||{}),r.configure(t,n),i.configure(t),o.configure(t),u.configure(t),t},this.render=function(e,n){return a(e,n)},this.helpers=function(e){r.helpers(y(n,e))},this.preload=function(e){return o.load(e||{})},this.create=function(e){return new z(e)},this.compile=function(e,n){return i.compile(e,n)},this.context=function(e){return r.create(e)},this.helpers({require:function(e){var n=d(e,t.extension),i=r.create({});return c(n,i).then((function(){return i.getMacro()}))},render:a}),this}var G=new z,H=G.render,I=G.context,Q=G.compile,Z=G.helpers,ee=G.preload,ne=G.configure,te=G.create;e.EJS=z,e.__express=function(e,u,c){r(u)&&(c=u,u={});var a=y({},(u=u||{}).settings),l=t(i,F.path,a.views),s=t(o,F.cache,a["view cache"]),f=y({},a["view options"]),h=n.relative(l,e);return f.path=l,f.cache=s,ne(f),H(h,u).then((function(e){c(null,e)})).catch((function(e){c(e)}))},e.compile=Q,e.configure=ne,e.context=I,e.create=te,e.element=C,e.helpers=Z,e.preload=ee,e.render=H,e.safeValue=g}));
|
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.
|
|
6
|
+
"version": "0.0.66",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
9
9
|
"browser": "dist/umd/index.js",
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/core": "^7.20.12",
|
|
35
35
|
"@babel/preset-env": "^7.20.2",
|
|
36
|
-
"@kosatyi/
|
|
37
|
-
"@kosatyi/rollup": "^0.0.15"
|
|
36
|
+
"@kosatyi/rollup": "^0.0.19"
|
|
38
37
|
},
|
|
39
38
|
"license": "MIT",
|
|
40
39
|
"bugs": {
|
|
@@ -48,10 +47,5 @@
|
|
|
48
47
|
"ejs",
|
|
49
48
|
"template-engine",
|
|
50
49
|
"nodejs"
|
|
51
|
-
]
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"@kosatyi/is-type": "^0.0.5",
|
|
54
|
-
"chokidar": "^3.5.3",
|
|
55
|
-
"ejs": "npm:@kosatyi/ejs@^0.0.62"
|
|
56
|
-
}
|
|
50
|
+
]
|
|
57
51
|
}
|