@kosatyi/ejs 0.0.99 → 0.0.101
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 +292 -196
- package/dist/cjs/index.js +292 -196
- package/dist/cjs/worker.js +292 -196
- package/dist/esm/browser.js +113 -84
- package/dist/esm/index.js +113 -84
- package/dist/esm/worker.js +113 -84
- package/dist/umd/browser.js +292 -196
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/index.js +292 -196
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +292 -196
- package/dist/umd/worker.min.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -704,8 +704,8 @@ function createBuffer() {
|
|
|
704
704
|
return buffer;
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
+
var PARENT = Symbol('ContextScope.parentTemplate');
|
|
707
708
|
var createContextScope = function createContextScope(config, methods) {
|
|
708
|
-
var _Object$definePropert;
|
|
709
709
|
var _config$vars = config.vars,
|
|
710
710
|
BLOCKS = _config$vars.BLOCKS,
|
|
711
711
|
MACRO = _config$vars.MACRO,
|
|
@@ -716,217 +716,300 @@ var createContextScope = function createContextScope(config, methods) {
|
|
|
716
716
|
SCOPE = _config$vars.SCOPE,
|
|
717
717
|
COMPONENT = _config$vars.COMPONENT,
|
|
718
718
|
ELEMENT = _config$vars.ELEMENT;
|
|
719
|
+
/**
|
|
720
|
+
*
|
|
721
|
+
* @type {symbol}
|
|
722
|
+
*/
|
|
723
|
+
|
|
719
724
|
/**
|
|
720
725
|
* @name ContextScope
|
|
721
726
|
* @param data
|
|
722
727
|
* @constructor
|
|
723
728
|
*/
|
|
724
729
|
function ContextScope(data) {
|
|
730
|
+
this[PARENT] = null;
|
|
725
731
|
this[BLOCKS] = {};
|
|
726
732
|
this[MACRO] = {};
|
|
727
733
|
Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT]));
|
|
728
734
|
}
|
|
729
735
|
Object.assign(ContextScope.prototype, methods);
|
|
730
|
-
Object.
|
|
736
|
+
Object.defineProperty(ContextScope.prototype, BUFFER, {
|
|
731
737
|
value: createBuffer()
|
|
732
|
-
})
|
|
738
|
+
});
|
|
739
|
+
Object.defineProperty(ContextScope.prototype, BLOCKS, {
|
|
733
740
|
value: {},
|
|
734
741
|
writable: true
|
|
735
|
-
})
|
|
742
|
+
});
|
|
743
|
+
Object.defineProperty(ContextScope.prototype, MACRO, {
|
|
736
744
|
value: {},
|
|
737
745
|
writable: true
|
|
738
|
-
})
|
|
746
|
+
});
|
|
747
|
+
Object.defineProperty(ContextScope.prototype, LAYOUT, {
|
|
739
748
|
value: false,
|
|
740
749
|
writable: true
|
|
741
|
-
})
|
|
750
|
+
});
|
|
751
|
+
Object.defineProperty(ContextScope.prototype, EXTEND, {
|
|
742
752
|
value: false,
|
|
743
753
|
writable: true
|
|
744
|
-
})
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
})
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
};
|
|
754
|
+
});
|
|
755
|
+
Object.defineProperty(ContextScope.prototype, PARENT, {
|
|
756
|
+
value: null,
|
|
757
|
+
writable: true
|
|
758
|
+
});
|
|
759
|
+
Object.defineProperties(ContextScope.prototype, {
|
|
760
|
+
/** @type {function} */
|
|
761
|
+
setParentTemplate: {
|
|
762
|
+
value: function value(_value) {
|
|
763
|
+
this[PARENT] = _value;
|
|
764
|
+
return this;
|
|
756
765
|
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return this[
|
|
762
|
-
} else {
|
|
763
|
-
return function () {
|
|
764
|
-
throw new Error("".concat(ELEMENT, " must be a function"));
|
|
765
|
-
};
|
|
766
|
+
},
|
|
767
|
+
/** @type {function} */
|
|
768
|
+
getParentTemplate: {
|
|
769
|
+
value: function value() {
|
|
770
|
+
return this[PARENT];
|
|
766
771
|
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}), "getBuffer", {
|
|
773
|
-
value: function value() {
|
|
774
|
-
return this[BUFFER];
|
|
775
|
-
}
|
|
776
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getBlocks", {
|
|
777
|
-
value: function value() {
|
|
778
|
-
return this[BLOCKS];
|
|
779
|
-
}
|
|
780
|
-
}), "setExtend", {
|
|
781
|
-
value: function value(_value) {
|
|
782
|
-
this[EXTEND] = _value;
|
|
783
|
-
}
|
|
784
|
-
}), "getExtend", {
|
|
785
|
-
value: function value() {
|
|
786
|
-
return this[EXTEND];
|
|
787
|
-
}
|
|
788
|
-
}), "setLayout", {
|
|
789
|
-
value: function value(layout) {
|
|
790
|
-
this[LAYOUT] = layout;
|
|
791
|
-
}
|
|
792
|
-
}), "getLayout", {
|
|
793
|
-
value: function value() {
|
|
794
|
-
return this[LAYOUT];
|
|
795
|
-
}
|
|
796
|
-
}), "clone", {
|
|
797
|
-
value: function value(exclude_blocks) {
|
|
798
|
-
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
799
|
-
if (exclude_blocks === true) {
|
|
800
|
-
filter.push(BLOCKS);
|
|
772
|
+
},
|
|
773
|
+
/** @type {function} */
|
|
774
|
+
useSafeValue: {
|
|
775
|
+
get: function get() {
|
|
776
|
+
return safeValue;
|
|
801
777
|
}
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
var params = [].slice.call(arguments);
|
|
813
|
-
params.forEach(buffer);
|
|
814
|
-
}
|
|
815
|
-
}), "fn", {
|
|
816
|
-
value: function value(callback) {
|
|
817
|
-
var buffer = this.getBuffer();
|
|
818
|
-
var context = this;
|
|
819
|
-
return function () {
|
|
820
|
-
if (isFunction(callback)) {
|
|
821
|
-
buffer.backup();
|
|
822
|
-
buffer(callback.apply(context, arguments));
|
|
823
|
-
return buffer.restore();
|
|
778
|
+
},
|
|
779
|
+
/** @type {function} */
|
|
780
|
+
useComponent: {
|
|
781
|
+
get: function get() {
|
|
782
|
+
if (isFunction(this[COMPONENT])) {
|
|
783
|
+
return this[COMPONENT].bind(this);
|
|
784
|
+
} else {
|
|
785
|
+
return function () {
|
|
786
|
+
throw new Error("".concat(COMPONENT, " must be a function"));
|
|
787
|
+
};
|
|
824
788
|
}
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
}), "macro", {
|
|
828
|
-
value: function value(name, callback) {
|
|
829
|
-
var list = this.getMacro();
|
|
830
|
-
var macro = this.fn(callback);
|
|
831
|
-
var context = this;
|
|
832
|
-
list[name] = function () {
|
|
833
|
-
return context.echo(macro.apply(undefined, arguments));
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
|
|
837
|
-
value: function value(name) {
|
|
838
|
-
var list = this.getMacro();
|
|
839
|
-
var macro = list[name];
|
|
840
|
-
var params = [].slice.call(arguments, 1);
|
|
841
|
-
if (isFunction(macro)) {
|
|
842
|
-
return macro.apply(macro, params);
|
|
843
789
|
}
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
if (this.getExtend()) return;
|
|
852
|
-
var list = Object.assign([], blocks[name]);
|
|
853
|
-
var current = function current() {
|
|
854
|
-
return list.shift();
|
|
855
|
-
};
|
|
856
|
-
var _next = function next() {
|
|
857
|
-
var parent = current();
|
|
858
|
-
if (parent) {
|
|
790
|
+
},
|
|
791
|
+
/** @type {function} */
|
|
792
|
+
useElement: {
|
|
793
|
+
get: function get() {
|
|
794
|
+
if (isFunction(this[ELEMENT])) {
|
|
795
|
+
return this[ELEMENT].bind(this);
|
|
796
|
+
} else {
|
|
859
797
|
return function () {
|
|
860
|
-
|
|
798
|
+
throw new Error("".concat(ELEMENT, " must be a function"));
|
|
861
799
|
};
|
|
862
|
-
} else {
|
|
863
|
-
return noop;
|
|
864
800
|
}
|
|
865
|
-
};
|
|
866
|
-
this.echo(current()(_next()));
|
|
867
|
-
}
|
|
868
|
-
}), "hasBlock", {
|
|
869
|
-
value: function value(name) {
|
|
870
|
-
return this.getBlocks().hasOwnProperty(name);
|
|
871
|
-
}
|
|
872
|
-
}), "include", {
|
|
873
|
-
value: function value(path, data, cx) {
|
|
874
|
-
var context = cx === false ? {} : this.clone(true);
|
|
875
|
-
var params = extend(context, data || {});
|
|
876
|
-
var promise = this.render(path, params);
|
|
877
|
-
this.echo(promise);
|
|
878
|
-
}
|
|
879
|
-
}), "use", {
|
|
880
|
-
value: function value(path, namespace) {
|
|
881
|
-
var _this2 = this;
|
|
882
|
-
this.echo(Promise.resolve(this.require(path)).then(function (exports) {
|
|
883
|
-
var list = _this2.getMacro();
|
|
884
|
-
each(exports, function (macro, name) {
|
|
885
|
-
list[[namespace, name].join('.')] = macro;
|
|
886
|
-
});
|
|
887
|
-
}));
|
|
888
|
-
}
|
|
889
|
-
}), "async", {
|
|
890
|
-
value: function value(promise, callback) {
|
|
891
|
-
this.echo(Promise.resolve(promise).then(callback));
|
|
892
|
-
}
|
|
893
|
-
}), "get", {
|
|
894
|
-
value: function value(name, defaults) {
|
|
895
|
-
var path = getPath(this, name, true);
|
|
896
|
-
var result = path.shift();
|
|
897
|
-
var prop = path.pop();
|
|
898
|
-
return hasProp(result, prop) ? result[prop] : defaults;
|
|
899
|
-
}
|
|
900
|
-
}), "set", {
|
|
901
|
-
value: function value(name, _value2) {
|
|
902
|
-
var path = getPath(this, name, false);
|
|
903
|
-
var result = path.shift();
|
|
904
|
-
var prop = path.pop();
|
|
905
|
-
if (this.getExtend() && hasProp(result, prop)) {
|
|
906
|
-
return result[prop];
|
|
907
801
|
}
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
object = this.get(object, []);
|
|
802
|
+
},
|
|
803
|
+
/** @type {()=>this[MACRO]} */
|
|
804
|
+
getMacro: {
|
|
805
|
+
value: function value() {
|
|
806
|
+
return this[MACRO];
|
|
914
807
|
}
|
|
915
|
-
each(object, callback);
|
|
916
808
|
},
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
return element(tag, attr, content);
|
|
923
|
-
}));
|
|
809
|
+
/** @type {function} */
|
|
810
|
+
getBuffer: {
|
|
811
|
+
value: function value() {
|
|
812
|
+
return this[BUFFER];
|
|
813
|
+
}
|
|
924
814
|
},
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
815
|
+
/** @type {function} */
|
|
816
|
+
getBlocks: {
|
|
817
|
+
value: function value() {
|
|
818
|
+
return this[BLOCKS];
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
/** @type {function} */
|
|
822
|
+
setExtend: {
|
|
823
|
+
value: function value(_value2) {
|
|
824
|
+
this[EXTEND] = _value2;
|
|
825
|
+
return this;
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
/** @type {function} */
|
|
829
|
+
getExtend: {
|
|
830
|
+
value: function value() {
|
|
831
|
+
return this[EXTEND];
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
/** @type {function} */
|
|
835
|
+
setLayout: {
|
|
836
|
+
value: function value(layout) {
|
|
837
|
+
this[LAYOUT] = layout;
|
|
838
|
+
return this;
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
/** @type {function} */
|
|
842
|
+
getLayout: {
|
|
843
|
+
value: function value() {
|
|
844
|
+
return this[LAYOUT];
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
/** @type {function} */
|
|
848
|
+
clone: {
|
|
849
|
+
value: function value(exclude_blocks) {
|
|
850
|
+
var filter = [LAYOUT, EXTEND, BUFFER];
|
|
851
|
+
if (exclude_blocks === true) {
|
|
852
|
+
filter.push(BLOCKS);
|
|
853
|
+
}
|
|
854
|
+
return omit(this, filter);
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
/** @type {function} */
|
|
858
|
+
extend: {
|
|
859
|
+
value: function value(layout) {
|
|
860
|
+
this.setExtend(true);
|
|
861
|
+
this.setLayout(layout);
|
|
862
|
+
}
|
|
863
|
+
},
|
|
864
|
+
/** @type {function} */
|
|
865
|
+
echo: {
|
|
866
|
+
value: function value(layout) {
|
|
867
|
+
var buffer = this.getBuffer();
|
|
868
|
+
var params = [].slice.call(arguments);
|
|
869
|
+
params.forEach(buffer);
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
/** @type {function} */
|
|
873
|
+
fn: {
|
|
874
|
+
value: function value(callback) {
|
|
875
|
+
var buffer = this.getBuffer();
|
|
876
|
+
var context = this;
|
|
877
|
+
return function () {
|
|
878
|
+
if (isFunction(callback)) {
|
|
879
|
+
buffer.backup();
|
|
880
|
+
buffer(callback.apply(context, arguments));
|
|
881
|
+
return buffer.restore();
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
/** @type {function} */
|
|
887
|
+
macro: {
|
|
888
|
+
value: function value(name, callback) {
|
|
889
|
+
var list = this.getMacro();
|
|
890
|
+
var macro = this.fn(callback);
|
|
891
|
+
var context = this;
|
|
892
|
+
list[name] = function () {
|
|
893
|
+
return context.echo(macro.apply(undefined, arguments));
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
/** @type {function} */
|
|
898
|
+
call: {
|
|
899
|
+
value: function value(name) {
|
|
900
|
+
var list = this.getMacro();
|
|
901
|
+
var macro = list[name];
|
|
902
|
+
var params = [].slice.call(arguments, 1);
|
|
903
|
+
if (isFunction(macro)) {
|
|
904
|
+
return macro.apply(macro, params);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
/** @type {function} */
|
|
909
|
+
block: {
|
|
910
|
+
value: function value(name, callback) {
|
|
911
|
+
var _this = this;
|
|
912
|
+
var blocks = this.getBlocks();
|
|
913
|
+
blocks[name] = blocks[name] || [];
|
|
914
|
+
blocks[name].push(this.fn(callback));
|
|
915
|
+
if (this.getExtend()) return;
|
|
916
|
+
var list = Object.assign([], blocks[name]);
|
|
917
|
+
var current = function current() {
|
|
918
|
+
return list.shift();
|
|
919
|
+
};
|
|
920
|
+
var _next = function next() {
|
|
921
|
+
var parent = current();
|
|
922
|
+
if (parent) {
|
|
923
|
+
return function () {
|
|
924
|
+
_this.echo(parent(_next()));
|
|
925
|
+
};
|
|
926
|
+
} else {
|
|
927
|
+
return noop;
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
this.echo(current()(_next()));
|
|
931
|
+
}
|
|
932
|
+
},
|
|
933
|
+
/** @type {function} */
|
|
934
|
+
hasBlock: {
|
|
935
|
+
value: function value(name) {
|
|
936
|
+
return this.getBlocks().hasOwnProperty(name);
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
/** @type {function} */
|
|
940
|
+
include: {
|
|
941
|
+
value: function value(path, data, cx) {
|
|
942
|
+
var context = cx === false ? {} : this.clone(true);
|
|
943
|
+
var params = extend(context, data || {});
|
|
944
|
+
var promise = this.render(path, params);
|
|
945
|
+
this.echo(promise);
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
/** @type {function} */
|
|
949
|
+
use: {
|
|
950
|
+
value: function value(path, namespace) {
|
|
951
|
+
var _this2 = this;
|
|
952
|
+
this.echo(Promise.resolve(this.require(path)).then(function (exports) {
|
|
953
|
+
var list = _this2.getMacro();
|
|
954
|
+
each(exports, function (macro, name) {
|
|
955
|
+
list[[namespace, name].join('.')] = macro;
|
|
956
|
+
});
|
|
957
|
+
}));
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
/** @type {function} */
|
|
961
|
+
async: {
|
|
962
|
+
value: function value(promise, callback) {
|
|
963
|
+
this.echo(Promise.resolve(promise).then(callback));
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
/** @type {function} */
|
|
967
|
+
get: {
|
|
968
|
+
value: function value(name, defaults) {
|
|
969
|
+
var path = getPath(this, name, true);
|
|
970
|
+
var result = path.shift();
|
|
971
|
+
var prop = path.pop();
|
|
972
|
+
return hasProp(result, prop) ? result[prop] : defaults;
|
|
973
|
+
}
|
|
974
|
+
},
|
|
975
|
+
/** @type {function} */
|
|
976
|
+
set: {
|
|
977
|
+
value: function value(name, _value3) {
|
|
978
|
+
var path = getPath(this, name, false);
|
|
979
|
+
var result = path.shift();
|
|
980
|
+
var prop = path.pop();
|
|
981
|
+
if (this.getParentTemplate() && hasProp(result, prop)) {
|
|
982
|
+
return result[prop];
|
|
983
|
+
}
|
|
984
|
+
return result[prop] = _value3;
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
/** @type {function} */
|
|
988
|
+
each: {
|
|
989
|
+
value: function value(object, callback) {
|
|
990
|
+
if (isString(object)) {
|
|
991
|
+
object = this.get(object, []);
|
|
992
|
+
}
|
|
993
|
+
each(object, callback);
|
|
994
|
+
},
|
|
995
|
+
writable: true
|
|
996
|
+
},
|
|
997
|
+
/** @type {function} */
|
|
998
|
+
el: {
|
|
999
|
+
value: function value(tag, attr, content) {
|
|
1000
|
+
content = isFunction(content) ? this.fn(content)() : content;
|
|
1001
|
+
this.echo(Promise.resolve(content).then(function (content) {
|
|
1002
|
+
return element(tag, attr, content);
|
|
1003
|
+
}));
|
|
1004
|
+
},
|
|
1005
|
+
writable: true
|
|
1006
|
+
},
|
|
1007
|
+
/** @type {function} */
|
|
1008
|
+
ui: {
|
|
1009
|
+
value: function value(layout) {},
|
|
1010
|
+
writable: true
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
930
1013
|
return ContextScope;
|
|
931
1014
|
};
|
|
932
1015
|
var _scope = /*#__PURE__*/new WeakMap();
|
|
@@ -994,21 +1077,43 @@ var EJS = /*#__PURE__*/function () {
|
|
|
994
1077
|
_classPrivateFieldGet2(_template, this).configure(_classPrivateFieldGet2(_config, this));
|
|
995
1078
|
return _classPrivateFieldGet2(_config, this);
|
|
996
1079
|
}
|
|
1080
|
+
}, {
|
|
1081
|
+
key: "filePath",
|
|
1082
|
+
value: function filePath(name) {
|
|
1083
|
+
return ext(name, _classPrivateFieldGet2(_config, this).extension);
|
|
1084
|
+
}
|
|
1085
|
+
}, {
|
|
1086
|
+
key: "require",
|
|
1087
|
+
value: function require(name) {
|
|
1088
|
+
var scope = this.context({});
|
|
1089
|
+
return _assertClassBrand(_EJS_brand, this, _output).call(this, this.filePath(name), scope).then(function () {
|
|
1090
|
+
return scope.getMacro();
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
997
1093
|
}, {
|
|
998
1094
|
key: "render",
|
|
999
1095
|
value: function render(name, data) {
|
|
1000
|
-
var _this = this;
|
|
1001
|
-
var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
|
|
1002
1096
|
var scope = this.context(data);
|
|
1003
|
-
return _assertClassBrand(_EJS_brand, this, _output).call(this,
|
|
1097
|
+
return _assertClassBrand(_EJS_brand, this, _output).call(this, this.filePath(name), scope).then(this.outputContent(name, scope));
|
|
1098
|
+
}
|
|
1099
|
+
}, {
|
|
1100
|
+
key: "outputContent",
|
|
1101
|
+
value: function outputContent(name, scope) {
|
|
1102
|
+
var _this = this;
|
|
1103
|
+
return function (content) {
|
|
1004
1104
|
if (scope.getExtend()) {
|
|
1005
1105
|
scope.setExtend(false);
|
|
1006
|
-
|
|
1007
|
-
var _data = scope.clone();
|
|
1008
|
-
return _this.render(layout, _data);
|
|
1106
|
+
return _this.renderLayout(scope.getLayout(), scope, name);
|
|
1009
1107
|
}
|
|
1010
1108
|
return content;
|
|
1011
|
-
}
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
}, {
|
|
1112
|
+
key: "renderLayout",
|
|
1113
|
+
value: function renderLayout(name, data, parent) {
|
|
1114
|
+
var scope = this.context(data);
|
|
1115
|
+
if (parent) scope.setParentTemplate(parent);
|
|
1116
|
+
return _assertClassBrand(_EJS_brand, this, _output).call(this, this.filePath(name), scope).then(this.outputContent(name, scope));
|
|
1012
1117
|
}
|
|
1013
1118
|
}, {
|
|
1014
1119
|
key: "helpers",
|
|
@@ -1035,15 +1140,6 @@ var EJS = /*#__PURE__*/function () {
|
|
|
1035
1140
|
value: function create(options) {
|
|
1036
1141
|
return new this.constructor(options);
|
|
1037
1142
|
}
|
|
1038
|
-
}, {
|
|
1039
|
-
key: "require",
|
|
1040
|
-
value: function require(name) {
|
|
1041
|
-
var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
|
|
1042
|
-
var scope = this.context({});
|
|
1043
|
-
return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
|
|
1044
|
-
return scope.getMacro();
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
1143
|
}]);
|
|
1048
1144
|
}();
|
|
1049
1145
|
function _output(path, scope) {
|