@kosatyi/ejs 0.0.98 → 0.0.100

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.
@@ -333,6 +333,7 @@ defaults.globalHelpers = [];
333
333
  defaults.vars = {
334
334
  SCOPE: 'ejs',
335
335
  COMPONENT: 'ui',
336
+ ELEMENT: 'el',
336
337
  EXTEND: '$$e',
337
338
  BUFFER: '$$a',
338
339
  LAYOUT: '$$l',
@@ -369,7 +370,6 @@ var Cache = /*#__PURE__*/function () {
369
370
  _classCallCheck(this, Cache);
370
371
  _classPrivateFieldInitSpec(this, _enabled, true);
371
372
  _classPrivateFieldInitSpec(this, _list, {});
372
- bindContext(this, ['configure']);
373
373
  this.configure(config);
374
374
  }
375
375
  return _createClass(Cache, [{
@@ -451,7 +451,6 @@ var Compiler = /*#__PURE__*/function () {
451
451
  return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
452
452
  }
453
453
  }]);
454
- bindContext(this, ['configure', 'compile']);
455
454
  this.configure(config);
456
455
  }
457
456
  return _createClass(Compiler, [{
@@ -486,7 +485,8 @@ var Compiler = /*#__PURE__*/function () {
486
485
  SCOPE = _classPrivateFieldGet2$1.SCOPE,
487
486
  SAFE = _classPrivateFieldGet2$1.SAFE,
488
487
  BUFFER = _classPrivateFieldGet2$1.BUFFER,
489
- COMPONENT = _classPrivateFieldGet2$1.COMPONENT;
488
+ COMPONENT = _classPrivateFieldGet2$1.COMPONENT,
489
+ ELEMENT = _classPrivateFieldGet2$1.ELEMENT;
490
490
  var GLOBALS = _classPrivateFieldGet2(_config$1, this).globalHelpers;
491
491
  if (_classPrivateFieldGet2(_config$1, this).rmWhitespace) {
492
492
  content = String(content).replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
@@ -509,7 +509,7 @@ var Compiler = /*#__PURE__*/function () {
509
509
  source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
510
510
  source += "\n//# sourceURL=".concat(path);
511
511
  var result = null;
512
- var params = [SCOPE, COMPONENT, BUFFER, SAFE].concat(GLOBALS);
512
+ var params = [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT].concat(GLOBALS);
513
513
  try {
514
514
  result = Function.apply(null, params.concat(source));
515
515
  result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
@@ -540,7 +540,6 @@ var Template = /*#__PURE__*/function () {
540
540
  assertInstanceOf(compiler, Compiler);
541
541
  _classPrivateFieldSet2(_cache$1, this, cache);
542
542
  _classPrivateFieldSet2(_compiler$1, this, compiler);
543
- bindContext(this, ['configure', 'get']);
544
543
  this.configure(config);
545
544
  }
546
545
  return _createClass(Template, [{
@@ -702,17 +701,17 @@ function createBuffer() {
702
701
  return buffer;
703
702
  }
704
703
 
705
- var createScope = function createScope(config, methods) {
706
- var _Object$definePropert;
704
+ var createContextScope = function createContextScope(config, methods) {
707
705
  var _config$vars = config.vars,
708
706
  BLOCKS = _config$vars.BLOCKS,
709
707
  MACRO = _config$vars.MACRO,
710
708
  EXTEND = _config$vars.EXTEND,
711
709
  LAYOUT = _config$vars.LAYOUT,
712
710
  BUFFER = _config$vars.BUFFER,
713
- COMPONENT = _config$vars.COMPONENT,
714
711
  SAFE = _config$vars.SAFE,
715
- SCOPE = _config$vars.SCOPE;
712
+ SCOPE = _config$vars.SCOPE,
713
+ COMPONENT = _config$vars.COMPONENT,
714
+ ELEMENT = _config$vars.ELEMENT;
716
715
  /**
717
716
  * @name ContextScope
718
717
  * @param data
@@ -721,200 +720,267 @@ var createScope = function createScope(config, methods) {
721
720
  function ContextScope(data) {
722
721
  this[BLOCKS] = {};
723
722
  this[MACRO] = {};
724
- Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT]));
723
+ Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT]));
725
724
  }
726
725
  Object.assign(ContextScope.prototype, methods);
727
- Object.defineProperties(ContextScope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
726
+ Object.defineProperty(ContextScope.prototype, BUFFER, {
728
727
  value: createBuffer()
729
- }), BLOCKS, {
728
+ });
729
+ Object.defineProperty(ContextScope.prototype, BLOCKS, {
730
730
  value: {},
731
731
  writable: true
732
- }), MACRO, {
732
+ });
733
+ Object.defineProperty(ContextScope.prototype, MACRO, {
733
734
  value: {},
734
735
  writable: true
735
- }), LAYOUT, {
736
+ });
737
+ Object.defineProperty(ContextScope.prototype, LAYOUT, {
736
738
  value: false,
737
739
  writable: true
738
- }), EXTEND, {
740
+ });
741
+ Object.defineProperty(ContextScope.prototype, EXTEND, {
739
742
  value: false,
740
743
  writable: true
741
- }), "getMacro", {
742
- value: function value() {
743
- return this[MACRO];
744
- }
745
- }), "getBuffer", {
746
- value: function value() {
747
- return this[BUFFER];
748
- }
749
- }), "getComponent", {
750
- value: function value() {
751
- var context = this;
752
- if (COMPONENT in context) {
744
+ });
745
+ Object.defineProperties(ContextScope.prototype, {
746
+ /** @type {function} */
747
+ useSafeValue: {
748
+ get: function get() {
749
+ return safeValue;
750
+ }
751
+ },
752
+ /** @type {function} */
753
+ useComponent: {
754
+ get: function get() {
755
+ if (isFunction(this[COMPONENT])) {
756
+ return this[COMPONENT].bind(this);
757
+ } else {
758
+ return function () {
759
+ throw new Error("".concat(COMPONENT, " must be a function"));
760
+ };
761
+ }
762
+ }
763
+ },
764
+ /** @type {function} */
765
+ useElement: {
766
+ get: function get() {
767
+ if (isFunction(this[ELEMENT])) {
768
+ return this[ELEMENT].bind(this);
769
+ } else {
770
+ return function () {
771
+ throw new Error("".concat(ELEMENT, " must be a function"));
772
+ };
773
+ }
774
+ }
775
+ },
776
+ /** @type {()=>this[MACRO]} */
777
+ getMacro: {
778
+ value: function value() {
779
+ return this[MACRO];
780
+ }
781
+ },
782
+ /** @type {function} */
783
+ getBuffer: {
784
+ value: function value() {
785
+ return this[BUFFER];
786
+ }
787
+ },
788
+ /** @type {function} */
789
+ getBlocks: {
790
+ value: function value() {
791
+ return this[BLOCKS];
792
+ }
793
+ },
794
+ /** @type {function} */
795
+ setExtend: {
796
+ value: function value(_value) {
797
+ this[EXTEND] = _value;
798
+ }
799
+ },
800
+ /** @type {function} */
801
+ getExtend: {
802
+ value: function value() {
803
+ return this[EXTEND];
804
+ }
805
+ },
806
+ /** @type {function} */
807
+ setLayout: {
808
+ value: function value(layout) {
809
+ this[LAYOUT] = layout;
810
+ }
811
+ },
812
+ /** @type {function} */
813
+ getLayout: {
814
+ value: function value() {
815
+ return this[LAYOUT];
816
+ }
817
+ },
818
+ /** @type {function} */
819
+ clone: {
820
+ value: function value(exclude_blocks) {
821
+ var filter = [LAYOUT, EXTEND, BUFFER];
822
+ if (exclude_blocks === true) {
823
+ filter.push(BLOCKS);
824
+ }
825
+ return omit(this, filter);
826
+ }
827
+ },
828
+ /** @type {function} */
829
+ extend: {
830
+ value: function value(layout) {
831
+ this.setExtend(true);
832
+ this.setLayout(layout);
833
+ }
834
+ },
835
+ /** @type {function} */
836
+ echo: {
837
+ value: function value(layout) {
838
+ var buffer = this.getBuffer();
839
+ var params = [].slice.call(arguments);
840
+ params.forEach(buffer);
841
+ }
842
+ },
843
+ /** @type {function} */
844
+ fn: {
845
+ value: function value(callback) {
846
+ var buffer = this.getBuffer();
847
+ var context = this;
753
848
  return function () {
754
- return context[COMPONENT].apply(context, arguments);
849
+ if (isFunction(callback)) {
850
+ buffer.backup();
851
+ buffer(callback.apply(context, arguments));
852
+ return buffer.restore();
853
+ }
755
854
  };
756
855
  }
757
- return function () {
758
- console.log('%s function not defined', COMPONENT);
759
- };
760
- }
761
- }), "getBlocks", {
762
- value: function value() {
763
- return this[BLOCKS];
764
- }
765
- }), "setExtend", {
766
- value: function value(_value) {
767
- this[EXTEND] = _value;
768
- }
769
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
770
- value: function value() {
771
- return this[EXTEND];
772
- }
773
- }), "setLayout", {
774
- value: function value(layout) {
775
- this[LAYOUT] = layout;
776
- }
777
- }), "getLayout", {
778
- value: function value() {
779
- return this[LAYOUT];
780
- }
781
- }), "clone", {
782
- value: function value(exclude_blocks) {
783
- var filter = [LAYOUT, EXTEND, BUFFER];
784
- if (exclude_blocks === true) {
785
- filter.push(BLOCKS);
856
+ },
857
+ /** @type {function} */
858
+ macro: {
859
+ value: function value(name, callback) {
860
+ var list = this.getMacro();
861
+ var macro = this.fn(callback);
862
+ var context = this;
863
+ list[name] = function () {
864
+ return context.echo(macro.apply(undefined, arguments));
865
+ };
786
866
  }
787
- return omit(this, filter);
788
- }
789
- }), "extend", {
790
- value: function value(layout) {
791
- this.setExtend(true);
792
- this.setLayout(layout);
793
- }
794
- }), "echo", {
795
- value: function value(layout) {
796
- var buffer = this.getBuffer();
797
- var params = [].slice.call(arguments);
798
- params.forEach(buffer);
799
- }
800
- }), "fn", {
801
- value: function value(callback) {
802
- var buffer = this.getBuffer();
803
- var context = this;
804
- return function () {
805
- buffer.backup();
806
- if (isFunction(callback)) {
807
- callback.apply(context, arguments);
867
+ },
868
+ /** @type {function} */
869
+ call: {
870
+ value: function value(name) {
871
+ var list = this.getMacro();
872
+ var macro = list[name];
873
+ var params = [].slice.call(arguments, 1);
874
+ if (isFunction(macro)) {
875
+ return macro.apply(macro, params);
808
876
  }
809
- return buffer.restore();
810
- };
811
- }
812
- }), "get", {
813
- value: function value(name, defaults) {
814
- var path = getPath(this, name, true);
815
- var result = path.shift();
816
- var prop = path.pop();
817
- return hasProp(result, prop) ? result[prop] : defaults;
818
- }
819
- }), "set", {
820
- value: function value(name, _value2) {
821
- var path = getPath(this, name, false);
822
- var result = path.shift();
823
- var prop = path.pop();
824
- if (this.getExtend() && hasProp(result, prop)) {
825
- return result[prop];
826
877
  }
827
- return result[prop] = _value2;
828
- }
829
- }), "macro", {
830
- value: function value(name, callback) {
831
- var list = this.getMacro();
832
- var macro = this.fn(callback);
833
- var context = this;
834
- list[name] = function () {
835
- return context.echo(macro.apply(undefined, arguments));
836
- };
837
- }
838
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
839
- value: function value(name) {
840
- var list = this.getMacro();
841
- var macro = list[name];
842
- var params = [].slice.call(arguments, 1);
843
- if (isFunction(macro)) {
844
- return macro.apply(macro, params);
878
+ },
879
+ /** @type {function} */
880
+ block: {
881
+ value: function value(name, callback) {
882
+ var _this = this;
883
+ var blocks = this.getBlocks();
884
+ blocks[name] = blocks[name] || [];
885
+ blocks[name].push(this.fn(callback));
886
+ if (this.getExtend()) return;
887
+ var list = Object.assign([], blocks[name]);
888
+ var current = function current() {
889
+ return list.shift();
890
+ };
891
+ var _next = function next() {
892
+ var parent = current();
893
+ if (parent) {
894
+ return function () {
895
+ _this.echo(parent(_next()));
896
+ };
897
+ } else {
898
+ return noop;
899
+ }
900
+ };
901
+ this.echo(current()(_next()));
845
902
  }
846
- }
847
- }), "block", {
848
- value: function value(name, callback) {
849
- var _this = this;
850
- var blocks = this.getBlocks();
851
- blocks[name] = blocks[name] || [];
852
- blocks[name].push(this.fn(callback));
853
- if (this.getExtend()) return;
854
- var list = Object.assign([], blocks[name]);
855
- var current = function current() {
856
- return list.shift();
857
- };
858
- var _next = function next() {
859
- var parent = current();
860
- if (parent) {
861
- return function () {
862
- _this.echo(parent(_next()));
863
- };
864
- } else {
865
- return noop;
903
+ },
904
+ /** @type {function} */
905
+ hasBlock: {
906
+ value: function value(name) {
907
+ return this.getBlocks().hasOwnProperty(name);
908
+ }
909
+ },
910
+ /** @type {function} */
911
+ include: {
912
+ value: function value(path, data, cx) {
913
+ var context = cx === false ? {} : this.clone(true);
914
+ var params = extend(context, data || {});
915
+ var promise = this.render(path, params);
916
+ this.echo(promise);
917
+ }
918
+ },
919
+ /** @type {function} */
920
+ use: {
921
+ value: function value(path, namespace) {
922
+ var _this2 = this;
923
+ this.echo(Promise.resolve(this.require(path)).then(function (exports) {
924
+ var list = _this2.getMacro();
925
+ each(exports, function (macro, name) {
926
+ list[[namespace, name].join('.')] = macro;
927
+ });
928
+ }));
929
+ }
930
+ },
931
+ /** @type {function} */
932
+ async: {
933
+ value: function value(promise, callback) {
934
+ this.echo(Promise.resolve(promise).then(callback));
935
+ }
936
+ },
937
+ /** @type {function} */
938
+ get: {
939
+ value: function value(name, defaults) {
940
+ var path = getPath(this, name, true);
941
+ var result = path.shift();
942
+ var prop = path.pop();
943
+ return hasProp(result, prop) ? result[prop] : defaults;
944
+ }
945
+ },
946
+ /** @type {function} */
947
+ set: {
948
+ value: function value(name, _value2) {
949
+ var path = getPath(this, name, false);
950
+ var result = path.shift();
951
+ var prop = path.pop();
952
+ if (this.getExtend() && hasProp(result, prop)) {
953
+ return result[prop];
866
954
  }
867
- };
868
- this.echo(current()(_next()));
869
- }
870
- }), "hasBlock", {
871
- value: function value(name) {
872
- return this.getBlocks().hasOwnProperty(name);
873
- }
874
- }), "include", {
875
- value: function value(path, data, cx) {
876
- var context = cx === false ? {} : this.clone(true);
877
- var params = extend(context, data || {});
878
- var promise = this.render(path, params);
879
- this.echo(promise);
880
- }
881
- }), "promiseResolve", {
882
- value: function value(_value3, callback) {
883
- return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
884
- }
885
- }), "use", {
886
- value: function value(path, namespace) {
887
- this.echo(this.promiseResolve(this.require(path), function (exports) {
888
- var list = this.getMacro();
889
- each(exports, function (macro, name) {
890
- list[[namespace, name].join('.')] = macro;
891
- });
892
- }));
893
- }
894
- }), "async", {
895
- value: function value(promise, callback) {
896
- this.echo(this.promiseResolve(promise, function (data) {
897
- return this.fn(callback)(data);
898
- }));
899
- }
900
- }), "each", {
901
- value: function value(object, callback) {
902
- if (isString(object)) {
903
- object = this.get(object, []);
955
+ return result[prop] = _value2;
904
956
  }
905
- each(object, callback);
906
- }
907
- }), "element", {
908
- value: function value(tag, attr, content) {
909
- return element(tag, attr, content);
910
- }
911
- }), "el", {
912
- value: function value(tag, attr, content) {
913
- this.echo(this.promiseResolve(content, function (content) {
914
- return this.element(tag, attr, content);
915
- }));
957
+ },
958
+ /** @type {function} */
959
+ each: {
960
+ value: function value(object, callback) {
961
+ if (isString(object)) {
962
+ object = this.get(object, []);
963
+ }
964
+ each(object, callback);
965
+ },
966
+ writable: true
967
+ },
968
+ /** @type {function} */
969
+ el: {
970
+ value: function value(tag, attr, content) {
971
+ content = isFunction(content) ? this.fn(content)() : content;
972
+ this.echo(Promise.resolve(content).then(function (content) {
973
+ return element(tag, attr, content);
974
+ }));
975
+ },
976
+ writable: true
977
+ },
978
+ /** @type {function} */
979
+ ui: {
980
+ value: function value(layout) {},
981
+ writable: true
916
982
  }
917
- })));
983
+ });
918
984
  return ContextScope;
