gant-core 2.0.2 → 2.0.4

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