@shopify/create-app 3.65.2 → 3.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2RSJVBMF.js +5625 -0
- package/dist/{chunk-Z65QJ5D7.js → chunk-4DRC2PSU.js} +17 -30
- package/dist/chunk-4OD45DDO.js +31508 -0
- package/dist/chunk-522OB3EU.js +45 -0
- package/dist/{chunk-JTKTLA7L.js → chunk-5U24TEX5.js} +5434 -10324
- package/dist/{chunk-GJPZCXGT.js → chunk-6A7MXLVB.js} +159 -405
- package/dist/{chunk-ZYKRTO5P.js → chunk-7ZCQLP5Y.js} +3 -3
- package/dist/{chunk-5LBEKXRW.js → chunk-FIJKOZJF.js} +19 -55
- package/dist/{chunk-QSKQTKTB.js → chunk-FT6PCF6E.js} +2441 -5551
- package/dist/chunk-GIUM5DCQ.js +2144 -0
- package/dist/chunk-HIAKHDLR.js +54 -0
- package/dist/chunk-LLSRDN3T.js +15352 -0
- package/dist/chunk-LTDD2GRL.js +111 -0
- package/dist/{chunk-63QVG2CD.js → chunk-NGBYQF44.js} +9 -9
- package/dist/chunk-NLC7NBUB.js +80 -0
- package/dist/{chunk-FMKVOTQK.js → chunk-O5K4AU7Q.js} +18 -34
- package/dist/chunk-OMDEA7TV.js +10615 -0
- package/dist/chunk-PNN7RS7Y.js +105 -0
- package/dist/{chunk-ZPL24Y2D.js → chunk-POZ5MGPT.js} +13 -18
- package/dist/chunk-T7T35H4F.js +108 -0
- package/dist/chunk-UBB7JKND.js +55 -0
- package/dist/chunk-VSLR7ET4.js +3034 -0
- package/dist/{chunk-SAO7C4LP.js → chunk-VZVGAREJ.js} +46821 -101962
- package/dist/{chunk-KDNBKIH4.js → chunk-WBQF4CSV.js} +12 -22
- package/dist/chunk-XVNW332R.js +524 -0
- package/dist/{chunk-YB6D4XQ7.js → chunk-Y4ECGRAF.js} +13 -23
- package/dist/chunk-ZAUZQLNO.js +3774 -0
- package/dist/chunk-ZULFH3SL.js +1847 -0
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +27 -27
- package/dist/commands/init.test.js +51 -70
- package/dist/{constants-24TFXZKQ.js → constants-WG7I7G3O.js} +5 -5
- package/dist/custom-oclif-loader-JKRJZ56E.js +47 -0
- package/dist/del-NW5KFKFP.js +1820 -0
- package/dist/devtools-UBOREV57.js +2572 -0
- package/dist/error-handler-26SLAJTC.js +35 -0
- package/dist/hooks/postrun.js +35 -42
- package/dist/hooks/prerun.js +58 -36
- package/dist/index.js +7 -7
- package/dist/lib-3K5QYF3J.js +9 -0
- package/dist/{local-3VUKCW4R.js → local-H6TW5MNX.js} +13 -13
- package/dist/magic-string.es-3RXPUXZF.js +843 -0
- package/dist/multipart-parser-QKUAJJP5.js +193 -0
- package/dist/{node-package-manager-HYZRZNU6.js → node-package-manager-QAUN6HGS.js} +16 -14
- package/dist/open-MZGVNFZO.js +197 -0
- package/dist/out-KDGAD475.js +6 -0
- package/dist/{path-CFPIDSWV.js → path-L375JOQ2.js} +4 -4
- package/dist/prompts/init.js +13 -13
- package/dist/prompts/init.test.js +42 -59
- package/dist/services/init.js +20 -20
- package/dist/services/init.test.js +5 -5
- package/dist/system-ZI2HKAKO.js +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-7NEDEALP.js → ui-727JEZUX.js} +13 -13
- package/dist/utils/template/cleanup.js +13 -13
- package/dist/utils/template/cleanup.test.js +18 -30
- package/dist/utils/template/npm.js +15 -15
- package/dist/utils/template/npm.test.js +48 -87
- package/oclif.manifest.json +1 -1
- package/package.json +3 -4
- package/dist/chunk-3US34ZNP.js +0 -145
- package/dist/chunk-3XYIOBQ2.js +0 -22131
- package/dist/chunk-6IZMEXPW.js +0 -105
- package/dist/chunk-7DRS5WXI.js +0 -7843
- package/dist/chunk-DL3MKXVR.js +0 -4754
- package/dist/chunk-HDVJ5FPK.js +0 -63
- package/dist/chunk-IKO7JBOJ.js +0 -14788
- package/dist/chunk-LSCXQWNO.js +0 -822
- package/dist/chunk-M2VKB6RG.js +0 -146
- package/dist/chunk-MCED27CG.js +0 -5626
- package/dist/chunk-SWNRLCC6.js +0 -61
- package/dist/chunk-T5LLJYYS.js +0 -195
- package/dist/chunk-U5LTJVWL.js +0 -3185
- package/dist/chunk-WR7YKB6H.js +0 -44962
- package/dist/chunk-YC4FLMDD.js +0 -74
- package/dist/chunk-ZRUHMMSQ.js +0 -2477
- package/dist/custom-oclif-loader-5KBN3RSN.js +0 -83
- package/dist/del-ZCPTGWOA.js +0 -2847
- package/dist/devtools-5N4JAP3R.js +0 -3588
- package/dist/error-handler-GTW2KSRC.js +0 -35
- package/dist/lib-CTSCLPNV.js +0 -9
- package/dist/magic-string.es-ATGURXGQ.js +0 -1353
- package/dist/multipart-parser-KYOHF24X.js +0 -360
- package/dist/open-JRS7RW22.js +0 -291
- package/dist/out-OKI3G7I5.js +0 -6
- package/dist/system-4S4YXUXZ.js +0 -26
|
@@ -0,0 +1,1847 @@
|
|
|
1
|
+
import {
|
|
2
|
+
errorHandler,
|
|
3
|
+
registerCleanBugsnagErrorsFromWithinPlugins
|
|
4
|
+
} from "./chunk-GIUM5DCQ.js";
|
|
5
|
+
import {
|
|
6
|
+
init_default as init_default2
|
|
7
|
+
} from "./chunk-2RSJVBMF.js";
|
|
8
|
+
import {
|
|
9
|
+
hashString
|
|
10
|
+
} from "./chunk-Y4ECGRAF.js";
|
|
11
|
+
import {
|
|
12
|
+
packageManager,
|
|
13
|
+
packageManagerFromUserAgent
|
|
14
|
+
} from "./chunk-LLSRDN3T.js";
|
|
15
|
+
import {
|
|
16
|
+
globalFlags
|
|
17
|
+
} from "./chunk-NLC7NBUB.js";
|
|
18
|
+
import {
|
|
19
|
+
init_default,
|
|
20
|
+
isPredefinedTemplate,
|
|
21
|
+
templates,
|
|
22
|
+
visibleTemplates
|
|
23
|
+
} from "./chunk-T7T35H4F.js";
|
|
24
|
+
import {
|
|
25
|
+
AbortError,
|
|
26
|
+
addPublicMetadata,
|
|
27
|
+
addSensitiveMetadata,
|
|
28
|
+
findPathUp,
|
|
29
|
+
inferPackageManagerForGlobalCLI,
|
|
30
|
+
installGlobalShopifyCLI,
|
|
31
|
+
isDevelopment,
|
|
32
|
+
outputContent,
|
|
33
|
+
outputInfo,
|
|
34
|
+
outputToken,
|
|
35
|
+
readFile,
|
|
36
|
+
renderInfo,
|
|
37
|
+
renderWarning,
|
|
38
|
+
terminalSupportsRawMode,
|
|
39
|
+
underscore
|
|
40
|
+
} from "./chunk-4OD45DDO.js";
|
|
41
|
+
import {
|
|
42
|
+
cwd,
|
|
43
|
+
resolvePath
|
|
44
|
+
} from "./chunk-4DRC2PSU.js";
|
|
45
|
+
import {
|
|
46
|
+
isTruthy
|
|
47
|
+
} from "./chunk-LTDD2GRL.js";
|
|
48
|
+
import {
|
|
49
|
+
require_lib
|
|
50
|
+
} from "./chunk-VZVGAREJ.js";
|
|
51
|
+
import {
|
|
52
|
+
__commonJS,
|
|
53
|
+
__require,
|
|
54
|
+
__toESM,
|
|
55
|
+
init_cjs_shims
|
|
56
|
+
} from "./chunk-POZ5MGPT.js";
|
|
57
|
+
|
|
58
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js
|
|
59
|
+
var require_parser = __commonJS({
|
|
60
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
|
|
61
|
+
"use strict";
|
|
62
|
+
init_cjs_shims();
|
|
63
|
+
var ParserError = class _ParserError extends Error {
|
|
64
|
+
/* istanbul ignore next */
|
|
65
|
+
constructor(msg, filename, linenumber) {
|
|
66
|
+
super("[ParserError] " + msg, filename, linenumber), this.name = "ParserError", this.code = "ParserError", Error.captureStackTrace && Error.captureStackTrace(this, _ParserError);
|
|
67
|
+
}
|
|
68
|
+
}, State = class {
|
|
69
|
+
constructor(parser) {
|
|
70
|
+
this.parser = parser, this.buf = "", this.returned = null, this.result = null, this.resultTable = null, this.resultArr = null;
|
|
71
|
+
}
|
|
72
|
+
}, Parser = class {
|
|
73
|
+
constructor() {
|
|
74
|
+
this.pos = 0, this.col = 0, this.line = 0, this.obj = {}, this.ctx = this.obj, this.stack = [], this._buf = "", this.char = null, this.ii = 0, this.state = new State(this.parseStart);
|
|
75
|
+
}
|
|
76
|
+
parse(str) {
|
|
77
|
+
if (str.length === 0 || str.length == null)
|
|
78
|
+
return;
|
|
79
|
+
this._buf = String(str), this.ii = -1, this.char = -1;
|
|
80
|
+
let getNext;
|
|
81
|
+
for (; getNext === !1 || this.nextChar(); )
|
|
82
|
+
getNext = this.runOne();
|
|
83
|
+
this._buf = null;
|
|
84
|
+
}
|
|
85
|
+
nextChar() {
|
|
86
|
+
return this.char === 10 && (++this.line, this.col = -1), ++this.ii, this.char = this._buf.codePointAt(this.ii), ++this.pos, ++this.col, this.haveBuffer();
|
|
87
|
+
}
|
|
88
|
+
haveBuffer() {
|
|
89
|
+
return this.ii < this._buf.length;
|
|
90
|
+
}
|
|
91
|
+
runOne() {
|
|
92
|
+
return this.state.parser.call(this, this.state.returned);
|
|
93
|
+
}
|
|
94
|
+
finish() {
|
|
95
|
+
this.char = 1114112;
|
|
96
|
+
let last;
|
|
97
|
+
do
|
|
98
|
+
last = this.state.parser, this.runOne();
|
|
99
|
+
while (this.state.parser !== last);
|
|
100
|
+
return this.ctx = null, this.state = null, this._buf = null, this.obj;
|
|
101
|
+
}
|
|
102
|
+
next(fn) {
|
|
103
|
+
if (typeof fn != "function")
|
|
104
|
+
throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
|
|
105
|
+
this.state.parser = fn;
|
|
106
|
+
}
|
|
107
|
+
goto(fn) {
|
|
108
|
+
return this.next(fn), this.runOne();
|
|
109
|
+
}
|
|
110
|
+
call(fn, returnWith) {
|
|
111
|
+
returnWith && this.next(returnWith), this.stack.push(this.state), this.state = new State(fn);
|
|
112
|
+
}
|
|
113
|
+
callNow(fn, returnWith) {
|
|
114
|
+
return this.call(fn, returnWith), this.runOne();
|
|
115
|
+
}
|
|
116
|
+
return(value) {
|
|
117
|
+
if (this.stack.length === 0)
|
|
118
|
+
throw this.error(new ParserError("Stack underflow"));
|
|
119
|
+
value === void 0 && (value = this.state.buf), this.state = this.stack.pop(), this.state.returned = value;
|
|
120
|
+
}
|
|
121
|
+
returnNow(value) {
|
|
122
|
+
return this.return(value), this.runOne();
|
|
123
|
+
}
|
|
124
|
+
consume() {
|
|
125
|
+
if (this.char === 1114112)
|
|
126
|
+
throw this.error(new ParserError("Unexpected end-of-buffer"));
|
|
127
|
+
this.state.buf += this._buf[this.ii];
|
|
128
|
+
}
|
|
129
|
+
error(err) {
|
|
130
|
+
return err.line = this.line, err.col = this.col, err.pos = this.pos, err;
|
|
131
|
+
}
|
|
132
|
+
/* istanbul ignore next */
|
|
133
|
+
parseStart() {
|
|
134
|
+
throw new ParserError("Must declare a parseStart method");
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
Parser.END = 1114112;
|
|
138
|
+
Parser.Error = ParserError;
|
|
139
|
+
module2.exports = Parser;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js
|
|
144
|
+
var require_create_datetime = __commonJS({
|
|
145
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
|
|
146
|
+
"use strict";
|
|
147
|
+
init_cjs_shims();
|
|
148
|
+
module2.exports = (value) => {
|
|
149
|
+
let date = new Date(value);
|
|
150
|
+
if (isNaN(date))
|
|
151
|
+
throw new TypeError("Invalid Datetime");
|
|
152
|
+
return date;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js
|
|
158
|
+
var require_format_num = __commonJS({
|
|
159
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
|
|
160
|
+
"use strict";
|
|
161
|
+
init_cjs_shims();
|
|
162
|
+
module2.exports = (d, num) => {
|
|
163
|
+
for (num = String(num); num.length < d; )
|
|
164
|
+
num = "0" + num;
|
|
165
|
+
return num;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js
|
|
171
|
+
var require_create_datetime_float = __commonJS({
|
|
172
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
|
|
173
|
+
"use strict";
|
|
174
|
+
init_cjs_shims();
|
|
175
|
+
var f = require_format_num(), FloatingDateTime = class extends Date {
|
|
176
|
+
constructor(value) {
|
|
177
|
+
super(value + "Z"), this.isFloating = !0;
|
|
178
|
+
}
|
|
179
|
+
toISOString() {
|
|
180
|
+
let date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`, time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
181
|
+
return `${date}T${time}`;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
module2.exports = (value) => {
|
|
185
|
+
let date = new FloatingDateTime(value);
|
|
186
|
+
if (isNaN(date))
|
|
187
|
+
throw new TypeError("Invalid Datetime");
|
|
188
|
+
return date;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js
|
|
194
|
+
var require_create_date = __commonJS({
|
|
195
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
|
|
196
|
+
"use strict";
|
|
197
|
+
init_cjs_shims();
|
|
198
|
+
var f = require_format_num(), DateTime = global.Date, Date2 = class extends DateTime {
|
|
199
|
+
constructor(value) {
|
|
200
|
+
super(value), this.isDate = !0;
|
|
201
|
+
}
|
|
202
|
+
toISOString() {
|
|
203
|
+
return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
module2.exports = (value) => {
|
|
207
|
+
let date = new Date2(value);
|
|
208
|
+
if (isNaN(date))
|
|
209
|
+
throw new TypeError("Invalid Datetime");
|
|
210
|
+
return date;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js
|
|
216
|
+
var require_create_time = __commonJS({
|
|
217
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
|
|
218
|
+
"use strict";
|
|
219
|
+
init_cjs_shims();
|
|
220
|
+
var f = require_format_num(), Time = class extends Date {
|
|
221
|
+
constructor(value) {
|
|
222
|
+
super(`0000-01-01T${value}Z`), this.isTime = !0;
|
|
223
|
+
}
|
|
224
|
+
toISOString() {
|
|
225
|
+
return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
module2.exports = (value) => {
|
|
229
|
+
let date = new Time(value);
|
|
230
|
+
if (isNaN(date))
|
|
231
|
+
throw new TypeError("Invalid Datetime");
|
|
232
|
+
return date;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js
|
|
238
|
+
var require_toml_parser = __commonJS({
|
|
239
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
|
|
240
|
+
"use strict";
|
|
241
|
+
init_cjs_shims();
|
|
242
|
+
module.exports = makeParserClass(require_parser());
|
|
243
|
+
module.exports.makeParserClass = makeParserClass;
|
|
244
|
+
var TomlError = class _TomlError extends Error {
|
|
245
|
+
constructor(msg) {
|
|
246
|
+
super(msg), this.name = "TomlError", Error.captureStackTrace && Error.captureStackTrace(this, _TomlError), this.fromTOML = !0, this.wrapped = null;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
TomlError.wrap = (err) => {
|
|
250
|
+
let terr = new TomlError(err.message);
|
|
251
|
+
return terr.code = err.code, terr.wrapped = err, terr;
|
|
252
|
+
};
|
|
253
|
+
module.exports.TomlError = TomlError;
|
|
254
|
+
var createDateTime = require_create_datetime(), createDateTimeFloat = require_create_datetime_float(), createDate = require_create_date(), createTime = require_create_time(), CTRL_I = 9, CTRL_J = 10, CTRL_M = 13, CTRL_CHAR_BOUNDARY = 31, CHAR_SP = 32, CHAR_QUOT = 34, CHAR_NUM = 35, CHAR_APOS = 39, CHAR_PLUS = 43, CHAR_COMMA = 44, CHAR_HYPHEN = 45, CHAR_PERIOD = 46, CHAR_0 = 48, CHAR_1 = 49, CHAR_7 = 55, CHAR_9 = 57, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_A = 65, CHAR_E = 69, CHAR_F = 70, CHAR_T = 84, CHAR_U = 85, CHAR_Z = 90, CHAR_LOWBAR = 95, CHAR_a = 97, CHAR_b = 98, CHAR_e = 101, CHAR_f = 102, CHAR_i = 105, CHAR_l = 108, CHAR_n = 110, CHAR_o = 111, CHAR_r = 114, CHAR_s = 115, CHAR_t = 116, CHAR_u = 117, CHAR_x = 120, CHAR_z = 122, CHAR_LCUB = 123, CHAR_RCUB = 125, CHAR_LSQB = 91, CHAR_BSOL = 92, CHAR_RSQB = 93, CHAR_DEL = 127, SURROGATE_FIRST = 55296, SURROGATE_LAST = 57343, escapes = {
|
|
255
|
+
[CHAR_b]: "\b",
|
|
256
|
+
[CHAR_t]: " ",
|
|
257
|
+
[CHAR_n]: `
|
|
258
|
+
`,
|
|
259
|
+
[CHAR_f]: "\f",
|
|
260
|
+
[CHAR_r]: "\r",
|
|
261
|
+
[CHAR_QUOT]: '"',
|
|
262
|
+
[CHAR_BSOL]: "\\"
|
|
263
|
+
};
|
|
264
|
+
function isDigit(cp) {
|
|
265
|
+
return cp >= CHAR_0 && cp <= CHAR_9;
|
|
266
|
+
}
|
|
267
|
+
function isHexit(cp) {
|
|
268
|
+
return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
|
269
|
+
}
|
|
270
|
+
function isBit(cp) {
|
|
271
|
+
return cp === CHAR_1 || cp === CHAR_0;
|
|
272
|
+
}
|
|
273
|
+
function isOctit(cp) {
|
|
274
|
+
return cp >= CHAR_0 && cp <= CHAR_7;
|
|
275
|
+
}
|
|
276
|
+
function isAlphaNumQuoteHyphen(cp) {
|
|
277
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
278
|
+
}
|
|
279
|
+
function isAlphaNumHyphen(cp) {
|
|
280
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
281
|
+
}
|
|
282
|
+
var _type = Symbol("type"), _declared = Symbol("declared"), hasOwnProperty = Object.prototype.hasOwnProperty, defineProperty = Object.defineProperty, descriptor = { configurable: !0, enumerable: !0, writable: !0, value: void 0 };
|
|
283
|
+
function hasKey(obj, key) {
|
|
284
|
+
return hasOwnProperty.call(obj, key) ? !0 : (key === "__proto__" && defineProperty(obj, "__proto__", descriptor), !1);
|
|
285
|
+
}
|
|
286
|
+
var INLINE_TABLE = Symbol("inline-table");
|
|
287
|
+
function InlineTable() {
|
|
288
|
+
return Object.defineProperties({}, {
|
|
289
|
+
[_type]: { value: INLINE_TABLE }
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function isInlineTable(obj) {
|
|
293
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === INLINE_TABLE;
|
|
294
|
+
}
|
|
295
|
+
var TABLE = Symbol("table");
|
|
296
|
+
function Table() {
|
|
297
|
+
return Object.defineProperties({}, {
|
|
298
|
+
[_type]: { value: TABLE },
|
|
299
|
+
[_declared]: { value: !1, writable: !0 }
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function isTable(obj) {
|
|
303
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === TABLE;
|
|
304
|
+
}
|
|
305
|
+
var _contentType = Symbol("content-type"), INLINE_LIST = Symbol("inline-list");
|
|
306
|
+
function InlineList(type) {
|
|
307
|
+
return Object.defineProperties([], {
|
|
308
|
+
[_type]: { value: INLINE_LIST },
|
|
309
|
+
[_contentType]: { value: type }
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function isInlineList(obj) {
|
|
313
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === INLINE_LIST;
|
|
314
|
+
}
|
|
315
|
+
var LIST = Symbol("list");
|
|
316
|
+
function List() {
|
|
317
|
+
return Object.defineProperties([], {
|
|
318
|
+
[_type]: { value: LIST }
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function isList(obj) {
|
|
322
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === LIST;
|
|
323
|
+
}
|
|
324
|
+
var _custom;
|
|
325
|
+
try {
|
|
326
|
+
let utilInspect = eval("require('util').inspect");
|
|
327
|
+
_custom = utilInspect.custom;
|
|
328
|
+
} catch (_) {
|
|
329
|
+
}
|
|
330
|
+
var _inspect = _custom || "inspect", BoxedBigInt = class {
|
|
331
|
+
constructor(value) {
|
|
332
|
+
try {
|
|
333
|
+
this.value = global.BigInt.asIntN(64, value);
|
|
334
|
+
} catch {
|
|
335
|
+
this.value = null;
|
|
336
|
+
}
|
|
337
|
+
Object.defineProperty(this, _type, { value: INTEGER });
|
|
338
|
+
}
|
|
339
|
+
isNaN() {
|
|
340
|
+
return this.value === null;
|
|
341
|
+
}
|
|
342
|
+
/* istanbul ignore next */
|
|
343
|
+
toString() {
|
|
344
|
+
return String(this.value);
|
|
345
|
+
}
|
|
346
|
+
/* istanbul ignore next */
|
|
347
|
+
[_inspect]() {
|
|
348
|
+
return `[BigInt: ${this.toString()}]}`;
|
|
349
|
+
}
|
|
350
|
+
valueOf() {
|
|
351
|
+
return this.value;
|
|
352
|
+
}
|
|
353
|
+
}, INTEGER = Symbol("integer");
|
|
354
|
+
function Integer(value) {
|
|
355
|
+
let num = Number(value);
|
|
356
|
+
return Object.is(num, -0) && (num = 0), global.BigInt && !Number.isSafeInteger(num) ? new BoxedBigInt(value) : Object.defineProperties(new Number(num), {
|
|
357
|
+
isNaN: { value: function() {
|
|
358
|
+
return isNaN(this);
|
|
359
|
+
} },
|
|
360
|
+
[_type]: { value: INTEGER },
|
|
361
|
+
[_inspect]: { value: () => `[Integer: ${value}]` }
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function isInteger(obj) {
|
|
365
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === INTEGER;
|
|
366
|
+
}
|
|
367
|
+
var FLOAT = Symbol("float");
|
|
368
|
+
function Float(value) {
|
|
369
|
+
return Object.defineProperties(new Number(value), {
|
|
370
|
+
[_type]: { value: FLOAT },
|
|
371
|
+
[_inspect]: { value: () => `[Float: ${value}]` }
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function isFloat(obj) {
|
|
375
|
+
return obj === null || typeof obj != "object" ? !1 : obj[_type] === FLOAT;
|
|
376
|
+
}
|
|
377
|
+
function tomlType(value) {
|
|
378
|
+
let type = typeof value;
|
|
379
|
+
if (type === "object") {
|
|
380
|
+
if (value === null)
|
|
381
|
+
return "null";
|
|
382
|
+
if (value instanceof Date)
|
|
383
|
+
return "datetime";
|
|
384
|
+
if (_type in value)
|
|
385
|
+
switch (value[_type]) {
|
|
386
|
+
case INLINE_TABLE:
|
|
387
|
+
return "inline-table";
|
|
388
|
+
case INLINE_LIST:
|
|
389
|
+
return "inline-list";
|
|
390
|
+
case TABLE:
|
|
391
|
+
return "table";
|
|
392
|
+
case LIST:
|
|
393
|
+
return "list";
|
|
394
|
+
case FLOAT:
|
|
395
|
+
return "float";
|
|
396
|
+
case INTEGER:
|
|
397
|
+
return "integer";
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return type;
|
|
401
|
+
}
|
|
402
|
+
function makeParserClass(Parser) {
|
|
403
|
+
class TOMLParser extends Parser {
|
|
404
|
+
constructor() {
|
|
405
|
+
super(), this.ctx = this.obj = Table();
|
|
406
|
+
}
|
|
407
|
+
/* MATCH HELPER */
|
|
408
|
+
atEndOfWord() {
|
|
409
|
+
return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
|
410
|
+
}
|
|
411
|
+
atEndOfLine() {
|
|
412
|
+
return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
|
413
|
+
}
|
|
414
|
+
parseStart() {
|
|
415
|
+
if (this.char === Parser.END)
|
|
416
|
+
return null;
|
|
417
|
+
if (this.char === CHAR_LSQB)
|
|
418
|
+
return this.call(this.parseTableOrList);
|
|
419
|
+
if (this.char === CHAR_NUM)
|
|
420
|
+
return this.call(this.parseComment);
|
|
421
|
+
if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M)
|
|
422
|
+
return null;
|
|
423
|
+
if (isAlphaNumQuoteHyphen(this.char))
|
|
424
|
+
return this.callNow(this.parseAssignStatement);
|
|
425
|
+
throw this.error(new TomlError(`Unknown character "${this.char}"`));
|
|
426
|
+
}
|
|
427
|
+
// HELPER, this strips any whitespace and comments to the end of the line
|
|
428
|
+
// then RETURNS. Last state in a production.
|
|
429
|
+
parseWhitespaceToEOL() {
|
|
430
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M)
|
|
431
|
+
return null;
|
|
432
|
+
if (this.char === CHAR_NUM)
|
|
433
|
+
return this.goto(this.parseComment);
|
|
434
|
+
if (this.char === Parser.END || this.char === CTRL_J)
|
|
435
|
+
return this.return();
|
|
436
|
+
throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
|
437
|
+
}
|
|
438
|
+
/* ASSIGNMENT: key = value */
|
|
439
|
+
parseAssignStatement() {
|
|
440
|
+
return this.callNow(this.parseAssign, this.recordAssignStatement);
|
|
441
|
+
}
|
|
442
|
+
recordAssignStatement(kv) {
|
|
443
|
+
let target = this.ctx, finalKey = kv.key.pop();
|
|
444
|
+
for (let kw of kv.key) {
|
|
445
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared]))
|
|
446
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
447
|
+
target = target[kw] = target[kw] || Table();
|
|
448
|
+
}
|
|
449
|
+
if (hasKey(target, finalKey))
|
|
450
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
451
|
+
return isInteger(kv.value) || isFloat(kv.value) ? target[finalKey] = kv.value.valueOf() : target[finalKey] = kv.value, this.goto(this.parseWhitespaceToEOL);
|
|
452
|
+
}
|
|
453
|
+
/* ASSSIGNMENT expression, key = value possibly inside an inline table */
|
|
454
|
+
parseAssign() {
|
|
455
|
+
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
456
|
+
}
|
|
457
|
+
recordAssignKeyword(key) {
|
|
458
|
+
return this.state.resultTable ? this.state.resultTable.push(key) : this.state.resultTable = [key], this.goto(this.parseAssignKeywordPreDot);
|
|
459
|
+
}
|
|
460
|
+
parseAssignKeywordPreDot() {
|
|
461
|
+
if (this.char === CHAR_PERIOD)
|
|
462
|
+
return this.next(this.parseAssignKeywordPostDot);
|
|
463
|
+
if (this.char !== CHAR_SP && this.char !== CTRL_I)
|
|
464
|
+
return this.goto(this.parseAssignEqual);
|
|
465
|
+
}
|
|
466
|
+
parseAssignKeywordPostDot() {
|
|
467
|
+
if (this.char !== CHAR_SP && this.char !== CTRL_I)
|
|
468
|
+
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
469
|
+
}
|
|
470
|
+
parseAssignEqual() {
|
|
471
|
+
if (this.char === CHAR_EQUALS)
|
|
472
|
+
return this.next(this.parseAssignPreValue);
|
|
473
|
+
throw this.error(new TomlError('Invalid character, expected "="'));
|
|
474
|
+
}
|
|
475
|
+
parseAssignPreValue() {
|
|
476
|
+
return this.char === CHAR_SP || this.char === CTRL_I ? null : this.callNow(this.parseValue, this.recordAssignValue);
|
|
477
|
+
}
|
|
478
|
+
recordAssignValue(value) {
|
|
479
|
+
return this.returnNow({ key: this.state.resultTable, value });
|
|
480
|
+
}
|
|
481
|
+
/* COMMENTS: #...eol */
|
|
482
|
+
parseComment() {
|
|
483
|
+
do
|
|
484
|
+
if (this.char === Parser.END || this.char === CTRL_J)
|
|
485
|
+
return this.return();
|
|
486
|
+
while (this.nextChar());
|
|
487
|
+
}
|
|
488
|
+
/* TABLES AND LISTS, [foo] and [[foo]] */
|
|
489
|
+
parseTableOrList() {
|
|
490
|
+
if (this.char === CHAR_LSQB)
|
|
491
|
+
this.next(this.parseList);
|
|
492
|
+
else
|
|
493
|
+
return this.goto(this.parseTable);
|
|
494
|
+
}
|
|
495
|
+
/* TABLE [foo.bar.baz] */
|
|
496
|
+
parseTable() {
|
|
497
|
+
return this.ctx = this.obj, this.goto(this.parseTableNext);
|
|
498
|
+
}
|
|
499
|
+
parseTableNext() {
|
|
500
|
+
return this.char === CHAR_SP || this.char === CTRL_I ? null : this.callNow(this.parseKeyword, this.parseTableMore);
|
|
501
|
+
}
|
|
502
|
+
parseTableMore(keyword) {
|
|
503
|
+
if (this.char === CHAR_SP || this.char === CTRL_I)
|
|
504
|
+
return null;
|
|
505
|
+
if (this.char === CHAR_RSQB) {
|
|
506
|
+
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared]))
|
|
507
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
508
|
+
return this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table(), this.ctx[_declared] = !0, this.next(this.parseWhitespaceToEOL);
|
|
509
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
510
|
+
if (!hasKey(this.ctx, keyword))
|
|
511
|
+
this.ctx = this.ctx[keyword] = Table();
|
|
512
|
+
else if (isTable(this.ctx[keyword]))
|
|
513
|
+
this.ctx = this.ctx[keyword];
|
|
514
|
+
else if (isList(this.ctx[keyword]))
|
|
515
|
+
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
516
|
+
else
|
|
517
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
518
|
+
return this.next(this.parseTableNext);
|
|
519
|
+
} else
|
|
520
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
521
|
+
}
|
|
522
|
+
/* LIST [[a.b.c]] */
|
|
523
|
+
parseList() {
|
|
524
|
+
return this.ctx = this.obj, this.goto(this.parseListNext);
|
|
525
|
+
}
|
|
526
|
+
parseListNext() {
|
|
527
|
+
return this.char === CHAR_SP || this.char === CTRL_I ? null : this.callNow(this.parseKeyword, this.parseListMore);
|
|
528
|
+
}
|
|
529
|
+
parseListMore(keyword) {
|
|
530
|
+
if (this.char === CHAR_SP || this.char === CTRL_I)
|
|
531
|
+
return null;
|
|
532
|
+
if (this.char === CHAR_RSQB) {
|
|
533
|
+
if (hasKey(this.ctx, keyword) || (this.ctx[keyword] = List()), isInlineList(this.ctx[keyword]))
|
|
534
|
+
throw this.error(new TomlError("Can't extend an inline array"));
|
|
535
|
+
if (isList(this.ctx[keyword])) {
|
|
536
|
+
let next = Table();
|
|
537
|
+
this.ctx[keyword].push(next), this.ctx = next;
|
|
538
|
+
} else
|
|
539
|
+
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
540
|
+
return this.next(this.parseListEnd);
|
|
541
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
542
|
+
if (!hasKey(this.ctx, keyword))
|
|
543
|
+
this.ctx = this.ctx[keyword] = Table();
|
|
544
|
+
else {
|
|
545
|
+
if (isInlineList(this.ctx[keyword]))
|
|
546
|
+
throw this.error(new TomlError("Can't extend an inline array"));
|
|
547
|
+
if (isInlineTable(this.ctx[keyword]))
|
|
548
|
+
throw this.error(new TomlError("Can't extend an inline table"));
|
|
549
|
+
if (isList(this.ctx[keyword]))
|
|
550
|
+
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
551
|
+
else if (isTable(this.ctx[keyword]))
|
|
552
|
+
this.ctx = this.ctx[keyword];
|
|
553
|
+
else
|
|
554
|
+
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
555
|
+
}
|
|
556
|
+
return this.next(this.parseListNext);
|
|
557
|
+
} else
|
|
558
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
559
|
+
}
|
|
560
|
+
parseListEnd(keyword) {
|
|
561
|
+
if (this.char === CHAR_RSQB)
|
|
562
|
+
return this.next(this.parseWhitespaceToEOL);
|
|
563
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
564
|
+
}
|
|
565
|
+
/* VALUE string, number, boolean, inline list, inline object */
|
|
566
|
+
parseValue() {
|
|
567
|
+
if (this.char === Parser.END)
|
|
568
|
+
throw this.error(new TomlError("Key without value"));
|
|
569
|
+
if (this.char === CHAR_QUOT)
|
|
570
|
+
return this.next(this.parseDoubleString);
|
|
571
|
+
if (this.char === CHAR_APOS)
|
|
572
|
+
return this.next(this.parseSingleString);
|
|
573
|
+
if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS)
|
|
574
|
+
return this.goto(this.parseNumberSign);
|
|
575
|
+
if (this.char === CHAR_i)
|
|
576
|
+
return this.next(this.parseInf);
|
|
577
|
+
if (this.char === CHAR_n)
|
|
578
|
+
return this.next(this.parseNan);
|
|
579
|
+
if (isDigit(this.char))
|
|
580
|
+
return this.goto(this.parseNumberOrDateTime);
|
|
581
|
+
if (this.char === CHAR_t || this.char === CHAR_f)
|
|
582
|
+
return this.goto(this.parseBoolean);
|
|
583
|
+
if (this.char === CHAR_LSQB)
|
|
584
|
+
return this.call(this.parseInlineList, this.recordValue);
|
|
585
|
+
if (this.char === CHAR_LCUB)
|
|
586
|
+
return this.call(this.parseInlineTable, this.recordValue);
|
|
587
|
+
throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
|
588
|
+
}
|
|
589
|
+
recordValue(value) {
|
|
590
|
+
return this.returnNow(value);
|
|
591
|
+
}
|
|
592
|
+
parseInf() {
|
|
593
|
+
if (this.char === CHAR_n)
|
|
594
|
+
return this.next(this.parseInf2);
|
|
595
|
+
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
596
|
+
}
|
|
597
|
+
parseInf2() {
|
|
598
|
+
if (this.char === CHAR_f)
|
|
599
|
+
return this.state.buf === "-" ? this.return(-1 / 0) : this.return(1 / 0);
|
|
600
|
+
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
601
|
+
}
|
|
602
|
+
parseNan() {
|
|
603
|
+
if (this.char === CHAR_a)
|
|
604
|
+
return this.next(this.parseNan2);
|
|
605
|
+
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
606
|
+
}
|
|
607
|
+
parseNan2() {
|
|
608
|
+
if (this.char === CHAR_n)
|
|
609
|
+
return this.return(NaN);
|
|
610
|
+
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
611
|
+
}
|
|
612
|
+
/* KEYS, barewords or basic, literal, or dotted */
|
|
613
|
+
parseKeyword() {
|
|
614
|
+
return this.char === CHAR_QUOT ? this.next(this.parseBasicString) : this.char === CHAR_APOS ? this.next(this.parseLiteralString) : this.goto(this.parseBareKey);
|
|
615
|
+
}
|
|
616
|
+
/* KEYS: barewords */
|
|
617
|
+
parseBareKey() {
|
|
618
|
+
do {
|
|
619
|
+
if (this.char === Parser.END)
|
|
620
|
+
throw this.error(new TomlError("Key ended without value"));
|
|
621
|
+
if (isAlphaNumHyphen(this.char))
|
|
622
|
+
this.consume();
|
|
623
|
+
else {
|
|
624
|
+
if (this.state.buf.length === 0)
|
|
625
|
+
throw this.error(new TomlError("Empty bare keys are not allowed"));
|
|
626
|
+
return this.returnNow();
|
|
627
|
+
}
|
|
628
|
+
} while (this.nextChar());
|
|
629
|
+
}
|
|
630
|
+
/* STRINGS, single quoted (literal) */
|
|
631
|
+
parseSingleString() {
|
|
632
|
+
return this.char === CHAR_APOS ? this.next(this.parseLiteralMultiStringMaybe) : this.goto(this.parseLiteralString);
|
|
633
|
+
}
|
|
634
|
+
parseLiteralString() {
|
|
635
|
+
do {
|
|
636
|
+
if (this.char === CHAR_APOS)
|
|
637
|
+
return this.return();
|
|
638
|
+
if (this.atEndOfLine())
|
|
639
|
+
throw this.error(new TomlError("Unterminated string"));
|
|
640
|
+
if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)
|
|
641
|
+
throw this.errorControlCharInString();
|
|
642
|
+
this.consume();
|
|
643
|
+
} while (this.nextChar());
|
|
644
|
+
}
|
|
645
|
+
parseLiteralMultiStringMaybe() {
|
|
646
|
+
return this.char === CHAR_APOS ? this.next(this.parseLiteralMultiString) : this.returnNow();
|
|
647
|
+
}
|
|
648
|
+
parseLiteralMultiString() {
|
|
649
|
+
return this.char === CTRL_M ? null : this.char === CTRL_J ? this.next(this.parseLiteralMultiStringContent) : this.goto(this.parseLiteralMultiStringContent);
|
|
650
|
+
}
|
|
651
|
+
parseLiteralMultiStringContent() {
|
|
652
|
+
do {
|
|
653
|
+
if (this.char === CHAR_APOS)
|
|
654
|
+
return this.next(this.parseLiteralMultiEnd);
|
|
655
|
+
if (this.char === Parser.END)
|
|
656
|
+
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
657
|
+
if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)
|
|
658
|
+
throw this.errorControlCharInString();
|
|
659
|
+
this.consume();
|
|
660
|
+
} while (this.nextChar());
|
|
661
|
+
}
|
|
662
|
+
parseLiteralMultiEnd() {
|
|
663
|
+
return this.char === CHAR_APOS ? this.next(this.parseLiteralMultiEnd2) : (this.state.buf += "'", this.goto(this.parseLiteralMultiStringContent));
|
|
664
|
+
}
|
|
665
|
+
parseLiteralMultiEnd2() {
|
|
666
|
+
return this.char === CHAR_APOS ? this.return() : (this.state.buf += "''", this.goto(this.parseLiteralMultiStringContent));
|
|
667
|
+
}
|
|
668
|
+
/* STRINGS double quoted */
|
|
669
|
+
parseDoubleString() {
|
|
670
|
+
return this.char === CHAR_QUOT ? this.next(this.parseMultiStringMaybe) : this.goto(this.parseBasicString);
|
|
671
|
+
}
|
|
672
|
+
parseBasicString() {
|
|
673
|
+
do {
|
|
674
|
+
if (this.char === CHAR_BSOL)
|
|
675
|
+
return this.call(this.parseEscape, this.recordEscapeReplacement);
|
|
676
|
+
if (this.char === CHAR_QUOT)
|
|
677
|
+
return this.return();
|
|
678
|
+
if (this.atEndOfLine())
|
|
679
|
+
throw this.error(new TomlError("Unterminated string"));
|
|
680
|
+
if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)
|
|
681
|
+
throw this.errorControlCharInString();
|
|
682
|
+
this.consume();
|
|
683
|
+
} while (this.nextChar());
|
|
684
|
+
}
|
|
685
|
+
recordEscapeReplacement(replacement) {
|
|
686
|
+
return this.state.buf += replacement, this.goto(this.parseBasicString);
|
|
687
|
+
}
|
|
688
|
+
parseMultiStringMaybe() {
|
|
689
|
+
return this.char === CHAR_QUOT ? this.next(this.parseMultiString) : this.returnNow();
|
|
690
|
+
}
|
|
691
|
+
parseMultiString() {
|
|
692
|
+
return this.char === CTRL_M ? null : this.char === CTRL_J ? this.next(this.parseMultiStringContent) : this.goto(this.parseMultiStringContent);
|
|
693
|
+
}
|
|
694
|
+
parseMultiStringContent() {
|
|
695
|
+
do {
|
|
696
|
+
if (this.char === CHAR_BSOL)
|
|
697
|
+
return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
|
698
|
+
if (this.char === CHAR_QUOT)
|
|
699
|
+
return this.next(this.parseMultiEnd);
|
|
700
|
+
if (this.char === Parser.END)
|
|
701
|
+
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
702
|
+
if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)
|
|
703
|
+
throw this.errorControlCharInString();
|
|
704
|
+
this.consume();
|
|
705
|
+
} while (this.nextChar());
|
|
706
|
+
}
|
|
707
|
+
errorControlCharInString() {
|
|
708
|
+
let displayCode = "\\u00";
|
|
709
|
+
return this.char < 16 && (displayCode += "0"), displayCode += this.char.toString(16), this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
|
|
710
|
+
}
|
|
711
|
+
recordMultiEscapeReplacement(replacement) {
|
|
712
|
+
return this.state.buf += replacement, this.goto(this.parseMultiStringContent);
|
|
713
|
+
}
|
|
714
|
+
parseMultiEnd() {
|
|
715
|
+
return this.char === CHAR_QUOT ? this.next(this.parseMultiEnd2) : (this.state.buf += '"', this.goto(this.parseMultiStringContent));
|
|
716
|
+
}
|
|
717
|
+
parseMultiEnd2() {
|
|
718
|
+
return this.char === CHAR_QUOT ? this.return() : (this.state.buf += '""', this.goto(this.parseMultiStringContent));
|
|
719
|
+
}
|
|
720
|
+
parseMultiEscape() {
|
|
721
|
+
return this.char === CTRL_M || this.char === CTRL_J ? this.next(this.parseMultiTrim) : this.char === CHAR_SP || this.char === CTRL_I ? this.next(this.parsePreMultiTrim) : this.goto(this.parseEscape);
|
|
722
|
+
}
|
|
723
|
+
parsePreMultiTrim() {
|
|
724
|
+
if (this.char === CHAR_SP || this.char === CTRL_I)
|
|
725
|
+
return null;
|
|
726
|
+
if (this.char === CTRL_M || this.char === CTRL_J)
|
|
727
|
+
return this.next(this.parseMultiTrim);
|
|
728
|
+
throw this.error(new TomlError("Can't escape whitespace"));
|
|
729
|
+
}
|
|
730
|
+
parseMultiTrim() {
|
|
731
|
+
return this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M ? null : this.returnNow();
|
|
732
|
+
}
|
|
733
|
+
parseEscape() {
|
|
734
|
+
if (this.char in escapes)
|
|
735
|
+
return this.return(escapes[this.char]);
|
|
736
|
+
if (this.char === CHAR_u)
|
|
737
|
+
return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
|
|
738
|
+
if (this.char === CHAR_U)
|
|
739
|
+
return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
|
740
|
+
throw this.error(new TomlError("Unknown escape character: " + this.char));
|
|
741
|
+
}
|
|
742
|
+
parseUnicodeReturn(char) {
|
|
743
|
+
try {
|
|
744
|
+
let codePoint = parseInt(char, 16);
|
|
745
|
+
if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST)
|
|
746
|
+
throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
|
747
|
+
return this.returnNow(String.fromCodePoint(codePoint));
|
|
748
|
+
} catch (err) {
|
|
749
|
+
throw this.error(TomlError.wrap(err));
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
parseSmallUnicode() {
|
|
753
|
+
if (isHexit(this.char)) {
|
|
754
|
+
if (this.consume(), this.state.buf.length >= 4)
|
|
755
|
+
return this.return();
|
|
756
|
+
} else
|
|
757
|
+
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
758
|
+
}
|
|
759
|
+
parseLargeUnicode() {
|
|
760
|
+
if (isHexit(this.char)) {
|
|
761
|
+
if (this.consume(), this.state.buf.length >= 8)
|
|
762
|
+
return this.return();
|
|
763
|
+
} else
|
|
764
|
+
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
765
|
+
}
|
|
766
|
+
/* NUMBERS */
|
|
767
|
+
parseNumberSign() {
|
|
768
|
+
return this.consume(), this.next(this.parseMaybeSignedInfOrNan);
|
|
769
|
+
}
|
|
770
|
+
parseMaybeSignedInfOrNan() {
|
|
771
|
+
return this.char === CHAR_i ? this.next(this.parseInf) : this.char === CHAR_n ? this.next(this.parseNan) : this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
|
772
|
+
}
|
|
773
|
+
parseNumberIntegerStart() {
|
|
774
|
+
return this.char === CHAR_0 ? (this.consume(), this.next(this.parseNumberIntegerExponentOrDecimal)) : this.goto(this.parseNumberInteger);
|
|
775
|
+
}
|
|
776
|
+
parseNumberIntegerExponentOrDecimal() {
|
|
777
|
+
return this.char === CHAR_PERIOD ? (this.consume(), this.call(this.parseNoUnder, this.parseNumberFloat)) : this.char === CHAR_E || this.char === CHAR_e ? (this.consume(), this.next(this.parseNumberExponentSign)) : this.returnNow(Integer(this.state.buf));
|
|
778
|
+
}
|
|
779
|
+
parseNumberInteger() {
|
|
780
|
+
if (isDigit(this.char))
|
|
781
|
+
this.consume();
|
|
782
|
+
else {
|
|
783
|
+
if (this.char === CHAR_LOWBAR)
|
|
784
|
+
return this.call(this.parseNoUnder);
|
|
785
|
+
if (this.char === CHAR_E || this.char === CHAR_e)
|
|
786
|
+
return this.consume(), this.next(this.parseNumberExponentSign);
|
|
787
|
+
if (this.char === CHAR_PERIOD)
|
|
788
|
+
return this.consume(), this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
789
|
+
{
|
|
790
|
+
let result = Integer(this.state.buf);
|
|
791
|
+
if (result.isNaN())
|
|
792
|
+
throw this.error(new TomlError("Invalid number"));
|
|
793
|
+
return this.returnNow(result);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
parseNoUnder() {
|
|
798
|
+
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e)
|
|
799
|
+
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
800
|
+
if (this.atEndOfWord())
|
|
801
|
+
throw this.error(new TomlError("Incomplete number"));
|
|
802
|
+
return this.returnNow();
|
|
803
|
+
}
|
|
804
|
+
parseNoUnderHexOctBinLiteral() {
|
|
805
|
+
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD)
|
|
806
|
+
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
807
|
+
if (this.atEndOfWord())
|
|
808
|
+
throw this.error(new TomlError("Incomplete number"));
|
|
809
|
+
return this.returnNow();
|
|
810
|
+
}
|
|
811
|
+
parseNumberFloat() {
|
|
812
|
+
if (this.char === CHAR_LOWBAR)
|
|
813
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
814
|
+
if (isDigit(this.char))
|
|
815
|
+
this.consume();
|
|
816
|
+
else
|
|
817
|
+
return this.char === CHAR_E || this.char === CHAR_e ? (this.consume(), this.next(this.parseNumberExponentSign)) : this.returnNow(Float(this.state.buf));
|
|
818
|
+
}
|
|
819
|
+
parseNumberExponentSign() {
|
|
820
|
+
if (isDigit(this.char))
|
|
821
|
+
return this.goto(this.parseNumberExponent);
|
|
822
|
+
if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS)
|
|
823
|
+
this.consume(), this.call(this.parseNoUnder, this.parseNumberExponent);
|
|
824
|
+
else
|
|
825
|
+
throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
|
|
826
|
+
}
|
|
827
|
+
parseNumberExponent() {
|
|
828
|
+
if (isDigit(this.char))
|
|
829
|
+
this.consume();
|
|
830
|
+
else
|
|
831
|
+
return this.char === CHAR_LOWBAR ? this.call(this.parseNoUnder) : this.returnNow(Float(this.state.buf));
|
|
832
|
+
}
|
|
833
|
+
/* NUMBERS or DATETIMES */
|
|
834
|
+
parseNumberOrDateTime() {
|
|
835
|
+
return this.char === CHAR_0 ? (this.consume(), this.next(this.parseNumberBaseOrDateTime)) : this.goto(this.parseNumberOrDateTimeOnly);
|
|
836
|
+
}
|
|
837
|
+
parseNumberOrDateTimeOnly() {
|
|
838
|
+
if (this.char === CHAR_LOWBAR)
|
|
839
|
+
return this.call(this.parseNoUnder, this.parseNumberInteger);
|
|
840
|
+
if (isDigit(this.char))
|
|
841
|
+
this.consume(), this.state.buf.length > 4 && this.next(this.parseNumberInteger);
|
|
842
|
+
else
|
|
843
|
+
return this.char === CHAR_E || this.char === CHAR_e ? (this.consume(), this.next(this.parseNumberExponentSign)) : this.char === CHAR_PERIOD ? (this.consume(), this.call(this.parseNoUnder, this.parseNumberFloat)) : this.char === CHAR_HYPHEN ? this.goto(this.parseDateTime) : this.char === CHAR_COLON ? this.goto(this.parseOnlyTimeHour) : this.returnNow(Integer(this.state.buf));
|
|
844
|
+
}
|
|
845
|
+
parseDateTimeOnly() {
|
|
846
|
+
if (this.state.buf.length < 4) {
|
|
847
|
+
if (isDigit(this.char))
|
|
848
|
+
return this.consume();
|
|
849
|
+
if (this.char === CHAR_COLON)
|
|
850
|
+
return this.goto(this.parseOnlyTimeHour);
|
|
851
|
+
throw this.error(new TomlError("Expected digit while parsing year part of a date"));
|
|
852
|
+
} else {
|
|
853
|
+
if (this.char === CHAR_HYPHEN)
|
|
854
|
+
return this.goto(this.parseDateTime);
|
|
855
|
+
throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
parseNumberBaseOrDateTime() {
|
|
859
|
+
return this.char === CHAR_b ? (this.consume(), this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin)) : this.char === CHAR_o ? (this.consume(), this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct)) : this.char === CHAR_x ? (this.consume(), this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex)) : this.char === CHAR_PERIOD ? this.goto(this.parseNumberInteger) : isDigit(this.char) ? this.goto(this.parseDateTimeOnly) : this.returnNow(Integer(this.state.buf));
|
|
860
|
+
}
|
|
861
|
+
parseIntegerHex() {
|
|
862
|
+
if (isHexit(this.char))
|
|
863
|
+
this.consume();
|
|
864
|
+
else {
|
|
865
|
+
if (this.char === CHAR_LOWBAR)
|
|
866
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
867
|
+
{
|
|
868
|
+
let result = Integer(this.state.buf);
|
|
869
|
+
if (result.isNaN())
|
|
870
|
+
throw this.error(new TomlError("Invalid number"));
|
|
871
|
+
return this.returnNow(result);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
parseIntegerOct() {
|
|
876
|
+
if (isOctit(this.char))
|
|
877
|
+
this.consume();
|
|
878
|
+
else {
|
|
879
|
+
if (this.char === CHAR_LOWBAR)
|
|
880
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
881
|
+
{
|
|
882
|
+
let result = Integer(this.state.buf);
|
|
883
|
+
if (result.isNaN())
|
|
884
|
+
throw this.error(new TomlError("Invalid number"));
|
|
885
|
+
return this.returnNow(result);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
parseIntegerBin() {
|
|
890
|
+
if (isBit(this.char))
|
|
891
|
+
this.consume();
|
|
892
|
+
else {
|
|
893
|
+
if (this.char === CHAR_LOWBAR)
|
|
894
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
895
|
+
{
|
|
896
|
+
let result = Integer(this.state.buf);
|
|
897
|
+
if (result.isNaN())
|
|
898
|
+
throw this.error(new TomlError("Invalid number"));
|
|
899
|
+
return this.returnNow(result);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/* DATETIME */
|
|
904
|
+
parseDateTime() {
|
|
905
|
+
if (this.state.buf.length < 4)
|
|
906
|
+
throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
|
|
907
|
+
return this.state.result = this.state.buf, this.state.buf = "", this.next(this.parseDateMonth);
|
|
908
|
+
}
|
|
909
|
+
parseDateMonth() {
|
|
910
|
+
if (this.char === CHAR_HYPHEN) {
|
|
911
|
+
if (this.state.buf.length < 2)
|
|
912
|
+
throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
|
|
913
|
+
return this.state.result += "-" + this.state.buf, this.state.buf = "", this.next(this.parseDateDay);
|
|
914
|
+
} else if (isDigit(this.char))
|
|
915
|
+
this.consume();
|
|
916
|
+
else
|
|
917
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
918
|
+
}
|
|
919
|
+
parseDateDay() {
|
|
920
|
+
if (this.char === CHAR_T || this.char === CHAR_SP) {
|
|
921
|
+
if (this.state.buf.length < 2)
|
|
922
|
+
throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
|
|
923
|
+
return this.state.result += "-" + this.state.buf, this.state.buf = "", this.next(this.parseStartTimeHour);
|
|
924
|
+
} else {
|
|
925
|
+
if (this.atEndOfWord())
|
|
926
|
+
return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
|
|
927
|
+
if (isDigit(this.char))
|
|
928
|
+
this.consume();
|
|
929
|
+
else
|
|
930
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
parseStartTimeHour() {
|
|
934
|
+
return this.atEndOfWord() ? this.returnNow(createDate(this.state.result)) : this.goto(this.parseTimeHour);
|
|
935
|
+
}
|
|
936
|
+
parseTimeHour() {
|
|
937
|
+
if (this.char === CHAR_COLON) {
|
|
938
|
+
if (this.state.buf.length < 2)
|
|
939
|
+
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
940
|
+
return this.state.result += "T" + this.state.buf, this.state.buf = "", this.next(this.parseTimeMin);
|
|
941
|
+
} else if (isDigit(this.char))
|
|
942
|
+
this.consume();
|
|
943
|
+
else
|
|
944
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
945
|
+
}
|
|
946
|
+
parseTimeMin() {
|
|
947
|
+
if (this.state.buf.length < 2 && isDigit(this.char))
|
|
948
|
+
this.consume();
|
|
949
|
+
else {
|
|
950
|
+
if (this.state.buf.length === 2 && this.char === CHAR_COLON)
|
|
951
|
+
return this.state.result += ":" + this.state.buf, this.state.buf = "", this.next(this.parseTimeSec);
|
|
952
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
parseTimeSec() {
|
|
956
|
+
if (isDigit(this.char)) {
|
|
957
|
+
if (this.consume(), this.state.buf.length === 2)
|
|
958
|
+
return this.state.result += ":" + this.state.buf, this.state.buf = "", this.next(this.parseTimeZoneOrFraction);
|
|
959
|
+
} else
|
|
960
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
961
|
+
}
|
|
962
|
+
parseOnlyTimeHour() {
|
|
963
|
+
if (this.char === CHAR_COLON) {
|
|
964
|
+
if (this.state.buf.length < 2)
|
|
965
|
+
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
966
|
+
return this.state.result = this.state.buf, this.state.buf = "", this.next(this.parseOnlyTimeMin);
|
|
967
|
+
} else
|
|
968
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
969
|
+
}
|
|
970
|
+
parseOnlyTimeMin() {
|
|
971
|
+
if (this.state.buf.length < 2 && isDigit(this.char))
|
|
972
|
+
this.consume();
|
|
973
|
+
else {
|
|
974
|
+
if (this.state.buf.length === 2 && this.char === CHAR_COLON)
|
|
975
|
+
return this.state.result += ":" + this.state.buf, this.state.buf = "", this.next(this.parseOnlyTimeSec);
|
|
976
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
parseOnlyTimeSec() {
|
|
980
|
+
if (isDigit(this.char)) {
|
|
981
|
+
if (this.consume(), this.state.buf.length === 2)
|
|
982
|
+
return this.next(this.parseOnlyTimeFractionMaybe);
|
|
983
|
+
} else
|
|
984
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
985
|
+
}
|
|
986
|
+
parseOnlyTimeFractionMaybe() {
|
|
987
|
+
if (this.state.result += ":" + this.state.buf, this.char === CHAR_PERIOD)
|
|
988
|
+
this.state.buf = "", this.next(this.parseOnlyTimeFraction);
|
|
989
|
+
else
|
|
990
|
+
return this.return(createTime(this.state.result));
|
|
991
|
+
}
|
|
992
|
+
parseOnlyTimeFraction() {
|
|
993
|
+
if (isDigit(this.char))
|
|
994
|
+
this.consume();
|
|
995
|
+
else if (this.atEndOfWord()) {
|
|
996
|
+
if (this.state.buf.length === 0)
|
|
997
|
+
throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
998
|
+
return this.returnNow(createTime(this.state.result + "." + this.state.buf));
|
|
999
|
+
} else
|
|
1000
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1001
|
+
}
|
|
1002
|
+
parseTimeZoneOrFraction() {
|
|
1003
|
+
if (this.char === CHAR_PERIOD)
|
|
1004
|
+
this.consume(), this.next(this.parseDateTimeFraction);
|
|
1005
|
+
else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS)
|
|
1006
|
+
this.consume(), this.next(this.parseTimeZoneHour);
|
|
1007
|
+
else {
|
|
1008
|
+
if (this.char === CHAR_Z)
|
|
1009
|
+
return this.consume(), this.return(createDateTime(this.state.result + this.state.buf));
|
|
1010
|
+
if (this.atEndOfWord())
|
|
1011
|
+
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
1012
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
parseDateTimeFraction() {
|
|
1016
|
+
if (isDigit(this.char))
|
|
1017
|
+
this.consume();
|
|
1018
|
+
else {
|
|
1019
|
+
if (this.state.buf.length === 1)
|
|
1020
|
+
throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
1021
|
+
if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS)
|
|
1022
|
+
this.consume(), this.next(this.parseTimeZoneHour);
|
|
1023
|
+
else {
|
|
1024
|
+
if (this.char === CHAR_Z)
|
|
1025
|
+
return this.consume(), this.return(createDateTime(this.state.result + this.state.buf));
|
|
1026
|
+
if (this.atEndOfWord())
|
|
1027
|
+
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
1028
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
parseTimeZoneHour() {
|
|
1033
|
+
if (isDigit(this.char)) {
|
|
1034
|
+
if (this.consume(), /\d\d$/.test(this.state.buf))
|
|
1035
|
+
return this.next(this.parseTimeZoneSep);
|
|
1036
|
+
} else
|
|
1037
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
1038
|
+
}
|
|
1039
|
+
parseTimeZoneSep() {
|
|
1040
|
+
if (this.char === CHAR_COLON)
|
|
1041
|
+
this.consume(), this.next(this.parseTimeZoneMin);
|
|
1042
|
+
else
|
|
1043
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
|
|
1044
|
+
}
|
|
1045
|
+
parseTimeZoneMin() {
|
|
1046
|
+
if (isDigit(this.char)) {
|
|
1047
|
+
if (this.consume(), /\d\d$/.test(this.state.buf))
|
|
1048
|
+
return this.return(createDateTime(this.state.result + this.state.buf));
|
|
1049
|
+
} else
|
|
1050
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
1051
|
+
}
|
|
1052
|
+
/* BOOLEAN */
|
|
1053
|
+
parseBoolean() {
|
|
1054
|
+
if (this.char === CHAR_t)
|
|
1055
|
+
return this.consume(), this.next(this.parseTrue_r);
|
|
1056
|
+
if (this.char === CHAR_f)
|
|
1057
|
+
return this.consume(), this.next(this.parseFalse_a);
|
|
1058
|
+
}
|
|
1059
|
+
parseTrue_r() {
|
|
1060
|
+
if (this.char === CHAR_r)
|
|
1061
|
+
return this.consume(), this.next(this.parseTrue_u);
|
|
1062
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1063
|
+
}
|
|
1064
|
+
parseTrue_u() {
|
|
1065
|
+
if (this.char === CHAR_u)
|
|
1066
|
+
return this.consume(), this.next(this.parseTrue_e);
|
|
1067
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1068
|
+
}
|
|
1069
|
+
parseTrue_e() {
|
|
1070
|
+
if (this.char === CHAR_e)
|
|
1071
|
+
return this.return(!0);
|
|
1072
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1073
|
+
}
|
|
1074
|
+
parseFalse_a() {
|
|
1075
|
+
if (this.char === CHAR_a)
|
|
1076
|
+
return this.consume(), this.next(this.parseFalse_l);
|
|
1077
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1078
|
+
}
|
|
1079
|
+
parseFalse_l() {
|
|
1080
|
+
if (this.char === CHAR_l)
|
|
1081
|
+
return this.consume(), this.next(this.parseFalse_s);
|
|
1082
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1083
|
+
}
|
|
1084
|
+
parseFalse_s() {
|
|
1085
|
+
if (this.char === CHAR_s)
|
|
1086
|
+
return this.consume(), this.next(this.parseFalse_e);
|
|
1087
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1088
|
+
}
|
|
1089
|
+
parseFalse_e() {
|
|
1090
|
+
if (this.char === CHAR_e)
|
|
1091
|
+
return this.return(!1);
|
|
1092
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
1093
|
+
}
|
|
1094
|
+
/* INLINE LISTS */
|
|
1095
|
+
parseInlineList() {
|
|
1096
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J)
|
|
1097
|
+
return null;
|
|
1098
|
+
if (this.char === Parser.END)
|
|
1099
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
1100
|
+
return this.char === CHAR_NUM ? this.call(this.parseComment) : this.char === CHAR_RSQB ? this.return(this.state.resultArr || InlineList()) : this.callNow(this.parseValue, this.recordInlineListValue);
|
|
1101
|
+
}
|
|
1102
|
+
recordInlineListValue(value) {
|
|
1103
|
+
if (this.state.resultArr) {
|
|
1104
|
+
let listType = this.state.resultArr[_contentType], valueType = tomlType(value);
|
|
1105
|
+
if (listType !== valueType)
|
|
1106
|
+
throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
|
|
1107
|
+
} else
|
|
1108
|
+
this.state.resultArr = InlineList(tomlType(value));
|
|
1109
|
+
return isFloat(value) || isInteger(value) ? this.state.resultArr.push(value.valueOf()) : this.state.resultArr.push(value), this.goto(this.parseInlineListNext);
|
|
1110
|
+
}
|
|
1111
|
+
parseInlineListNext() {
|
|
1112
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J)
|
|
1113
|
+
return null;
|
|
1114
|
+
if (this.char === CHAR_NUM)
|
|
1115
|
+
return this.call(this.parseComment);
|
|
1116
|
+
if (this.char === CHAR_COMMA)
|
|
1117
|
+
return this.next(this.parseInlineList);
|
|
1118
|
+
if (this.char === CHAR_RSQB)
|
|
1119
|
+
return this.goto(this.parseInlineList);
|
|
1120
|
+
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
1121
|
+
}
|
|
1122
|
+
/* INLINE TABLE */
|
|
1123
|
+
parseInlineTable() {
|
|
1124
|
+
if (this.char === CHAR_SP || this.char === CTRL_I)
|
|
1125
|
+
return null;
|
|
1126
|
+
if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M)
|
|
1127
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
1128
|
+
return this.char === CHAR_RCUB ? this.return(this.state.resultTable || InlineTable()) : (this.state.resultTable || (this.state.resultTable = InlineTable()), this.callNow(this.parseAssign, this.recordInlineTableValue));
|
|
1129
|
+
}
|
|
1130
|
+
recordInlineTableValue(kv) {
|
|
1131
|
+
let target = this.state.resultTable, finalKey = kv.key.pop();
|
|
1132
|
+
for (let kw of kv.key) {
|
|
1133
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared]))
|
|
1134
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
1135
|
+
target = target[kw] = target[kw] || Table();
|
|
1136
|
+
}
|
|
1137
|
+
if (hasKey(target, finalKey))
|
|
1138
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
1139
|
+
return isInteger(kv.value) || isFloat(kv.value) ? target[finalKey] = kv.value.valueOf() : target[finalKey] = kv.value, this.goto(this.parseInlineTableNext);
|
|
1140
|
+
}
|
|
1141
|
+
parseInlineTableNext() {
|
|
1142
|
+
if (this.char === CHAR_SP || this.char === CTRL_I)
|
|
1143
|
+
return null;
|
|
1144
|
+
if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M)
|
|
1145
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
1146
|
+
if (this.char === CHAR_COMMA)
|
|
1147
|
+
return this.next(this.parseInlineTable);
|
|
1148
|
+
if (this.char === CHAR_RCUB)
|
|
1149
|
+
return this.goto(this.parseInlineTable);
|
|
1150
|
+
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return TOMLParser;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js
|
|
1159
|
+
var require_parse_pretty_error = __commonJS({
|
|
1160
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
|
|
1161
|
+
"use strict";
|
|
1162
|
+
init_cjs_shims();
|
|
1163
|
+
module2.exports = prettyError;
|
|
1164
|
+
function prettyError(err, buf) {
|
|
1165
|
+
if (err.pos == null || err.line == null)
|
|
1166
|
+
return err;
|
|
1167
|
+
let msg = err.message;
|
|
1168
|
+
if (msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
|
|
1169
|
+
`, buf && buf.split) {
|
|
1170
|
+
let lines = buf.split(/\n/), lineNumWidth = String(Math.min(lines.length, err.line + 3)).length, linePadding = " ";
|
|
1171
|
+
for (; linePadding.length < lineNumWidth; )
|
|
1172
|
+
linePadding += " ";
|
|
1173
|
+
for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
|
|
1174
|
+
let lineNum = String(ii + 1);
|
|
1175
|
+
if (lineNum.length < lineNumWidth && (lineNum = " " + lineNum), err.line === ii) {
|
|
1176
|
+
msg += lineNum + "> " + lines[ii] + `
|
|
1177
|
+
`, msg += linePadding + " ";
|
|
1178
|
+
for (let hh = 0; hh < err.col; ++hh)
|
|
1179
|
+
msg += " ";
|
|
1180
|
+
msg += `^
|
|
1181
|
+
`;
|
|
1182
|
+
} else
|
|
1183
|
+
msg += lineNum + ": " + lines[ii] + `
|
|
1184
|
+
`;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
return err.message = msg + `
|
|
1188
|
+
`, err;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js
|
|
1194
|
+
var require_parse_string = __commonJS({
|
|
1195
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
|
|
1196
|
+
"use strict";
|
|
1197
|
+
init_cjs_shims();
|
|
1198
|
+
module2.exports = parseString;
|
|
1199
|
+
var TOMLParser = require_toml_parser(), prettyError = require_parse_pretty_error();
|
|
1200
|
+
function parseString(str) {
|
|
1201
|
+
global.Buffer && global.Buffer.isBuffer(str) && (str = str.toString("utf8"));
|
|
1202
|
+
let parser = new TOMLParser();
|
|
1203
|
+
try {
|
|
1204
|
+
return parser.parse(str), parser.finish();
|
|
1205
|
+
} catch (err) {
|
|
1206
|
+
throw prettyError(err, str);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js
|
|
1213
|
+
var require_parse_async = __commonJS({
|
|
1214
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
|
|
1215
|
+
"use strict";
|
|
1216
|
+
init_cjs_shims();
|
|
1217
|
+
module2.exports = parseAsync;
|
|
1218
|
+
var TOMLParser = require_toml_parser(), prettyError = require_parse_pretty_error();
|
|
1219
|
+
function parseAsync(str, opts) {
|
|
1220
|
+
opts || (opts = {});
|
|
1221
|
+
let index = 0, blocksize = opts.blocksize || 40960, parser = new TOMLParser();
|
|
1222
|
+
return new Promise((resolve, reject) => {
|
|
1223
|
+
setImmediate(parseAsyncNext, index, blocksize, resolve, reject);
|
|
1224
|
+
});
|
|
1225
|
+
function parseAsyncNext(index2, blocksize2, resolve, reject) {
|
|
1226
|
+
if (index2 >= str.length)
|
|
1227
|
+
try {
|
|
1228
|
+
return resolve(parser.finish());
|
|
1229
|
+
} catch (err) {
|
|
1230
|
+
return reject(prettyError(err, str));
|
|
1231
|
+
}
|
|
1232
|
+
try {
|
|
1233
|
+
parser.parse(str.slice(index2, index2 + blocksize2)), setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve, reject);
|
|
1234
|
+
} catch (err) {
|
|
1235
|
+
reject(prettyError(err, str));
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
|
|
1242
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js
|
|
1243
|
+
var require_parse_stream = __commonJS({
|
|
1244
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
|
|
1245
|
+
"use strict";
|
|
1246
|
+
init_cjs_shims();
|
|
1247
|
+
module2.exports = parseStream;
|
|
1248
|
+
var stream = __require("stream"), TOMLParser = require_toml_parser();
|
|
1249
|
+
function parseStream(stm) {
|
|
1250
|
+
return stm ? parseReadable(stm) : parseTransform(stm);
|
|
1251
|
+
}
|
|
1252
|
+
function parseReadable(stm) {
|
|
1253
|
+
let parser = new TOMLParser();
|
|
1254
|
+
return stm.setEncoding("utf8"), new Promise((resolve, reject) => {
|
|
1255
|
+
let readable, ended = !1, errored = !1;
|
|
1256
|
+
function finish() {
|
|
1257
|
+
if (ended = !0, !readable)
|
|
1258
|
+
try {
|
|
1259
|
+
resolve(parser.finish());
|
|
1260
|
+
} catch (err) {
|
|
1261
|
+
reject(err);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
function error(err) {
|
|
1265
|
+
errored = !0, reject(err);
|
|
1266
|
+
}
|
|
1267
|
+
stm.once("end", finish), stm.once("error", error), readNext();
|
|
1268
|
+
function readNext() {
|
|
1269
|
+
readable = !0;
|
|
1270
|
+
let data;
|
|
1271
|
+
for (; (data = stm.read()) !== null; )
|
|
1272
|
+
try {
|
|
1273
|
+
parser.parse(data);
|
|
1274
|
+
} catch (err) {
|
|
1275
|
+
return error(err);
|
|
1276
|
+
}
|
|
1277
|
+
if (readable = !1, ended)
|
|
1278
|
+
return finish();
|
|
1279
|
+
errored || stm.once("readable", readNext);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
function parseTransform() {
|
|
1284
|
+
let parser = new TOMLParser();
|
|
1285
|
+
return new stream.Transform({
|
|
1286
|
+
objectMode: !0,
|
|
1287
|
+
transform(chunk, encoding, cb) {
|
|
1288
|
+
try {
|
|
1289
|
+
parser.parse(chunk.toString(encoding));
|
|
1290
|
+
} catch (err) {
|
|
1291
|
+
this.emit("error", err);
|
|
1292
|
+
}
|
|
1293
|
+
cb();
|
|
1294
|
+
},
|
|
1295
|
+
flush(cb) {
|
|
1296
|
+
try {
|
|
1297
|
+
this.push(parser.finish());
|
|
1298
|
+
} catch (err) {
|
|
1299
|
+
this.emit("error", err);
|
|
1300
|
+
}
|
|
1301
|
+
cb();
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js
|
|
1309
|
+
var require_parse = __commonJS({
|
|
1310
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/parse.js"(exports2, module2) {
|
|
1311
|
+
"use strict";
|
|
1312
|
+
init_cjs_shims();
|
|
1313
|
+
module2.exports = require_parse_string();
|
|
1314
|
+
module2.exports.async = require_parse_async();
|
|
1315
|
+
module2.exports.stream = require_parse_stream();
|
|
1316
|
+
module2.exports.prettyError = require_parse_pretty_error();
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js
|
|
1321
|
+
var require_stringify = __commonJS({
|
|
1322
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/stringify.js"(exports2, module2) {
|
|
1323
|
+
"use strict";
|
|
1324
|
+
init_cjs_shims();
|
|
1325
|
+
module2.exports = stringify2;
|
|
1326
|
+
module2.exports.value = stringifyInline;
|
|
1327
|
+
function stringify2(obj) {
|
|
1328
|
+
if (obj === null)
|
|
1329
|
+
throw typeError("null");
|
|
1330
|
+
if (obj === void 0)
|
|
1331
|
+
throw typeError("undefined");
|
|
1332
|
+
if (typeof obj != "object")
|
|
1333
|
+
throw typeError(typeof obj);
|
|
1334
|
+
if (typeof obj.toJSON == "function" && (obj = obj.toJSON()), obj == null)
|
|
1335
|
+
return null;
|
|
1336
|
+
let type = tomlType2(obj);
|
|
1337
|
+
if (type !== "table")
|
|
1338
|
+
throw typeError(type);
|
|
1339
|
+
return stringifyObject("", "", obj);
|
|
1340
|
+
}
|
|
1341
|
+
function typeError(type) {
|
|
1342
|
+
return new Error("Can only stringify objects, not " + type);
|
|
1343
|
+
}
|
|
1344
|
+
function arrayOneTypeError() {
|
|
1345
|
+
return new Error("Array values can't have mixed types");
|
|
1346
|
+
}
|
|
1347
|
+
function getInlineKeys(obj) {
|
|
1348
|
+
return Object.keys(obj).filter((key) => isInline(obj[key]));
|
|
1349
|
+
}
|
|
1350
|
+
function getComplexKeys(obj) {
|
|
1351
|
+
return Object.keys(obj).filter((key) => !isInline(obj[key]));
|
|
1352
|
+
}
|
|
1353
|
+
function toJSON(obj) {
|
|
1354
|
+
let nobj = Array.isArray(obj) ? [] : Object.prototype.hasOwnProperty.call(obj, "__proto__") ? { ["__proto__"]: void 0 } : {};
|
|
1355
|
+
for (let prop of Object.keys(obj))
|
|
1356
|
+
obj[prop] && typeof obj[prop].toJSON == "function" && !("toISOString" in obj[prop]) ? nobj[prop] = obj[prop].toJSON() : nobj[prop] = obj[prop];
|
|
1357
|
+
return nobj;
|
|
1358
|
+
}
|
|
1359
|
+
function stringifyObject(prefix, indent, obj) {
|
|
1360
|
+
obj = toJSON(obj);
|
|
1361
|
+
var inlineKeys, complexKeys;
|
|
1362
|
+
inlineKeys = getInlineKeys(obj), complexKeys = getComplexKeys(obj);
|
|
1363
|
+
var result = [], inlineIndent = indent || "";
|
|
1364
|
+
inlineKeys.forEach((key) => {
|
|
1365
|
+
var type = tomlType2(obj[key]);
|
|
1366
|
+
type !== "undefined" && type !== "null" && result.push(inlineIndent + stringifyKey(key) + " = " + stringifyAnyInline(obj[key], !0));
|
|
1367
|
+
}), result.length > 0 && result.push("");
|
|
1368
|
+
var complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
|
|
1369
|
+
return complexKeys.forEach((key) => {
|
|
1370
|
+
result.push(stringifyComplex(prefix, complexIndent, key, obj[key]));
|
|
1371
|
+
}), result.join(`
|
|
1372
|
+
`);
|
|
1373
|
+
}
|
|
1374
|
+
function isInline(value) {
|
|
1375
|
+
switch (tomlType2(value)) {
|
|
1376
|
+
case "undefined":
|
|
1377
|
+
case "null":
|
|
1378
|
+
case "integer":
|
|
1379
|
+
case "nan":
|
|
1380
|
+
case "float":
|
|
1381
|
+
case "boolean":
|
|
1382
|
+
case "string":
|
|
1383
|
+
case "datetime":
|
|
1384
|
+
return !0;
|
|
1385
|
+
case "array":
|
|
1386
|
+
return value.length === 0 || tomlType2(value[0]) !== "table";
|
|
1387
|
+
case "table":
|
|
1388
|
+
return Object.keys(value).length === 0;
|
|
1389
|
+
default:
|
|
1390
|
+
return !1;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
function tomlType2(value) {
|
|
1394
|
+
return value === void 0 ? "undefined" : value === null ? "null" : typeof value == "bigint" || Number.isInteger(value) && !Object.is(value, -0) ? "integer" : typeof value == "number" ? "float" : typeof value == "boolean" ? "boolean" : typeof value == "string" ? "string" : "toISOString" in value ? isNaN(value) ? "undefined" : "datetime" : Array.isArray(value) ? "array" : "table";
|
|
1395
|
+
}
|
|
1396
|
+
function stringifyKey(key) {
|
|
1397
|
+
var keyStr = String(key);
|
|
1398
|
+
return /^[-A-Za-z0-9_]+$/.test(keyStr) ? keyStr : stringifyBasicString(keyStr);
|
|
1399
|
+
}
|
|
1400
|
+
function stringifyBasicString(str) {
|
|
1401
|
+
return '"' + escapeString(str).replace(/"/g, '\\"') + '"';
|
|
1402
|
+
}
|
|
1403
|
+
function stringifyLiteralString(str) {
|
|
1404
|
+
return "'" + str + "'";
|
|
1405
|
+
}
|
|
1406
|
+
function numpad(num, str) {
|
|
1407
|
+
for (; str.length < num; )
|
|
1408
|
+
str = "0" + str;
|
|
1409
|
+
return str;
|
|
1410
|
+
}
|
|
1411
|
+
function escapeString(str) {
|
|
1412
|
+
return str.replace(/\\/g, "\\\\").replace(/[\b]/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/([\u0000-\u001f\u007f])/, (c) => "\\u" + numpad(4, c.codePointAt(0).toString(16)));
|
|
1413
|
+
}
|
|
1414
|
+
function stringifyMultilineString(str) {
|
|
1415
|
+
let escaped = str.split(/\n/).map((str2) => escapeString(str2).replace(/"(?="")/g, '\\"')).join(`
|
|
1416
|
+
`);
|
|
1417
|
+
return escaped.slice(-1) === '"' && (escaped += `\\
|
|
1418
|
+
`), `"""
|
|
1419
|
+
` + escaped + '"""';
|
|
1420
|
+
}
|
|
1421
|
+
function stringifyAnyInline(value, multilineOk) {
|
|
1422
|
+
let type = tomlType2(value);
|
|
1423
|
+
return type === "string" && (multilineOk && /\n/.test(value) ? type = "string-multiline" : !/[\b\t\n\f\r']/.test(value) && /"/.test(value) && (type = "string-literal")), stringifyInline(value, type);
|
|
1424
|
+
}
|
|
1425
|
+
function stringifyInline(value, type) {
|
|
1426
|
+
switch (type || (type = tomlType2(value)), type) {
|
|
1427
|
+
case "string-multiline":
|
|
1428
|
+
return stringifyMultilineString(value);
|
|
1429
|
+
case "string":
|
|
1430
|
+
return stringifyBasicString(value);
|
|
1431
|
+
case "string-literal":
|
|
1432
|
+
return stringifyLiteralString(value);
|
|
1433
|
+
case "integer":
|
|
1434
|
+
return stringifyInteger(value);
|
|
1435
|
+
case "float":
|
|
1436
|
+
return stringifyFloat(value);
|
|
1437
|
+
case "boolean":
|
|
1438
|
+
return stringifyBoolean(value);
|
|
1439
|
+
case "datetime":
|
|
1440
|
+
return stringifyDatetime(value);
|
|
1441
|
+
case "array":
|
|
1442
|
+
return stringifyInlineArray(value.filter((_) => tomlType2(_) !== "null" && tomlType2(_) !== "undefined" && tomlType2(_) !== "nan"));
|
|
1443
|
+
case "table":
|
|
1444
|
+
return stringifyInlineTable(value);
|
|
1445
|
+
default:
|
|
1446
|
+
throw typeError(type);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
function stringifyInteger(value) {
|
|
1450
|
+
return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
|
1451
|
+
}
|
|
1452
|
+
function stringifyFloat(value) {
|
|
1453
|
+
if (value === 1 / 0)
|
|
1454
|
+
return "inf";
|
|
1455
|
+
if (value === -1 / 0)
|
|
1456
|
+
return "-inf";
|
|
1457
|
+
if (Object.is(value, NaN))
|
|
1458
|
+
return "nan";
|
|
1459
|
+
if (Object.is(value, -0))
|
|
1460
|
+
return "-0.0";
|
|
1461
|
+
var chunks = String(value).split("."), int = chunks[0], dec = chunks[1] || 0;
|
|
1462
|
+
return stringifyInteger(int) + "." + dec;
|
|
1463
|
+
}
|
|
1464
|
+
function stringifyBoolean(value) {
|
|
1465
|
+
return String(value);
|
|
1466
|
+
}
|
|
1467
|
+
function stringifyDatetime(value) {
|
|
1468
|
+
return value.toISOString();
|
|
1469
|
+
}
|
|
1470
|
+
function isNumber(type) {
|
|
1471
|
+
return type === "float" || type === "integer";
|
|
1472
|
+
}
|
|
1473
|
+
function arrayType(values) {
|
|
1474
|
+
var contentType = tomlType2(values[0]);
|
|
1475
|
+
return values.every((_) => tomlType2(_) === contentType) ? contentType : values.every((_) => isNumber(tomlType2(_))) ? "float" : "mixed";
|
|
1476
|
+
}
|
|
1477
|
+
function validateArray(values) {
|
|
1478
|
+
let type = arrayType(values);
|
|
1479
|
+
if (type === "mixed")
|
|
1480
|
+
throw arrayOneTypeError();
|
|
1481
|
+
return type;
|
|
1482
|
+
}
|
|
1483
|
+
function stringifyInlineArray(values) {
|
|
1484
|
+
values = toJSON(values);
|
|
1485
|
+
let type = validateArray(values);
|
|
1486
|
+
var result = "[", stringified = values.map((_) => stringifyInline(_, type));
|
|
1487
|
+
return stringified.join(", ").length > 60 || /\n/.test(stringified) ? result += `
|
|
1488
|
+
` + stringified.join(`,
|
|
1489
|
+
`) + `
|
|
1490
|
+
` : result += " " + stringified.join(", ") + (stringified.length > 0 ? " " : ""), result + "]";
|
|
1491
|
+
}
|
|
1492
|
+
function stringifyInlineTable(value) {
|
|
1493
|
+
value = toJSON(value);
|
|
1494
|
+
var result = [];
|
|
1495
|
+
return Object.keys(value).forEach((key) => {
|
|
1496
|
+
result.push(stringifyKey(key) + " = " + stringifyAnyInline(value[key], !1));
|
|
1497
|
+
}), "{ " + result.join(", ") + (result.length > 0 ? " " : "") + "}";
|
|
1498
|
+
}
|
|
1499
|
+
function stringifyComplex(prefix, indent, key, value) {
|
|
1500
|
+
var valueType = tomlType2(value);
|
|
1501
|
+
if (valueType === "array")
|
|
1502
|
+
return stringifyArrayOfTables(prefix, indent, key, value);
|
|
1503
|
+
if (valueType === "table")
|
|
1504
|
+
return stringifyComplexTable(prefix, indent, key, value);
|
|
1505
|
+
throw typeError(valueType);
|
|
1506
|
+
}
|
|
1507
|
+
function stringifyArrayOfTables(prefix, indent, key, values) {
|
|
1508
|
+
values = toJSON(values), validateArray(values);
|
|
1509
|
+
var firstValueType = tomlType2(values[0]);
|
|
1510
|
+
if (firstValueType !== "table")
|
|
1511
|
+
throw typeError(firstValueType);
|
|
1512
|
+
var fullKey = prefix + stringifyKey(key), result = "";
|
|
1513
|
+
return values.forEach((table) => {
|
|
1514
|
+
result.length > 0 && (result += `
|
|
1515
|
+
`), result += indent + "[[" + fullKey + `]]
|
|
1516
|
+
`, result += stringifyObject(fullKey + ".", indent, table);
|
|
1517
|
+
}), result;
|
|
1518
|
+
}
|
|
1519
|
+
function stringifyComplexTable(prefix, indent, key, value) {
|
|
1520
|
+
var fullKey = prefix + stringifyKey(key), result = "";
|
|
1521
|
+
return getInlineKeys(value).length > 0 && (result += indent + "[" + fullKey + `]
|
|
1522
|
+
`), result + stringifyObject(fullKey + ".", indent, value);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
// ../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js
|
|
1528
|
+
var require_toml = __commonJS({
|
|
1529
|
+
"../../node_modules/.pnpm/@iarna+toml@2.2.5/node_modules/@iarna/toml/toml.js"(exports2) {
|
|
1530
|
+
"use strict";
|
|
1531
|
+
init_cjs_shims();
|
|
1532
|
+
exports2.parse = require_parse();
|
|
1533
|
+
exports2.stringify = require_stringify();
|
|
1534
|
+
}
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
// src/commands/init.ts
|
|
1538
|
+
init_cjs_shims();
|
|
1539
|
+
var import_core2 = __toESM(require_lib(), 1);
|
|
1540
|
+
|
|
1541
|
+
// ../cli-kit/src/public/node/base-command.ts
|
|
1542
|
+
init_cjs_shims();
|
|
1543
|
+
|
|
1544
|
+
// ../cli-kit/src/public/node/environments.ts
|
|
1545
|
+
init_cjs_shims();
|
|
1546
|
+
|
|
1547
|
+
// ../cli-kit/src/public/node/toml.ts
|
|
1548
|
+
init_cjs_shims();
|
|
1549
|
+
var toml = __toESM(require_toml(), 1);
|
|
1550
|
+
function decodeToml(input) {
|
|
1551
|
+
let normalizedInput = input.replace(/\r\n$/g, `
|
|
1552
|
+
`);
|
|
1553
|
+
return toml.parse(normalizedInput);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// ../cli-kit/src/public/node/environments.ts
|
|
1557
|
+
async function loadEnvironment(environmentName, fileName, options) {
|
|
1558
|
+
let basePath = options?.from && options?.from !== "." ? options.from : cwd(), filePath = await findPathUp(fileName, {
|
|
1559
|
+
cwd: basePath,
|
|
1560
|
+
type: "file"
|
|
1561
|
+
});
|
|
1562
|
+
if (!filePath) {
|
|
1563
|
+
renderWarning({ body: "Environment file not found." });
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
let environments = decodeToml(await readFile(filePath)).environments;
|
|
1567
|
+
if (!environments) {
|
|
1568
|
+
renderWarning({
|
|
1569
|
+
body: ["No environments found in", { command: filePath }, { char: "." }]
|
|
1570
|
+
});
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
let environment = environments[environmentName];
|
|
1574
|
+
return environment || renderWarning({
|
|
1575
|
+
body: ["Environment", { command: environmentName }, "not found."]
|
|
1576
|
+
}), await addSensitiveMetadata(() => ({
|
|
1577
|
+
environmentFlags: JSON.stringify(environment)
|
|
1578
|
+
})), environment;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
// ../cli-kit/src/public/node/base-command.ts
|
|
1582
|
+
var import_core = __toESM(require_lib(), 1), BaseCommand = class extends import_core.Command {
|
|
1583
|
+
static {
|
|
1584
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1585
|
+
this.baseFlags = {};
|
|
1586
|
+
}
|
|
1587
|
+
// Replace markdown links to plain text like: "link label" (url)
|
|
1588
|
+
static descriptionWithoutMarkdown() {
|
|
1589
|
+
return (this.descriptionWithMarkdown ?? "").replace(/(\[)(.*?)(])(\()(.*?)(\))/gm, '"$2" ($5)');
|
|
1590
|
+
}
|
|
1591
|
+
static analyticsNameOverride() {
|
|
1592
|
+
}
|
|
1593
|
+
static analyticsStopCommand() {
|
|
1594
|
+
}
|
|
1595
|
+
async catch(error) {
|
|
1596
|
+
return error.skipOclifErrorHandling = !0, await errorHandler(error, this.config), import_core.Errors.handle(error);
|
|
1597
|
+
}
|
|
1598
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1599
|
+
async init() {
|
|
1600
|
+
return this.exitWithTimestampWhenEnvVariablePresent(), isDevelopment() || await registerCleanBugsnagErrorsFromWithinPlugins(this.config), this.showNpmFlagWarning(), super.init();
|
|
1601
|
+
}
|
|
1602
|
+
// NPM creates an environment variable for every flag passed to a script.
|
|
1603
|
+
// This function checks for the presence of any of the available CLI flags
|
|
1604
|
+
// and warns the user to use the `--` separator.
|
|
1605
|
+
showNpmFlagWarning() {
|
|
1606
|
+
let commandVariables = this.constructor;
|
|
1607
|
+
Object.keys(commandVariables.flags || {}).map((key) => `npm_config_${underscore(key).replace(/^no_/, "")}`).some((flag) => process.env[flag] !== void 0) && renderWarning({
|
|
1608
|
+
body: [
|
|
1609
|
+
"NPM scripts require an extra",
|
|
1610
|
+
{ command: "--" },
|
|
1611
|
+
"separator to pass the flags. Example:",
|
|
1612
|
+
{ command: "npm run dev -- --reset" }
|
|
1613
|
+
]
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1617
|
+
exitWithTimestampWhenEnvVariablePresent() {
|
|
1618
|
+
isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN) && (outputInfo(`
|
|
1619
|
+
SHOPIFY_CLI_TIMESTAMP_START
|
|
1620
|
+
{ "timestamp": ${Date.now()} }
|
|
1621
|
+
SHOPIFY_CLI_TIMESTAMP_END
|
|
1622
|
+
`), process.exit(0));
|
|
1623
|
+
}
|
|
1624
|
+
async parse(options, argv) {
|
|
1625
|
+
let result = await super.parse(options, argv);
|
|
1626
|
+
return result = await this.resultWithEnvironment(result, options, argv), await addFromParsedFlags(result.flags), { ...result, argv: result.argv };
|
|
1627
|
+
}
|
|
1628
|
+
environmentsFilename() {
|
|
1629
|
+
}
|
|
1630
|
+
failMissingNonTTYFlags(flags, requiredFlags) {
|
|
1631
|
+
terminalSupportsRawMode() || requiredFlags.forEach((name) => {
|
|
1632
|
+
if (!(name in flags))
|
|
1633
|
+
throw new AbortError(
|
|
1634
|
+
outputContent`Flag not specified:
|
|
1635
|
+
|
|
1636
|
+
${outputToken.cyan(name)}
|
|
1637
|
+
|
|
1638
|
+
This flag is required in non-interactive terminal environments, such as a CI environment, or when piping input from another process.`,
|
|
1639
|
+
"To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal."
|
|
1640
|
+
);
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
async resultWithEnvironment(originalResult, options, argv) {
|
|
1644
|
+
let flags = originalResult.flags, environmentsFileName = this.environmentsFilename();
|
|
1645
|
+
if (!flags.environment || !environmentsFileName)
|
|
1646
|
+
return originalResult;
|
|
1647
|
+
let environment = await loadEnvironment(flags.environment, environmentsFileName, { from: flags.path });
|
|
1648
|
+
if (!environment)
|
|
1649
|
+
return originalResult;
|
|
1650
|
+
let noDefaultsResult = await super.parse(noDefaultsOptions(options), argv), result = await super.parse(options, [
|
|
1651
|
+
// Need to specify argv default because we're merging with argsFromEnvironment.
|
|
1652
|
+
...argv || this.argv,
|
|
1653
|
+
...argsFromEnvironment(environment, options, noDefaultsResult)
|
|
1654
|
+
]);
|
|
1655
|
+
return reportEnvironmentApplication(
|
|
1656
|
+
noDefaultsResult.flags,
|
|
1657
|
+
result.flags,
|
|
1658
|
+
flags.environment,
|
|
1659
|
+
environment
|
|
1660
|
+
), result;
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
async function addFromParsedFlags(flags) {
|
|
1664
|
+
await addPublicMetadata(() => ({
|
|
1665
|
+
cmd_all_verbose: flags.verbose,
|
|
1666
|
+
cmd_all_path_override: flags.path !== void 0,
|
|
1667
|
+
cmd_all_path_override_hash: flags.path === void 0 ? void 0 : hashString(flags.path)
|
|
1668
|
+
}));
|
|
1669
|
+
}
|
|
1670
|
+
function reportEnvironmentApplication(noDefaultsFlags, flagsWithEnvironments, environmentName, environment) {
|
|
1671
|
+
let changes = {};
|
|
1672
|
+
for (let [name, value] of Object.entries(flagsWithEnvironments)) {
|
|
1673
|
+
let userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name), environmentContainsFlag = Object.prototype.hasOwnProperty.call(environment, name);
|
|
1674
|
+
if (!userSpecifiedThisFlag && environmentContainsFlag) {
|
|
1675
|
+
let valueToReport = name === "password" ? `********${value.substr(-4)}` : value;
|
|
1676
|
+
changes[name] = valueToReport;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
if (Object.keys(changes).length === 0)
|
|
1680
|
+
return;
|
|
1681
|
+
let items = Object.entries(changes).map(([name, value]) => `${name}: ${value}`);
|
|
1682
|
+
renderInfo({
|
|
1683
|
+
headline: ["Using applicable flags from", { userInput: environmentName }, "environment:"],
|
|
1684
|
+
body: [{ list: { items } }]
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
function noDefaultsOptions(options) {
|
|
1688
|
+
return options?.flags ? {
|
|
1689
|
+
...options,
|
|
1690
|
+
flags: Object.fromEntries(
|
|
1691
|
+
Object.entries(options.flags).map(([label, settings]) => {
|
|
1692
|
+
let copiedSettings = { ...settings };
|
|
1693
|
+
return delete copiedSettings.default, [label, copiedSettings];
|
|
1694
|
+
})
|
|
1695
|
+
)
|
|
1696
|
+
} : options;
|
|
1697
|
+
}
|
|
1698
|
+
function argsFromEnvironment(environment, options, noDefaultsResult) {
|
|
1699
|
+
let args = [];
|
|
1700
|
+
for (let [label, value] of Object.entries(environment)) {
|
|
1701
|
+
let flagIsRelevantToCommand = options?.flags && Object.prototype.hasOwnProperty.call(options.flags, label), userSpecifiedThisFlag = noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label);
|
|
1702
|
+
if (flagIsRelevantToCommand && !userSpecifiedThisFlag)
|
|
1703
|
+
if (typeof value == "boolean")
|
|
1704
|
+
if (value === !0)
|
|
1705
|
+
args.push(`--${label}`);
|
|
1706
|
+
else
|
|
1707
|
+
throw new AbortError(
|
|
1708
|
+
outputContent`Environments can only specify true for boolean flags. Attempted to set ${outputToken.yellow(
|
|
1709
|
+
label
|
|
1710
|
+
)} to false.`
|
|
1711
|
+
);
|
|
1712
|
+
else
|
|
1713
|
+
Array.isArray(value) ? value.forEach((element) => args.push(`--${label}`, `${element}`)) : args.push(`--${label}`, `${value}`);
|
|
1714
|
+
}
|
|
1715
|
+
return args;
|
|
1716
|
+
}
|
|
1717
|
+
var base_command_default = BaseCommand;
|
|
1718
|
+
|
|
1719
|
+
// src/commands/init.ts
|
|
1720
|
+
var Init = class _Init extends base_command_default {
|
|
1721
|
+
static {
|
|
1722
|
+
this.summary = "Create a new app project";
|
|
1723
|
+
}
|
|
1724
|
+
static {
|
|
1725
|
+
this.flags = {
|
|
1726
|
+
...globalFlags,
|
|
1727
|
+
name: import_core2.Flags.string({
|
|
1728
|
+
char: "n",
|
|
1729
|
+
env: "SHOPIFY_FLAG_NAME",
|
|
1730
|
+
hidden: !1
|
|
1731
|
+
}),
|
|
1732
|
+
path: import_core2.Flags.string({
|
|
1733
|
+
char: "p",
|
|
1734
|
+
env: "SHOPIFY_FLAG_PATH",
|
|
1735
|
+
parse: async (input) => resolvePath(input),
|
|
1736
|
+
default: async () => cwd(),
|
|
1737
|
+
hidden: !1
|
|
1738
|
+
}),
|
|
1739
|
+
template: import_core2.Flags.string({
|
|
1740
|
+
description: `The app template. Accepts one of the following:
|
|
1741
|
+
- <${visibleTemplates.join("|")}>
|
|
1742
|
+
- Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]`,
|
|
1743
|
+
env: "SHOPIFY_FLAG_TEMPLATE"
|
|
1744
|
+
}),
|
|
1745
|
+
flavor: import_core2.Flags.string({
|
|
1746
|
+
description: "Which flavor of the given template to use.",
|
|
1747
|
+
env: "SHOPIFY_FLAG_TEMPLATE_FLAVOR"
|
|
1748
|
+
}),
|
|
1749
|
+
"package-manager": import_core2.Flags.string({
|
|
1750
|
+
char: "d",
|
|
1751
|
+
env: "SHOPIFY_FLAG_PACKAGE_MANAGER",
|
|
1752
|
+
hidden: !1,
|
|
1753
|
+
options: ["npm", "yarn", "pnpm", "bun"]
|
|
1754
|
+
}),
|
|
1755
|
+
local: import_core2.Flags.boolean({
|
|
1756
|
+
char: "l",
|
|
1757
|
+
env: "SHOPIFY_FLAG_LOCAL",
|
|
1758
|
+
default: !1,
|
|
1759
|
+
hidden: !0
|
|
1760
|
+
})
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
async run() {
|
|
1764
|
+
let { flags } = await this.parse(_Init);
|
|
1765
|
+
this.validateTemplateValue(flags.template), this.validateFlavorValue(flags.template, flags.flavor);
|
|
1766
|
+
let inferredPackageManager = this.inferPackageManager(flags["package-manager"]), promptAnswers = await init_default({
|
|
1767
|
+
name: flags.name,
|
|
1768
|
+
template: flags.template,
|
|
1769
|
+
flavor: flags.flavor,
|
|
1770
|
+
directory: flags.path
|
|
1771
|
+
});
|
|
1772
|
+
promptAnswers.globalCLIResult.install && await installGlobalShopifyCLI(inferredPackageManager), await addPublicMetadata(() => ({
|
|
1773
|
+
cmd_create_app_template: promptAnswers.templateType,
|
|
1774
|
+
cmd_create_app_template_url: promptAnswers.template
|
|
1775
|
+
})), await init_default2({
|
|
1776
|
+
name: promptAnswers.name,
|
|
1777
|
+
packageManager: inferredPackageManager,
|
|
1778
|
+
template: promptAnswers.template,
|
|
1779
|
+
local: flags.local,
|
|
1780
|
+
directory: flags.path,
|
|
1781
|
+
useGlobalCLI: promptAnswers.globalCLIResult.alreadyInstalled || promptAnswers.globalCLIResult.install,
|
|
1782
|
+
postCloneActions: {
|
|
1783
|
+
removeLockfilesFromGitignore: promptAnswers.templateType !== "custom"
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
validateTemplateValue(template) {
|
|
1788
|
+
if (!template)
|
|
1789
|
+
return;
|
|
1790
|
+
let url = this.parseURL(template);
|
|
1791
|
+
if (url && url.origin !== "https://github.com")
|
|
1792
|
+
throw new AbortError(
|
|
1793
|
+
"Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]"
|
|
1794
|
+
);
|
|
1795
|
+
if (!url && !isPredefinedTemplate(template))
|
|
1796
|
+
throw new AbortError(
|
|
1797
|
+
outputContent`Only ${visibleTemplates.map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")} template aliases are supported, please provide a valid URL`
|
|
1798
|
+
);
|
|
1799
|
+
}
|
|
1800
|
+
validateFlavorValue(template, flavor) {
|
|
1801
|
+
if (!template) {
|
|
1802
|
+
if (flavor)
|
|
1803
|
+
throw new AbortError(
|
|
1804
|
+
outputContent`The ${outputToken.yellow("--flavor")} flag requires the ${outputToken.yellow(
|
|
1805
|
+
"--template"
|
|
1806
|
+
)} flag to be set`
|
|
1807
|
+
);
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
if (!flavor)
|
|
1811
|
+
return;
|
|
1812
|
+
if (!isPredefinedTemplate(template))
|
|
1813
|
+
throw new AbortError(
|
|
1814
|
+
outputContent`The ${outputToken.yellow("--flavor")} flag is not supported for custom templates`
|
|
1815
|
+
);
|
|
1816
|
+
let templateConfig = templates[template];
|
|
1817
|
+
if (!templateConfig.branches)
|
|
1818
|
+
throw new AbortError(outputContent`The ${outputToken.yellow(template)} template does not support flavors`);
|
|
1819
|
+
if (!templateConfig.branches.options[flavor])
|
|
1820
|
+
throw new AbortError(
|
|
1821
|
+
outputContent`Invalid option for ${outputToken.yellow("--flavor")}\nThe ${outputToken.yellow(
|
|
1822
|
+
"--flavor"
|
|
1823
|
+
)} flag for ${outputToken.yellow(template)} accepts only ${Object.keys(templateConfig.branches.options).map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")}`
|
|
1824
|
+
);
|
|
1825
|
+
}
|
|
1826
|
+
parseURL(url) {
|
|
1827
|
+
try {
|
|
1828
|
+
return new URL(url);
|
|
1829
|
+
} catch {
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
inferPackageManager(optionsPackageManager) {
|
|
1834
|
+
if (optionsPackageManager && packageManager.includes(optionsPackageManager))
|
|
1835
|
+
return optionsPackageManager;
|
|
1836
|
+
let usedPackageManager = packageManagerFromUserAgent();
|
|
1837
|
+
if (usedPackageManager !== "unknown")
|
|
1838
|
+
return usedPackageManager;
|
|
1839
|
+
let globalPackageManager = inferPackageManagerForGlobalCLI();
|
|
1840
|
+
return globalPackageManager !== "unknown" ? globalPackageManager : "npm";
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
|
|
1844
|
+
export {
|
|
1845
|
+
Init
|
|
1846
|
+
};
|
|
1847
|
+
//# sourceMappingURL=chunk-ZULFH3SL.js.map
|