@kosatyi/ejs 0.0.78 → 0.0.80
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 +60 -59
- package/dist/cjs/index.js +60 -59
- package/dist/cjs/worker.js +90 -94
- package/dist/esm/browser.js +8 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/worker.js +8 -0
- package/dist/umd/browser.js +60 -59
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +60 -59
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +90 -94
- package/dist/umd/worker.min.js +1 -1
- package/package.json +2 -2
- package/types/ejs.d.ts +5 -0
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,22 +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()));
|
|
718
|
+
},
|
|
719
|
+
writable: false,
|
|
720
|
+
configurable: false,
|
|
721
|
+
enumerable: false
|
|
722
|
+
}), "hasBlock", {
|
|
723
|
+
value: function value(name) {
|
|
724
|
+
return this.getBlocks().hasOwnProperty(name);
|
|
724
725
|
},
|
|
725
726
|
writable: false,
|
|
726
727
|
configurable: false,
|
|
727
728
|
enumerable: false
|
|
728
|
-
}),
|
|
729
|
+
}), "include", {
|
|
729
730
|
value: function value(path, data, cx) {
|
|
730
731
|
var context = cx === false ? {} : this.clone(true);
|
|
731
732
|
var params = extend(context, data || {});
|
|
@@ -735,7 +736,7 @@ function Context(config) {
|
|
|
735
736
|
writable: false,
|
|
736
737
|
configurable: false,
|
|
737
738
|
enumerable: false
|
|
738
|
-
}),
|
|
739
|
+
}), "use", {
|
|
739
740
|
value: function value(path, namespace) {
|
|
740
741
|
var promise = this.require(path);
|
|
741
742
|
this.echo(resolve$1(promise, function (exports) {
|
|
@@ -748,7 +749,7 @@ function Context(config) {
|
|
|
748
749
|
writable: false,
|
|
749
750
|
configurable: false,
|
|
750
751
|
enumerable: false
|
|
751
|
-
}),
|
|
752
|
+
}), "async", {
|
|
752
753
|
value: function value(promise, callback) {
|
|
753
754
|
this.echo(resolve$1(promise, function (data) {
|
|
754
755
|
return this.fn(callback)(data);
|
|
@@ -757,7 +758,7 @@ function Context(config) {
|
|
|
757
758
|
writable: false,
|
|
758
759
|
configurable: false,
|
|
759
760
|
enumerable: false
|
|
760
|
-
}),
|
|
761
|
+
}), "each", {
|
|
761
762
|
value: function value(object, callback) {
|
|
762
763
|
if (isString(object)) {
|
|
763
764
|
object = this.get(object, []);
|
|
@@ -767,14 +768,14 @@ function Context(config) {
|
|
|
767
768
|
writable: false,
|
|
768
769
|
configurable: false,
|
|
769
770
|
enumerable: false
|
|
770
|
-
}),
|
|
771
|
+
}), "element", {
|
|
771
772
|
value: function value(tag, attr, content) {
|
|
772
773
|
return element(tag, attr, content);
|
|
773
774
|
},
|
|
774
775
|
writable: false,
|
|
775
776
|
configurable: false,
|
|
776
777
|
enumerable: false
|
|
777
|
-
}),
|
|
778
|
+
}), "el", {
|
|
778
779
|
value: function value(tag, attr, content) {
|
|
779
780
|
if (isFunction(content)) {
|
|
780
781
|
content = this.fn(content)();
|
|
@@ -786,7 +787,7 @@ function Context(config) {
|
|
|
786
787
|
writable: false,
|
|
787
788
|
configurable: false,
|
|
788
789
|
enumerable: false
|
|
789
|
-
})
|
|
790
|
+
})));
|
|
790
791
|
};
|
|
791
792
|
this.configure(config);
|
|
792
793
|
}
|
|
@@ -818,7 +819,7 @@ function EJS(options) {
|
|
|
818
819
|
return scope.getMacro();
|
|
819
820
|
});
|
|
820
821
|
};
|
|
821
|
-
var
|
|
822
|
+
var _render = function render(name, data) {
|
|
822
823
|
var filepath = ext(name, config.extension);
|
|
823
824
|
var scope = context.create(data);
|
|
824
825
|
return output(filepath, scope).then(function (content) {
|
|
@@ -826,7 +827,7 @@ function EJS(options) {
|
|
|
826
827
|
scope.setExtend(false);
|
|
827
828
|
var layout = scope.getLayout();
|
|
828
829
|
var _data = scope.clone();
|
|
829
|
-
return
|
|
830
|
+
return _render(layout, _data);
|
|
830
831
|
}
|
|
831
832
|
return content;
|
|
832
833
|
});
|
|
@@ -841,7 +842,7 @@ function EJS(options) {
|
|
|
841
842
|
return config;
|
|
842
843
|
};
|
|
843
844
|
this.render = function (name, data) {
|
|
844
|
-
return
|
|
845
|
+
return _render(name, data);
|
|
845
846
|
};
|
|
846
847
|
this.helpers = function (methods) {
|
|
847
848
|
context.helpers(extend(scope, methods));
|
|
@@ -860,7 +861,7 @@ function EJS(options) {
|
|
|
860
861
|
};
|
|
861
862
|
this.helpers({
|
|
862
863
|
require: require,
|
|
863
|
-
render:
|
|
864
|
+
render: _render
|
|
864
865
|
});
|
|
865
866
|
return this;
|
|
866
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,22 +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()));
|
|
721
|
+
},
|
|
722
|
+
writable: false,
|
|
723
|
+
configurable: false,
|
|
724
|
+
enumerable: false
|
|
725
|
+
}), "hasBlock", {
|
|
726
|
+
value: function value(name) {
|
|
727
|
+
return this.getBlocks().hasOwnProperty(name);
|
|
727
728
|
},
|
|
728
729
|
writable: false,
|
|
729
730
|
configurable: false,
|
|
730
731
|
enumerable: false
|
|
731
|
-
}),
|
|
732
|
+
}), "include", {
|
|
732
733
|
value: function value(path, data, cx) {
|
|
733
734
|
var context = cx === false ? {} : this.clone(true);
|
|
734
735
|
var params = extend(context, data || {});
|
|
@@ -738,7 +739,7 @@ function Context(config) {
|
|
|
738
739
|
writable: false,
|
|
739
740
|
configurable: false,
|
|
740
741
|
enumerable: false
|
|
741
|
-
}),
|
|
742
|
+
}), "use", {
|
|
742
743
|
value: function value(path, namespace) {
|
|
743
744
|
var promise = this.require(path);
|
|
744
745
|
this.echo(resolve$1(promise, function (exports) {
|
|
@@ -751,7 +752,7 @@ function Context(config) {
|
|
|
751
752
|
writable: false,
|
|
752
753
|
configurable: false,
|
|
753
754
|
enumerable: false
|
|
754
|
-
}),
|
|
755
|
+
}), "async", {
|
|
755
756
|
value: function value(promise, callback) {
|
|
756
757
|
this.echo(resolve$1(promise, function (data) {
|
|
757
758
|
return this.fn(callback)(data);
|
|
@@ -760,7 +761,7 @@ function Context(config) {
|
|
|
760
761
|
writable: false,
|
|
761
762
|
configurable: false,
|
|
762
763
|
enumerable: false
|
|
763
|
-
}),
|
|
764
|
+
}), "each", {
|
|
764
765
|
value: function value(object, callback) {
|
|
765
766
|
if (isString(object)) {
|
|
766
767
|
object = this.get(object, []);
|
|
@@ -770,14 +771,14 @@ function Context(config) {
|
|
|
770
771
|
writable: false,
|
|
771
772
|
configurable: false,
|
|
772
773
|
enumerable: false
|
|
773
|
-
}),
|
|
774
|
+
}), "element", {
|
|
774
775
|
value: function value(tag, attr, content) {
|
|
775
776
|
return element(tag, attr, content);
|
|
776
777
|
},
|
|
777
778
|
writable: false,
|
|
778
779
|
configurable: false,
|
|
779
780
|
enumerable: false
|
|
780
|
-
}),
|
|
781
|
+
}), "el", {
|
|
781
782
|
value: function value(tag, attr, content) {
|
|
782
783
|
if (isFunction(content)) {
|
|
783
784
|
content = this.fn(content)();
|
|
@@ -789,7 +790,7 @@ function Context(config) {
|
|
|
789
790
|
writable: false,
|
|
790
791
|
configurable: false,
|
|
791
792
|
enumerable: false
|
|
792
|
-
})
|
|
793
|
+
})));
|
|
793
794
|
};
|
|
794
795
|
this.configure(config);
|
|
795
796
|
}
|
|
@@ -821,7 +822,7 @@ function EJS(options) {
|
|
|
821
822
|
return scope.getMacro();
|
|
822
823
|
});
|
|
823
824
|
};
|
|
824
|
-
var
|
|
825
|
+
var _render = function render(name, data) {
|
|
825
826
|
var filepath = ext(name, config.extension);
|
|
826
827
|
var scope = context.create(data);
|
|
827
828
|
return output(filepath, scope).then(function (content) {
|
|
@@ -829,7 +830,7 @@ function EJS(options) {
|
|
|
829
830
|
scope.setExtend(false);
|
|
830
831
|
var layout = scope.getLayout();
|
|
831
832
|
var _data = scope.clone();
|
|
832
|
-
return
|
|
833
|
+
return _render(layout, _data);
|
|
833
834
|
}
|
|
834
835
|
return content;
|
|
835
836
|
});
|
|
@@ -844,7 +845,7 @@ function EJS(options) {
|
|
|
844
845
|
return config;
|
|
845
846
|
};
|
|
846
847
|
this.render = function (name, data) {
|
|
847
|
-
return
|
|
848
|
+
return _render(name, data);
|
|
848
849
|
};
|
|
849
850
|
this.helpers = function (methods) {
|
|
850
851
|
context.helpers(extend(scope, methods));
|
|
@@ -863,7 +864,7 @@ function EJS(options) {
|
|
|
863
864
|
};
|
|
864
865
|
this.helpers({
|
|
865
866
|
require: require,
|
|
866
|
-
render:
|
|
867
|
+
render: _render
|
|
867
868
|
});
|
|
868
869
|
return this;
|
|
869
870
|
}
|