@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.
@@ -654,6 +654,7 @@ defaults.globalHelpers = [];
654
654
  defaults.vars = {
655
655
  SCOPE: 'ejs',
656
656
  COMPONENT: 'ui',
657
+ ELEMENT: 'el',
657
658
  EXTEND: '$$e',
658
659
  BUFFER: '$$a',
659
660
  LAYOUT: '$$l',
@@ -690,7 +691,6 @@ var Cache = /*#__PURE__*/function () {
690
691
  _classCallCheck(this, Cache);
691
692
  _classPrivateFieldInitSpec(this, _enabled, true);
692
693
  _classPrivateFieldInitSpec(this, _list, {});
693
- bindContext(this, ['configure']);
694
694
  this.configure(config);
695
695
  }
696
696
  return _createClass(Cache, [{
@@ -772,7 +772,6 @@ var Compiler = /*#__PURE__*/function () {
772
772
  return "')\n".concat(value.trim(), "\n").concat(this.BUFFER, "('");
773
773
  }
774
774
  }]);
775
- bindContext(this, ['configure', 'compile']);
776
775
  this.configure(config);
777
776
  }
778
777
  return _createClass(Compiler, [{
@@ -807,7 +806,8 @@ var Compiler = /*#__PURE__*/function () {
807
806
  SCOPE = _classPrivateFieldGet2$1.SCOPE,
808
807
  SAFE = _classPrivateFieldGet2$1.SAFE,
809
808
  BUFFER = _classPrivateFieldGet2$1.BUFFER,
810
- COMPONENT = _classPrivateFieldGet2$1.COMPONENT;
809
+ COMPONENT = _classPrivateFieldGet2$1.COMPONENT,
810
+ ELEMENT = _classPrivateFieldGet2$1.ELEMENT;
811
811
  var GLOBALS = _classPrivateFieldGet2(_config$1, this).globalHelpers;
812
812
  if (_classPrivateFieldGet2(_config$1, this).rmWhitespace) {
813
813
  content = String(content).replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
@@ -830,7 +830,7 @@ var Compiler = /*#__PURE__*/function () {
830
830
  source = "".concat(BUFFER, ".start();").concat(source, "return ").concat(BUFFER, ".end();");
831
831
  source += "\n//# sourceURL=".concat(path);
832
832
  var result = null;
833
- var params = [SCOPE, COMPONENT, BUFFER, SAFE].concat(GLOBALS);
833
+ var params = [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT].concat(GLOBALS);
834
834
  try {
835
835
  result = Function.apply(null, params.concat(source));
836
836
  result.source = "(function(".concat(params.join(','), "){\n").concat(source, "\n});");
@@ -861,7 +861,6 @@ var Template = /*#__PURE__*/function () {
861
861
  assertInstanceOf(compiler, Compiler);
862
862
  _classPrivateFieldSet2(_cache$1, this, cache);
863
863
  _classPrivateFieldSet2(_compiler$1, this, compiler);
864
- bindContext(this, ['configure', 'get']);
865
864
  this.configure(config);
866
865
  }
867
866
  return _createClass(Template, [{
@@ -1023,17 +1022,17 @@ function createBuffer() {
1023
1022
  return buffer;
1024
1023
  }
1025
1024
 
1026
- var createScope = function createScope(config, methods) {
1027
- var _Object$definePropert;
1025
+ var createContextScope = function createContextScope(config, methods) {
1028
1026
  var _config$vars = config.vars,
1029
1027
  BLOCKS = _config$vars.BLOCKS,
1030
1028
  MACRO = _config$vars.MACRO,
1031
1029
  EXTEND = _config$vars.EXTEND,
1032
1030
  LAYOUT = _config$vars.LAYOUT,
1033
1031
  BUFFER = _config$vars.BUFFER,
1034
- COMPONENT = _config$vars.COMPONENT,
1035
1032
  SAFE = _config$vars.SAFE,
1036
- SCOPE = _config$vars.SCOPE;
1033
+ SCOPE = _config$vars.SCOPE,
1034
+ COMPONENT = _config$vars.COMPONENT,
1035
+ ELEMENT = _config$vars.ELEMENT;
1037
1036
  /**
1038
1037
  * @name ContextScope
1039
1038
  * @param data
@@ -1042,200 +1041,267 @@ var createScope = function createScope(config, methods) {
1042
1041
  function ContextScope(data) {
1043
1042
  this[BLOCKS] = {};
1044
1043
  this[MACRO] = {};
1045
- Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT]));
1044
+ Object.assign(this, omit(data, [SCOPE, BUFFER, SAFE, COMPONENT, ELEMENT]));
1046
1045
  }
1047
1046
  Object.assign(ContextScope.prototype, methods);
1048
- Object.defineProperties(ContextScope.prototype, (_Object$definePropert = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, BUFFER, {
1047
+ Object.defineProperty(ContextScope.prototype, BUFFER, {
1049
1048
  value: createBuffer()
1050
- }), BLOCKS, {
1049
+ });
1050
+ Object.defineProperty(ContextScope.prototype, BLOCKS, {
1051
1051
  value: {},
1052
1052
  writable: true
1053
- }), MACRO, {
1053
+ });
1054
+ Object.defineProperty(ContextScope.prototype, MACRO, {
1054
1055
  value: {},
1055
1056
  writable: true
1056
- }), LAYOUT, {
1057
+ });
1058
+ Object.defineProperty(ContextScope.prototype, LAYOUT, {
1057
1059
  value: false,
1058
1060
  writable: true
1059
- }), EXTEND, {
1061
+ });
1062
+ Object.defineProperty(ContextScope.prototype, EXTEND, {
1060
1063
  value: false,
1061
1064
  writable: true
1062
- }), "getMacro", {
1063
- value: function value() {
1064
- return this[MACRO];
1065
- }
1066
- }), "getBuffer", {
1067
- value: function value() {
1068
- return this[BUFFER];
1069
- }
1070
- }), "getComponent", {
1071
- value: function value() {
1072
- var context = this;
1073
- if (COMPONENT in context) {
1065
+ });
1066
+ Object.defineProperties(ContextScope.prototype, {
1067
+ /** @type {function} */
1068
+ useSafeValue: {
1069
+ get: function get() {
1070
+ return safeValue;
1071
+ }
1072
+ },
1073
+ /** @type {function} */
1074
+ useComponent: {
1075
+ get: function get() {
1076
+ if (isFunction(this[COMPONENT])) {
1077
+ return this[COMPONENT].bind(this);
1078
+ } else {
1079
+ return function () {
1080
+ throw new Error("".concat(COMPONENT, " must be a function"));
1081
+ };
1082
+ }
1083
+ }
1084
+ },
1085
+ /** @type {function} */
1086
+ useElement: {
1087
+ get: function get() {
1088
+ if (isFunction(this[ELEMENT])) {
1089
+ return this[ELEMENT].bind(this);
1090
+ } else {
1091
+ return function () {
1092
+ throw new Error("".concat(ELEMENT, " must be a function"));
1093
+ };
1094
+ }
1095
+ }
1096
+ },
1097
+ /** @type {()=>this[MACRO]} */
1098
+ getMacro: {
1099
+ value: function value() {
1100
+ return this[MACRO];
1101
+ }
1102
+ },
1103
+ /** @type {function} */
1104
+ getBuffer: {
1105
+ value: function value() {
1106
+ return this[BUFFER];
1107
+ }
1108
+ },
1109
+ /** @type {function} */
1110
+ getBlocks: {
1111
+ value: function value() {
1112
+ return this[BLOCKS];
1113
+ }
1114
+ },
1115
+ /** @type {function} */
1116
+ setExtend: {
1117
+ value: function value(_value) {
1118
+ this[EXTEND] = _value;
1119
+ }
1120
+ },
1121
+ /** @type {function} */
1122
+ getExtend: {
1123
+ value: function value() {
1124
+ return this[EXTEND];
1125
+ }
1126
+ },
1127
+ /** @type {function} */
1128
+ setLayout: {
1129
+ value: function value(layout) {
1130
+ this[LAYOUT] = layout;
1131
+ }
1132
+ },
1133
+ /** @type {function} */
1134
+ getLayout: {
1135
+ value: function value() {
1136
+ return this[LAYOUT];
1137
+ }
1138
+ },
1139
+ /** @type {function} */
1140
+ clone: {
1141
+ value: function value(exclude_blocks) {
1142
+ var filter = [LAYOUT, EXTEND, BUFFER];
1143
+ if (exclude_blocks === true) {
1144
+ filter.push(BLOCKS);
1145
+ }
1146
+ return omit(this, filter);
1147
+ }
1148
+ },
1149
+ /** @type {function} */
1150
+ extend: {
1151
+ value: function value(layout) {
1152
+ this.setExtend(true);
1153
+ this.setLayout(layout);
1154
+ }
1155
+ },
1156
+ /** @type {function} */
1157
+ echo: {
1158
+ value: function value(layout) {
1159
+ var buffer = this.getBuffer();
1160
+ var params = [].slice.call(arguments);
1161
+ params.forEach(buffer);
1162
+ }
1163
+ },
1164
+ /** @type {function} */
1165
+ fn: {
1166
+ value: function value(callback) {
1167
+ var buffer = this.getBuffer();
1168
+ var context = this;
1074
1169
  return function () {
1075
- return context[COMPONENT].apply(context, arguments);
1170
+ if (isFunction(callback)) {
1171
+ buffer.backup();
1172
+ buffer(callback.apply(context, arguments));
1173
+ return buffer.restore();
1174
+ }
1076
1175
  };
1077
1176
  }
1078
- return function () {
1079
- console.log('%s function not defined', COMPONENT);
1080
- };
1081
- }
1082
- }), "getBlocks", {
1083
- value: function value() {
1084
- return this[BLOCKS];
1085
- }
1086
- }), "setExtend", {
1087
- value: function value(_value) {
1088
- this[EXTEND] = _value;
1089
- }
1090
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "getExtend", {
1091
- value: function value() {
1092
- return this[EXTEND];
1093
- }
1094
- }), "setLayout", {
1095
- value: function value(layout) {
1096
- this[LAYOUT] = layout;
1097
- }
1098
- }), "getLayout", {
1099
- value: function value() {
1100
- return this[LAYOUT];
1101
- }
1102
- }), "clone", {
1103
- value: function value(exclude_blocks) {
1104
- var filter = [LAYOUT, EXTEND, BUFFER];
1105
- if (exclude_blocks === true) {
1106
- filter.push(BLOCKS);
1177
+ },
1178
+ /** @type {function} */
1179
+ macro: {
1180
+ value: function value(name, callback) {
1181
+ var list = this.getMacro();
1182
+ var macro = this.fn(callback);
1183
+ var context = this;
1184
+ list[name] = function () {
1185
+ return context.echo(macro.apply(undefined, arguments));
1186
+ };
1107
1187
  }
1108
- return omit(this, filter);
1109
- }
1110
- }), "extend", {
1111
- value: function value(layout) {
1112
- this.setExtend(true);
1113
- this.setLayout(layout);
1114
- }
1115
- }), "echo", {
1116
- value: function value(layout) {
1117
- var buffer = this.getBuffer();
1118
- var params = [].slice.call(arguments);
1119
- params.forEach(buffer);
1120
- }
1121
- }), "fn", {
1122
- value: function value(callback) {
1123
- var buffer = this.getBuffer();
1124
- var context = this;
1125
- return function () {
1126
- buffer.backup();
1127
- if (isFunction(callback)) {
1128
- callback.apply(context, arguments);
1188
+ },
1189
+ /** @type {function} */
1190
+ call: {
1191
+ value: function value(name) {
1192
+ var list = this.getMacro();
1193
+ var macro = list[name];
1194
+ var params = [].slice.call(arguments, 1);
1195
+ if (isFunction(macro)) {
1196
+ return macro.apply(macro, params);
1129
1197
  }
1130
- return buffer.restore();
1131
- };
1132
- }
1133
- }), "get", {
1134
- value: function value(name, defaults) {
1135
- var path = getPath(this, name, true);
1136
- var result = path.shift();
1137
- var prop = path.pop();
1138
- return hasProp(result, prop) ? result[prop] : defaults;
1139
- }
1140
- }), "set", {
1141
- value: function value(name, _value2) {
1142
- var path = getPath(this, name, false);
1143
- var result = path.shift();
1144
- var prop = path.pop();
1145
- if (this.getExtend() && hasProp(result, prop)) {
1146
- return result[prop];
1147
1198
  }
1148
- return result[prop] = _value2;
1149
- }
1150
- }), "macro", {
1151
- value: function value(name, callback) {
1152
- var list = this.getMacro();
1153
- var macro = this.fn(callback);
1154
- var context = this;
1155
- list[name] = function () {
1156
- return context.echo(macro.apply(undefined, arguments));
1157
- };
1158
- }
1159
- }), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_Object$definePropert, "call", {
1160
- value: function value(name) {
1161
- var list = this.getMacro();
1162
- var macro = list[name];
1163
- var params = [].slice.call(arguments, 1);
1164
- if (isFunction(macro)) {
1165
- return macro.apply(macro, params);
1199
+ },
1200
+ /** @type {function} */
1201
+ block: {
1202
+ value: function value(name, callback) {
1203
+ var _this = this;
1204
+ var blocks = this.getBlocks();
1205
+ blocks[name] = blocks[name] || [];
1206
+ blocks[name].push(this.fn(callback));
1207
+ if (this.getExtend()) return;
1208
+ var list = Object.assign([], blocks[name]);
1209
+ var current = function current() {
1210
+ return list.shift();
1211
+ };
1212
+ var _next = function next() {
1213
+ var parent = current();
1214
+ if (parent) {
1215
+ return function () {
1216
+ _this.echo(parent(_next()));
1217
+ };
1218
+ } else {
1219
+ return noop;
1220
+ }
1221
+ };
1222
+ this.echo(current()(_next()));
1166
1223
  }
1167
- }
1168
- }), "block", {
1169
- value: function value(name, callback) {
1170
- var _this = this;
1171
- var blocks = this.getBlocks();
1172
- blocks[name] = blocks[name] || [];
1173
- blocks[name].push(this.fn(callback));
1174
- if (this.getExtend()) return;
1175
- var list = Object.assign([], blocks[name]);
1176
- var current = function current() {
1177
- return list.shift();
1178
- };
1179
- var _next = function next() {
1180
- var parent = current();
1181
- if (parent) {
1182
- return function () {
1183
- _this.echo(parent(_next()));
1184
- };
1185
- } else {
1186
- return noop;
1224
+ },
1225
+ /** @type {function} */
1226
+ hasBlock: {
1227
+ value: function value(name) {
1228
+ return this.getBlocks().hasOwnProperty(name);
1229
+ }
1230
+ },
1231
+ /** @type {function} */
1232
+ include: {
1233
+ value: function value(path, data, cx) {
1234
+ var context = cx === false ? {} : this.clone(true);
1235
+ var params = extend(context, data || {});
1236
+ var promise = this.render(path, params);
1237
+ this.echo(promise);
1238
+ }
1239
+ },
1240
+ /** @type {function} */
1241
+ use: {
1242
+ value: function value(path, namespace) {
1243
+ var _this2 = this;
1244
+ this.echo(Promise.resolve(this.require(path)).then(function (exports) {
1245
+ var list = _this2.getMacro();
1246
+ each(exports, function (macro, name) {
1247
+ list[[namespace, name].join('.')] = macro;
1248
+ });
1249
+ }));
1250
+ }
1251
+ },
1252
+ /** @type {function} */
1253
+ async: {
1254
+ value: function value(promise, callback) {
1255
+ this.echo(Promise.resolve(promise).then(callback));
1256
+ }
1257
+ },
1258
+ /** @type {function} */
1259
+ get: {
1260
+ value: function value(name, defaults) {
1261
+ var path = getPath(this, name, true);
1262
+ var result = path.shift();
1263
+ var prop = path.pop();
1264
+ return hasProp(result, prop) ? result[prop] : defaults;
1265
+ }
1266
+ },
1267
+ /** @type {function} */
1268
+ set: {
1269
+ value: function value(name, _value2) {
1270
+ var path = getPath(this, name, false);
1271
+ var result = path.shift();
1272
+ var prop = path.pop();
1273
+ if (this.getExtend() && hasProp(result, prop)) {
1274
+ return result[prop];
1187
1275
  }
1188
- };
1189
- this.echo(current()(_next()));
1190
- }
1191
- }), "hasBlock", {
1192
- value: function value(name) {
1193
- return this.getBlocks().hasOwnProperty(name);
1194
- }
1195
- }), "include", {
1196
- value: function value(path, data, cx) {
1197
- var context = cx === false ? {} : this.clone(true);
1198
- var params = extend(context, data || {});
1199
- var promise = this.render(path, params);
1200
- this.echo(promise);
1201
- }
1202
- }), "promiseResolve", {
1203
- value: function value(_value3, callback) {
1204
- return Promise.resolve(isFunction(_value3) ? this.fn(_value3)() : _value3).then(callback.bind(this));
1205
- }
1206
- }), "use", {
1207
- value: function value(path, namespace) {
1208
- this.echo(this.promiseResolve(this.require(path), function (exports) {
1209
- var list = this.getMacro();
1210
- each(exports, function (macro, name) {
1211
- list[[namespace, name].join('.')] = macro;
1212
- });
1213
- }));
1214
- }
1215
- }), "async", {
1216
- value: function value(promise, callback) {
1217
- this.echo(this.promiseResolve(promise, function (data) {
1218
- return this.fn(callback)(data);
1219
- }));
1220
- }
1221
- }), "each", {
1222
- value: function value(object, callback) {
1223
- if (isString(object)) {
1224
- object = this.get(object, []);
1276
+ return result[prop] = _value2;
1225
1277
  }
1226
- each(object, callback);
1227
- }
1228
- }), "element", {
1229
- value: function value(tag, attr, content) {
1230
- return element(tag, attr, content);
1231
- }
1232
- }), "el", {
1233
- value: function value(tag, attr, content) {
1234
- this.echo(this.promiseResolve(content, function (content) {
1235
- return this.element(tag, attr, content);
1236
- }));
1278
+ },
1279
+ /** @type {function} */
1280
+ each: {
1281
+ value: function value(object, callback) {
1282
+ if (isString(object)) {
1283
+ object = this.get(object, []);
1284
+ }
1285
+ each(object, callback);
1286
+ },
1287
+ writable: true
1288
+ },
1289
+ /** @type {function} */
1290
+ el: {
1291
+ value: function value(tag, attr, content) {
1292
+ content = isFunction(content) ? this.fn(content)() : content;
1293
+ this.echo(Promise.resolve(content).then(function (content) {
1294
+ return element(tag, attr, content);
1295
+ }));
1296
+ },
1297
+ writable: true
1298
+ },
1299
+ /** @type {function} */
1300
+ ui: {
1301
+ value: function value(layout) {},
1302
+ writable: true
1237
1303
  }
1238
- })));
1304
+ });
1239
1305
  return ContextScope;
