@kosatyi/ejs 0.0.89 → 0.0.90
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/worker.js +23 -21
- package/dist/esm/worker.js +14 -8
- package/dist/umd/worker.js +23 -21
- package/dist/umd/worker.min.js +1 -1
- package/package.json +5 -4
package/dist/cjs/worker.js
CHANGED
|
@@ -1244,49 +1244,55 @@ function EJS(options) {
|
|
|
1244
1244
|
return this;
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
|
-
var
|
|
1247
|
+
var hash = (+new Date()).toString(36);
|
|
1248
|
+
var templates = {};
|
|
1248
1249
|
var ejs = new EJS({
|
|
1249
1250
|
cache: false,
|
|
1250
1251
|
withObject: false,
|
|
1251
1252
|
resolver: function resolver(path, name) {
|
|
1252
1253
|
return new Promise(function (resolve, reject) {
|
|
1253
|
-
if (
|
|
1254
|
-
resolve(
|
|
1254
|
+
if (templates.hasOwnProperty(name)) {
|
|
1255
|
+
resolve(templates[name]);
|
|
1255
1256
|
} else {
|
|
1256
1257
|
reject(new TemplateNotFound("template ".concat(name, " not found")));
|
|
1257
1258
|
}
|
|
1258
1259
|
});
|
|
1259
1260
|
}
|
|
1260
1261
|
});
|
|
1262
|
+
var render = ejs.render,
|
|
1263
|
+
context = ejs.context,
|
|
1264
|
+
helpers = ejs.helpers,
|
|
1265
|
+
configure = ejs.configure,
|
|
1266
|
+
create = ejs.create;
|
|
1261
1267
|
var getOrigin = function getOrigin(url, secure) {
|
|
1262
1268
|
url = new URL(url);
|
|
1263
1269
|
if (secure) url.protocol = 'https:';
|
|
1264
1270
|
return url.origin;
|
|
1265
1271
|
};
|
|
1266
1272
|
function setTemplates(list) {
|
|
1267
|
-
Object.assign(
|
|
1273
|
+
Object.assign(templates, list || {});
|
|
1268
1274
|
}
|
|
1269
1275
|
|
|
1270
1276
|
/**
|
|
1271
1277
|
* @typedef {Object<string,any>} HonoContext
|
|
1272
1278
|
* @property {function(*):Promise<Response>} html
|
|
1273
1279
|
* @property {function():Promise<Response>} notFound
|
|
1280
|
+
* @property {function(methods:{}):void} helpers
|
|
1274
1281
|
* @property {function(name:string,data:{}):Promise<string>} render
|
|
1275
1282
|
* @property {function(name:string,data:{}):Promise<string>} ejs
|
|
1276
1283
|
* @property {ContextScope} data
|
|
1277
1284
|
*/
|
|
1278
1285
|
|
|
1279
1286
|
/**
|
|
1280
|
-
*
|
|
1281
1287
|
* @param {Object<string,any>} options
|
|
1282
1288
|
* @return {(function(c:Context, next): Promise<any>)|*}
|
|
1283
1289
|
*/
|
|
1284
|
-
function setRenderer(
|
|
1285
|
-
var _ref
|
|
1286
|
-
secure = _ref$secure === void 0 ? true : _ref$secure,
|
|
1290
|
+
function setRenderer() {
|
|
1291
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1287
1292
|
_ref$version = _ref.version,
|
|
1288
|
-
version = _ref$version === void 0 ?
|
|
1289
|
-
_ref.
|
|
1293
|
+
version = _ref$version === void 0 ? hash : _ref$version,
|
|
1294
|
+
_ref$secure = _ref.secure,
|
|
1295
|
+
secure = _ref$secure === void 0 ? true : _ref$secure;
|
|
1290
1296
|
return /*#__PURE__*/function () {
|
|
1291
1297
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(c, next) {
|
|
1292
1298
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -1298,12 +1304,15 @@ function setRenderer(_ref) {
|
|
|
1298
1304
|
c.ejs = function (name, data) {
|
|
1299
1305
|
return render(name, Object.assign({}, c.data, data));
|
|
1300
1306
|
};
|
|
1307
|
+
c.helpers = function (methods) {
|
|
1308
|
+
return helpers(methods);
|
|
1309
|
+
};
|
|
1301
1310
|
c.render = function (name, data) {
|
|
1302
1311
|
return c.html(c.ejs(name, data));
|
|
1303
1312
|
};
|
|
1304
|
-
_context.next =
|
|
1313
|
+
_context.next = 8;
|
|
1305
1314
|
return next();
|
|
1306
|
-
case
|
|
1315
|
+
case 8:
|
|
1307
1316
|
case "end":
|
|
1308
1317
|
return _context.stop();
|
|
1309
1318
|
}
|
|
@@ -1314,23 +1323,16 @@ function setRenderer(_ref) {
|
|
|
1314
1323
|
};
|
|
1315
1324
|
}();
|
|
1316
1325
|
}
|
|
1317
|
-
var
|
|
1318
|
-
context = ejs.context,
|
|
1319
|
-
compile = ejs.compile,
|
|
1320
|
-
helpers = ejs.helpers,
|
|
1321
|
-
preload = ejs.preload,
|
|
1322
|
-
configure = ejs.configure,
|
|
1323
|
-
create = ejs.create;
|
|
1326
|
+
var version = hash;
|
|
1324
1327
|
|
|
1325
1328
|
exports.TemplateError = TemplateError;
|
|
1326
1329
|
exports.TemplateNotFound = TemplateNotFound;
|
|
1327
1330
|
exports.TemplateSyntaxError = TemplateSyntaxError;
|
|
1328
|
-
exports.compile = compile;
|
|
1329
1331
|
exports.configure = configure;
|
|
1330
1332
|
exports.context = context;
|
|
1331
1333
|
exports.create = create;
|
|
1332
1334
|
exports.helpers = helpers;
|
|
1333
|
-
exports.preload = preload;
|
|
1334
1335
|
exports.render = render;
|
|
1335
1336
|
exports.setRenderer = setRenderer;
|
|
1336
1337
|
exports.setTemplates = setTemplates;
|
|
1338
|
+
exports.version = version;
|
package/dist/esm/worker.js
CHANGED
|
@@ -1034,15 +1034,17 @@ function EJS(options) {
|
|
|
1034
1034
|
return this
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
|
-
const
|
|
1037
|
+
const hash = (+new Date()).toString(36);
|
|
1038
|
+
|
|
1039
|
+
const templates = {};
|
|
1038
1040
|
|
|
1039
1041
|
const ejs = new EJS({
|
|
1040
1042
|
cache: false,
|
|
1041
1043
|
withObject: false,
|
|
1042
1044
|
resolver(path, name) {
|
|
1043
1045
|
return new Promise((resolve, reject) => {
|
|
1044
|
-
if (
|
|
1045
|
-
resolve(
|
|
1046
|
+
if (templates.hasOwnProperty(name)) {
|
|
1047
|
+
resolve(templates[name]);
|
|
1046
1048
|
} else {
|
|
1047
1049
|
reject(new TemplateNotFound(`template ${name} not found`));
|
|
1048
1050
|
}
|
|
@@ -1050,41 +1052,45 @@ const ejs = new EJS({
|
|
|
1050
1052
|
}
|
|
1051
1053
|
});
|
|
1052
1054
|
|
|
1055
|
+
const { render, context, helpers, configure, create } = ejs;
|
|
1056
|
+
|
|
1053
1057
|
const getOrigin = (url, secure) => {
|
|
1054
1058
|
url = new URL(url);
|
|
1055
1059
|
if (secure) url.protocol = 'https:';
|
|
1056
1060
|
return url.origin
|
|
1057
1061
|
};
|
|
1058
1062
|
|
|
1063
|
+
|
|
1059
1064
|
function setTemplates(list) {
|
|
1060
|
-
Object.assign(
|
|
1065
|
+
Object.assign(templates, list || {});
|
|
1061
1066
|
}
|
|
1062
1067
|
|
|
1063
1068
|
/**
|
|
1064
1069
|
* @typedef {Object<string,any>} HonoContext
|
|
1065
1070
|
* @property {function(*):Promise<Response>} html
|
|
1066
1071
|
* @property {function():Promise<Response>} notFound
|
|
1072
|
+
* @property {function(methods:{}):void} helpers
|
|
1067
1073
|
* @property {function(name:string,data:{}):Promise<string>} render
|
|
1068
1074
|
* @property {function(name:string,data:{}):Promise<string>} ejs
|
|
1069
1075
|
* @property {ContextScope} data
|
|
1070
1076
|
*/
|
|
1071
1077
|
|
|
1072
1078
|
/**
|
|
1073
|
-
*
|
|
1074
1079
|
* @param {Object<string,any>} options
|
|
1075
1080
|
* @return {(function(c:Context, next): Promise<any>)|*}
|
|
1076
1081
|
*/
|
|
1077
|
-
function setRenderer({
|
|
1082
|
+
function setRenderer({ version = hash, secure = true } = {}) {
|
|
1078
1083
|
return async (c, next) => {
|
|
1079
1084
|
c.data = context({});
|
|
1080
1085
|
c.data.set('version', version);
|
|
1081
1086
|
c.data.set('origin', getOrigin(c.req.url, secure));
|
|
1082
1087
|
c.ejs = (name, data) => render(name, Object.assign({}, c.data, data));
|
|
1088
|
+
c.helpers = (methods) => helpers(methods);
|
|
1083
1089
|
c.render = (name, data) => c.html(c.ejs(name, data));
|
|
1084
1090
|
await next();
|
|
1085
1091
|
}
|
|
1086
1092
|
}
|
|
1087
1093
|
|
|
1088
|
-
const
|
|
1094
|
+
const version = hash;
|
|
1089
1095
|
|
|
1090
|
-
export { TemplateError, TemplateNotFound, TemplateSyntaxError,
|
|
1096
|
+
export { TemplateError, TemplateNotFound, TemplateSyntaxError, configure, context, create, helpers, render, setRenderer, setTemplates, version };
|
package/dist/umd/worker.js
CHANGED
|
@@ -1248,49 +1248,55 @@
|
|
|
1248
1248
|
return this;
|
|
1249
1249
|
}
|
|
1250
1250
|
|
|
1251
|
-
var
|
|
1251
|
+
var hash = (+new Date()).toString(36);
|
|
1252
|
+
var templates = {};
|
|
1252
1253
|
var ejs = new EJS({
|
|
1253
1254
|
cache: false,
|
|
1254
1255
|
withObject: false,
|
|
1255
1256
|
resolver: function resolver(path, name) {
|
|
1256
1257
|
return new Promise(function (resolve, reject) {
|
|
1257
|
-
if (
|
|
1258
|
-
resolve(
|
|
1258
|
+
if (templates.hasOwnProperty(name)) {
|
|
1259
|
+
resolve(templates[name]);
|
|
1259
1260
|
} else {
|
|
1260
1261
|
reject(new TemplateNotFound("template ".concat(name, " not found")));
|
|
1261
1262
|
}
|
|
1262
1263
|
});
|
|
1263
1264
|
}
|
|
1264
1265
|
});
|
|
1266
|
+
var render = ejs.render,
|
|
1267
|
+
context = ejs.context,
|
|
1268
|
+
helpers = ejs.helpers,
|
|
1269
|
+
configure = ejs.configure,
|
|
1270
|
+
create = ejs.create;
|
|
1265
1271
|
var getOrigin = function getOrigin(url, secure) {
|
|
1266
1272
|
url = new URL(url);
|
|
1267
1273
|
if (secure) url.protocol = 'https:';
|
|
1268
1274
|
return url.origin;
|
|
1269
1275
|
};
|
|
1270
1276
|
function setTemplates(list) {
|
|
1271
|
-
Object.assign(
|
|
1277
|
+
Object.assign(templates, list || {});
|
|
1272
1278
|
}
|
|
1273
1279
|
|
|
1274
1280
|
/**
|
|
1275
1281
|
* @typedef {Object<string,any>} HonoContext
|
|
1276
1282
|
* @property {function(*):Promise<Response>} html
|
|
1277
1283
|
* @property {function():Promise<Response>} notFound
|
|
1284
|
+
* @property {function(methods:{}):void} helpers
|
|
1278
1285
|
* @property {function(name:string,data:{}):Promise<string>} render
|
|
1279
1286
|
* @property {function(name:string,data:{}):Promise<string>} ejs
|
|
1280
1287
|
* @property {ContextScope} data
|
|
1281
1288
|
*/
|
|
1282
1289
|
|
|
1283
1290
|
/**
|
|
1284
|
-
*
|
|
1285
1291
|
* @param {Object<string,any>} options
|
|
1286
1292
|
* @return {(function(c:Context, next): Promise<any>)|*}
|
|
1287
1293
|
*/
|
|
1288
|
-
function setRenderer(
|
|
1289
|
-
var _ref
|
|
1290
|
-
secure = _ref$secure === void 0 ? true : _ref$secure,
|
|
1294
|
+
function setRenderer() {
|
|
1295
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1291
1296
|
_ref$version = _ref.version,
|
|
1292
|
-
version = _ref$version === void 0 ?
|
|
1293
|
-
_ref.
|
|
1297
|
+
version = _ref$version === void 0 ? hash : _ref$version,
|
|
1298
|
+
_ref$secure = _ref.secure,
|
|
1299
|
+
secure = _ref$secure === void 0 ? true : _ref$secure;
|
|
1294
1300
|
return /*#__PURE__*/function () {
|
|
1295
1301
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(c, next) {
|
|
1296
1302
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -1302,12 +1308,15 @@
|
|
|
1302
1308
|
c.ejs = function (name, data) {
|
|
1303
1309
|
return render(name, Object.assign({}, c.data, data));
|
|
1304
1310
|
};
|
|
1311
|
+
c.helpers = function (methods) {
|
|
1312
|
+
return helpers(methods);
|
|
1313
|
+
};
|
|
1305
1314
|
c.render = function (name, data) {
|
|
1306
1315
|
return c.html(c.ejs(name, data));
|
|
1307
1316
|
};
|
|
1308
|
-
_context.next =
|
|
1317
|
+
_context.next = 8;
|
|
1309
1318
|
return next();
|
|
1310
|
-
case
|
|
1319
|
+
case 8:
|
|
1311
1320
|
case "end":
|
|
1312
1321
|
return _context.stop();
|
|
1313
1322
|
}
|
|
@@ -1318,25 +1327,18 @@
|
|
|
1318
1327
|
};
|
|
1319
1328
|
}();
|
|
1320
1329
|
}
|
|
1321
|
-
var
|
|
1322
|
-
context = ejs.context,
|
|
1323
|
-
compile = ejs.compile,
|
|
1324
|
-
helpers = ejs.helpers,
|
|
1325
|
-
preload = ejs.preload,
|
|
1326
|
-
configure = ejs.configure,
|
|
1327
|
-
create = ejs.create;
|
|
1330
|
+
var version = hash;
|
|
1328
1331
|
|
|
1329
1332
|
exports.TemplateError = TemplateError;
|
|
1330
1333
|
exports.TemplateNotFound = TemplateNotFound;
|
|
1331
1334
|
exports.TemplateSyntaxError = TemplateSyntaxError;
|
|
1332
|
-
exports.compile = compile;
|
|
1333
1335
|
exports.configure = configure;
|
|
1334
1336
|
exports.context = context;
|
|
1335
1337
|
exports.create = create;
|
|
1336
1338
|
exports.helpers = helpers;
|
|
1337
|
-
exports.preload = preload;
|
|
1338
1339
|
exports.render = render;
|
|
1339
1340
|
exports.setRenderer = setRenderer;
|
|
1340
1341
|
exports.setTemplates = setTemplates;
|
|
1342
|
+
exports.version = version;
|
|
1341
1343
|
|
|
1342
1344
|
}));
|
package/dist/umd/worker.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),c=new N(r||[]);return i(a,"_invoke",{value:P(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function y(){}function d(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(B([])));j&&j!==n&&o.call(j,c)&&(E=j);var O=w.prototype=y.prototype=Object.create(E);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,c){var u=h(t[r],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(e,n,r){var o=p;return function(i,a){if(o===g)throw Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=F(c,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?b:v,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=b,r.method="throw",r.arg=s.arg)}}}function F(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,F(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return d.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:d,configurable:!0}),d.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),l(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=B,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},c=function(t){return"string"==typeof t},u=function(t){return"boolean"==typeof t},s=function(t){return void 0===t},l="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},h={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},v=p(h),g=p(f),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(v,(function(t){return h[t]}))},m=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?b(n):n},y=function(t,e){return Boolean(t instanceof e)},d=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),c=0;c<o.length;c++){var u=o[c];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},w=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},E=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},x=function(){},j=function(t,e){var n;for(n in t)k(t,n)&&e(t[n],n,t)},O=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return j(t,(function(t,o,i){var a=e(t,o,i);!1===s(a)&&(n?r.push(a):r[o]=a)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e,n){return Promise.resolve(t).then(e.bind(n))},k=function(t,e){return t&&t.hasOwnProperty(e)},P={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},F=function(t,e){E(t,{path:o(c,P.path,t.path,e.path),export:o(c,P.export,t.export,e.export),resolver:o(a,P.resolver,t.resolver,e.resolver),extension:o(c,P.extension,t.extension,e.extension),withObject:o(u,P.withObject,t.withObject,e.withObject),rmWhitespace:o(u,P.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(u,P.cache,t.cache,e.cache),token:E({},P.token,t.token,e.token),vars:E({},P.vars,t.vars,e.vars),globalHelpers:o(i,P.globalHelpers,t.globalHelpers,e.globalHelpers)})},S="undefined"!=typeof globalThis?globalThis:window||self;function T(t){if(!1===y(this,T))return new T;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===l&&this.load(S[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&E(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return k(e.list,t)}}var N=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function B(t){if(!1===y(this,B))return new B(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[ \\t]*",start:[e.token.start,"_"],end:["_",e.token.end]},N.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,u=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var s,l,h,p="".concat(a,"('");s=e.regex,l=function(n,r,o){p+=(""+t.slice(r,o)).replace(g,(function(t){return"\\"+f[t]})),n.forEach((function(t,n){t&&(p+=e.formats[n](t))}))},h=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,h,e),h=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(a,".error(e)}"),e.withObject&&(p="with(".concat(o,"){").concat(p,"}")),p="".concat(a,".start();").concat(p,"return ").concat(a,".end();"),p+="\n//# sourceURL=".concat(n);var v=null,b=[o,c,a,i].concat(u);try{(v=Function.apply(null,b.concat(p))).source="(function(".concat(b.join(","),"){\n").concat(p,"\n});")}catch(t){throw t.filename=n,t.source=p,t}return v},this.configure(t)}function R(t,e,n){if(!1===y(this,R))return new R(t,e,n);if(!1===y(e,T))throw new TypeError("cache is not instance of Cache");if(!1===y(n,B))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var _=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=" ",C='"',$="/",U="<",M=">",H=function(t,e,n){var r=[],o=-1===_.indexOf(t),i=function(t,e){var n=[];return j(t,(function(t,r,o){var i=e(t,r,o);!1===s(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[b(e),[C,b(t),C].join("")].join("=")})).join(A);return r.push([U,t,A,i,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([U,$,t,M].join("")),r.join("")};function G(t){this.name="TemplateError",this.message=t,Error.call(this)}function W(t){G.call(this),this.name="TemplateNotFound",this.message=t}function q(t){G.call(this),this.name="TemplateSyntaxError",this.message=t}function J(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function Y(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),J(n)},n.error=function(t){return e=t,Promise.reject(new q(e.message));var e},n.end=function(){return J(e)},n}function I(t){if(!1===y(this,I))return new I(t);this.configure=function(t,e){var r,o=t.vars,i=o.BLOCKS,u=o.MACRO,s=o.EXTEND,l=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[u]={},E(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){E(p.prototype,t||{})},p.prototype=E({},e||{}),Object.defineProperties(p.prototype,(n(n(n(n(n(n(n(n(n(n(r={},f,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),i,{value:{},writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(n(r,"getExtend",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(t){var e=[l,s,f];return!0===t&&e.push(i),O(this,e)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(t,e){var n=d(this,t,!0),r=n.shift(),o=n.pop();return k(r,o)?r[o]:e},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(t,e){var n=d(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(r,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},a=function(){var t=i();return t?function(){n.echo(t(a()))}:x};this.echo(i()(a()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=E(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(t,e){var n=this.require(t);this.echo(L(n,(function(t){var n=this.getMacro();j(t,(function(t,r){n[[e,r].join(".")]=t}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(t,e){this.echo(L(t,(function(t){return this.fn(e)(t)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(t,e){c(t)&&(t=this.get(t,[])),j(t,e)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(t,e,n){return H(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(t,e,n){a(n)&&(n=this.fn(n)()),this.echo(L(n,(function(n){return this.element(t,e,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(t)}Object.setPrototypeOf(G.prototype,Error.prototype),Object.assign(G.prototype,{code:1}),G.prototype.getCode=function(){return this.code},G.prototype.getMessage=function(){return this.message},G.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(W.prototype,G.prototype),Object.assign(W.prototype,{code:404}),Object.setPrototypeOf(q.prototype,G.prototype),Object.assign(q.prototype,{code:500});var D={},K=new function t(e){if(!1===y(this,t))return new t(e);var n={},r={};F(r,e||{});var o=new I(r),i=new B(r),c=new T,u=new R(r,c,i),s=function(t,e){var n=r.globalHelpers,o=[e,e.getComponent(),e.getBuffer(),m].concat(n.filter((function(t){return a(e[t])})).map((function(t){return e[t].bind(e)})));return u.get(t).then((function(t){return t.apply(e,o)}))},l=function(t,e){var n=w(t,r.extension),i=o.create(e);return s(n,i).then((function(t){if(i.getExtend()){i.setExtend(!1);var e=i.getLayout(),n=i.clone();return l(e,n)}return t}))};return this.configure=function(t){return F(r,t=t||{}),o.configure(r,n),i.configure(r),c.configure(r),u.configure(r),r},this.render=function(t,e){return l(t,e)},this.helpers=function(t){o.helpers(E(n,t))},this.preload=function(t){return c.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=w(t,r.extension),n=o.create({});return s(e,n).then((function(){return n.getMacro()}))},render:l}),this}({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){D.hasOwnProperty(e)?t(D[e]):n(new W("template ".concat(e," not found")))}))}}),X=function(t,e){return t=new URL(t),e&&(t.protocol="https:"),t.origin};var z=K.render,Q=K.context,V=K.compile,Z=K.helpers,tt=K.preload,et=K.configure,nt=K.create;t.TemplateError=G,t.TemplateNotFound=W,t.TemplateSyntaxError=q,t.compile=V,t.configure=et,t.context=Q,t.create=nt,t.helpers=Z,t.preload=tt,t.render=z,t.setRenderer=function(t){var n=t.secure,o=void 0===n||n,i=t.version,a=void 0===i?"1.0":i;return t.errorHandler,function(){var t,n=(t=r().mark((function t(e,n){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.data=Q({}),e.data.set("version",a),e.data.set("origin",X(e.req.url,o)),e.ejs=function(t,n){return z(t,Object.assign({},e.data,n))},e.render=function(t,n){return e.html(e.ejs(t,n))},t.next=7,n();case 7:case"end":return t.stop()}}),t)})),function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return n.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(D,t||{})}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),c=new N(r||[]);return i(a,"_invoke",{value:P(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function y(){}function d(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(B([])));j&&j!==n&&o.call(j,c)&&(E=j);var O=w.prototype=y.prototype=Object.create(E);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,c){var u=h(t[r],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(e,n,r){var o=p;return function(i,a){if(o===g)throw Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=F(c,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?b:v,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=b,r.method="throw",r.arg=s.arg)}}}function F(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,F(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return d.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:d,configurable:!0}),d.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(k.prototype),l(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=B,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},c=function(t){return"string"==typeof t},u=function(t){return"boolean"==typeof t},s=function(t){return void 0===t},l="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},h={"&":"&","<":"<",">":">",'"':""","'":"'"},p=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},v=p(h),g=p(f),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(v,(function(t){return h[t]}))},m=function(t,e){var n=t;return null==n?"":!0===Boolean(e)?b(n):n},y=function(t,e){return Boolean(t instanceof e)},d=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),c=0;c<o.length;c++){var u=o[c];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},w=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},E=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},x=function(){},j=function(t,e){var n;for(n in t)k(t,n)&&e(t[n],n,t)},O=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return j(t,(function(t,o,i){var a=e(t,o,i);!1===s(a)&&(n?r.push(a):r[o]=a)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e,n){return Promise.resolve(t).then(e.bind(n))},k=function(t,e){return t&&t.hasOwnProperty(e)},P={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},F=function(t,e){E(t,{path:o(c,P.path,t.path,e.path),export:o(c,P.export,t.export,e.export),resolver:o(a,P.resolver,t.resolver,e.resolver),extension:o(c,P.extension,t.extension,e.extension),withObject:o(u,P.withObject,t.withObject,e.withObject),rmWhitespace:o(u,P.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(u,P.cache,t.cache,e.cache),token:E({},P.token,t.token,e.token),vars:E({},P.vars,t.vars,e.vars),globalHelpers:o(i,P.globalHelpers,t.globalHelpers,e.globalHelpers)})},S="undefined"!=typeof globalThis?globalThis:window||self;function T(t){if(!1===y(this,T))return new T;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===l&&this.load(S[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&E(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return k(e.list,t)}}var N=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function B(t){if(!1===y(this,B))return new B(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[ \\t]*",start:[e.token.start,"_"],end:["_",e.token.end]},N.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,u=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var s,l,h,p="".concat(a,"('");s=e.regex,l=function(n,r,o){p+=(""+t.slice(r,o)).replace(g,(function(t){return"\\"+f[t]})),n.forEach((function(t,n){t&&(p+=e.formats[n](t))}))},h=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,h,e),h=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(a,".error(e)}"),e.withObject&&(p="with(".concat(o,"){").concat(p,"}")),p="".concat(a,".start();").concat(p,"return ").concat(a,".end();"),p+="\n//# sourceURL=".concat(n);var v=null,b=[o,c,a,i].concat(u);try{(v=Function.apply(null,b.concat(p))).source="(function(".concat(b.join(","),"){\n").concat(p,"\n});")}catch(t){throw t.filename=n,t.source=p,t}return v},this.configure(t)}function R(t,e,n){if(!1===y(this,R))return new R(t,e,n);if(!1===y(e,T))throw new TypeError("cache is not instance of Cache");if(!1===y(n,B))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var _=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=" ",C='"',$="/",U="<",M=">",H=function(t,e,n){var r=[],o=-1===_.indexOf(t),i=function(t,e){var n=[];return j(t,(function(t,r,o){var i=e(t,r,o);!1===s(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[b(e),[C,b(t),C].join("")].join("=")})).join(A);return r.push([U,t,A,i,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([U,$,t,M].join("")),r.join("")};function G(t){this.name="TemplateError",this.message=t,Error.call(this)}function W(t){G.call(this),this.name="TemplateNotFound",this.message=t}function q(t){G.call(this),this.name="TemplateSyntaxError",this.message=t}function J(t){return Promise.all(t||[]).then((function(t){return t.join("")})).catch((function(t){return t}))}function Y(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),J(n)},n.error=function(t){return e=t,Promise.reject(new q(e.message));var e},n.end=function(){return J(e)},n}function D(t){if(!1===y(this,D))return new D(t);this.configure=function(t,e){var r,o=t.vars,i=o.BLOCKS,u=o.MACRO,s=o.EXTEND,l=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[u]={},E(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){E(p.prototype,t||{})},p.prototype=E({},e||{}),Object.defineProperties(p.prototype,(n(n(n(n(n(n(n(n(n(n(r={},f,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),i,{value:{},writable:!0,configurable:!1,enumerable:!1}),u,{value:{},writable:!0,configurable:!1,enumerable:!1}),l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),"setExtend",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(n(r,"getExtend",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),"setLayout",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),"clone",{value:function(t){var e=[l,s,f];return!0===t&&e.push(i),O(this,e)},writable:!1,configurable:!1,enumerable:!1}),"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),"get",{value:function(t,e){var n=d(this,t,!0),r=n.shift(),o=n.pop();return k(r,o)?r[o]:e},writable:!0,configurable:!0,enumerable:!1}),"set",{value:function(t,e){var n=d(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),n(n(n(n(n(n(n(n(n(r,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()},a=function(){var t=i();return t?function(){n.echo(t(a()))}:x};this.echo(i()(a()))}},writable:!1,configurable:!1,enumerable:!1}),"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)},writable:!1,configurable:!1,enumerable:!1}),"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=E(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),"use",{value:function(t,e){var n=this.require(t);this.echo(L(n,(function(t){var n=this.getMacro();j(t,(function(t,r){n[[e,r].join(".")]=t}))}),this))},writable:!1,configurable:!1,enumerable:!1}),"async",{value:function(t,e){this.echo(L(t,(function(t){return this.fn(e)(t)}),this))},writable:!1,configurable:!1,enumerable:!1}),"each",{value:function(t,e){c(t)&&(t=this.get(t,[])),j(t,e)},writable:!1,configurable:!1,enumerable:!1}),"element",{value:function(t,e,n){return H(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),"el",{value:function(t,e,n){a(n)&&(n=this.fn(n)()),this.echo(L(n,(function(n){return this.element(t,e,n)}),this))},writable:!1,configurable:!1,enumerable:!1})))},this.configure(t)}Object.setPrototypeOf(G.prototype,Error.prototype),Object.assign(G.prototype,{code:1}),G.prototype.getCode=function(){return this.code},G.prototype.getMessage=function(){return this.message},G.prototype.toString=function(){return this.getMessage()},Object.setPrototypeOf(W.prototype,G.prototype),Object.assign(W.prototype,{code:404}),Object.setPrototypeOf(q.prototype,G.prototype),Object.assign(q.prototype,{code:500});var I=(+new Date).toString(36),K={},X=new function t(e){if(!1===y(this,t))return new t(e);var n={},r={};F(r,e||{});var o=new D(r),i=new B(r),c=new T,u=new R(r,c,i),s=function(t,e){var n=r.globalHelpers,o=[e,e.getComponent(),e.getBuffer(),m].concat(n.filter((function(t){return a(e[t])})).map((function(t){return e[t].bind(e)})));return u.get(t).then((function(t){return t.apply(e,o)}))},l=function(t,e){var n=w(t,r.extension),i=o.create(e);return s(n,i).then((function(t){if(i.getExtend()){i.setExtend(!1);var e=i.getLayout(),n=i.clone();return l(e,n)}return t}))};return this.configure=function(t){return F(r,t=t||{}),o.configure(r,n),i.configure(r),c.configure(r),u.configure(r),r},this.render=function(t,e){return l(t,e)},this.helpers=function(t){o.helpers(E(n,t))},this.preload=function(t){return c.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=w(t,r.extension),n=o.create({});return s(e,n).then((function(){return n.getMacro()}))},render:l}),this}({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){K.hasOwnProperty(e)?t(K[e]):n(new W("template ".concat(e," not found")))}))}}),z=X.render,Q=X.context,V=X.helpers,Z=X.configure,tt=X.create,et=function(t,e){return t=new URL(t),e&&(t.protocol="https:"),t.origin};var nt=I;t.TemplateError=G,t.TemplateNotFound=W,t.TemplateSyntaxError=q,t.configure=Z,t.context=Q,t.create=tt,t.helpers=V,t.render=z,t.setRenderer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.version,o=void 0===n?I:n,i=t.secure,a=void 0===i||i;return function(){var t,n=(t=r().mark((function t(e,n){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.data=Q({}),e.data.set("version",o),e.data.set("origin",et(e.req.url,a)),e.ejs=function(t,n){return z(t,Object.assign({},e.data,n))},e.helpers=function(t){return V(t)},e.render=function(t,n){return e.html(e.ejs(t,n))},t.next=8,n();case 8:case"end":return t.stop()}}),t)})),function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return n.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(K,t||{})},t.version=nt}));
|
package/package.json
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
"description": "EJS Templates",
|
|
4
4
|
"homepage": "https://github.com/kosatyi/ejs",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.90",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
9
9
|
"browser": "dist/umd/browser.js",
|
|
10
10
|
"minified": "dist/umd/browser.min.js",
|
|
11
11
|
"author": "Stepan Kosatyi (https://kosatyi.com)",
|
|
12
12
|
"bin": {
|
|
13
|
-
"ejs-bundler": "bin/bundler.js"
|
|
13
|
+
"ejs-bundler": "bin/bundler.js",
|
|
14
|
+
"jekyll-json": "bin/jekyll-json.js"
|
|
14
15
|
},
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
@@ -30,9 +31,9 @@
|
|
|
30
31
|
"require": "./dist/cjs/element.js"
|
|
31
32
|
},
|
|
32
33
|
"./bundler": {
|
|
34
|
+
"types": "./types/bundler.d.ts",
|
|
33
35
|
"import": "./dist/esm/bundler.js",
|
|
34
|
-
"require": "./dist/cjs/bundler.js"
|
|
35
|
-
"types": "./types/bundler.d.ts"
|
|
36
|
+
"require": "./dist/cjs/bundler.js"
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
"files": [
|