elrh-cosca 0.2.5 → 0.2.7
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/README.md +9 -4
- package/dist/elrh-cosca.mjs +146 -136
- package/dist/types/functions/create-file-from-template.d.ts +10 -0
- package/dist/types/functions/create-file-from-web-template.d.ts +10 -0
- package/dist/types/functions/update-config-file.d.ts +2 -1
- package/dist/types/functions/update-json-file.d.ts +11 -0
- package/dist/types/functions/update-text-file.d.ts +10 -0
- package/dist/types/terminal/prompt-user.d.ts +11 -1
- package/dist/types/terminal/show-error.d.ts +6 -0
- package/dist/types/terminal/show-message.d.ts +6 -0
- package/dist/types/utils/get-env-value.d.ts +7 -0
- package/dist/types/utils/parse-qualified-path.d.ts +5 -1
- package/dist/types/utils/resolve-package-path.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ async function createFileFromTemplate(
|
|
|
21
21
|
): Promise<void>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Gets a file definition from given `templateFile` and will create a fresh copy in target project.
|
|
25
25
|
|
|
26
26
|
Path to `templateFile` must be prefixed with the package name to allow proper resolution, e.g. `your-package:path/to/template`. The package name can be scoped.
|
|
27
27
|
|
|
@@ -37,9 +37,9 @@ async function createFileWebFromTemplate(
|
|
|
37
37
|
): Promise<void>
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Gets a file definition from given `url` and will create a fresh copy in target project
|
|
40
|
+
Gets a file definition from given `url` and will create a fresh copy in target project.
|
|
41
41
|
|
|
42
|
-
Contents of `url` must be accessible via `node:https.get` function and will be fetched as raw
|
|
42
|
+
Contents of `url` must be accessible via `node:https.get` function and will be fetched as raw text data.
|
|
43
43
|
|
|
44
44
|
Path to `targetFile` is relative to `process.cwd()` which allows consumers to run `npx your-script` in their project roots during development.
|
|
45
45
|
|
|
@@ -102,11 +102,16 @@ By default the function asks for confirmation before attempting to alter the `ta
|
|
|
102
102
|
#### `promptUser`
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
|
-
async function promptUser(
|
|
105
|
+
async function promptUser(
|
|
106
|
+
question: string,
|
|
107
|
+
options?: { input?: NodeJS.ReadableStream; output?: NodeJS.WritableStream }
|
|
108
|
+
): Promise<boolean>
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
Prints out a `question` to the console and waits for the input. Returns `true` when `y` is pressed and `false` otherwise.
|
|
109
112
|
|
|
113
|
+
By default it uses `process.stdin` and `process.stdout` streams. To use custom NodeJS streams, `options` object with `input` and `output` properties can be optionally passed.
|
|
114
|
+
|
|
110
115
|
#### `showMessage`
|
|
111
116
|
|
|
112
117
|
```ts
|
package/dist/elrh-cosca.mjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { join as Ps, resolve as
|
|
2
|
-
import { readFileSync as ss, access as Sa, constants as Ea, existsSync as
|
|
1
|
+
import { join as Ps, resolve as Ye } from "node:path";
|
|
2
|
+
import { readFileSync as ss, access as Sa, constants as Ea, existsSync as We, copyFileSync as Aa, writeFileSync as is, promises as wa } from "node:fs";
|
|
3
3
|
import va from "node:readline";
|
|
4
4
|
import Ca from "node:https";
|
|
5
5
|
import "fs";
|
|
6
|
-
async function
|
|
7
|
-
const
|
|
8
|
-
input: process.stdin,
|
|
9
|
-
output: process.stdout
|
|
6
|
+
async function Ze(a, l) {
|
|
7
|
+
const i = va.createInterface({
|
|
8
|
+
input: l?.input || process.stdin,
|
|
9
|
+
output: l?.output || process.stdout
|
|
10
10
|
});
|
|
11
|
-
return new Promise((
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
return new Promise((r) => {
|
|
12
|
+
i.question(a + " (y/N): ", (o) => {
|
|
13
|
+
i.close();
|
|
14
|
+
const u = o.trim().toLowerCase();
|
|
15
|
+
r(/^y(es)?$/.test(u));
|
|
16
|
+
}), i.on("SIGINT", () => {
|
|
17
|
+
i.close();
|
|
14
18
|
});
|
|
15
19
|
});
|
|
16
20
|
}
|
|
@@ -46,19 +50,22 @@ function Na(a) {
|
|
|
46
50
|
throw new Error(`Cannot find package "${a}" from ${process.cwd()}. Make sure it's installed or linked in this project.`);
|
|
47
51
|
}
|
|
48
52
|
async function Il(a, l, i = !1, r = "") {
|
|
49
|
-
if (i || await
|
|
53
|
+
if (i || await Ze(
|
|
50
54
|
r || `This will create '${l}' file. Continue?`
|
|
51
55
|
)) {
|
|
52
|
-
const { pkg: u, file: h } = Ia(a), d = Na(u), g =
|
|
53
|
-
if (!
|
|
56
|
+
const { pkg: u, file: h } = Ia(a), d = Na(u), g = Ye(d, h), b = Ye(process.cwd(), l);
|
|
57
|
+
if (!We(g))
|
|
54
58
|
throw new Error(`Template file not found at ${g}`);
|
|
55
|
-
if (
|
|
59
|
+
if (We(b) && !(i || await Ze(
|
|
56
60
|
`File '${l}' already exists. Overwrite?`
|
|
57
61
|
))) {
|
|
58
62
|
console.log("Aborted.");
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
61
|
-
Aa(g, b),
|
|
65
|
+
if (Aa(g, b), We(b))
|
|
66
|
+
console.log(`New file '${l}' successfully created.`);
|
|
67
|
+
else
|
|
68
|
+
throw new Error(`Failed to create '${l}'.`);
|
|
62
69
|
} else
|
|
63
70
|
console.log(`Creation of '${l}' skipped.`);
|
|
64
71
|
}
|
|
@@ -75,7 +82,7 @@ async function ka(a) {
|
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
async function Nl(a, l, i = !1, r = "") {
|
|
78
|
-
if (i || await
|
|
85
|
+
if (i || await Ze(
|
|
79
86
|
r || `This will create '${l}' file. Continue?`
|
|
80
87
|
)) {
|
|
81
88
|
let u;
|
|
@@ -85,14 +92,17 @@ async function Nl(a, l, i = !1, r = "") {
|
|
|
85
92
|
throw new Error(`Failed to fetch template from external source ${a}:
|
|
86
93
|
${d}`);
|
|
87
94
|
}
|
|
88
|
-
const h =
|
|
89
|
-
if (
|
|
95
|
+
const h = Ye(process.cwd(), l);
|
|
96
|
+
if (We(h) && !(i || await Ze(
|
|
90
97
|
`File '${l}' already exists. Overwrite?`
|
|
91
98
|
))) {
|
|
92
99
|
console.log("Aborted.");
|
|
93
100
|
return;
|
|
94
101
|
}
|
|
95
|
-
is(h, u, "utf8"),
|
|
102
|
+
if (is(h, u, "utf8"), We(h))
|
|
103
|
+
console.log(`New file '${l}' successfully created.`);
|
|
104
|
+
else
|
|
105
|
+
throw new Error(`Failed to create '${l}'.`);
|
|
96
106
|
} else
|
|
97
107
|
console.log(`Creation of '${l}' skipped.`);
|
|
98
108
|
}
|
|
@@ -1096,10 +1106,10 @@ function ja() {
|
|
|
1096
1106
|
}
|
|
1097
1107
|
var Ra = ja();
|
|
1098
1108
|
const Us = /* @__PURE__ */ La(Ra);
|
|
1099
|
-
var
|
|
1109
|
+
var rt = {}, rr;
|
|
1100
1110
|
function Ua() {
|
|
1101
|
-
if (rr) return
|
|
1102
|
-
rr = 1, Object.defineProperty(
|
|
1111
|
+
if (rr) return rt;
|
|
1112
|
+
rr = 1, Object.defineProperty(rt, "__esModule", {
|
|
1103
1113
|
value: !0
|
|
1104
1114
|
});
|
|
1105
1115
|
function a(p, t) {
|
|
@@ -1838,7 +1848,7 @@ function Ua() {
|
|
|
1838
1848
|
var e, s, n, c;
|
|
1839
1849
|
return ++z, Ne.set(p, z), X.push(p), Y.push((e = t.binop) != null ? e : -1), re.push((s = t.beforeExpr) != null ? s : !1), ne.push((n = t.startsExpr) != null ? n : !1), oe.push((c = t.prefix) != null ? c : !1), V.push(new Fe("name", t)), z;
|
|
1840
1850
|
}
|
|
1841
|
-
const
|
|
1851
|
+
const et = {
|
|
1842
1852
|
bracketL: J("[", {
|
|
1843
1853
|
beforeExpr: _,
|
|
1844
1854
|
startsExpr: N
|
|
@@ -2236,7 +2246,7 @@ function Ua() {
|
|
|
2236
2246
|
function se(p) {
|
|
2237
2247
|
return p >= 93 && p <= 133;
|
|
2238
2248
|
}
|
|
2239
|
-
function
|
|
2249
|
+
function He(p) {
|
|
2240
2250
|
return p <= 92;
|
|
2241
2251
|
}
|
|
2242
2252
|
function Se(p) {
|
|
@@ -2317,7 +2327,7 @@ function Ua() {
|
|
|
2317
2327
|
function _e(p) {
|
|
2318
2328
|
return p < 65 ? p === 36 : p <= 90 ? !0 : p < 97 ? p === 95 : p <= 122 ? !0 : p <= 65535 ? p >= 170 && fn.test(String.fromCharCode(p)) : cs(p, Ks);
|
|
2319
2329
|
}
|
|
2320
|
-
function
|
|
2330
|
+
function tt(p) {
|
|
2321
2331
|
return p < 48 ? p === 36 : p < 58 ? !0 : p < 65 ? !1 : p <= 90 ? !0 : p < 97 ? p === 95 : p <= 122 ? !0 : p <= 65535 ? p >= 170 && dn.test(String.fromCharCode(p)) : cs(p, Ks) || cs(p, mn);
|
|
2322
2332
|
}
|
|
2323
2333
|
const us = {
|
|
@@ -2883,8 +2893,8 @@ function Ua() {
|
|
|
2883
2893
|
const qe = this.lookahead();
|
|
2884
2894
|
Mt(qe.type) && (le = this.state.value, this.next());
|
|
2885
2895
|
}
|
|
2886
|
-
const
|
|
2887
|
-
|
|
2896
|
+
const Xe = this.flowParseObjectTypeProperty(fe, W, K, te, le, n, f ?? !C);
|
|
2897
|
+
Xe === null ? (F = !0, ee = this.state.lastTokStartLoc) : x.properties.push(Xe);
|
|
2888
2898
|
}
|
|
2889
2899
|
this.flowObjectTypeSemicolon(), ee && !this.match(8) && !this.match(9) && this.raise(G.UnexpectedExplicitInexactInObject, ee);
|
|
2890
2900
|
}
|
|
@@ -4144,7 +4154,7 @@ function Ua() {
|
|
|
4144
4154
|
hearts: "♥",
|
|
4145
4155
|
diams: "♦"
|
|
4146
4156
|
}, On = /\r\n|[\r\n\u2028\u2029]/, _t = new RegExp(On.source, "g");
|
|
4147
|
-
function
|
|
4157
|
+
function st(p) {
|
|
4148
4158
|
switch (p) {
|
|
4149
4159
|
case 10:
|
|
4150
4160
|
case 13:
|
|
@@ -4157,7 +4167,7 @@ function Ua() {
|
|
|
4157
4167
|
}
|
|
4158
4168
|
function ei(p, t, e) {
|
|
4159
4169
|
for (let s = t; s < e; s++)
|
|
4160
|
-
if (
|
|
4170
|
+
if (st(p.charCodeAt(s)))
|
|
4161
4171
|
return !0;
|
|
4162
4172
|
return !1;
|
|
4163
4173
|
}
|
|
@@ -4190,7 +4200,7 @@ function Ua() {
|
|
|
4190
4200
|
return !1;
|
|
4191
4201
|
}
|
|
4192
4202
|
}
|
|
4193
|
-
const
|
|
4203
|
+
const Ke = P`jsx`({
|
|
4194
4204
|
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
4195
4205
|
MissingClosingTagElement: ({
|
|
4196
4206
|
openingTagName: p
|
|
@@ -4208,13 +4218,13 @@ function Ua() {
|
|
|
4208
4218
|
function Ue(p) {
|
|
4209
4219
|
return p ? p.type === "JSXOpeningFragment" || p.type === "JSXClosingFragment" : !1;
|
|
4210
4220
|
}
|
|
4211
|
-
function
|
|
4221
|
+
function it(p) {
|
|
4212
4222
|
if (p.type === "JSXIdentifier")
|
|
4213
4223
|
return p.name;
|
|
4214
4224
|
if (p.type === "JSXNamespacedName")
|
|
4215
4225
|
return p.namespace.name + ":" + p.name.name;
|
|
4216
4226
|
if (p.type === "JSXMemberExpression")
|
|
4217
|
-
return
|
|
4227
|
+
return it(p.object) + "." + it(p.property);
|
|
4218
4228
|
throw new Error("Node had unexpected type: " + p.type);
|
|
4219
4229
|
}
|
|
4220
4230
|
var Mn = (p) => class extends p {
|
|
@@ -4222,7 +4232,7 @@ function Ua() {
|
|
|
4222
4232
|
let e = "", s = this.state.pos;
|
|
4223
4233
|
for (; ; ) {
|
|
4224
4234
|
if (this.state.pos >= this.length)
|
|
4225
|
-
throw this.raise(
|
|
4235
|
+
throw this.raise(Ke.UnterminatedJsxContent, this.state.startLoc);
|
|
4226
4236
|
const n = this.input.charCodeAt(this.state.pos);
|
|
4227
4237
|
switch (n) {
|
|
4228
4238
|
case 60:
|
|
@@ -4239,7 +4249,7 @@ function Ua() {
|
|
|
4239
4249
|
case 62:
|
|
4240
4250
|
case 125:
|
|
4241
4251
|
default:
|
|
4242
|
-
|
|
4252
|
+
st(n) ? (e += this.input.slice(s, this.state.pos), e += this.jsxReadNewLine(!0), s = this.state.pos) : ++this.state.pos;
|
|
4243
4253
|
}
|
|
4244
4254
|
}
|
|
4245
4255
|
}
|
|
@@ -4257,7 +4267,7 @@ function Ua() {
|
|
|
4257
4267
|
throw this.raise(m.UnterminatedString, this.state.startLoc);
|
|
4258
4268
|
const c = this.input.charCodeAt(this.state.pos);
|
|
4259
4269
|
if (c === e) break;
|
|
4260
|
-
c === 38 ? (s += this.input.slice(n, this.state.pos), s += this.jsxReadEntity(), n = this.state.pos) :
|
|
4270
|
+
c === 38 ? (s += this.input.slice(n, this.state.pos), s += this.jsxReadEntity(), n = this.state.pos) : st(c) ? (s += this.input.slice(n, this.state.pos), s += this.jsxReadNewLine(!1), n = this.state.pos) : ++this.state.pos;
|
|
4261
4271
|
}
|
|
4262
4272
|
s += this.input.slice(n, this.state.pos++), this.finishToken(134, s);
|
|
4263
4273
|
}
|
|
@@ -4287,7 +4297,7 @@ function Ua() {
|
|
|
4287
4297
|
const s = this.state.pos;
|
|
4288
4298
|
do
|
|
4289
4299
|
e = this.input.charCodeAt(++this.state.pos);
|
|
4290
|
-
while (
|
|
4300
|
+
while (tt(e) || e === 45);
|
|
4291
4301
|
this.finishToken(141, this.input.slice(s, this.state.pos));
|
|
4292
4302
|
}
|
|
4293
4303
|
jsxParseIdentifier() {
|
|
@@ -4315,12 +4325,12 @@ function Ua() {
|
|
|
4315
4325
|
let e;
|
|
4316
4326
|
switch (this.state.type) {
|
|
4317
4327
|
case 5:
|
|
4318
|
-
return e = this.startNode(), this.setContext(k.brace), this.next(), e = this.jsxParseExpressionContainer(e, k.j_oTag), e.expression.type === "JSXEmptyExpression" && this.raise(
|
|
4328
|
+
return e = this.startNode(), this.setContext(k.brace), this.next(), e = this.jsxParseExpressionContainer(e, k.j_oTag), e.expression.type === "JSXEmptyExpression" && this.raise(Ke.AttributeIsEmpty, e), e;
|
|
4319
4329
|
case 143:
|
|
4320
4330
|
case 134:
|
|
4321
4331
|
return this.parseExprAtom();
|
|
4322
4332
|
default:
|
|
4323
|
-
throw this.raise(
|
|
4333
|
+
throw this.raise(Ke.UnsupportedJsxValue, this.state.startLoc);
|
|
4324
4334
|
}
|
|
4325
4335
|
}
|
|
4326
4336
|
jsxParseEmptyExpression() {
|
|
@@ -4381,14 +4391,14 @@ function Ua() {
|
|
|
4381
4391
|
default:
|
|
4382
4392
|
this.unexpected();
|
|
4383
4393
|
}
|
|
4384
|
-
Ue(c) && !Ue(f) && f !== null ? this.raise(
|
|
4385
|
-
openingTagName:
|
|
4386
|
-
}) : !Ue(c) && !Ue(f) &&
|
|
4387
|
-
openingTagName:
|
|
4394
|
+
Ue(c) && !Ue(f) && f !== null ? this.raise(Ke.MissingClosingTagFragment, f) : !Ue(c) && Ue(f) ? this.raise(Ke.MissingClosingTagElement, f, {
|
|
4395
|
+
openingTagName: it(c.name)
|
|
4396
|
+
}) : !Ue(c) && !Ue(f) && it(f.name) !== it(c.name) && this.raise(Ke.MissingClosingTagElement, f, {
|
|
4397
|
+
openingTagName: it(c.name)
|
|
4388
4398
|
});
|
|
4389
4399
|
}
|
|
4390
4400
|
if (Ue(c) ? (s.openingFragment = c, s.closingFragment = f) : (s.openingElement = c, s.closingElement = f), s.children = n, this.match(47))
|
|
4391
|
-
throw this.raise(
|
|
4401
|
+
throw this.raise(Ke.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
4392
4402
|
return Ue(c) ? this.finishNode(s, "JSXFragment") : this.finishNode(s, "JSXElement");
|
|
4393
4403
|
}
|
|
4394
4404
|
jsxParseElement() {
|
|
@@ -4951,9 +4961,9 @@ function Ua() {
|
|
|
4951
4961
|
const te = p.charCodeAt(t);
|
|
4952
4962
|
let le;
|
|
4953
4963
|
if (te === 95 && y !== "bail") {
|
|
4954
|
-
const
|
|
4964
|
+
const Xe = p.charCodeAt(t - 1), qe = p.charCodeAt(t + 1);
|
|
4955
4965
|
if (y) {
|
|
4956
|
-
if (Number.isNaN(qe) || !$(qe) || F.has(
|
|
4966
|
+
if (Number.isNaN(qe) || !$(qe) || F.has(Xe) || F.has(qe)) {
|
|
4957
4967
|
if (E) return {
|
|
4958
4968
|
n: null,
|
|
4959
4969
|
pos: t
|
|
@@ -5153,7 +5163,7 @@ function Ua() {
|
|
|
5153
5163
|
this.isLookahead || (s = this.state.curPosition());
|
|
5154
5164
|
let n = this.input.charCodeAt(this.state.pos += t);
|
|
5155
5165
|
if (this.state.pos < this.length)
|
|
5156
|
-
for (; !
|
|
5166
|
+
for (; !st(n) && ++this.state.pos < this.length; )
|
|
5157
5167
|
n = this.input.charCodeAt(this.state.pos);
|
|
5158
5168
|
if (this.isLookahead) return;
|
|
5159
5169
|
const c = this.state.pos, y = {
|
|
@@ -5267,7 +5277,7 @@ function Ua() {
|
|
|
5267
5277
|
let t = this.input.charCodeAt(this.state.pos + 1);
|
|
5268
5278
|
if (t !== 33) return !1;
|
|
5269
5279
|
const e = this.state.pos;
|
|
5270
|
-
for (this.state.pos += 1; !
|
|
5280
|
+
for (this.state.pos += 1; !st(t) && ++this.state.pos < this.length; )
|
|
5271
5281
|
t = this.input.charCodeAt(this.state.pos);
|
|
5272
5282
|
const s = this.input.slice(e + 2, this.state.pos);
|
|
5273
5283
|
return this.finishToken(28, s), !0;
|
|
@@ -5521,7 +5531,7 @@ function Ua() {
|
|
|
5521
5531
|
if (c >= this.length)
|
|
5522
5532
|
throw this.raise(m.UnterminatedRegExp, r(t, 1));
|
|
5523
5533
|
const E = this.input.charCodeAt(c);
|
|
5524
|
-
if (
|
|
5534
|
+
if (st(E))
|
|
5525
5535
|
throw this.raise(m.UnterminatedRegExp, r(t, 1));
|
|
5526
5536
|
if (s)
|
|
5527
5537
|
s = !1;
|
|
@@ -5543,7 +5553,7 @@ function Ua() {
|
|
|
5543
5553
|
const E = this.codePointAtPos(c), C = String.fromCharCode(E);
|
|
5544
5554
|
if (zn.has(E))
|
|
5545
5555
|
E === 118 ? y.includes("u") && this.raise(m.IncompatibleRegExpUVFlags, x()) : E === 117 && y.includes("v") && this.raise(m.IncompatibleRegExpUVFlags, x()), y.includes(C) && this.raise(m.DuplicateRegExpFlags, x());
|
|
5546
|
-
else if (
|
|
5556
|
+
else if (tt(E) || E === 92)
|
|
5547
5557
|
this.raise(m.MalformedRegExpFlags, x());
|
|
5548
5558
|
else
|
|
5549
5559
|
break;
|
|
@@ -5655,11 +5665,11 @@ function Ua() {
|
|
|
5655
5665
|
let n = this.state.pos;
|
|
5656
5666
|
for (t !== void 0 && (this.state.pos += t <= 65535 ? 1 : 2); this.state.pos < this.length; ) {
|
|
5657
5667
|
const c = this.codePointAtPos(this.state.pos);
|
|
5658
|
-
if (
|
|
5668
|
+
if (tt(c))
|
|
5659
5669
|
this.state.pos += c <= 65535 ? 1 : 2;
|
|
5660
5670
|
else if (c === 92) {
|
|
5661
5671
|
this.state.containsEsc = !0, e += this.input.slice(n, this.state.pos);
|
|
5662
|
-
const f = this.state.curPosition(), y = this.state.pos === s ? _e :
|
|
5672
|
+
const f = this.state.curPosition(), y = this.state.pos === s ? _e : tt;
|
|
5663
5673
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
5664
5674
|
this.raise(m.MissingUnicodeEscape, this.state.curPosition()), n = this.state.pos - 1;
|
|
5665
5675
|
continue;
|
|
@@ -5884,7 +5894,7 @@ function Ua() {
|
|
|
5884
5894
|
isUnparsedContextual(t, e) {
|
|
5885
5895
|
if (this.input.startsWith(e, t)) {
|
|
5886
5896
|
const s = this.input.charCodeAt(t + e.length);
|
|
5887
|
-
return !(
|
|
5897
|
+
return !(tt(s) || (s & 64512) === 55296);
|
|
5888
5898
|
}
|
|
5889
5899
|
return !1;
|
|
5890
5900
|
}
|
|
@@ -7930,7 +7940,7 @@ function Ua() {
|
|
|
7930
7940
|
e[$] = E ? "type" : "value", C && this.eatContextual(93) && (e[f] = s ? this.parseIdentifier() : this.parseModuleExportName()), e[f] || (e[f] = this.cloneIdentifier(e[c])), s && this.checkIdentifier(e[f], E ? 4098 : 4096);
|
|
7931
7941
|
}
|
|
7932
7942
|
fillOptionalPropertiesForTSESLint(e) {
|
|
7933
|
-
var s, n, c, f, y, x, E, C, F, $, W, K, ee, fe, te, le,
|
|
7943
|
+
var s, n, c, f, y, x, E, C, F, $, W, K, ee, fe, te, le, Xe, qe, bi, Pi, Ti, Si, Ei, Ai, wi, vi, Ci, Ii, Ni, ki, Li, Oi, Di, Mi, Fi, Bi, _i, ji, Ri, Ui, $i, Vi, qi, zi, Wi, Ji;
|
|
7934
7944
|
switch (e.type) {
|
|
7935
7945
|
case "ExpressionStatement":
|
|
7936
7946
|
(s = e.directive) != null || (e.directive = void 0);
|
|
@@ -7962,7 +7972,7 @@ function Ua() {
|
|
|
7962
7972
|
case "TSPropertySignature":
|
|
7963
7973
|
(fe = e.optional) != null || (e.optional = !1);
|
|
7964
7974
|
case "TSIndexSignature":
|
|
7965
|
-
(te = e.accessibility) != null || (e.accessibility = void 0), (le = e.readonly) != null || (e.readonly = !1), (
|
|
7975
|
+
(te = e.accessibility) != null || (e.accessibility = void 0), (le = e.readonly) != null || (e.readonly = !1), (Xe = e.static) != null || (e.static = !1);
|
|
7966
7976
|
return;
|
|
7967
7977
|
case "TSAbstractPropertyDefinition":
|
|
7968
7978
|
case "PropertyDefinition":
|
|
@@ -9114,7 +9124,7 @@ function Ua() {
|
|
|
9114
9124
|
type: n
|
|
9115
9125
|
} = this.state;
|
|
9116
9126
|
Se(n) ? e = this.state.value : this.unexpected();
|
|
9117
|
-
const c =
|
|
9127
|
+
const c = He(n);
|
|
9118
9128
|
return t ? c && this.replaceToken(132) : this.checkReservedWord(e, s, c, !1), this.next(), e;
|
|
9119
9129
|
}
|
|
9120
9130
|
checkReservedWord(t, e, s, n) {
|
|
@@ -9490,7 +9500,7 @@ function Ua() {
|
|
|
9490
9500
|
if (_e(t)) {
|
|
9491
9501
|
if (bs.lastIndex = e, bs.test(this.input)) {
|
|
9492
9502
|
const s = this.codePointAtPos(bs.lastIndex);
|
|
9493
|
-
if (!
|
|
9503
|
+
if (!tt(s) && s !== 92)
|
|
9494
9504
|
return !1;
|
|
9495
9505
|
}
|
|
9496
9506
|
return !0;
|
|
@@ -10453,7 +10463,7 @@ function Ua() {
|
|
|
10453
10463
|
t[e] = Be(p[e]);
|
|
10454
10464
|
return t;
|
|
10455
10465
|
}
|
|
10456
|
-
const Pa = ba(
|
|
10466
|
+
const Pa = ba(et);
|
|
10457
10467
|
function mt(p, t) {
|
|
10458
10468
|
let e = gi;
|
|
10459
10469
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -10481,7 +10491,7 @@ function Ua() {
|
|
|
10481
10491
|
}
|
|
10482
10492
|
return s;
|
|
10483
10493
|
}
|
|
10484
|
-
return
|
|
10494
|
+
return rt.parse = ga, rt.parseExpression = xa, rt.tokTypes = Pa, rt;
|
|
10485
10495
|
}
|
|
10486
10496
|
var $a = Ua();
|
|
10487
10497
|
function we(a) {
|
|
@@ -10769,22 +10779,22 @@ function pe(a) {
|
|
|
10769
10779
|
var Q = this.allFields;
|
|
10770
10780
|
if (!ve.call(Q, ne))
|
|
10771
10781
|
throw new Error("" + ne);
|
|
10772
|
-
var
|
|
10782
|
+
var et = Q[ne], se = et.type, He;
|
|
10773
10783
|
if (J)
|
|
10774
|
-
|
|
10775
|
-
else if (
|
|
10776
|
-
|
|
10784
|
+
He = oe;
|
|
10785
|
+
else if (et.defaultFn)
|
|
10786
|
+
He = et.defaultFn.call(re);
|
|
10777
10787
|
else {
|
|
10778
10788
|
var Se = "no value or default function given for field " + JSON.stringify(ne) + " of " + this.typeName + "(" + this.buildParams.map(function(Mt) {
|
|
10779
10789
|
return Q[Mt];
|
|
10780
10790
|
}).join(", ") + ")";
|
|
10781
10791
|
throw new Error(Se);
|
|
10782
10792
|
}
|
|
10783
|
-
if (!se.check(
|
|
10793
|
+
if (!se.check(He))
|
|
10784
10794
|
throw new Error(
|
|
10785
|
-
$s(
|
|
10795
|
+
$s(He) + " does not match field " + et + " of type " + this.typeName
|
|
10786
10796
|
);
|
|
10787
|
-
re[ne] =
|
|
10797
|
+
re[ne] = He;
|
|
10788
10798
|
}
|
|
10789
10799
|
}, Y = (...re) => {
|
|
10790
10800
|
var ne = re.length;
|
|
@@ -11137,7 +11147,7 @@ function Cr(a) {
|
|
|
11137
11147
|
}, o;
|
|
11138
11148
|
}
|
|
11139
11149
|
ae(() => module);
|
|
11140
|
-
var
|
|
11150
|
+
var nt = Object.prototype.hasOwnProperty;
|
|
11141
11151
|
function Wa(a) {
|
|
11142
11152
|
var l = a.use(pe), i = l.Type, r = l.namedTypes, o = r.Node, u = r.Expression, h = l.builtInTypes.array, d = l.builders;
|
|
11143
11153
|
const g = function D(B, R) {
|
|
@@ -11187,9 +11197,9 @@ function Wa(a) {
|
|
|
11187
11197
|
};
|
|
11188
11198
|
var v = g.prototype;
|
|
11189
11199
|
v.didScan = !1, v.declares = function(D) {
|
|
11190
|
-
return this.scan(),
|
|
11200
|
+
return this.scan(), nt.call(this.bindings, D);
|
|
11191
11201
|
}, v.declaresType = function(D) {
|
|
11192
|
-
return this.scan(),
|
|
11202
|
+
return this.scan(), nt.call(this.types, D);
|
|
11193
11203
|
}, v.declareTemporary = function(D) {
|
|
11194
11204
|
if (D) {
|
|
11195
11205
|
if (!/^[a-z$_]/i.test(D))
|
|
@@ -11267,7 +11277,7 @@ function Wa(a) {
|
|
|
11267
11277
|
else if (b.check(q)) {
|
|
11268
11278
|
if (r.CatchClause.check(q) && // TODO Broaden this to accept any pattern.
|
|
11269
11279
|
r.Identifier.check(q.param)) {
|
|
11270
|
-
var M = q.param.name, k =
|
|
11280
|
+
var M = q.param.name, k = nt.call(B, M);
|
|
11271
11281
|
T(D.get("body"), B, R), k || delete B[M];
|
|
11272
11282
|
}
|
|
11273
11283
|
} else
|
|
@@ -11275,7 +11285,7 @@ function Wa(a) {
|
|
|
11275
11285
|
}
|
|
11276
11286
|
function m(D, B) {
|
|
11277
11287
|
var R = D.value;
|
|
11278
|
-
r.Pattern.assert(R), r.Identifier.check(R) ?
|
|
11288
|
+
r.Pattern.assert(R), r.Identifier.check(R) ? nt.call(B, R.name) ? B[R.name].push(D) : B[R.name] = [D] : r.AssignmentPattern && r.AssignmentPattern.check(R) ? m(D.get("left"), B) : r.ObjectPattern && r.ObjectPattern.check(R) ? D.get("properties").each(function(q) {
|
|
11279
11289
|
var M = q.value;
|
|
11280
11290
|
r.Pattern.check(M) ? m(q, B) : r.Property.check(M) || r.ObjectProperty && r.ObjectProperty.check(M) ? m(q.get("value"), B) : r.SpreadProperty && r.SpreadProperty.check(M) && m(q.get("argument"), B);
|
|
11281
11291
|
}) : r.ArrayPattern && r.ArrayPattern.check(R) ? D.get("elements").each(function(q) {
|
|
@@ -11285,11 +11295,11 @@ function Wa(a) {
|
|
|
11285
11295
|
}
|
|
11286
11296
|
function O(D, B) {
|
|
11287
11297
|
var R = D.value;
|
|
11288
|
-
r.Pattern.assert(R), r.Identifier.check(R) && (
|
|
11298
|
+
r.Pattern.assert(R), r.Identifier.check(R) && (nt.call(B, R.name) ? B[R.name].push(D) : B[R.name] = [D]);
|
|
11289
11299
|
}
|
|
11290
11300
|
function U(D, B) {
|
|
11291
11301
|
var R = D.value;
|
|
11292
|
-
w.assert(R),
|
|
11302
|
+
w.assert(R), nt.call(B, R.name) ? B[R.name].push(D) : B[R.name] = [D];
|
|
11293
11303
|
}
|
|
11294
11304
|
return v.lookup = function(D) {
|
|
11295
11305
|
for (var B = this; B && !B.declares(D); B = B.parent)
|
|
@@ -12682,7 +12692,7 @@ function go(...a) {
|
|
|
12682
12692
|
function ie(a, l) {
|
|
12683
12693
|
return a.line - l.line || a.column - l.column;
|
|
12684
12694
|
}
|
|
12685
|
-
function
|
|
12695
|
+
function Je(a) {
|
|
12686
12696
|
return {
|
|
12687
12697
|
line: a.line,
|
|
12688
12698
|
column: a.column
|
|
@@ -12707,7 +12717,7 @@ function xo(a, l) {
|
|
|
12707
12717
|
return;
|
|
12708
12718
|
o.addMapping({
|
|
12709
12719
|
source: g,
|
|
12710
|
-
original:
|
|
12720
|
+
original: Je(d),
|
|
12711
12721
|
generated: {
|
|
12712
12722
|
line: h.generatedLine,
|
|
12713
12723
|
column: h.generatedColumn
|
|
@@ -12728,7 +12738,7 @@ function Br(a, l) {
|
|
|
12728
12738
|
function r(o) {
|
|
12729
12739
|
Os(i, o.loc);
|
|
12730
12740
|
}
|
|
12731
|
-
return a.declaration && a.declaration.decorators && rs(a) && a.declaration.decorators.forEach(r), ie(i.start, i.end) < 0 && (i.start =
|
|
12741
|
+
return a.declaration && a.declaration.decorators && rs(a) && a.declaration.decorators.forEach(r), ie(i.start, i.end) < 0 && (i.start = Je(i.start), l.skipSpaces(i.start, !1, !0), ie(i.start, i.end) < 0 && (i.end = Je(i.end), l.skipSpaces(i.end, !0, !0))), a.comments && a.comments.forEach(r), i;
|
|
12732
12742
|
}
|
|
12733
12743
|
function Os(a, l) {
|
|
12734
12744
|
a && l && (ie(l.start, a.start) < 0 && (a.start = l.start), ie(a.end, l.end) < 0 && (a.end = l.end));
|
|
@@ -12750,14 +12760,14 @@ function Vs(a, l) {
|
|
|
12750
12760
|
else if (a.type === "ObjectTypeProperty") {
|
|
12751
12761
|
const r = a.loc;
|
|
12752
12762
|
let o = r && r.end;
|
|
12753
|
-
o && (o =
|
|
12763
|
+
o && (o = Je(o), l.prevPos(o) && l.charAt(o) === "," && (o = l.skipSpaces(o, !0, !0)) && (r.end = o));
|
|
12754
12764
|
}
|
|
12755
12765
|
}
|
|
12756
12766
|
function bo(a, l) {
|
|
12757
12767
|
if (a.type !== "ForStatement")
|
|
12758
12768
|
return;
|
|
12759
12769
|
function i(r) {
|
|
12760
|
-
const o = r && r.loc, u = o && o.start, h = o &&
|
|
12770
|
+
const o = r && r.loc, u = o && o.start, h = o && Je(o.end);
|
|
12761
12771
|
for (; u && h && ie(u, h) < 0 && (l.prevPos(h), l.charAt(h) === ";"); )
|
|
12762
12772
|
o.end.line = h.line, o.end.column = h.column;
|
|
12763
12773
|
}
|
|
@@ -12766,9 +12776,9 @@ function bo(a, l) {
|
|
|
12766
12776
|
function Po(a, l) {
|
|
12767
12777
|
if (a.type === "TemplateLiteral" && a.quasis.length !== 0) {
|
|
12768
12778
|
if (a.loc) {
|
|
12769
|
-
const i =
|
|
12779
|
+
const i = Je(a.loc.start), r = a.quasis[0];
|
|
12770
12780
|
ie(r.loc.start, i) < 0 && (r.loc.start = i);
|
|
12771
|
-
const o =
|
|
12781
|
+
const o = Je(a.loc.end), u = a.quasis[a.quasis.length - 1];
|
|
12772
12782
|
ie(o, u.loc.end) < 0 && (u.loc.end = o);
|
|
12773
12783
|
}
|
|
12774
12784
|
a.expressions.forEach(function(i, r) {
|
|
@@ -12854,7 +12864,7 @@ function ns(a) {
|
|
|
12854
12864
|
tokens: !!i("tokens")
|
|
12855
12865
|
};
|
|
12856
12866
|
}
|
|
12857
|
-
class
|
|
12867
|
+
class ut {
|
|
12858
12868
|
constructor(l, i, r = i) {
|
|
12859
12869
|
this.sourceLines = l, this.sourceLoc = i, this.targetLoc = r;
|
|
12860
12870
|
}
|
|
@@ -12908,16 +12918,16 @@ class ct {
|
|
|
12908
12918
|
end: ze(r, i.line, i.column)
|
|
12909
12919
|
});
|
|
12910
12920
|
}
|
|
12911
|
-
return new
|
|
12921
|
+
return new ut(this.sourceLines, u, h);
|
|
12912
12922
|
}
|
|
12913
12923
|
add(l, i) {
|
|
12914
|
-
return new
|
|
12924
|
+
return new ut(this.sourceLines, this.sourceLoc, {
|
|
12915
12925
|
start: hr(this.targetLoc.start, l, i),
|
|
12916
12926
|
end: hr(this.targetLoc.end, l, i)
|
|
12917
12927
|
});
|
|
12918
12928
|
}
|
|
12919
12929
|
subtract(l, i) {
|
|
12920
|
-
return new
|
|
12930
|
+
return new ut(this.sourceLines, this.sourceLoc, {
|
|
12921
12931
|
start: ze(this.targetLoc.start, l, i),
|
|
12922
12932
|
end: ze(this.targetLoc.end, l, i)
|
|
12923
12933
|
});
|
|
@@ -12946,7 +12956,7 @@ class ct {
|
|
|
12946
12956
|
column: r ? Math.max(0, d) : d
|
|
12947
12957
|
};
|
|
12948
12958
|
}
|
|
12949
|
-
return new
|
|
12959
|
+
return new ut(this.sourceLines, this.sourceLoc, o);
|
|
12950
12960
|
}
|
|
12951
12961
|
}
|
|
12952
12962
|
function hr(a, l, i) {
|
|
@@ -12983,7 +12993,7 @@ var Eo = Object.defineProperty, Ao = (a, l, i) => l in a ? Eo(a, l, { enumerable
|
|
|
12983
12993
|
class ke {
|
|
12984
12994
|
constructor(l, i = null) {
|
|
12985
12995
|
this.infos = l, bt(this, "length"), bt(this, "name"), bt(this, "mappings", []), bt(this, "cachedSourceMap", null), bt(this, "cachedTabWidth"), this.length = l.length, this.name = i || null, this.name && this.mappings.push(
|
|
12986
|
-
new
|
|
12996
|
+
new ut(this, {
|
|
12987
12997
|
start: this.firstPos(),
|
|
12988
12998
|
end: this.lastPos()
|
|
12989
12999
|
})
|
|
@@ -13111,7 +13121,7 @@ class ke {
|
|
|
13111
13121
|
let i = 0;
|
|
13112
13122
|
for (let u = 1, h = this.length; u <= h; ++u) {
|
|
13113
13123
|
const d = this.infos[u - 1], g = d.line.slice(d.sliceStart, d.sliceEnd);
|
|
13114
|
-
if (
|
|
13124
|
+
if (at(g))
|
|
13115
13125
|
continue;
|
|
13116
13126
|
const b = Math.abs(d.indent - i);
|
|
13117
13127
|
l[b] = ~~l[b] + 1, i = d.indent;
|
|
@@ -13131,14 +13141,14 @@ class ke {
|
|
|
13131
13141
|
return o.length === 0 || o.slice(0, 2) === "//" || o.slice(0, 2) === "/*";
|
|
13132
13142
|
}
|
|
13133
13143
|
isOnlyWhitespace() {
|
|
13134
|
-
return
|
|
13144
|
+
return at(this.toString());
|
|
13135
13145
|
}
|
|
13136
13146
|
isPrecededOnlyByWhitespace(l) {
|
|
13137
13147
|
const i = this.infos[l.line - 1], r = Math.max(i.indent, 0), o = l.column - r;
|
|
13138
13148
|
if (o <= 0)
|
|
13139
13149
|
return !0;
|
|
13140
13150
|
const u = i.sliceStart, h = Math.min(u + o, i.sliceEnd), d = i.line.slice(u, h);
|
|
13141
|
-
return
|
|
13151
|
+
return at(d);
|
|
13142
13152
|
}
|
|
13143
13153
|
getLineLength(l) {
|
|
13144
13154
|
const i = this.infos[l - 1];
|
|
@@ -13173,11 +13183,11 @@ class ke {
|
|
|
13173
13183
|
column: l.column
|
|
13174
13184
|
} : i ? l = this.lastPos() : l = this.firstPos(), i) {
|
|
13175
13185
|
for (; this.prevPos(l); )
|
|
13176
|
-
if (!
|
|
13186
|
+
if (!at(this.charAt(l)) && this.nextPos(l))
|
|
13177
13187
|
return l;
|
|
13178
13188
|
return null;
|
|
13179
13189
|
} else {
|
|
13180
|
-
for (;
|
|
13190
|
+
for (; at(this.charAt(l)); )
|
|
13181
13191
|
if (!this.nextPos(l))
|
|
13182
13192
|
return null;
|
|
13183
13193
|
return l;
|
|
@@ -13185,18 +13195,18 @@ class ke {
|
|
|
13185
13195
|
}
|
|
13186
13196
|
trimLeft() {
|
|
13187
13197
|
const l = this.skipSpaces(this.firstPos(), !1, !0);
|
|
13188
|
-
return l ? this.slice(l) :
|
|
13198
|
+
return l ? this.slice(l) : Qe;
|
|
13189
13199
|
}
|
|
13190
13200
|
trimRight() {
|
|
13191
13201
|
const l = this.skipSpaces(this.lastPos(), !0, !0);
|
|
13192
|
-
return l ? this.slice(this.firstPos(), l) :
|
|
13202
|
+
return l ? this.slice(this.firstPos(), l) : Qe;
|
|
13193
13203
|
}
|
|
13194
13204
|
trim() {
|
|
13195
13205
|
const l = this.skipSpaces(this.firstPos(), !1, !0);
|
|
13196
13206
|
if (l === null)
|
|
13197
|
-
return
|
|
13207
|
+
return Qe;
|
|
13198
13208
|
const i = this.skipSpaces(this.lastPos(), !0, !0);
|
|
13199
|
-
return i === null ?
|
|
13209
|
+
return i === null ? Qe : this.slice(l, i);
|
|
13200
13210
|
}
|
|
13201
13211
|
eachPos(l, i = this.firstPos(), r = !1) {
|
|
13202
13212
|
const o = this.firstPos();
|
|
@@ -13219,7 +13229,7 @@ class ke {
|
|
|
13219
13229
|
if (!l)
|
|
13220
13230
|
throw new Error("cannot slice with end but not start");
|
|
13221
13231
|
const r = this.infos.slice(l.line - 1, i.line);
|
|
13222
|
-
l.line === i.line ? r[0] =
|
|
13232
|
+
l.line === i.line ? r[0] = ot(r[0], l.column, i.column) : (r[0] = ot(r[0], l.column), r.push(ot(r.pop(), 0, i.column)));
|
|
13223
13233
|
const o = new ke(r);
|
|
13224
13234
|
if (this.mappings.length > 0) {
|
|
13225
13235
|
const u = o.mappings;
|
|
@@ -13237,9 +13247,9 @@ class ke {
|
|
|
13237
13247
|
const { tabWidth: o, useTabs: u, reuseWhitespace: h, lineTerminator: d } = ns(r), g = [];
|
|
13238
13248
|
for (let b = l.line; b <= i.line; ++b) {
|
|
13239
13249
|
let S = this.infos[b - 1];
|
|
13240
|
-
b === l.line ? b === i.line ? S =
|
|
13250
|
+
b === l.line ? b === i.line ? S = ot(S, l.column, i.column) : S = ot(S, l.column) : b === i.line && (S = ot(S, 0, i.column));
|
|
13241
13251
|
const w = Math.max(S.indent, 0), v = S.line.slice(0, S.sliceStart);
|
|
13242
|
-
if (h &&
|
|
13252
|
+
if (h && at(v) && jr(v, o) === w) {
|
|
13243
13253
|
g.push(S.line.slice(0, S.sliceEnd));
|
|
13244
13254
|
continue;
|
|
13245
13255
|
}
|
|
@@ -13278,13 +13288,13 @@ class ke {
|
|
|
13278
13288
|
}).forEach((b, S) => {
|
|
13279
13289
|
i.isEmpty() ? h(b) : d(b, S);
|
|
13280
13290
|
}), r.length < 1)
|
|
13281
|
-
return
|
|
13291
|
+
return Qe;
|
|
13282
13292
|
const g = new ke(r);
|
|
13283
13293
|
return g.mappings = o, g;
|
|
13284
13294
|
}
|
|
13285
13295
|
concat(...l) {
|
|
13286
13296
|
const i = [this];
|
|
13287
|
-
return i.push.apply(i, l),
|
|
13297
|
+
return i.push.apply(i, l), Qe.join(i);
|
|
13288
13298
|
}
|
|
13289
13299
|
}
|
|
13290
13300
|
const Qt = {}, Ms = Qt.hasOwnProperty, wo = 10;
|
|
@@ -13334,10 +13344,10 @@ function j(a, l) {
|
|
|
13334
13344
|
);
|
|
13335
13345
|
return o && (Qt[a] = u), u;
|
|
13336
13346
|
}
|
|
13337
|
-
function
|
|
13347
|
+
function at(a) {
|
|
13338
13348
|
return !/\S/.test(a);
|
|
13339
13349
|
}
|
|
13340
|
-
function
|
|
13350
|
+
function ot(a, l, i) {
|
|
13341
13351
|
let r = a.sliceStart, o = a.sliceEnd, u = Math.max(a.indent, 0), h = u + o - r;
|
|
13342
13352
|
return typeof i > "u" && (i = h), l = Math.max(l, 0), i = Math.min(i, h), i = Math.max(i, l), i < u ? (u = i, o = r) : o -= h - i, h = i, h -= l, l < u ? u -= l : (l -= u, u = 0, r += l), a.indent === u && a.sliceStart === r && a.sliceEnd === o ? a : {
|
|
13343
13353
|
line: a.line,
|
|
@@ -13349,9 +13359,9 @@ function at(a, l, i) {
|
|
|
13349
13359
|
};
|
|
13350
13360
|
}
|
|
13351
13361
|
function L(a) {
|
|
13352
|
-
return
|
|
13362
|
+
return Qe.join(a);
|
|
13353
13363
|
}
|
|
13354
|
-
const
|
|
13364
|
+
const Qe = j(""), ht = Oe, Rr = De.array, Co = De.object, pr = /* @__PURE__ */ new WeakMap();
|
|
13355
13365
|
function Ur(a, l, i) {
|
|
13356
13366
|
if (!a)
|
|
13357
13367
|
return i;
|
|
@@ -13974,7 +13984,7 @@ function $o(a) {
|
|
|
13974
13984
|
};
|
|
13975
13985
|
}
|
|
13976
13986
|
function Vo(a, l, i) {
|
|
13977
|
-
const r =
|
|
13987
|
+
const r = Je(l.start), o = a.prevPos(r) && a.charAt(r), u = i.charAt(i.firstPos());
|
|
13978
13988
|
return o && es.test(o) && u && es.test(u);
|
|
13979
13989
|
}
|
|
13980
13990
|
function qo(a, l, i) {
|
|
@@ -14177,7 +14187,7 @@ function Xo(a, l, i) {
|
|
|
14177
14187
|
`);
|
|
14178
14188
|
}, "directives"), r.interpreter && o.push(a.call(i, "interpreter")), o.push(
|
|
14179
14189
|
a.call(
|
|
14180
|
-
(u) =>
|
|
14190
|
+
(u) => lt(u, l, i),
|
|
14181
14191
|
"body"
|
|
14182
14192
|
)
|
|
14183
14193
|
), L(o);
|
|
@@ -14334,7 +14344,7 @@ function Xo(a, l, i) {
|
|
|
14334
14344
|
o.push("static ");
|
|
14335
14345
|
case "BlockStatement": {
|
|
14336
14346
|
const u = a.call(
|
|
14337
|
-
(h) =>
|
|
14347
|
+
(h) => lt(h, l, i),
|
|
14338
14348
|
"body"
|
|
14339
14349
|
);
|
|
14340
14350
|
return u.isEmpty() && (!r.directives || r.directives.length === 0) ? (o.push("{}"), L(o)) : (o.push(`{
|
|
@@ -14446,28 +14456,28 @@ function Xo(a, l, i) {
|
|
|
14446
14456
|
return j("null");
|
|
14447
14457
|
case "RegExpLiteral":
|
|
14448
14458
|
return j(
|
|
14449
|
-
|
|
14459
|
+
ct(r) || `/${r.pattern}/${r.flags || ""}`,
|
|
14450
14460
|
l
|
|
14451
14461
|
);
|
|
14452
14462
|
case "BigIntLiteral":
|
|
14453
|
-
return j(
|
|
14463
|
+
return j(ct(r) || r.value + "n", l);
|
|
14454
14464
|
case "NumericLiteral":
|
|
14455
|
-
return j(
|
|
14465
|
+
return j(ct(r) || r.value, l);
|
|
14456
14466
|
case "DecimalLiteral":
|
|
14457
|
-
return j(
|
|
14467
|
+
return j(ct(r) || r.value + "m", l);
|
|
14458
14468
|
case "StringLiteral":
|
|
14459
14469
|
return j(Et(r.value, l));
|
|
14460
14470
|
case "BooleanLiteral":
|
|
14461
14471
|
case "Literal":
|
|
14462
14472
|
return j(
|
|
14463
|
-
|
|
14473
|
+
ct(r) || (typeof r.value == "string" ? Et(r.value, l) : r.value),
|
|
14464
14474
|
l
|
|
14465
14475
|
);
|
|
14466
14476
|
case "Directive":
|
|
14467
14477
|
return a.call(i, "value");
|
|
14468
14478
|
case "DirectiveLiteral":
|
|
14469
14479
|
return j(
|
|
14470
|
-
|
|
14480
|
+
ct(r) || Et(r.value, l),
|
|
14471
14481
|
l
|
|
14472
14482
|
);
|
|
14473
14483
|
case "InterpreterDirective":
|
|
@@ -14518,17 +14528,17 @@ function Xo(a, l, i) {
|
|
|
14518
14528
|
a.call(i, "body")
|
|
14519
14529
|
]);
|
|
14520
14530
|
case "IfStatement": {
|
|
14521
|
-
const u =
|
|
14531
|
+
const u = Ge(a.call(i, "consequent"), l);
|
|
14522
14532
|
return o.push("if (", a.call(i, "test"), ")", u), r.alternate && o.push(
|
|
14523
14533
|
Tr(u) ? " else" : `
|
|
14524
14534
|
else`,
|
|
14525
|
-
|
|
14535
|
+
Ge(a.call(i, "alternate"), l)
|
|
14526
14536
|
), L(o);
|
|
14527
14537
|
}
|
|
14528
14538
|
case "ForStatement": {
|
|
14529
14539
|
const u = a.call(i, "init"), h = u.length > 1 ? `;
|
|
14530
14540
|
` : "; ", d = "for (", g = j(h).join([u, a.call(i, "test"), a.call(i, "update")]).indentTail(d.length), b = L([d, g, ")"]);
|
|
14531
|
-
let S =
|
|
14541
|
+
let S = Ge(a.call(i, "body"), l);
|
|
14532
14542
|
return o.push(b), b.length > 1 && (o.push(`
|
|
14533
14543
|
`), S = S.trimLeft()), o.push(S), L(o);
|
|
14534
14544
|
}
|
|
@@ -14537,7 +14547,7 @@ else`,
|
|
|
14537
14547
|
"while (",
|
|
14538
14548
|
a.call(i, "test"),
|
|
14539
14549
|
")",
|
|
14540
|
-
|
|
14550
|
+
Ge(a.call(i, "body"), l)
|
|
14541
14551
|
]);
|
|
14542
14552
|
case "ForInStatement":
|
|
14543
14553
|
return L([
|
|
@@ -14546,7 +14556,7 @@ else`,
|
|
|
14546
14556
|
" in ",
|
|
14547
14557
|
a.call(i, "right"),
|
|
14548
14558
|
")",
|
|
14549
|
-
|
|
14559
|
+
Ge(a.call(i, "body"), l)
|
|
14550
14560
|
]);
|
|
14551
14561
|
case "ForOfStatement":
|
|
14552
14562
|
case "ForAwaitStatement":
|
|
@@ -14556,19 +14566,19 @@ else`,
|
|
|
14556
14566
|
" of ",
|
|
14557
14567
|
a.call(i, "right"),
|
|
14558
14568
|
")",
|
|
14559
|
-
|
|
14569
|
+
Ge(a.call(i, "body"), l)
|
|
14560
14570
|
), L(o);
|
|
14561
14571
|
case "DoWhileStatement": {
|
|
14562
14572
|
const u = L([
|
|
14563
14573
|
"do",
|
|
14564
|
-
|
|
14574
|
+
Ge(a.call(i, "body"), l)
|
|
14565
14575
|
]);
|
|
14566
14576
|
return o.push(u), Tr(u) ? o.push(" while") : o.push(`
|
|
14567
14577
|
while`), o.push(" (", a.call(i, "test"), ");"), L(o);
|
|
14568
14578
|
}
|
|
14569
14579
|
case "DoExpression": {
|
|
14570
14580
|
const u = a.call(
|
|
14571
|
-
(h) =>
|
|
14581
|
+
(h) => lt(h, l, i),
|
|
14572
14582
|
"body"
|
|
14573
14583
|
);
|
|
14574
14584
|
return L([`do {
|
|
@@ -14610,7 +14620,7 @@ while`), o.push(" (", a.call(i, "test"), ");"), L(o);
|
|
|
14610
14620
|
`
|
|
14611
14621
|
`,
|
|
14612
14622
|
a.call(
|
|
14613
|
-
(u) =>
|
|
14623
|
+
(u) => lt(u, l, i),
|
|
14614
14624
|
"consequent"
|
|
14615
14625
|
).indent(l.tabWidth)
|
|
14616
14626
|
), L(o);
|
|
@@ -14689,7 +14699,7 @@ while`), o.push(" (", a.call(i, "test"), ");"), L(o);
|
|
|
14689
14699
|
`{
|
|
14690
14700
|
`,
|
|
14691
14701
|
a.call(
|
|
14692
|
-
(u) =>
|
|
14702
|
+
(u) => lt(u, l, i),
|
|
14693
14703
|
"body"
|
|
14694
14704
|
).indent(l.tabWidth),
|
|
14695
14705
|
`
|
|
@@ -15267,7 +15277,7 @@ while`), o.push(" (", a.call(i, "test"), ");"), L(o);
|
|
|
15267
15277
|
return a.getParentNode().type === "TSModuleDeclaration" ? o.push(".") : (r.declare && o.push("declare "), r.global || (r.id.type === "StringLiteral" || r.id.type === "Literal" && typeof r.id.value == "string" || r.loc && r.loc.lines && r.id.loc && r.loc.lines.sliceString(r.loc.start, r.id.loc.start).indexOf("module") >= 0 ? o.push("module ") : o.push("namespace "))), o.push(a.call(i, "id")), r.body && (o.push(" "), o.push(a.call(i, "body"))), L(o);
|
|
15268
15278
|
case "TSModuleBlock": {
|
|
15269
15279
|
const u = a.call(
|
|
15270
|
-
(h) =>
|
|
15280
|
+
(h) => lt(h, l, i),
|
|
15271
15281
|
"body"
|
|
15272
15282
|
);
|
|
15273
15283
|
return u.isEmpty() ? o.push("{}") : o.push(`{
|
|
@@ -15332,7 +15342,7 @@ function Go(a, l) {
|
|
|
15332
15342
|
"decorators"
|
|
15333
15343
|
), L(i);
|
|
15334
15344
|
}
|
|
15335
|
-
function
|
|
15345
|
+
function lt(a, l, i) {
|
|
15336
15346
|
const r = [];
|
|
15337
15347
|
a.each(function(d) {
|
|
15338
15348
|
const g = d.getValue();
|
|
@@ -15505,7 +15515,7 @@ function St(a, l) {
|
|
|
15505
15515
|
return r ? r === "plus" ? j("+") : r === "minus" ? j("-") : l(i) : j("");
|
|
15506
15516
|
}, "variance");
|
|
15507
15517
|
}
|
|
15508
|
-
function
|
|
15518
|
+
function Ge(a, l) {
|
|
15509
15519
|
return a.length > 1 ? L([" ", a]) : L([`
|
|
15510
15520
|
`, Yt(a).indent(l.tabWidth)]);
|
|
15511
15521
|
}
|
|
@@ -15523,7 +15533,7 @@ function Tr(a) {
|
|
|
15523
15533
|
function Kt(a) {
|
|
15524
15534
|
return a.replace(/['"]/g, (l) => l === '"' ? "'" : '"');
|
|
15525
15535
|
}
|
|
15526
|
-
function
|
|
15536
|
+
function ct(a) {
|
|
15527
15537
|
const l = je(a, "value"), i = je(a, "extra");
|
|
15528
15538
|
if (i && typeof i.raw == "string" && l == i.rawValue)
|
|
15529
15539
|
return i.raw;
|
|
@@ -16333,10 +16343,10 @@ function sn(a, l) {
|
|
|
16333
16343
|
}
|
|
16334
16344
|
}
|
|
16335
16345
|
async function Bl(a, l, i = !1, r = "") {
|
|
16336
|
-
if (i || await
|
|
16346
|
+
if (i || await Ze(
|
|
16337
16347
|
r || `This will update '${a}' file. Continue?`
|
|
16338
16348
|
)) {
|
|
16339
|
-
const u =
|
|
16349
|
+
const u = Ye(process.cwd(), a), h = await Sl(u);
|
|
16340
16350
|
let d = h.exports?.default;
|
|
16341
16351
|
if (!d) {
|
|
16342
16352
|
const w = Object.keys(h.exports);
|
|
@@ -16361,11 +16371,11 @@ async function Bl(a, l, i = !1, r = "") {
|
|
|
16361
16371
|
console.log(`Updating '${a}' skipped.`);
|
|
16362
16372
|
}
|
|
16363
16373
|
async function _l(a, l, i, r = !1, o = "") {
|
|
16364
|
-
if (r || await
|
|
16374
|
+
if (r || await Ze(
|
|
16365
16375
|
o || `This will update '${a}' file. Continue?`
|
|
16366
16376
|
)) {
|
|
16367
|
-
const h =
|
|
16368
|
-
if (!
|
|
16377
|
+
const h = Ye(process.cwd(), a);
|
|
16378
|
+
if (!We(h))
|
|
16369
16379
|
throw new Error(`No '${a}' found in project root — skipping updates.`);
|
|
16370
16380
|
const d = ss(h, "utf8");
|
|
16371
16381
|
let g;
|
|
@@ -16385,11 +16395,11 @@ ${S}`);
|
|
|
16385
16395
|
console.log(`Updating '${a}' skipped.`);
|
|
16386
16396
|
}
|
|
16387
16397
|
async function jl(a, l, i = !1, r = "") {
|
|
16388
|
-
if (i || await
|
|
16398
|
+
if (i || await Ze(
|
|
16389
16399
|
r || `This will update '${a}' file. Continue?`
|
|
16390
16400
|
)) {
|
|
16391
|
-
const u =
|
|
16392
|
-
if (!
|
|
16401
|
+
const u = Ye(process.cwd(), a);
|
|
16402
|
+
if (!We(u))
|
|
16393
16403
|
throw new Error(`No '${a}' found in project root — skipping updates.`);
|
|
16394
16404
|
const d = ss(u, "utf8").split(/\r?\n/);
|
|
16395
16405
|
let g = !1;
|
|
@@ -16413,8 +16423,8 @@ function Ul(a, l = 1) {
|
|
|
16413
16423
|
process.stdout.write(`
|
|
16414
16424
|
`);
|
|
16415
16425
|
}
|
|
16416
|
-
function $l(a, l =
|
|
16417
|
-
if (!
|
|
16426
|
+
function $l(a, l = Ye(process.cwd(), ".env")) {
|
|
16427
|
+
if (!We(l))
|
|
16418
16428
|
return;
|
|
16419
16429
|
const i = ss(l, "utf-8");
|
|
16420
16430
|
for (const r of i.split(/\r?\n/)) {
|
|
@@ -16432,7 +16442,7 @@ export {
|
|
|
16432
16442
|
Nl as createFileFromWebTemplate,
|
|
16433
16443
|
$l as getEnvValue,
|
|
16434
16444
|
Ia as parseQualifiedPath,
|
|
16435
|
-
|
|
16445
|
+
Ze as promptUser,
|
|
16436
16446
|
Na as resolvePackagePath,
|
|
16437
16447
|
Rl as showError,
|
|
16438
16448
|
Ul as showMessage,
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new copy of given file from a local template.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} templateFile - The path to the template file (prefixed with package name).
|
|
5
|
+
* @param {string} targetFile - The path to the target file to create (relative to CWD). Can overwrite existing files if confirmed.
|
|
6
|
+
* @param {boolean} force - Whether to force creation without prompting.
|
|
7
|
+
* @param {string} prompt - Custom prompt message displayed in terminal.
|
|
8
|
+
* @returns {Promise<void>} An empty promise that resolves when the file is created.
|
|
9
|
+
* @throws Will throw an error if the template file cannot be found or the target file failed to be created.
|
|
10
|
+
*/
|
|
1
11
|
export declare function createFileFromTemplate(templateFile: string, targetFile: string, force?: boolean, prompt?: string): Promise<void>;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new copy of given file from a web template.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} url - The URL to the template file (must be accessible via `node:https.get` and return raw text data).
|
|
5
|
+
* @param {string} targetFile - The path to the target file to create (relative to CWD). Can overwrite existing files if confirmed.
|
|
6
|
+
* @param {boolean} force - Whether to force creation without prompting.
|
|
7
|
+
* @param {string} prompt - Custom prompt message displayed in terminal.
|
|
8
|
+
* @returns {Promise<void>} An empty promise that resolves when the file is created.
|
|
9
|
+
* @throws Will throw an error if the remote template cannot be fetched or the target file failed to be created.
|
|
10
|
+
*/
|
|
1
11
|
export declare function createFileFromWebTemplate(url: string, targetFile: string, force?: boolean, prompt?: string): Promise<void>;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @param {string} pathToFile - Path to file, relative to project root (process.cwd()).
|
|
10
10
|
* @param {object} newConfig - Config to merge in (takes precedence).
|
|
11
|
-
* @returns {Promise<void>}
|
|
11
|
+
* @returns {Promise<void>} An empty promise that resolves when the file is updated.
|
|
12
|
+
* @throws Will throw an error if no config export is found or it cannot be processed.
|
|
12
13
|
*/
|
|
13
14
|
export declare function updateConfigFile(pathToFile: string, newConfig: Record<string | number | symbol, any>, force?: boolean, prompt?: string): Promise<void>;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Updates a JSON file by modifying a specific key with new values.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} pathToFile - The path to the JSON file to update (relative to CWD).
|
|
5
|
+
* @param {string} jsonKey - The key in the JSON file to update (can be new or existing).
|
|
6
|
+
* @param {Record<string | number | symbol, any>} newValues - The new values to set for the specified key.
|
|
7
|
+
* @param {boolean} force - Whether to force the update without prompting.
|
|
8
|
+
* @param {string} prompt - Custom prompt message displayed in terminal.
|
|
9
|
+
* @returns {Promise<void>} An empty promise that resolves when the file is updated.
|
|
10
|
+
* @throws Will throw an error if the file does not exist or cannot be parsed as JSON.
|
|
11
|
+
*/
|
|
1
12
|
export declare function updateJsonFile(pathToFile: string, jsonKey: string, newValues: Record<string | number | symbol, any>, force?: boolean, prompt?: string): Promise<void>;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Updates a text file by adding new rows.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} pathToFile - The path to the text file to update (relative to CWD).
|
|
5
|
+
* @param {string[]} rowsToAdd - New rows to be added at the end of the file.
|
|
6
|
+
* @param {boolean} force - Whether to force the update without prompting.
|
|
7
|
+
* @param {string} prompt - Custom prompt message displayed in terminal.
|
|
8
|
+
* @returns {Promise<void>} An empty promise that resolves when the file is updated.
|
|
9
|
+
* @throws Will throw an error if the file does not exist.
|
|
10
|
+
*/
|
|
1
11
|
export declare function updateTextFile(pathToFile: string, rowsToAdd: string[], force?: boolean, prompt?: string): Promise<void>;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Prompts the user with a question and returns their response.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} question - Question to ask the user
|
|
5
|
+
* @param {{ input?: NodeJS.ReadableStream; output?: NodeJS.WritableStream }} options - Optional setting of custom input/output stream
|
|
6
|
+
* @returns {Promise<boolean>} - true if the user answered yes (`y`, `Y`, `yes`, `YES`), false otherwise
|
|
7
|
+
*/
|
|
8
|
+
export declare function promptUser(question: string, options?: {
|
|
9
|
+
input?: NodeJS.ReadableStream;
|
|
10
|
+
output?: NodeJS.WritableStream;
|
|
11
|
+
}): Promise<boolean>;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints error message into stderr with specified number of newlines after it.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} message - The error message text to display.
|
|
5
|
+
* @param {number} linesAfter - The number of newlines to print after the message (default is 1).
|
|
6
|
+
*/
|
|
1
7
|
export declare function showError(message: string, linesAfter?: number): void;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prints message into stdout with specified number of newlines after it.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} message - The message text to display.
|
|
5
|
+
* @param {number} linesAfter - The number of newlines to print after the message (default is 1).
|
|
6
|
+
*/
|
|
1
7
|
export declare function showMessage(message: string, linesAfter?: number): void;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the value of an environment variable from a .env file.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} key - The name of the environment variable to retrieve.
|
|
5
|
+
* @param {string} envFilePath - The path to the .env file (default is the .env file in the project root).
|
|
6
|
+
* @returns {string | undefined} - The value of the environment variable, or undefined if not found.
|
|
7
|
+
*/
|
|
1
8
|
export declare function getEnvValue(key: string, envFilePath?: string): string | undefined;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expects path to file in `"package:relative/path/to/file"` format and splits it into `{ pkg, file }`.
|
|
3
|
-
* The package name can be scoped (e.g. `@scope/package`).
|
|
3
|
+
* The package name can be scoped (e.g. `@scope/package`).
|
|
4
|
+
*
|
|
5
|
+
* @param {string} path - The qualified path string to parse.
|
|
6
|
+
* @returns {{ pkg: string; file: string }} An object containing the package name and the relative file path.
|
|
7
|
+
* @throws Will throw an error if the input format is invalid.
|
|
4
8
|
*/
|
|
5
9
|
export declare function parseQualifiedPath(path: string): {
|
|
6
10
|
pkg: string;
|
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
* Resolve a package's installed root directory *from the target app*.
|
|
3
3
|
* Package name can be scoped (e.g. `@scope/package`).
|
|
4
4
|
* Works with npm/yarn/pnpm, hoisting or not.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} packageName - The name of the package to resolve.
|
|
7
|
+
* @returns {string} The absolute path to the package's root directory.
|
|
8
|
+
* @throws Will throw an error if the package cannot be found or accessed.
|
|
5
9
|
*/
|
|
6
10
|
export declare function resolvePackagePath(packageName: string): string;
|