1240
1306
  };
1241
1307
  var _scope = /*#__PURE__*/new WeakMap();
@@ -1243,7 +1309,6 @@ var Context = /*#__PURE__*/function () {
1243
1309
  function Context(config, methods) {
1244
1310
  _classCallCheck(this, Context);
1245
1311
  _classPrivateFieldInitSpec(this, _scope, void 0);
1246
- bindContext(this, ['create', 'helpers', 'configure']);
1247
1312
  this.configure(config, methods);
1248
1313
  }
1249
1314
  return _createClass(Context, [{
@@ -1254,7 +1319,7 @@ var Context = /*#__PURE__*/function () {
1254
1319
  }, {
1255
1320
  key: "configure",
1256
1321
  value: function configure(config, methods) {
1257
- _classPrivateFieldSet2(_scope, this, createScope(config, methods));
1322
+ _classPrivateFieldSet2(_scope, this, createContextScope(config, methods));
1258
1323
  }
1259
1324
  }, {
1260
1325
  key: "helpers",
@@ -1287,10 +1352,10 @@ var EJS = /*#__PURE__*/function () {
1287
1352
  _classPrivateFieldSet2(_cache, this, new Cache(_classPrivateFieldGet2(_config, this)));
1288
1353
  _classPrivateFieldSet2(_template, this, new Template(_classPrivateFieldGet2(_config, this), _classPrivateFieldGet2(_cache, this), _classPrivateFieldGet2(_compiler, this)));
1289
1354
  //
1290
- bindContext(this, ['configure', 'create', 'render', 'context', 'preload', 'compile', 'helpers']);
1355
+ bindContext(this, ['configure', 'create', 'render', 'require', 'context', 'preload', 'compile', 'helpers']);
1291
1356
  //
1292
1357
  this.helpers({
1293
- require: _assertClassBrand(_EJS_brand, this, _require),
1358
+ require: this.require,
1294
1359
  render: this.render
1295
1360
  });
1296
1361
  }
@@ -1345,163 +1410,21 @@ var EJS = /*#__PURE__*/function () {
1345
1410
  value: function create(options) {
1346
1411
  return new this.constructor(options);
1347
1412
  }
1413
+ }, {
1414
+ key: "require",
1415
+ value: function require(name) {
1416
+ var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1417
+ var scope = this.context({});
1418
+ return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
1419
+ return scope.getMacro();
1420
+ });
1421
+ }
1348
1422
  }]);
1349
1423
  }();