919
985
  };
920
986
  var _scope = /*#__PURE__*/new WeakMap();
@@ -922,7 +988,6 @@ var Context = /*#__PURE__*/function () {
922
988
  function Context(config, methods) {
923
989
  _classCallCheck(this, Context);
924
990
  _classPrivateFieldInitSpec(this, _scope, void 0);
925
- bindContext(this, ['create', 'helpers', 'configure']);
926
991
  this.configure(config, methods);
927
992
  }
928
993
  return _createClass(Context, [{
@@ -933,7 +998,7 @@ var Context = /*#__PURE__*/function () {
933
998
  }, {
934
999
  key: "configure",
935
1000
  value: function configure(config, methods) {
936
- _classPrivateFieldSet2(_scope, this, createScope(config, methods));
1001
+ _classPrivateFieldSet2(_scope, this, createContextScope(config, methods));
937
1002
  }
938
1003
  }, {
939
1004
  key: "helpers",
@@ -966,10 +1031,10 @@ var EJS = /*#__PURE__*/function () {
966
1031
  _classPrivateFieldSet2(_cache, this, new Cache(_classPrivateFieldGet2(_config, this)));
967
1032
  _classPrivateFieldSet2(_template, this, new Template(_classPrivateFieldGet2(_config, this), _classPrivateFieldGet2(_cache, this), _classPrivateFieldGet2(_compiler, this)));
968
1033
  //
969
- bindContext(this, ['configure', 'create', 'render', 'context', 'preload', 'compile', 'helpers']);
1034
+ bindContext(this, ['configure', 'create', 'render', 'require', 'context', 'preload', 'compile', 'helpers']);
970
1035
  //
971
1036
  this.helpers({
972
- require: _assertClassBrand(_EJS_brand, this, _require),
1037
+ require: this.require,
973
1038
  render: this.render
974
1039
  });
975
1040
  }
@@ -1024,163 +1089,21 @@ var EJS = /*#__PURE__*/function () {
1024
1089
  value: function create(options) {
1025
1090
  return new this.constructor(options);
1026
1091
  }
1092
+ }, {
1093
+ key: "require",
1094
+ value: function require(name) {
1095
+ var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1096
+ var scope = this.context({});
1097
+ return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
1098
+ return scope.getMacro();
1099
+ });
1100
+ }
1027
1101
  }]);
1028
1102
  }();
