@flemist/simple-utils 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +115 -53
- package/build/common/async/index.d.ts +1 -0
- package/build/common/async/retry/index.d.ts +2 -0
- package/build/common/async/retry/types.d.ts +15 -0
- package/build/common/async/retry/withRetry.d.ts +28 -0
- package/build/common/debug/LogLevel.d.ts +6 -0
- package/build/common/debug/console/consoleIntercept.d.ts +18 -0
- package/build/common/debug/console/consoleReplace.d.ts +2 -1
- package/build/common/debug/console/index.d.ts +1 -0
- package/build/common/debug/index.d.ts +1 -0
- package/build/common/index.cjs +1 -1
- package/build/common/index.d.ts +2 -0
- package/build/common/index.mjs +115 -53
- package/build/common/rx/Derived.d.ts +11 -0
- package/build/common/rx/Subject.d.ts +35 -0
- package/build/common/rx/SubjectWithId.d.ts +15 -0
- package/build/common/rx/helpers.d.ts +2 -0
- package/build/common/rx/index.d.ts +5 -0
- package/build/common/rx/types.d.ts +35 -0
- package/build/common/rx/waitObservable.d.ts +3 -0
- package/build/node/index.cjs +5 -2
- package/build/node/index.d.ts +2 -0
- package/build/node/index.mjs +912 -238
- package/build/node/process/exec.d.ts +2 -0
- package/build/node/process/index.d.ts +1 -0
- package/build/urlGet-BCW9jvAm.mjs +1947 -0
- package/build/urlGet-BOGFUahf.js +17 -0
- package/package.json +1 -1
- package/build/urlGet-gscwyYHD.mjs +0 -780
- package/build/urlGet-jyEOC24k.js +0 -11
package/build/node/index.mjs
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { T as ct, Q as lt, E as ut } from "../urlGet-BCW9jvAm.mjs";
|
|
2
|
+
import { L as Yt, V as Zt, W as te, O as ee, R as ne, _ as re, $ as se, U as ae, K as oe, G as ie, a2 as ce, J as le, H as ue, M as fe, q as de, Y as he, l as me, o as pe, A as ye, B as we, C as ge, D as xe, y as Se, z as Ee, P as ke, u as Oe, v as be, w as je, I as Pe, p as Le, d as Ae, g as Ce, Z as De, a1 as Fe, aq as Te, as as Ie, a5 as We, a3 as _e, aP as Re, a4 as Me, a8 as Ne, au as ze, ax as $e, am as Je, al as Ue, a9 as He, aI as Be, ag as Ge, aH as Ke, ae as Ve, aG as qe, aj as ve, ad as Qe, aJ as Xe, ab as Ye, aa as Ze, a7 as tn, aM as en, ao as nn, an as rn, ac as sn, af as an, aA as on, aB as cn, aC as ln, aE as un, ay as fn, aF as dn, ah as hn, aD as mn, az as pn, aw as yn, at as wn, ap as gn, ar as xn, aK as Sn, aL as En, a6 as kn, ai as On, av as bn, ak as jn, aN as Pn, aO as Ln, b as An, m as Cn, c as Dn, n as Fn, f as Tn, k as In, r as Wn, h as _n, e as Rn, i as Mn, j as Nn, F as zn, a as $n, s as Jn, S as Un, t as Hn, x as Bn, aV as Gn, aX as Kn, aW as Vn, aQ as qn, aU as vn, aR as Qn, aT as Xn, aS as Yn, a0 as Zn, N as tr, X as er } from "../urlGet-BCW9jvAm.mjs";
|
|
3
|
+
import { Locker as ft, useAbortController as dt, combineAbortSignals as ht, delay as mt } from "@flemist/async-utils";
|
|
4
|
+
import { Pool as pt, poolRunWait as M } from "@flemist/time-limits";
|
|
5
|
+
import yt from "node:os";
|
|
6
|
+
import * as T from "path";
|
|
7
|
+
import { priorityCreate as J } from "@flemist/priority-queue";
|
|
7
8
|
import * as I from "fs";
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import wt from "picomatch";
|
|
10
|
+
import { spawn as gt } from "child_process";
|
|
11
|
+
const Q = new pt(yt.cpus().length);
|
|
12
|
+
function N(t) {
|
|
11
13
|
return t.replace(/\\/g, "/");
|
|
12
14
|
}
|
|
13
|
-
let
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
const e =
|
|
17
|
-
let
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
function
|
|
21
|
-
const { filePath: e, func:
|
|
22
|
-
return
|
|
23
|
-
() =>
|
|
24
|
-
pool:
|
|
15
|
+
let H = null;
|
|
16
|
+
function xt(t) {
|
|
17
|
+
H == null && (H = /* @__PURE__ */ new Map());
|
|
18
|
+
const e = N(t);
|
|
19
|
+
let r = H.get(e);
|
|
20
|
+
return r == null && (r = new ft(), H.set(e, r)), r;
|
|
21
|
+
}
|
|
22
|
+
function Jt(t) {
|
|
23
|
+
const { filePath: e, func: r } = t;
|
|
24
|
+
return xt(e).lock(
|
|
25
|
+
() => M({
|
|
26
|
+
pool: Q,
|
|
25
27
|
count: 1,
|
|
26
|
-
func:
|
|
28
|
+
func: r
|
|
27
29
|
})
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function St(t) {
|
|
31
33
|
return t.match(/^[/\\]?[^/\\]+/)[0];
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
35
|
+
function Et(t, e) {
|
|
36
|
+
return St(t) + "|" + e.ino;
|
|
35
37
|
}
|
|
36
|
-
function
|
|
37
|
-
return t.endsWith(":") && (t += "/"),
|
|
38
|
+
function kt(t) {
|
|
39
|
+
return t.endsWith(":") && (t += "/"), T.resolve(t);
|
|
38
40
|
}
|
|
39
|
-
function
|
|
41
|
+
function Y(t, e) {
|
|
40
42
|
t.totalSize += e.totalSize, t.maxFileDateModified = Math.max(
|
|
41
43
|
t.maxFileDateModified,
|
|
42
44
|
e.maxFileDateModified
|
|
43
45
|
), t.countFiles += e.countFiles, t.countDirs += e.countDirs, t.countLinks += e.countLinks;
|
|
44
46
|
}
|
|
45
|
-
const
|
|
47
|
+
const Ot = function(e) {
|
|
46
48
|
return e.code === "ENOENT";
|
|
47
49
|
};
|
|
48
|
-
function
|
|
50
|
+
function et(t) {
|
|
49
51
|
const e = t.paths;
|
|
50
52
|
if (!e || e.length === 0)
|
|
51
53
|
return Promise.resolve({
|
|
@@ -55,296 +57,968 @@ function B(t) {
|
|
|
55
57
|
countDirs: 0,
|
|
56
58
|
countLinks: 0
|
|
57
59
|
});
|
|
58
|
-
const
|
|
59
|
-
async function
|
|
60
|
-
if (!(
|
|
61
|
-
throw
|
|
60
|
+
const r = t.level ?? 0, s = t.walkedIds ?? /* @__PURE__ */ new Set(), n = t.abortSignal, a = t.pool ?? Q, o = t.handleError, u = t.priority ?? J(0), f = t.walkLinks ?? !1, i = t.log, S = t.handlePath, l = t.matchPath;
|
|
61
|
+
async function y(d) {
|
|
62
|
+
if (!(o && await o(d)) && !Ot(d))
|
|
63
|
+
throw d;
|
|
62
64
|
}
|
|
63
|
-
function
|
|
64
|
-
return !(!
|
|
65
|
+
function j(d) {
|
|
66
|
+
return !(!i || i.minTotalContentSize != null && d < i.minTotalContentSize || i.maxNestedLevel != null && r > i.maxNestedLevel);
|
|
65
67
|
}
|
|
66
|
-
return
|
|
67
|
-
const
|
|
68
|
+
return dt(async (d) => {
|
|
69
|
+
const w = ht(n, d), m = {
|
|
68
70
|
totalSize: 0,
|
|
69
71
|
maxFileDateModified: 0,
|
|
70
72
|
countFiles: 0,
|
|
71
73
|
countDirs: 0,
|
|
72
74
|
countLinks: 0
|
|
73
75
|
};
|
|
74
|
-
function
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
|
|
76
|
+
function D(x, b) {
|
|
77
|
+
if (j(b.totalSize)) {
|
|
78
|
+
const g = `${b.totalSize.toLocaleString("en-US").replace(/,/g, " ").padStart(19)}: ${x}`;
|
|
79
|
+
i?.handleLog ? i.handleLog(g) : console.log(g);
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
async function
|
|
81
|
-
return
|
|
82
|
-
pool:
|
|
82
|
+
async function c(x, b, p, g) {
|
|
83
|
+
return S ? await M({
|
|
84
|
+
pool: a,
|
|
83
85
|
func: async () => {
|
|
84
86
|
try {
|
|
85
|
-
return await
|
|
86
|
-
level:
|
|
87
|
-
path:
|
|
88
|
-
stat:
|
|
89
|
-
itemStat:
|
|
90
|
-
totalStat:
|
|
91
|
-
abortSignal:
|
|
87
|
+
return await S({
|
|
88
|
+
level: r,
|
|
89
|
+
path: x,
|
|
90
|
+
stat: b,
|
|
91
|
+
itemStat: p,
|
|
92
|
+
totalStat: m,
|
|
93
|
+
abortSignal: w
|
|
92
94
|
});
|
|
93
|
-
} catch (
|
|
94
|
-
return await
|
|
95
|
+
} catch (O) {
|
|
96
|
+
return await y(O), !1;
|
|
95
97
|
}
|
|
96
98
|
},
|
|
97
99
|
count: 1,
|
|
98
|
-
priority:
|
|
99
|
-
abortSignal:
|
|
100
|
+
priority: g,
|
|
101
|
+
abortSignal: w
|
|
100
102
|
}) : !0;
|
|
101
103
|
}
|
|
102
|
-
async function
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
pool:
|
|
106
|
-
func: () => I.promises.lstat(
|
|
104
|
+
async function E(x, b, p, g) {
|
|
105
|
+
g || (g = x);
|
|
106
|
+
const O = await M({
|
|
107
|
+
pool: a,
|
|
108
|
+
func: () => I.promises.lstat(x).catch(y),
|
|
107
109
|
count: 1,
|
|
108
|
-
priority:
|
|
109
|
-
abortSignal:
|
|
110
|
+
priority: J(b, J(1, u)),
|
|
111
|
+
abortSignal: w
|
|
110
112
|
});
|
|
111
|
-
if (!
|
|
113
|
+
if (!O || !p && O.isFile())
|
|
112
114
|
return null;
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
+
const L = Et(x, O);
|
|
116
|
+
if (s.has(L))
|
|
115
117
|
return null;
|
|
116
|
-
|
|
117
|
-
let
|
|
118
|
-
totalSize:
|
|
119
|
-
maxFileDateModified:
|
|
118
|
+
s.add(L);
|
|
119
|
+
let h = {
|
|
120
|
+
totalSize: O.size,
|
|
121
|
+
maxFileDateModified: O.isDirectory() ? 0 : O.mtimeMs,
|
|
120
122
|
countFiles: 0,
|
|
121
123
|
countDirs: 0,
|
|
122
124
|
countLinks: 0
|
|
123
125
|
};
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
const A = J(
|
|
127
|
+
b,
|
|
128
|
+
J(O.isDirectory() ? 2 : 3, u)
|
|
127
129
|
);
|
|
128
|
-
if (
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
pool:
|
|
132
|
-
func: () => I.promises.readlink(
|
|
130
|
+
if (O.isSymbolicLink()) {
|
|
131
|
+
if (f) {
|
|
132
|
+
const P = await M({
|
|
133
|
+
pool: a,
|
|
134
|
+
func: () => I.promises.readlink(x).catch(y).then((F) => F ?? null),
|
|
133
135
|
count: 1,
|
|
134
|
-
priority:
|
|
135
|
-
abortSignal:
|
|
136
|
+
priority: A,
|
|
137
|
+
abortSignal: w
|
|
136
138
|
});
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
|
|
139
|
+
if (P) {
|
|
140
|
+
const F = T.isAbsolute(P) ? P : T.resolve(T.dirname(g), P), W = await E(
|
|
141
|
+
F,
|
|
142
|
+
b,
|
|
140
143
|
p,
|
|
141
|
-
|
|
142
|
-
i
|
|
144
|
+
g
|
|
143
145
|
);
|
|
144
|
-
|
|
146
|
+
W && (h = W);
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
return (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
) && (
|
|
153
|
-
} else if (
|
|
154
|
-
const
|
|
155
|
-
pool:
|
|
156
|
-
func: () => I.promises.readdir(
|
|
149
|
+
return (p || h.countFiles + h.countDirs + h.countLinks >= 1) && (h.countLinks += 1, await c(
|
|
150
|
+
g,
|
|
151
|
+
O,
|
|
152
|
+
h,
|
|
153
|
+
A
|
|
154
|
+
) && (Y(m, h), D(g, h))), h;
|
|
155
|
+
} else if (O.isDirectory()) {
|
|
156
|
+
const P = await M({
|
|
157
|
+
pool: a,
|
|
158
|
+
func: () => I.promises.readdir(x).catch(y),
|
|
157
159
|
count: 1,
|
|
158
|
-
priority:
|
|
159
|
-
abortSignal:
|
|
160
|
+
priority: u,
|
|
161
|
+
abortSignal: w
|
|
160
162
|
});
|
|
161
|
-
if (
|
|
162
|
-
for (let
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if (P) {
|
|
164
|
+
for (let F = 0, W = P.length; F < W; F++)
|
|
165
|
+
P[F] = T.join(g, P[F]);
|
|
166
|
+
h = await et({
|
|
165
167
|
...t,
|
|
166
|
-
paths:
|
|
167
|
-
abortSignal:
|
|
168
|
-
priority:
|
|
169
|
-
level:
|
|
170
|
-
walkedIds:
|
|
168
|
+
paths: P,
|
|
169
|
+
abortSignal: w,
|
|
170
|
+
priority: A,
|
|
171
|
+
level: r + 1,
|
|
172
|
+
walkedIds: s
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
|
-
return (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
) && (
|
|
176
|
+
return (p || h.countFiles + h.countDirs + h.countLinks >= 1) && (O.isDirectory() ? h.countDirs += 1 : O.isFile() && (h.countFiles += 1), await c(
|
|
177
|
+
g,
|
|
178
|
+
O,
|
|
179
|
+
h,
|
|
180
|
+
A
|
|
181
|
+
) && (Y(m, h), D(g, h))), h;
|
|
180
182
|
}
|
|
181
|
-
const
|
|
182
|
-
for (let
|
|
183
|
-
const
|
|
184
|
-
|
|
183
|
+
const k = [];
|
|
184
|
+
for (let x = 0, b = e.length; x < b; x++) {
|
|
185
|
+
const p = kt(e[x]), g = l ? l(p) : !0;
|
|
186
|
+
g !== !1 && k.push(E(p, x, g));
|
|
185
187
|
}
|
|
186
|
-
return await Promise.all(
|
|
188
|
+
return await Promise.all(k), m;
|
|
187
189
|
});
|
|
188
190
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
191
|
+
function Ut(t) {
|
|
192
|
+
return et(t);
|
|
191
193
|
}
|
|
192
|
-
function
|
|
194
|
+
function Ht({
|
|
193
195
|
globs: t,
|
|
194
196
|
rootDir: e,
|
|
195
|
-
noCase:
|
|
197
|
+
noCase: r
|
|
196
198
|
}) {
|
|
197
|
-
const
|
|
199
|
+
const s = [];
|
|
198
200
|
return t.forEach((n) => {
|
|
199
|
-
n =
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
201
|
+
n = N(n).trim();
|
|
202
|
+
const a = n.startsWith("^");
|
|
203
|
+
a && (n = n.substring(1).trim());
|
|
204
|
+
const o = n.startsWith("!");
|
|
205
|
+
if (o && (n = n.substring(1).trim()), n.startsWith("!") || n.startsWith("^"))
|
|
204
206
|
throw new Error(
|
|
205
207
|
`Invalid glob pattern: "${n}". The syntax '${n.substring(0, 2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`
|
|
206
208
|
);
|
|
207
209
|
n.startsWith("/") && (n = "." + n);
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
210
|
+
const u = N(e ? T.resolve(e, n) : n);
|
|
211
|
+
if (!u)
|
|
210
212
|
return;
|
|
211
|
-
let
|
|
213
|
+
let f;
|
|
212
214
|
try {
|
|
213
|
-
|
|
214
|
-
nocase:
|
|
215
|
+
f = wt(u, {
|
|
216
|
+
nocase: r ?? !1,
|
|
215
217
|
dot: !0,
|
|
216
218
|
strictBrackets: !0
|
|
217
219
|
// Validate bracket balance for patterns like "["
|
|
218
220
|
});
|
|
219
|
-
} catch (
|
|
221
|
+
} catch (i) {
|
|
220
222
|
throw new Error(
|
|
221
|
-
`Invalid glob pattern: "${n}". ${
|
|
223
|
+
`Invalid glob pattern: "${n}". ${i instanceof Error ? i.message : "Unknown error"}. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class with balanced brackets), ! (negate pattern), ^ (exclude if included). Examples: "*.js", "src/**/*.ts", "!node_modules", "[abc]def.txt". Ensure all brackets [ ] are properly closed and balanced.`
|
|
222
224
|
);
|
|
223
225
|
}
|
|
224
|
-
|
|
225
|
-
exclude:
|
|
226
|
-
negative:
|
|
227
|
-
debugInfo:
|
|
228
|
-
match:
|
|
226
|
+
s.push({
|
|
227
|
+
exclude: a,
|
|
228
|
+
negative: o,
|
|
229
|
+
debugInfo: u,
|
|
230
|
+
match: f
|
|
229
231
|
});
|
|
230
|
-
}), function(
|
|
231
|
-
|
|
232
|
-
let
|
|
233
|
-
for (let
|
|
234
|
-
const
|
|
235
|
-
|
|
232
|
+
}), function(a) {
|
|
233
|
+
a = N(a);
|
|
234
|
+
let o = null, u = !1;
|
|
235
|
+
for (let f = 0, i = s.length; f < i; f++) {
|
|
236
|
+
const S = s[f];
|
|
237
|
+
S.match(a) && (S.exclude ? u = !S.negative : (o = !S.negative, u = !1));
|
|
236
238
|
}
|
|
237
|
-
return
|
|
239
|
+
return u ? !1 : o;
|
|
238
240
|
};
|
|
239
241
|
}
|
|
240
|
-
function
|
|
242
|
+
function bt(t) {
|
|
241
243
|
const e = t.startsWith("!");
|
|
242
244
|
return e && (t = t.substring(1)), t.startsWith("/") ? t = t.substring(1) : !t.startsWith("**") && !t.startsWith("../") && (t = `**/${t}`), e && (t = "!" + t), t;
|
|
243
245
|
}
|
|
244
|
-
function
|
|
246
|
+
function jt(t, e) {
|
|
245
247
|
if (!e || e === ".")
|
|
246
248
|
return t;
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
return
|
|
249
|
+
const r = t.startsWith("^");
|
|
250
|
+
r && (t = t.substring(1));
|
|
251
|
+
const s = t.startsWith("!");
|
|
252
|
+
return s && (t = t.substring(1)), t.startsWith("/") ? (e.endsWith("/") && (e = e.substring(0, e.length - 1)), t = e + t) : (e.endsWith("/") || (e += "/"), t.startsWith("./") ? t = e + t.substring(2) : t.startsWith("../") ? t = e + t : (e.startsWith("..") && (e = ""), t.startsWith("**") ? t = e + t : t = e + "**/" + t)), t = N(T.normalize(t)), s && (t = "!" + t), r && (t = "^" + t), t;
|
|
251
253
|
}
|
|
252
|
-
function
|
|
254
|
+
function Z(t) {
|
|
253
255
|
return "^" + t;
|
|
254
256
|
}
|
|
255
|
-
async function
|
|
256
|
-
const
|
|
257
|
-
`),
|
|
258
|
-
return
|
|
259
|
-
n = n.trim(), !(!n || n.startsWith("#")) &&
|
|
260
|
-
}),
|
|
257
|
+
async function Pt(t) {
|
|
258
|
+
const r = (await I.promises.readFile(t, "utf-8")).split(`
|
|
259
|
+
`), s = [];
|
|
260
|
+
return r.forEach((n) => {
|
|
261
|
+
n = n.trim(), !(!n || n.startsWith("#")) && s.push(n);
|
|
262
|
+
}), s;
|
|
261
263
|
}
|
|
262
|
-
async function
|
|
263
|
-
const e = t.rootDir ?? ".",
|
|
264
|
+
async function Bt(t) {
|
|
265
|
+
const e = t.rootDir ?? ".", r = [];
|
|
264
266
|
if (!t.globs?.length)
|
|
265
|
-
return
|
|
266
|
-
const
|
|
267
|
+
return r;
|
|
268
|
+
const s = [];
|
|
267
269
|
return t.globs.forEach((n) => {
|
|
268
|
-
n.value && (n.valueType === "file-contains-patterns" ?
|
|
269
|
-
}),
|
|
270
|
-
|
|
271
|
-
await
|
|
272
|
-
pool:
|
|
270
|
+
n.value && (n.valueType === "file-contains-patterns" ? s.push(n) : n.valueType === "pattern" && r.push(n.exclude ? Z(n.value) : n.value));
|
|
271
|
+
}), s.length && await Promise.all(
|
|
272
|
+
s.map(async (n) => {
|
|
273
|
+
await M({
|
|
274
|
+
pool: Q,
|
|
273
275
|
count: 1,
|
|
274
276
|
func: async () => {
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
const a = T.resolve(e, n.value), o = await Pt(a), u = T.relative(e, T.dirname(a));
|
|
278
|
+
o.forEach((f) => {
|
|
279
|
+
f = bt(f), f = jt(f, u), r.push(n.exclude ? Z(f) : f);
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
282
|
});
|
|
281
283
|
})
|
|
282
|
-
),
|
|
284
|
+
), r;
|
|
285
|
+
}
|
|
286
|
+
function Lt(t, e = {}) {
|
|
287
|
+
return new Promise((r, s) => {
|
|
288
|
+
const n = gt(t, {
|
|
289
|
+
shell: !0,
|
|
290
|
+
...e
|
|
291
|
+
}), a = [];
|
|
292
|
+
n.stdout.on("data", (o) => {
|
|
293
|
+
a.push(o);
|
|
294
|
+
}), n.on("error", (o) => {
|
|
295
|
+
s(o);
|
|
296
|
+
}), n.on("exit", (o) => {
|
|
297
|
+
const u = Buffer.concat(a).toString("utf8");
|
|
298
|
+
if (o !== 0) {
|
|
299
|
+
s(new Error(`[exec][exit] code: ${o}`));
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
r(u);
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
async function At({
|
|
307
|
+
page: t,
|
|
308
|
+
urlFilters: e,
|
|
309
|
+
timeouts: r
|
|
310
|
+
}) {
|
|
311
|
+
return r || (r = {}), r.downloadInternal || (r.downloadInternal = 10 * 1e3), r.downloadExternal || (r.downloadExternal = 60 * 1e3), r.total || (r.total = 300 * 1e3), await ct(
|
|
312
|
+
() => t.evaluate(
|
|
313
|
+
({
|
|
314
|
+
urlFilters: n,
|
|
315
|
+
timeouts: a
|
|
316
|
+
}) => {
|
|
317
|
+
function o(i) {
|
|
318
|
+
return function(l) {
|
|
319
|
+
let y = !1;
|
|
320
|
+
for (let j = 0, d = i.length; j < d; j++) {
|
|
321
|
+
const w = i[j];
|
|
322
|
+
w.pattern.test(l) && (y = w.value);
|
|
323
|
+
}
|
|
324
|
+
return y;
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
const u = n && o(n);
|
|
328
|
+
let f = performance.getEntries && performance.getEntries();
|
|
329
|
+
return f || (f = []), f.push({
|
|
330
|
+
name: location.href
|
|
331
|
+
}), Promise.all(
|
|
332
|
+
f.map(
|
|
333
|
+
(i) => {
|
|
334
|
+
if (i.entryType != null && i.entryType !== "resource" || u && !u(i.name))
|
|
335
|
+
return null;
|
|
336
|
+
if (i.responseStatus != null)
|
|
337
|
+
return i.responseStatus >= 400 ? Promise.resolve({
|
|
338
|
+
url: i.name,
|
|
339
|
+
error: i.responseStatus
|
|
340
|
+
}) : null;
|
|
341
|
+
if (navigator.userAgent.indexOf("Chrome") === -1)
|
|
342
|
+
return null;
|
|
343
|
+
const S = typeof AbortController < "u" ? new AbortController() : null, l = new URL(i.name).origin === location.origin, y = l ? a.downloadInternal : a.downloadExternal;
|
|
344
|
+
let j;
|
|
345
|
+
const d = new Promise((c, E) => {
|
|
346
|
+
j = E;
|
|
347
|
+
}), w = y && setTimeout(() => {
|
|
348
|
+
S?.abort(), j(
|
|
349
|
+
new Error("[test][getPageHttpErrors] fetch timeout")
|
|
350
|
+
);
|
|
351
|
+
}, y);
|
|
352
|
+
let m = fetch(i.name, {
|
|
353
|
+
mode: l ? "same-origin" : "no-cors",
|
|
354
|
+
signal: S?.signal,
|
|
355
|
+
cache: l ? "force-cache" : void 0,
|
|
356
|
+
method: "HEAD"
|
|
357
|
+
}).then((c) => c.ok ? null : {
|
|
358
|
+
url: i.name,
|
|
359
|
+
error: c.status + " " + c.statusText
|
|
360
|
+
}).catch((c) => ({
|
|
361
|
+
url: i.name,
|
|
362
|
+
error: c.message
|
|
363
|
+
}));
|
|
364
|
+
S || (m = Promise.race([m, d]));
|
|
365
|
+
function D() {
|
|
366
|
+
w && clearTimeout(w);
|
|
367
|
+
}
|
|
368
|
+
return m.then(
|
|
369
|
+
(c) => (D(), c),
|
|
370
|
+
(c) => {
|
|
371
|
+
throw D(), c;
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
).then((i) => {
|
|
377
|
+
const S = i.filter((l) => l).map(
|
|
378
|
+
(l) => ({
|
|
379
|
+
url: new URL(l.url),
|
|
380
|
+
error: l.error
|
|
381
|
+
})
|
|
382
|
+
);
|
|
383
|
+
return S.length > 0 ? S : null;
|
|
384
|
+
});
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
urlFilters: e,
|
|
388
|
+
timeouts: r
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
{ timeout: r.total }
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
async function Gt({
|
|
395
|
+
page: t,
|
|
396
|
+
urlFilters: e,
|
|
397
|
+
errorFilter: r
|
|
398
|
+
}) {
|
|
399
|
+
let s = await At({
|
|
400
|
+
page: t,
|
|
401
|
+
urlFilters: e
|
|
402
|
+
});
|
|
403
|
+
if (s && (r && (s = s.filter(r)), s.length > 0))
|
|
404
|
+
throw new Error(
|
|
405
|
+
`[test][checkPageHttpErrors] Page has http errors: ${JSON.stringify(s, null, 2)}`
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
async function Kt({
|
|
409
|
+
page: t,
|
|
410
|
+
filter: e,
|
|
411
|
+
onError: r
|
|
412
|
+
}) {
|
|
413
|
+
const s = "callback_191b355ea6f64499a6607ad571da5d4d", n = t.context().browser()?.browserType().name(), a = lt();
|
|
414
|
+
function o(u) {
|
|
415
|
+
try {
|
|
416
|
+
if (e && !e({
|
|
417
|
+
url: new URL(t.url()),
|
|
418
|
+
error: u
|
|
419
|
+
}))
|
|
420
|
+
return;
|
|
421
|
+
} catch (f) {
|
|
422
|
+
u = String(f);
|
|
423
|
+
}
|
|
424
|
+
try {
|
|
425
|
+
console.error(
|
|
426
|
+
`[test][subscribeJsErrors] BROWSER JS ERROR (${n}): ${u}`
|
|
427
|
+
);
|
|
428
|
+
const f = new Error(u);
|
|
429
|
+
f.stack = a, r(f);
|
|
430
|
+
} catch (f) {
|
|
431
|
+
console.error("[test][subscribeJsErrors] error", f);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
await t.exposeFunction(s, o), await t.addInitScript((u) => {
|
|
435
|
+
function f(l) {
|
|
436
|
+
if (Array.isArray(l))
|
|
437
|
+
return l.map(f).join(`\r
|
|
438
|
+
\r
|
|
439
|
+
`);
|
|
440
|
+
if (l instanceof Error)
|
|
441
|
+
return l.stack || l.toString();
|
|
442
|
+
if (typeof l == "object" && l != null) {
|
|
443
|
+
const y = /* @__PURE__ */ new Set();
|
|
444
|
+
return JSON.stringify(
|
|
445
|
+
l,
|
|
446
|
+
(j, d) => {
|
|
447
|
+
if (typeof d == "object" && d != null) {
|
|
448
|
+
if (y.has(d))
|
|
449
|
+
return "[Circular]";
|
|
450
|
+
y.add(d);
|
|
451
|
+
}
|
|
452
|
+
return d;
|
|
453
|
+
},
|
|
454
|
+
2
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
return String(l);
|
|
458
|
+
}
|
|
459
|
+
function i(l) {
|
|
460
|
+
window[u](l);
|
|
461
|
+
}
|
|
462
|
+
const S = {
|
|
463
|
+
warn: console.warn.bind(console),
|
|
464
|
+
error: console.error.bind(console)
|
|
465
|
+
};
|
|
466
|
+
console.warn = function(...y) {
|
|
467
|
+
return i("console.warn: " + f(y)), S.warn.apply(this, y);
|
|
468
|
+
}, console.error = function(...y) {
|
|
469
|
+
return i("console.error: " + f(y)), S.error.apply(this, y);
|
|
470
|
+
}, window.addEventListener(
|
|
471
|
+
"error",
|
|
472
|
+
function(l) {
|
|
473
|
+
i("window error: " + (l.message || JSON.stringify(l)));
|
|
474
|
+
},
|
|
475
|
+
!0
|
|
476
|
+
), window.addEventListener(
|
|
477
|
+
"unhandledrejection",
|
|
478
|
+
function(l) {
|
|
479
|
+
i("window unhandledrejection: " + f(l.reason));
|
|
480
|
+
},
|
|
481
|
+
!0
|
|
482
|
+
);
|
|
483
|
+
}, s);
|
|
484
|
+
}
|
|
485
|
+
async function Vt() {
|
|
486
|
+
try {
|
|
487
|
+
process.platform === "win32" && await Lt(
|
|
488
|
+
`wmic process where "commandline like '%ms-playwright%' and not commandline like '%wmic.exe%' and priority != 4" CALL setpriority "idle"`
|
|
489
|
+
);
|
|
490
|
+
} catch (t) {
|
|
491
|
+
const e = t?.message?.trim();
|
|
492
|
+
if (/exit code: 2147749890/.test(e))
|
|
493
|
+
return;
|
|
494
|
+
console.warn("[test][setPlaywrightPriorityLow] error: " + e);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
async function V(t, e) {
|
|
498
|
+
const r = T.dirname(t);
|
|
499
|
+
await I.promises.stat(r).catch(() => null) || await I.promises.mkdir(r, { recursive: !0 }), await I.promises.writeFile(t, JSON.stringify(e, null, 4), {
|
|
500
|
+
encoding: "utf-8"
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
async function Ct(t) {
|
|
504
|
+
if (!await I.promises.stat(t).catch(() => null))
|
|
505
|
+
return null;
|
|
506
|
+
const e = await I.promises.readFile(t, { encoding: "utf-8" });
|
|
507
|
+
return JSON.parse(e);
|
|
508
|
+
}
|
|
509
|
+
const q = "-", v = "+";
|
|
510
|
+
function B(t, e, r) {
|
|
511
|
+
if (t === e)
|
|
512
|
+
return null;
|
|
513
|
+
if (Array.isArray(t)) {
|
|
514
|
+
if (Array.isArray(e)) {
|
|
515
|
+
let n = null;
|
|
516
|
+
for (let a = 0, o = Math.max(e.length, e.length); a < o; a++) {
|
|
517
|
+
const u = B(t[a], e[a], r);
|
|
518
|
+
u != null && (n || (n = []), n.push(u));
|
|
519
|
+
}
|
|
520
|
+
return n != null && r && (n = r(t, e, n)), n;
|
|
521
|
+
}
|
|
522
|
+
} else if (t instanceof Object && e instanceof Object) {
|
|
523
|
+
let n = null;
|
|
524
|
+
for (const a in t)
|
|
525
|
+
if (Object.prototype.hasOwnProperty.call(t, a)) {
|
|
526
|
+
const o = B(t[a], e[a], r);
|
|
527
|
+
o != null && (n || (n = {}), n[a] = o);
|
|
528
|
+
}
|
|
529
|
+
for (const a in e)
|
|
530
|
+
if (Object.prototype.hasOwnProperty.call(e, a) && !Object.prototype.hasOwnProperty.call(t, a)) {
|
|
531
|
+
const o = B(t[a], e[a], r);
|
|
532
|
+
o != null && (n || (n = {}), n[a] = o);
|
|
533
|
+
}
|
|
534
|
+
return n != null && r && (n = r(t, e, n)), n;
|
|
535
|
+
}
|
|
536
|
+
let s = {
|
|
537
|
+
[q]: t,
|
|
538
|
+
[v]: e
|
|
539
|
+
};
|
|
540
|
+
return r && (s = r(t, e, s)), s;
|
|
541
|
+
}
|
|
542
|
+
function tt(t) {
|
|
543
|
+
function e(c) {
|
|
544
|
+
return c.sort((E, k) => E[0] > k[0] ? 1 : -1).reduce((E, k) => (E[k[0]] = k[1], E), {});
|
|
545
|
+
}
|
|
546
|
+
function r(c) {
|
|
547
|
+
return c.reduce((E, k) => (E[k] = !0, E), {});
|
|
548
|
+
}
|
|
549
|
+
const s = t.filters && t.filters.excludeAttrs && r(t.filters.excludeAttrs), n = t.filters && t.filters.fixAttrs, a = t.filters && t.filters.fixStyles, o = t.filters && t.filters.excludeStyles && r(t.filters.excludeStyles), u = t.filters && t.filters.fixTags, f = t.filters && t.filters.excludeClasses, i = t.filters && t.filters.excludeIds, S = t.filters && t.filters.excludeSelectorClasses, l = t.filters && t.filters.excludeSelectorIds;
|
|
550
|
+
let y;
|
|
551
|
+
if (t.filters && t.filters.excludeSelectors && t.filters.excludeSelectors.length > 0) {
|
|
552
|
+
const c = Array.from(
|
|
553
|
+
document.querySelectorAll(t.filters.excludeSelectors.join(","))
|
|
554
|
+
);
|
|
555
|
+
c.length > 0 && (y = new Set(c));
|
|
556
|
+
}
|
|
557
|
+
function j(c, E, k, x) {
|
|
558
|
+
const b = getComputedStyle(c, E), p = [];
|
|
559
|
+
for (let g = 0, O = b.length; g < O; g++) {
|
|
560
|
+
const L = b[g];
|
|
561
|
+
if (o && o[L])
|
|
562
|
+
continue;
|
|
563
|
+
let h = b[L];
|
|
564
|
+
if (h && a)
|
|
565
|
+
for (let A = 0, P = a.length; A < P; A++)
|
|
566
|
+
a[A].name.test(L) && (h = h.replace(a[A].search, a[A].replace));
|
|
567
|
+
(!k || k[L] !== h) && (!x || x[L] === h) && p.push([L, h]);
|
|
568
|
+
}
|
|
569
|
+
return e(p);
|
|
570
|
+
}
|
|
571
|
+
function d(c, E, k) {
|
|
572
|
+
return {
|
|
573
|
+
_: j(
|
|
574
|
+
c,
|
|
575
|
+
void 0,
|
|
576
|
+
E && E._,
|
|
577
|
+
k && k._
|
|
578
|
+
),
|
|
579
|
+
before: j(
|
|
580
|
+
c,
|
|
581
|
+
"before",
|
|
582
|
+
E && E.before,
|
|
583
|
+
k && k.before
|
|
584
|
+
),
|
|
585
|
+
after: j(
|
|
586
|
+
c,
|
|
587
|
+
"after",
|
|
588
|
+
E && E.after,
|
|
589
|
+
k && k.after
|
|
590
|
+
)
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
function w(c, E, k, x, b) {
|
|
594
|
+
for (let p = 0, g = c.childNodes.length; p < g; p++) {
|
|
595
|
+
const O = c.childNodes[p];
|
|
596
|
+
if (!O)
|
|
597
|
+
throw new Error(
|
|
598
|
+
`child is null; index=${p}; ${x}, ${c.className}\r
|
|
599
|
+
You should wait js executions before test`
|
|
600
|
+
);
|
|
601
|
+
O instanceof Element && m(
|
|
602
|
+
O,
|
|
603
|
+
E,
|
|
604
|
+
k,
|
|
605
|
+
x,
|
|
606
|
+
b
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function m(c, E, k, x, b) {
|
|
611
|
+
const p = b && b[E.length];
|
|
612
|
+
if (b && !p || y && y.has(c))
|
|
613
|
+
return;
|
|
614
|
+
let g = c.tagName && c.tagName.toLowerCase();
|
|
615
|
+
if (g === "head" && (k = !1), u)
|
|
616
|
+
for (let C = 0, z = u.length; C < z; C++)
|
|
617
|
+
g = g.replace(u[C].search, u[C].replace);
|
|
618
|
+
if (p && p.tag !== g)
|
|
619
|
+
return;
|
|
620
|
+
const O = [];
|
|
621
|
+
for (let C = 0, z = c.attributes.length; C < z; C++) {
|
|
622
|
+
const _ = c.attributes.item(C);
|
|
623
|
+
let R = _.name, U = _.value;
|
|
624
|
+
if (R = R.toLowerCase(), R !== "class" && !(s && s[R])) {
|
|
625
|
+
if (n)
|
|
626
|
+
for (let $ = 0, it = n.length; $ < it; $++)
|
|
627
|
+
n[$].name.test(R) && (U = U.replace(n[$].search, n[$].replace));
|
|
628
|
+
(!p || p.attrs && p.attrs[R] === U) && O.push([R, U]);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const L = [], h = [];
|
|
632
|
+
for (let C = 0, z = c.classList.length; C < z; C++) {
|
|
633
|
+
const _ = c.classList.item(C);
|
|
634
|
+
(!f || !f.test(_)) && L.push(_), (!S || !S.test(_)) && h.push(_);
|
|
635
|
+
}
|
|
636
|
+
const A = k ? d(c, t.defaultStyle, p && p.style) : null, P = c.childElementCount ? [] : null;
|
|
637
|
+
c.id && (!i || !i.test(c.id)) && c.id;
|
|
638
|
+
const F = c.id && (!l || !l.test(c.id)) ? c.id : "", W = (g || "") + (F ? "#" + F : "") + (h.length > 0 ? "." + h.join(".") : ""), X = W ? x ? x + " > " + W : W : x, ot = {
|
|
639
|
+
tag: g,
|
|
640
|
+
selector: X,
|
|
641
|
+
classes: L,
|
|
642
|
+
attrs: O.length > 0 ? e(O) : null,
|
|
643
|
+
style: A,
|
|
644
|
+
childs: P
|
|
645
|
+
};
|
|
646
|
+
E.push(ot), P && w(
|
|
647
|
+
c,
|
|
648
|
+
P,
|
|
649
|
+
k,
|
|
650
|
+
X,
|
|
651
|
+
p && p.childs
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
const D = [];
|
|
655
|
+
return m(
|
|
656
|
+
document.documentElement,
|
|
657
|
+
D,
|
|
658
|
+
!0,
|
|
659
|
+
"",
|
|
660
|
+
t.shouldEqualResult && [t.shouldEqualResult]
|
|
661
|
+
), D[0];
|
|
662
|
+
}
|
|
663
|
+
async function nt(t) {
|
|
664
|
+
const e = await t.context().newCDPSession(t);
|
|
665
|
+
return await e.send("DOM.enable"), await e.send("CSS.enable"), e;
|
|
666
|
+
}
|
|
667
|
+
async function rt(t) {
|
|
668
|
+
await t.send("CSS.disable"), await t.send("DOM.disable"), await t.detach();
|
|
669
|
+
}
|
|
670
|
+
async function qt(t, e) {
|
|
671
|
+
const r = await nt(t);
|
|
672
|
+
try {
|
|
673
|
+
return await e(r);
|
|
674
|
+
} finally {
|
|
675
|
+
await rt(r);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
async function Dt(t, e) {
|
|
679
|
+
const { nodes: r } = await t.send("DOM.getFlattenedDocument", {
|
|
680
|
+
depth: -1,
|
|
681
|
+
pierce: !0
|
|
682
|
+
}), s = r.filter((n) => n.nodeType === 1).map((n) => n.nodeId);
|
|
683
|
+
for (const n of s)
|
|
684
|
+
await t.send("CSS.forcePseudoState", {
|
|
685
|
+
nodeId: n,
|
|
686
|
+
forcedPseudoClasses: e
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
function G(t, e) {
|
|
690
|
+
if (!t || !e)
|
|
691
|
+
return e || null;
|
|
692
|
+
let r = null;
|
|
693
|
+
for (const s in e)
|
|
694
|
+
Object.prototype.hasOwnProperty.call(e, s) && e[s] !== t[s] && (r || (r = {}), r[s] = e[s]);
|
|
695
|
+
for (const s in t)
|
|
696
|
+
Object.prototype.hasOwnProperty.call(t, s) && !Object.prototype.hasOwnProperty.call(e, s) && (r || (r = {}), r[s] = "");
|
|
697
|
+
return r;
|
|
698
|
+
}
|
|
699
|
+
function Ft(t, e) {
|
|
700
|
+
if (!t || !e)
|
|
701
|
+
return e || null;
|
|
702
|
+
const r = G(t._, e._), s = G(t.before, e.before), n = G(t.after, e.after);
|
|
703
|
+
return !r && !s && !n ? null : {
|
|
704
|
+
_: r || {},
|
|
705
|
+
before: s || {},
|
|
706
|
+
after: n || {}
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function Tt(t, e) {
|
|
710
|
+
if (!t || !e)
|
|
711
|
+
return e || null;
|
|
712
|
+
if (t.length !== e.length)
|
|
713
|
+
return e;
|
|
714
|
+
for (let r = 0, s = t.length; r < s; r++)
|
|
715
|
+
if (t[r] !== e[r])
|
|
716
|
+
return e;
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
function st(t, e) {
|
|
720
|
+
const r = Tt(t.classes, e.classes), s = G(t.attrs, e.attrs), n = Ft(t.style, e.style);
|
|
721
|
+
let a = null;
|
|
722
|
+
if (t.childs && e.childs) {
|
|
723
|
+
const o = Math.min(t.childs.length, e.childs.length);
|
|
724
|
+
for (let u = 0; u < o; u++) {
|
|
725
|
+
const f = st(t.childs[u], e.childs[u]);
|
|
726
|
+
if (f) {
|
|
727
|
+
if (!a) {
|
|
728
|
+
a = [];
|
|
729
|
+
for (let i = 0; i < o; i++)
|
|
730
|
+
a.push({});
|
|
731
|
+
}
|
|
732
|
+
a[u] = f;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return !r && !s && !n && !a ? null : {
|
|
737
|
+
tag: e.tag,
|
|
738
|
+
selector: e.selector,
|
|
739
|
+
classes: r,
|
|
740
|
+
attrs: s,
|
|
741
|
+
style: n,
|
|
742
|
+
childs: a
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
const K = (t, e, r, s) => {
|
|
746
|
+
const n = s(t, e, r, s);
|
|
747
|
+
if (n == null)
|
|
748
|
+
return n;
|
|
749
|
+
if (Array.isArray(n))
|
|
750
|
+
return n.map(
|
|
751
|
+
(a, o, u) => K(a, o, u, s)
|
|
752
|
+
);
|
|
753
|
+
if (typeof n == "object") {
|
|
754
|
+
const a = {};
|
|
755
|
+
for (const o in n)
|
|
756
|
+
Object.prototype.hasOwnProperty.call(n, o) && (a[o] = K(n[o], o, n, s));
|
|
757
|
+
return a;
|
|
758
|
+
}
|
|
759
|
+
return n;
|
|
760
|
+
};
|
|
761
|
+
function at(t, e) {
|
|
762
|
+
if (t.attrs && e.excludeAttrs) {
|
|
763
|
+
for (let r = 0, s = e.excludeAttrs.length; r < s; r++)
|
|
764
|
+
delete t.attrs[e.excludeAttrs[r]];
|
|
765
|
+
Object.keys(t.attrs).length === 0 && (t.attrs = null);
|
|
766
|
+
}
|
|
767
|
+
if (t.classes && e.excludeClasses && (t.classes = t.classes.filter(
|
|
768
|
+
(r) => !e.excludeClasses.test(r)
|
|
769
|
+
)), t.style && e.excludeStyles)
|
|
770
|
+
for (const r of ["_", "before", "after"]) {
|
|
771
|
+
const s = t.style[r];
|
|
772
|
+
if (s)
|
|
773
|
+
for (let n = 0, a = e.excludeStyles.length; n < a; n++)
|
|
774
|
+
delete s[e.excludeStyles[n]];
|
|
775
|
+
}
|
|
776
|
+
if (t.childs)
|
|
777
|
+
for (let r = 0, s = t.childs.length; r < s; r++)
|
|
778
|
+
at(t.childs[r], e);
|
|
779
|
+
}
|
|
780
|
+
function It(t, e) {
|
|
781
|
+
for (const r in t) {
|
|
782
|
+
if (!Object.prototype.hasOwnProperty.call(t, r)) continue;
|
|
783
|
+
const s = t[r];
|
|
784
|
+
for (const n in s) {
|
|
785
|
+
if (!Object.prototype.hasOwnProperty.call(s, n)) continue;
|
|
786
|
+
const a = s[n];
|
|
787
|
+
for (const o in a)
|
|
788
|
+
Object.prototype.hasOwnProperty.call(a, o) && at(a[o], e);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
function vt({
|
|
793
|
+
actualResultFile: t,
|
|
794
|
+
expectedResultFile: e,
|
|
795
|
+
diffResultFile: r,
|
|
796
|
+
filters: s,
|
|
797
|
+
transform: n,
|
|
798
|
+
pseudoStates: a
|
|
799
|
+
}) {
|
|
800
|
+
let o, u, f, i = {};
|
|
801
|
+
return {
|
|
802
|
+
async init(S) {
|
|
803
|
+
o = await Ct(e), n && (o = K(o, null, null, n)), o && s && It(o, s), await S.goto("about:blank"), u = await S.evaluate(tt, { filters: s }), f = u.style;
|
|
804
|
+
},
|
|
805
|
+
async handlePage({
|
|
806
|
+
page: S,
|
|
807
|
+
testId: l,
|
|
808
|
+
url: y,
|
|
809
|
+
stateId: j,
|
|
810
|
+
_filters: d
|
|
811
|
+
}) {
|
|
812
|
+
let w = i[l];
|
|
813
|
+
w || (w = {}, i[l] = w);
|
|
814
|
+
let m = w[y.href];
|
|
815
|
+
m || (m = {}, w[y.href] = m), await S.addStyleTag({
|
|
816
|
+
content: "*, *::before, *::after { animation-name: none!important; transition-duration: 0s !important; }"
|
|
817
|
+
});
|
|
818
|
+
const D = a ?? [{ states: [] }];
|
|
819
|
+
let c = null, E;
|
|
820
|
+
try {
|
|
821
|
+
for (let k = 0; k < D.length; k++) {
|
|
822
|
+
const x = D[k], b = x.states.length > 0 ? j + ":" + x.states.join(":") : j;
|
|
823
|
+
let p = null;
|
|
824
|
+
if (x.states.length > 0) {
|
|
825
|
+
c || (c = await nt(S));
|
|
826
|
+
const h = performance.now();
|
|
827
|
+
await Dt(c, x.states), p = performance.now() - h;
|
|
828
|
+
}
|
|
829
|
+
x.delay && await mt(x.delay);
|
|
830
|
+
const g = performance.now(), O = await S.evaluate(tt, {
|
|
831
|
+
filters: d || s,
|
|
832
|
+
defaultStyle: f,
|
|
833
|
+
shouldEqualResult: m[b]
|
|
834
|
+
}), L = performance.now() - g;
|
|
835
|
+
if (console.log(
|
|
836
|
+
`SNAPSHOT ${b}:` + (p != null ? ` forcePseudoClasses ${p.toFixed(0)}ms,` : "") + ` getAllElements ${L.toFixed(0)}ms`
|
|
837
|
+
), !E)
|
|
838
|
+
E = O, m[b] = O;
|
|
839
|
+
else {
|
|
840
|
+
const h = st(E, O);
|
|
841
|
+
h && (m[b] = h);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
} finally {
|
|
845
|
+
c && await rt(c);
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
async end({ checkExistUrlsOnly: S }) {
|
|
849
|
+
if (i = ut(i), n && (i = K(i, null, null, n)), o) {
|
|
850
|
+
let l, y;
|
|
851
|
+
if (!S)
|
|
852
|
+
l = o, y = i;
|
|
853
|
+
else {
|
|
854
|
+
l = {}, y = {};
|
|
855
|
+
for (const d in o)
|
|
856
|
+
if (Object.prototype.hasOwnProperty.call(o, d) && Object.prototype.hasOwnProperty.call(i, d)) {
|
|
857
|
+
l[d] = {}, y[d] = {};
|
|
858
|
+
for (const w in o[d])
|
|
859
|
+
Object.prototype.hasOwnProperty.call(o[d], w) && Object.prototype.hasOwnProperty.call(i[d], w) && (l[d][w] = o[d][w], y[d][w] = i[d][w]);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
const j = B(
|
|
863
|
+
l,
|
|
864
|
+
y,
|
|
865
|
+
(d, w, m) => m.selector && (delete m.selector, Object.keys(m).length === 0) ? null : m.childs && m.childs.length === 1 ? m.childs[0] : (w && w.selector ? m[v] ? m[v] = w.selector : m = { selector: w.selector, ...m } : d && d.selector && (m[q] ? m[q] = d.selector : m = { selector: d.selector, ...m }), m)
|
|
866
|
+
);
|
|
867
|
+
if (r && await V(r, j || {}), j)
|
|
868
|
+
throw await V(t, i), console.error(
|
|
869
|
+
"Pages elements changes: " + JSON.stringify(j, null, 4).substring(0, 5e3)
|
|
870
|
+
), new Error("Pages elements changes detected");
|
|
871
|
+
await I.promises.stat(t).catch(() => null) && await I.promises.unlink(t);
|
|
872
|
+
} else
|
|
873
|
+
await V(e, i);
|
|
874
|
+
return i;
|
|
875
|
+
}
|
|
876
|
+
};
|
|
283
877
|
}
|
|
284
878
|
export {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
879
|
+
Yt as ConsoleMessageLevel,
|
|
880
|
+
v as DIFF_NEW,
|
|
881
|
+
q as DIFF_OLD,
|
|
882
|
+
Zt as Lazy,
|
|
883
|
+
te as LazyWithId,
|
|
884
|
+
ee as LogLevel,
|
|
885
|
+
ne as Random,
|
|
886
|
+
re as Subject,
|
|
887
|
+
se as SubjectWithId,
|
|
888
|
+
ae as UNIQUE_PSEUDO_RANDOM_MAX_COUNT,
|
|
889
|
+
oe as alertConsole,
|
|
890
|
+
ie as alertReplace,
|
|
891
|
+
ce as check,
|
|
892
|
+
Gt as checkPageHttpErrors,
|
|
893
|
+
le as consoleIntercept,
|
|
894
|
+
ue as consoleMessageToString,
|
|
895
|
+
fe as consoleReplace,
|
|
896
|
+
de as convertTimeZone,
|
|
897
|
+
nt as createCDPSession,
|
|
898
|
+
Ht as createMatchPath,
|
|
899
|
+
vt as createPagesElementsChangesTest,
|
|
900
|
+
he as createTaskDelayRetry,
|
|
901
|
+
me as createUniquePseudoRandom,
|
|
902
|
+
pe as dateNowUnique,
|
|
903
|
+
ye as deepCloneJsonLike,
|
|
904
|
+
we as deepEqualJsonLike,
|
|
905
|
+
ge as deepEqualJsonLikeMap,
|
|
906
|
+
rt as destroyCDPSession,
|
|
907
|
+
xe as equalArray,
|
|
908
|
+
Se as escapeHtml,
|
|
909
|
+
Ee as escapeRegExp,
|
|
910
|
+
Lt as exec,
|
|
911
|
+
Jt as fileLock,
|
|
912
|
+
ke as fixStackTrace,
|
|
913
|
+
Dt as forcePseudoClasses,
|
|
914
|
+
Oe as formatAny,
|
|
915
|
+
be as formatDate,
|
|
916
|
+
je as formatDateFileName,
|
|
917
|
+
tt as getAllElements,
|
|
918
|
+
Pe as getConsoleMessages,
|
|
919
|
+
Le as getDateInet,
|
|
920
|
+
St as getDrive,
|
|
921
|
+
st as getElementsStyleDiff,
|
|
922
|
+
Et as getFileId,
|
|
923
|
+
ut as getNormalizedObject,
|
|
924
|
+
B as getObjectsDiff,
|
|
925
|
+
At as getPageHttpErrors,
|
|
926
|
+
Ae as getRandomFunc,
|
|
927
|
+
Ce as getRandomSeed,
|
|
928
|
+
lt as getStackTrace,
|
|
929
|
+
bt as globGitIgnoreToPicomatch,
|
|
930
|
+
jt as globToRelative,
|
|
931
|
+
De as isObservable,
|
|
932
|
+
Bt as loadGlobs,
|
|
933
|
+
Pt as loadGlobsFromFile,
|
|
934
|
+
Ct as loadJson,
|
|
935
|
+
Fe as match,
|
|
936
|
+
Te as matchAnd,
|
|
937
|
+
Ie as matchAndPipe,
|
|
938
|
+
We as matchAny,
|
|
939
|
+
_e as matchArray,
|
|
940
|
+
Re as matchArrayBuffer,
|
|
941
|
+
Me as matchArrayIncludes,
|
|
942
|
+
Ne as matchArrayItem,
|
|
943
|
+
ze as matchArrayLength,
|
|
944
|
+
$e as matchArrayWith,
|
|
945
|
+
Je as matchBoolean,
|
|
946
|
+
Ue as matchConstructor,
|
|
947
|
+
He as matchConvert,
|
|
948
|
+
Be as matchCustom,
|
|
949
|
+
Ge as matchDeep,
|
|
950
|
+
Ke as matchEnum,
|
|
951
|
+
Ve as matchFloat,
|
|
952
|
+
qe as matchIn,
|
|
953
|
+
ve as matchInstanceOf,
|
|
954
|
+
Qe as matchInt,
|
|
955
|
+
Xe as matchIntDate,
|
|
956
|
+
Ye as matchIs,
|
|
957
|
+
Ze as matchIsNonStrict,
|
|
958
|
+
tn as matchNever,
|
|
959
|
+
en as matchNot,
|
|
960
|
+
nn as matchNotNullish,
|
|
961
|
+
rn as matchNullish,
|
|
962
|
+
sn as matchNumber,
|
|
963
|
+
an as matchObject,
|
|
964
|
+
on as matchObjectEntries,
|
|
965
|
+
cn as matchObjectEntry,
|
|
966
|
+
ln as matchObjectKey,
|
|
967
|
+
un as matchObjectKeyValue,
|
|
968
|
+
fn as matchObjectKeys,
|
|
969
|
+
dn as matchObjectKeysNotNull,
|
|
970
|
+
hn as matchObjectPartial,
|
|
971
|
+
mn as matchObjectValue,
|
|
972
|
+
pn as matchObjectValues,
|
|
973
|
+
yn as matchObjectWith,
|
|
974
|
+
wn as matchOptional,
|
|
975
|
+
gn as matchOr,
|
|
976
|
+
xn as matchOrPipe,
|
|
977
|
+
Sn as matchRange,
|
|
978
|
+
En as matchRangeDate,
|
|
979
|
+
kn as matchRef,
|
|
980
|
+
On as matchString,
|
|
981
|
+
bn as matchStringLength,
|
|
982
|
+
jn as matchTypeOf,
|
|
983
|
+
Pn as matchUuid,
|
|
984
|
+
Ln as matchValueState,
|
|
985
|
+
An as max,
|
|
986
|
+
Cn as min,
|
|
987
|
+
Dn as minMax,
|
|
988
|
+
Fn as numberMod,
|
|
989
|
+
K as objectTransform,
|
|
990
|
+
N as pathNormalize,
|
|
991
|
+
kt as pathResolve,
|
|
992
|
+
Q as poolFs,
|
|
993
|
+
Tn as randomBoolean,
|
|
994
|
+
In as randomEnum,
|
|
995
|
+
Wn as randomFloat,
|
|
996
|
+
_n as randomIndexWeighted,
|
|
997
|
+
Rn as randomInt,
|
|
998
|
+
Mn as randomItem,
|
|
999
|
+
Nn as randomItems,
|
|
1000
|
+
V as saveJson,
|
|
1001
|
+
zn as setFuncName,
|
|
1002
|
+
Vt as setPlaywrightPriorityLow,
|
|
1003
|
+
$n as sha256,
|
|
1004
|
+
Jn as sha256Buffer,
|
|
1005
|
+
Kt as subscribeJsErrors,
|
|
1006
|
+
Un as timeoutAbortController,
|
|
1007
|
+
Hn as toHex,
|
|
1008
|
+
Bn as truncateString,
|
|
1009
|
+
Gn as urlGetBoolean,
|
|
1010
|
+
Kn as urlGetFloat,
|
|
1011
|
+
Vn as urlGetInt,
|
|
1012
|
+
qn as urlGetParams,
|
|
1013
|
+
vn as urlGetString,
|
|
1014
|
+
Qn as urlParamToBoolean,
|
|
1015
|
+
Xn as urlParamToFloat,
|
|
1016
|
+
Yn as urlParamToInt,
|
|
1017
|
+
qt as usingCDPSession,
|
|
1018
|
+
Zn as waitObservable,
|
|
1019
|
+
Ot as walkPathHandleErrorDefault,
|
|
1020
|
+
Ut as walkPaths,
|
|
1021
|
+
tr as withConsoleReplace,
|
|
1022
|
+
er as withRetry,
|
|
1023
|
+
ct as withTimeout
|
|
350
1024
|
};
|