1350
-
1351
- // export function EJS2(options) {
1352
- // const self = {
1353
- // config: {},
1354
- // helpers: {},
1355
- // /**
1356
- // * @type {Context}
1357
- // */
1358
- // context: null,
1359
- // /**
1360
- // * @type {Compiler}
1361
- // */
1362
- // compiler: null,
1363
- // /**
1364
- // * @type {Template}
1365
- // */
1366
- // template: null,
1367
- // /**
1368
- // * @type {Cache}
1369
- // */
1370
- // cache: null,
1371
- // }
1372
- // /**
1373
- // *
1374
- // */
1375
- // configSchema(self.config, options || {})
1376
- // self.context = useContext(self.config, self.helpers)
1377
- // self.compiler = useCompiler(self.config)
1378
- // self.cache = useCache(self.config)
1379
- // self.template = useTemplate(self.config, self.cache, self.compiler)
1380
- // /**
1381
- // *
1382
- // * @param {string} path
1383
- // * @param {ContextScope} scope
1384
- // * @return {Promise<string>}
1385
- // */
1386
- // const output = (path, scope) => {
1387
- // const { globalHelpers } = self.config
1388
- // const params = [
1389
- // scope,
1390
- // scope.getComponent(),
1391
- // scope.getBuffer(),
1392
- // safeValue,
1393
- // ].concat(
1394
- // globalHelpers
1395
- // .filter((name) => isFunction(scope[name]))
1396
- // .map((name) => scope[name].bind(scope))
1397
- // )
1398
- // return self.template
1399
- // .get(path)
1400
- // .then((callback) => callback.apply(scope, params))
1401
- // }
1402
- // /**
1403
- // *
1404
- // * @param name
1405
- // * @return {Promise<string>}
1406
- // */
1407
- // const require = (name) => {
1408
- // const filepath = ext(name, self.config.extension)
1409
- // const scope = context({})
1410
- // return output(filepath, scope).then(() => scope.getMacro())
1411
- // }
1412
- // /**
1413
- // *
1414
- // * @param {string} name
1415
- // * @param {{}} [data]
1416
- // * @return {Promise<string>}
1417
- // */
1418
- // const render = (name, data) => {
1419
- // const filepath = ext(name, self.config.extension)
1420
- // const scope = context(data)
1421
- // return output(filepath, scope).then((content) => {
1422
- // if (scope.getExtend()) {
1423
- // scope.setExtend(false)
1424
- // const layout = scope.getLayout()
1425
- // const data = scope.clone()
1426
- // return render(layout, data)
1427
- // }
1428
- // return content
1429
- // })
1430
- // }
1431
- // /**
1432
- // *
1433
- // * @param options
1434
- // * @return {{}}
1435
- // */
1436
- // const configure = (options = {}) => {
1437
- // configSchema(self.config, options || {})
1438
- // self.context.configure(self.config, self.helpers)
1439
- // self.compiler.configure(self.config)
1440
- // self.cache.configure(self.config)
1441
- // self.template.configure(self.config)
1442
- // return self.config
1443
- // }
1444
- // /**
1445
- // *
1446
- // * @param methods
1447
- // */
1448
- // const helpers = (methods) => {
1449
- // self.context.helpers(extend(self.helpers, methods))
1450
- // }
1451
- // /**
1452
- // *
1453
- // * @param list
1454
- // * @return {*}
1455
- // */
1456
- // const preload = (list) => {
1457
- // return self.cache.load(list || {})
1458
- // }
1459
- // /**
1460
- // *
1461
- // * @param options
1462
- // * @return {any}
1463
- // */
1464
- // const create = (options) => {
1465
- // return EJS(options)
1466
- // }
1467
- // /**
1468
- // *
1469
- // * @param content
1470
- // * @param path
1471
- // * @return {Function}
1472
- // */
1473
- // const compile = (content, path) => {
1474
- // return self.compiler.compile(content, path)
1475
- // }
1476
- // /**
1477
- // *
1478
- // * @param data
1479
- // * @return {ContextScope}
1480
- // */
1481
- // const context = (data = {}) => {
1482
- // return self.context.create(data)
1483
- // }
1484
- // /**
1485
- // *
1486
- // */
1487
- // helpers({ require, render })
1488
- // /**
1489
- // *
1490
- // */
1491
- // return {
1492
- // configure,
1493
- // helpers,
1494
- // preload,
1495
- // context,
1496
- // compile,
1497
- // create,
1498
- // render,
1499
- // }
1500
- // }
1501
1424
  function _output(path, scope) {
1502
1425
  var _classPrivateFieldGet2$1 = _classPrivateFieldGet2(_config, this),
1503
1426
  globalHelpers = _classPrivateFieldGet2$1.globalHelpers;
1504
- var params = [scope, scope.getComponent(), scope.getBuffer(), safeValue].concat(globalHelpers.filter(function (name) {
1427
+ var params = [scope, scope.getBuffer(), scope.useSafeValue, scope.useComponent, scope.useElement].concat(globalHelpers.filter(function (name) {
1505
1428
  return isFunction(scope[name]);
1506
1429
  }).map(function (name) {
1507
1430
  return scope[name].bind(scope);
@@ -1510,13 +1433,6 @@ function _output(path, scope) {
1510
1433
  return callback.apply(scope, params);
1511
1434
  });
1512
1435
  }
1513
- function _require(name) {
1514
- var filepath = ext(name, _classPrivateFieldGet2(_config, this).extension);
1515
- var scope = this.context({});
1516
- return _assertClassBrand(_EJS_brand, this, _output).call(this, filepath, scope).then(function () {
1517
- return scope.getMacro();
1518
- });
1519
- }
1520
1436
 
1521
1437
  var templates = {};
1522
1438
  var getOrigin = function getOrigin(url, secure) {