1029
-
1030
- // export function EJS2(options) {
1031
- // const self = {
1032
- // config: {},
1033
- // helpers: {},
1034
- // /**
1035
- // * @type {Context}
1036
- // */
1037
- // context: null,
1038
- // /**
1039
- // * @type {Compiler}
1040
- // */
1041
- // compiler: null,
1042
- // /**
1043
- // * @type {Template}
1044
- // */
1045
- // template: null,
1046
- // /**
1047
- // * @type {Cache}
1048
- // */
1049
- // cache: null,
1050
- // }
1051
- // /**
1052
- // *
1053
- // */
1054
- // configSchema(self.config, options || {})
1055
- // self.context = useContext(self.config, self.helpers)
1056
- // self.compiler = useCompiler(self.config)
1057
- // self.cache = useCache(self.config)
1058
- // self.template = useTemplate(self.config, self.cache, self.compiler)
1059
- // /**
1060
- // *
1061
- // * @param {string} path
1062
- // * @param {ContextScope} scope
1063
- // * @return {Promise<string>}
1064
- // */
1065
- // const output = (path, scope) => {
1066
- // const { globalHelpers } = self.config
1067
- // const params = [
1068
- // scope,
1069
- // scope.getComponent(),
1070
- // scope.getBuffer(),
1071
- // safeValue,
1072
- // ].concat(
1073
- // globalHelpers
1074
- // .filter((name) => isFunction(scope[name]))
1075
- // .map((name) => scope[name].bind(scope))
1076
- // )
1077
- // return self.template
1078
- // .get(path)
1079
- // .then((callback) => callback.apply(scope, params))
1080
- // }
1081
- // /**
1082
- // *
1083
- // * @param name
1084
- // * @return {Promise<string>}
1085
- // */
1086
- // const require = (name) => {
1087
- // const filepath = ext(name, self.config.extension)
1088
- // const scope = context({})
1089
- // return output(filepath, scope).then(() => scope.getMacro())
1090
- // }
1091
- // /**
1092
- // *
1093
- // * @param {string} name
1094
- // * @param {{}} [data]
1095
- // * @return {Promise<string>}
1096
- // */
1097
- // const render = (name, data) => {
1098
- // const filepath = ext(name, self.config.extension)
1099
- // const scope = context(data)
1100
- // return output(filepath, scope).then((content) => {
1101
- // if (scope.getExtend()) {
1102
- // scope.setExtend(false)
1103
- // const layout = scope.getLayout()
1104
- // const data = scope.clone()
1105
- // return render(layout, data)
1106
- // }
1107
- // return content
1108
- // })
1109
- // }
1110
- // /**
1111
- // *
1112
- // * @param options
1113
- // * @return {{}}
1114
- // */
1115
- // const configure = (options = {}) => {
1116
- // configSchema(self.config, options || {})
1117
- // self.context.configure(self.config, self.helpers)
1118
- // self.compiler.configure(self.config)
1119
- // self.cache.configure(self.config)
1120
- // self.template.configure(self.config)
1121
- // return self.config
1122
- // }
1123
- // /**
1124
- // *
1125
- // * @param methods
1126
- // */
1127
- // const helpers = (methods) => {
1128
- // self.context.helpers(extend(self.helpers, methods))
1129
- // }
1130
- // /**
1131
- // *
1132
- // * @param list
1133
- // * @return {*}
1134
- // */
1135
- // const preload = (list) => {
1136
- // return self.cache.load(list || {})
1137
- // }
1138
- // /**
1139
- // *
1140
- // * @param options
1141
- // * @return {any}
1142
- // */
1143
- // const create = (options) => {
1144
- // return EJS(options)
1145
- // }
1146
- // /**
1147
- // *
1148
- // * @param content
1149
- // * @param path
1150
- // * @return {Function}
1151
- // */
1152
- // const compile = (content, path) => {
1153
- // return self.compiler.compile(content, path)
1154
- // }
1155
- // /**
1156
- // *
1157
- // * @param data
1158
- // * @return {ContextScope}
1159
- // */
1160
- // const context = (data = {}) => {
1161
- // return self.context.create(data)
1162
- // }
1163
- // /**
1164
- // *
1165
- // */
1166
- // helpers({ require, render })
1167
- // /**
1168
- // *
1169
- // */
1170
- // return {
1171
- // configure,
1172
- // helpers,
1173
- // preload,
1174
- // context,
1175
- // compile,
1176
- // create,
1177
- // render,
1178
- // }
1179
- // }
1180
1103
  function _output(path, scope) {
1181
1104
  var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
1182
1105
  globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
1183
- var params = [scope, scope.getComponent(), scope.getBuffer(), safeValue].concat(globalHelpers.filter(function (name) {
1106
+ var params = [scope, scope.getBuffer(), scope.useSafeValue, scope.useComponent, scope.useElement].concat(globalHelpers.filter(function (name) {
1184
1107
  return isFunction(scope[name]);
1185
1108
  }).map(function (name) {
1186
1109
  return scope[name].bind(scope);
@@ -1189,13 +1112,6 @@ function _output(path, scope) {
1189
1112
  return callback.apply(scope, params);
1190
1113
  });
1191
1114
  }
1192
- function _require(name) {
1193
- var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1194
- var scope = this.context({});
1195
- return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
1196
- return scope.getMacro();
1197
- });
1198
- }
1199
1115
 
1200
1116
  var httpRequest = function httpRequest(path, template) {
1201
1117
  return fetch(joinPath(path, template)).then(function (response) {