@gusto/baerly-storage 0.1.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/README.md +97 -0
- package/dist/API.md +850 -0
- package/dist/app-config-Cb5dO2s9.d.ts +480 -0
- package/dist/app-config.d.ts +2 -0
- package/dist/app-config.js +8 -0
- package/dist/app-config.js.map +1 -0
- package/dist/auth.d.ts +237 -0
- package/dist/auth.js +1335 -0
- package/dist/auth.js.map +1 -0
- package/dist/baerly.js +761 -0
- package/dist/baerly.js.map +1 -0
- package/dist/bucket-uri-BrDEYvzy.js +4922 -0
- package/dist/bucket-uri-BrDEYvzy.js.map +1 -0
- package/dist/chunk-EAsCxrDo.js +14 -0
- package/dist/client-BLf3Ae5s.d.ts +233 -0
- package/dist/client-react.d.ts +131 -0
- package/dist/client-react.js +559 -0
- package/dist/client-react.js.map +1 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +160 -0
- package/dist/client.js.map +1 -0
- package/dist/cloudflare-CINJPKCW.js +911 -0
- package/dist/cloudflare-CINJPKCW.js.map +1 -0
- package/dist/cloudflare.d.ts +211 -0
- package/dist/cloudflare.js +445 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/config-Bsg8wgwo.js +198 -0
- package/dist/config-Bsg8wgwo.js.map +1 -0
- package/dist/context-Oj7ffwD-.js +187 -0
- package/dist/context-Oj7ffwD-.js.map +1 -0
- package/dist/cost-B1WiZxlf.js +203 -0
- package/dist/cost-B1WiZxlf.js.map +1 -0
- package/dist/current-json-BkatBzF7.js +252 -0
- package/dist/current-json-BkatBzF7.js.map +1 -0
- package/dist/db-D62JguBc.d.ts +336 -0
- package/dist/deploy-BB-wqbhf.js +83 -0
- package/dist/deploy-BB-wqbhf.js.map +1 -0
- package/dist/dev-banner-CWHIk8tH.d.ts +26 -0
- package/dist/dev-vite.d.ts +146 -0
- package/dist/dev-vite.js +223 -0
- package/dist/dev-vite.js.map +1 -0
- package/dist/dev.d.ts +3 -0
- package/dist/dev.js +2 -0
- package/dist/doctor-B8h9GCN9.js +331 -0
- package/dist/doctor-B8h9GCN9.js.map +1 -0
- package/dist/dump-BHo_sIMZ.js +116 -0
- package/dist/dump-BHo_sIMZ.js.map +1 -0
- package/dist/errors-DOdL95kK.js +58 -0
- package/dist/errors-DOdL95kK.js.map +1 -0
- package/dist/export-Dz2PZKSR.js +423 -0
- package/dist/export-Dz2PZKSR.js.map +1 -0
- package/dist/fsck-DEz9lyCy.js +293 -0
- package/dist/fsck-DEz9lyCy.js.map +1 -0
- package/dist/http-CjUO1Bec.js +1756 -0
- package/dist/http-CjUO1Bec.js.map +1 -0
- package/dist/http.d.ts +1619 -0
- package/dist/http.js +2 -0
- package/dist/index-BGC-ENnj.d.ts +1065 -0
- package/dist/index-BYv0hb8M.d.ts +1457 -0
- package/dist/index-BquQkhJi.d.ts +112 -0
- package/dist/index-COsQ-Mlz.d.ts +146 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/indexes-BXn7a06a.js +297 -0
- package/dist/indexes-BXn7a06a.js.map +1 -0
- package/dist/indexes-DwOXkn1Y.d.ts +22 -0
- package/dist/inspect-x02aFWnh.js +149 -0
- package/dist/inspect-x02aFWnh.js.map +1 -0
- package/dist/log-walk-DIru96UT.js +260 -0
- package/dist/log-walk-DIru96UT.js.map +1 -0
- package/dist/maintenance-Bn6ul9aV.js +758 -0
- package/dist/maintenance-Bn6ul9aV.js.map +1 -0
- package/dist/maintenance.d.ts +323 -0
- package/dist/maintenance.js +2 -0
- package/dist/node.d.ts +422 -0
- package/dist/node.js +2 -0
- package/dist/normalize-XWY25_sG.js +133 -0
- package/dist/normalize-XWY25_sG.js.map +1 -0
- package/dist/observability-2IDYRuZK.js +2333 -0
- package/dist/observability-2IDYRuZK.js.map +1 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +3 -0
- package/dist/plan-Cs17VqjU.js +224 -0
- package/dist/plan-Cs17VqjU.js.map +1 -0
- package/dist/query-DcSbFLJt.js +1880 -0
- package/dist/query-DcSbFLJt.js.map +1 -0
- package/dist/rebuild-index-C5gTXryd.js +119 -0
- package/dist/rebuild-index-C5gTXryd.js.map +1 -0
- package/dist/rebuild-index-DwXM0WfA.js +104 -0
- package/dist/rebuild-index-DwXM0WfA.js.map +1 -0
- package/dist/request-BEF_OvMh.js +72 -0
- package/dist/request-BEF_OvMh.js.map +1 -0
- package/dist/restore-CbKVMMpm.js +847 -0
- package/dist/restore-CbKVMMpm.js.map +1 -0
- package/dist/shared-secret-BJdSwpgw.js +71 -0
- package/dist/shared-secret-BJdSwpgw.js.map +1 -0
- package/dist/snapshot-D7C4_FSl.js +71 -0
- package/dist/snapshot-D7C4_FSl.js.map +1 -0
- package/dist/snapshot-z_N9hpTe.js +917 -0
- package/dist/snapshot-z_N9hpTe.js.map +1 -0
- package/dist/src-Chafbw8r.js +522 -0
- package/dist/src-Chafbw8r.js.map +1 -0
- package/dist/src-DyET_VPP.js +6199 -0
- package/dist/src-DyET_VPP.js.map +1 -0
- package/dist/src-n0Te1r98.js +352 -0
- package/dist/src-n0Te1r98.js.map +1 -0
- package/dist/subcommand-BWs6K7zb.js +110 -0
- package/dist/subcommand-BWs6K7zb.js.map +1 -0
- package/dist/usage-RVUQMLop.js +339 -0
- package/dist/usage-RVUQMLop.js.map +1 -0
- package/dist/validate-DhH1lO8I.js +377 -0
- package/dist/validate-DhH1lO8I.js.map +1 -0
- package/dist/wire-izfGZDvr.js +7 -0
- package/dist/wire-izfGZDvr.js.map +1 -0
- package/package.json +189 -0
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
import { o as BaerlyError } from "./baerly.js";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
//#region src/runner.ts
|
|
6
|
+
/**
|
|
7
|
+
* `ProcessRunner` interface + default `node:child_process.spawn`-backed
|
|
8
|
+
* implementation. Shared by `baerly deploy` and `baerly doctor`, both of
|
|
9
|
+
* which shell out to Wrangler.
|
|
10
|
+
*
|
|
11
|
+
* Tests inject a mock; production uses {@link defaultRunner}. Pass
|
|
12
|
+
* `{ tee: true }` to also write the child's stdout/stderr to the parent
|
|
13
|
+
* process — `baerly deploy` does this so the operator sees Wrangler's
|
|
14
|
+
* progress in real time; `baerly doctor` captures silently for parsing.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Default `node:child_process.spawn`-backed runner. Inherits stdin and
|
|
18
|
+
* captures stdout/stderr. With `tee: true` the captured bytes are also
|
|
19
|
+
* forwarded to the parent process so the user sees the child's progress
|
|
20
|
+
* in real time.
|
|
21
|
+
*/
|
|
22
|
+
const defaultRunner = (opts = {}) => {
|
|
23
|
+
const tee = opts.tee === true;
|
|
24
|
+
return { run: (cmd, args, cwd) => new Promise((res, rej) => {
|
|
25
|
+
const child = spawn(cmd, args, {
|
|
26
|
+
cwd,
|
|
27
|
+
stdio: [
|
|
28
|
+
"inherit",
|
|
29
|
+
"pipe",
|
|
30
|
+
"pipe"
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
let stdout = "";
|
|
34
|
+
let stderr = "";
|
|
35
|
+
child.stdout?.on("data", (b) => {
|
|
36
|
+
stdout += b.toString("utf8");
|
|
37
|
+
if (tee) process.stdout.write(b);
|
|
38
|
+
});
|
|
39
|
+
child.stderr?.on("data", (b) => {
|
|
40
|
+
stderr += b.toString("utf8");
|
|
41
|
+
if (tee) process.stderr.write(b);
|
|
42
|
+
});
|
|
43
|
+
child.on("error", rej);
|
|
44
|
+
child.on("close", (code) => res({
|
|
45
|
+
code: code ?? 1,
|
|
46
|
+
stdout,
|
|
47
|
+
stderr
|
|
48
|
+
}));
|
|
49
|
+
}) };
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
53
|
+
/**
|
|
54
|
+
* Creates a JSON scanner on the given text.
|
|
55
|
+
* If ignoreTrivia is set, whitespaces or comments are ignored.
|
|
56
|
+
*/
|
|
57
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
58
|
+
const len = text.length;
|
|
59
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
60
|
+
function scanHexDigits(count, exact) {
|
|
61
|
+
let digits = 0;
|
|
62
|
+
let value = 0;
|
|
63
|
+
while (digits < count || !exact) {
|
|
64
|
+
let ch = text.charCodeAt(pos);
|
|
65
|
+
if (ch >= 48 && ch <= 57) value = value * 16 + ch - 48;
|
|
66
|
+
else if (ch >= 65 && ch <= 70) value = value * 16 + ch - 65 + 10;
|
|
67
|
+
else if (ch >= 97 && ch <= 102) value = value * 16 + ch - 97 + 10;
|
|
68
|
+
else break;
|
|
69
|
+
pos++;
|
|
70
|
+
digits++;
|
|
71
|
+
}
|
|
72
|
+
if (digits < count) value = -1;
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
function setPosition(newPosition) {
|
|
76
|
+
pos = newPosition;
|
|
77
|
+
value = "";
|
|
78
|
+
tokenOffset = 0;
|
|
79
|
+
token = 16;
|
|
80
|
+
scanError = 0;
|
|
81
|
+
}
|
|
82
|
+
function scanNumber() {
|
|
83
|
+
let start = pos;
|
|
84
|
+
if (text.charCodeAt(pos) === 48) pos++;
|
|
85
|
+
else {
|
|
86
|
+
pos++;
|
|
87
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
88
|
+
}
|
|
89
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
90
|
+
pos++;
|
|
91
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
92
|
+
pos++;
|
|
93
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
94
|
+
} else {
|
|
95
|
+
scanError = 3;
|
|
96
|
+
return text.substring(start, pos);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
let end = pos;
|
|
100
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
101
|
+
pos++;
|
|
102
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++;
|
|
103
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
104
|
+
pos++;
|
|
105
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) pos++;
|
|
106
|
+
end = pos;
|
|
107
|
+
} else scanError = 3;
|
|
108
|
+
}
|
|
109
|
+
return text.substring(start, end);
|
|
110
|
+
}
|
|
111
|
+
function scanString() {
|
|
112
|
+
let result = "", start = pos;
|
|
113
|
+
while (true) {
|
|
114
|
+
if (pos >= len) {
|
|
115
|
+
result += text.substring(start, pos);
|
|
116
|
+
scanError = 2;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
const ch = text.charCodeAt(pos);
|
|
120
|
+
if (ch === 34) {
|
|
121
|
+
result += text.substring(start, pos);
|
|
122
|
+
pos++;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
if (ch === 92) {
|
|
126
|
+
result += text.substring(start, pos);
|
|
127
|
+
pos++;
|
|
128
|
+
if (pos >= len) {
|
|
129
|
+
scanError = 2;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
switch (text.charCodeAt(pos++)) {
|
|
133
|
+
case 34:
|
|
134
|
+
result += "\"";
|
|
135
|
+
break;
|
|
136
|
+
case 92:
|
|
137
|
+
result += "\\";
|
|
138
|
+
break;
|
|
139
|
+
case 47:
|
|
140
|
+
result += "/";
|
|
141
|
+
break;
|
|
142
|
+
case 98:
|
|
143
|
+
result += "\b";
|
|
144
|
+
break;
|
|
145
|
+
case 102:
|
|
146
|
+
result += "\f";
|
|
147
|
+
break;
|
|
148
|
+
case 110:
|
|
149
|
+
result += "\n";
|
|
150
|
+
break;
|
|
151
|
+
case 114:
|
|
152
|
+
result += "\r";
|
|
153
|
+
break;
|
|
154
|
+
case 116:
|
|
155
|
+
result += " ";
|
|
156
|
+
break;
|
|
157
|
+
case 117:
|
|
158
|
+
const ch3 = scanHexDigits(4, true);
|
|
159
|
+
if (ch3 >= 0) result += String.fromCharCode(ch3);
|
|
160
|
+
else scanError = 4;
|
|
161
|
+
break;
|
|
162
|
+
default: scanError = 5;
|
|
163
|
+
}
|
|
164
|
+
start = pos;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (ch >= 0 && ch <= 31) if (isLineBreak(ch)) {
|
|
168
|
+
result += text.substring(start, pos);
|
|
169
|
+
scanError = 2;
|
|
170
|
+
break;
|
|
171
|
+
} else scanError = 6;
|
|
172
|
+
pos++;
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
function scanNext() {
|
|
177
|
+
value = "";
|
|
178
|
+
scanError = 0;
|
|
179
|
+
tokenOffset = pos;
|
|
180
|
+
lineStartOffset = lineNumber;
|
|
181
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
182
|
+
if (pos >= len) {
|
|
183
|
+
tokenOffset = len;
|
|
184
|
+
return token = 17;
|
|
185
|
+
}
|
|
186
|
+
let code = text.charCodeAt(pos);
|
|
187
|
+
if (isWhiteSpace(code)) {
|
|
188
|
+
do {
|
|
189
|
+
pos++;
|
|
190
|
+
value += String.fromCharCode(code);
|
|
191
|
+
code = text.charCodeAt(pos);
|
|
192
|
+
} while (isWhiteSpace(code));
|
|
193
|
+
return token = 15;
|
|
194
|
+
}
|
|
195
|
+
if (isLineBreak(code)) {
|
|
196
|
+
pos++;
|
|
197
|
+
value += String.fromCharCode(code);
|
|
198
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
199
|
+
pos++;
|
|
200
|
+
value += "\n";
|
|
201
|
+
}
|
|
202
|
+
lineNumber++;
|
|
203
|
+
tokenLineStartOffset = pos;
|
|
204
|
+
return token = 14;
|
|
205
|
+
}
|
|
206
|
+
switch (code) {
|
|
207
|
+
case 123:
|
|
208
|
+
pos++;
|
|
209
|
+
return token = 1;
|
|
210
|
+
case 125:
|
|
211
|
+
pos++;
|
|
212
|
+
return token = 2;
|
|
213
|
+
case 91:
|
|
214
|
+
pos++;
|
|
215
|
+
return token = 3;
|
|
216
|
+
case 93:
|
|
217
|
+
pos++;
|
|
218
|
+
return token = 4;
|
|
219
|
+
case 58:
|
|
220
|
+
pos++;
|
|
221
|
+
return token = 6;
|
|
222
|
+
case 44:
|
|
223
|
+
pos++;
|
|
224
|
+
return token = 5;
|
|
225
|
+
case 34:
|
|
226
|
+
pos++;
|
|
227
|
+
value = scanString();
|
|
228
|
+
return token = 10;
|
|
229
|
+
case 47:
|
|
230
|
+
const start = pos - 1;
|
|
231
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
232
|
+
pos += 2;
|
|
233
|
+
while (pos < len) {
|
|
234
|
+
if (isLineBreak(text.charCodeAt(pos))) break;
|
|
235
|
+
pos++;
|
|
236
|
+
}
|
|
237
|
+
value = text.substring(start, pos);
|
|
238
|
+
return token = 12;
|
|
239
|
+
}
|
|
240
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
241
|
+
pos += 2;
|
|
242
|
+
const safeLength = len - 1;
|
|
243
|
+
let commentClosed = false;
|
|
244
|
+
while (pos < safeLength) {
|
|
245
|
+
const ch = text.charCodeAt(pos);
|
|
246
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
247
|
+
pos += 2;
|
|
248
|
+
commentClosed = true;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
pos++;
|
|
252
|
+
if (isLineBreak(ch)) {
|
|
253
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) pos++;
|
|
254
|
+
lineNumber++;
|
|
255
|
+
tokenLineStartOffset = pos;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (!commentClosed) {
|
|
259
|
+
pos++;
|
|
260
|
+
scanError = 1;
|
|
261
|
+
}
|
|
262
|
+
value = text.substring(start, pos);
|
|
263
|
+
return token = 13;
|
|
264
|
+
}
|
|
265
|
+
value += String.fromCharCode(code);
|
|
266
|
+
pos++;
|
|
267
|
+
return token = 16;
|
|
268
|
+
case 45:
|
|
269
|
+
value += String.fromCharCode(code);
|
|
270
|
+
pos++;
|
|
271
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) return token = 16;
|
|
272
|
+
case 48:
|
|
273
|
+
case 49:
|
|
274
|
+
case 50:
|
|
275
|
+
case 51:
|
|
276
|
+
case 52:
|
|
277
|
+
case 53:
|
|
278
|
+
case 54:
|
|
279
|
+
case 55:
|
|
280
|
+
case 56:
|
|
281
|
+
case 57:
|
|
282
|
+
value += scanNumber();
|
|
283
|
+
return token = 11;
|
|
284
|
+
default:
|
|
285
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
286
|
+
pos++;
|
|
287
|
+
code = text.charCodeAt(pos);
|
|
288
|
+
}
|
|
289
|
+
if (tokenOffset !== pos) {
|
|
290
|
+
value = text.substring(tokenOffset, pos);
|
|
291
|
+
switch (value) {
|
|
292
|
+
case "true": return token = 8;
|
|
293
|
+
case "false": return token = 9;
|
|
294
|
+
case "null": return token = 7;
|
|
295
|
+
}
|
|
296
|
+
return token = 16;
|
|
297
|
+
}
|
|
298
|
+
value += String.fromCharCode(code);
|
|
299
|
+
pos++;
|
|
300
|
+
return token = 16;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function isUnknownContentCharacter(code) {
|
|
304
|
+
if (isWhiteSpace(code) || isLineBreak(code)) return false;
|
|
305
|
+
switch (code) {
|
|
306
|
+
case 125:
|
|
307
|
+
case 93:
|
|
308
|
+
case 123:
|
|
309
|
+
case 91:
|
|
310
|
+
case 34:
|
|
311
|
+
case 58:
|
|
312
|
+
case 44:
|
|
313
|
+
case 47: return false;
|
|
314
|
+
}
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
function scanNextNonTrivia() {
|
|
318
|
+
let result;
|
|
319
|
+
do
|
|
320
|
+
result = scanNext();
|
|
321
|
+
while (result >= 12 && result <= 15);
|
|
322
|
+
return result;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
setPosition,
|
|
326
|
+
getPosition: () => pos,
|
|
327
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
328
|
+
getToken: () => token,
|
|
329
|
+
getTokenValue: () => value,
|
|
330
|
+
getTokenOffset: () => tokenOffset,
|
|
331
|
+
getTokenLength: () => pos - tokenOffset,
|
|
332
|
+
getTokenStartLine: () => lineStartOffset,
|
|
333
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
334
|
+
getTokenError: () => scanError
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function isWhiteSpace(ch) {
|
|
338
|
+
return ch === 32 || ch === 9;
|
|
339
|
+
}
|
|
340
|
+
function isLineBreak(ch) {
|
|
341
|
+
return ch === 10 || ch === 13;
|
|
342
|
+
}
|
|
343
|
+
function isDigit(ch) {
|
|
344
|
+
return ch >= 48 && ch <= 57;
|
|
345
|
+
}
|
|
346
|
+
var CharacterCodes;
|
|
347
|
+
(function(CharacterCodes) {
|
|
348
|
+
CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed";
|
|
349
|
+
CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn";
|
|
350
|
+
CharacterCodes[CharacterCodes["space"] = 32] = "space";
|
|
351
|
+
CharacterCodes[CharacterCodes["_0"] = 48] = "_0";
|
|
352
|
+
CharacterCodes[CharacterCodes["_1"] = 49] = "_1";
|
|
353
|
+
CharacterCodes[CharacterCodes["_2"] = 50] = "_2";
|
|
354
|
+
CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
|
|
355
|
+
CharacterCodes[CharacterCodes["_4"] = 52] = "_4";
|
|
356
|
+
CharacterCodes[CharacterCodes["_5"] = 53] = "_5";
|
|
357
|
+
CharacterCodes[CharacterCodes["_6"] = 54] = "_6";
|
|
358
|
+
CharacterCodes[CharacterCodes["_7"] = 55] = "_7";
|
|
359
|
+
CharacterCodes[CharacterCodes["_8"] = 56] = "_8";
|
|
360
|
+
CharacterCodes[CharacterCodes["_9"] = 57] = "_9";
|
|
361
|
+
CharacterCodes[CharacterCodes["a"] = 97] = "a";
|
|
362
|
+
CharacterCodes[CharacterCodes["b"] = 98] = "b";
|
|
363
|
+
CharacterCodes[CharacterCodes["c"] = 99] = "c";
|
|
364
|
+
CharacterCodes[CharacterCodes["d"] = 100] = "d";
|
|
365
|
+
CharacterCodes[CharacterCodes["e"] = 101] = "e";
|
|
366
|
+
CharacterCodes[CharacterCodes["f"] = 102] = "f";
|
|
367
|
+
CharacterCodes[CharacterCodes["g"] = 103] = "g";
|
|
368
|
+
CharacterCodes[CharacterCodes["h"] = 104] = "h";
|
|
369
|
+
CharacterCodes[CharacterCodes["i"] = 105] = "i";
|
|
370
|
+
CharacterCodes[CharacterCodes["j"] = 106] = "j";
|
|
371
|
+
CharacterCodes[CharacterCodes["k"] = 107] = "k";
|
|
372
|
+
CharacterCodes[CharacterCodes["l"] = 108] = "l";
|
|
373
|
+
CharacterCodes[CharacterCodes["m"] = 109] = "m";
|
|
374
|
+
CharacterCodes[CharacterCodes["n"] = 110] = "n";
|
|
375
|
+
CharacterCodes[CharacterCodes["o"] = 111] = "o";
|
|
376
|
+
CharacterCodes[CharacterCodes["p"] = 112] = "p";
|
|
377
|
+
CharacterCodes[CharacterCodes["q"] = 113] = "q";
|
|
378
|
+
CharacterCodes[CharacterCodes["r"] = 114] = "r";
|
|
379
|
+
CharacterCodes[CharacterCodes["s"] = 115] = "s";
|
|
380
|
+
CharacterCodes[CharacterCodes["t"] = 116] = "t";
|
|
381
|
+
CharacterCodes[CharacterCodes["u"] = 117] = "u";
|
|
382
|
+
CharacterCodes[CharacterCodes["v"] = 118] = "v";
|
|
383
|
+
CharacterCodes[CharacterCodes["w"] = 119] = "w";
|
|
384
|
+
CharacterCodes[CharacterCodes["x"] = 120] = "x";
|
|
385
|
+
CharacterCodes[CharacterCodes["y"] = 121] = "y";
|
|
386
|
+
CharacterCodes[CharacterCodes["z"] = 122] = "z";
|
|
387
|
+
CharacterCodes[CharacterCodes["A"] = 65] = "A";
|
|
388
|
+
CharacterCodes[CharacterCodes["B"] = 66] = "B";
|
|
389
|
+
CharacterCodes[CharacterCodes["C"] = 67] = "C";
|
|
390
|
+
CharacterCodes[CharacterCodes["D"] = 68] = "D";
|
|
391
|
+
CharacterCodes[CharacterCodes["E"] = 69] = "E";
|
|
392
|
+
CharacterCodes[CharacterCodes["F"] = 70] = "F";
|
|
393
|
+
CharacterCodes[CharacterCodes["G"] = 71] = "G";
|
|
394
|
+
CharacterCodes[CharacterCodes["H"] = 72] = "H";
|
|
395
|
+
CharacterCodes[CharacterCodes["I"] = 73] = "I";
|
|
396
|
+
CharacterCodes[CharacterCodes["J"] = 74] = "J";
|
|
397
|
+
CharacterCodes[CharacterCodes["K"] = 75] = "K";
|
|
398
|
+
CharacterCodes[CharacterCodes["L"] = 76] = "L";
|
|
399
|
+
CharacterCodes[CharacterCodes["M"] = 77] = "M";
|
|
400
|
+
CharacterCodes[CharacterCodes["N"] = 78] = "N";
|
|
401
|
+
CharacterCodes[CharacterCodes["O"] = 79] = "O";
|
|
402
|
+
CharacterCodes[CharacterCodes["P"] = 80] = "P";
|
|
403
|
+
CharacterCodes[CharacterCodes["Q"] = 81] = "Q";
|
|
404
|
+
CharacterCodes[CharacterCodes["R"] = 82] = "R";
|
|
405
|
+
CharacterCodes[CharacterCodes["S"] = 83] = "S";
|
|
406
|
+
CharacterCodes[CharacterCodes["T"] = 84] = "T";
|
|
407
|
+
CharacterCodes[CharacterCodes["U"] = 85] = "U";
|
|
408
|
+
CharacterCodes[CharacterCodes["V"] = 86] = "V";
|
|
409
|
+
CharacterCodes[CharacterCodes["W"] = 87] = "W";
|
|
410
|
+
CharacterCodes[CharacterCodes["X"] = 88] = "X";
|
|
411
|
+
CharacterCodes[CharacterCodes["Y"] = 89] = "Y";
|
|
412
|
+
CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
|
|
413
|
+
CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk";
|
|
414
|
+
CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
|
|
415
|
+
CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace";
|
|
416
|
+
CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket";
|
|
417
|
+
CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
|
|
418
|
+
CharacterCodes[CharacterCodes["comma"] = 44] = "comma";
|
|
419
|
+
CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
|
|
420
|
+
CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote";
|
|
421
|
+
CharacterCodes[CharacterCodes["minus"] = 45] = "minus";
|
|
422
|
+
CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace";
|
|
423
|
+
CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket";
|
|
424
|
+
CharacterCodes[CharacterCodes["plus"] = 43] = "plus";
|
|
425
|
+
CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
|
|
426
|
+
CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed";
|
|
427
|
+
CharacterCodes[CharacterCodes["tab"] = 9] = "tab";
|
|
428
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
429
|
+
new Array(20).fill(0).map((_, index) => {
|
|
430
|
+
return " ".repeat(index);
|
|
431
|
+
});
|
|
432
|
+
const maxCachedValues = 200;
|
|
433
|
+
new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
434
|
+
return "\n" + " ".repeat(index);
|
|
435
|
+
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
436
|
+
return "\r" + " ".repeat(index);
|
|
437
|
+
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
438
|
+
return "\r\n" + " ".repeat(index);
|
|
439
|
+
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
440
|
+
return "\n" + " ".repeat(index);
|
|
441
|
+
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
442
|
+
return "\r" + " ".repeat(index);
|
|
443
|
+
}), new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
444
|
+
return "\r\n" + " ".repeat(index);
|
|
445
|
+
});
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
448
|
+
var ParseOptions;
|
|
449
|
+
(function(ParseOptions) {
|
|
450
|
+
ParseOptions.DEFAULT = { allowTrailingComma: false };
|
|
451
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
452
|
+
/**
|
|
453
|
+
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
454
|
+
* Therefore always check the errors list to find out if the input was valid.
|
|
455
|
+
*/
|
|
456
|
+
function parse$1(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
457
|
+
let currentProperty = null;
|
|
458
|
+
let currentParent = [];
|
|
459
|
+
const previousParents = [];
|
|
460
|
+
function onValue(value) {
|
|
461
|
+
if (Array.isArray(currentParent)) currentParent.push(value);
|
|
462
|
+
else if (currentProperty !== null) currentParent[currentProperty] = value;
|
|
463
|
+
}
|
|
464
|
+
visit(text, {
|
|
465
|
+
onObjectBegin: () => {
|
|
466
|
+
const object = {};
|
|
467
|
+
onValue(object);
|
|
468
|
+
previousParents.push(currentParent);
|
|
469
|
+
currentParent = object;
|
|
470
|
+
currentProperty = null;
|
|
471
|
+
},
|
|
472
|
+
onObjectProperty: (name) => {
|
|
473
|
+
currentProperty = name;
|
|
474
|
+
},
|
|
475
|
+
onObjectEnd: () => {
|
|
476
|
+
currentParent = previousParents.pop();
|
|
477
|
+
},
|
|
478
|
+
onArrayBegin: () => {
|
|
479
|
+
const array = [];
|
|
480
|
+
onValue(array);
|
|
481
|
+
previousParents.push(currentParent);
|
|
482
|
+
currentParent = array;
|
|
483
|
+
currentProperty = null;
|
|
484
|
+
},
|
|
485
|
+
onArrayEnd: () => {
|
|
486
|
+
currentParent = previousParents.pop();
|
|
487
|
+
},
|
|
488
|
+
onLiteralValue: onValue,
|
|
489
|
+
onError: (error, offset, length) => {
|
|
490
|
+
errors.push({
|
|
491
|
+
error,
|
|
492
|
+
offset,
|
|
493
|
+
length
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}, options);
|
|
497
|
+
return currentParent[0];
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Parses the given text and invokes the visitor functions for each object, array and literal reached.
|
|
501
|
+
*/
|
|
502
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
503
|
+
const _scanner = createScanner(text, false);
|
|
504
|
+
const _jsonPath = [];
|
|
505
|
+
let suppressedCallbacks = 0;
|
|
506
|
+
function toNoArgVisit(visitFunction) {
|
|
507
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
508
|
+
}
|
|
509
|
+
function toOneArgVisit(visitFunction) {
|
|
510
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
511
|
+
}
|
|
512
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
513
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
514
|
+
}
|
|
515
|
+
function toBeginVisit(visitFunction) {
|
|
516
|
+
return visitFunction ? () => {
|
|
517
|
+
if (suppressedCallbacks > 0) suppressedCallbacks++;
|
|
518
|
+
else if (visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) === false) suppressedCallbacks = 1;
|
|
519
|
+
} : () => true;
|
|
520
|
+
}
|
|
521
|
+
function toEndVisit(visitFunction) {
|
|
522
|
+
return visitFunction ? () => {
|
|
523
|
+
if (suppressedCallbacks > 0) suppressedCallbacks--;
|
|
524
|
+
if (suppressedCallbacks === 0) visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
525
|
+
} : () => true;
|
|
526
|
+
}
|
|
527
|
+
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
528
|
+
const disallowComments = options && options.disallowComments;
|
|
529
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
530
|
+
function scanNext() {
|
|
531
|
+
while (true) {
|
|
532
|
+
const token = _scanner.scan();
|
|
533
|
+
switch (_scanner.getTokenError()) {
|
|
534
|
+
case 4:
|
|
535
|
+
handleError(14);
|
|
536
|
+
break;
|
|
537
|
+
case 5:
|
|
538
|
+
handleError(15);
|
|
539
|
+
break;
|
|
540
|
+
case 3:
|
|
541
|
+
handleError(13);
|
|
542
|
+
break;
|
|
543
|
+
case 1:
|
|
544
|
+
if (!disallowComments) handleError(11);
|
|
545
|
+
break;
|
|
546
|
+
case 2:
|
|
547
|
+
handleError(12);
|
|
548
|
+
break;
|
|
549
|
+
case 6:
|
|
550
|
+
handleError(16);
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
switch (token) {
|
|
554
|
+
case 12:
|
|
555
|
+
case 13:
|
|
556
|
+
if (disallowComments) handleError(10);
|
|
557
|
+
else onComment();
|
|
558
|
+
break;
|
|
559
|
+
case 16:
|
|
560
|
+
handleError(1);
|
|
561
|
+
break;
|
|
562
|
+
case 15:
|
|
563
|
+
case 14: break;
|
|
564
|
+
default: return token;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
569
|
+
onError(error);
|
|
570
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
571
|
+
let token = _scanner.getToken();
|
|
572
|
+
while (token !== 17) {
|
|
573
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
574
|
+
scanNext();
|
|
575
|
+
break;
|
|
576
|
+
} else if (skipUntil.indexOf(token) !== -1) break;
|
|
577
|
+
token = scanNext();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function parseString(isValue) {
|
|
582
|
+
const value = _scanner.getTokenValue();
|
|
583
|
+
if (isValue) onLiteralValue(value);
|
|
584
|
+
else {
|
|
585
|
+
onObjectProperty(value);
|
|
586
|
+
_jsonPath.push(value);
|
|
587
|
+
}
|
|
588
|
+
scanNext();
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
function parseLiteral() {
|
|
592
|
+
switch (_scanner.getToken()) {
|
|
593
|
+
case 11:
|
|
594
|
+
const tokenValue = _scanner.getTokenValue();
|
|
595
|
+
let value = Number(tokenValue);
|
|
596
|
+
if (isNaN(value)) {
|
|
597
|
+
handleError(2);
|
|
598
|
+
value = 0;
|
|
599
|
+
}
|
|
600
|
+
onLiteralValue(value);
|
|
601
|
+
break;
|
|
602
|
+
case 7:
|
|
603
|
+
onLiteralValue(null);
|
|
604
|
+
break;
|
|
605
|
+
case 8:
|
|
606
|
+
onLiteralValue(true);
|
|
607
|
+
break;
|
|
608
|
+
case 9:
|
|
609
|
+
onLiteralValue(false);
|
|
610
|
+
break;
|
|
611
|
+
default: return false;
|
|
612
|
+
}
|
|
613
|
+
scanNext();
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
616
|
+
function parseProperty() {
|
|
617
|
+
if (_scanner.getToken() !== 10) {
|
|
618
|
+
handleError(3, [], [2, 5]);
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
parseString(false);
|
|
622
|
+
if (_scanner.getToken() === 6) {
|
|
623
|
+
onSeparator(":");
|
|
624
|
+
scanNext();
|
|
625
|
+
if (!parseValue()) handleError(4, [], [2, 5]);
|
|
626
|
+
} else handleError(5, [], [2, 5]);
|
|
627
|
+
_jsonPath.pop();
|
|
628
|
+
return true;
|
|
629
|
+
}
|
|
630
|
+
function parseObject() {
|
|
631
|
+
onObjectBegin();
|
|
632
|
+
scanNext();
|
|
633
|
+
let needsComma = false;
|
|
634
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
635
|
+
if (_scanner.getToken() === 5) {
|
|
636
|
+
if (!needsComma) handleError(4, [], []);
|
|
637
|
+
onSeparator(",");
|
|
638
|
+
scanNext();
|
|
639
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) break;
|
|
640
|
+
} else if (needsComma) handleError(6, [], []);
|
|
641
|
+
if (!parseProperty()) handleError(4, [], [2, 5]);
|
|
642
|
+
needsComma = true;
|
|
643
|
+
}
|
|
644
|
+
onObjectEnd();
|
|
645
|
+
if (_scanner.getToken() !== 2) handleError(7, [2], []);
|
|
646
|
+
else scanNext();
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
function parseArray() {
|
|
650
|
+
onArrayBegin();
|
|
651
|
+
scanNext();
|
|
652
|
+
let isFirstElement = true;
|
|
653
|
+
let needsComma = false;
|
|
654
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
655
|
+
if (_scanner.getToken() === 5) {
|
|
656
|
+
if (!needsComma) handleError(4, [], []);
|
|
657
|
+
onSeparator(",");
|
|
658
|
+
scanNext();
|
|
659
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) break;
|
|
660
|
+
} else if (needsComma) handleError(6, [], []);
|
|
661
|
+
if (isFirstElement) {
|
|
662
|
+
_jsonPath.push(0);
|
|
663
|
+
isFirstElement = false;
|
|
664
|
+
} else _jsonPath[_jsonPath.length - 1]++;
|
|
665
|
+
if (!parseValue()) handleError(4, [], [4, 5]);
|
|
666
|
+
needsComma = true;
|
|
667
|
+
}
|
|
668
|
+
onArrayEnd();
|
|
669
|
+
if (!isFirstElement) _jsonPath.pop();
|
|
670
|
+
if (_scanner.getToken() !== 4) handleError(8, [4], []);
|
|
671
|
+
else scanNext();
|
|
672
|
+
return true;
|
|
673
|
+
}
|
|
674
|
+
function parseValue() {
|
|
675
|
+
switch (_scanner.getToken()) {
|
|
676
|
+
case 3: return parseArray();
|
|
677
|
+
case 1: return parseObject();
|
|
678
|
+
case 10: return parseString(true);
|
|
679
|
+
default: return parseLiteral();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
scanNext();
|
|
683
|
+
if (_scanner.getToken() === 17) {
|
|
684
|
+
if (options.allowEmptyContent) return true;
|
|
685
|
+
handleError(4, [], []);
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
if (!parseValue()) {
|
|
689
|
+
handleError(4, [], []);
|
|
690
|
+
return false;
|
|
691
|
+
}
|
|
692
|
+
if (_scanner.getToken() !== 17) handleError(9, [], []);
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
697
|
+
var ScanError;
|
|
698
|
+
(function(ScanError) {
|
|
699
|
+
ScanError[ScanError["None"] = 0] = "None";
|
|
700
|
+
ScanError[ScanError["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
701
|
+
ScanError[ScanError["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
702
|
+
ScanError[ScanError["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
703
|
+
ScanError[ScanError["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
704
|
+
ScanError[ScanError["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
705
|
+
ScanError[ScanError["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
706
|
+
})(ScanError || (ScanError = {}));
|
|
707
|
+
var SyntaxKind;
|
|
708
|
+
(function(SyntaxKind) {
|
|
709
|
+
SyntaxKind[SyntaxKind["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
710
|
+
SyntaxKind[SyntaxKind["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
711
|
+
SyntaxKind[SyntaxKind["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
712
|
+
SyntaxKind[SyntaxKind["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
713
|
+
SyntaxKind[SyntaxKind["CommaToken"] = 5] = "CommaToken";
|
|
714
|
+
SyntaxKind[SyntaxKind["ColonToken"] = 6] = "ColonToken";
|
|
715
|
+
SyntaxKind[SyntaxKind["NullKeyword"] = 7] = "NullKeyword";
|
|
716
|
+
SyntaxKind[SyntaxKind["TrueKeyword"] = 8] = "TrueKeyword";
|
|
717
|
+
SyntaxKind[SyntaxKind["FalseKeyword"] = 9] = "FalseKeyword";
|
|
718
|
+
SyntaxKind[SyntaxKind["StringLiteral"] = 10] = "StringLiteral";
|
|
719
|
+
SyntaxKind[SyntaxKind["NumericLiteral"] = 11] = "NumericLiteral";
|
|
720
|
+
SyntaxKind[SyntaxKind["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
721
|
+
SyntaxKind[SyntaxKind["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
722
|
+
SyntaxKind[SyntaxKind["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
723
|
+
SyntaxKind[SyntaxKind["Trivia"] = 15] = "Trivia";
|
|
724
|
+
SyntaxKind[SyntaxKind["Unknown"] = 16] = "Unknown";
|
|
725
|
+
SyntaxKind[SyntaxKind["EOF"] = 17] = "EOF";
|
|
726
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
727
|
+
/**
|
|
728
|
+
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.
|
|
729
|
+
* Therefore, always check the errors list to find out if the input was valid.
|
|
730
|
+
*/
|
|
731
|
+
const parse = parse$1;
|
|
732
|
+
var ParseErrorCode;
|
|
733
|
+
(function(ParseErrorCode) {
|
|
734
|
+
ParseErrorCode[ParseErrorCode["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
735
|
+
ParseErrorCode[ParseErrorCode["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
736
|
+
ParseErrorCode[ParseErrorCode["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
737
|
+
ParseErrorCode[ParseErrorCode["ValueExpected"] = 4] = "ValueExpected";
|
|
738
|
+
ParseErrorCode[ParseErrorCode["ColonExpected"] = 5] = "ColonExpected";
|
|
739
|
+
ParseErrorCode[ParseErrorCode["CommaExpected"] = 6] = "CommaExpected";
|
|
740
|
+
ParseErrorCode[ParseErrorCode["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
741
|
+
ParseErrorCode[ParseErrorCode["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
742
|
+
ParseErrorCode[ParseErrorCode["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
743
|
+
ParseErrorCode[ParseErrorCode["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
744
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
745
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
746
|
+
ParseErrorCode[ParseErrorCode["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
747
|
+
ParseErrorCode[ParseErrorCode["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
748
|
+
ParseErrorCode[ParseErrorCode["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
749
|
+
ParseErrorCode[ParseErrorCode["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
750
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region src/wrangler-patch.ts
|
|
753
|
+
/**
|
|
754
|
+
* Surgical wrangler.jsonc helpers used by `baerly deploy` and the
|
|
755
|
+
* `@gusto/create-baerly-storage` bolt-on flow. All functions are pure (no I/O) —
|
|
756
|
+
* callers do the file read/write. Built on `jsonc-parser` so
|
|
757
|
+
* comments and trailing commas survive round-trips.
|
|
758
|
+
*/
|
|
759
|
+
/**
|
|
760
|
+
* Parse declared `r2_buckets[]` from a `wrangler.jsonc` source
|
|
761
|
+
* string. Tolerates comments + trailing commas via `jsonc-parser`.
|
|
762
|
+
*
|
|
763
|
+
* @throws BaerlyError code="InvalidConfig" — malformed JSONC or
|
|
764
|
+
* invalid `r2_buckets` shape.
|
|
765
|
+
*/
|
|
766
|
+
const parseR2Bindings$1 = (source) => {
|
|
767
|
+
const errors = [];
|
|
768
|
+
const obj = parse(source, errors, {
|
|
769
|
+
allowTrailingComma: true,
|
|
770
|
+
disallowComments: false
|
|
771
|
+
});
|
|
772
|
+
if (errors.length > 0) throw new BaerlyError("InvalidConfig", `wrangler.jsonc parse error at offset ${errors[0].offset}: ${errors[0].error}`);
|
|
773
|
+
if (obj === void 0 || typeof obj !== "object") throw new BaerlyError("InvalidConfig", `wrangler.jsonc did not parse to an object`);
|
|
774
|
+
const buckets = obj.r2_buckets;
|
|
775
|
+
if (buckets === void 0) return [];
|
|
776
|
+
if (!Array.isArray(buckets)) throw new BaerlyError("InvalidConfig", `wrangler.jsonc: r2_buckets must be an array`);
|
|
777
|
+
const out = [];
|
|
778
|
+
for (const b of buckets) {
|
|
779
|
+
if (b === null || typeof b !== "object") throw new BaerlyError("InvalidConfig", `wrangler.jsonc: r2_buckets entry must be an object`);
|
|
780
|
+
const entry = b;
|
|
781
|
+
if (typeof entry.binding !== "string" || entry.binding.length === 0) throw new BaerlyError("InvalidConfig", `wrangler.jsonc: r2_buckets[].binding must be a non-empty string`);
|
|
782
|
+
if (typeof entry.bucket_name !== "string" || entry.bucket_name.length === 0) throw new BaerlyError("InvalidConfig", `wrangler.jsonc: r2_buckets[].bucket_name must be a non-empty string`);
|
|
783
|
+
out.push({
|
|
784
|
+
binding: entry.binding,
|
|
785
|
+
bucket_name: entry.bucket_name
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
return out;
|
|
789
|
+
};
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/deploy/cloudflare.ts
|
|
792
|
+
/**
|
|
793
|
+
* `baerly deploy --target=cloudflare` — one-command Cloudflare
|
|
794
|
+
* Workers deploy.
|
|
795
|
+
*
|
|
796
|
+
* Behavior:
|
|
797
|
+
* 1. Locate `wrangler.jsonc` at the package root.
|
|
798
|
+
* 2. Sniff `wrangler deploy --help` for the `--x-provision` flag.
|
|
799
|
+
* 3. When present, invoke
|
|
800
|
+
* `wrangler deploy --x-provision --x-auto-create` and rely on
|
|
801
|
+
* Wrangler to auto-create the declared R2 buckets.
|
|
802
|
+
* 4. When absent, parse `wrangler.jsonc` for declared
|
|
803
|
+
* `r2_buckets[]`, ensure each bucket exists (creating with
|
|
804
|
+
* `wrangler r2 bucket create` when missing), then run
|
|
805
|
+
* `wrangler deploy` without the experimental flag.
|
|
806
|
+
* 5. Warn (non-fatal) on any `requiredSecret` not present in the
|
|
807
|
+
* Wrangler-reported secret list.
|
|
808
|
+
*
|
|
809
|
+
* No `wrangler secret put` is invoked — that requires interactive
|
|
810
|
+
* stdin and Wrangler is the authority on the user's secret store.
|
|
811
|
+
* Missing secrets surface as actionable hints printed to stderr.
|
|
812
|
+
*
|
|
813
|
+
* Tests inject a {@link ProcessRunner} mock; production uses the
|
|
814
|
+
* default `node:child_process.spawn`-backed implementation.
|
|
815
|
+
*/
|
|
816
|
+
/** Path to `wrangler.jsonc` at the package root. */
|
|
817
|
+
const wranglerPathFor = (repoRoot) => resolve(repoRoot, "wrangler.jsonc");
|
|
818
|
+
/**
|
|
819
|
+
* Parse the declared `r2_buckets[]` array from a `wrangler.jsonc`
|
|
820
|
+
* file. Tolerates comments + trailing commas via `jsonc-parser`.
|
|
821
|
+
*
|
|
822
|
+
* @throws BaerlyError code="InvalidConfig" — file missing, parse
|
|
823
|
+
* error, or any entry missing `binding` / `bucket_name`.
|
|
824
|
+
*/
|
|
825
|
+
const parseR2Bindings = (wranglerPath) => {
|
|
826
|
+
if (!existsSync(wranglerPath)) throw new BaerlyError("InvalidConfig", `baerly deploy: ${wranglerPath} missing. Expected wrangler.jsonc at the package root.`);
|
|
827
|
+
return parseR2Bindings$1(readFileSync(wranglerPath, "utf8"));
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* Walk the declared R2 bindings; for each, run `wrangler r2 bucket
|
|
831
|
+
* info <name>` and, on non-zero exit, `wrangler r2 bucket create
|
|
832
|
+
* <name>`. Used as the fallback when `wrangler --x-provision` is
|
|
833
|
+
* unavailable, and directly invoked by `baerly doctor
|
|
834
|
+
* --target=cloudflare --fix`.
|
|
835
|
+
*
|
|
836
|
+
* @throws BaerlyError code="NetworkError" — bucket creation
|
|
837
|
+
* reported a non-zero exit (Wrangler's own error already on
|
|
838
|
+
* stderr).
|
|
839
|
+
*/
|
|
840
|
+
const ensureBindings = async (runner, cwd, wranglerPath) => {
|
|
841
|
+
const declared = parseR2Bindings(wranglerPath);
|
|
842
|
+
for (const { bucket_name } of declared) {
|
|
843
|
+
if ((await runner.run("wrangler", [
|
|
844
|
+
"r2",
|
|
845
|
+
"bucket",
|
|
846
|
+
"info",
|
|
847
|
+
bucket_name
|
|
848
|
+
], cwd)).code === 0) continue;
|
|
849
|
+
process.stderr.write(`baerly deploy: creating R2 bucket ${bucket_name}\n`);
|
|
850
|
+
const created = await runner.run("wrangler", [
|
|
851
|
+
"r2",
|
|
852
|
+
"bucket",
|
|
853
|
+
"create",
|
|
854
|
+
bucket_name
|
|
855
|
+
], cwd);
|
|
856
|
+
if (created.code !== 0) throw new BaerlyError("NetworkError", `baerly deploy: failed to create R2 bucket ${bucket_name} (exit ${created.code})`);
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
/**
|
|
860
|
+
* Best-effort secret check. `wrangler secret list` emits a JSON
|
|
861
|
+
* array of `{ name, type }` when stdout is piped (Wrangler 4.x
|
|
862
|
+
* default). We parse, diff against `required`, and print
|
|
863
|
+
* actionable hints for each missing secret. Non-fatal — a missing
|
|
864
|
+
* secret blocks the Verifier at runtime, not at deploy time.
|
|
865
|
+
*/
|
|
866
|
+
const warnOnMissingSecrets = async (runner, cwd, required) => {
|
|
867
|
+
const r = await runner.run("wrangler", ["secret", "list"], cwd);
|
|
868
|
+
if (r.code !== 0) {
|
|
869
|
+
process.stderr.write("baerly deploy: could not list secrets; skipping check\n");
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
let configured;
|
|
873
|
+
try {
|
|
874
|
+
const parsed = JSON.parse(r.stdout);
|
|
875
|
+
if (!Array.isArray(parsed)) return;
|
|
876
|
+
configured = parsed.map((s) => s !== null && typeof s === "object" ? s.name : void 0).filter((n) => typeof n === "string");
|
|
877
|
+
} catch {
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
for (const name of required) if (!configured.includes(name)) process.stderr.write(`baerly deploy: secret ${name} is required but unset. Run: wrangler secret put ${name}\n`);
|
|
881
|
+
};
|
|
882
|
+
/**
|
|
883
|
+
* Deploy a baerly app to Cloudflare Workers. Returns the integer
|
|
884
|
+
* exit code from the underlying `wrangler deploy` invocation.
|
|
885
|
+
*
|
|
886
|
+
* @throws BaerlyError code="InvalidConfig" — `wrangler.jsonc`
|
|
887
|
+
* missing or unparseable.
|
|
888
|
+
* @throws BaerlyError code="NetworkError" — the fallback path
|
|
889
|
+
* could not create a declared R2 bucket.
|
|
890
|
+
*/
|
|
891
|
+
const deployCloudflare = async (config, opts = {}) => {
|
|
892
|
+
const runner = opts.runner ?? defaultRunner({ tee: true });
|
|
893
|
+
const repoRoot = opts.cwd ?? config.repoRoot;
|
|
894
|
+
const wranglerPath = wranglerPathFor(repoRoot);
|
|
895
|
+
if (!existsSync(wranglerPath)) throw new BaerlyError("InvalidConfig", `baerly deploy: ${wranglerPath} missing. Expected wrangler.jsonc at the package root.`);
|
|
896
|
+
const help = await runner.run("wrangler", ["deploy", "--help"], repoRoot);
|
|
897
|
+
const hasXProvision = help.code === 0 && help.stdout.includes("--x-provision");
|
|
898
|
+
await warnOnMissingSecrets(runner, repoRoot, config.requiredSecrets ?? ["SHARED_SECRET"]);
|
|
899
|
+
if (hasXProvision) return (await runner.run("wrangler", [
|
|
900
|
+
"deploy",
|
|
901
|
+
"--x-provision",
|
|
902
|
+
"--x-auto-create"
|
|
903
|
+
], repoRoot)).code;
|
|
904
|
+
process.stderr.write("baerly deploy: wrangler --x-provision unavailable; falling back to manual provisioning\n");
|
|
905
|
+
await ensureBindings(runner, repoRoot, wranglerPath);
|
|
906
|
+
return (await runner.run("wrangler", ["deploy"], repoRoot)).code;
|
|
907
|
+
};
|
|
908
|
+
//#endregion
|
|
909
|
+
export { defaultRunner as a, parse as i, ensureBindings as n, parseR2Bindings as r, deployCloudflare as t };
|
|
910
|
+
|
|
911
|
+
//# sourceMappingURL=cloudflare-CINJPKCW.js.map
|