shipthis 0.1.9 → 0.1.11

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.
Files changed (134) hide show
  1. package/assets/markdown/create-or-import-keystore.md +7 -0
  2. package/dist/AppleBundleIdDetails-CjP5y0cj.js +74 -0
  3. package/dist/AppleBundleIdDetails-CztWY_mT.js +73 -0
  4. package/dist/AppleBundleIdDetails-DKeSAte9.js +73 -0
  5. package/dist/AppleBundleIdDetails-DymjrhOZ.js +73 -0
  6. package/dist/Command-BiB9MqbJ.js +204 -0
  7. package/dist/Command-D6rWEZRM.js +204 -0
  8. package/dist/Command-Dn0P_KOV.js +205 -0
  9. package/dist/Command-YJJp90ru.js +204 -0
  10. package/dist/CommandGame-C1oTlfdb.js +8 -0
  11. package/dist/CommandGame-cPaTk1wh.js +8 -0
  12. package/dist/CommandGame-k04mHiDl.js +8 -0
  13. package/dist/CommandGame-pI9VXKxi.js +8 -0
  14. package/dist/Create-DIaSKUpl.js +56 -0
  15. package/dist/CreateKeystore-BnNdeDUa.js +57 -0
  16. package/dist/CreateKeystore-Cf-nsK_M.js +56 -0
  17. package/dist/CreateKeystore-g1z6DsU5.js +56 -0
  18. package/dist/Import-BIOsf8AA.js +107 -0
  19. package/dist/JobProgress-CPkWVSlH.js +108 -0
  20. package/dist/JobProgress-W0QQR49T.js +108 -0
  21. package/dist/JobProgress-biiLhigg.js +109 -0
  22. package/dist/JobProgress-jmGAzvxS.js +108 -0
  23. package/dist/JobStatusTable-BA_q-kgE.js +75 -0
  24. package/dist/JobStatusTable-ByW0bN6c.js +75 -0
  25. package/dist/JobStatusTable-CgaTS7jS.js +75 -0
  26. package/dist/JobStatusTable-DqoppRro.js +75 -0
  27. package/dist/ProjectCredentialsTable-8kXt7sTS.js +37 -0
  28. package/dist/ProjectCredentialsTable-DRMK_SNw.js +37 -0
  29. package/dist/ProjectCredentialsTable-DfkpvTf8.js +37 -0
  30. package/dist/UserCredentialsTable-DMh8Wpy7.js +82 -0
  31. package/dist/UserCredentialsTable-DgHZJSHG.js +82 -0
  32. package/dist/UserCredentialsTable-TflQvTEP.js +82 -0
  33. package/dist/baseAppleCommand-1isaFxCQ.js +10 -0
  34. package/dist/baseAppleCommand-B9wyIqdL.js +10 -0
  35. package/dist/baseAppleCommand-DpasCbje.js +10 -0
  36. package/dist/baseGameAndroidCommand-6vsMpE7a.js +43 -0
  37. package/dist/baseGameAndroidCommand-B3LRG701.js +43 -0
  38. package/dist/baseGameAndroidCommand-C9BuS2Sr.js +43 -0
  39. package/dist/commands/apple/apiKey/create.js +10 -10
  40. package/dist/commands/apple/apiKey/export.js +8 -8
  41. package/dist/commands/apple/apiKey/import.js +8 -8
  42. package/dist/commands/apple/apiKey/status.js +7 -7
  43. package/dist/commands/apple/certificate/create.js +10 -10
  44. package/dist/commands/apple/certificate/export.js +8 -8
  45. package/dist/commands/apple/certificate/import.js +8 -8
  46. package/dist/commands/apple/certificate/status.js +7 -7
  47. package/dist/commands/apple/login.js +2 -2
  48. package/dist/commands/apple/status.js +6 -6
  49. package/dist/commands/dashboard.js +1 -1
  50. package/dist/commands/game/android/apiKey/connect.js +11 -11
  51. package/dist/commands/game/android/apiKey/create.js +13 -13
  52. package/dist/commands/game/android/apiKey/export.js +9 -9
  53. package/dist/commands/game/android/apiKey/import.js +9 -9
  54. package/dist/commands/game/android/apiKey/invite.js +4 -4
  55. package/dist/commands/game/android/apiKey/status.js +9 -9
  56. package/dist/commands/game/android/keyStore/create.js +12 -12
  57. package/dist/commands/game/android/keyStore/export.js +8 -8
  58. package/dist/commands/game/android/keyStore/import.js +49 -29
  59. package/dist/commands/game/android/keyStore/status.js +8 -8
  60. package/dist/commands/game/android/status.js +7 -7
  61. package/dist/commands/game/build/download.js +7 -7
  62. package/dist/commands/game/build/list.js +7 -7
  63. package/dist/commands/game/create.js +2 -2
  64. package/dist/commands/game/details.js +22 -8
  65. package/dist/commands/game/export.js +1 -1
  66. package/dist/commands/game/ios/app/addTester.js +6 -6
  67. package/dist/commands/game/ios/app/create.js +5 -5
  68. package/dist/commands/game/ios/app/status.js +9 -9
  69. package/dist/commands/game/ios/app/sync.js +7 -7
  70. package/dist/commands/game/ios/profile/create.js +10 -10
  71. package/dist/commands/game/ios/profile/export.js +8 -8
  72. package/dist/commands/game/ios/profile/import.js +8 -8
  73. package/dist/commands/game/ios/profile/status.js +8 -8
  74. package/dist/commands/game/ios/status.js +10 -10
  75. package/dist/commands/game/ios/wizard.js +2 -2
  76. package/dist/commands/game/job/list.js +7 -7
  77. package/dist/commands/game/job/status.js +11 -11
  78. package/dist/commands/game/list.js +7 -7
  79. package/dist/commands/game/ship.js +11 -11
  80. package/dist/commands/game/status.js +7 -7
  81. package/dist/commands/game/wizard.js +590 -35
  82. package/dist/commands/internal/fastlane.js +1 -1
  83. package/dist/commands/internal/readme.js +255 -770
  84. package/dist/commands/login.js +2 -2
  85. package/dist/commands/status.js +6 -6
  86. package/dist/export-B_F6vXIK.js +36 -0
  87. package/dist/export-C_lu1FD9.js +36 -0
  88. package/dist/export-rS9o87LD.js +36 -0
  89. package/dist/import-7T3J63j2.js +38 -0
  90. package/dist/import-Brg3zYmT.js +38 -0
  91. package/dist/import-DPbg8WvS.js +38 -0
  92. package/dist/import-v54PM_Qg.js +47 -0
  93. package/dist/index-BB7X1Pqp.js +695 -0
  94. package/dist/index-BQnkBr1Q.js +136 -0
  95. package/dist/index-BX9h2vPV.js +123 -0
  96. package/dist/index-BjGSEqP5.js +135 -0
  97. package/dist/index-Bv3x8c78.js +693 -0
  98. package/dist/index-ByOvCs4O.js +122 -0
  99. package/dist/index-BzffuqPa.js +24 -0
  100. package/dist/index-C9734Cj2.js +693 -0
  101. package/dist/index-CKYExssR.js +136 -0
  102. package/dist/index-Cz_KLwWf.js +136 -0
  103. package/dist/index-D6BH5UAM.js +135 -0
  104. package/dist/index-DOgF4dFK.js +24 -0
  105. package/dist/index-DgbQBx6x.js +122 -0
  106. package/dist/index-DxHPjZav.js +136 -0
  107. package/dist/index-m4HTrJ5J.js +135 -0
  108. package/dist/index-o9Y-84Rj.js +122 -0
  109. package/dist/upload-2naN75Zu.js +60 -0
  110. package/dist/upload-Cx71802W.js +60 -0
  111. package/dist/upload-DvAE1vDq.js +60 -0
  112. package/dist/useAndroidServiceAccountTestResult-BDc7XpKE.js +52 -0
  113. package/dist/useAndroidServiceAccountTestResult-B_ekRewZ.js +52 -0
  114. package/dist/useAndroidServiceAccountTestResult-Ce1x0Eh8.js +52 -0
  115. package/dist/useAppleApp-BEtLQa7n.js +32 -0
  116. package/dist/useAppleApp-CApC0-4Q.js +32 -0
  117. package/dist/useAppleApp-CETIcsJS.js +32 -0
  118. package/dist/useAppleBundleId-DXbMDRLd.js +64 -0
  119. package/dist/useAppleBundleId-SmzY6rkm.js +64 -0
  120. package/dist/useAppleBundleId-gPBzJwQg.js +64 -0
  121. package/dist/useJobWatching-BIG6fnTN.js +45 -0
  122. package/dist/useJobWatching-Cp-CYd90.js +45 -0
  123. package/dist/useJobWatching-D-YzSlK8.js +45 -0
  124. package/dist/useJobWatching-I_A3b36f.js +45 -0
  125. package/dist/useProjectCredentials-CKngz2rd.js +54 -0
  126. package/dist/useProjectCredentials-EapDge1I.js +54 -0
  127. package/dist/useProjectCredentials-vjedBbKl.js +54 -0
  128. package/dist/useWebSocket-Bep1zAVG.js +36 -0
  129. package/dist/useWebSocket-CBqsjHbt.js +36 -0
  130. package/dist/useWebSocket-rBLiZsKb.js +36 -0
  131. package/dist/wizard-ChPegnMW.js +133 -0
  132. package/npm-shrinkwrap.json +251 -223
  133. package/oclif.manifest.json +282 -223
  134. package/package.json +2 -4
