@oliasoft-open-source/node-json-migrator 5.4.0-beta-1 → 5.4.1-beta-1
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 +12 -0
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +1379 -1360
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,1282 +1,466 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { lstatSync, promises, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
|
|
3
|
-
import process$1 from "node:process";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import tty from "node:tty";
|
|
6
|
-
import vm from "node:vm";
|
|
7
|
-
import { produce } from "immer";
|
|
8
|
-
import { createHash } from "crypto";
|
|
9
2
|
import { fileURLToPath } from "node:url";
|
|
10
3
|
import { posix, win32 } from "node:path";
|
|
4
|
+
import { lstatSync, promises, readdir, readdirSync, readlinkSync, realpathSync } from "fs";
|
|
11
5
|
import * as xi from "node:fs";
|
|
12
6
|
import { lstat, readdir as readdir$1, readlink, realpath } from "node:fs/promises";
|
|
13
7
|
import { EventEmitter } from "node:events";
|
|
14
8
|
import Pe from "node:stream";
|
|
15
9
|
import { StringDecoder } from "node:string_decoder";
|
|
10
|
+
import vm from "node:vm";
|
|
11
|
+
import { produce } from "immer";
|
|
12
|
+
import { createHash } from "crypto";
|
|
13
|
+
import process$1 from "node:process";
|
|
14
|
+
import os from "node:os";
|
|
15
|
+
import tty from "node:tty";
|
|
16
16
|
import process$2 from "process";
|
|
17
17
|
import { execSync, spawn } from "child_process";
|
|
18
|
-
//#region node_modules/.pnpm/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cyan: [36, 39],
|
|
43
|
-
white: [37, 39],
|
|
44
|
-
blackBright: [90, 39],
|
|
45
|
-
gray: [90, 39],
|
|
46
|
-
grey: [90, 39],
|
|
47
|
-
redBright: [91, 39],
|
|
48
|
-
greenBright: [92, 39],
|
|
49
|
-
yellowBright: [93, 39],
|
|
50
|
-
blueBright: [94, 39],
|
|
51
|
-
magentaBright: [95, 39],
|
|
52
|
-
cyanBright: [96, 39],
|
|
53
|
-
whiteBright: [97, 39]
|
|
54
|
-
},
|
|
55
|
-
bgColor: {
|
|
56
|
-
bgBlack: [40, 49],
|
|
57
|
-
bgRed: [41, 49],
|
|
58
|
-
bgGreen: [42, 49],
|
|
59
|
-
bgYellow: [43, 49],
|
|
60
|
-
bgBlue: [44, 49],
|
|
61
|
-
bgMagenta: [45, 49],
|
|
62
|
-
bgCyan: [46, 49],
|
|
63
|
-
bgWhite: [47, 49],
|
|
64
|
-
bgBlackBright: [100, 49],
|
|
65
|
-
bgGray: [100, 49],
|
|
66
|
-
bgGrey: [100, 49],
|
|
67
|
-
bgRedBright: [101, 49],
|
|
68
|
-
bgGreenBright: [102, 49],
|
|
69
|
-
bgYellowBright: [103, 49],
|
|
70
|
-
bgBlueBright: [104, 49],
|
|
71
|
-
bgMagentaBright: [105, 49],
|
|
72
|
-
bgCyanBright: [106, 49],
|
|
73
|
-
bgWhiteBright: [107, 49]
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
Object.keys(styles$1.modifier);
|
|
77
|
-
const foregroundColorNames = Object.keys(styles$1.color);
|
|
78
|
-
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
79
|
-
[...foregroundColorNames, ...backgroundColorNames];
|
|
80
|
-
function assembleStyles() {
|
|
81
|
-
const codes = /* @__PURE__ */ new Map();
|
|
82
|
-
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
83
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
84
|
-
styles$1[styleName] = {
|
|
85
|
-
open: `\u001B[${style[0]}m`,
|
|
86
|
-
close: `\u001B[${style[1]}m`
|
|
87
|
-
};
|
|
88
|
-
group[styleName] = styles$1[styleName];
|
|
89
|
-
codes.set(style[0], style[1]);
|
|
18
|
+
//#region node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
|
|
19
|
+
var Gt = (n, t, e) => {
|
|
20
|
+
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
21
|
+
return r && {
|
|
22
|
+
start: r[0],
|
|
23
|
+
end: r[1],
|
|
24
|
+
pre: e.slice(0, r[0]),
|
|
25
|
+
body: e.slice(r[0] + s.length, r[1]),
|
|
26
|
+
post: e.slice(r[1] + i.length)
|
|
27
|
+
};
|
|
28
|
+
}, ce = (n, t) => {
|
|
29
|
+
let e = t.match(n);
|
|
30
|
+
return e ? e[0] : null;
|
|
31
|
+
}, ss = (n, t, e) => {
|
|
32
|
+
let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
|
|
33
|
+
if (a >= 0 && l > 0) {
|
|
34
|
+
if (n === t) return [a, l];
|
|
35
|
+
for (s = [], r = e.length; u >= 0 && !h;) {
|
|
36
|
+
if (u === a) s.push(u), a = e.indexOf(n, u + 1);
|
|
37
|
+
else if (s.length === 1) {
|
|
38
|
+
let c = s.pop();
|
|
39
|
+
c !== void 0 && (h = [c, l]);
|
|
40
|
+
} else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
|
|
41
|
+
u = a < l && a >= 0 ? a : l;
|
|
90
42
|
}
|
|
91
|
-
|
|
92
|
-
value: group,
|
|
93
|
-
enumerable: false
|
|
94
|
-
});
|
|
43
|
+
s.length && o !== void 0 && (h = [r, o]);
|
|
95
44
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
styles$1.bgColor.close = "\x1B[49m";
|
|
102
|
-
styles$1.color.ansi = wrapAnsi16();
|
|
103
|
-
styles$1.color.ansi256 = wrapAnsi256();
|
|
104
|
-
styles$1.color.ansi16m = wrapAnsi16m();
|
|
105
|
-
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
106
|
-
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
107
|
-
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
108
|
-
Object.defineProperties(styles$1, {
|
|
109
|
-
rgbToAnsi256: {
|
|
110
|
-
value(red, green, blue) {
|
|
111
|
-
if (red === green && green === blue) {
|
|
112
|
-
if (red < 8) return 16;
|
|
113
|
-
if (red > 248) return 231;
|
|
114
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
115
|
-
}
|
|
116
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
117
|
-
},
|
|
118
|
-
enumerable: false
|
|
119
|
-
},
|
|
120
|
-
hexToRgb: {
|
|
121
|
-
value(hex) {
|
|
122
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
123
|
-
if (!matches) return [
|
|
124
|
-
0,
|
|
125
|
-
0,
|
|
126
|
-
0
|
|
127
|
-
];
|
|
128
|
-
let [colorString] = matches;
|
|
129
|
-
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
130
|
-
const integer = Number.parseInt(colorString, 16);
|
|
131
|
-
return [
|
|
132
|
-
integer >> 16 & 255,
|
|
133
|
-
integer >> 8 & 255,
|
|
134
|
-
integer & 255
|
|
135
|
-
];
|
|
136
|
-
},
|
|
137
|
-
enumerable: false
|
|
138
|
-
},
|
|
139
|
-
hexToAnsi256: {
|
|
140
|
-
value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
141
|
-
enumerable: false
|
|
142
|
-
},
|
|
143
|
-
ansi256ToAnsi: {
|
|
144
|
-
value(code) {
|
|
145
|
-
if (code < 8) return 30 + code;
|
|
146
|
-
if (code < 16) return 90 + (code - 8);
|
|
147
|
-
let red;
|
|
148
|
-
let green;
|
|
149
|
-
let blue;
|
|
150
|
-
if (code >= 232) {
|
|
151
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
152
|
-
green = red;
|
|
153
|
-
blue = red;
|
|
154
|
-
} else {
|
|
155
|
-
code -= 16;
|
|
156
|
-
const remainder = code % 36;
|
|
157
|
-
red = Math.floor(code / 36) / 5;
|
|
158
|
-
green = Math.floor(remainder / 6) / 5;
|
|
159
|
-
blue = remainder % 6 / 5;
|
|
160
|
-
}
|
|
161
|
-
const value = Math.max(red, green, blue) * 2;
|
|
162
|
-
if (value === 0) return 30;
|
|
163
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
164
|
-
if (value === 2) result += 60;
|
|
165
|
-
return result;
|
|
166
|
-
},
|
|
167
|
-
enumerable: false
|
|
168
|
-
},
|
|
169
|
-
rgbToAnsi: {
|
|
170
|
-
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
171
|
-
enumerable: false
|
|
172
|
-
},
|
|
173
|
-
hexToAnsi: {
|
|
174
|
-
value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
175
|
-
enumerable: false
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
return styles$1;
|
|
45
|
+
return h;
|
|
46
|
+
};
|
|
47
|
+
var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os$1 = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs = /\\,/g, us = /\\./g, ds = 1e5;
|
|
48
|
+
function Ht(n) {
|
|
49
|
+
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
179
50
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
183
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
184
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
185
|
-
const position = argv.indexOf(prefix + flag);
|
|
186
|
-
const terminatorPosition = argv.indexOf("--");
|
|
187
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
51
|
+
function ps(n) {
|
|
52
|
+
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
|
|
188
53
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
192
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
193
|
-
function envForceColor() {
|
|
194
|
-
if ("FORCE_COLOR" in env) {
|
|
195
|
-
if (env.FORCE_COLOR === "true") return 1;
|
|
196
|
-
if (env.FORCE_COLOR === "false") return 0;
|
|
197
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
198
|
-
}
|
|
54
|
+
function ms(n) {
|
|
55
|
+
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$1, ",").replace(hs, ".");
|
|
199
56
|
}
|
|
200
|
-
function
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
57
|
+
function me(n) {
|
|
58
|
+
if (!n) return [""];
|
|
59
|
+
let t = [], e = Gt("{", "}", n);
|
|
60
|
+
if (!e) return n.split(",");
|
|
61
|
+
let { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
62
|
+
o[o.length - 1] += "{" + i + "}";
|
|
63
|
+
let h = me(r);
|
|
64
|
+
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
208
65
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (forceColor === 0) return 0;
|
|
214
|
-
if (sniffFlags) {
|
|
215
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
216
|
-
if (hasFlag("color=256")) return 2;
|
|
217
|
-
}
|
|
218
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
219
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
220
|
-
const min = forceColor || 0;
|
|
221
|
-
if (env.TERM === "dumb") return min;
|
|
222
|
-
if (process$1.platform === "win32") {
|
|
223
|
-
const osRelease = os.release().split(".");
|
|
224
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
225
|
-
return 1;
|
|
226
|
-
}
|
|
227
|
-
if ("CI" in env) {
|
|
228
|
-
if ([
|
|
229
|
-
"GITHUB_ACTIONS",
|
|
230
|
-
"GITEA_ACTIONS",
|
|
231
|
-
"CIRCLECI"
|
|
232
|
-
].some((key) => key in env)) return 3;
|
|
233
|
-
if ([
|
|
234
|
-
"TRAVIS",
|
|
235
|
-
"APPVEYOR",
|
|
236
|
-
"GITLAB_CI",
|
|
237
|
-
"BUILDKITE",
|
|
238
|
-
"DRONE"
|
|
239
|
-
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
240
|
-
return min;
|
|
241
|
-
}
|
|
242
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
243
|
-
if (env.COLORTERM === "truecolor") return 3;
|
|
244
|
-
if (env.TERM === "xterm-kitty") return 3;
|
|
245
|
-
if (env.TERM === "xterm-ghostty") return 3;
|
|
246
|
-
if (env.TERM === "wezterm") return 3;
|
|
247
|
-
if ("TERM_PROGRAM" in env) {
|
|
248
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
249
|
-
switch (env.TERM_PROGRAM) {
|
|
250
|
-
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
251
|
-
case "Apple_Terminal": return 2;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
255
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
256
|
-
if ("COLORTERM" in env) return 1;
|
|
257
|
-
return min;
|
|
66
|
+
function ge(n, t = {}) {
|
|
67
|
+
if (!n) return [];
|
|
68
|
+
let { max: e = ds } = t;
|
|
69
|
+
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
|
|
258
70
|
}
|
|
259
|
-
function
|
|
260
|
-
return
|
|
261
|
-
streamIsTTY: stream && stream.isTTY,
|
|
262
|
-
...options
|
|
263
|
-
}));
|
|
71
|
+
function gs(n) {
|
|
72
|
+
return "{" + n + "}";
|
|
264
73
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
268
|
-
};
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
271
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
272
|
-
let index = string.indexOf(substring);
|
|
273
|
-
if (index === -1) return string;
|
|
274
|
-
const substringLength = substring.length;
|
|
275
|
-
let endIndex = 0;
|
|
276
|
-
let returnValue = "";
|
|
277
|
-
do {
|
|
278
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
279
|
-
endIndex = index + substringLength;
|
|
280
|
-
index = string.indexOf(substring, endIndex);
|
|
281
|
-
} while (index !== -1);
|
|
282
|
-
returnValue += string.slice(endIndex);
|
|
283
|
-
return returnValue;
|
|
74
|
+
function ws(n) {
|
|
75
|
+
return /^-?0\d/.test(n);
|
|
284
76
|
}
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
let returnValue = "";
|
|
288
|
-
do {
|
|
289
|
-
const gotCR = string[index - 1] === "\r";
|
|
290
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
291
|
-
endIndex = index + 1;
|
|
292
|
-
index = string.indexOf("\n", endIndex);
|
|
293
|
-
} while (index !== -1);
|
|
294
|
-
returnValue += string.slice(endIndex);
|
|
295
|
-
return returnValue;
|
|
77
|
+
function ys(n, t) {
|
|
78
|
+
return n <= t;
|
|
296
79
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
300
|
-
const GENERATOR = Symbol("GENERATOR");
|
|
301
|
-
const STYLER = Symbol("STYLER");
|
|
302
|
-
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
303
|
-
const levelMapping = [
|
|
304
|
-
"ansi",
|
|
305
|
-
"ansi",
|
|
306
|
-
"ansi256",
|
|
307
|
-
"ansi16m"
|
|
308
|
-
];
|
|
309
|
-
const styles = Object.create(null);
|
|
310
|
-
const applyOptions = (object, options = {}) => {
|
|
311
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
|
|
312
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
313
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
314
|
-
};
|
|
315
|
-
const chalkFactory = (options) => {
|
|
316
|
-
const chalk = (...strings) => strings.join(" ");
|
|
317
|
-
applyOptions(chalk, options);
|
|
318
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
319
|
-
return chalk;
|
|
320
|
-
};
|
|
321
|
-
function createChalk(options) {
|
|
322
|
-
return chalkFactory(options);
|
|
80
|
+
function bs(n, t) {
|
|
81
|
+
return n >= t;
|
|
323
82
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
332
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
333
|
-
return builder;
|
|
334
|
-
} };
|
|
335
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
336
|
-
if (model === "rgb") {
|
|
337
|
-
if (level === "ansi16m") return ansiStyles[type].ansi16m(...arguments_);
|
|
338
|
-
if (level === "ansi256") return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
339
|
-
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
83
|
+
function ht(n, t, e) {
|
|
84
|
+
let s = [], i = Gt("{", "}", n);
|
|
85
|
+
if (!i) return [n];
|
|
86
|
+
let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
|
|
87
|
+
if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
|
|
88
|
+
let a = r + "{" + i.body + "}" + o[h];
|
|
89
|
+
s.push(a);
|
|
340
90
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
]) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
set(level) {
|
|
373
|
-
this[GENERATOR].level = level;
|
|
91
|
+
else {
|
|
92
|
+
let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
|
|
93
|
+
if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
|
|
94
|
+
let c;
|
|
95
|
+
if (l) c = i.body.split(/\.\./);
|
|
96
|
+
else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
|
|
97
|
+
let d;
|
|
98
|
+
if (l && c[0] !== void 0 && c[1] !== void 0) {
|
|
99
|
+
let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
|
|
100
|
+
m < f && (w *= -1, g = bs);
|
|
101
|
+
let E = c.some(ws);
|
|
102
|
+
d = [];
|
|
103
|
+
for (let y = f; g(y, m); y += w) {
|
|
104
|
+
let b;
|
|
105
|
+
if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
|
|
106
|
+
else if (b = String(y), E) {
|
|
107
|
+
let z = p - b.length;
|
|
108
|
+
if (z > 0) {
|
|
109
|
+
let $ = new Array(z + 1).join("0");
|
|
110
|
+
y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
d.push(b);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
d = [];
|
|
117
|
+
for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
|
|
118
|
+
}
|
|
119
|
+
for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
|
|
120
|
+
let p = r + d[f] + o[m];
|
|
121
|
+
(!e || l || p) && s.push(p);
|
|
374
122
|
}
|
|
375
123
|
}
|
|
376
|
-
|
|
377
|
-
const createStyler = (open, close, parent) => {
|
|
378
|
-
let openAll;
|
|
379
|
-
let closeAll;
|
|
380
|
-
if (parent === void 0) {
|
|
381
|
-
openAll = open;
|
|
382
|
-
closeAll = close;
|
|
383
|
-
} else {
|
|
384
|
-
openAll = parent.openAll + open;
|
|
385
|
-
closeAll = close + parent.closeAll;
|
|
386
|
-
}
|
|
387
|
-
return {
|
|
388
|
-
open,
|
|
389
|
-
close,
|
|
390
|
-
openAll,
|
|
391
|
-
closeAll,
|
|
392
|
-
parent
|
|
393
|
-
};
|
|
394
|
-
};
|
|
395
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
396
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
397
|
-
Object.setPrototypeOf(builder, proto);
|
|
398
|
-
builder[GENERATOR] = self;
|
|
399
|
-
builder[STYLER] = _styler;
|
|
400
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
401
|
-
return builder;
|
|
402
|
-
};
|
|
403
|
-
const applyStyle = (self, string) => {
|
|
404
|
-
if (self.level <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
405
|
-
let styler = self[STYLER];
|
|
406
|
-
if (styler === void 0) return string;
|
|
407
|
-
const { openAll, closeAll } = styler;
|
|
408
|
-
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
409
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
410
|
-
styler = styler.parent;
|
|
411
|
-
}
|
|
412
|
-
const lfIndex = string.indexOf("\n");
|
|
413
|
-
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
414
|
-
return openAll + string + closeAll;
|
|
415
|
-
};
|
|
416
|
-
Object.defineProperties(createChalk.prototype, styles);
|
|
417
|
-
const chalk = createChalk();
|
|
418
|
-
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
419
|
-
//#endregion
|
|
420
|
-
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/difference.mjs
|
|
421
|
-
function difference(firstArr, secondArr) {
|
|
422
|
-
const secondSet = new Set(secondArr);
|
|
423
|
-
return firstArr.filter((item) => !secondSet.has(item));
|
|
124
|
+
return s;
|
|
424
125
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);
|
|
492
|
-
else if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);
|
|
493
|
-
else if (isPlainObject(sourceValue)) target[key] = merge({}, sourceValue);
|
|
494
|
-
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
126
|
+
var at = (n) => {
|
|
127
|
+
if (typeof n != "string") throw new TypeError("invalid pattern");
|
|
128
|
+
if (n.length > 65536) throw new TypeError("pattern is too long");
|
|
129
|
+
};
|
|
130
|
+
var Ss = {
|
|
131
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
132
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
133
|
+
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
134
|
+
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
135
|
+
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
136
|
+
"[:digit:]": ["\\p{Nd}", !0],
|
|
137
|
+
"[:graph:]": [
|
|
138
|
+
"\\p{Z}\\p{C}",
|
|
139
|
+
!0,
|
|
140
|
+
!0
|
|
141
|
+
],
|
|
142
|
+
"[:lower:]": ["\\p{Ll}", !0],
|
|
143
|
+
"[:print:]": ["\\p{C}", !0],
|
|
144
|
+
"[:punct:]": ["\\p{P}", !0],
|
|
145
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
146
|
+
"[:upper:]": ["\\p{Lu}", !0],
|
|
147
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
148
|
+
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
149
|
+
}, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
|
|
150
|
+
let e = t;
|
|
151
|
+
if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
|
|
152
|
+
let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
|
|
153
|
+
t: for (; r < n.length;) {
|
|
154
|
+
let p = n.charAt(r);
|
|
155
|
+
if ((p === "!" || p === "^") && r === e + 1) {
|
|
156
|
+
l = !0, r++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (p === "]" && o && !a) {
|
|
160
|
+
u = r + 1;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
if (o = !0, p === "\\" && !a) {
|
|
164
|
+
a = !0, r++;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (p === "[" && !a) {
|
|
168
|
+
for (let [w, [g, S, E]] of Object.entries(Ss)) if (n.startsWith(w, r)) {
|
|
169
|
+
if (c) return [
|
|
170
|
+
"$.",
|
|
171
|
+
!1,
|
|
172
|
+
n.length - e,
|
|
173
|
+
!0
|
|
174
|
+
];
|
|
175
|
+
r += w.length, E ? i.push(g) : s.push(g), h = h || S;
|
|
176
|
+
continue t;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (a = !1, c) {
|
|
180
|
+
p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (n.startsWith("-]", r + 1)) {
|
|
184
|
+
s.push(lt(p + "-")), r += 2;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (n.startsWith("-", r + 1)) {
|
|
188
|
+
c = p, r += 2;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
s.push(lt(p)), r++;
|
|
495
192
|
}
|
|
496
|
-
return
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
193
|
+
if (u < r) return [
|
|
194
|
+
"",
|
|
195
|
+
!1,
|
|
196
|
+
0,
|
|
197
|
+
!1
|
|
198
|
+
];
|
|
199
|
+
if (!s.length && !i.length) return [
|
|
200
|
+
"$.",
|
|
201
|
+
!1,
|
|
202
|
+
n.length - e,
|
|
203
|
+
!0
|
|
204
|
+
];
|
|
205
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) return [
|
|
206
|
+
Es(s[0].length === 2 ? s[0].slice(-1) : s[0]),
|
|
207
|
+
!1,
|
|
208
|
+
u - e,
|
|
209
|
+
!1
|
|
210
|
+
];
|
|
211
|
+
let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
|
|
212
|
+
return [
|
|
213
|
+
s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f,
|
|
214
|
+
h,
|
|
215
|
+
u - e,
|
|
216
|
+
!0
|
|
217
|
+
];
|
|
218
|
+
};
|
|
219
|
+
var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
220
|
+
var xs = new Set([
|
|
221
|
+
"!",
|
|
222
|
+
"?",
|
|
223
|
+
"+",
|
|
224
|
+
"*",
|
|
225
|
+
"@"
|
|
226
|
+
]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
|
|
227
|
+
type;
|
|
228
|
+
#t;
|
|
229
|
+
#s;
|
|
230
|
+
#n = !1;
|
|
231
|
+
#r = [];
|
|
232
|
+
#o;
|
|
233
|
+
#S;
|
|
234
|
+
#w;
|
|
235
|
+
#c = !1;
|
|
236
|
+
#h;
|
|
237
|
+
#u;
|
|
238
|
+
#f = !1;
|
|
239
|
+
constructor(t, e, s = {}) {
|
|
240
|
+
this.type = t, t && (this.#s = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
|
|
508
241
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
"items": {
|
|
532
|
-
"type": "object",
|
|
533
|
-
"properties": {
|
|
534
|
-
"fileHash": { "type": ["string"] },
|
|
535
|
-
"fileName": { "type": "string" },
|
|
536
|
-
"sequence": {
|
|
537
|
-
"type": "string",
|
|
538
|
-
"pattern": "^[1-9][0-9]*(.[1-9][0-9]*)*$"
|
|
242
|
+
get hasMagic() {
|
|
243
|
+
if (this.#s !== void 0) return this.#s;
|
|
244
|
+
for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = !0;
|
|
245
|
+
return this.#s;
|
|
246
|
+
}
|
|
247
|
+
toString() {
|
|
248
|
+
return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
|
|
249
|
+
}
|
|
250
|
+
#a() {
|
|
251
|
+
if (this !== this.#t) throw new Error("should only call on root");
|
|
252
|
+
if (this.#c) return this;
|
|
253
|
+
this.toString(), this.#c = !0;
|
|
254
|
+
let t;
|
|
255
|
+
for (; t = this.#w.pop();) {
|
|
256
|
+
if (t.type !== "!") continue;
|
|
257
|
+
let e = t, s = e.#o;
|
|
258
|
+
for (; s;) {
|
|
259
|
+
for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
|
|
260
|
+
if (typeof r == "string") throw new Error("string part in extglob AST??");
|
|
261
|
+
r.copyIn(s.#r[i]);
|
|
262
|
+
}
|
|
263
|
+
e = s, s = e.#o;
|
|
539
264
|
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
"fileHash",
|
|
543
|
-
"fileName",
|
|
544
|
-
"sequence"
|
|
545
|
-
],
|
|
546
|
-
"additionalProperties": false
|
|
265
|
+
}
|
|
266
|
+
return this;
|
|
547
267
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
let errors = 0;
|
|
553
|
-
if (Array.isArray(data)) {
|
|
554
|
-
const len0 = data.length;
|
|
555
|
-
for (let i0 = 0; i0 < len0; i0++) {
|
|
556
|
-
let data0 = data[i0];
|
|
557
|
-
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
|
558
|
-
if (data0.fileHash === void 0) {
|
|
559
|
-
const err0 = {
|
|
560
|
-
instancePath: instancePath + "/" + i0,
|
|
561
|
-
schemaPath: "#/items/required",
|
|
562
|
-
keyword: "required",
|
|
563
|
-
params: { missingProperty: "fileHash" },
|
|
564
|
-
message: "must have required property 'fileHash'"
|
|
565
|
-
};
|
|
566
|
-
if (vErrors === null) vErrors = [err0];
|
|
567
|
-
else vErrors.push(err0);
|
|
568
|
-
errors++;
|
|
569
|
-
}
|
|
570
|
-
if (data0.fileName === void 0) {
|
|
571
|
-
const err1 = {
|
|
572
|
-
instancePath: instancePath + "/" + i0,
|
|
573
|
-
schemaPath: "#/items/required",
|
|
574
|
-
keyword: "required",
|
|
575
|
-
params: { missingProperty: "fileName" },
|
|
576
|
-
message: "must have required property 'fileName'"
|
|
577
|
-
};
|
|
578
|
-
if (vErrors === null) vErrors = [err1];
|
|
579
|
-
else vErrors.push(err1);
|
|
580
|
-
errors++;
|
|
581
|
-
}
|
|
582
|
-
if (data0.sequence === void 0) {
|
|
583
|
-
const err2 = {
|
|
584
|
-
instancePath: instancePath + "/" + i0,
|
|
585
|
-
schemaPath: "#/items/required",
|
|
586
|
-
keyword: "required",
|
|
587
|
-
params: { missingProperty: "sequence" },
|
|
588
|
-
message: "must have required property 'sequence'"
|
|
589
|
-
};
|
|
590
|
-
if (vErrors === null) vErrors = [err2];
|
|
591
|
-
else vErrors.push(err2);
|
|
592
|
-
errors++;
|
|
593
|
-
}
|
|
594
|
-
for (const key0 in data0) if (!(key0 === "fileHash" || key0 === "fileName" || key0 === "sequence")) {
|
|
595
|
-
const err3 = {
|
|
596
|
-
instancePath: instancePath + "/" + i0,
|
|
597
|
-
schemaPath: "#/items/additionalProperties",
|
|
598
|
-
keyword: "additionalProperties",
|
|
599
|
-
params: { additionalProperty: key0 },
|
|
600
|
-
message: "must NOT have additional properties"
|
|
601
|
-
};
|
|
602
|
-
if (vErrors === null) vErrors = [err3];
|
|
603
|
-
else vErrors.push(err3);
|
|
604
|
-
errors++;
|
|
605
|
-
}
|
|
606
|
-
if (data0.fileHash !== void 0) {
|
|
607
|
-
if (typeof data0.fileHash !== "string") {
|
|
608
|
-
const err4 = {
|
|
609
|
-
instancePath: instancePath + "/" + i0 + "/fileHash",
|
|
610
|
-
schemaPath: "#/items/properties/fileHash/type",
|
|
611
|
-
keyword: "type",
|
|
612
|
-
params: { type: schema32.items.properties.fileHash.type },
|
|
613
|
-
message: "must be string"
|
|
614
|
-
};
|
|
615
|
-
if (vErrors === null) vErrors = [err4];
|
|
616
|
-
else vErrors.push(err4);
|
|
617
|
-
errors++;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if (data0.fileName !== void 0) {
|
|
621
|
-
if (typeof data0.fileName !== "string") {
|
|
622
|
-
const err5 = {
|
|
623
|
-
instancePath: instancePath + "/" + i0 + "/fileName",
|
|
624
|
-
schemaPath: "#/items/properties/fileName/type",
|
|
625
|
-
keyword: "type",
|
|
626
|
-
params: { type: "string" },
|
|
627
|
-
message: "must be string"
|
|
628
|
-
};
|
|
629
|
-
if (vErrors === null) vErrors = [err5];
|
|
630
|
-
else vErrors.push(err5);
|
|
631
|
-
errors++;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
if (data0.sequence !== void 0) {
|
|
635
|
-
let data3 = data0.sequence;
|
|
636
|
-
if (typeof data3 === "string") {
|
|
637
|
-
if (!pattern0.test(data3)) {
|
|
638
|
-
const err6 = {
|
|
639
|
-
instancePath: instancePath + "/" + i0 + "/sequence",
|
|
640
|
-
schemaPath: "#/items/properties/sequence/pattern",
|
|
641
|
-
keyword: "pattern",
|
|
642
|
-
params: { pattern: "^[1-9][0-9]*(.[1-9][0-9]*)*$" },
|
|
643
|
-
message: "must match pattern \"^[1-9][0-9]*(.[1-9][0-9]*)*$\""
|
|
644
|
-
};
|
|
645
|
-
if (vErrors === null) vErrors = [err6];
|
|
646
|
-
else vErrors.push(err6);
|
|
647
|
-
errors++;
|
|
648
|
-
}
|
|
649
|
-
} else {
|
|
650
|
-
const err7 = {
|
|
651
|
-
instancePath: instancePath + "/" + i0 + "/sequence",
|
|
652
|
-
schemaPath: "#/items/properties/sequence/type",
|
|
653
|
-
keyword: "type",
|
|
654
|
-
params: { type: "string" },
|
|
655
|
-
message: "must be string"
|
|
656
|
-
};
|
|
657
|
-
if (vErrors === null) vErrors = [err7];
|
|
658
|
-
else vErrors.push(err7);
|
|
659
|
-
errors++;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
} else {
|
|
663
|
-
const err8 = {
|
|
664
|
-
instancePath: instancePath + "/" + i0,
|
|
665
|
-
schemaPath: "#/items/type",
|
|
666
|
-
keyword: "type",
|
|
667
|
-
params: { type: "object" },
|
|
668
|
-
message: "must be object"
|
|
669
|
-
};
|
|
670
|
-
if (vErrors === null) vErrors = [err8];
|
|
671
|
-
else vErrors.push(err8);
|
|
672
|
-
errors++;
|
|
673
|
-
}
|
|
268
|
+
push(...t) {
|
|
269
|
+
for (let e of t) if (e !== "") {
|
|
270
|
+
if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
|
|
271
|
+
this.#r.push(e);
|
|
674
272
|
}
|
|
675
|
-
} else {
|
|
676
|
-
const err9 = {
|
|
677
|
-
instancePath,
|
|
678
|
-
schemaPath: "#/type",
|
|
679
|
-
keyword: "type",
|
|
680
|
-
params: { type: "array" },
|
|
681
|
-
message: "must be array"
|
|
682
|
-
};
|
|
683
|
-
if (vErrors === null) vErrors = [err9];
|
|
684
|
-
else vErrors.push(err9);
|
|
685
|
-
errors++;
|
|
686
273
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
//#endregion
|
|
691
|
-
//#region src/validator/validator.ts
|
|
692
|
-
const isNonEmptyString = (input) => isString(input) && input.length > 0;
|
|
693
|
-
/**
|
|
694
|
-
* Validates if a plan matches the schema
|
|
695
|
-
*/
|
|
696
|
-
const validatePlan = (plan) => {
|
|
697
|
-
const valid = planSchemaValidator(plan);
|
|
698
|
-
const errors = planSchemaValidator.errors;
|
|
699
|
-
if (errors?.length) errors.forEach((e) => console.error(`${e.message}${e.instancePath ? `at ${e.instancePath}` : ""}`));
|
|
700
|
-
return valid;
|
|
701
|
-
};
|
|
702
|
-
/**
|
|
703
|
-
* Validates if file description format is valid
|
|
704
|
-
*/
|
|
705
|
-
const validateFileDescription = (description) => {
|
|
706
|
-
if (!description) return false;
|
|
707
|
-
return /^([a-z]+|(([a-z]+-)+[a-z]+))$/g.test(description);
|
|
708
|
-
};
|
|
709
|
-
/**
|
|
710
|
-
* Validates if fileName format is valid
|
|
711
|
-
*/
|
|
712
|
-
const validateFileName = (fileName) => {
|
|
713
|
-
return /^([a-z]+|(([a-z]+-)+[a-z]+))(.js|.skip.js)$/g.test(fileName);
|
|
714
|
-
};
|
|
715
|
-
/**
|
|
716
|
-
* Throws if file names are invalid
|
|
717
|
-
*/
|
|
718
|
-
const throwIfFileNamesInvalid = (fileEntries) => {
|
|
719
|
-
const invalidFileNames = fileEntries.filter((f) => !f.isValidFileName).map((f) => f.fileName);
|
|
720
|
-
if (invalidFileNames.length) {
|
|
721
|
-
invalidFileNames.forEach((name) => console.error(chalk.red(name)));
|
|
722
|
-
throw new Error("Invalid migration filename format (use kebab-case)");
|
|
274
|
+
toJSON() {
|
|
275
|
+
let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
276
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
|
|
723
277
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
278
|
+
isStart() {
|
|
279
|
+
if (this.#t === this) return !0;
|
|
280
|
+
if (!this.#o?.isStart()) return !1;
|
|
281
|
+
if (this.#S === 0) return !0;
|
|
282
|
+
let t = this.#o;
|
|
283
|
+
for (let e = 0; e < this.#S; e++) {
|
|
284
|
+
let s = t.#r[e];
|
|
285
|
+
if (!(s instanceof n && s.type === "!")) return !1;
|
|
286
|
+
}
|
|
287
|
+
return !0;
|
|
734
288
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
const { fileHash, fileHashFromPlan, fileHashFromHistory, skippedFileHashes } = m;
|
|
742
|
-
const matchesHistory = !isNonEmptyString(fileHashFromHistory) || [fileHash].concat(skippedFileHashes).includes(fileHashFromHistory);
|
|
743
|
-
const matchesPlan = !isNonEmptyString(fileHashFromPlan) || [fileHash].concat(skippedFileHashes).includes(fileHashFromPlan);
|
|
744
|
-
return !(matchesHistory && matchesPlan);
|
|
745
|
-
}).map((f) => f.fileName);
|
|
746
|
-
if (changedFilesNames.length) {
|
|
747
|
-
changedFilesNames.forEach((name) => console.error(chalk.red(name)));
|
|
748
|
-
throw new Error("Not allowed to change migration files (for unreleased local work, you can use the `force` option)");
|
|
289
|
+
isEnd() {
|
|
290
|
+
if (this.#t === this || this.#o?.type === "!") return !0;
|
|
291
|
+
if (!this.#o?.isEnd()) return !1;
|
|
292
|
+
if (!this.type) return this.#o?.isEnd();
|
|
293
|
+
let t = this.#o ? this.#o.#r.length : 0;
|
|
294
|
+
return this.#S === t - 1;
|
|
749
295
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
* Throws error if previous sequence numbers have changed
|
|
753
|
-
*/
|
|
754
|
-
const throwIfSequenceHasChanged = (migrationEntries) => {
|
|
755
|
-
const changeSequences = migrationEntries.filter((m) => {
|
|
756
|
-
const { sequence, sequenceFromHistory } = m;
|
|
757
|
-
return isString(sequenceFromHistory) && sequenceFromHistory !== sequence;
|
|
758
|
-
}).map((f) => f.fileName);
|
|
759
|
-
if (changeSequences.length) {
|
|
760
|
-
changeSequences.forEach((name) => console.error(chalk.red(name)));
|
|
761
|
-
throw new Error("Not allowed to change migration sequences in plan.json");
|
|
296
|
+
copyIn(t) {
|
|
297
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
762
298
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
const throwIfSequenceNotUnique = (migrationEntries) => {
|
|
768
|
-
const repeatedSequenceNumbers = migrationEntries.map((f) => f.sequence).filter(((s) => (v) => s.has(v) || !s.add(v))(/* @__PURE__ */ new Set()));
|
|
769
|
-
const duplicates = migrationEntries.filter((f) => repeatedSequenceNumbers.includes(f.sequence)).map((f) => f.fileName);
|
|
770
|
-
if (duplicates.length) {
|
|
771
|
-
duplicates.forEach((fileName) => console.error(chalk.red(fileName)));
|
|
772
|
-
throw new Error("Migrations must have unique sequence numbers in plan.json");
|
|
299
|
+
clone(t) {
|
|
300
|
+
let e = new n(this.type, t);
|
|
301
|
+
for (let s of this.#r) e.copyIn(s);
|
|
302
|
+
return e;
|
|
773
303
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
304
|
+
static #i(t, e, s, i) {
|
|
305
|
+
let r = !1, o = !1, h = -1, a = !1;
|
|
306
|
+
if (e.type === null) {
|
|
307
|
+
let f = s, m = "";
|
|
308
|
+
for (; f < t.length;) {
|
|
309
|
+
let p = t.charAt(f++);
|
|
310
|
+
if (r || p === "\\") {
|
|
311
|
+
r = !r, m += p;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
if (o) {
|
|
315
|
+
f === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === h + 2 && a) && (o = !1), m += p;
|
|
316
|
+
continue;
|
|
317
|
+
} else if (p === "[") {
|
|
318
|
+
o = !0, h = f, a = !1, m += p;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
if (!i.noext && be(p) && t.charAt(f) === "(") {
|
|
322
|
+
e.push(m), m = "";
|
|
323
|
+
let w = new n(p, e);
|
|
324
|
+
f = n.#i(t, w, f, i), e.push(w);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
m += p;
|
|
328
|
+
}
|
|
329
|
+
return e.push(m), f;
|
|
330
|
+
}
|
|
331
|
+
let l = s + 1, u = new n(null, e), c = [], d = "";
|
|
332
|
+
for (; l < t.length;) {
|
|
333
|
+
let f = t.charAt(l++);
|
|
334
|
+
if (r || f === "\\") {
|
|
335
|
+
r = !r, d += f;
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
if (o) {
|
|
339
|
+
l === h + 1 ? (f === "^" || f === "!") && (a = !0) : f === "]" && !(l === h + 2 && a) && (o = !1), d += f;
|
|
340
|
+
continue;
|
|
341
|
+
} else if (f === "[") {
|
|
342
|
+
o = !0, h = l, a = !1, d += f;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
if (be(f) && t.charAt(l) === "(") {
|
|
346
|
+
u.push(d), d = "";
|
|
347
|
+
let m = new n(f, u);
|
|
348
|
+
u.push(m), l = n.#i(t, m, l, i);
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (f === "|") {
|
|
352
|
+
u.push(d), d = "", c.push(u), u = new n(null, e);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = !0), u.push(d), d = "", e.push(...c, u), l;
|
|
356
|
+
d += f;
|
|
357
|
+
}
|
|
358
|
+
return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
|
|
794
359
|
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
*/
|
|
799
|
-
const throwIfFilesNotFound = (migrationEntries) => {
|
|
800
|
-
const migrationsWithoutFiles = migrationEntries.filter((m) => !m.script || !m.script && !m.migrator);
|
|
801
|
-
if (migrationsWithoutFiles.length) {
|
|
802
|
-
migrationsWithoutFiles.forEach((migration) => console.error(chalk.red(migration.fileName)));
|
|
803
|
-
throw new Error("Migration files from plan.json are missing from filesystem");
|
|
360
|
+
static fromGlob(t, e = {}) {
|
|
361
|
+
let s = new n(null, void 0, e);
|
|
362
|
+
return n.#i(t, s, 0, e), s;
|
|
804
363
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
const lazyImportMigration = (script) => {
|
|
815
|
-
if (!script) return noop;
|
|
816
|
-
const patchedScript = script.replace(/import\s+\{?\s*produce\s*}?\s+from\s+['"]immer['"];?/, "").replace(/export\s+default\s+/, "const migration = ").replace(/export\s+(const|function|async function)\s+/g, "$1 ");
|
|
817
|
-
return (payload, metaData) => {
|
|
818
|
-
const context = {
|
|
819
|
-
payload,
|
|
820
|
-
metaData,
|
|
821
|
-
produce
|
|
822
|
-
};
|
|
823
|
-
return vm.runInNewContext(`${patchedScript}; migration(payload, metaData);`, context);
|
|
824
|
-
};
|
|
825
|
-
};
|
|
826
|
-
const LoaderModule = { lazyImportMigration };
|
|
827
|
-
//#endregion
|
|
828
|
-
//#region src/hash/hash.ts
|
|
829
|
-
/**
|
|
830
|
-
* Generate SHA256 hash from a string
|
|
831
|
-
*/
|
|
832
|
-
const hash = (string) => createHash("sha256").update(string).digest("hex");
|
|
833
|
-
//#endregion
|
|
834
|
-
//#region node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
|
|
835
|
-
var Gt = (n, t, e) => {
|
|
836
|
-
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
837
|
-
return r && {
|
|
838
|
-
start: r[0],
|
|
839
|
-
end: r[1],
|
|
840
|
-
pre: e.slice(0, r[0]),
|
|
841
|
-
body: e.slice(r[0] + s.length, r[1]),
|
|
842
|
-
post: e.slice(r[1] + i.length)
|
|
843
|
-
};
|
|
844
|
-
}, ce = (n, t) => {
|
|
845
|
-
let e = t.match(n);
|
|
846
|
-
return e ? e[0] : null;
|
|
847
|
-
}, ss = (n, t, e) => {
|
|
848
|
-
let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
|
|
849
|
-
if (a >= 0 && l > 0) {
|
|
850
|
-
if (n === t) return [a, l];
|
|
851
|
-
for (s = [], r = e.length; u >= 0 && !h;) {
|
|
852
|
-
if (u === a) s.push(u), a = e.indexOf(n, u + 1);
|
|
853
|
-
else if (s.length === 1) {
|
|
854
|
-
let c = s.pop();
|
|
855
|
-
c !== void 0 && (h = [c, l]);
|
|
856
|
-
} else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
|
|
857
|
-
u = a < l && a >= 0 ? a : l;
|
|
858
|
-
}
|
|
859
|
-
s.length && o !== void 0 && (h = [r, o]);
|
|
364
|
+
toMMPattern() {
|
|
365
|
+
if (this !== this.#t) return this.#t.toMMPattern();
|
|
366
|
+
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
367
|
+
if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
|
|
368
|
+
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
369
|
+
return Object.assign(new RegExp(`^${e}$`, h), {
|
|
370
|
+
_src: e,
|
|
371
|
+
_glob: t
|
|
372
|
+
});
|
|
860
373
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os$1 = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs = /\\,/g, us = /\\./g, ds = 1e5;
|
|
864
|
-
function Ht(n) {
|
|
865
|
-
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
866
|
-
}
|
|
867
|
-
function ps(n) {
|
|
868
|
-
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
|
|
869
|
-
}
|
|
870
|
-
function ms(n) {
|
|
871
|
-
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$1, ",").replace(hs, ".");
|
|
872
|
-
}
|
|
873
|
-
function me(n) {
|
|
874
|
-
if (!n) return [""];
|
|
875
|
-
let t = [], e = Gt("{", "}", n);
|
|
876
|
-
if (!e) return n.split(",");
|
|
877
|
-
let { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
878
|
-
o[o.length - 1] += "{" + i + "}";
|
|
879
|
-
let h = me(r);
|
|
880
|
-
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
881
|
-
}
|
|
882
|
-
function ge(n, t = {}) {
|
|
883
|
-
if (!n) return [];
|
|
884
|
-
let { max: e = ds } = t;
|
|
885
|
-
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
|
|
886
|
-
}
|
|
887
|
-
function gs(n) {
|
|
888
|
-
return "{" + n + "}";
|
|
889
|
-
}
|
|
890
|
-
function ws(n) {
|
|
891
|
-
return /^-?0\d/.test(n);
|
|
892
|
-
}
|
|
893
|
-
function ys(n, t) {
|
|
894
|
-
return n <= t;
|
|
895
|
-
}
|
|
896
|
-
function bs(n, t) {
|
|
897
|
-
return n >= t;
|
|
898
|
-
}
|
|
899
|
-
function ht(n, t, e) {
|
|
900
|
-
let s = [], i = Gt("{", "}", n);
|
|
901
|
-
if (!i) return [n];
|
|
902
|
-
let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
|
|
903
|
-
if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
|
|
904
|
-
let a = r + "{" + i.body + "}" + o[h];
|
|
905
|
-
s.push(a);
|
|
374
|
+
get options() {
|
|
375
|
+
return this.#h;
|
|
906
376
|
}
|
|
907
|
-
|
|
908
|
-
let
|
|
909
|
-
if (
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
let E = c.some(ws);
|
|
918
|
-
d = [];
|
|
919
|
-
for (let y = f; g(y, m); y += w) {
|
|
920
|
-
let b;
|
|
921
|
-
if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
|
|
922
|
-
else if (b = String(y), E) {
|
|
923
|
-
let z = p - b.length;
|
|
924
|
-
if (z > 0) {
|
|
925
|
-
let $ = new Array(z + 1).join("0");
|
|
926
|
-
y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
d.push(b);
|
|
377
|
+
toRegExpSource(t) {
|
|
378
|
+
let e = t ?? !!this.#h.dot;
|
|
379
|
+
if (this.#t === this && this.#a(), !this.type) {
|
|
380
|
+
let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
|
|
381
|
+
let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
|
|
382
|
+
return this.#s = this.#s || w, this.#n = this.#n || g, m;
|
|
383
|
+
}).join(""), u = "";
|
|
384
|
+
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
|
|
385
|
+
let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
|
|
386
|
+
u = p ? vs : w ? Ct : "";
|
|
930
387
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
388
|
+
let c = "";
|
|
389
|
+
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
|
|
390
|
+
u + l + c,
|
|
391
|
+
W(l),
|
|
392
|
+
this.#s = !!this.#s,
|
|
393
|
+
this.#n
|
|
394
|
+
];
|
|
934
395
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
396
|
+
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
397
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
398
|
+
let a = this.toString();
|
|
399
|
+
return this.#r = [a], this.type = null, this.#s = void 0, [
|
|
400
|
+
a,
|
|
401
|
+
W(this.toString()),
|
|
402
|
+
!1,
|
|
403
|
+
!1
|
|
404
|
+
];
|
|
405
|
+
}
|
|
406
|
+
let o = !s || t || e || !Ct ? "" : this.#d(!0);
|
|
407
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
408
|
+
let h = "";
|
|
409
|
+
if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
|
|
410
|
+
else {
|
|
411
|
+
let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
412
|
+
h = i + r + a;
|
|
938
413
|
}
|
|
414
|
+
return [
|
|
415
|
+
h,
|
|
416
|
+
W(r),
|
|
417
|
+
this.#s = !!this.#s,
|
|
418
|
+
this.#n
|
|
419
|
+
];
|
|
939
420
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
};
|
|
946
|
-
var Ss = {
|
|
947
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
948
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
949
|
-
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
950
|
-
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
951
|
-
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
952
|
-
"[:digit:]": ["\\p{Nd}", !0],
|
|
953
|
-
"[:graph:]": [
|
|
954
|
-
"\\p{Z}\\p{C}",
|
|
955
|
-
!0,
|
|
956
|
-
!0
|
|
957
|
-
],
|
|
958
|
-
"[:lower:]": ["\\p{Ll}", !0],
|
|
959
|
-
"[:print:]": ["\\p{C}", !0],
|
|
960
|
-
"[:punct:]": ["\\p{P}", !0],
|
|
961
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
962
|
-
"[:upper:]": ["\\p{Lu}", !0],
|
|
963
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
964
|
-
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
965
|
-
}, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
|
|
966
|
-
let e = t;
|
|
967
|
-
if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
|
|
968
|
-
let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
|
|
969
|
-
t: for (; r < n.length;) {
|
|
970
|
-
let p = n.charAt(r);
|
|
971
|
-
if ((p === "!" || p === "^") && r === e + 1) {
|
|
972
|
-
l = !0, r++;
|
|
973
|
-
continue;
|
|
974
|
-
}
|
|
975
|
-
if (p === "]" && o && !a) {
|
|
976
|
-
u = r + 1;
|
|
977
|
-
break;
|
|
978
|
-
}
|
|
979
|
-
if (o = !0, p === "\\" && !a) {
|
|
980
|
-
a = !0, r++;
|
|
981
|
-
continue;
|
|
982
|
-
}
|
|
983
|
-
if (p === "[" && !a) {
|
|
984
|
-
for (let [w, [g, S, E]] of Object.entries(Ss)) if (n.startsWith(w, r)) {
|
|
985
|
-
if (c) return [
|
|
986
|
-
"$.",
|
|
987
|
-
!1,
|
|
988
|
-
n.length - e,
|
|
989
|
-
!0
|
|
990
|
-
];
|
|
991
|
-
r += w.length, E ? i.push(g) : s.push(g), h = h || S;
|
|
992
|
-
continue t;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
if (a = !1, c) {
|
|
996
|
-
p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
|
|
997
|
-
continue;
|
|
998
|
-
}
|
|
999
|
-
if (n.startsWith("-]", r + 1)) {
|
|
1000
|
-
s.push(lt(p + "-")), r += 2;
|
|
1001
|
-
continue;
|
|
1002
|
-
}
|
|
1003
|
-
if (n.startsWith("-", r + 1)) {
|
|
1004
|
-
c = p, r += 2;
|
|
1005
|
-
continue;
|
|
1006
|
-
}
|
|
1007
|
-
s.push(lt(p)), r++;
|
|
1008
|
-
}
|
|
1009
|
-
if (u < r) return [
|
|
1010
|
-
"",
|
|
1011
|
-
!1,
|
|
1012
|
-
0,
|
|
1013
|
-
!1
|
|
1014
|
-
];
|
|
1015
|
-
if (!s.length && !i.length) return [
|
|
1016
|
-
"$.",
|
|
1017
|
-
!1,
|
|
1018
|
-
n.length - e,
|
|
1019
|
-
!0
|
|
1020
|
-
];
|
|
1021
|
-
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) return [
|
|
1022
|
-
Es(s[0].length === 2 ? s[0].slice(-1) : s[0]),
|
|
1023
|
-
!1,
|
|
1024
|
-
u - e,
|
|
1025
|
-
!1
|
|
1026
|
-
];
|
|
1027
|
-
let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
|
|
1028
|
-
return [
|
|
1029
|
-
s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f,
|
|
1030
|
-
h,
|
|
1031
|
-
u - e,
|
|
1032
|
-
!0
|
|
1033
|
-
];
|
|
1034
|
-
};
|
|
1035
|
-
var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
1036
|
-
var xs = new Set([
|
|
1037
|
-
"!",
|
|
1038
|
-
"?",
|
|
1039
|
-
"+",
|
|
1040
|
-
"*",
|
|
1041
|
-
"@"
|
|
1042
|
-
]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
|
|
1043
|
-
type;
|
|
1044
|
-
#t;
|
|
1045
|
-
#s;
|
|
1046
|
-
#n = !1;
|
|
1047
|
-
#r = [];
|
|
1048
|
-
#o;
|
|
1049
|
-
#S;
|
|
1050
|
-
#w;
|
|
1051
|
-
#c = !1;
|
|
1052
|
-
#h;
|
|
1053
|
-
#u;
|
|
1054
|
-
#f = !1;
|
|
1055
|
-
constructor(t, e, s = {}) {
|
|
1056
|
-
this.type = t, t && (this.#s = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
|
|
1057
|
-
}
|
|
1058
|
-
get hasMagic() {
|
|
1059
|
-
if (this.#s !== void 0) return this.#s;
|
|
1060
|
-
for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = !0;
|
|
1061
|
-
return this.#s;
|
|
1062
|
-
}
|
|
1063
|
-
toString() {
|
|
1064
|
-
return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
|
|
1065
|
-
}
|
|
1066
|
-
#a() {
|
|
1067
|
-
if (this !== this.#t) throw new Error("should only call on root");
|
|
1068
|
-
if (this.#c) return this;
|
|
1069
|
-
this.toString(), this.#c = !0;
|
|
1070
|
-
let t;
|
|
1071
|
-
for (; t = this.#w.pop();) {
|
|
1072
|
-
if (t.type !== "!") continue;
|
|
1073
|
-
let e = t, s = e.#o;
|
|
1074
|
-
for (; s;) {
|
|
1075
|
-
for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
|
|
1076
|
-
if (typeof r == "string") throw new Error("string part in extglob AST??");
|
|
1077
|
-
r.copyIn(s.#r[i]);
|
|
1078
|
-
}
|
|
1079
|
-
e = s, s = e.#o;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return this;
|
|
1083
|
-
}
|
|
1084
|
-
push(...t) {
|
|
1085
|
-
for (let e of t) if (e !== "") {
|
|
1086
|
-
if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
|
|
1087
|
-
this.#r.push(e);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
toJSON() {
|
|
1091
|
-
let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
1092
|
-
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
|
|
1093
|
-
}
|
|
1094
|
-
isStart() {
|
|
1095
|
-
if (this.#t === this) return !0;
|
|
1096
|
-
if (!this.#o?.isStart()) return !1;
|
|
1097
|
-
if (this.#S === 0) return !0;
|
|
1098
|
-
let t = this.#o;
|
|
1099
|
-
for (let e = 0; e < this.#S; e++) {
|
|
1100
|
-
let s = t.#r[e];
|
|
1101
|
-
if (!(s instanceof n && s.type === "!")) return !1;
|
|
1102
|
-
}
|
|
1103
|
-
return !0;
|
|
1104
|
-
}
|
|
1105
|
-
isEnd() {
|
|
1106
|
-
if (this.#t === this || this.#o?.type === "!") return !0;
|
|
1107
|
-
if (!this.#o?.isEnd()) return !1;
|
|
1108
|
-
if (!this.type) return this.#o?.isEnd();
|
|
1109
|
-
let t = this.#o ? this.#o.#r.length : 0;
|
|
1110
|
-
return this.#S === t - 1;
|
|
1111
|
-
}
|
|
1112
|
-
copyIn(t) {
|
|
1113
|
-
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
1114
|
-
}
|
|
1115
|
-
clone(t) {
|
|
1116
|
-
let e = new n(this.type, t);
|
|
1117
|
-
for (let s of this.#r) e.copyIn(s);
|
|
1118
|
-
return e;
|
|
421
|
+
#d(t) {
|
|
422
|
+
return this.#r.map((e) => {
|
|
423
|
+
if (typeof e == "string") throw new Error("string type in extglob ast??");
|
|
424
|
+
let [s, i, r, o] = e.toRegExpSource(t);
|
|
425
|
+
return this.#n = this.#n || o, s;
|
|
426
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
1119
427
|
}
|
|
1120
|
-
static #
|
|
1121
|
-
let
|
|
1122
|
-
|
|
1123
|
-
let
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
if (r || p === "\\") {
|
|
1127
|
-
r = !r, m += p;
|
|
1128
|
-
continue;
|
|
1129
|
-
}
|
|
1130
|
-
if (o) {
|
|
1131
|
-
f === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === h + 2 && a) && (o = !1), m += p;
|
|
1132
|
-
continue;
|
|
1133
|
-
} else if (p === "[") {
|
|
1134
|
-
o = !0, h = f, a = !1, m += p;
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
if (!i.noext && be(p) && t.charAt(f) === "(") {
|
|
1138
|
-
e.push(m), m = "";
|
|
1139
|
-
let w = new n(p, e);
|
|
1140
|
-
f = n.#i(t, w, f, i), e.push(w);
|
|
1141
|
-
continue;
|
|
1142
|
-
}
|
|
1143
|
-
m += p;
|
|
1144
|
-
}
|
|
1145
|
-
return e.push(m), f;
|
|
1146
|
-
}
|
|
1147
|
-
let l = s + 1, u = new n(null, e), c = [], d = "";
|
|
1148
|
-
for (; l < t.length;) {
|
|
1149
|
-
let f = t.charAt(l++);
|
|
1150
|
-
if (r || f === "\\") {
|
|
1151
|
-
r = !r, d += f;
|
|
428
|
+
static #E(t, e, s = !1) {
|
|
429
|
+
let i = !1, r = "", o = !1, h = !1;
|
|
430
|
+
for (let a = 0; a < t.length; a++) {
|
|
431
|
+
let l = t.charAt(a);
|
|
432
|
+
if (i) {
|
|
433
|
+
i = !1, r += (As.has(l) ? "\\" : "") + l;
|
|
1152
434
|
continue;
|
|
1153
435
|
}
|
|
1154
|
-
if (
|
|
1155
|
-
|
|
436
|
+
if (l === "*") {
|
|
437
|
+
if (h) continue;
|
|
438
|
+
h = !0, r += s && /^[*]+$/.test(t) ? Ee : Se, e = !0;
|
|
1156
439
|
continue;
|
|
1157
|
-
} else
|
|
1158
|
-
|
|
440
|
+
} else h = !1;
|
|
441
|
+
if (l === "\\") {
|
|
442
|
+
a === t.length - 1 ? r += "\\\\" : i = !0;
|
|
1159
443
|
continue;
|
|
1160
444
|
}
|
|
1161
|
-
if (
|
|
1162
|
-
u
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
445
|
+
if (l === "[") {
|
|
446
|
+
let [u, c, d, f] = ye(t, a);
|
|
447
|
+
if (d) {
|
|
448
|
+
r += u, o = o || c, a += d - 1, e = e || f;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
1166
451
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
|
|
452
|
+
if (l === "?") {
|
|
453
|
+
r += Kt, e = !0;
|
|
1169
454
|
continue;
|
|
1170
455
|
}
|
|
1171
|
-
|
|
1172
|
-
d += f;
|
|
456
|
+
r += ks(l);
|
|
1173
457
|
}
|
|
1174
|
-
return
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
toMMPattern() {
|
|
1181
|
-
if (this !== this.#t) return this.#t.toMMPattern();
|
|
1182
|
-
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
1183
|
-
if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
|
|
1184
|
-
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
1185
|
-
return Object.assign(new RegExp(`^${e}$`, h), {
|
|
1186
|
-
_src: e,
|
|
1187
|
-
_glob: t
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
get options() {
|
|
1191
|
-
return this.#h;
|
|
1192
|
-
}
|
|
1193
|
-
toRegExpSource(t) {
|
|
1194
|
-
let e = t ?? !!this.#h.dot;
|
|
1195
|
-
if (this.#t === this && this.#a(), !this.type) {
|
|
1196
|
-
let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
|
|
1197
|
-
let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
|
|
1198
|
-
return this.#s = this.#s || w, this.#n = this.#n || g, m;
|
|
1199
|
-
}).join(""), u = "";
|
|
1200
|
-
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
|
|
1201
|
-
let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
|
|
1202
|
-
u = p ? vs : w ? Ct : "";
|
|
1203
|
-
}
|
|
1204
|
-
let c = "";
|
|
1205
|
-
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
|
|
1206
|
-
u + l + c,
|
|
1207
|
-
W(l),
|
|
1208
|
-
this.#s = !!this.#s,
|
|
1209
|
-
this.#n
|
|
1210
|
-
];
|
|
1211
|
-
}
|
|
1212
|
-
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
1213
|
-
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
1214
|
-
let a = this.toString();
|
|
1215
|
-
return this.#r = [a], this.type = null, this.#s = void 0, [
|
|
1216
|
-
a,
|
|
1217
|
-
W(this.toString()),
|
|
1218
|
-
!1,
|
|
1219
|
-
!1
|
|
1220
|
-
];
|
|
1221
|
-
}
|
|
1222
|
-
let o = !s || t || e || !Ct ? "" : this.#d(!0);
|
|
1223
|
-
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
1224
|
-
let h = "";
|
|
1225
|
-
if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
|
|
1226
|
-
else {
|
|
1227
|
-
let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
1228
|
-
h = i + r + a;
|
|
1229
|
-
}
|
|
1230
|
-
return [
|
|
1231
|
-
h,
|
|
1232
|
-
W(r),
|
|
1233
|
-
this.#s = !!this.#s,
|
|
1234
|
-
this.#n
|
|
1235
|
-
];
|
|
1236
|
-
}
|
|
1237
|
-
#d(t) {
|
|
1238
|
-
return this.#r.map((e) => {
|
|
1239
|
-
if (typeof e == "string") throw new Error("string type in extglob ast??");
|
|
1240
|
-
let [s, i, r, o] = e.toRegExpSource(t);
|
|
1241
|
-
return this.#n = this.#n || o, s;
|
|
1242
|
-
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
1243
|
-
}
|
|
1244
|
-
static #E(t, e, s = !1) {
|
|
1245
|
-
let i = !1, r = "", o = !1, h = !1;
|
|
1246
|
-
for (let a = 0; a < t.length; a++) {
|
|
1247
|
-
let l = t.charAt(a);
|
|
1248
|
-
if (i) {
|
|
1249
|
-
i = !1, r += (As.has(l) ? "\\" : "") + l;
|
|
1250
|
-
continue;
|
|
1251
|
-
}
|
|
1252
|
-
if (l === "*") {
|
|
1253
|
-
if (h) continue;
|
|
1254
|
-
h = !0, r += s && /^[*]+$/.test(t) ? Ee : Se, e = !0;
|
|
1255
|
-
continue;
|
|
1256
|
-
} else h = !1;
|
|
1257
|
-
if (l === "\\") {
|
|
1258
|
-
a === t.length - 1 ? r += "\\\\" : i = !0;
|
|
1259
|
-
continue;
|
|
1260
|
-
}
|
|
1261
|
-
if (l === "[") {
|
|
1262
|
-
let [u, c, d, f] = ye(t, a);
|
|
1263
|
-
if (d) {
|
|
1264
|
-
r += u, o = o || c, a += d - 1, e = e || f;
|
|
1265
|
-
continue;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
if (l === "?") {
|
|
1269
|
-
r += Kt, e = !0;
|
|
1270
|
-
continue;
|
|
1271
|
-
}
|
|
1272
|
-
r += ks(l);
|
|
1273
|
-
}
|
|
1274
|
-
return [
|
|
1275
|
-
r,
|
|
1276
|
-
W(t),
|
|
1277
|
-
!!e,
|
|
1278
|
-
o
|
|
1279
|
-
];
|
|
458
|
+
return [
|
|
459
|
+
r,
|
|
460
|
+
W(t),
|
|
461
|
+
!!e,
|
|
462
|
+
o
|
|
463
|
+
];
|
|
1280
464
|
}
|
|
1281
465
|
};
|
|
1282
466
|
var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
|
|
@@ -3947,11 +3131,36 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
|
|
|
3947
3131
|
});
|
|
3948
3132
|
Ze.glob = Ze;
|
|
3949
3133
|
//#endregion
|
|
3134
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isLength.mjs
|
|
3135
|
+
function isLength(value) {
|
|
3136
|
+
return Number.isSafeInteger(value) && value >= 0;
|
|
3137
|
+
}
|
|
3138
|
+
//#endregion
|
|
3950
3139
|
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
|
|
3951
3140
|
function isArrayLike(value) {
|
|
3952
3141
|
return value != null && typeof value !== "function" && isLength(value.length);
|
|
3953
3142
|
}
|
|
3954
3143
|
//#endregion
|
|
3144
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/flatten.mjs
|
|
3145
|
+
function flatten(arr, depth = 1) {
|
|
3146
|
+
const result = [];
|
|
3147
|
+
const flooredDepth = Math.floor(depth);
|
|
3148
|
+
const recursive = (arr, currentDepth) => {
|
|
3149
|
+
for (let i = 0; i < arr.length; i++) {
|
|
3150
|
+
const item = arr[i];
|
|
3151
|
+
if (Array.isArray(item) && currentDepth < flooredDepth) recursive(item, currentDepth + 1);
|
|
3152
|
+
else result.push(item);
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
recursive(arr, 0);
|
|
3156
|
+
return result;
|
|
3157
|
+
}
|
|
3158
|
+
//#endregion
|
|
3159
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
|
|
3160
|
+
function isUnsafeProperty(key) {
|
|
3161
|
+
return key === "__proto__";
|
|
3162
|
+
}
|
|
3163
|
+
//#endregion
|
|
3955
3164
|
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs
|
|
3956
3165
|
function toKey(value) {
|
|
3957
3166
|
if (typeof value === "string" || typeof value === "symbol") return value;
|
|
@@ -4021,6 +3230,11 @@ function isObject(value) {
|
|
|
4021
3230
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
4022
3231
|
}
|
|
4023
3232
|
//#endregion
|
|
3233
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
|
|
3234
|
+
function isEqualsSameValueZero(value, other) {
|
|
3235
|
+
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
3236
|
+
}
|
|
3237
|
+
//#endregion
|
|
4024
3238
|
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
|
|
4025
3239
|
const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
|
|
4026
3240
|
function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
|
|
@@ -4031,142 +3245,922 @@ function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
|
|
|
4031
3245
|
}
|
|
4032
3246
|
}
|
|
4033
3247
|
//#endregion
|
|
4034
|
-
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/
|
|
4035
|
-
function
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
//#
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
return
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
3248
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/difference.mjs
|
|
3249
|
+
function difference(firstArr, secondArr) {
|
|
3250
|
+
const secondSet = new Set(secondArr);
|
|
3251
|
+
return firstArr.filter((item) => !secondSet.has(item));
|
|
3252
|
+
}
|
|
3253
|
+
//#endregion
|
|
3254
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
|
|
3255
|
+
function isSymbol(value) {
|
|
3256
|
+
return typeof value === "symbol" || value instanceof Symbol;
|
|
3257
|
+
}
|
|
3258
|
+
//#endregion
|
|
3259
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
|
|
3260
|
+
function isIterateeCall(value, index, object) {
|
|
3261
|
+
if (!isObject(object)) return false;
|
|
3262
|
+
if (typeof index === "number" && isArrayLike(object) && isIndex(index) && index < object.length || typeof index === "string" && index in object) return isEqualsSameValueZero(object[index], value);
|
|
3263
|
+
return false;
|
|
3264
|
+
}
|
|
3265
|
+
//#endregion
|
|
3266
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/intersection.mjs
|
|
3267
|
+
function intersection(firstArr, secondArr) {
|
|
3268
|
+
const secondSet = new Set(secondArr);
|
|
3269
|
+
return firstArr.filter((item) => secondSet.has(item));
|
|
3270
|
+
}
|
|
3271
|
+
//#endregion
|
|
3272
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/uniq.mjs
|
|
3273
|
+
function uniq(arr) {
|
|
3274
|
+
return [...new Set(arr)];
|
|
3275
|
+
}
|
|
3276
|
+
//#endregion
|
|
3277
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs
|
|
3278
|
+
function getPriority(a) {
|
|
3279
|
+
if (typeof a === "symbol") return 1;
|
|
3280
|
+
if (a === null) return 2;
|
|
3281
|
+
if (a === void 0) return 3;
|
|
3282
|
+
if (a !== a) return 4;
|
|
3283
|
+
return 0;
|
|
3284
|
+
}
|
|
3285
|
+
const compareValues = (a, b, order) => {
|
|
3286
|
+
if (a !== b) {
|
|
3287
|
+
const aPriority = getPriority(a);
|
|
3288
|
+
const bPriority = getPriority(b);
|
|
3289
|
+
if (aPriority === bPriority && aPriority === 0) {
|
|
3290
|
+
if (a < b) return order === "desc" ? 1 : -1;
|
|
3291
|
+
if (a > b) return order === "desc" ? -1 : 1;
|
|
3292
|
+
}
|
|
3293
|
+
return order === "desc" ? bPriority - aPriority : aPriority - bPriority;
|
|
3294
|
+
}
|
|
3295
|
+
return 0;
|
|
3296
|
+
};
|
|
3297
|
+
//#endregion
|
|
3298
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs
|
|
3299
|
+
const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
3300
|
+
const regexIsPlainProp = /^\w*$/;
|
|
3301
|
+
function isKey(value, object) {
|
|
3302
|
+
if (Array.isArray(value)) return false;
|
|
3303
|
+
if (typeof value === "number" || typeof value === "boolean" || value == null || isSymbol(value)) return true;
|
|
3304
|
+
return typeof value === "string" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);
|
|
3305
|
+
}
|
|
3306
|
+
//#endregion
|
|
3307
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/array/orderBy.mjs
|
|
3308
|
+
function orderBy(collection, criteria, orders, guard) {
|
|
3309
|
+
if (collection == null) return [];
|
|
3310
|
+
orders = guard ? void 0 : orders;
|
|
3311
|
+
if (!Array.isArray(collection)) collection = Object.values(collection);
|
|
3312
|
+
if (!Array.isArray(criteria)) criteria = criteria == null ? [null] : [criteria];
|
|
3313
|
+
if (criteria.length === 0) criteria = [null];
|
|
3314
|
+
if (!Array.isArray(orders)) orders = orders == null ? [] : [orders];
|
|
3315
|
+
orders = orders.map((order) => String(order));
|
|
3316
|
+
const getValueByNestedPath = (object, path) => {
|
|
3317
|
+
let target = object;
|
|
3318
|
+
for (let i = 0; i < path.length && target != null; ++i) target = target[path[i]];
|
|
3319
|
+
return target;
|
|
3320
|
+
};
|
|
3321
|
+
const getValueByCriterion = (criterion, object) => {
|
|
3322
|
+
if (object == null || criterion == null) return object;
|
|
3323
|
+
if (typeof criterion === "object" && "key" in criterion) {
|
|
3324
|
+
if (Object.hasOwn(object, criterion.key)) return object[criterion.key];
|
|
3325
|
+
return getValueByNestedPath(object, criterion.path);
|
|
3326
|
+
}
|
|
3327
|
+
if (typeof criterion === "function") return criterion(object);
|
|
3328
|
+
if (Array.isArray(criterion)) return getValueByNestedPath(object, criterion);
|
|
3329
|
+
if (typeof object === "object") return object[criterion];
|
|
3330
|
+
return object;
|
|
3331
|
+
};
|
|
3332
|
+
const preparedCriteria = criteria.map((criterion) => {
|
|
3333
|
+
if (Array.isArray(criterion) && criterion.length === 1) criterion = criterion[0];
|
|
3334
|
+
if (criterion == null || typeof criterion === "function" || Array.isArray(criterion) || isKey(criterion)) return criterion;
|
|
3335
|
+
return {
|
|
3336
|
+
key: criterion,
|
|
3337
|
+
path: toPath(criterion)
|
|
3338
|
+
};
|
|
3339
|
+
});
|
|
3340
|
+
return collection.map((item) => ({
|
|
3341
|
+
original: item,
|
|
3342
|
+
criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item))
|
|
3343
|
+
})).slice().sort((a, b) => {
|
|
3344
|
+
for (let i = 0; i < preparedCriteria.length; i++) {
|
|
3345
|
+
const comparedResult = compareValues(a.criteria[i], b.criteria[i], orders[i]);
|
|
3346
|
+
if (comparedResult !== 0) return comparedResult;
|
|
3347
|
+
}
|
|
3348
|
+
return 0;
|
|
3349
|
+
}).map((item) => item.original);
|
|
3350
|
+
}
|
|
3351
|
+
//#endregion
|
|
3352
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/array/sortBy.mjs
|
|
3353
|
+
function sortBy(collection, ...criteria) {
|
|
3354
|
+
const length = criteria.length;
|
|
3355
|
+
if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) criteria = [];
|
|
3356
|
+
else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]];
|
|
3357
|
+
return orderBy(collection, flatten(criteria), ["asc"]);
|
|
3358
|
+
}
|
|
3359
|
+
//#endregion
|
|
3360
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
3361
|
+
function isPlainObject(value) {
|
|
3362
|
+
if (!value || typeof value !== "object") return false;
|
|
3363
|
+
const proto = Object.getPrototypeOf(value);
|
|
3364
|
+
if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
|
|
3365
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
3366
|
+
}
|
|
3367
|
+
//#endregion
|
|
3368
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/noop.mjs
|
|
3369
|
+
function noop() {}
|
|
3370
|
+
//#endregion
|
|
3371
|
+
//#region src/glob/glob.ts
|
|
3372
|
+
/**
|
|
3373
|
+
* Sorts migration file paths
|
|
3374
|
+
*
|
|
3375
|
+
* @param {Array<String>} filePaths
|
|
3376
|
+
* @returns {Array<String>} sorted files
|
|
3377
|
+
*/
|
|
3378
|
+
const sortFilePathsByFilename = (filePaths) => sortBy(filePaths, (file) => {
|
|
3379
|
+
return path.parse(file).base;
|
|
3380
|
+
});
|
|
3381
|
+
/**
|
|
3382
|
+
* Gets paths to entity migrations in a directory
|
|
3383
|
+
*
|
|
3384
|
+
* @param {String} pathToMigrations
|
|
3385
|
+
* @returns {Promise<Array<String>>} matching migration filePaths
|
|
3386
|
+
*/
|
|
3387
|
+
const getMigrationFilePaths = async (pathToMigrations) => {
|
|
3388
|
+
const filePath = (pattern) => `${pathToMigrations}${pattern}`;
|
|
3389
|
+
return sortFilePathsByFilename(await Ze(filePath("/**/*.js"), { ignore: [
|
|
3390
|
+
filePath("/**/*.skip?([0-9]*).js"),
|
|
3391
|
+
filePath("/**/index.js"),
|
|
3392
|
+
filePath("/**/plan.json"),
|
|
3393
|
+
filePath("/**/*.bundle.js"),
|
|
3394
|
+
filePath("/**/*.test.js"),
|
|
3395
|
+
filePath("/**/*.spec.js"),
|
|
3396
|
+
filePath("/**/__tests__/*"),
|
|
3397
|
+
filePath("/**/__test__/*")
|
|
3398
|
+
] }));
|
|
3399
|
+
};
|
|
3400
|
+
/**
|
|
3401
|
+
* Gets paths to skipped migrations in a directory
|
|
3402
|
+
*
|
|
3403
|
+
* @param {String} pathToMigrations
|
|
3404
|
+
* @returns {Promise<Array<String>>} skipped migration filePaths
|
|
3405
|
+
*/
|
|
3406
|
+
const getSkippedFilePaths = async (pathToMigrations) => {
|
|
3407
|
+
const filePath = (pattern) => `${pathToMigrations}${pattern}`;
|
|
3408
|
+
return sortFilePathsByFilename(await Ze(filePath("/**/*.skip?([0-9]*).js"), { ignore: [
|
|
3409
|
+
filePath("/**/index.js"),
|
|
3410
|
+
filePath("/**/plan.json"),
|
|
3411
|
+
filePath("/**/*.bundle.js"),
|
|
3412
|
+
filePath("/**/*.test.js"),
|
|
3413
|
+
filePath("/**/*.spec.js"),
|
|
3414
|
+
filePath("/**/__tests__/*"),
|
|
3415
|
+
filePath("/**/__test__/*")
|
|
3416
|
+
] }));
|
|
3417
|
+
};
|
|
3418
|
+
//#endregion
|
|
3419
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/union.mjs
|
|
3420
|
+
function union(arr1, arr2) {
|
|
3421
|
+
return uniq(arr1.concat(arr2));
|
|
3422
|
+
}
|
|
3423
|
+
//#endregion
|
|
3424
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/array/xor.mjs
|
|
3425
|
+
function xor(arr1, arr2) {
|
|
3426
|
+
return difference(union(arr1, arr2), intersection(arr1, arr2));
|
|
3427
|
+
}
|
|
3428
|
+
//#endregion
|
|
3429
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/merge.mjs
|
|
3430
|
+
function merge(target, source) {
|
|
3431
|
+
const sourceKeys = Object.keys(source);
|
|
3432
|
+
for (let i = 0; i < sourceKeys.length; i++) {
|
|
3433
|
+
const key = sourceKeys[i];
|
|
3434
|
+
if (isUnsafeProperty(key)) continue;
|
|
3435
|
+
const sourceValue = source[key];
|
|
3436
|
+
const targetValue = target[key];
|
|
3437
|
+
if (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);
|
|
3438
|
+
else if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);
|
|
3439
|
+
else if (isPlainObject(sourceValue)) target[key] = merge({}, sourceValue);
|
|
3440
|
+
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
3441
|
+
}
|
|
3442
|
+
return target;
|
|
3443
|
+
}
|
|
3444
|
+
function isMergeableValue(value) {
|
|
3445
|
+
return isPlainObject(value) || Array.isArray(value);
|
|
3446
|
+
}
|
|
3447
|
+
//#endregion
|
|
3448
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/omit.mjs
|
|
3449
|
+
function omit(obj, keys) {
|
|
3450
|
+
const result = { ...obj };
|
|
3451
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3452
|
+
const key = keys[i];
|
|
3453
|
+
delete result[key];
|
|
3454
|
+
}
|
|
3455
|
+
return result;
|
|
3456
|
+
}
|
|
3457
|
+
//#endregion
|
|
3458
|
+
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isString.mjs
|
|
3459
|
+
function isString(value) {
|
|
3460
|
+
return typeof value === "string";
|
|
3461
|
+
}
|
|
3462
|
+
//#endregion
|
|
3463
|
+
//#region src/plan/loader-module.ts
|
|
3464
|
+
const lazyImportMigration = (script) => {
|
|
3465
|
+
if (!script) return noop;
|
|
3466
|
+
const patchedScript = script.replace(/import\s+\{?\s*produce\s*}?\s+from\s+['"]immer['"];?/, "").replace(/export\s+default\s+/, "const migration = ").replace(/export\s+(const|function|async function)\s+/g, "$1 ");
|
|
3467
|
+
return (payload, metaData) => {
|
|
3468
|
+
const context = {
|
|
3469
|
+
payload,
|
|
3470
|
+
metaData,
|
|
3471
|
+
produce
|
|
3472
|
+
};
|
|
3473
|
+
return vm.runInNewContext(`${patchedScript}; migration(payload, metaData);`, context);
|
|
3474
|
+
};
|
|
3475
|
+
};
|
|
3476
|
+
const LoaderModule = { lazyImportMigration };
|
|
3477
|
+
//#endregion
|
|
3478
|
+
//#region src/hash/hash.ts
|
|
3479
|
+
/**
|
|
3480
|
+
* Generate SHA256 hash from a string
|
|
3481
|
+
*/
|
|
3482
|
+
const hash = (string) => createHash("sha256").update(string).digest("hex");
|
|
3483
|
+
//#endregion
|
|
3484
|
+
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3485
|
+
const ANSI_BACKGROUND_OFFSET = 10;
|
|
3486
|
+
const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
3487
|
+
const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
3488
|
+
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
3489
|
+
const styles$1 = {
|
|
3490
|
+
modifier: {
|
|
3491
|
+
reset: [0, 0],
|
|
3492
|
+
bold: [1, 22],
|
|
3493
|
+
dim: [2, 22],
|
|
3494
|
+
italic: [3, 23],
|
|
3495
|
+
underline: [4, 24],
|
|
3496
|
+
overline: [53, 55],
|
|
3497
|
+
inverse: [7, 27],
|
|
3498
|
+
hidden: [8, 28],
|
|
3499
|
+
strikethrough: [9, 29]
|
|
3500
|
+
},
|
|
3501
|
+
color: {
|
|
3502
|
+
black: [30, 39],
|
|
3503
|
+
red: [31, 39],
|
|
3504
|
+
green: [32, 39],
|
|
3505
|
+
yellow: [33, 39],
|
|
3506
|
+
blue: [34, 39],
|
|
3507
|
+
magenta: [35, 39],
|
|
3508
|
+
cyan: [36, 39],
|
|
3509
|
+
white: [37, 39],
|
|
3510
|
+
blackBright: [90, 39],
|
|
3511
|
+
gray: [90, 39],
|
|
3512
|
+
grey: [90, 39],
|
|
3513
|
+
redBright: [91, 39],
|
|
3514
|
+
greenBright: [92, 39],
|
|
3515
|
+
yellowBright: [93, 39],
|
|
3516
|
+
blueBright: [94, 39],
|
|
3517
|
+
magentaBright: [95, 39],
|
|
3518
|
+
cyanBright: [96, 39],
|
|
3519
|
+
whiteBright: [97, 39]
|
|
3520
|
+
},
|
|
3521
|
+
bgColor: {
|
|
3522
|
+
bgBlack: [40, 49],
|
|
3523
|
+
bgRed: [41, 49],
|
|
3524
|
+
bgGreen: [42, 49],
|
|
3525
|
+
bgYellow: [43, 49],
|
|
3526
|
+
bgBlue: [44, 49],
|
|
3527
|
+
bgMagenta: [45, 49],
|
|
3528
|
+
bgCyan: [46, 49],
|
|
3529
|
+
bgWhite: [47, 49],
|
|
3530
|
+
bgBlackBright: [100, 49],
|
|
3531
|
+
bgGray: [100, 49],
|
|
3532
|
+
bgGrey: [100, 49],
|
|
3533
|
+
bgRedBright: [101, 49],
|
|
3534
|
+
bgGreenBright: [102, 49],
|
|
3535
|
+
bgYellowBright: [103, 49],
|
|
3536
|
+
bgBlueBright: [104, 49],
|
|
3537
|
+
bgMagentaBright: [105, 49],
|
|
3538
|
+
bgCyanBright: [106, 49],
|
|
3539
|
+
bgWhiteBright: [107, 49]
|
|
3540
|
+
}
|
|
3541
|
+
};
|
|
3542
|
+
Object.keys(styles$1.modifier);
|
|
3543
|
+
const foregroundColorNames = Object.keys(styles$1.color);
|
|
3544
|
+
const backgroundColorNames = Object.keys(styles$1.bgColor);
|
|
3545
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
3546
|
+
function assembleStyles() {
|
|
3547
|
+
const codes = /* @__PURE__ */ new Map();
|
|
3548
|
+
for (const [groupName, group] of Object.entries(styles$1)) {
|
|
3549
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
3550
|
+
styles$1[styleName] = {
|
|
3551
|
+
open: `\u001B[${style[0]}m`,
|
|
3552
|
+
close: `\u001B[${style[1]}m`
|
|
3553
|
+
};
|
|
3554
|
+
group[styleName] = styles$1[styleName];
|
|
3555
|
+
codes.set(style[0], style[1]);
|
|
3556
|
+
}
|
|
3557
|
+
Object.defineProperty(styles$1, groupName, {
|
|
3558
|
+
value: group,
|
|
3559
|
+
enumerable: false
|
|
3560
|
+
});
|
|
3561
|
+
}
|
|
3562
|
+
Object.defineProperty(styles$1, "codes", {
|
|
3563
|
+
value: codes,
|
|
3564
|
+
enumerable: false
|
|
3565
|
+
});
|
|
3566
|
+
styles$1.color.close = "\x1B[39m";
|
|
3567
|
+
styles$1.bgColor.close = "\x1B[49m";
|
|
3568
|
+
styles$1.color.ansi = wrapAnsi16();
|
|
3569
|
+
styles$1.color.ansi256 = wrapAnsi256();
|
|
3570
|
+
styles$1.color.ansi16m = wrapAnsi16m();
|
|
3571
|
+
styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
3572
|
+
styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
3573
|
+
styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
3574
|
+
Object.defineProperties(styles$1, {
|
|
3575
|
+
rgbToAnsi256: {
|
|
3576
|
+
value(red, green, blue) {
|
|
3577
|
+
if (red === green && green === blue) {
|
|
3578
|
+
if (red < 8) return 16;
|
|
3579
|
+
if (red > 248) return 231;
|
|
3580
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
3581
|
+
}
|
|
3582
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
3583
|
+
},
|
|
3584
|
+
enumerable: false
|
|
3585
|
+
},
|
|
3586
|
+
hexToRgb: {
|
|
3587
|
+
value(hex) {
|
|
3588
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
3589
|
+
if (!matches) return [
|
|
3590
|
+
0,
|
|
3591
|
+
0,
|
|
3592
|
+
0
|
|
3593
|
+
];
|
|
3594
|
+
let [colorString] = matches;
|
|
3595
|
+
if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
|
|
3596
|
+
const integer = Number.parseInt(colorString, 16);
|
|
3597
|
+
return [
|
|
3598
|
+
integer >> 16 & 255,
|
|
3599
|
+
integer >> 8 & 255,
|
|
3600
|
+
integer & 255
|
|
3601
|
+
];
|
|
3602
|
+
},
|
|
3603
|
+
enumerable: false
|
|
3604
|
+
},
|
|
3605
|
+
hexToAnsi256: {
|
|
3606
|
+
value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
|
|
3607
|
+
enumerable: false
|
|
3608
|
+
},
|
|
3609
|
+
ansi256ToAnsi: {
|
|
3610
|
+
value(code) {
|
|
3611
|
+
if (code < 8) return 30 + code;
|
|
3612
|
+
if (code < 16) return 90 + (code - 8);
|
|
3613
|
+
let red;
|
|
3614
|
+
let green;
|
|
3615
|
+
let blue;
|
|
3616
|
+
if (code >= 232) {
|
|
3617
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
3618
|
+
green = red;
|
|
3619
|
+
blue = red;
|
|
3620
|
+
} else {
|
|
3621
|
+
code -= 16;
|
|
3622
|
+
const remainder = code % 36;
|
|
3623
|
+
red = Math.floor(code / 36) / 5;
|
|
3624
|
+
green = Math.floor(remainder / 6) / 5;
|
|
3625
|
+
blue = remainder % 6 / 5;
|
|
3626
|
+
}
|
|
3627
|
+
const value = Math.max(red, green, blue) * 2;
|
|
3628
|
+
if (value === 0) return 30;
|
|
3629
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
3630
|
+
if (value === 2) result += 60;
|
|
3631
|
+
return result;
|
|
3632
|
+
},
|
|
3633
|
+
enumerable: false
|
|
3634
|
+
},
|
|
3635
|
+
rgbToAnsi: {
|
|
3636
|
+
value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
|
|
3637
|
+
enumerable: false
|
|
3638
|
+
},
|
|
3639
|
+
hexToAnsi: {
|
|
3640
|
+
value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
|
|
3641
|
+
enumerable: false
|
|
3642
|
+
}
|
|
3643
|
+
});
|
|
3644
|
+
return styles$1;
|
|
3645
|
+
}
|
|
3646
|
+
const ansiStyles = assembleStyles();
|
|
3647
|
+
//#endregion
|
|
3648
|
+
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
3649
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
|
|
3650
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
3651
|
+
const position = argv.indexOf(prefix + flag);
|
|
3652
|
+
const terminatorPosition = argv.indexOf("--");
|
|
3653
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
3654
|
+
}
|
|
3655
|
+
const { env } = process$1;
|
|
3656
|
+
let flagForceColor;
|
|
3657
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
3658
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
3659
|
+
function envForceColor() {
|
|
3660
|
+
if ("FORCE_COLOR" in env) {
|
|
3661
|
+
if (env.FORCE_COLOR === "true") return 1;
|
|
3662
|
+
if (env.FORCE_COLOR === "false") return 0;
|
|
3663
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
function translateLevel(level) {
|
|
3667
|
+
if (level === 0) return false;
|
|
3668
|
+
return {
|
|
3669
|
+
level,
|
|
3670
|
+
hasBasic: true,
|
|
3671
|
+
has256: level >= 2,
|
|
3672
|
+
has16m: level >= 3
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
3676
|
+
const noFlagForceColor = envForceColor();
|
|
3677
|
+
if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
|
|
3678
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
3679
|
+
if (forceColor === 0) return 0;
|
|
3680
|
+
if (sniffFlags) {
|
|
3681
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
3682
|
+
if (hasFlag("color=256")) return 2;
|
|
3683
|
+
}
|
|
3684
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
3685
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
3686
|
+
const min = forceColor || 0;
|
|
3687
|
+
if (env.TERM === "dumb") return min;
|
|
3688
|
+
if (process$1.platform === "win32") {
|
|
3689
|
+
const osRelease = os.release().split(".");
|
|
3690
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3691
|
+
return 1;
|
|
3692
|
+
}
|
|
3693
|
+
if ("CI" in env) {
|
|
3694
|
+
if ([
|
|
3695
|
+
"GITHUB_ACTIONS",
|
|
3696
|
+
"GITEA_ACTIONS",
|
|
3697
|
+
"CIRCLECI"
|
|
3698
|
+
].some((key) => key in env)) return 3;
|
|
3699
|
+
if ([
|
|
3700
|
+
"TRAVIS",
|
|
3701
|
+
"APPVEYOR",
|
|
3702
|
+
"GITLAB_CI",
|
|
3703
|
+
"BUILDKITE",
|
|
3704
|
+
"DRONE"
|
|
3705
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
3706
|
+
return min;
|
|
3707
|
+
}
|
|
3708
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3709
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
3710
|
+
if (env.TERM === "xterm-kitty") return 3;
|
|
3711
|
+
if (env.TERM === "xterm-ghostty") return 3;
|
|
3712
|
+
if (env.TERM === "wezterm") return 3;
|
|
3713
|
+
if ("TERM_PROGRAM" in env) {
|
|
3714
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
3715
|
+
switch (env.TERM_PROGRAM) {
|
|
3716
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
3717
|
+
case "Apple_Terminal": return 2;
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
3721
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
3722
|
+
if ("COLORTERM" in env) return 1;
|
|
3723
|
+
return min;
|
|
3724
|
+
}
|
|
3725
|
+
function createSupportsColor(stream, options = {}) {
|
|
3726
|
+
return translateLevel(_supportsColor(stream, {
|
|
3727
|
+
streamIsTTY: stream && stream.isTTY,
|
|
3728
|
+
...options
|
|
3729
|
+
}));
|
|
3730
|
+
}
|
|
3731
|
+
const supportsColor = {
|
|
3732
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
3733
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
3734
|
+
};
|
|
3735
|
+
//#endregion
|
|
3736
|
+
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
3737
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
3738
|
+
let index = string.indexOf(substring);
|
|
3739
|
+
if (index === -1) return string;
|
|
3740
|
+
const substringLength = substring.length;
|
|
3741
|
+
let endIndex = 0;
|
|
3742
|
+
let returnValue = "";
|
|
3743
|
+
do {
|
|
3744
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
3745
|
+
endIndex = index + substringLength;
|
|
3746
|
+
index = string.indexOf(substring, endIndex);
|
|
3747
|
+
} while (index !== -1);
|
|
3748
|
+
returnValue += string.slice(endIndex);
|
|
3749
|
+
return returnValue;
|
|
3750
|
+
}
|
|
3751
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
3752
|
+
let endIndex = 0;
|
|
3753
|
+
let returnValue = "";
|
|
3754
|
+
do {
|
|
3755
|
+
const gotCR = string[index - 1] === "\r";
|
|
3756
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
3757
|
+
endIndex = index + 1;
|
|
3758
|
+
index = string.indexOf("\n", endIndex);
|
|
3759
|
+
} while (index !== -1);
|
|
3760
|
+
returnValue += string.slice(endIndex);
|
|
3761
|
+
return returnValue;
|
|
3762
|
+
}
|
|
3763
|
+
//#endregion
|
|
3764
|
+
//#region node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
3765
|
+
const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
|
|
3766
|
+
const GENERATOR = Symbol("GENERATOR");
|
|
3767
|
+
const STYLER = Symbol("STYLER");
|
|
3768
|
+
const IS_EMPTY = Symbol("IS_EMPTY");
|
|
3769
|
+
const levelMapping = [
|
|
3770
|
+
"ansi",
|
|
3771
|
+
"ansi",
|
|
3772
|
+
"ansi256",
|
|
3773
|
+
"ansi16m"
|
|
3774
|
+
];
|
|
3775
|
+
const styles = Object.create(null);
|
|
3776
|
+
const applyOptions = (object, options = {}) => {
|
|
3777
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3778
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3779
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3780
|
+
};
|
|
3781
|
+
const chalkFactory = (options) => {
|
|
3782
|
+
const chalk = (...strings) => strings.join(" ");
|
|
3783
|
+
applyOptions(chalk, options);
|
|
3784
|
+
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
3785
|
+
return chalk;
|
|
3786
|
+
};
|
|
3787
|
+
function createChalk(options) {
|
|
3788
|
+
return chalkFactory(options);
|
|
3789
|
+
}
|
|
3790
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
3791
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
|
|
3792
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
3793
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
3794
|
+
return builder;
|
|
3795
|
+
} };
|
|
3796
|
+
styles.visible = { get() {
|
|
3797
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
3798
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
3799
|
+
return builder;
|
|
3800
|
+
} };
|
|
3801
|
+
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
3802
|
+
if (model === "rgb") {
|
|
3803
|
+
if (level === "ansi16m") return ansiStyles[type].ansi16m(...arguments_);
|
|
3804
|
+
if (level === "ansi256") return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
|
|
3805
|
+
return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
|
|
3806
|
+
}
|
|
3807
|
+
if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles.hexToRgb(...arguments_));
|
|
3808
|
+
return ansiStyles[type][model](...arguments_);
|
|
3809
|
+
};
|
|
3810
|
+
for (const model of [
|
|
3811
|
+
"rgb",
|
|
3812
|
+
"hex",
|
|
3813
|
+
"ansi256"
|
|
3814
|
+
]) {
|
|
3815
|
+
styles[model] = { get() {
|
|
3816
|
+
const { level } = this;
|
|
3817
|
+
return function(...arguments_) {
|
|
3818
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles.color.close, this[STYLER]);
|
|
3819
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3820
|
+
};
|
|
3821
|
+
} };
|
|
3822
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3823
|
+
styles[bgModel] = { get() {
|
|
3824
|
+
const { level } = this;
|
|
3825
|
+
return function(...arguments_) {
|
|
3826
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
|
|
3827
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3828
|
+
};
|
|
3829
|
+
} };
|
|
3830
|
+
}
|
|
3831
|
+
const proto = Object.defineProperties(() => {}, {
|
|
3832
|
+
...styles,
|
|
3833
|
+
level: {
|
|
3834
|
+
enumerable: true,
|
|
3835
|
+
get() {
|
|
3836
|
+
return this[GENERATOR].level;
|
|
3837
|
+
},
|
|
3838
|
+
set(level) {
|
|
3839
|
+
this[GENERATOR].level = level;
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
const createStyler = (open, close, parent) => {
|
|
3844
|
+
let openAll;
|
|
3845
|
+
let closeAll;
|
|
3846
|
+
if (parent === void 0) {
|
|
3847
|
+
openAll = open;
|
|
3848
|
+
closeAll = close;
|
|
3849
|
+
} else {
|
|
3850
|
+
openAll = parent.openAll + open;
|
|
3851
|
+
closeAll = close + parent.closeAll;
|
|
3852
|
+
}
|
|
3853
|
+
return {
|
|
3854
|
+
open,
|
|
3855
|
+
close,
|
|
3856
|
+
openAll,
|
|
3857
|
+
closeAll,
|
|
3858
|
+
parent
|
|
3859
|
+
};
|
|
3860
|
+
};
|
|
3861
|
+
const createBuilder = (self, _styler, _isEmpty) => {
|
|
3862
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3863
|
+
Object.setPrototypeOf(builder, proto);
|
|
3864
|
+
builder[GENERATOR] = self;
|
|
3865
|
+
builder[STYLER] = _styler;
|
|
3866
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
3867
|
+
return builder;
|
|
3868
|
+
};
|
|
3869
|
+
const applyStyle = (self, string) => {
|
|
3870
|
+
if (self.level <= 0 || !string) return self[IS_EMPTY] ? "" : string;
|
|
3871
|
+
let styler = self[STYLER];
|
|
3872
|
+
if (styler === void 0) return string;
|
|
3873
|
+
const { openAll, closeAll } = styler;
|
|
3874
|
+
if (string.includes("\x1B")) while (styler !== void 0) {
|
|
3875
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
3876
|
+
styler = styler.parent;
|
|
3877
|
+
}
|
|
3878
|
+
const lfIndex = string.indexOf("\n");
|
|
3879
|
+
if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
3880
|
+
return openAll + string + closeAll;
|
|
3881
|
+
};
|
|
3882
|
+
Object.defineProperties(createChalk.prototype, styles);
|
|
3883
|
+
const chalk = createChalk();
|
|
3884
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3885
|
+
//#endregion
|
|
3886
|
+
//#region src/validator/ajv-validators.ts
|
|
3887
|
+
const planSchemaValidator = validate14;
|
|
3888
|
+
const schema32 = {
|
|
3889
|
+
"type": "array",
|
|
3890
|
+
"items": {
|
|
3891
|
+
"type": "object",
|
|
3892
|
+
"properties": {
|
|
3893
|
+
"fileHash": { "type": ["string"] },
|
|
3894
|
+
"fileName": { "type": "string" },
|
|
3895
|
+
"sequence": {
|
|
3896
|
+
"type": "string",
|
|
3897
|
+
"pattern": "^[1-9][0-9]*(.[1-9][0-9]*)*$"
|
|
3898
|
+
}
|
|
3899
|
+
},
|
|
3900
|
+
"required": [
|
|
3901
|
+
"fileHash",
|
|
3902
|
+
"fileName",
|
|
3903
|
+
"sequence"
|
|
3904
|
+
],
|
|
3905
|
+
"additionalProperties": false
|
|
3906
|
+
}
|
|
3907
|
+
};
|
|
3908
|
+
const pattern0 = /* @__PURE__ */ new RegExp("^[1-9][0-9]*(.[1-9][0-9]*)*$", "u");
|
|
3909
|
+
function validate14(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
3910
|
+
let vErrors = null;
|
|
3911
|
+
let errors = 0;
|
|
3912
|
+
if (Array.isArray(data)) {
|
|
3913
|
+
const len0 = data.length;
|
|
3914
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
3915
|
+
let data0 = data[i0];
|
|
3916
|
+
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
|
3917
|
+
if (data0.fileHash === void 0) {
|
|
3918
|
+
const err0 = {
|
|
3919
|
+
instancePath: instancePath + "/" + i0,
|
|
3920
|
+
schemaPath: "#/items/required",
|
|
3921
|
+
keyword: "required",
|
|
3922
|
+
params: { missingProperty: "fileHash" },
|
|
3923
|
+
message: "must have required property 'fileHash'"
|
|
3924
|
+
};
|
|
3925
|
+
if (vErrors === null) vErrors = [err0];
|
|
3926
|
+
else vErrors.push(err0);
|
|
3927
|
+
errors++;
|
|
3928
|
+
}
|
|
3929
|
+
if (data0.fileName === void 0) {
|
|
3930
|
+
const err1 = {
|
|
3931
|
+
instancePath: instancePath + "/" + i0,
|
|
3932
|
+
schemaPath: "#/items/required",
|
|
3933
|
+
keyword: "required",
|
|
3934
|
+
params: { missingProperty: "fileName" },
|
|
3935
|
+
message: "must have required property 'fileName'"
|
|
3936
|
+
};
|
|
3937
|
+
if (vErrors === null) vErrors = [err1];
|
|
3938
|
+
else vErrors.push(err1);
|
|
3939
|
+
errors++;
|
|
3940
|
+
}
|
|
3941
|
+
if (data0.sequence === void 0) {
|
|
3942
|
+
const err2 = {
|
|
3943
|
+
instancePath: instancePath + "/" + i0,
|
|
3944
|
+
schemaPath: "#/items/required",
|
|
3945
|
+
keyword: "required",
|
|
3946
|
+
params: { missingProperty: "sequence" },
|
|
3947
|
+
message: "must have required property 'sequence'"
|
|
3948
|
+
};
|
|
3949
|
+
if (vErrors === null) vErrors = [err2];
|
|
3950
|
+
else vErrors.push(err2);
|
|
3951
|
+
errors++;
|
|
3952
|
+
}
|
|
3953
|
+
for (const key0 in data0) if (!(key0 === "fileHash" || key0 === "fileName" || key0 === "sequence")) {
|
|
3954
|
+
const err3 = {
|
|
3955
|
+
instancePath: instancePath + "/" + i0,
|
|
3956
|
+
schemaPath: "#/items/additionalProperties",
|
|
3957
|
+
keyword: "additionalProperties",
|
|
3958
|
+
params: { additionalProperty: key0 },
|
|
3959
|
+
message: "must NOT have additional properties"
|
|
3960
|
+
};
|
|
3961
|
+
if (vErrors === null) vErrors = [err3];
|
|
3962
|
+
else vErrors.push(err3);
|
|
3963
|
+
errors++;
|
|
3964
|
+
}
|
|
3965
|
+
if (data0.fileHash !== void 0) {
|
|
3966
|
+
if (typeof data0.fileHash !== "string") {
|
|
3967
|
+
const err4 = {
|
|
3968
|
+
instancePath: instancePath + "/" + i0 + "/fileHash",
|
|
3969
|
+
schemaPath: "#/items/properties/fileHash/type",
|
|
3970
|
+
keyword: "type",
|
|
3971
|
+
params: { type: schema32.items.properties.fileHash.type },
|
|
3972
|
+
message: "must be string"
|
|
3973
|
+
};
|
|
3974
|
+
if (vErrors === null) vErrors = [err4];
|
|
3975
|
+
else vErrors.push(err4);
|
|
3976
|
+
errors++;
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
if (data0.fileName !== void 0) {
|
|
3980
|
+
if (typeof data0.fileName !== "string") {
|
|
3981
|
+
const err5 = {
|
|
3982
|
+
instancePath: instancePath + "/" + i0 + "/fileName",
|
|
3983
|
+
schemaPath: "#/items/properties/fileName/type",
|
|
3984
|
+
keyword: "type",
|
|
3985
|
+
params: { type: "string" },
|
|
3986
|
+
message: "must be string"
|
|
3987
|
+
};
|
|
3988
|
+
if (vErrors === null) vErrors = [err5];
|
|
3989
|
+
else vErrors.push(err5);
|
|
3990
|
+
errors++;
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
if (data0.sequence !== void 0) {
|
|
3994
|
+
let data3 = data0.sequence;
|
|
3995
|
+
if (typeof data3 === "string") {
|
|
3996
|
+
if (!pattern0.test(data3)) {
|
|
3997
|
+
const err6 = {
|
|
3998
|
+
instancePath: instancePath + "/" + i0 + "/sequence",
|
|
3999
|
+
schemaPath: "#/items/properties/sequence/pattern",
|
|
4000
|
+
keyword: "pattern",
|
|
4001
|
+
params: { pattern: "^[1-9][0-9]*(.[1-9][0-9]*)*$" },
|
|
4002
|
+
message: "must match pattern \"^[1-9][0-9]*(.[1-9][0-9]*)*$\""
|
|
4003
|
+
};
|
|
4004
|
+
if (vErrors === null) vErrors = [err6];
|
|
4005
|
+
else vErrors.push(err6);
|
|
4006
|
+
errors++;
|
|
4007
|
+
}
|
|
4008
|
+
} else {
|
|
4009
|
+
const err7 = {
|
|
4010
|
+
instancePath: instancePath + "/" + i0 + "/sequence",
|
|
4011
|
+
schemaPath: "#/items/properties/sequence/type",
|
|
4012
|
+
keyword: "type",
|
|
4013
|
+
params: { type: "string" },
|
|
4014
|
+
message: "must be string"
|
|
4015
|
+
};
|
|
4016
|
+
if (vErrors === null) vErrors = [err7];
|
|
4017
|
+
else vErrors.push(err7);
|
|
4018
|
+
errors++;
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
} else {
|
|
4022
|
+
const err8 = {
|
|
4023
|
+
instancePath: instancePath + "/" + i0,
|
|
4024
|
+
schemaPath: "#/items/type",
|
|
4025
|
+
keyword: "type",
|
|
4026
|
+
params: { type: "object" },
|
|
4027
|
+
message: "must be object"
|
|
4028
|
+
};
|
|
4029
|
+
if (vErrors === null) vErrors = [err8];
|
|
4030
|
+
else vErrors.push(err8);
|
|
4031
|
+
errors++;
|
|
4032
|
+
}
|
|
4033
|
+
}
|
|
4034
|
+
} else {
|
|
4035
|
+
const err9 = {
|
|
4036
|
+
instancePath,
|
|
4037
|
+
schemaPath: "#/type",
|
|
4038
|
+
keyword: "type",
|
|
4039
|
+
params: { type: "array" },
|
|
4040
|
+
message: "must be array"
|
|
4041
|
+
};
|
|
4042
|
+
if (vErrors === null) vErrors = [err9];
|
|
4043
|
+
else vErrors.push(err9);
|
|
4044
|
+
errors++;
|
|
4045
|
+
}
|
|
4046
|
+
validate14.errors = vErrors;
|
|
4047
|
+
return errors === 0;
|
|
4048
|
+
}
|
|
4049
|
+
//#endregion
|
|
4050
|
+
//#region src/validator/validator.ts
|
|
4051
|
+
const isNonEmptyString = (input) => isString(input) && input.length > 0;
|
|
4052
|
+
/**
|
|
4053
|
+
* Validates if a plan matches the schema
|
|
4054
|
+
*/
|
|
4055
|
+
const validatePlan = (plan) => {
|
|
4056
|
+
const valid = planSchemaValidator(plan);
|
|
4057
|
+
const errors = planSchemaValidator.errors;
|
|
4058
|
+
if (errors?.length) errors.forEach((e) => console.error(`${e.message}${e.instancePath ? `at ${e.instancePath}` : ""}`));
|
|
4059
|
+
return valid;
|
|
4060
|
+
};
|
|
4061
|
+
/**
|
|
4062
|
+
* Validates if file description format is valid
|
|
4063
|
+
*/
|
|
4064
|
+
const validateFileDescription = (description) => {
|
|
4065
|
+
if (!description) return false;
|
|
4066
|
+
return /^([a-z]+|(([a-z]+-)+[a-z]+))$/g.test(description);
|
|
4067
|
+
};
|
|
4068
|
+
/**
|
|
4069
|
+
* Validates if fileName format is valid
|
|
4070
|
+
*/
|
|
4071
|
+
const validateFileName = (fileName) => {
|
|
4072
|
+
return /^([a-z]+|(([a-z]+-)+[a-z]+))(.js|.skip.js)$/g.test(fileName);
|
|
4073
|
+
};
|
|
4074
|
+
/**
|
|
4075
|
+
* Throws if file names are invalid
|
|
4076
|
+
*/
|
|
4077
|
+
const throwIfFileNamesInvalid = (fileEntries) => {
|
|
4078
|
+
const invalidFileNames = fileEntries.filter((f) => !f.isValidFileName).map((f) => f.fileName);
|
|
4079
|
+
if (invalidFileNames.length) {
|
|
4080
|
+
invalidFileNames.forEach((name) => console.error(chalk.red(name)));
|
|
4081
|
+
throw new Error("Invalid migration filename format (use kebab-case)");
|
|
4058
4082
|
}
|
|
4059
|
-
return 0;
|
|
4060
4083
|
};
|
|
4061
|
-
//#endregion
|
|
4062
|
-
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs
|
|
4063
|
-
const regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
4064
|
-
const regexIsPlainProp = /^\w*$/;
|
|
4065
|
-
function isKey(value, object) {
|
|
4066
|
-
if (Array.isArray(value)) return false;
|
|
4067
|
-
if (typeof value === "number" || typeof value === "boolean" || value == null || isSymbol(value)) return true;
|
|
4068
|
-
return typeof value === "string" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);
|
|
4069
|
-
}
|
|
4070
|
-
//#endregion
|
|
4071
|
-
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/array/orderBy.mjs
|
|
4072
|
-
function orderBy(collection, criteria, orders, guard) {
|
|
4073
|
-
if (collection == null) return [];
|
|
4074
|
-
orders = guard ? void 0 : orders;
|
|
4075
|
-
if (!Array.isArray(collection)) collection = Object.values(collection);
|
|
4076
|
-
if (!Array.isArray(criteria)) criteria = criteria == null ? [null] : [criteria];
|
|
4077
|
-
if (criteria.length === 0) criteria = [null];
|
|
4078
|
-
if (!Array.isArray(orders)) orders = orders == null ? [] : [orders];
|
|
4079
|
-
orders = orders.map((order) => String(order));
|
|
4080
|
-
const getValueByNestedPath = (object, path) => {
|
|
4081
|
-
let target = object;
|
|
4082
|
-
for (let i = 0; i < path.length && target != null; ++i) target = target[path[i]];
|
|
4083
|
-
return target;
|
|
4084
|
-
};
|
|
4085
|
-
const getValueByCriterion = (criterion, object) => {
|
|
4086
|
-
if (object == null || criterion == null) return object;
|
|
4087
|
-
if (typeof criterion === "object" && "key" in criterion) {
|
|
4088
|
-
if (Object.hasOwn(object, criterion.key)) return object[criterion.key];
|
|
4089
|
-
return getValueByNestedPath(object, criterion.path);
|
|
4090
|
-
}
|
|
4091
|
-
if (typeof criterion === "function") return criterion(object);
|
|
4092
|
-
if (Array.isArray(criterion)) return getValueByNestedPath(object, criterion);
|
|
4093
|
-
if (typeof object === "object") return object[criterion];
|
|
4094
|
-
return object;
|
|
4095
|
-
};
|
|
4096
|
-
const preparedCriteria = criteria.map((criterion) => {
|
|
4097
|
-
if (Array.isArray(criterion) && criterion.length === 1) criterion = criterion[0];
|
|
4098
|
-
if (criterion == null || typeof criterion === "function" || Array.isArray(criterion) || isKey(criterion)) return criterion;
|
|
4099
|
-
return {
|
|
4100
|
-
key: criterion,
|
|
4101
|
-
path: toPath(criterion)
|
|
4102
|
-
};
|
|
4103
|
-
});
|
|
4104
|
-
return collection.map((item) => ({
|
|
4105
|
-
original: item,
|
|
4106
|
-
criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item))
|
|
4107
|
-
})).slice().sort((a, b) => {
|
|
4108
|
-
for (let i = 0; i < preparedCriteria.length; i++) {
|
|
4109
|
-
const comparedResult = compareValues(a.criteria[i], b.criteria[i], orders[i]);
|
|
4110
|
-
if (comparedResult !== 0) return comparedResult;
|
|
4111
|
-
}
|
|
4112
|
-
return 0;
|
|
4113
|
-
}).map((item) => item.original);
|
|
4114
|
-
}
|
|
4115
|
-
//#endregion
|
|
4116
|
-
//#region node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/array/sortBy.mjs
|
|
4117
|
-
function sortBy(collection, ...criteria) {
|
|
4118
|
-
const length = criteria.length;
|
|
4119
|
-
if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) criteria = [];
|
|
4120
|
-
else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]];
|
|
4121
|
-
return orderBy(collection, flatten(criteria), ["asc"]);
|
|
4122
|
-
}
|
|
4123
|
-
//#endregion
|
|
4124
|
-
//#region src/glob/glob.ts
|
|
4125
4084
|
/**
|
|
4126
|
-
*
|
|
4127
|
-
*
|
|
4128
|
-
* @param {Array<String>} filePaths
|
|
4129
|
-
* @returns {Array<String>} sorted files
|
|
4085
|
+
* Warns if files have been removed
|
|
4130
4086
|
*/
|
|
4131
|
-
const
|
|
4132
|
-
|
|
4133
|
-
|
|
4087
|
+
const warnIfFilesHaveBeenRemovedFromPlan = (migrationEntries, historicalMigrations) => {
|
|
4088
|
+
const fileNames = migrationEntries.map((f) => f.fileName);
|
|
4089
|
+
const deletedFilesNames = historicalMigrations.filter((e) => !fileNames.includes(e.fileName)).map((e) => e.fileName);
|
|
4090
|
+
if (deletedFilesNames.length) {
|
|
4091
|
+
deletedFilesNames.forEach((name) => console.warn(chalk.yellow(name)));
|
|
4092
|
+
console.warn(chalk.yellow("Previously executed migration files have been deleted from plan.json (rename file to .skip.js and replace with a new file instead)"));
|
|
4093
|
+
}
|
|
4094
|
+
};
|
|
4134
4095
|
/**
|
|
4135
|
-
*
|
|
4136
|
-
*
|
|
4137
|
-
* @param {String} pathToMigrations
|
|
4138
|
-
* @returns {Promise<Array<String>>} matching migration filePaths
|
|
4096
|
+
* Throws error if any pre-existing file has changed
|
|
4139
4097
|
*/
|
|
4140
|
-
const
|
|
4141
|
-
const
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
] }));
|
|
4098
|
+
const throwIfFilesHaveChanged = (migrationEntries) => {
|
|
4099
|
+
const changedFilesNames = migrationEntries.filter((m) => {
|
|
4100
|
+
const { fileHash, fileHashFromPlan, fileHashFromHistory, skippedFileHashes } = m;
|
|
4101
|
+
const matchesHistory = !isNonEmptyString(fileHashFromHistory) || [fileHash].concat(skippedFileHashes).includes(fileHashFromHistory);
|
|
4102
|
+
const matchesPlan = !isNonEmptyString(fileHashFromPlan) || [fileHash].concat(skippedFileHashes).includes(fileHashFromPlan);
|
|
4103
|
+
return !(matchesHistory && matchesPlan);
|
|
4104
|
+
}).map((f) => f.fileName);
|
|
4105
|
+
if (changedFilesNames.length) {
|
|
4106
|
+
changedFilesNames.forEach((name) => console.error(chalk.red(name)));
|
|
4107
|
+
throw new Error("Not allowed to change migration files (for unreleased local work, you can use the `force` option)");
|
|
4108
|
+
}
|
|
4152
4109
|
};
|
|
4153
4110
|
/**
|
|
4154
|
-
*
|
|
4155
|
-
*
|
|
4156
|
-
* @param {String} pathToMigrations
|
|
4157
|
-
* @returns {Promise<Array<String>>} skipped migration filePaths
|
|
4111
|
+
* Throws error if previous sequence numbers have changed
|
|
4158
4112
|
*/
|
|
4159
|
-
const
|
|
4160
|
-
const
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4113
|
+
const throwIfSequenceHasChanged = (migrationEntries) => {
|
|
4114
|
+
const changeSequences = migrationEntries.filter((m) => {
|
|
4115
|
+
const { sequence, sequenceFromHistory } = m;
|
|
4116
|
+
return isString(sequenceFromHistory) && sequenceFromHistory !== sequence;
|
|
4117
|
+
}).map((f) => f.fileName);
|
|
4118
|
+
if (changeSequences.length) {
|
|
4119
|
+
changeSequences.forEach((name) => console.error(chalk.red(name)));
|
|
4120
|
+
throw new Error("Not allowed to change migration sequences in plan.json");
|
|
4121
|
+
}
|
|
4122
|
+
};
|
|
4123
|
+
/**
|
|
4124
|
+
* Throws error if sequence numbers are not unique
|
|
4125
|
+
*/
|
|
4126
|
+
const throwIfSequenceNotUnique = (migrationEntries) => {
|
|
4127
|
+
const repeatedSequenceNumbers = migrationEntries.map((f) => f.sequence).filter(((s) => (v) => s.has(v) || !s.add(v))(/* @__PURE__ */ new Set()));
|
|
4128
|
+
const duplicates = migrationEntries.filter((f) => repeatedSequenceNumbers.includes(f.sequence)).map((f) => f.fileName);
|
|
4129
|
+
if (duplicates.length) {
|
|
4130
|
+
duplicates.forEach((fileName) => console.error(chalk.red(fileName)));
|
|
4131
|
+
throw new Error("Migrations must have unique sequence numbers in plan.json");
|
|
4132
|
+
}
|
|
4133
|
+
};
|
|
4134
|
+
/**
|
|
4135
|
+
* Throws error if sequence numbers are not unique
|
|
4136
|
+
*/
|
|
4137
|
+
const throwIfSequenceHasIntegerGaps = (migrationEntries) => {
|
|
4138
|
+
const toInteger = (sequence) => parseInt(sequence.split(".")[0], 10);
|
|
4139
|
+
const unique = (arr) => Array.from(new Set(arr));
|
|
4140
|
+
const orderedUniqueSequenceIntegers = unique(migrationEntries.map((s) => s.sequence).map((s) => toInteger(s))).sort((a, b) => a - b);
|
|
4141
|
+
const max = orderedUniqueSequenceIntegers[orderedUniqueSequenceIntegers.length - 1];
|
|
4142
|
+
const missing = xor(orderedUniqueSequenceIntegers, Array.from({ length: max }, (_v, k) => k + 1));
|
|
4143
|
+
if (missing.length) throw new Error(`Migration sequence numbers in plan.json have unexpected gaps: ${missing.join(", ")}`);
|
|
4144
|
+
};
|
|
4145
|
+
/**
|
|
4146
|
+
* Throws error if file names are not unique
|
|
4147
|
+
*/
|
|
4148
|
+
const throwIfFileNamesNotUnique = (migrationEntries) => {
|
|
4149
|
+
const repeatedFileNames = migrationEntries.map((f) => f.fileName).filter(((s) => (v) => s.has(v) || !s.add(v))(/* @__PURE__ */ new Set()));
|
|
4150
|
+
if (repeatedFileNames.length) {
|
|
4151
|
+
repeatedFileNames.forEach((fileName) => console.error(chalk.red(fileName)));
|
|
4152
|
+
throw new Error("Migration file names must be unique");
|
|
4153
|
+
}
|
|
4154
|
+
};
|
|
4155
|
+
/**
|
|
4156
|
+
* Throws error if files listed in plan.json are found
|
|
4157
|
+
*/
|
|
4158
|
+
const throwIfFilesNotFound = (migrationEntries) => {
|
|
4159
|
+
const migrationsWithoutFiles = migrationEntries.filter((m) => !m.script || !m.script && !m.migrator);
|
|
4160
|
+
if (migrationsWithoutFiles.length) {
|
|
4161
|
+
migrationsWithoutFiles.forEach((migration) => console.error(chalk.red(migration.fileName)));
|
|
4162
|
+
throw new Error("Migration files from plan.json are missing from filesystem");
|
|
4163
|
+
}
|
|
4170
4164
|
};
|
|
4171
4165
|
//#endregion
|
|
4172
4166
|
//#region src/database/database.ts
|
|
@@ -4500,6 +4494,28 @@ const getPlannedMigrations = async ({ config }) => {
|
|
|
4500
4494
|
};
|
|
4501
4495
|
const PlanModule = { getPlannedMigrations };
|
|
4502
4496
|
//#endregion
|
|
4497
|
+
//#region src/plan/check-migration-plan.ts
|
|
4498
|
+
/** Check the committed plan against migration files without modifying files or accessing a database. */
|
|
4499
|
+
const checkMigrationPlan = async ({ directory }) => {
|
|
4500
|
+
const committedPlan = parsePlan$1(await readPlan(directory));
|
|
4501
|
+
const { validatedPlan } = await getPlannedMigrations({ config: {
|
|
4502
|
+
directory,
|
|
4503
|
+
dry: true
|
|
4504
|
+
} });
|
|
4505
|
+
for (const migration of validatedPlan) if (committedPlan.find((entry) => entry.fileName === migration.fileName)?.fileHash !== migration.fileHash) throw new Error(`Migration plan is out of date: ${migration.fileName}. Update and commit plan.json.`);
|
|
4506
|
+
const filePaths = await getMigrationFilePaths(directory);
|
|
4507
|
+
for (const filePath of filePaths) {
|
|
4508
|
+
const fileName = path.basename(filePath);
|
|
4509
|
+
if (!committedPlan.some((entry) => entry.fileName === fileName)) throw new Error(`Migration file is missing from plan.json: ${fileName}.`);
|
|
4510
|
+
}
|
|
4511
|
+
};
|
|
4512
|
+
//#endregion
|
|
4513
|
+
//#region src/helpers/helpers.ts
|
|
4514
|
+
const capitalize = (word) => {
|
|
4515
|
+
if (!word) return "";
|
|
4516
|
+
return word[0].toUpperCase() + word.slice(1);
|
|
4517
|
+
};
|
|
4518
|
+
//#endregion
|
|
4503
4519
|
//#region src/create/create.ts
|
|
4504
4520
|
const templateMigrationFileWithMetaDataLegacy = (entity) => `import produce from 'immer';
|
|
4505
4521
|
//other imports not allowed
|
|
@@ -4767,12 +4783,15 @@ const getPendingMigrators = async ({ config, preparedPlan }) => {
|
|
|
4767
4783
|
//#region src/migrate/migrate.ts
|
|
4768
4784
|
/**
|
|
4769
4785
|
* Migrates a payload
|
|
4770
|
-
*
|
|
4771
|
-
* There are two ways to use this function:
|
|
4772
|
-
* i) function looks up the pending migrations for you (default)
|
|
4773
|
-
* ii) reuse a prepared plan while resolving pending migrations for the current payload version
|
|
4774
4786
|
*/
|
|
4775
|
-
const migrate = async ({ payload, config, metaData
|
|
4787
|
+
const migrate = async ({ payload, config, metaData }) => {
|
|
4788
|
+
return migrateWithPlan({
|
|
4789
|
+
payload,
|
|
4790
|
+
config,
|
|
4791
|
+
metaData
|
|
4792
|
+
});
|
|
4793
|
+
};
|
|
4794
|
+
const migrateWithPlan = async ({ payload, config, metaData, preparedPlan }) => {
|
|
4776
4795
|
const { pendingMigrators, nextVersion } = await getPendingMigrators({
|
|
4777
4796
|
config,
|
|
4778
4797
|
preparedPlan
|
|
@@ -4800,7 +4819,7 @@ const migrateRecord = async ({ record, config, preparedPlan, beforeMigrateRecord
|
|
|
4800
4819
|
transaction,
|
|
4801
4820
|
dry
|
|
4802
4821
|
});
|
|
4803
|
-
const { nextPayload: nextData, nextVersion } = await
|
|
4822
|
+
const { nextPayload: nextData, nextVersion } = await migrateWithPlan({
|
|
4804
4823
|
payload,
|
|
4805
4824
|
preparedPlan,
|
|
4806
4825
|
config: {
|
|
@@ -4872,7 +4891,7 @@ const migrateRecords = async ({ recordList, config, preparedPlan, beforeMigrateR
|
|
|
4872
4891
|
* Migrate all records (only use via command line interface)
|
|
4873
4892
|
*/
|
|
4874
4893
|
const migrateAll = async ({ config, beforeMigrateRecord, afterMigrateRecord, onMigrationErrors }) => {
|
|
4875
|
-
const preparedPlan = await getPlannedMigrations({ config });
|
|
4894
|
+
const preparedPlan = await PlanModule.getPlannedMigrations({ config });
|
|
4876
4895
|
const { validatedPlan: latestPlan, nextVersion: latestVersion } = preparedPlan;
|
|
4877
4896
|
await migrateRecords({
|
|
4878
4897
|
config,
|
|
@@ -4937,4 +4956,4 @@ const printVersionHistory = async ({ config }) => {
|
|
|
4937
4956
|
}
|
|
4938
4957
|
};
|
|
4939
4958
|
//#endregion
|
|
4940
|
-
export { createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
4959
|
+
export { checkMigrationPlan, createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|