@kosatyi/ejs 0.0.79 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser.js +54 -60
- package/dist/cjs/index.js +54 -60
- package/dist/cjs/worker.js +84 -95
- package/dist/umd/browser.js +54 -60
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +54 -60
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +84 -95
- package/dist/umd/worker.min.js +1 -1
- package/package.json +11 -3
package/dist/cjs/browser.js
CHANGED
|
@@ -381,33 +381,27 @@ function Template(config, cache, compiler) {
|
|
|
381
381
|
this.configure(config);
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
function _defineProperty(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
writable: true
|
|
392
|
-
});
|
|
393
|
-
} else {
|
|
394
|
-
obj[key] = value;
|
|
395
|
-
}
|
|
396
|
-
return obj;
|
|
384
|
+
function _defineProperty(e, r, t) {
|
|
385
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
386
|
+
value: t,
|
|
387
|
+
enumerable: !0,
|
|
388
|
+
configurable: !0,
|
|
389
|
+
writable: !0
|
|
390
|
+
}) : e[r] = t, e;
|
|
397
391
|
}
|
|
398
|
-
function _toPrimitive(
|
|
399
|
-
if (
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
402
|
-
var
|
|
403
|
-
if (
|
|
392
|
+
function _toPrimitive(t, r) {
|
|
393
|
+
if ("object" != typeof t || !t) return t;
|
|
394
|
+
var e = t[Symbol.toPrimitive];
|
|
395
|
+
if (void 0 !== e) {
|
|
396
|
+
var i = e.call(t, r || "default");
|
|
397
|
+
if ("object" != typeof i) return i;
|
|
404
398
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
405
399
|
}
|
|
406
|
-
return (
|
|
400
|
+
return ("string" === r ? String : Number)(t);
|
|
407
401
|
}
|
|
408
|
-
function _toPropertyKey(
|
|
409
|
-
var
|
|
410
|
-
return
|
|
402
|
+
function _toPropertyKey(t) {
|
|
403
|
+
var i = _toPrimitive(t, "string");
|
|
404
|
+
return "symbol" == typeof i ? i : i + "";
|
|
411
405
|
}
|
|
412
406
|
|
|
413
407
|
var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
@@ -520,46 +514,46 @@ function Context(config) {
|
|
|
520
514
|
extend(this, data || {});
|
|
521
515
|
}
|
|
522
516
|
Scope.prototype = extend({}, methods || {});
|
|
523
|
-
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, BUFFER, {
|
|
517
|
+
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
|
|
524
518
|
value: createBuffer(),
|
|
525
519
|
writable: true,
|
|
526
520
|
configurable: false,
|
|
527
521
|
enumerable: false
|
|
528
|
-
}),
|
|
522
|
+
}), BLOCKS, {
|
|
529
523
|
value: {},
|
|
530
524
|
writable: true,
|
|
531
525
|
configurable: false,
|
|
532
526
|
enumerable: false
|
|
533
|
-
}),
|
|
527
|
+
}), MACRO, {
|
|
534
528
|
value: {},
|
|
535
529
|
writable: true,
|
|
536
530
|
configurable: false,
|
|
537
531
|
enumerable: false
|
|
538
|
-
}),
|
|
532
|
+
}), LAYOUT, {
|
|
539
533
|
value: false,
|
|
540
534
|
writable: true,
|
|
541
535
|
configurable: false,
|
|
542
536
|
enumerable: false
|
|
543
|
-
}),
|
|
537
|
+
}), EXTEND, {
|
|
544
538
|
value: false,
|
|
545
539
|
writable: true,
|
|
546
540
|
configurable: false,
|
|
547
541
|
enumerable: false
|
|
548
|
-
}),
|
|
542
|
+
}), "getMacro", {
|
|
549
543
|
value: function value() {
|
|
550
544
|
return this[MACRO];
|
|
551
545
|
},
|
|
552
546
|
writable: false,
|
|
553
547
|
configurable: false,
|
|
554
548
|
enumerable: false
|
|
555
|
-
}),
|
|
549
|
+
}), "getBuffer", {
|
|
556
550
|
value: function value() {
|
|
557
551
|
return this[BUFFER];
|
|
558
552
|
},
|
|
559
553
|
writable: false,
|
|
560
554
|
configurable: false,
|
|
561
555
|
enumerable: false
|
|
562
|
-
}),
|
|
556
|
+
}), "getComponent", {
|
|
563
557
|
value: function value() {
|
|
564
558
|
var context = this;
|
|
565
559
|
if (COMPONENT in context) {
|
|
@@ -574,42 +568,42 @@ function Context(config) {
|
|
|
574
568
|
writable: false,
|
|
575
569
|
configurable: false,
|
|
576
570
|
enumerable: false
|
|
577
|
-
}),
|
|
571
|
+
}), "getBlocks", {
|
|
578
572
|
value: function value() {
|
|
579
573
|
return this[BLOCKS];
|
|
580
574
|
},
|
|
581
575
|
writable: false,
|
|
582
576
|
configurable: false,
|
|
583
577
|
enumerable: false
|
|
584
|
-
}),
|
|
578
|
+
}), "setExtend", {
|
|
585
579
|
value: function value(_value) {
|
|
586
580
|
this[EXTEND] = _value;
|
|
587
581
|
},
|
|
588
582
|
writable: false,
|
|
589
583
|
configurable: false,
|
|
590
584
|
enumerable: false
|
|
591
|
-
}), _defineProperty(_Object$definePropert, "getExtend", {
|
|
585
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
|
|
592
586
|
value: function value() {
|
|
593
587
|
return this[EXTEND];
|
|
594
588
|
},
|
|
595
589
|
writable: false,
|
|
596
590
|
configurable: false,
|
|
597
591
|
enumerable: false
|
|
598
|
-
}),
|
|
592
|
+
}), "setLayout", {
|
|
599
593
|
value: function value(layout) {
|
|
600
594
|
this[LAYOUT] = layout;
|
|
601
595
|
},
|
|
602
596
|
writable: false,
|
|
603
597
|
configurable: false,
|
|
604
598
|
enumerable: false
|
|
605
|
-
}),
|
|
599
|
+
}), "getLayout", {
|
|
606
600
|
value: function value() {
|
|
607
601
|
return this[LAYOUT];
|
|
608
602
|
},
|
|
609
603
|
writable: false,
|
|
610
604
|
configurable: false,
|
|
611
605
|
enumerable: false
|
|
612
|
-
}),
|
|
606
|
+
}), "clone", {
|
|
613
607
|
value: function value(exclude_blocks) {
|
|
614
608
|
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
615
609
|
if (exclude_blocks === true) {
|
|
@@ -620,7 +614,7 @@ function Context(config) {
|
|
|
620
614
|
writable: false,
|
|
621
615
|
configurable: false,
|
|
622
616
|
enumerable: false
|
|
623
|
-
}),
|
|
617
|
+
}), "extend", {
|
|
624
618
|
value: function value(layout) {
|
|
625
619
|
this.setExtend(true);
|
|
626
620
|
this.setLayout(layout);
|
|
@@ -628,7 +622,7 @@ function Context(config) {
|
|
|
628
622
|
writable: false,
|
|
629
623
|
configurable: false,
|
|
630
624
|
enumerable: false
|
|
631
|
-
}),
|
|
625
|
+
}), "echo", {
|
|
632
626
|
value: function value(layout) {
|
|
633
627
|
var buffer = this.getBuffer();
|
|
634
628
|
var params = [].slice.call(arguments);
|
|
@@ -637,7 +631,7 @@ function Context(config) {
|
|
|
637
631
|
writable: false,
|
|
638
632
|
configurable: false,
|
|
639
633
|
enumerable: false
|
|
640
|
-
}),
|
|
634
|
+
}), "fn", {
|
|
641
635
|
value: function value(callback) {
|
|
642
636
|
var buffer = this.getBuffer();
|
|
643
637
|
var context = this;
|
|
@@ -652,7 +646,7 @@ function Context(config) {
|
|
|
652
646
|
writable: false,
|
|
653
647
|
configurable: false,
|
|
654
648
|
enumerable: false
|
|
655
|
-
}),
|
|
649
|
+
}), "get", {
|
|
656
650
|
value: function value(name, defaults) {
|
|
657
651
|
var path = getPath(this, name, true);
|
|
658
652
|
var result = path.shift();
|
|
@@ -662,7 +656,7 @@ function Context(config) {
|
|
|
662
656
|
writable: true,
|
|
663
657
|
configurable: true,
|
|
664
658
|
enumerable: false
|
|
665
|
-
}),
|
|
659
|
+
}), "set", {
|
|
666
660
|
value: function value(name, _value2) {
|
|
667
661
|
var path = getPath(this, name, false);
|
|
668
662
|
var result = path.shift();
|
|
@@ -675,7 +669,7 @@ function Context(config) {
|
|
|
675
669
|
writable: false,
|
|
676
670
|
configurable: false,
|
|
677
671
|
enumerable: false
|
|
678
|
-
}),
|
|
672
|
+
}), "macro", {
|
|
679
673
|
value: function value(name, callback) {
|
|
680
674
|
var list = this.getMacro();
|
|
681
675
|
var macro = this.fn(callback);
|
|
@@ -687,7 +681,7 @@ function Context(config) {
|
|
|
687
681
|
writable: false,
|
|
688
682
|
configurable: false,
|
|
689
683
|
enumerable: false
|
|
690
|
-
}), _defineProperty(_Object$definePropert, "call", {
|
|
684
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
691
685
|
value: function value(name) {
|
|
692
686
|
var list = this.getMacro();
|
|
693
687
|
var macro = list[name];
|
|
@@ -699,7 +693,7 @@ function Context(config) {
|
|
|
699
693
|
writable: false,
|
|
700
694
|
configurable: false,
|
|
701
695
|
enumerable: false
|
|
702
|
-
}),
|
|
696
|
+
}), "block", {
|
|
703
697
|
value: function value(name, callback) {
|
|
704
698
|
var _this = this;
|
|
705
699
|
var blocks = this.getBlocks();
|
|
@@ -710,29 +704,29 @@ function Context(config) {
|
|
|
710
704
|
var current = function current() {
|
|
711
705
|
return list.shift();
|
|
712
706
|
};
|
|
713
|
-
var
|
|
707
|
+
var _next = function next() {
|
|
714
708
|
var parent = current();
|
|
715
709
|
if (parent) {
|
|
716
710
|
return function () {
|
|
717
|
-
_this.echo(parent(
|
|
711
|
+
_this.echo(parent(_next()));
|
|
718
712
|
};
|
|
719
713
|
} else {
|
|
720
714
|
return noop;
|
|
721
715
|
}
|
|
722
716
|
};
|
|
723
|
-
this.echo(current()(
|
|
717
|
+
this.echo(current()(_next()));
|
|
724
718
|
},
|
|
725
719
|
writable: false,
|
|
726
720
|
configurable: false,
|
|
727
721
|
enumerable: false
|
|
728
|
-
}),
|
|
722
|
+
}), "hasBlock", {
|
|
729
723
|
value: function value(name) {
|
|
730
724
|
return this.getBlocks().hasOwnProperty(name);
|
|
731
725
|
},
|
|
732
726
|
writable: false,
|
|
733
727
|
configurable: false,
|
|
734
728
|
enumerable: false
|
|
735
|
-
}),
|
|
729
|
+
}), "include", {
|
|
736
730
|
value: function value(path, data, cx) {
|
|
737
731
|
var context = cx === false ? {} : this.clone(true);
|
|
738
732
|
var params = extend(context, data || {});
|
|
@@ -742,7 +736,7 @@ function Context(config) {
|
|
|
742
736
|
writable: false,
|
|
743
737
|
configurable: false,
|
|
744
738
|
enumerable: false
|
|
745
|
-
}),
|
|
739
|
+
}), "use", {
|
|
746
740
|
value: function value(path, namespace) {
|
|
747
741
|
var promise = this.require(path);
|
|
748
742
|
this.echo(resolve$1(promise, function (exports) {
|
|
@@ -755,7 +749,7 @@ function Context(config) {
|
|
|
755
749
|
writable: false,
|
|
756
750
|
configurable: false,
|
|
757
751
|
enumerable: false
|
|
758
|
-
}),
|
|
752
|
+
}), "async", {
|
|
759
753
|
value: function value(promise, callback) {
|
|
760
754
|
this.echo(resolve$1(promise, function (data) {
|
|
761
755
|
return this.fn(callback)(data);
|
|
@@ -764,7 +758,7 @@ function Context(config) {
|
|
|
764
758
|
writable: false,
|
|
765
759
|
configurable: false,
|
|
766
760
|
enumerable: false
|
|
767
|
-
}),
|
|
761
|
+
}), "each", {
|
|
768
762
|
value: function value(object, callback) {
|
|
769
763
|
if (isString(object)) {
|
|
770
764
|
object = this.get(object, []);
|
|
@@ -774,14 +768,14 @@ function Context(config) {
|
|
|
774
768
|
writable: false,
|
|
775
769
|
configurable: false,
|
|
776
770
|
enumerable: false
|
|
777
|
-
}),
|
|
771
|
+
}), "element", {
|
|
778
772
|
value: function value(tag, attr, content) {
|
|
779
773
|
return element(tag, attr, content);
|
|
780
774
|
},
|
|
781
775
|
writable: false,
|
|
782
776
|
configurable: false,
|
|
783
777
|
enumerable: false
|
|
784
|
-
}),
|
|
778
|
+
}), "el", {
|
|
785
779
|
value: function value(tag, attr, content) {
|
|
786
780
|
if (isFunction(content)) {
|
|
787
781
|
content = this.fn(content)();
|
|
@@ -793,7 +787,7 @@ function Context(config) {
|
|
|
793
787
|
writable: false,
|
|
794
788
|
configurable: false,
|
|
795
789
|
enumerable: false
|
|
796
|
-
})
|
|
790
|
+
})));
|
|
797
791
|
};
|
|
798
792
|
this.configure(config);
|
|
799
793
|
}
|
|
@@ -825,7 +819,7 @@ function EJS(options) {
|
|
|
825
819
|
return scope.getMacro();
|
|
826
820
|
});
|
|
827
821
|
};
|
|
828
|
-
var
|
|
822
|
+
var _render = function render(name, data) {
|
|
829
823
|
var filepath = ext(name, config.extension);
|
|
830
824
|
var scope = context.create(data);
|
|
831
825
|
return output(filepath, scope).then(function (content) {
|
|
@@ -833,7 +827,7 @@ function EJS(options) {
|
|
|
833
827
|
scope.setExtend(false);
|
|
834
828
|
var layout = scope.getLayout();
|
|
835
829
|
var _data = scope.clone();
|
|
836
|
-
return
|
|
830
|
+
return _render(layout, _data);
|
|
837
831
|
}
|
|
838
832
|
return content;
|
|
839
833
|
});
|
|
@@ -848,7 +842,7 @@ function EJS(options) {
|
|
|
848
842
|
return config;
|
|
849
843
|
};
|
|
850
844
|
this.render = function (name, data) {
|
|
851
|
-
return
|
|
845
|
+
return _render(name, data);
|
|
852
846
|
};
|
|
853
847
|
this.helpers = function (methods) {
|
|
854
848
|
context.helpers(extend(scope, methods));
|
|
@@ -867,7 +861,7 @@ function EJS(options) {
|
|
|
867
861
|
};
|
|
868
862
|
this.helpers({
|
|
869
863
|
require: require,
|
|
870
|
-
render:
|
|
864
|
+
render: _render
|
|
871
865
|
});
|
|
872
866
|
return this;
|
|
873
867
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -384,33 +384,27 @@ function Template(config, cache, compiler) {
|
|
|
384
384
|
this.configure(config);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
function _defineProperty(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
writable: true
|
|
395
|
-
});
|
|
396
|
-
} else {
|
|
397
|
-
obj[key] = value;
|
|
398
|
-
}
|
|
399
|
-
return obj;
|
|
387
|
+
function _defineProperty(e, r, t) {
|
|
388
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
389
|
+
value: t,
|
|
390
|
+
enumerable: !0,
|
|
391
|
+
configurable: !0,
|
|
392
|
+
writable: !0
|
|
393
|
+
}) : e[r] = t, e;
|
|
400
394
|
}
|
|
401
|
-
function _toPrimitive(
|
|
402
|
-
if (
|
|
403
|
-
var
|
|
404
|
-
if (
|
|
405
|
-
var
|
|
406
|
-
if (
|
|
395
|
+
function _toPrimitive(t, r) {
|
|
396
|
+
if ("object" != typeof t || !t) return t;
|
|
397
|
+
var e = t[Symbol.toPrimitive];
|
|
398
|
+
if (void 0 !== e) {
|
|
399
|
+
var i = e.call(t, r || "default");
|
|
400
|
+
if ("object" != typeof i) return i;
|
|
407
401
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
408
402
|
}
|
|
409
|
-
return (
|
|
403
|
+
return ("string" === r ? String : Number)(t);
|
|
410
404
|
}
|
|
411
|
-
function _toPropertyKey(
|
|
412
|
-
var
|
|
413
|
-
return
|
|
405
|
+
function _toPropertyKey(t) {
|
|
406
|
+
var i = _toPrimitive(t, "string");
|
|
407
|
+
return "symbol" == typeof i ? i : i + "";
|
|
414
408
|
}
|
|
415
409
|
|
|
416
410
|
var selfClosed = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
|
@@ -523,46 +517,46 @@ function Context(config) {
|
|
|
523
517
|
extend(this, data || {});
|
|
524
518
|
}
|
|
525
519
|
Scope.prototype = extend({}, methods || {});
|
|
526
|
-
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, BUFFER, {
|
|
520
|
+
Object.defineProperties(Scope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
|
|
527
521
|
value: createBuffer(),
|
|
528
522
|
writable: true,
|
|
529
523
|
configurable: false,
|
|
530
524
|
enumerable: false
|
|
531
|
-
}),
|
|
525
|
+
}), BLOCKS, {
|
|
532
526
|
value: {},
|
|
533
527
|
writable: true,
|
|
534
528
|
configurable: false,
|
|
535
529
|
enumerable: false
|
|
536
|
-
}),
|
|
530
|
+
}), MACRO, {
|
|
537
531
|
value: {},
|
|
538
532
|
writable: true,
|
|
539
533
|
configurable: false,
|
|
540
534
|
enumerable: false
|
|
541
|
-
}),
|
|
535
|
+
}), LAYOUT, {
|
|
542
536
|
value: false,
|
|
543
537
|
writable: true,
|
|
544
538
|
configurable: false,
|
|
545
539
|
enumerable: false
|
|
546
|
-
}),
|
|
540
|
+
}), EXTEND, {
|
|
547
541
|
value: false,
|
|
548
542
|
writable: true,
|
|
549
543
|
configurable: false,
|
|
550
544
|
enumerable: false
|
|
551
|
-
}),
|
|
545
|
+
}), "getMacro", {
|
|
552
546
|
value: function value() {
|
|
553
547
|
return this[MACRO];
|
|
554
548
|
},
|
|
555
549
|
writable: false,
|
|
556
550
|
configurable: false,
|
|
557
551
|
enumerable: false
|
|
558
|
-
}),
|
|
552
|
+
}), "getBuffer", {
|
|
559
553
|
value: function value() {
|
|
560
554
|
return this[BUFFER];
|
|
561
555
|
},
|
|
562
556
|
writable: false,
|
|
563
557
|
configurable: false,
|
|
564
558
|
enumerable: false
|
|
565
|
-
}),
|
|
559
|
+
}), "getComponent", {
|
|
566
560
|
value: function value() {
|
|
567
561
|
var context = this;
|
|
568
562
|
if (COMPONENT in context) {
|
|
@@ -577,42 +571,42 @@ function Context(config) {
|
|
|
577
571
|
writable: false,
|
|
578
572
|
configurable: false,
|
|
579
573
|
enumerable: false
|
|
580
|
-
}),
|
|
574
|
+
}), "getBlocks", {
|
|
581
575
|
value: function value() {
|
|
582
576
|
return this[BLOCKS];
|
|
583
577
|
},
|
|
584
578
|
writable: false,
|
|
585
579
|
configurable: false,
|
|
586
580
|
enumerable: false
|
|
587
|
-
}),
|
|
581
|
+
}), "setExtend", {
|
|
588
582
|
value: function value(_value) {
|
|
589
583
|
this[EXTEND] = _value;
|
|
590
584
|
},
|
|
591
585
|
writable: false,
|
|
592
586
|
configurable: false,
|
|
593
587
|
enumerable: false
|
|
594
|
-
}), _defineProperty(_Object$definePropert, "getExtend", {
|
|
588
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
|
|
595
589
|
value: function value() {
|
|
596
590
|
return this[EXTEND];
|
|
597
591
|
},
|
|
598
592
|
writable: false,
|
|
599
593
|
configurable: false,
|
|
600
594
|
enumerable: false
|
|
601
|
-
}),
|
|
595
|
+
}), "setLayout", {
|
|
602
596
|
value: function value(layout) {
|
|
603
597
|
this[LAYOUT] = layout;
|
|
604
598
|
},
|
|
605
599
|
writable: false,
|
|
606
600
|
configurable: false,
|
|
607
601
|
enumerable: false
|
|
608
|
-
}),
|
|
602
|
+
}), "getLayout", {
|
|
609
603
|
value: function value() {
|
|
610
604
|
return this[LAYOUT];
|
|
611
605
|
},
|
|
612
606
|
writable: false,
|
|
613
607
|
configurable: false,
|
|
614
608
|
enumerable: false
|
|
615
|
-
}),
|
|
609
|
+
}), "clone", {
|
|
616
610
|
value: function value(exclude_blocks) {
|
|
617
611
|
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
618
612
|
if (exclude_blocks === true) {
|
|
@@ -623,7 +617,7 @@ function Context(config) {
|
|
|
623
617
|
writable: false,
|
|
624
618
|
configurable: false,
|
|
625
619
|
enumerable: false
|
|
626
|
-
}),
|
|
620
|
+
}), "extend", {
|
|
627
621
|
value: function value(layout) {
|
|
628
622
|
this.setExtend(true);
|
|
629
623
|
this.setLayout(layout);
|
|
@@ -631,7 +625,7 @@ function Context(config) {
|
|
|
631
625
|
writable: false,
|
|
632
626
|
configurable: false,
|
|
633
627
|
enumerable: false
|
|
634
|
-
}),
|
|
628
|
+
}), "echo", {
|
|
635
629
|
value: function value(layout) {
|
|
636
630
|
var buffer = this.getBuffer();
|
|
637
631
|
var params = [].slice.call(arguments);
|
|
@@ -640,7 +634,7 @@ function Context(config) {
|
|
|
640
634
|
writable: false,
|
|
641
635
|
configurable: false,
|
|
642
636
|
enumerable: false
|
|
643
|
-
}),
|
|
637
|
+
}), "fn", {
|
|
644
638
|
value: function value(callback) {
|
|
645
639
|
var buffer = this.getBuffer();
|
|
646
640
|
var context = this;
|
|
@@ -655,7 +649,7 @@ function Context(config) {
|
|
|
655
649
|
writable: false,
|
|
656
650
|
configurable: false,
|
|
657
651
|
enumerable: false
|
|
658
|
-
}),
|
|
652
|
+
}), "get", {
|
|
659
653
|
value: function value(name, defaults) {
|
|
660
654
|
var path = getPath(this, name, true);
|
|
661
655
|
var result = path.shift();
|
|
@@ -665,7 +659,7 @@ function Context(config) {
|
|
|
665
659
|
writable: true,
|
|
666
660
|
configurable: true,
|
|
667
661
|
enumerable: false
|
|
668
|
-
}),
|
|
662
|
+
}), "set", {
|
|
669
663
|
value: function value(name, _value2) {
|
|
670
664
|
var path = getPath(this, name, false);
|
|
671
665
|
var result = path.shift();
|
|
@@ -678,7 +672,7 @@ function Context(config) {
|
|
|
678
672
|
writable: false,
|
|
679
673
|
configurable: false,
|
|
680
674
|
enumerable: false
|
|
681
|
-
}),
|
|
675
|
+
}), "macro", {
|
|
682
676
|
value: function value(name, callback) {
|
|
683
677
|
var list = this.getMacro();
|
|
684
678
|
var macro = this.fn(callback);
|
|
@@ -690,7 +684,7 @@ function Context(config) {
|
|
|
690
684
|
writable: false,
|
|
691
685
|
configurable: false,
|
|
692
686
|
enumerable: false
|
|
693
|
-
}), _defineProperty(_Object$definePropert, "call", {
|
|
687
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
694
688
|
value: function value(name) {
|
|
695
689
|
var list = this.getMacro();
|
|
696
690
|
var macro = list[name];
|
|
@@ -702,7 +696,7 @@ function Context(config) {
|
|
|
702
696
|
writable: false,
|
|
703
697
|
configurable: false,
|
|
704
698
|
enumerable: false
|
|
705
|
-
}),
|
|
699
|
+
}), "block", {
|
|
706
700
|
value: function value(name, callback) {
|
|
707
701
|
var _this = this;
|
|
708
702
|
var blocks = this.getBlocks();
|
|
@@ -713,29 +707,29 @@ function Context(config) {
|
|
|
713
707
|
var current = function current() {
|
|
714
708
|
return list.shift();
|
|
715
709
|
};
|
|
716
|
-
var
|
|
710
|
+
var _next = function next() {
|
|
717
711
|
var parent = current();
|
|
718
712
|
if (parent) {
|
|
719
713
|
return function () {
|
|
720
|
-
_this.echo(parent(
|
|
714
|
+
_this.echo(parent(_next()));
|
|
721
715
|
};
|
|
722
716
|
} else {
|
|
723
717
|
return noop;
|
|
724
718
|
}
|
|
725
719
|
};
|
|
726
|
-
this.echo(current()(
|
|
720
|
+
this.echo(current()(_next()));
|
|
727
721
|
},
|
|
728
722
|
writable: false,
|
|
729
723
|
configurable: false,
|
|
730
724
|
enumerable: false
|
|
731
|
-
}),
|
|
725
|
+
}), "hasBlock", {
|
|
732
726
|
value: function value(name) {
|
|
733
727
|
return this.getBlocks().hasOwnProperty(name);
|
|
734
728
|
},
|
|
735
729
|
writable: false,
|
|
736
730
|
configurable: false,
|
|
737
731
|
enumerable: false
|
|
738
|
-
}),
|
|
732
|
+
}), "include", {
|
|
739
733
|
value: function value(path, data, cx) {
|
|
740
734
|
var context = cx === false ? {} : this.clone(true);
|
|
741
735
|
var params = extend(context, data || {});
|
|
@@ -745,7 +739,7 @@ function Context(config) {
|
|
|
745
739
|
writable: false,
|
|
746
740
|
configurable: false,
|
|
747
741
|
enumerable: false
|
|
748
|
-
}),
|
|
742
|
+
}), "use", {
|
|
749
743
|
value: function value(path, namespace) {
|
|
750
744
|
var promise = this.require(path);
|
|
751
745
|
this.echo(resolve$1(promise, function (exports) {
|
|
@@ -758,7 +752,7 @@ function Context(config) {
|
|
|
758
752
|
writable: false,
|
|
759
753
|
configurable: false,
|
|
760
754
|
enumerable: false
|
|
761
|
-
}),
|
|
755
|
+
}), "async", {
|
|
762
756
|
value: function value(promise, callback) {
|
|
763
757
|
this.echo(resolve$1(promise, function (data) {
|
|
764
758
|
return this.fn(callback)(data);
|
|
@@ -767,7 +761,7 @@ function Context(config) {
|
|
|
767
761
|
writable: false,
|
|
768
762
|
configurable: false,
|
|
769
763
|
enumerable: false
|
|
770
|
-
}),
|
|
764
|
+
}), "each", {
|
|
771
765
|
value: function value(object, callback) {
|
|
772
766
|
if (isString(object)) {
|
|
773
767
|
object = this.get(object, []);
|
|
@@ -777,14 +771,14 @@ function Context(config) {
|
|
|
777
771
|
writable: false,
|
|
778
772
|
configurable: false,
|
|
779
773
|
enumerable: false
|
|
780
|
-
}),
|
|
774
|
+
}), "element", {
|
|
781
775
|
value: function value(tag, attr, content) {
|
|
782
776
|
return element(tag, attr, content);
|
|
783
777
|
},
|
|
784
778
|
writable: false,
|
|
785
779
|
configurable: false,
|
|
786
780
|
enumerable: false
|
|
787
|
-
}),
|
|
781
|
+
}), "el", {
|
|
788
782
|
value: function value(tag, attr, content) {
|
|
789
783
|
if (isFunction(content)) {
|
|
790
784
|
content = this.fn(content)();
|
|
@@ -796,7 +790,7 @@ function Context(config) {
|
|
|
796
790
|
writable: false,
|
|
797
791
|
configurable: false,
|
|
798
792
|
enumerable: false
|
|
799
|
-
})
|
|
793
|
+
})));
|
|
800
794
|
};
|
|
801
795
|
this.configure(config);
|
|
802
796
|
}
|
|
@@ -828,7 +822,7 @@ function EJS(options) {
|
|
|
828
822
|
return scope.getMacro();
|
|
829
823
|
});
|
|
830
824
|
};
|
|
831
|
-
var
|
|
825
|
+
var _render = function render(name, data) {
|
|
832
826
|
var filepath = ext(name, config.extension);
|
|
833
827
|
var scope = context.create(data);
|
|
834
828
|
return output(filepath, scope).then(function (content) {
|
|
@@ -836,7 +830,7 @@ function EJS(options) {
|
|
|
836
830
|
scope.setExtend(false);
|
|
837
831
|
var layout = scope.getLayout();
|
|
838
832
|
var _data = scope.clone();
|
|
839
|
-
return
|
|
833
|
+
return _render(layout, _data);
|
|
840
834
|
}
|
|
841
835
|
return content;
|
|
842
836
|
});
|
|
@@ -851,7 +845,7 @@ function EJS(options) {
|
|
|
851
845
|
return config;
|
|
852
846
|
};
|
|
853
847
|
this.render = function (name, data) {
|
|
854
|
-
return
|
|
848
|
+
return _render(name, data);
|
|
855
849
|
};
|
|
856
850
|
this.helpers = function (methods) {
|
|
857
851
|
context.helpers(extend(scope, methods));
|
|
@@ -870,7 +864,7 @@ function EJS(options) {
|
|
|
870
864
|
};
|
|
871
865
|
this.helpers({
|
|
872
866
|
require: require,
|
|
873
|
-
render:
|
|
867
|
+
render: _render
|
|
874
868
|
});
|
|
875
869
|
return this;
|
|
876
870
|
}
|