@@ -1,7 +1,7 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
2
  import fs__default from 'fs';
3
3
  import path from 'path';
4
- import { T as BaseCommand } from '../../index-DdABTtYO.js';
4
+ import { T as BaseCommand } from '../../index-BB7X1Pqp.js';
5
5
  import CustomHelp from '../../utils/help.js';
6
6
  import '@expo/apple-utils/build/index.js';
7
7
  import 'axios';
@@ -30,145 +30,69 @@ var ejs$1 = {};
30
30
 
31
31
  var utils = {};
32
32
 
33
- /*
34
- * EJS Embedded JavaScript templates
35
- * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
36
- *
37
- * Licensed under the Apache License, Version 2.0 (the "License");
38
- * you may not use this file except in compliance with the License.
39
- * You may obtain a copy of the License at
40
- *
41
- * http://www.apache.org/licenses/LICENSE-2.0
42
- *
43
- * Unless required by applicable law or agreed to in writing, software
44
- * distributed under the License is distributed on an "AS IS" BASIS,
45
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46
- * See the License for the specific language governing permissions and
47
- * limitations under the License.
48
- *
49
- */
50
-
51
33
  var hasRequiredUtils;
52
34
 
53
35
  function requireUtils () {
54
36
  if (hasRequiredUtils) return utils;
55
37
  hasRequiredUtils = 1;
56
38
  (function (exports) {
57
-
58
39
  var regExpChars = /[|\\{}()[\]^$+*?.]/g;
59
40
  var hasOwnProperty = Object.prototype.hasOwnProperty;
60
- var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); };
61
-
62
- /**
63
- * Escape characters reserved in regular expressions.
64
- *
65
- * If `string` is `undefined` or `null`, the empty string is returned.
66
- *
67
- * @param {String} string Input string
68
- * @return {String} Escaped string
69
- * @static
70
- * @private
71
- */
72
- exports.escapeRegExpChars = function (string) {
73
- // istanbul ignore if
41
+ var hasOwn = function(obj, key) {
42
+ return hasOwnProperty.apply(obj, [key]);
43
+ };
44
+ exports.escapeRegExpChars = function(string) {
74
45
  if (!string) {
75
- return '';
46
+ return "";
76
47
  }
77
- return String(string).replace(regExpChars, '\\$&');
48
+ return String(string).replace(regExpChars, "\\$&");
78
49
  };
79
-
80
50
  var _ENCODE_HTML_RULES = {
81
- '&': '&',
82
- '<': '&lt;',
83
- '>': '&gt;',
84
- '"': '&#34;',
85
- "'": '&#39;'
51
+ "&": "&amp;",
52
+ "<": "&lt;",
53
+ ">": "&gt;",
54
+ '"': "&#34;",
55
+ "'": "&#39;"
86
56
  };
87
57
  var _MATCH_HTML = /[&<>'"]/g;
88
-
89
58
  function encode_char(c) {
90
59
  return _ENCODE_HTML_RULES[c] || c;
91
60
  }
92
-
93
- /**
94
- * Stringified version of constants used by {@link module:utils.escapeXML}.
95
- *
96
- * It is used in the process of generating {@link ClientFunction}s.
97
- *
98
- * @readonly
99
- * @type {String}
100
- */
101
-
102
- var escapeFuncStr =
103
- 'var _ENCODE_HTML_RULES = {\n'
104
- + ' "&": "&amp;"\n'
105
- + ' , "<": "&lt;"\n'
106
- + ' , ">": "&gt;"\n'
107
- + ' , \'"\': "&#34;"\n'
108
- + ' , "\'": "&#39;"\n'
109
- + ' }\n'
110
- + ' , _MATCH_HTML = /[&<>\'"]/g;\n'
111
- + 'function encode_char(c) {\n'
112
- + ' return _ENCODE_HTML_RULES[c] || c;\n'
113
- + '};\n';
114
-
115
- /**
116
- * Escape characters reserved in XML.
117
- *
118
- * If `markup` is `undefined` or `null`, the empty string is returned.
119
- *
120
- * @implements {EscapeCallback}
121
- * @param {String} markup Input string
122
- * @return {String} Escaped string
123
- * @static
124
- * @private
125
- */
126
-
127
- exports.escapeXML = function (markup) {
128
- return markup == undefined
129
- ? ''
130
- : String(markup)
131
- .replace(_MATCH_HTML, encode_char);
61
+ var escapeFuncStr = `var _ENCODE_HTML_RULES = {
62
+ "&": "&amp;"
63
+ , "<": "&lt;"
64
+ , ">": "&gt;"
65
+ , '"': "&#34;"
66
+ , "'": "&#39;"
67
+ }
68
+ , _MATCH_HTML = /[&<>'"]/g;
69
+ function encode_char(c) {
70
+ return _ENCODE_HTML_RULES[c] || c;
71
+ };
72
+ `;
73
+ exports.escapeXML = function(markup) {
74
+ return markup == void 0 ? "" : String(markup).replace(_MATCH_HTML, encode_char);
132
75
  };
133
-
134
76
  function escapeXMLToString() {
135
- return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr;
77
+ return Function.prototype.toString.call(this) + ";\n" + escapeFuncStr;
136
78
  }
137
-
138
79
  try {
139
- if (typeof Object.defineProperty === 'function') {
140
- // If the Function prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
141
- // cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
142
- // mode, attempting that will be silently ignored.
143
- // However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
144
- Object.defineProperty(exports.escapeXML, 'toString', { value: escapeXMLToString });
80
+ if (typeof Object.defineProperty === "function") {
81
+ Object.defineProperty(exports.escapeXML, "toString", { value: escapeXMLToString });
145
82
  } else {
146
- // If Object.defineProperty() doesn't exist, attempt to shadow this property using the assignment operator.
147
83
  exports.escapeXML.toString = escapeXMLToString;
148
84
  }
149
85
  } catch (err) {
150
- console.warn('Unable to set escapeXML.toString (is the Function prototype frozen?)');
86
+ console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)");
151
87
  }
152
-
153
- /**
154
- * Naive copy of properties from one object to another.
155
- * Does not recurse into non-scalar properties
156
- * Does not check to see if the property has a value before copying
157
- *
158
- * @param {Object} to Destination object
159
- * @param {Object} from Source object
160
- * @return {Object} Destination object
161
- * @static
162
- * @private
163
- */
164
- exports.shallowCopy = function (to, from) {
88
+ exports.shallowCopy = function(to, from) {
165
89
  from = from || {};
166
- if ((to !== null) && (to !== undefined)) {
90
+ if (to !== null && to !== void 0) {
167
91
  for (var p in from) {
168
92
  if (!hasOwn(from, p)) {
169
93
  continue;
170
94
  }
171
- if (p === '__proto__' || p === 'constructor') {
95
+ if (p === "__proto__" || p === "constructor") {
172
96
  continue;
173
97
  }
174
98
  to[p] = from[p];
@@ -176,30 +100,17 @@ function requireUtils () {
176
100
  }
177
101
  return to;
178
102
  };
179
-
180
- /**
181
- * Naive copy of a list of key names, from one object to another.
182
- * Only copies property if it is actually defined
183
- * Does not recurse into non-scalar properties
184
- *
185
- * @param {Object} to Destination object
186
- * @param {Object} from Source object
187
- * @param {Array} list List of properties to copy
188
- * @return {Object} Destination object
189
- * @static
190
- * @private
191
- */
192
- exports.shallowCopyFromList = function (to, from, list) {
103
+ exports.shallowCopyFromList = function(to, from, list) {
193
104
  list = list || [];
194
105
  from = from || {};
195
- if ((to !== null) && (to !== undefined)) {
106
+ if (to !== null && to !== void 0) {
196
107
  for (var i = 0; i < list.length; i++) {
197
108
  var p = list[i];
198
- if (typeof from[p] != 'undefined') {
109
+ if (typeof from[p] != "undefined") {
199
110
  if (!hasOwn(from, p)) {
200
111
  continue;
201
112
  }
202
- if (p === '__proto__' || p === 'constructor') {
113
+ if (p === "__proto__" || p === "constructor") {
203
114
  continue;
204
115
  }
205
116
  to[p] = from[p];
@@ -208,68 +119,42 @@ function requireUtils () {
208
119
  }
209
120
  return to;
210
121
  };
211
-
212
- /**
213
- * Simple in-process cache implementation. Does not implement limits of any
214
- * sort.
215
- *
216
- * @implements {Cache}
217
- * @static
218
- * @private
219
- */
220
122
  exports.cache = {
221
123
  _data: {},
222
- set: function (key, val) {
124
+ set: function(key, val) {
223
125
  this._data[key] = val;
224
126
  },
225
- get: function (key) {
127
+ get: function(key) {
226
128
  return this._data[key];
227
129
  },
228
- remove: function (key) {
130
+ remove: function(key) {
229
131
  delete this._data[key];
230
132
  },
231
- reset: function () {
133
+ reset: function() {
232
134
  this._data = {};
233
135
  }
234
136
  };
235
-
236
- /**
237
- * Transforms hyphen case variable into camel case.
238
- *
239
- * @param {String} string Hyphen case string
240
- * @return {String} Camel case string
241
- * @static
242
- * @private
243
- */
244
- exports.hyphenToCamel = function (str) {
245
- return str.replace(/-[a-z]/g, function (match) { return match[1].toUpperCase(); });
137
+ exports.hyphenToCamel = function(str) {
138
+ return str.replace(/-[a-z]/g, function(match) {
139
+ return match[1].toUpperCase();
140
+ });
246
141
  };
247
-
248
- /**
249
- * Returns a null-prototype object in runtimes that support it
250
- *
251
- * @return {Object} Object, prototype will be set to null where possible
252
- * @static
253
- * @private
254
- */
255
- exports.createNullProtoObjWherePossible = (function () {
256
- if (typeof Object.create == 'function') {
257
- return function () {
258
- return Object.create(null);
142
+ exports.createNullProtoObjWherePossible = function() {
143
+ if (typeof Object.create == "function") {
144
+ return function() {
145
+ return /* @__PURE__ */ Object.create(null);
259
146
  };
260
147
  }
261
- if (!({__proto__: null} instanceof Object)) {
262
- return function () {
263
- return {__proto__: null};
148
+ if (!({ __proto__: null } instanceof Object)) {
149
+ return function() {
150
+ return { __proto__: null };
264
151
  };
265
152
  }
266
- // Not possible, just pass through
267
- return function () {
153
+ return function() {
268
154
  return {};
269
155
  };
270
- })();
271
-
272
- exports.hasOwnOnlyObject = function (obj) {
156
+ }();
157
+ exports.hasOwnOnlyObject = function(obj) {
273
158
  var o = exports.createNullProtoObjWherePossible();
274
159
  for (var p in obj) {
275
160
  if (hasOwn(obj, p)) {
@@ -286,31 +171,12 @@ var version = "3.1.10";
286
171
  var require$$3 = {
287
172
  version: version};
288
173
 
289
- /*
290
- * EJS Embedded JavaScript templates
291
- * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
292
- *
293
- * Licensed under the Apache License, Version 2.0 (the "License");
294
- * you may not use this file except in compliance with the License.
295
- * You may obtain a copy of the License at
296
- *
297
- * http://www.apache.org/licenses/LICENSE-2.0
298
- *
299
- * Unless required by applicable law or agreed to in writing, software
300
- * distributed under the License is distributed on an "AS IS" BASIS,
301
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302
- * See the License for the specific language governing permissions and
303
- * limitations under the License.
304
- *
305
- */
306
-
307
174
  var hasRequiredEjs;
308
175
 
309
176
  function requireEjs () {
310
177
  if (hasRequiredEjs) return ejs$1;
311
178
  hasRequiredEjs = 1;
312
179
  (function (exports) {
313
-
314
180
  /**
315
181
  * @file Embedded JavaScript templating engine. {@link http://ejs.co}
316
182
  * @author Matthew Eernisse <mde@fleegix.org>
@@ -318,98 +184,37 @@ function requireEjs () {
318
184
  * @project EJS
319
185
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
320
186
  */
321
-
322
- /**
323
- * EJS internal functions.
324
- *
325
- * Technically this "module" lies in the same file as {@link module:ejs}, for
326
- * the sake of organization all the private functions re grouped into this
327
- * module.
328
- *
329
- * @module ejs-internal
330
- * @private
331
- */
332
-
333
- /**
334
- * Embedded JavaScript templating engine.
335
- *
336
- * @module ejs
337
- * @public
338
- */
339
-
340
-
341
187
  var fs = fs__default;
342
188
  var path$1 = path;
343
189
  var utils = requireUtils();
344
-
345
190
  var scopeOptionWarned = false;
346
- /** @type {string} */
347
191
  var _VERSION_STRING = require$$3.version;
348
- var _DEFAULT_OPEN_DELIMITER = '<';
349
- var _DEFAULT_CLOSE_DELIMITER = '>';
350
- var _DEFAULT_DELIMITER = '%';
351
- var _DEFAULT_LOCALS_NAME = 'locals';
352
- var _NAME = 'ejs';
353
- var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)';
354
- var _OPTS_PASSABLE_WITH_DATA = ['delimiter', 'scope', 'context', 'debug', 'compileDebug',
355
- 'client', '_with', 'rmWhitespace', 'strict', 'filename', 'async'];
356
- // We don't allow 'cache' option to be passed in the data obj for
357
- // the normal `render` call, but this is where Express 2 & 3 put it
358
- // so we make an exception for `renderFile`
359
- var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat('cache');
192
+ var _DEFAULT_OPEN_DELIMITER = "<";
193
+ var _DEFAULT_CLOSE_DELIMITER = ">";
194
+ var _DEFAULT_DELIMITER = "%";
195
+ var _DEFAULT_LOCALS_NAME = "locals";
196
+ var _NAME = "ejs";
197
+ var _REGEX_STRING = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";
198
+ var _OPTS_PASSABLE_WITH_DATA = [
199
+ "delimiter",
200
+ "scope",
201
+ "context",
202
+ "debug",
203
+ "compileDebug",
204
+ "client",
205
+ "_with",
206
+ "rmWhitespace",
207
+ "strict",
208
+ "filename",
209
+ "async"
210
+ ];
211
+ var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat("cache");
360
212
  var _BOM = /^\uFEFF/;
361
213
  var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
362
-
363
- /**
364
- * EJS template function cache. This can be a LRU object from lru-cache NPM
365
- * module. By default, it is {@link module:utils.cache}, a simple in-process
366
- * cache that grows continuously.
367
- *
368
- * @type {Cache}
369
- */
370
-
371
214
  exports.cache = utils.cache;
372
-
373
- /**
374
- * Custom file loader. Useful for template preprocessing or restricting access
375
- * to a certain part of the filesystem.
376
- *
377
- * @type {fileLoader}
378
- */
379
-
380
215
  exports.fileLoader = fs.readFileSync;
381
-
382
- /**
383
- * Name of the object containing the locals.
384
- *
385
- * This variable is overridden by {@link Options}`.localsName` if it is not
386
- * `undefined`.
387
- *
388
- * @type {String}
389
- * @public
390
- */
391
-
392
216
  exports.localsName = _DEFAULT_LOCALS_NAME;
393
-
394
- /**
395
- * Promise implementation -- defaults to the native implementation if available
396
- * This is mostly just for testability
397
- *
398
- * @type {PromiseConstructorLike}
399
- * @public
400
- */
401
-
402
- exports.promiseImpl = (new Function('return this;'))().Promise;
403
-
404
- /**
405
- * Get the path to the included file from the parent file path and the
406
- * specified path.
407
- *
408
- * @param {String} name specified path
409
- * @param {String} filename parent file path
410
- * @param {Boolean} [isDir=false] whether the parent file path is a directory
411
- * @return {String}
412
- */
217
+ exports.promiseImpl = new Function("return this;")().Promise;
413
218
  exports.resolveInclude = function(name, filename, isDir) {
414
219
  var dirname = path$1.dirname;
415
220
  var extname = path$1.extname;
@@ -417,113 +222,67 @@ function requireEjs () {
417
222
  var includePath = resolve(isDir ? filename : dirname(filename), name);
418
223
  var ext = extname(name);
419
224
  if (!ext) {
420
- includePath += '.ejs';
225
+ includePath += ".ejs";
421
226
  }
422
227
  return includePath;
423
228
  };
424
-
425
- /**
426
- * Try to resolve file path on multiple directories
427
- *
428
- * @param {String} name specified path
429
- * @param {Array<String>} paths list of possible parent directory paths
430
- * @return {String}
431
- */
432
229
  function resolvePaths(name, paths) {
433
230
  var filePath;
434
- if (paths.some(function (v) {
231
+ if (paths.some(function(v) {
435
232
  filePath = exports.resolveInclude(name, v, true);
436
233
  return fs.existsSync(filePath);
437
234
  })) {
438
235
  return filePath;
439
236
  }
440
237
  }
441
-
442
- /**
443
- * Get the path to the included file by Options
444
- *
445
- * @param {String} path specified path
446
- * @param {Options} options compilation options
447
- * @return {String}
448
- */
449
- function getIncludePath(path, options) {
238
+ function getIncludePath(path2, options) {
450
239
  var includePath;
451
240
  var filePath;
452
241
  var views = options.views;
453
- var match = /^[A-Za-z]+:\\|^\//.exec(path);
454
-
455
- // Abs path
242
+ var match = /^[A-Za-z]+:\\|^\//.exec(path2);
456
243
  if (match && match.length) {
457
- path = path.replace(/^\/*/, '');
244
+ path2 = path2.replace(/^\/*/, "");
458
245
  if (Array.isArray(options.root)) {
459
- includePath = resolvePaths(path, options.root);
246
+ includePath = resolvePaths(path2, options.root);
460
247
  } else {
461
- includePath = exports.resolveInclude(path, options.root || '/', true);
248
+ includePath = exports.resolveInclude(path2, options.root || "/", true);
462
249
  }
463
- }
464
- // Relative paths
465
- else {
466
- // Look relative to a passed filename first
250
+ } else {
467
251
  if (options.filename) {
468
- filePath = exports.resolveInclude(path, options.filename);
252
+ filePath = exports.resolveInclude(path2, options.filename);
469
253
  if (fs.existsSync(filePath)) {
470
254
  includePath = filePath;
471
255
  }
472
256
  }
473
- // Then look in any views directories
474
257
  if (!includePath && Array.isArray(views)) {
475
- includePath = resolvePaths(path, views);
258
+ includePath = resolvePaths(path2, views);
476
259
  }
477
- if (!includePath && typeof options.includer !== 'function') {
478
- throw new Error('Could not find the include file "' +
479
- options.escapeFunction(path) + '"');
260
+ if (!includePath && typeof options.includer !== "function") {
261
+ throw new Error('Could not find the include file "' + options.escapeFunction(path2) + '"');
480
262
  }
481
263
  }
482
264
  return includePath;
483
265
  }
484
-
485
- /**
486
- * Get the template from a string or a file, either compiled on-the-fly or
487
- * read from cache (if enabled), and cache the template if needed.
488
- *
489
- * If `template` is not set, the file specified in `options.filename` will be
490
- * read.
491
- *
492
- * If `options.cache` is true, this function reads the file from
493
- * `options.filename` so it must be set prior to calling this function.
494
- *
495
- * @memberof module:ejs-internal
496
- * @param {Options} options compilation options
497
- * @param {String} [template] template source
498
- * @return {(TemplateFunction|ClientFunction)}
499
- * Depending on the value of `options.client`, either type might be returned.
500
- * @static
501
- */
502
-
503
266
  function handleCache(options, template) {
504
267
  var func;
505
268
  var filename = options.filename;
506
269
  var hasTemplate = arguments.length > 1;
507
-
508
270
  if (options.cache) {
509
271
  if (!filename) {
510
- throw new Error('cache option requires a filename');
272
+ throw new Error("cache option requires a filename");
511
273
  }
512
274
  func = exports.cache.get(filename);
513
275
  if (func) {
514
276
  return func;
515
277
  }
516
278
  if (!hasTemplate) {
517
- template = fileLoader(filename).toString().replace(_BOM, '');
279
+ template = fileLoader(filename).toString().replace(_BOM, "");
518
280
  }
519
- }
520
- else if (!hasTemplate) {
521
- // istanbul ignore if: should not happen at all
281
+ } else if (!hasTemplate) {
522
282
  if (!filename) {
523
- throw new Error('Internal EJS error: no file name or template '
524
- + 'provided');
283
+ throw new Error("Internal EJS error: no file name or template provided");
525
284
  }
526
- template = fileLoader(filename).toString().replace(_BOM, '');
285
+ template = fileLoader(filename).toString().replace(_BOM, "");
527
286
  }
528
287
  func = exports.compile(template, options);
529
288
  if (options.cache) {
@@ -531,79 +290,38 @@ function requireEjs () {
531
290
  }
532
291
  return func;
533
292
  }
534
-
535
- /**
536
- * Try calling handleCache with the given options and data and call the
537
- * callback with the result. If an error occurs, call the callback with
538
- * the error. Used by renderFile().
539
- *
540
- * @memberof module:ejs-internal
541
- * @param {Options} options compilation options
542
- * @param {Object} data template data
543
- * @param {RenderFileCallback} cb callback
544
- * @static
545
- */
546
-
547
293
  function tryHandleCache(options, data, cb) {
548
294
  var result;
549
295
  if (!cb) {
550
- if (typeof exports.promiseImpl == 'function') {
551
- return new exports.promiseImpl(function (resolve, reject) {
296
+ if (typeof exports.promiseImpl == "function") {
297
+ return new exports.promiseImpl(function(resolve, reject) {
552
298
  try {
553
299
  result = handleCache(options)(data);
554
300
  resolve(result);
555
- }
556
- catch (err) {
301
+ } catch (err) {
557
302
  reject(err);
558
303
  }
559
304
  });
305
+ } else {
306
+ throw new Error("Please provide a callback function");
560
307
  }
561
- else {
562
- throw new Error('Please provide a callback function');
563
- }
564
- }
565
- else {
308
+ } else {
566
309
  try {
567
310
  result = handleCache(options)(data);
568
- }
569
- catch (err) {
311
+ } catch (err) {
570
312
  return cb(err);
571
313
  }
572
-
573
314
  cb(null, result);
574
315
  }
575
316
  }
576
-
577
- /**
578
- * fileLoader is independent
579
- *
580
- * @param {String} filePath ejs file path.
581
- * @return {String} The contents of the specified file.
582
- * @static
583
- */
584
-
585
- function fileLoader(filePath){
317
+ function fileLoader(filePath) {
586
318
  return exports.fileLoader(filePath);
587
319
  }
588
-
589
- /**
590
- * Get the template function.
591
- *
592
- * If `options.cache` is `true`, then the template is cached.
593
- *
594
- * @memberof module:ejs-internal
595
- * @param {String} path path for the specified file
596
- * @param {Options} options compilation options
597
- * @return {(TemplateFunction|ClientFunction)}
598
- * Depending on the value of `options.client`, either type might be returned
599
- * @static
600
- */
601
-
602
- function includeFile(path, options) {
320
+ function includeFile(path2, options) {
603
321
  var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
604
- opts.filename = getIncludePath(path, opts);
605
- if (typeof options.includer === 'function') {
606
- var includerResult = options.includer(path, opts.filename);
322
+ opts.filename = getIncludePath(path2, opts);
323
+ if (typeof options.includer === "function") {
324
+ var includerResult = options.includer(path2, opts.filename);
607
325
  if (includerResult) {
608
326
  if (includerResult.filename) {
609
327
  opts.filename = includerResult.filename;
@@ -615,71 +333,27 @@ function requireEjs () {
615
333
  }
616
334
  return handleCache(opts);
617
335
  }
618
-
619
- /**
620
- * Re-throw the given `err` in context to the `str` of ejs, `filename`, and
621
- * `lineno`.
622
- *
623
- * @implements {RethrowCallback}
624
- * @memberof module:ejs-internal
625
- * @param {Error} err Error object
626
- * @param {String} str EJS source
627
- * @param {String} flnm file name of the EJS file
628
- * @param {Number} lineno line number of the error
629
- * @param {EscapeCallback} esc
630
- * @static
631
- */
632
-
633
336
  function rethrow(err, str, flnm, lineno, esc) {
634
- var lines = str.split('\n');
337
+ var lines = str.split("\n");
635
338
  var start = Math.max(lineno - 3, 0);
636
339
  var end = Math.min(lines.length, lineno + 3);
637
340
  var filename = esc(flnm);
638
- // Error context
639
- var context = lines.slice(start, end).map(function (line, i){
341
+ var context = lines.slice(start, end).map(function(line, i) {
640
342
  var curr = i + start + 1;
641
- return (curr == lineno ? ' >> ' : ' ')
642
- + curr
643
- + '| '
644
- + line;
645
- }).join('\n');
646
-
647
- // Alter exception message
343
+ return (curr == lineno ? " >> " : " ") + curr + "| " + line;
344
+ }).join("\n");
648
345
  err.path = filename;
649
- err.message = (filename || 'ejs') + ':'
650
- + lineno + '\n'
651
- + context + '\n\n'
652
- + err.message;
653
-
346
+ err.message = (filename || "ejs") + ":" + lineno + "\n" + context + "\n\n" + err.message;
654
347
  throw err;
655
348
  }
656
-
657
- function stripSemi(str){
658
- return str.replace(/;(\s*$)/, '$1');
349
+ function stripSemi(str) {
350
+ return str.replace(/;(\s*$)/, "$1");
659
351
  }
660
-
661
- /**
662
- * Compile the given `str` of ejs into a template function.
663
- *
664
- * @param {String} template EJS template
665
- *
666
- * @param {Options} [opts] compilation options
667
- *
668
- * @return {(TemplateFunction|ClientFunction)}
669
- * Depending on the value of `opts.client`, either type might be returned.
670
- * Note that the return type of the function also depends on the value of `opts.async`.
671
- * @public
672
- */
673
-
674
352
  exports.compile = function compile(template, opts) {
675
353
  var templ;
676
-
677
- // v1 compat
678
- // 'scope' is 'context'
679
- // FIXME: Remove this in a future version
680
354
  if (opts && opts.scope) {
681
- if (!scopeOptionWarned){
682
- console.warn('`scope` option is deprecated and will be removed in EJS 3');
355
+ if (!scopeOptionWarned) {
356
+ console.warn("`scope` option is deprecated and will be removed in EJS 3");
683
357
  scopeOptionWarned = true;
684
358
  }
685
359
  if (!opts.context) {
@@ -690,124 +364,61 @@ function requireEjs () {
690
364
  templ = new Template(template, opts);
691
365
  return templ.compile();
692
366
  };
693
-
694
- /**
695
- * Render the given `template` of ejs.
696
- *
697
- * If you would like to include options but not data, you need to explicitly
698
- * call this function with `data` being an empty object or `null`.
699
- *
700
- * @param {String} template EJS template
701
- * @param {Object} [data={}] template data
702
- * @param {Options} [opts={}] compilation and rendering options
703
- * @return {(String|Promise<String>)}
704
- * Return value type depends on `opts.async`.
705
- * @public
706
- */
707
-
708
- exports.render = function (template, d, o) {
367
+ exports.render = function(template, d, o) {
709
368
  var data = d || utils.createNullProtoObjWherePossible();
710
369
  var opts = o || utils.createNullProtoObjWherePossible();
711
-
712
- // No options object -- if there are optiony names
713
- // in the data, copy them to options
714
370
  if (arguments.length == 2) {
715
371
  utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);
716
372
  }
717
-
718
373
  return handleCache(opts, template)(data);
719
374
  };
720
-
721
- /**
722
- * Render an EJS file at the given `path` and callback `cb(err, str)`.
723
- *
724
- * If you would like to include options but not data, you need to explicitly
725
- * call this function with `data` being an empty object or `null`.
726
- *
727
- * @param {String} path path to the EJS file
728
- * @param {Object} [data={}] template data
729
- * @param {Options} [opts={}] compilation and rendering options
730
- * @param {RenderFileCallback} cb callback
731
- * @public
732
- */
733
-
734
- exports.renderFile = function () {
375
+ exports.renderFile = function() {
735
376
  var args = Array.prototype.slice.call(arguments);
736
377
  var filename = args.shift();
737
378
  var cb;
738
- var opts = {filename: filename};
379
+ var opts = { filename };
739
380
  var data;
740
381
  var viewOpts;
741
-
742
- // Do we have a callback?
743
- if (typeof arguments[arguments.length - 1] == 'function') {
382
+ if (typeof arguments[arguments.length - 1] == "function") {
744
383
  cb = args.pop();
745
384
  }
746
- // Do we have data/opts?
747
385
  if (args.length) {
748
- // Should always have data obj
749
386
  data = args.shift();
750
- // Normal passed opts (data obj + opts obj)
751
387
  if (args.length) {
752
- // Use shallowCopy so we don't pollute passed in opts obj with new vals
753
388
  utils.shallowCopy(opts, args.pop());
754
- }
755
- // Special casing for Express (settings + opts-in-data)
756
- else {
757
- // Express 3 and 4
389
+ } else {
758
390
  if (data.settings) {
759
- // Pull a few things from known locations
760
391
  if (data.settings.views) {
761
392
  opts.views = data.settings.views;
762
393
  }
763
- if (data.settings['view cache']) {
394
+ if (data.settings["view cache"]) {
764
395
  opts.cache = true;
765
396
  }
766
- // Undocumented after Express 2, but still usable, esp. for
767
- // items that are unsafe to be passed along with data, like `root`
768
- viewOpts = data.settings['view options'];
397
+ viewOpts = data.settings["view options"];
769
398
  if (viewOpts) {
770
399
  utils.shallowCopy(opts, viewOpts);
771
400
  }
772
401
  }
773
- // Express 2 and lower, values set in app.locals, or people who just
774
- // want to pass options in their data. NOTE: These values will override
775
- // anything previously set in settings or settings['view options']
776
402
  utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS);
777
403
  }
778
404
  opts.filename = filename;
779
- }
780
- else {
405
+ } else {
781
406
  data = utils.createNullProtoObjWherePossible();
782
407
  }
783
-
784
408
  return tryHandleCache(opts, data, cb);
785
409
  };
786
-
787
- /**
788
- * Clear intermediate JavaScript cache. Calls {@link Cache#reset}.
789
- * @public
790
- */
791
-
792
- /**
793
- * EJS template class
794
- * @public
795
- */
796
410
  exports.Template = Template;
797
-
798
- exports.clearCache = function () {
411
+ exports.clearCache = function() {
799
412
  exports.cache.reset();
800
413
  };
801
-
802
414
  function Template(text, optsParam) {
803
415
  var opts = utils.hasOwnOnlyObject(optsParam);
804
416
  var options = utils.createNullProtoObjWherePossible();
805
417
  this.templateText = text;
806
- /** @type {string | null} */
807
418
  this.mode = null;
808
419
  this.truncate = false;
809
420
  this.currentLine = 1;
810
- this.source = '';
421
+ this.source = "";
811
422
  options.client = opts.client || false;
812
423
  options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML;
813
424
  options.compileDebug = opts.compileDebug !== false;
@@ -827,112 +438,84 @@ function requireEjs () {
827
438
  options.views = opts.views;
828
439
  options.async = opts.async;
829
440
  options.destructuredLocals = opts.destructuredLocals;
830
- options.legacyInclude = typeof opts.legacyInclude != 'undefined' ? !!opts.legacyInclude : true;
831
-
441
+ options.legacyInclude = typeof opts.legacyInclude != "undefined" ? !!opts.legacyInclude : true;
832
442
  if (options.strict) {
833
443
  options._with = false;
444
+ } else {
445
+ options._with = typeof opts._with != "undefined" ? opts._with : true;
834
446
  }
835
- else {
836
- options._with = typeof opts._with != 'undefined' ? opts._with : true;
837
- }
838
-
839
447
  this.opts = options;
840
-
841
448
  this.regex = this.createRegex();
842
449
  }
843
-
844
450
  Template.modes = {
845
- EVAL: 'eval',
846
- ESCAPED: 'escaped',
847
- RAW: 'raw',
848
- COMMENT: 'comment',
849
- LITERAL: 'literal'
451
+ EVAL: "eval",
452
+ ESCAPED: "escaped",
453
+ RAW: "raw",
454
+ COMMENT: "comment",
455
+ LITERAL: "literal"
850
456
  };
851
-
852
457
  Template.prototype = {
853
- createRegex: function () {
458
+ createRegex: function() {
854
459
  var str = _REGEX_STRING;
855
460
  var delim = utils.escapeRegExpChars(this.opts.delimiter);
856
461
  var open = utils.escapeRegExpChars(this.opts.openDelimiter);
857
462
  var close = utils.escapeRegExpChars(this.opts.closeDelimiter);
858
- str = str.replace(/%/g, delim)
859
- .replace(/</g, open)
860
- .replace(/>/g, close);
463
+ str = str.replace(/%/g, delim).replace(/</g, open).replace(/>/g, close);
861
464
  return new RegExp(str);
862
465
  },
863
-
864
- compile: function () {
865
- /** @type {string} */
466
+ compile: function() {
866
467
  var src;
867
- /** @type {ClientFunction} */
868
468
  var fn;
869
469
  var opts = this.opts;
870
- var prepended = '';
871
- var appended = '';
872
- /** @type {EscapeCallback} */
470
+ var prepended = "";
471
+ var appended = "";
873
472
  var escapeFn = opts.escapeFunction;
874
- /** @type {FunctionConstructor} */
875
473
  var ctor;
876
- /** @type {string} */
877
- var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : 'undefined';
878
-
474
+ var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : "undefined";
879
475
  if (!this.source) {
880
476
  this.generateSource();
881
- prepended +=
882
- ' var __output = "";\n' +
883
- ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
477
+ prepended += ' var __output = "";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
884
478
  if (opts.outputFunctionName) {
885
479
  if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) {
886
- throw new Error('outputFunctionName is not a valid JS identifier.');
480
+ throw new Error("outputFunctionName is not a valid JS identifier.");
887
481
  }
888
- prepended += ' var ' + opts.outputFunctionName + ' = __append;' + '\n';
482
+ prepended += " var " + opts.outputFunctionName + " = __append;\n";
889
483
  }
890
484
  if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) {
891
- throw new Error('localsName is not a valid JS identifier.');
485
+ throw new Error("localsName is not a valid JS identifier.");
892
486
  }
893
487
  if (opts.destructuredLocals && opts.destructuredLocals.length) {
894
- var destructuring = ' var __locals = (' + opts.localsName + ' || {}),\n';
488
+ var destructuring = " var __locals = (" + opts.localsName + " || {}),\n";
895
489
  for (var i = 0; i < opts.destructuredLocals.length; i++) {
896
490
  var name = opts.destructuredLocals[i];
897
491
  if (!_JS_IDENTIFIER.test(name)) {
898
- throw new Error('destructuredLocals[' + i + '] is not a valid JS identifier.');
492
+ throw new Error("destructuredLocals[" + i + "] is not a valid JS identifier.");
899
493
  }
900
494
  if (i > 0) {
901
- destructuring += ',\n ';
495
+ destructuring += ",\n ";
902
496
  }
903
- destructuring += name + ' = __locals.' + name;
497
+ destructuring += name + " = __locals." + name;
904
498
  }
905
- prepended += destructuring + ';\n';
499
+ prepended += destructuring + ";\n";
906
500
  }
907
501
  if (opts._with !== false) {
908
- prepended += ' with (' + opts.localsName + ' || {}) {' + '\n';
909
- appended += ' }' + '\n';
502
+ prepended += " with (" + opts.localsName + " || {}) {\n";
503
+ appended += " }\n";
910
504
  }
911
- appended += ' return __output;' + '\n';
505
+ appended += " return __output;\n";
912
506
  this.source = prepended + this.source + appended;
913
507
  }
914
-
915
508
  if (opts.compileDebug) {
916
- src = 'var __line = 1' + '\n'
917
- + ' , __lines = ' + JSON.stringify(this.templateText) + '\n'
918
- + ' , __filename = ' + sanitizedFilename + ';' + '\n'
919
- + 'try {' + '\n'
920
- + this.source
921
- + '} catch (e) {' + '\n'
922
- + ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
923
- + '}' + '\n';
924
- }
925
- else {
509
+ src = "var __line = 1\n , __lines = " + JSON.stringify(this.templateText) + "\n , __filename = " + sanitizedFilename + ";\ntry {\n" + this.source + "} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n";
510
+ } else {
926
511
  src = this.source;
927
512
  }
928
-
929
513
  if (opts.client) {
930
- src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
514
+ src = "escapeFn = escapeFn || " + escapeFn.toString() + ";\n" + src;
931
515
  if (opts.compileDebug) {
932
- src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src;
516
+ src = "rethrow = rethrow || " + rethrow.toString() + ";\n" + src;
933
517
  }
934
518
  }
935
-
936
519
  if (opts.strict) {
937
520
  src = '"use strict";\n' + src;
938
521
  }
@@ -940,306 +523,208 @@ function requireEjs () {
940
523
  console.log(src);
941
524
  }
942
525
  if (opts.compileDebug && opts.filename) {
943
- src = src + '\n'
944
- + '//# sourceURL=' + sanitizedFilename + '\n';
526
+ src = src + "\n//# sourceURL=" + sanitizedFilename + "\n";
945
527
  }
946
-
947
528
  try {
948
529
  if (opts.async) {
949
- // Have to use generated function for this, since in envs without support,
950
- // it breaks in parsing
951
530
  try {
952
- ctor = (new Function('return (async function(){}).constructor;'))();
953
- }
954
- catch(e) {
531
+ ctor = new Function("return (async function(){}).constructor;")();
532
+ } catch (e) {
955
533
  if (e instanceof SyntaxError) {
956
- throw new Error('This environment does not support async/await');
957
- }
958
- else {
534
+ throw new Error("This environment does not support async/await");
535
+ } else {
959
536
  throw e;
960
537
  }
961
538
  }
962
- }
963
- else {
539
+ } else {
964
540
  ctor = Function;
965
541
  }
966
- fn = new ctor(opts.localsName + ', escapeFn, include, rethrow', src);
967
- }
968
- catch(e) {
969
- // istanbul ignore else
542
+ fn = new ctor(opts.localsName + ", escapeFn, include, rethrow", src);
543
+ } catch (e) {
970
544
  if (e instanceof SyntaxError) {
971
545
  if (opts.filename) {
972
- e.message += ' in ' + opts.filename;
546
+ e.message += " in " + opts.filename;
973
547
  }
974
- e.message += ' while compiling ejs\n\n';
975
- e.message += 'If the above error is not helpful, you may want to try EJS-Lint:\n';
976
- e.message += 'https://github.com/RyanZim/EJS-Lint';
548
+ e.message += " while compiling ejs\n\n";
549
+ e.message += "If the above error is not helpful, you may want to try EJS-Lint:\n";
550
+ e.message += "https://github.com/RyanZim/EJS-Lint";
977
551
  if (!opts.async) {
978
- e.message += '\n';
979
- e.message += 'Or, if you meant to create an async function, pass `async: true` as an option.';
552
+ e.message += "\n";
553
+ e.message += "Or, if you meant to create an async function, pass `async: true` as an option.";
980
554
  }
981
555
  }
982
556
  throw e;
983
557
  }
984
-
985
- // Return a callable function which will execute the function
986
- // created by the source-code, with the passed data as locals
987
- // Adds a local `include` function which allows full recursive include
988
558
  var returnedFn = opts.client ? fn : function anonymous(data) {
989
- var include = function (path, includeData) {
559
+ var include = function(path2, includeData) {
990
560
  var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
991
561
  if (includeData) {
992
562
  d = utils.shallowCopy(d, includeData);
993
563
  }
994
- return includeFile(path, opts)(d);
564
+ return includeFile(path2, opts)(d);
995
565
  };
996
- return fn.apply(opts.context,
997
- [data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]);
566
+ return fn.apply(
567
+ opts.context,
568
+ [data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]
569
+ );
998
570
  };
999
- if (opts.filename && typeof Object.defineProperty === 'function') {
571
+ if (opts.filename && typeof Object.defineProperty === "function") {
1000
572
  var filename = opts.filename;
1001
573
  var basename = path$1.basename(filename, path$1.extname(filename));
1002
574
  try {
1003
- Object.defineProperty(returnedFn, 'name', {
575
+ Object.defineProperty(returnedFn, "name", {
1004
576
  value: basename,
1005
577
  writable: false,
1006
578
  enumerable: false,
1007
579
  configurable: true
1008
580
  });
1009
- } catch (e) {/* ignore */}
581
+ } catch (e) {
582
+ }
1010
583
  }
1011
584
  return returnedFn;
1012
585
  },
1013
-
1014
- generateSource: function () {
586
+ generateSource: function() {
1015
587
  var opts = this.opts;
1016
-
1017
588
  if (opts.rmWhitespace) {
1018
- // Have to use two separate replace here as `^` and `$` operators don't
1019
- // work well with `\r` and empty lines don't work well with the `m` flag.
1020
- this.templateText =
1021
- this.templateText.replace(/[\r\n]+/g, '\n').replace(/^\s+|\s+$/gm, '');
589
+ this.templateText = this.templateText.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
1022
590
  }
1023
-
1024
- // Slurp spaces and tabs before <%_ and after _%>
1025
- this.templateText =
1026
- this.templateText.replace(/[ \t]*<%_/gm, '<%_').replace(/_%>[ \t]*/gm, '_%>');
1027
-
591
+ this.templateText = this.templateText.replace(/[ \t]*<%_/gm, "<%_").replace(/_%>[ \t]*/gm, "_%>");
1028
592
  var self = this;
1029
593
  var matches = this.parseTemplateText();
1030
594
  var d = this.opts.delimiter;
1031
595
  var o = this.opts.openDelimiter;
1032
596
  var c = this.opts.closeDelimiter;
1033
-
1034
597
  if (matches && matches.length) {
1035
- matches.forEach(function (line, index) {
598
+ matches.forEach(function(line, index) {
1036
599
  var closing;
1037
- // If this is an opening tag, check for closing tags
1038
- // FIXME: May end up with some false positives here
1039
- // Better to store modes as k/v with openDelimiter + delimiter as key
1040
- // Then this can simply check against the map
1041
- if ( line.indexOf(o + d) === 0 // If it is a tag
1042
- && line.indexOf(o + d + d) !== 0) { // and is not escaped
600
+ if (line.indexOf(o + d) === 0 && line.indexOf(o + d + d) !== 0) {
1043
601
  closing = matches[index + 2];
1044
- if (!(closing == d + c || closing == '-' + d + c || closing == '_' + d + c)) {
602
+ if (!(closing == d + c || closing == "-" + d + c || closing == "_" + d + c)) {
1045
603
  throw new Error('Could not find matching close tag for "' + line + '".');
1046
604
  }
1047
605
  }
1048
606
  self.scanLine(line);
1049
607
  });
1050
608
  }
1051
-
1052
609
  },
1053
-
1054
- parseTemplateText: function () {
610
+ parseTemplateText: function() {
1055
611
  var str = this.templateText;
1056
612
  var pat = this.regex;
1057
613
  var result = pat.exec(str);
1058
614
  var arr = [];
1059
615
  var firstPos;
1060
-
1061
616
  while (result) {
1062
617
  firstPos = result.index;
1063
-
1064
618
  if (firstPos !== 0) {
1065
619
  arr.push(str.substring(0, firstPos));
1066
620
  str = str.slice(firstPos);
1067
621
  }
1068
-
1069
622
  arr.push(result[0]);
1070
623
  str = str.slice(result[0].length);
1071
624
  result = pat.exec(str);
1072
625
  }
1073
-
1074
626
  if (str) {
1075
627
  arr.push(str);
1076
628
  }
1077
-
1078
629
  return arr;
1079
630
  },
1080
-
1081
- _addOutput: function (line) {
631
+ _addOutput: function(line) {
1082
632
  if (this.truncate) {
1083
- // Only replace single leading linebreak in the line after
1084
- // -%> tag -- this is the single, trailing linebreak
1085
- // after the tag that the truncation mode replaces
1086
- // Handle Win / Unix / old Mac linebreaks -- do the \r\n
1087
- // combo first in the regex-or
1088
- line = line.replace(/^(?:\r\n|\r|\n)/, '');
633
+ line = line.replace(/^(?:\r\n|\r|\n)/, "");
1089
634
  this.truncate = false;
1090
635
  }
1091
636
  if (!line) {
1092
637
  return line;
1093
638
  }
1094
-
1095
- // Preserve literal slashes
1096
- line = line.replace(/\\/g, '\\\\');
1097
-
1098
- // Convert linebreaks
1099
- line = line.replace(/\n/g, '\\n');
1100
- line = line.replace(/\r/g, '\\r');
1101
-
1102
- // Escape double-quotes
1103
- // - this will be the delimiter during execution
639
+ line = line.replace(/\\/g, "\\\\");
640
+ line = line.replace(/\n/g, "\\n");
641
+ line = line.replace(/\r/g, "\\r");
1104
642
  line = line.replace(/"/g, '\\"');
1105
- this.source += ' ; __append("' + line + '")' + '\n';
643
+ this.source += ' ; __append("' + line + '")\n';
1106
644
  },
1107
-
1108
- scanLine: function (line) {
645
+ scanLine: function(line) {
1109
646
  var self = this;
1110
647
  var d = this.opts.delimiter;
1111
648
  var o = this.opts.openDelimiter;
1112
649
  var c = this.opts.closeDelimiter;
1113
650
  var newLineCount = 0;
1114
-
1115
- newLineCount = (line.split('\n').length - 1);
1116
-
651
+ newLineCount = line.split("\n").length - 1;
1117
652
  switch (line) {
1118
- case o + d:
1119
- case o + d + '_':
1120
- this.mode = Template.modes.EVAL;
1121
- break;
1122
- case o + d + '=':
1123
- this.mode = Template.modes.ESCAPED;
1124
- break;
1125
- case o + d + '-':
1126
- this.mode = Template.modes.RAW;
1127
- break;
1128
- case o + d + '#':
1129
- this.mode = Template.modes.COMMENT;
1130
- break;
1131
- case o + d + d:
1132
- this.mode = Template.modes.LITERAL;
1133
- this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")' + '\n';
1134
- break;
1135
- case d + d + c:
1136
- this.mode = Template.modes.LITERAL;
1137
- this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")' + '\n';
1138
- break;
1139
- case d + c:
1140
- case '-' + d + c:
1141
- case '_' + d + c:
1142
- if (this.mode == Template.modes.LITERAL) {
1143
- this._addOutput(line);
1144
- }
1145
-
1146
- this.mode = null;
1147
- this.truncate = line.indexOf('-') === 0 || line.indexOf('_') === 0;
1148
- break;
1149
- default:
1150
- // In script mode, depends on type of tag
1151
- if (this.mode) {
1152
- // If '//' is found without a line break, add a line break.
1153
- switch (this.mode) {
1154
- case Template.modes.EVAL:
1155
- case Template.modes.ESCAPED:
1156
- case Template.modes.RAW:
1157
- if (line.lastIndexOf('//') > line.lastIndexOf('\n')) {
1158
- line += '\n';
1159
- }
653
+ case o + d:
654
+ case o + d + "_":
655
+ this.mode = Template.modes.EVAL;
656
+ break;
657
+ case o + d + "=":
658
+ this.mode = Template.modes.ESCAPED;
659
+ break;
660
+ case o + d + "-":
661
+ this.mode = Template.modes.RAW;
662
+ break;
663
+ case o + d + "#":
664
+ this.mode = Template.modes.COMMENT;
665
+ break;
666
+ case o + d + d:
667
+ this.mode = Template.modes.LITERAL;
668
+ this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")\n';
669
+ break;
670
+ case d + d + c:
671
+ this.mode = Template.modes.LITERAL;
672
+ this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")\n';
673
+ break;
674
+ case d + c:
675
+ case "-" + d + c:
676
+ case "_" + d + c:
677
+ if (this.mode == Template.modes.LITERAL) {
678
+ this._addOutput(line);
1160
679
  }
1161
- switch (this.mode) {
1162
- // Just executing code
1163
- case Template.modes.EVAL:
1164
- this.source += ' ; ' + line + '\n';
1165
- break;
1166
- // Exec, esc, and output
1167
- case Template.modes.ESCAPED:
1168
- this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n';
1169
- break;
1170
- // Exec and output
1171
- case Template.modes.RAW:
1172
- this.source += ' ; __append(' + stripSemi(line) + ')' + '\n';
1173
- break;
1174
- case Template.modes.COMMENT:
1175
- // Do nothing
1176
- break;
1177
- // Literal <%% mode, append as raw output
1178
- case Template.modes.LITERAL:
680
+ this.mode = null;
681
+ this.truncate = line.indexOf("-") === 0 || line.indexOf("_") === 0;
682
+ break;
683
+ default:
684
+ if (this.mode) {
685
+ switch (this.mode) {
686
+ case Template.modes.EVAL:
687
+ case Template.modes.ESCAPED:
688
+ case Template.modes.RAW:
689
+ if (line.lastIndexOf("//") > line.lastIndexOf("\n")) {
690
+ line += "\n";
691
+ }
692
+ }
693
+ switch (this.mode) {
694
+ // Just executing code
695
+ case Template.modes.EVAL:
696
+ this.source += " ; " + line + "\n";
697
+ break;
698
+ // Exec, esc, and output
699
+ case Template.modes.ESCAPED:
700
+ this.source += " ; __append(escapeFn(" + stripSemi(line) + "))\n";
701
+ break;
702
+ // Exec and output
703
+ case Template.modes.RAW:
704
+ this.source += " ; __append(" + stripSemi(line) + ")\n";
705
+ break;
706
+ case Template.modes.COMMENT:
707
+ break;
708
+ // Literal <%% mode, append as raw output
709
+ case Template.modes.LITERAL:
710
+ this._addOutput(line);
711
+ break;
712
+ }
713
+ } else {
1179
714
  this._addOutput(line);
1180
- break;
1181
715
  }
1182
- }
1183
- // In string mode, just add the output
1184
- else {
1185
- this._addOutput(line);
1186
- }
1187
716
  }
1188
-
1189
717
  if (self.opts.compileDebug && newLineCount) {
1190
718
  this.currentLine += newLineCount;
1191
- this.source += ' ; __line = ' + this.currentLine + '\n';
719
+ this.source += " ; __line = " + this.currentLine + "\n";
1192
720
  }
1193
721
  }
1194
722
  };
1195
-
1196
- /**
1197
- * Escape characters reserved in XML.
1198
- *
1199
- * This is simply an export of {@link module:utils.escapeXML}.
1200
- *
1201
- * If `markup` is `undefined` or `null`, the empty string is returned.
1202
- *
1203
- * @param {String} markup Input string
1204
- * @return {String} Escaped string
1205
- * @public
1206
- * @func
1207
- * */
1208
723
  exports.escapeXML = utils.escapeXML;
1209
-
1210
- /**
1211
- * Express.js support.
1212
- *
1213
- * This is an alias for {@link module:ejs.renderFile}, in order to support
1214
- * Express.js out-of-the-box.
1215
- *
1216
- * @func
1217
- */
1218
-
1219
724
  exports.__express = exports.renderFile;
1220
-
1221
- /**
1222
- * Version of EJS.
1223
- *
1224
- * @readonly
1225
- * @type {String}
1226
- * @public
1227
- */
1228
-
1229
725
  exports.VERSION = _VERSION_STRING;
1230
-
1231
- /**
1232
- * Name for detection of EJS.
1233
- *
1234
- * @readonly
1235
- * @type {String}
1236
- * @public
1237
- */
1238
-
1239
726
  exports.name = _NAME;
1240
-
1241
- /* istanbul ignore if */
1242
- if (typeof window != 'undefined') {
727
+ if (typeof window != "undefined") {
1243
728
  window.ejs = exports;
1244
729
  }
1245
730
  } (ejs$1));