@shopware/api-gen 1.3.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -22
- package/api-gen.schema.json +99 -0
- package/dist/cli.mjs +35405 -80
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +4 -4
- package/dist/shared/{api-gen.BZLmrTCs.mjs → api-gen.a71ec925.mjs} +753 -1171
- package/package.json +13 -11
|
@@ -2,24 +2,17 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
|
2
2
|
import { resolve, join, dirname } from 'node:path';
|
|
3
3
|
import openapiTS, { transformSchemaObjectWithComposition, astToString } from 'openapi-typescript';
|
|
4
4
|
import ts from 'typescript';
|
|
5
|
-
import { ofetch } from 'ofetch';
|
|
6
|
-
import { format as format$1 } from 'prettier';
|
|
7
|
-
import { Project } from 'ts-morph';
|
|
8
5
|
import require$$0 from 'fs';
|
|
9
6
|
import require$$1 from 'path';
|
|
10
7
|
import require$$2 from 'os';
|
|
11
8
|
import require$$3 from 'crypto';
|
|
9
|
+
import { ofetch } from 'ofetch';
|
|
10
|
+
import { format as format$1 } from 'prettier';
|
|
11
|
+
import { Project } from 'ts-morph';
|
|
12
12
|
import { createAdminAPIClient, createAPIClient } from '@shopware/api-client';
|
|
13
13
|
|
|
14
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
// -- Unbuild CommonJS Shims --
|
|
17
|
-
import __cjs_url__ from 'url';
|
|
18
|
-
import __cjs_path__ from 'path';
|
|
19
|
-
import __cjs_mod__ from 'module';
|
|
20
|
-
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = __cjs_path__.dirname(__filename);
|
|
22
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
23
16
|
function getDefaultExportFromCjs$2 (x) {
|
|
24
17
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
25
18
|
}
|
|
@@ -52,7 +45,7 @@ function getAugmentedNamespace(n) {
|
|
|
52
45
|
var main$1 = {exports: {}};
|
|
53
46
|
|
|
54
47
|
const name = "dotenv";
|
|
55
|
-
const version$1 = "
|
|
48
|
+
const version$1 = "17.3.1";
|
|
56
49
|
const description = "Loads environment variables from .env file";
|
|
57
50
|
const main = "lib/main.js";
|
|
58
51
|
const types = "lib/main.d.ts";
|
|
@@ -74,8 +67,8 @@ const scripts = {
|
|
|
74
67
|
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
75
68
|
lint: "standard",
|
|
76
69
|
pretest: "npm run lint && npm run dts-check",
|
|
77
|
-
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
78
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
|
|
70
|
+
test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
71
|
+
"test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
79
72
|
prerelease: "npm test",
|
|
80
73
|
release: "standard-version"
|
|
81
74
|
};
|
|
@@ -161,6 +154,43 @@ const packageJson = require$$4;
|
|
|
161
154
|
|
|
162
155
|
const version = packageJson.version;
|
|
163
156
|
|
|
157
|
+
// Array of tips to display randomly
|
|
158
|
+
const TIPS = [
|
|
159
|
+
'🔐 encrypt with Dotenvx: https://dotenvx.com',
|
|
160
|
+
'🔐 prevent committing .env to code: https://dotenvx.com/precommit',
|
|
161
|
+
'🔐 prevent building .env in docker: https://dotenvx.com/prebuild',
|
|
162
|
+
'🤖 agentic secret storage: https://dotenvx.com/as2',
|
|
163
|
+
'⚡️ secrets for agents: https://dotenvx.com/as2',
|
|
164
|
+
'🛡️ auth for agents: https://vestauth.com',
|
|
165
|
+
'🛠️ run anywhere with `dotenvx run -- yourcommand`',
|
|
166
|
+
'⚙️ specify custom .env file path with { path: \'/custom/path/.env\' }',
|
|
167
|
+
'⚙️ enable debug logging with { debug: true }',
|
|
168
|
+
'⚙️ override existing env vars with { override: true }',
|
|
169
|
+
'⚙️ suppress all logs with { quiet: true }',
|
|
170
|
+
'⚙️ write to custom object with { processEnv: myObject }',
|
|
171
|
+
'⚙️ load multiple .env files with { path: [\'.env.local\', \'.env\'] }'
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
// Get a random tip from the tips array
|
|
175
|
+
function _getRandomTip () {
|
|
176
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function parseBoolean (value) {
|
|
180
|
+
if (typeof value === 'string') {
|
|
181
|
+
return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())
|
|
182
|
+
}
|
|
183
|
+
return Boolean(value)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function supportsAnsi () {
|
|
187
|
+
return process.stdout.isTTY // && process.env.TERM !== 'dumb'
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function dim (text) {
|
|
191
|
+
return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text
|
|
192
|
+
}
|
|
193
|
+
|
|
164
194
|
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
165
195
|
|
|
166
196
|
// Parse src into an Object
|
|
@@ -203,10 +233,11 @@ function parse$1 (src) {
|
|
|
203
233
|
}
|
|
204
234
|
|
|
205
235
|
function _parseVault (options) {
|
|
206
|
-
|
|
236
|
+
options = options || {};
|
|
207
237
|
|
|
208
|
-
|
|
209
|
-
|
|
238
|
+
const vaultPath = _vaultPath(options);
|
|
239
|
+
options.path = vaultPath; // parse .env.vault
|
|
240
|
+
const result = DotenvModule.configDotenv(options);
|
|
210
241
|
if (!result.parsed) {
|
|
211
242
|
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
212
243
|
err.code = 'MISSING_DATA';
|
|
@@ -245,13 +276,17 @@ function _parseVault (options) {
|
|
|
245
276
|
}
|
|
246
277
|
|
|
247
278
|
function _warn (message) {
|
|
248
|
-
console.
|
|
279
|
+
console.error(`[dotenv@${version}][WARN] ${message}`);
|
|
249
280
|
}
|
|
250
281
|
|
|
251
282
|
function _debug (message) {
|
|
252
283
|
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
253
284
|
}
|
|
254
285
|
|
|
286
|
+
function _log (message) {
|
|
287
|
+
console.log(`[dotenv@${version}] ${message}`);
|
|
288
|
+
}
|
|
289
|
+
|
|
255
290
|
function _dotenvKey (options) {
|
|
256
291
|
// prioritize developer directly setting options.DOTENV_KEY
|
|
257
292
|
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
@@ -339,9 +374,11 @@ function _resolveHome (envPath) {
|
|
|
339
374
|
}
|
|
340
375
|
|
|
341
376
|
function _configVault (options) {
|
|
342
|
-
const debug =
|
|
343
|
-
|
|
344
|
-
|
|
377
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug));
|
|
378
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet));
|
|
379
|
+
|
|
380
|
+
if (debug || !quiet) {
|
|
381
|
+
_log('Loading env from encrypted .env.vault');
|
|
345
382
|
}
|
|
346
383
|
|
|
347
384
|
const parsed = DotenvModule._parseVault(options);
|
|
@@ -359,7 +396,12 @@ function _configVault (options) {
|
|
|
359
396
|
function configDotenv (options) {
|
|
360
397
|
const dotenvPath = path.resolve(process.cwd(), '.env');
|
|
361
398
|
let encoding = 'utf8';
|
|
362
|
-
|
|
399
|
+
let processEnv = process.env;
|
|
400
|
+
if (options && options.processEnv != null) {
|
|
401
|
+
processEnv = options.processEnv;
|
|
402
|
+
}
|
|
403
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug));
|
|
404
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet));
|
|
363
405
|
|
|
364
406
|
if (options && options.encoding) {
|
|
365
407
|
encoding = options.encoding;
|
|
@@ -399,12 +441,29 @@ function configDotenv (options) {
|
|
|
399
441
|
}
|
|
400
442
|
}
|
|
401
443
|
|
|
402
|
-
|
|
403
|
-
if (options && options.processEnv != null) {
|
|
404
|
-
processEnv = options.processEnv;
|
|
405
|
-
}
|
|
444
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
406
445
|
|
|
407
|
-
|
|
446
|
+
// handle user settings DOTENV_CONFIG_ options inside .env file(s)
|
|
447
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
448
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
449
|
+
|
|
450
|
+
if (debug || !quiet) {
|
|
451
|
+
const keysCount = Object.keys(populated).length;
|
|
452
|
+
const shortPaths = [];
|
|
453
|
+
for (const filePath of optionPaths) {
|
|
454
|
+
try {
|
|
455
|
+
const relative = path.relative(process.cwd(), filePath);
|
|
456
|
+
shortPaths.push(relative);
|
|
457
|
+
} catch (e) {
|
|
458
|
+
if (debug) {
|
|
459
|
+
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
460
|
+
}
|
|
461
|
+
lastError = e;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
_log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`-- tip: ${_getRandomTip()}`)}`);
|
|
466
|
+
}
|
|
408
467
|
|
|
409
468
|
if (lastError) {
|
|
410
469
|
return { parsed: parsedAll, error: lastError }
|
|
@@ -467,6 +526,7 @@ function decrypt (encrypted, keyStr) {
|
|
|
467
526
|
function populate (processEnv, parsed, options = {}) {
|
|
468
527
|
const debug = Boolean(options && options.debug);
|
|
469
528
|
const override = Boolean(options && options.override);
|
|
529
|
+
const populated = {};
|
|
470
530
|
|
|
471
531
|
if (typeof parsed !== 'object') {
|
|
472
532
|
const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
|
|
@@ -479,6 +539,7 @@ function populate (processEnv, parsed, options = {}) {
|
|
|
479
539
|
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
480
540
|
if (override === true) {
|
|
481
541
|
processEnv[key] = parsed[key];
|
|
542
|
+
populated[key] = parsed[key];
|
|
482
543
|
}
|
|
483
544
|
|
|
484
545
|
if (debug) {
|
|
@@ -490,8 +551,11 @@ function populate (processEnv, parsed, options = {}) {
|
|
|
490
551
|
}
|
|
491
552
|
} else {
|
|
492
553
|
processEnv[key] = parsed[key];
|
|
554
|
+
populated[key] = parsed[key];
|
|
493
555
|
}
|
|
494
556
|
}
|
|
557
|
+
|
|
558
|
+
return populated
|
|
495
559
|
}
|
|
496
560
|
|
|
497
561
|
const DotenvModule = {
|
|
@@ -527,6 +591,10 @@ if (process.env.DOTENV_CONFIG_PATH != null) {
|
|
|
527
591
|
options.path = process.env.DOTENV_CONFIG_PATH;
|
|
528
592
|
}
|
|
529
593
|
|
|
594
|
+
if (process.env.DOTENV_CONFIG_QUIET != null) {
|
|
595
|
+
options.quiet = process.env.DOTENV_CONFIG_QUIET;
|
|
596
|
+
}
|
|
597
|
+
|
|
530
598
|
if (process.env.DOTENV_CONFIG_DEBUG != null) {
|
|
531
599
|
options.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
532
600
|
}
|
|
@@ -541,16 +609,22 @@ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
|
|
|
541
609
|
|
|
542
610
|
var envOptions = options;
|
|
543
611
|
|
|
544
|
-
const re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
|
|
612
|
+
const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
545
613
|
|
|
546
614
|
var cliOptions = function optionMatcher (args) {
|
|
547
|
-
|
|
615
|
+
const options = args.reduce(function (acc, cur) {
|
|
548
616
|
const matches = cur.match(re);
|
|
549
617
|
if (matches) {
|
|
550
618
|
acc[matches[1]] = matches[2];
|
|
551
619
|
}
|
|
552
620
|
return acc
|
|
553
|
-
}, {})
|
|
621
|
+
}, {});
|
|
622
|
+
|
|
623
|
+
if (!('quiet' in options)) {
|
|
624
|
+
options.quiet = 'true';
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
return options
|
|
554
628
|
};
|
|
555
629
|
|
|
556
630
|
(function () {
|
|
@@ -1990,10 +2064,10 @@ var lib = JSON5;
|
|
|
1990
2064
|
|
|
1991
2065
|
var picocolors = {exports: {}};
|
|
1992
2066
|
|
|
1993
|
-
let p
|
|
2067
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
1994
2068
|
let isColorSupported =
|
|
1995
2069
|
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
1996
|
-
(!!env.FORCE_COLOR || argv.includes("--color") || p
|
|
2070
|
+
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
1997
2071
|
|
|
1998
2072
|
let formatter = (open, close, replace = open) =>
|
|
1999
2073
|
input => {
|
|
@@ -2069,7 +2143,7 @@ picocolors.exports.createColors = createColors;
|
|
|
2069
2143
|
var picocolorsExports = picocolors.exports;
|
|
2070
2144
|
const c = /*@__PURE__*/getDefaultExportFromCjs$2(picocolorsExports);
|
|
2071
2145
|
|
|
2072
|
-
function isPlainObject(value) {
|
|
2146
|
+
function isPlainObject$1(value) {
|
|
2073
2147
|
if (value === null || typeof value !== "object") {
|
|
2074
2148
|
return false;
|
|
2075
2149
|
}
|
|
@@ -2087,7 +2161,7 @@ function isPlainObject(value) {
|
|
|
2087
2161
|
}
|
|
2088
2162
|
|
|
2089
2163
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
2090
|
-
if (!isPlainObject(defaults)) {
|
|
2164
|
+
if (!isPlainObject$1(defaults)) {
|
|
2091
2165
|
return _defu(baseObject, {}, namespace, merger);
|
|
2092
2166
|
}
|
|
2093
2167
|
const object = Object.assign({}, defaults);
|
|
@@ -2104,7 +2178,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
2104
2178
|
}
|
|
2105
2179
|
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
2106
2180
|
object[key] = [...value, ...object[key]];
|
|
2107
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
2181
|
+
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
2108
2182
|
object[key] = _defu(
|
|
2109
2183
|
value,
|
|
2110
2184
|
object[key],
|
|
@@ -2126,7 +2200,7 @@ function createDefu(merger) {
|
|
|
2126
2200
|
const defu = createDefu();
|
|
2127
2201
|
|
|
2128
2202
|
// src/index.ts
|
|
2129
|
-
var
|
|
2203
|
+
var d = {
|
|
2130
2204
|
reset: [0, 0],
|
|
2131
2205
|
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
2132
2206
|
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
@@ -2168,42 +2242,43 @@ var f = {
|
|
|
2168
2242
|
bgMagentaBright: [105, 49],
|
|
2169
2243
|
bgCyanBright: [106, 49],
|
|
2170
2244
|
bgWhiteBright: [107, 49]
|
|
2171
|
-
}
|
|
2172
|
-
function
|
|
2173
|
-
return String(
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
function
|
|
2178
|
-
let e = typeof process != "undefined" ? process : void 0,
|
|
2179
|
-
return !("NO_COLOR" in
|
|
2180
|
-
}
|
|
2181
|
-
function
|
|
2182
|
-
let e =
|
|
2245
|
+
};
|
|
2246
|
+
function g(e) {
|
|
2247
|
+
return String(e);
|
|
2248
|
+
}
|
|
2249
|
+
g.open = "";
|
|
2250
|
+
g.close = "";
|
|
2251
|
+
function h() {
|
|
2252
|
+
let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
|
|
2253
|
+
return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
|
|
2254
|
+
}
|
|
2255
|
+
function f() {
|
|
2256
|
+
let e = h(), n = (r, t, u, o) => {
|
|
2183
2257
|
let l = "", s = 0;
|
|
2184
2258
|
do
|
|
2185
|
-
l += r.substring(s, o) +
|
|
2259
|
+
l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
|
|
2186
2260
|
while (~o);
|
|
2187
2261
|
return l + r.substring(s);
|
|
2188
|
-
},
|
|
2262
|
+
}, a = (r, t, u = r) => {
|
|
2189
2263
|
let o = (l) => {
|
|
2190
2264
|
let s = String(l), b = s.indexOf(t, r.length);
|
|
2191
|
-
return ~b ? r +
|
|
2265
|
+
return ~b ? r + n(s, t, u, b) + t : r + s + t;
|
|
2192
2266
|
};
|
|
2193
2267
|
return o.open = r, o.close = t, o;
|
|
2194
|
-
},
|
|
2268
|
+
}, i = {
|
|
2195
2269
|
isColorSupported: e
|
|
2196
|
-
},
|
|
2197
|
-
for (let
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2270
|
+
}, c = (r) => `\x1B[${r}m`;
|
|
2271
|
+
for (let r in d) {
|
|
2272
|
+
let t = d[r];
|
|
2273
|
+
i[r] = e ? a(
|
|
2274
|
+
c(t[0]),
|
|
2275
|
+
c(t[1]),
|
|
2201
2276
|
t[2]
|
|
2202
|
-
) :
|
|
2203
|
-
|
|
2277
|
+
) : g;
|
|
2278
|
+
}
|
|
2279
|
+
return i;
|
|
2204
2280
|
}
|
|
2205
|
-
|
|
2206
|
-
var s = p();
|
|
2281
|
+
var C = f();
|
|
2207
2282
|
|
|
2208
2283
|
function _mergeNamespaces(n, m) {
|
|
2209
2284
|
m.forEach(function (e) {
|
|
@@ -2427,6 +2502,10 @@ function printProps(keys, props, config, indentation, depth, refs, printer) {
|
|
|
2427
2502
|
const colors = config.colors;
|
|
2428
2503
|
return keys.map((key) => {
|
|
2429
2504
|
const value = props[key];
|
|
2505
|
+
// hidden injected value that should not be printed
|
|
2506
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
|
|
2507
|
+
return "";
|
|
2508
|
+
}
|
|
2430
2509
|
let printed = printer(value, config, indentationNext, depth, refs);
|
|
2431
2510
|
if (typeof value !== "string") {
|
|
2432
2511
|
if (printed.includes("\n")) {
|
|
@@ -2441,6 +2520,12 @@ function printProps(keys, props, config, indentation, depth, refs, printer) {
|
|
|
2441
2520
|
function printChildren(children, config, indentation, depth, refs, printer) {
|
|
2442
2521
|
return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join("");
|
|
2443
2522
|
}
|
|
2523
|
+
function printShadowRoot(children, config, indentation, depth, refs, printer) {
|
|
2524
|
+
if (config.printShadowRoot === false) {
|
|
2525
|
+
return "";
|
|
2526
|
+
}
|
|
2527
|
+
return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer)].join("");
|
|
2528
|
+
}
|
|
2444
2529
|
function printText(text, config) {
|
|
2445
2530
|
const contentColor = config.colors.content;
|
|
2446
2531
|
return contentColor.open + escapeHTML(text) + contentColor.close;
|
|
@@ -2480,10 +2565,7 @@ function testNode(val) {
|
|
|
2480
2565
|
const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
|
|
2481
2566
|
return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
|
|
2482
2567
|
}
|
|
2483
|
-
const test$3 = (val) =>
|
|
2484
|
-
var _val$constructor;
|
|
2485
|
-
return (val === null || val === void 0 || (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val);
|
|
2486
|
-
};
|
|
2568
|
+
const test$3 = (val) => val?.constructor?.name && testNode(val);
|
|
2487
2569
|
function nodeIsText(node) {
|
|
2488
2570
|
return node.nodeType === TEXT_NODE;
|
|
2489
2571
|
}
|
|
@@ -2507,7 +2589,7 @@ const serialize$3 = (node, config, indentation, depth, refs, printer) => {
|
|
|
2507
2589
|
return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
|
|
2508
2590
|
props[attribute.name] = attribute.value;
|
|
2509
2591
|
return props;
|
|
2510
|
-
}, {}), config, indentation + config.indent, depth, refs, printer), printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
2592
|
+
}, {}), config, indentation + config.indent, depth, refs, printer), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
|
|
2511
2593
|
};
|
|
2512
2594
|
const plugin$3 = {
|
|
2513
2595
|
serialize: serialize$3,
|
|
@@ -2595,8 +2677,8 @@ const plugin$2 = {
|
|
|
2595
2677
|
test: test$2
|
|
2596
2678
|
};
|
|
2597
2679
|
|
|
2598
|
-
function getDefaultExportFromCjs$1
|
|
2599
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x,
|
|
2680
|
+
function getDefaultExportFromCjs$1(x) {
|
|
2681
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2600
2682
|
}
|
|
2601
2683
|
|
|
2602
2684
|
var reactIs$1 = {exports: {}};
|
|
@@ -2622,8 +2704,8 @@ function requireReactIs_production () {
|
|
|
2622
2704
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
2623
2705
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
2624
2706
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
2625
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler")
|
|
2626
|
-
|
|
2707
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
2708
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
2627
2709
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
2628
2710
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
2629
2711
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
@@ -2739,157 +2821,14 @@ function requireReactIs_production () {
|
|
|
2739
2821
|
return reactIs_production;
|
|
2740
2822
|
}
|
|
2741
2823
|
|
|
2742
|
-
var reactIs_development$1 = {};
|
|
2743
|
-
|
|
2744
|
-
/**
|
|
2745
|
-
* @license React
|
|
2746
|
-
* react-is.development.js
|
|
2747
|
-
*
|
|
2748
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2749
|
-
*
|
|
2750
|
-
* This source code is licensed under the MIT license found in the
|
|
2751
|
-
* LICENSE file in the root directory of this source tree.
|
|
2752
|
-
*/
|
|
2753
|
-
|
|
2754
|
-
var hasRequiredReactIs_development$1;
|
|
2755
|
-
|
|
2756
|
-
function requireReactIs_development$1 () {
|
|
2757
|
-
if (hasRequiredReactIs_development$1) return reactIs_development$1;
|
|
2758
|
-
hasRequiredReactIs_development$1 = 1;
|
|
2759
|
-
"production" !== process.env.NODE_ENV &&
|
|
2760
|
-
(function () {
|
|
2761
|
-
function typeOf(object) {
|
|
2762
|
-
if ("object" === typeof object && null !== object) {
|
|
2763
|
-
var $$typeof = object.$$typeof;
|
|
2764
|
-
switch ($$typeof) {
|
|
2765
|
-
case REACT_ELEMENT_TYPE:
|
|
2766
|
-
switch (((object = object.type), object)) {
|
|
2767
|
-
case REACT_FRAGMENT_TYPE:
|
|
2768
|
-
case REACT_PROFILER_TYPE:
|
|
2769
|
-
case REACT_STRICT_MODE_TYPE:
|
|
2770
|
-
case REACT_SUSPENSE_TYPE:
|
|
2771
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2772
|
-
case REACT_VIEW_TRANSITION_TYPE:
|
|
2773
|
-
return object;
|
|
2774
|
-
default:
|
|
2775
|
-
switch (((object = object && object.$$typeof), object)) {
|
|
2776
|
-
case REACT_CONTEXT_TYPE:
|
|
2777
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2778
|
-
case REACT_LAZY_TYPE:
|
|
2779
|
-
case REACT_MEMO_TYPE:
|
|
2780
|
-
return object;
|
|
2781
|
-
case REACT_CONSUMER_TYPE:
|
|
2782
|
-
return object;
|
|
2783
|
-
default:
|
|
2784
|
-
return $$typeof;
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
case REACT_PORTAL_TYPE:
|
|
2788
|
-
return $$typeof;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
2793
|
-
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
2794
|
-
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
2795
|
-
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
2796
|
-
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
2797
|
-
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
2798
|
-
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
2799
|
-
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
2800
|
-
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
2801
|
-
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
2802
|
-
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
2803
|
-
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
2804
|
-
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
|
|
2805
|
-
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
2806
|
-
reactIs_development$1.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
2807
|
-
reactIs_development$1.ContextProvider = REACT_CONTEXT_TYPE;
|
|
2808
|
-
reactIs_development$1.Element = REACT_ELEMENT_TYPE;
|
|
2809
|
-
reactIs_development$1.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2810
|
-
reactIs_development$1.Fragment = REACT_FRAGMENT_TYPE;
|
|
2811
|
-
reactIs_development$1.Lazy = REACT_LAZY_TYPE;
|
|
2812
|
-
reactIs_development$1.Memo = REACT_MEMO_TYPE;
|
|
2813
|
-
reactIs_development$1.Portal = REACT_PORTAL_TYPE;
|
|
2814
|
-
reactIs_development$1.Profiler = REACT_PROFILER_TYPE;
|
|
2815
|
-
reactIs_development$1.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2816
|
-
reactIs_development$1.Suspense = REACT_SUSPENSE_TYPE;
|
|
2817
|
-
reactIs_development$1.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
2818
|
-
reactIs_development$1.isContextConsumer = function (object) {
|
|
2819
|
-
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
2820
|
-
};
|
|
2821
|
-
reactIs_development$1.isContextProvider = function (object) {
|
|
2822
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2823
|
-
};
|
|
2824
|
-
reactIs_development$1.isElement = function (object) {
|
|
2825
|
-
return (
|
|
2826
|
-
"object" === typeof object &&
|
|
2827
|
-
null !== object &&
|
|
2828
|
-
object.$$typeof === REACT_ELEMENT_TYPE
|
|
2829
|
-
);
|
|
2830
|
-
};
|
|
2831
|
-
reactIs_development$1.isForwardRef = function (object) {
|
|
2832
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
2833
|
-
};
|
|
2834
|
-
reactIs_development$1.isFragment = function (object) {
|
|
2835
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
2836
|
-
};
|
|
2837
|
-
reactIs_development$1.isLazy = function (object) {
|
|
2838
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
2839
|
-
};
|
|
2840
|
-
reactIs_development$1.isMemo = function (object) {
|
|
2841
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
2842
|
-
};
|
|
2843
|
-
reactIs_development$1.isPortal = function (object) {
|
|
2844
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
2845
|
-
};
|
|
2846
|
-
reactIs_development$1.isProfiler = function (object) {
|
|
2847
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
2848
|
-
};
|
|
2849
|
-
reactIs_development$1.isStrictMode = function (object) {
|
|
2850
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
2851
|
-
};
|
|
2852
|
-
reactIs_development$1.isSuspense = function (object) {
|
|
2853
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
2854
|
-
};
|
|
2855
|
-
reactIs_development$1.isSuspenseList = function (object) {
|
|
2856
|
-
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
2857
|
-
};
|
|
2858
|
-
reactIs_development$1.isValidElementType = function (type) {
|
|
2859
|
-
return "string" === typeof type ||
|
|
2860
|
-
"function" === typeof type ||
|
|
2861
|
-
type === REACT_FRAGMENT_TYPE ||
|
|
2862
|
-
type === REACT_PROFILER_TYPE ||
|
|
2863
|
-
type === REACT_STRICT_MODE_TYPE ||
|
|
2864
|
-
type === REACT_SUSPENSE_TYPE ||
|
|
2865
|
-
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
2866
|
-
("object" === typeof type &&
|
|
2867
|
-
null !== type &&
|
|
2868
|
-
(type.$$typeof === REACT_LAZY_TYPE ||
|
|
2869
|
-
type.$$typeof === REACT_MEMO_TYPE ||
|
|
2870
|
-
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
2871
|
-
type.$$typeof === REACT_CONSUMER_TYPE ||
|
|
2872
|
-
type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
2873
|
-
type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|
2874
|
-
void 0 !== type.getModuleId))
|
|
2875
|
-
? true
|
|
2876
|
-
: false;
|
|
2877
|
-
};
|
|
2878
|
-
reactIs_development$1.typeOf = typeOf;
|
|
2879
|
-
})();
|
|
2880
|
-
return reactIs_development$1;
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
2824
|
var hasRequiredReactIs$1;
|
|
2884
2825
|
|
|
2885
2826
|
function requireReactIs$1 () {
|
|
2886
2827
|
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
2887
2828
|
hasRequiredReactIs$1 = 1;
|
|
2888
2829
|
|
|
2889
|
-
|
|
2830
|
+
{
|
|
2890
2831
|
reactIs$1.exports = requireReactIs_production();
|
|
2891
|
-
} else {
|
|
2892
|
-
reactIs$1.exports = requireReactIs_development$1();
|
|
2893
2832
|
}
|
|
2894
2833
|
return reactIs$1.exports;
|
|
2895
2834
|
}
|
|
@@ -2929,245 +2868,14 @@ var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("rea
|
|
|
2929
2868
|
return reactIs_production_min;
|
|
2930
2869
|
}
|
|
2931
2870
|
|
|
2932
|
-
var reactIs_development = {};
|
|
2933
|
-
|
|
2934
|
-
/**
|
|
2935
|
-
* @license React
|
|
2936
|
-
* react-is.development.js
|
|
2937
|
-
*
|
|
2938
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2939
|
-
*
|
|
2940
|
-
* This source code is licensed under the MIT license found in the
|
|
2941
|
-
* LICENSE file in the root directory of this source tree.
|
|
2942
|
-
*/
|
|
2943
|
-
|
|
2944
|
-
var hasRequiredReactIs_development;
|
|
2945
|
-
|
|
2946
|
-
function requireReactIs_development () {
|
|
2947
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
2948
|
-
hasRequiredReactIs_development = 1;
|
|
2949
|
-
|
|
2950
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2951
|
-
(function() {
|
|
2952
|
-
|
|
2953
|
-
// ATTENTION
|
|
2954
|
-
// When adding new symbols to this file,
|
|
2955
|
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
2956
|
-
// The Symbol used to tag the ReactElement-like types.
|
|
2957
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
2958
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
2959
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
2960
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
2961
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
2962
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
2963
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
2964
|
-
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
2965
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
2966
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
2967
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
2968
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
2969
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
2970
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
2971
|
-
|
|
2972
|
-
// -----------------------------------------------------------------------------
|
|
2973
|
-
|
|
2974
|
-
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
2975
|
-
var enableCacheElement = false;
|
|
2976
|
-
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
2977
|
-
|
|
2978
|
-
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
2979
|
-
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
2980
|
-
// issues in DEV builds.
|
|
2981
|
-
|
|
2982
|
-
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
2983
|
-
|
|
2984
|
-
var REACT_MODULE_REFERENCE;
|
|
2985
|
-
|
|
2986
|
-
{
|
|
2987
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
function isValidElementType(type) {
|
|
2991
|
-
if (typeof type === 'string' || typeof type === 'function') {
|
|
2992
|
-
return true;
|
|
2993
|
-
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
2997
|
-
return true;
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3000
|
-
if (typeof type === 'object' && type !== null) {
|
|
3001
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
3002
|
-
// types supported by any Flight configuration anywhere since
|
|
3003
|
-
// we don't know which Flight build this will end up being used
|
|
3004
|
-
// with.
|
|
3005
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
3006
|
-
return true;
|
|
3007
|
-
}
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
return false;
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
function typeOf(object) {
|
|
3014
|
-
if (typeof object === 'object' && object !== null) {
|
|
3015
|
-
var $$typeof = object.$$typeof;
|
|
3016
|
-
|
|
3017
|
-
switch ($$typeof) {
|
|
3018
|
-
case REACT_ELEMENT_TYPE:
|
|
3019
|
-
var type = object.type;
|
|
3020
|
-
|
|
3021
|
-
switch (type) {
|
|
3022
|
-
case REACT_FRAGMENT_TYPE:
|
|
3023
|
-
case REACT_PROFILER_TYPE:
|
|
3024
|
-
case REACT_STRICT_MODE_TYPE:
|
|
3025
|
-
case REACT_SUSPENSE_TYPE:
|
|
3026
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
3027
|
-
return type;
|
|
3028
|
-
|
|
3029
|
-
default:
|
|
3030
|
-
var $$typeofType = type && type.$$typeof;
|
|
3031
|
-
|
|
3032
|
-
switch ($$typeofType) {
|
|
3033
|
-
case REACT_SERVER_CONTEXT_TYPE:
|
|
3034
|
-
case REACT_CONTEXT_TYPE:
|
|
3035
|
-
case REACT_FORWARD_REF_TYPE:
|
|
3036
|
-
case REACT_LAZY_TYPE:
|
|
3037
|
-
case REACT_MEMO_TYPE:
|
|
3038
|
-
case REACT_PROVIDER_TYPE:
|
|
3039
|
-
return $$typeofType;
|
|
3040
|
-
|
|
3041
|
-
default:
|
|
3042
|
-
return $$typeof;
|
|
3043
|
-
}
|
|
3044
|
-
|
|
3045
|
-
}
|
|
3046
|
-
|
|
3047
|
-
case REACT_PORTAL_TYPE:
|
|
3048
|
-
return $$typeof;
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
return undefined;
|
|
3053
|
-
}
|
|
3054
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
3055
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
3056
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
3057
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
3058
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
3059
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
3060
|
-
var Memo = REACT_MEMO_TYPE;
|
|
3061
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
3062
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
3063
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
3064
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
3065
|
-
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
3066
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
3067
|
-
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
3068
|
-
|
|
3069
|
-
function isAsyncMode(object) {
|
|
3070
|
-
{
|
|
3071
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
3072
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
3073
|
-
|
|
3074
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
3075
|
-
}
|
|
3076
|
-
}
|
|
3077
|
-
|
|
3078
|
-
return false;
|
|
3079
|
-
}
|
|
3080
|
-
function isConcurrentMode(object) {
|
|
3081
|
-
{
|
|
3082
|
-
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
3083
|
-
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
3084
|
-
|
|
3085
|
-
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
|
|
3089
|
-
return false;
|
|
3090
|
-
}
|
|
3091
|
-
function isContextConsumer(object) {
|
|
3092
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
3093
|
-
}
|
|
3094
|
-
function isContextProvider(object) {
|
|
3095
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
3096
|
-
}
|
|
3097
|
-
function isElement(object) {
|
|
3098
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
3099
|
-
}
|
|
3100
|
-
function isForwardRef(object) {
|
|
3101
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
3102
|
-
}
|
|
3103
|
-
function isFragment(object) {
|
|
3104
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
3105
|
-
}
|
|
3106
|
-
function isLazy(object) {
|
|
3107
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
3108
|
-
}
|
|
3109
|
-
function isMemo(object) {
|
|
3110
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
3111
|
-
}
|
|
3112
|
-
function isPortal(object) {
|
|
3113
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
3114
|
-
}
|
|
3115
|
-
function isProfiler(object) {
|
|
3116
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
3117
|
-
}
|
|
3118
|
-
function isStrictMode(object) {
|
|
3119
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
3120
|
-
}
|
|
3121
|
-
function isSuspense(object) {
|
|
3122
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
3123
|
-
}
|
|
3124
|
-
function isSuspenseList(object) {
|
|
3125
|
-
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
3129
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
3130
|
-
reactIs_development.Element = Element;
|
|
3131
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
3132
|
-
reactIs_development.Fragment = Fragment;
|
|
3133
|
-
reactIs_development.Lazy = Lazy;
|
|
3134
|
-
reactIs_development.Memo = Memo;
|
|
3135
|
-
reactIs_development.Portal = Portal;
|
|
3136
|
-
reactIs_development.Profiler = Profiler;
|
|
3137
|
-
reactIs_development.StrictMode = StrictMode;
|
|
3138
|
-
reactIs_development.Suspense = Suspense;
|
|
3139
|
-
reactIs_development.SuspenseList = SuspenseList;
|
|
3140
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
3141
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
3142
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
3143
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
3144
|
-
reactIs_development.isElement = isElement;
|
|
3145
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
3146
|
-
reactIs_development.isFragment = isFragment;
|
|
3147
|
-
reactIs_development.isLazy = isLazy;
|
|
3148
|
-
reactIs_development.isMemo = isMemo;
|
|
3149
|
-
reactIs_development.isPortal = isPortal;
|
|
3150
|
-
reactIs_development.isProfiler = isProfiler;
|
|
3151
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
3152
|
-
reactIs_development.isSuspense = isSuspense;
|
|
3153
|
-
reactIs_development.isSuspenseList = isSuspenseList;
|
|
3154
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
3155
|
-
reactIs_development.typeOf = typeOf;
|
|
3156
|
-
})();
|
|
3157
|
-
}
|
|
3158
|
-
return reactIs_development;
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
2871
|
var hasRequiredReactIs;
|
|
3162
2872
|
|
|
3163
2873
|
function requireReactIs () {
|
|
3164
2874
|
if (hasRequiredReactIs) return reactIs.exports;
|
|
3165
2875
|
hasRequiredReactIs = 1;
|
|
3166
2876
|
|
|
3167
|
-
|
|
2877
|
+
{
|
|
3168
2878
|
reactIs.exports = requireReactIs_production_min();
|
|
3169
|
-
} else {
|
|
3170
|
-
reactIs.exports = requireReactIs_development();
|
|
3171
2879
|
}
|
|
3172
2880
|
return reactIs.exports;
|
|
3173
2881
|
}
|
|
@@ -3418,7 +3126,7 @@ const ErrorPlugin = {
|
|
|
3418
3126
|
}
|
|
3419
3127
|
refs = [...refs, val];
|
|
3420
3128
|
const hitMaxDepth = ++depth > config.maxDepth;
|
|
3421
|
-
const { message, cause
|
|
3129
|
+
const { message, cause, ...rest } = val;
|
|
3422
3130
|
const entries = {
|
|
3423
3131
|
message,
|
|
3424
3132
|
...typeof cause !== "undefined" ? { cause } : {},
|
|
@@ -3495,11 +3203,12 @@ const DEFAULT_OPTIONS = {
|
|
|
3495
3203
|
plugins: [],
|
|
3496
3204
|
printBasicPrototype: true,
|
|
3497
3205
|
printFunctionName: true,
|
|
3206
|
+
printShadowRoot: true,
|
|
3498
3207
|
theme: DEFAULT_THEME
|
|
3499
3208
|
};
|
|
3500
3209
|
function validateOptions(options) {
|
|
3501
3210
|
for (const key of Object.keys(options)) {
|
|
3502
|
-
if (!Object.
|
|
3211
|
+
if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {
|
|
3503
3212
|
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
3504
3213
|
}
|
|
3505
3214
|
}
|
|
@@ -3510,7 +3219,7 @@ function validateOptions(options) {
|
|
|
3510
3219
|
function getColorsHighlight() {
|
|
3511
3220
|
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
3512
3221
|
const value = DEFAULT_THEME[key];
|
|
3513
|
-
const color = value &&
|
|
3222
|
+
const color = value && C[value];
|
|
3514
3223
|
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
3515
3224
|
colors[key] = color;
|
|
3516
3225
|
} else {
|
|
@@ -3529,30 +3238,31 @@ function getColorsEmpty() {
|
|
|
3529
3238
|
}, Object.create(null));
|
|
3530
3239
|
}
|
|
3531
3240
|
function getPrintFunctionName(options) {
|
|
3532
|
-
return
|
|
3241
|
+
return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
|
|
3533
3242
|
}
|
|
3534
3243
|
function getEscapeRegex(options) {
|
|
3535
|
-
return
|
|
3244
|
+
return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
|
|
3536
3245
|
}
|
|
3537
3246
|
function getEscapeString(options) {
|
|
3538
|
-
return
|
|
3247
|
+
return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
|
|
3539
3248
|
}
|
|
3540
3249
|
function getConfig(options) {
|
|
3541
3250
|
return {
|
|
3542
|
-
callToJSON:
|
|
3543
|
-
colors:
|
|
3544
|
-
compareKeys: typeof
|
|
3251
|
+
callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
|
|
3252
|
+
colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
|
|
3253
|
+
compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
3545
3254
|
escapeRegex: getEscapeRegex(options),
|
|
3546
3255
|
escapeString: getEscapeString(options),
|
|
3547
|
-
indent:
|
|
3548
|
-
maxDepth:
|
|
3549
|
-
maxWidth:
|
|
3550
|
-
min:
|
|
3551
|
-
plugins:
|
|
3552
|
-
printBasicPrototype:
|
|
3256
|
+
indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
|
|
3257
|
+
maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
|
|
3258
|
+
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
3259
|
+
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
3260
|
+
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
3261
|
+
printBasicPrototype: options?.printBasicPrototype ?? true,
|
|
3553
3262
|
printFunctionName: getPrintFunctionName(options),
|
|
3554
|
-
|
|
3555
|
-
|
|
3263
|
+
printShadowRoot: options?.printShadowRoot ?? true,
|
|
3264
|
+
spacingInner: options?.min ? " " : "\n",
|
|
3265
|
+
spacingOuter: options?.min ? "" : "\n"
|
|
3556
3266
|
};
|
|
3557
3267
|
}
|
|
3558
3268
|
function createIndent(indent) {
|
|
@@ -3589,26 +3299,8 @@ const plugins = {
|
|
|
3589
3299
|
Error: ErrorPlugin
|
|
3590
3300
|
};
|
|
3591
3301
|
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
// @ts-ignore
|
|
3595
|
-
const { getPromiseDetails, kPending, kRejected } = process.binding('util');
|
|
3596
|
-
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
3597
|
-
getPromiseValue$1 = (value, options) => {
|
|
3598
|
-
const [state, innerValue] = getPromiseDetails(value);
|
|
3599
|
-
if (state === kPending) {
|
|
3600
|
-
return 'Promise{<pending>}';
|
|
3601
|
-
}
|
|
3602
|
-
return `Promise${state === kRejected ? '!' : ''}{${options.inspect(innerValue, options)}}`;
|
|
3603
|
-
};
|
|
3604
|
-
}
|
|
3605
|
-
}
|
|
3606
|
-
catch (notNode) {
|
|
3607
|
-
/* ignore */
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
|
-
function getDefaultExportFromCjs (x) {
|
|
3611
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3302
|
+
function getDefaultExportFromCjs(x) {
|
|
3303
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
3612
3304
|
}
|
|
3613
3305
|
|
|
3614
3306
|
/**
|
|
@@ -4482,7 +4174,7 @@ function requireBuild () {
|
|
|
4482
4174
|
return build;
|
|
4483
4175
|
}
|
|
4484
4176
|
|
|
4485
|
-
var buildExports = requireBuild();
|
|
4177
|
+
var buildExports = /*@__PURE__*/ requireBuild();
|
|
4486
4178
|
var diffSequences = /*@__PURE__*/getDefaultExportFromCjs(buildExports);
|
|
4487
4179
|
|
|
4488
4180
|
function formatTrailingSpaces(line, trailingSpaceFormatter) {
|
|
@@ -4670,14 +4362,14 @@ const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
|
4670
4362
|
function getDefaultOptions() {
|
|
4671
4363
|
return {
|
|
4672
4364
|
aAnnotation: "Expected",
|
|
4673
|
-
aColor:
|
|
4365
|
+
aColor: C.green,
|
|
4674
4366
|
aIndicator: "-",
|
|
4675
4367
|
bAnnotation: "Received",
|
|
4676
|
-
bColor:
|
|
4368
|
+
bColor: C.red,
|
|
4677
4369
|
bIndicator: "+",
|
|
4678
|
-
changeColor:
|
|
4370
|
+
changeColor: C.inverse,
|
|
4679
4371
|
changeLineTrailingSpaceColor: noColor,
|
|
4680
|
-
commonColor:
|
|
4372
|
+
commonColor: C.dim,
|
|
4681
4373
|
commonIndicator: " ",
|
|
4682
4374
|
commonLineTrailingSpaceColor: noColor,
|
|
4683
4375
|
compareKeys: undefined,
|
|
@@ -4686,7 +4378,7 @@ function getDefaultOptions() {
|
|
|
4686
4378
|
expand: false,
|
|
4687
4379
|
includeChangeCounts: false,
|
|
4688
4380
|
omitAnnotationLines: false,
|
|
4689
|
-
patchColor:
|
|
4381
|
+
patchColor: C.yellow,
|
|
4690
4382
|
printBasicPrototype: false,
|
|
4691
4383
|
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
4692
4384
|
truncateAnnotation: "... Diff result is truncated",
|
|
@@ -5013,21 +4705,13 @@ function getObjectsDifference(a, b, formatOptions, options) {
|
|
|
5013
4705
|
}
|
|
5014
4706
|
|
|
5015
4707
|
var __defProp = Object.defineProperty;
|
|
5016
|
-
var
|
|
4708
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5017
4709
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5018
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
5019
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5020
|
-
};
|
|
5021
4710
|
var __export = (target, all) => {
|
|
5022
4711
|
for (var name in all)
|
|
5023
4712
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5024
4713
|
};
|
|
5025
|
-
|
|
5026
|
-
// (disabled):util
|
|
5027
|
-
var require_util = __commonJS({
|
|
5028
|
-
"(disabled):util"() {
|
|
5029
|
-
}
|
|
5030
|
-
});
|
|
4714
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5031
4715
|
|
|
5032
4716
|
// lib/chai/utils/index.js
|
|
5033
4717
|
var utils_exports = {};
|
|
@@ -5039,6 +4723,7 @@ __export(utils_exports, {
|
|
|
5039
4723
|
checkError: () => check_error_exports,
|
|
5040
4724
|
compareByInspect: () => compareByInspect,
|
|
5041
4725
|
eql: () => deep_eql_default,
|
|
4726
|
+
events: () => events,
|
|
5042
4727
|
expectTypes: () => expectTypes,
|
|
5043
4728
|
flag: () => flag,
|
|
5044
4729
|
getActual: () => getActual,
|
|
@@ -5131,7 +4816,7 @@ __name(getMessage, "getMessage");
|
|
|
5131
4816
|
|
|
5132
4817
|
// lib/chai/utils/flag.js
|
|
5133
4818
|
function flag(obj, key, value) {
|
|
5134
|
-
|
|
4819
|
+
let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
|
|
5135
4820
|
if (arguments.length === 3) {
|
|
5136
4821
|
flags[key] = value;
|
|
5137
4822
|
} else {
|
|
@@ -5142,7 +4827,7 @@ __name(flag, "flag");
|
|
|
5142
4827
|
|
|
5143
4828
|
// lib/chai/utils/test.js
|
|
5144
4829
|
function test(obj, args) {
|
|
5145
|
-
|
|
4830
|
+
let negate = flag(obj, "negate"), expr = args[0];
|
|
5146
4831
|
return negate ? !expr : expr;
|
|
5147
4832
|
}
|
|
5148
4833
|
__name(test, "test");
|
|
@@ -5166,19 +4851,10 @@ __name(type, "type");
|
|
|
5166
4851
|
|
|
5167
4852
|
// node_modules/assertion-error/index.js
|
|
5168
4853
|
var canElideFrames = "captureStackTrace" in Error;
|
|
5169
|
-
var
|
|
5170
|
-
static {
|
|
5171
|
-
__name(this, "AssertionError");
|
|
5172
|
-
}
|
|
5173
|
-
message;
|
|
5174
|
-
get name() {
|
|
5175
|
-
return "AssertionError";
|
|
5176
|
-
}
|
|
5177
|
-
get ok() {
|
|
5178
|
-
return false;
|
|
5179
|
-
}
|
|
4854
|
+
var _AssertionError = class _AssertionError extends Error {
|
|
5180
4855
|
constructor(message = "Unspecified AssertionError", props, ssf) {
|
|
5181
4856
|
super(message);
|
|
4857
|
+
__publicField(this, "message");
|
|
5182
4858
|
this.message = message;
|
|
5183
4859
|
if (canElideFrames) {
|
|
5184
4860
|
Error.captureStackTrace(this, ssf || _AssertionError);
|
|
@@ -5189,6 +4865,12 @@ var AssertionError = class _AssertionError extends Error {
|
|
|
5189
4865
|
}
|
|
5190
4866
|
}
|
|
5191
4867
|
}
|
|
4868
|
+
get name() {
|
|
4869
|
+
return "AssertionError";
|
|
4870
|
+
}
|
|
4871
|
+
get ok() {
|
|
4872
|
+
return false;
|
|
4873
|
+
}
|
|
5192
4874
|
toJSON(stack) {
|
|
5193
4875
|
return {
|
|
5194
4876
|
...this,
|
|
@@ -5199,23 +4881,25 @@ var AssertionError = class _AssertionError extends Error {
|
|
|
5199
4881
|
};
|
|
5200
4882
|
}
|
|
5201
4883
|
};
|
|
4884
|
+
__name(_AssertionError, "AssertionError");
|
|
4885
|
+
var AssertionError = _AssertionError;
|
|
5202
4886
|
|
|
5203
4887
|
// lib/chai/utils/expectTypes.js
|
|
5204
4888
|
function expectTypes(obj, types) {
|
|
5205
|
-
|
|
5206
|
-
|
|
4889
|
+
let flagMsg = flag(obj, "message");
|
|
4890
|
+
let ssfi = flag(obj, "ssfi");
|
|
5207
4891
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
5208
4892
|
obj = flag(obj, "object");
|
|
5209
4893
|
types = types.map(function(t) {
|
|
5210
4894
|
return t.toLowerCase();
|
|
5211
4895
|
});
|
|
5212
4896
|
types.sort();
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
4897
|
+
let str = types.map(function(t, index) {
|
|
4898
|
+
let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
|
|
4899
|
+
let or = types.length > 1 && index === types.length - 1 ? "or " : "";
|
|
5216
4900
|
return or + art + " " + t;
|
|
5217
4901
|
}).join(", ");
|
|
5218
|
-
|
|
4902
|
+
let objType = type(obj).toLowerCase();
|
|
5219
4903
|
if (!types.some(function(expected) {
|
|
5220
4904
|
return objType === expected;
|
|
5221
4905
|
})) {
|
|
@@ -5487,10 +5171,8 @@ function mapToEntries(map) {
|
|
|
5487
5171
|
}
|
|
5488
5172
|
__name(mapToEntries, "mapToEntries");
|
|
5489
5173
|
function inspectMap(map, options) {
|
|
5490
|
-
|
|
5491
|
-
if (size <= 0) {
|
|
5174
|
+
if (map.size === 0)
|
|
5492
5175
|
return "Map{}";
|
|
5493
|
-
}
|
|
5494
5176
|
options.truncate -= 7;
|
|
5495
5177
|
return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
|
|
5496
5178
|
}
|
|
@@ -5586,19 +5268,6 @@ __name(inspectSymbol, "inspectSymbol");
|
|
|
5586
5268
|
|
|
5587
5269
|
// node_modules/loupe/lib/promise.js
|
|
5588
5270
|
var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue");
|
|
5589
|
-
try {
|
|
5590
|
-
const { getPromiseDetails, kPending, kRejected } = process.binding("util");
|
|
5591
|
-
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
5592
|
-
getPromiseValue = /* @__PURE__ */ __name((value, options) => {
|
|
5593
|
-
const [state, innerValue] = getPromiseDetails(value);
|
|
5594
|
-
if (state === kPending) {
|
|
5595
|
-
return "Promise{<pending>}";
|
|
5596
|
-
}
|
|
5597
|
-
return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
|
|
5598
|
-
}, "getPromiseValue");
|
|
5599
|
-
}
|
|
5600
|
-
} catch (notNode) {
|
|
5601
|
-
}
|
|
5602
5271
|
var promise_default = getPromiseValue;
|
|
5603
5272
|
|
|
5604
5273
|
// node_modules/loupe/lib/object.js
|
|
@@ -5695,10 +5364,21 @@ function inspectAttribute([key, value], options) {
|
|
|
5695
5364
|
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
5696
5365
|
}
|
|
5697
5366
|
__name(inspectAttribute, "inspectAttribute");
|
|
5698
|
-
function
|
|
5699
|
-
return inspectList(collection, options,
|
|
5367
|
+
function inspectNodeCollection(collection, options) {
|
|
5368
|
+
return inspectList(collection, options, inspectNode, "\n");
|
|
5369
|
+
}
|
|
5370
|
+
__name(inspectNodeCollection, "inspectNodeCollection");
|
|
5371
|
+
function inspectNode(node, options) {
|
|
5372
|
+
switch (node.nodeType) {
|
|
5373
|
+
case 1:
|
|
5374
|
+
return inspectHTML(node, options);
|
|
5375
|
+
case 3:
|
|
5376
|
+
return options.inspect(node.data, options);
|
|
5377
|
+
default:
|
|
5378
|
+
return options.inspect(node, options);
|
|
5379
|
+
}
|
|
5700
5380
|
}
|
|
5701
|
-
__name(
|
|
5381
|
+
__name(inspectNode, "inspectNode");
|
|
5702
5382
|
function inspectHTML(element, options) {
|
|
5703
5383
|
const properties = element.getAttributeNames();
|
|
5704
5384
|
const name = element.tagName.toLowerCase();
|
|
@@ -5713,7 +5393,7 @@ function inspectHTML(element, options) {
|
|
|
5713
5393
|
}
|
|
5714
5394
|
options.truncate -= propertyContents.length;
|
|
5715
5395
|
const truncate2 = options.truncate;
|
|
5716
|
-
let children =
|
|
5396
|
+
let children = inspectNodeCollection(element.children, options);
|
|
5717
5397
|
if (children && children.length > truncate2) {
|
|
5718
5398
|
children = `${truncator}(${element.children.length})`;
|
|
5719
5399
|
}
|
|
@@ -5723,21 +5403,15 @@ __name(inspectHTML, "inspectHTML");
|
|
|
5723
5403
|
|
|
5724
5404
|
// node_modules/loupe/lib/index.js
|
|
5725
5405
|
var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
5726
|
-
var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
5727
|
-
var nodeInspect =
|
|
5728
|
-
try {
|
|
5729
|
-
const nodeUtil = require_util();
|
|
5730
|
-
nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
|
5731
|
-
} catch (noNodeInspect) {
|
|
5732
|
-
nodeInspect = false;
|
|
5733
|
-
}
|
|
5406
|
+
var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
|
|
5407
|
+
var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
5734
5408
|
var constructorMap = /* @__PURE__ */ new WeakMap();
|
|
5735
5409
|
var stringTagMap = {};
|
|
5736
5410
|
var baseTypesMap = {
|
|
5737
|
-
undefined: (value, options) => options.stylize("undefined", "undefined"),
|
|
5738
|
-
null: (value, options) => options.stylize("null", "null"),
|
|
5739
|
-
boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
5740
|
-
Boolean: (value, options) => options.stylize(String(value), "boolean"),
|
|
5411
|
+
undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"),
|
|
5412
|
+
null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"),
|
|
5413
|
+
boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"),
|
|
5414
|
+
Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"),
|
|
5741
5415
|
number: inspectNumber,
|
|
5742
5416
|
Number: inspectNumber,
|
|
5743
5417
|
bigint: inspectBigInt,
|
|
@@ -5756,8 +5430,8 @@ var baseTypesMap = {
|
|
|
5756
5430
|
RegExp: inspectRegExp,
|
|
5757
5431
|
Promise: promise_default,
|
|
5758
5432
|
// WeakSet, WeakMap are totally opaque to us
|
|
5759
|
-
WeakSet: (value, options) => options.stylize("WeakSet{\u2026}", "special"),
|
|
5760
|
-
WeakMap: (value, options) => options.stylize("WeakMap{\u2026}", "special"),
|
|
5433
|
+
WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{\u2026}", "special"), "WeakSet"),
|
|
5434
|
+
WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{\u2026}", "special"), "WeakMap"),
|
|
5761
5435
|
Arguments: inspectArguments,
|
|
5762
5436
|
Int8Array: inspectTypedArray,
|
|
5763
5437
|
Uint8Array: inspectTypedArray,
|
|
@@ -5768,19 +5442,19 @@ var baseTypesMap = {
|
|
|
5768
5442
|
Uint32Array: inspectTypedArray,
|
|
5769
5443
|
Float32Array: inspectTypedArray,
|
|
5770
5444
|
Float64Array: inspectTypedArray,
|
|
5771
|
-
Generator: () => "",
|
|
5772
|
-
DataView: () => "",
|
|
5773
|
-
ArrayBuffer: () => "",
|
|
5445
|
+
Generator: /* @__PURE__ */ __name(() => "", "Generator"),
|
|
5446
|
+
DataView: /* @__PURE__ */ __name(() => "", "DataView"),
|
|
5447
|
+
ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"),
|
|
5774
5448
|
Error: inspectObject2,
|
|
5775
|
-
HTMLCollection:
|
|
5776
|
-
NodeList:
|
|
5449
|
+
HTMLCollection: inspectNodeCollection,
|
|
5450
|
+
NodeList: inspectNodeCollection
|
|
5777
5451
|
};
|
|
5778
|
-
var inspectCustom = /* @__PURE__ */ __name((value, options, type3) => {
|
|
5452
|
+
var inspectCustom = /* @__PURE__ */ __name((value, options, type3, inspectFn) => {
|
|
5779
5453
|
if (chaiInspect in value && typeof value[chaiInspect] === "function") {
|
|
5780
5454
|
return value[chaiInspect](options);
|
|
5781
5455
|
}
|
|
5782
|
-
if (nodeInspect
|
|
5783
|
-
return value[nodeInspect](options.depth, options);
|
|
5456
|
+
if (nodeInspect in value && typeof value[nodeInspect] === "function") {
|
|
5457
|
+
return value[nodeInspect](options.depth, options, inspectFn);
|
|
5784
5458
|
}
|
|
5785
5459
|
if ("inspect" in value && typeof value.inspect === "function") {
|
|
5786
5460
|
return value.inspect(options.depth, options);
|
|
@@ -5805,7 +5479,7 @@ function inspect(value, opts = {}) {
|
|
|
5805
5479
|
return baseTypesMap[type3](value, options);
|
|
5806
5480
|
}
|
|
5807
5481
|
if (customInspect && value) {
|
|
5808
|
-
const output = inspectCustom(value, options, type3);
|
|
5482
|
+
const output = inspectCustom(value, options, type3, inspect);
|
|
5809
5483
|
if (output) {
|
|
5810
5484
|
if (typeof output === "string")
|
|
5811
5485
|
return output;
|
|
@@ -5943,7 +5617,7 @@ var config = {
|
|
|
5943
5617
|
|
|
5944
5618
|
// lib/chai/utils/inspect.js
|
|
5945
5619
|
function inspect2(obj, showHidden, depth, colors) {
|
|
5946
|
-
|
|
5620
|
+
let options = {
|
|
5947
5621
|
colors,
|
|
5948
5622
|
depth: typeof depth === "undefined" ? 2 : depth,
|
|
5949
5623
|
showHidden,
|
|
@@ -5955,14 +5629,14 @@ __name(inspect2, "inspect");
|
|
|
5955
5629
|
|
|
5956
5630
|
// lib/chai/utils/objDisplay.js
|
|
5957
5631
|
function objDisplay(obj) {
|
|
5958
|
-
|
|
5632
|
+
let str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
|
|
5959
5633
|
if (config.truncateThreshold && str.length >= config.truncateThreshold) {
|
|
5960
5634
|
if (type3 === "[object Function]") {
|
|
5961
5635
|
return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
|
|
5962
5636
|
} else if (type3 === "[object Array]") {
|
|
5963
5637
|
return "[ Array(" + obj.length + ") ]";
|
|
5964
5638
|
} else if (type3 === "[object Object]") {
|
|
5965
|
-
|
|
5639
|
+
let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
|
|
5966
5640
|
return "{ Object (" + kstr + ") }";
|
|
5967
5641
|
} else {
|
|
5968
5642
|
return str;
|
|
@@ -5975,9 +5649,13 @@ __name(objDisplay, "objDisplay");
|
|
|
5975
5649
|
|
|
5976
5650
|
// lib/chai/utils/getMessage.js
|
|
5977
5651
|
function getMessage2(obj, args) {
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5652
|
+
let negate = flag(obj, "negate");
|
|
5653
|
+
let val = flag(obj, "object");
|
|
5654
|
+
let expected = args[3];
|
|
5655
|
+
let actual = getActual(obj, args);
|
|
5656
|
+
let msg = negate ? args[2] : args[1];
|
|
5657
|
+
let flagMsg = flag(obj, "message");
|
|
5658
|
+
if (typeof msg === "function") msg = msg();
|
|
5981
5659
|
msg = msg || "";
|
|
5982
5660
|
msg = msg.replace(/#\{this\}/g, function() {
|
|
5983
5661
|
return objDisplay(val);
|
|
@@ -5992,12 +5670,12 @@ __name(getMessage2, "getMessage");
|
|
|
5992
5670
|
|
|
5993
5671
|
// lib/chai/utils/transferFlags.js
|
|
5994
5672
|
function transferFlags(assertion, object, includeAll) {
|
|
5995
|
-
|
|
5673
|
+
let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
|
|
5996
5674
|
if (!object.__flags) {
|
|
5997
5675
|
object.__flags = /* @__PURE__ */ Object.create(null);
|
|
5998
5676
|
}
|
|
5999
5677
|
includeAll = arguments.length === 3 ? includeAll : true;
|
|
6000
|
-
for (
|
|
5678
|
+
for (let flag3 in flags) {
|
|
6001
5679
|
if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
|
|
6002
5680
|
object.__flags[flag3] = flags[flag3];
|
|
6003
5681
|
}
|
|
@@ -6391,96 +6069,194 @@ function getPathInfo(obj, path) {
|
|
|
6391
6069
|
__name(getPathInfo, "getPathInfo");
|
|
6392
6070
|
|
|
6393
6071
|
// lib/chai/assertion.js
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6072
|
+
var _Assertion = class _Assertion {
|
|
6073
|
+
/**
|
|
6074
|
+
* Creates object for chaining.
|
|
6075
|
+
* `Assertion` objects contain metadata in the form of flags. Three flags can
|
|
6076
|
+
* be assigned during instantiation by passing arguments to this constructor:
|
|
6077
|
+
*
|
|
6078
|
+
* - `object`: This flag contains the target of the assertion. For example, in
|
|
6079
|
+
* the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
|
|
6080
|
+
* contain `numKittens` so that the `equal` assertion can reference it when
|
|
6081
|
+
* needed.
|
|
6082
|
+
*
|
|
6083
|
+
* - `message`: This flag contains an optional custom error message to be
|
|
6084
|
+
* prepended to the error message that's generated by the assertion when it
|
|
6085
|
+
* fails.
|
|
6086
|
+
*
|
|
6087
|
+
* - `ssfi`: This flag stands for "start stack function indicator". It
|
|
6088
|
+
* contains a function reference that serves as the starting point for
|
|
6089
|
+
* removing frames from the stack trace of the error that's created by the
|
|
6090
|
+
* assertion when it fails. The goal is to provide a cleaner stack trace to
|
|
6091
|
+
* end users by removing Chai's internal functions. Note that it only works
|
|
6092
|
+
* in environments that support `Error.captureStackTrace`, and only when
|
|
6093
|
+
* `Chai.config.includeStack` hasn't been set to `false`.
|
|
6094
|
+
*
|
|
6095
|
+
* - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
|
|
6096
|
+
* should retain its current value, even as assertions are chained off of
|
|
6097
|
+
* this object. This is usually set to `true` when creating a new assertion
|
|
6098
|
+
* from within another assertion. It's also temporarily set to `true` before
|
|
6099
|
+
* an overwritten assertion gets called by the overwriting assertion.
|
|
6100
|
+
*
|
|
6101
|
+
* - `eql`: This flag contains the deepEqual function to be used by the assertion.
|
|
6102
|
+
*
|
|
6103
|
+
* @param {unknown} obj target of the assertion
|
|
6104
|
+
* @param {string} [msg] (optional) custom error message
|
|
6105
|
+
* @param {Function} [ssfi] (optional) starting point for removing stack frames
|
|
6106
|
+
* @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked
|
|
6107
|
+
*/
|
|
6108
|
+
constructor(obj, msg, ssfi, lockSsfi) {
|
|
6109
|
+
/** @type {{}} */
|
|
6110
|
+
__publicField(this, "__flags", {});
|
|
6111
|
+
flag(this, "ssfi", ssfi || _Assertion);
|
|
6112
|
+
flag(this, "lockSsfi", lockSsfi);
|
|
6113
|
+
flag(this, "object", obj);
|
|
6114
|
+
flag(this, "message", msg);
|
|
6115
|
+
flag(this, "eql", config.deepEqual || deep_eql_default);
|
|
6116
|
+
return proxify(this);
|
|
6117
|
+
}
|
|
6118
|
+
/** @returns {boolean} */
|
|
6119
|
+
static get includeStack() {
|
|
6405
6120
|
console.warn(
|
|
6406
6121
|
"Assertion.includeStack is deprecated, use chai.config.includeStack instead."
|
|
6407
6122
|
);
|
|
6408
6123
|
return config.includeStack;
|
|
6409
|
-
}
|
|
6410
|
-
|
|
6124
|
+
}
|
|
6125
|
+
/** @param {boolean} value */
|
|
6126
|
+
static set includeStack(value) {
|
|
6411
6127
|
console.warn(
|
|
6412
6128
|
"Assertion.includeStack is deprecated, use chai.config.includeStack instead."
|
|
6413
6129
|
);
|
|
6414
6130
|
config.includeStack = value;
|
|
6415
6131
|
}
|
|
6416
|
-
}
|
|
6417
|
-
|
|
6418
|
-
get: function() {
|
|
6132
|
+
/** @returns {boolean} */
|
|
6133
|
+
static get showDiff() {
|
|
6419
6134
|
console.warn(
|
|
6420
6135
|
"Assertion.showDiff is deprecated, use chai.config.showDiff instead."
|
|
6421
6136
|
);
|
|
6422
6137
|
return config.showDiff;
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6138
|
+
}
|
|
6139
|
+
/** @param {boolean} value */
|
|
6140
|
+
static set showDiff(value) {
|
|
6425
6141
|
console.warn(
|
|
6426
6142
|
"Assertion.showDiff is deprecated, use chai.config.showDiff instead."
|
|
6427
6143
|
);
|
|
6428
6144
|
config.showDiff = value;
|
|
6429
6145
|
}
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
}
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
}
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6146
|
+
/**
|
|
6147
|
+
* @param {string} name
|
|
6148
|
+
* @param {Function} fn
|
|
6149
|
+
*/
|
|
6150
|
+
static addProperty(name, fn) {
|
|
6151
|
+
addProperty(this.prototype, name, fn);
|
|
6152
|
+
}
|
|
6153
|
+
/**
|
|
6154
|
+
* @param {string} name
|
|
6155
|
+
* @param {Function} fn
|
|
6156
|
+
*/
|
|
6157
|
+
static addMethod(name, fn) {
|
|
6158
|
+
addMethod(this.prototype, name, fn);
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* @param {string} name
|
|
6162
|
+
* @param {Function} fn
|
|
6163
|
+
* @param {Function} chainingBehavior
|
|
6164
|
+
*/
|
|
6165
|
+
static addChainableMethod(name, fn, chainingBehavior) {
|
|
6166
|
+
addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
6167
|
+
}
|
|
6168
|
+
/**
|
|
6169
|
+
* @param {string} name
|
|
6170
|
+
* @param {Function} fn
|
|
6171
|
+
*/
|
|
6172
|
+
static overwriteProperty(name, fn) {
|
|
6173
|
+
overwriteProperty(this.prototype, name, fn);
|
|
6174
|
+
}
|
|
6175
|
+
/**
|
|
6176
|
+
* @param {string} name
|
|
6177
|
+
* @param {Function} fn
|
|
6178
|
+
*/
|
|
6179
|
+
static overwriteMethod(name, fn) {
|
|
6180
|
+
overwriteMethod(this.prototype, name, fn);
|
|
6181
|
+
}
|
|
6182
|
+
/**
|
|
6183
|
+
* @param {string} name
|
|
6184
|
+
* @param {Function} fn
|
|
6185
|
+
* @param {Function} chainingBehavior
|
|
6186
|
+
*/
|
|
6187
|
+
static overwriteChainableMethod(name, fn, chainingBehavior) {
|
|
6188
|
+
overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
|
6189
|
+
}
|
|
6190
|
+
/**
|
|
6191
|
+
* ### .assert(expression, message, negateMessage, expected, actual, showDiff)
|
|
6192
|
+
*
|
|
6193
|
+
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
|
6194
|
+
*
|
|
6195
|
+
* @name assert
|
|
6196
|
+
* @param {unknown} _expr to be tested
|
|
6197
|
+
* @param {string | Function} msg or function that returns message to display if expression fails
|
|
6198
|
+
* @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails
|
|
6199
|
+
* @param {unknown} expected value (remember to check for negation)
|
|
6200
|
+
* @param {unknown} _actual (optional) will default to `this.obj`
|
|
6201
|
+
* @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
|
|
6202
|
+
* @returns {void}
|
|
6203
|
+
*/
|
|
6204
|
+
assert(_expr, msg, _negateMsg, expected, _actual, showDiff) {
|
|
6205
|
+
const ok = test(this, arguments);
|
|
6206
|
+
if (false !== showDiff) showDiff = true;
|
|
6207
|
+
if (void 0 === expected && void 0 === _actual) showDiff = false;
|
|
6208
|
+
if (true !== config.showDiff) showDiff = false;
|
|
6209
|
+
if (!ok) {
|
|
6210
|
+
msg = getMessage2(this, arguments);
|
|
6211
|
+
const actual = getActual(this, arguments);
|
|
6212
|
+
const assertionErrorObjectProperties = {
|
|
6213
|
+
actual,
|
|
6214
|
+
expected,
|
|
6215
|
+
showDiff
|
|
6216
|
+
};
|
|
6217
|
+
const operator = getOperator(this, arguments);
|
|
6218
|
+
if (operator) {
|
|
6219
|
+
assertionErrorObjectProperties.operator = operator;
|
|
6220
|
+
}
|
|
6221
|
+
throw new AssertionError(
|
|
6222
|
+
msg,
|
|
6223
|
+
assertionErrorObjectProperties,
|
|
6224
|
+
// @ts-expect-error Not sure what to do about these types yet
|
|
6225
|
+
config.includeStack ? this.assert : flag(this, "ssfi")
|
|
6226
|
+
);
|
|
6468
6227
|
}
|
|
6469
|
-
throw new AssertionError(
|
|
6470
|
-
msg,
|
|
6471
|
-
assertionErrorObjectProperties,
|
|
6472
|
-
config.includeStack ? this.assert : flag(this, "ssfi")
|
|
6473
|
-
);
|
|
6474
6228
|
}
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6229
|
+
/**
|
|
6230
|
+
* Quick reference to stored `actual` value for plugin developers.
|
|
6231
|
+
*
|
|
6232
|
+
* @returns {unknown}
|
|
6233
|
+
*/
|
|
6234
|
+
get _obj() {
|
|
6478
6235
|
return flag(this, "object");
|
|
6479
|
-
}
|
|
6480
|
-
|
|
6236
|
+
}
|
|
6237
|
+
/**
|
|
6238
|
+
* Quick reference to stored `actual` value for plugin developers.
|
|
6239
|
+
*
|
|
6240
|
+
* @param {unknown} val
|
|
6241
|
+
*/
|
|
6242
|
+
set _obj(val) {
|
|
6481
6243
|
flag(this, "object", val);
|
|
6482
6244
|
}
|
|
6483
|
-
}
|
|
6245
|
+
};
|
|
6246
|
+
__name(_Assertion, "Assertion");
|
|
6247
|
+
var Assertion = _Assertion;
|
|
6248
|
+
|
|
6249
|
+
// lib/chai/utils/events.js
|
|
6250
|
+
var events = new EventTarget();
|
|
6251
|
+
var _PluginEvent = class _PluginEvent extends Event {
|
|
6252
|
+
constructor(type3, name, fn) {
|
|
6253
|
+
super(type3);
|
|
6254
|
+
this.name = String(name);
|
|
6255
|
+
this.fn = fn;
|
|
6256
|
+
}
|
|
6257
|
+
};
|
|
6258
|
+
__name(_PluginEvent, "PluginEvent");
|
|
6259
|
+
var PluginEvent = _PluginEvent;
|
|
6484
6260
|
|
|
6485
6261
|
// lib/chai/utils/isProxyEnabled.js
|
|
6486
6262
|
function isProxyEnabled() {
|
|
@@ -6497,15 +6273,15 @@ function addProperty(ctx, name, getter) {
|
|
|
6497
6273
|
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
6498
6274
|
flag(this, "ssfi", propertyGetter);
|
|
6499
6275
|
}
|
|
6500
|
-
|
|
6501
|
-
if (result !== void 0)
|
|
6502
|
-
|
|
6503
|
-
var newAssertion = new Assertion();
|
|
6276
|
+
let result = getter.call(this);
|
|
6277
|
+
if (result !== void 0) return result;
|
|
6278
|
+
let newAssertion = new Assertion();
|
|
6504
6279
|
transferFlags(this, newAssertion);
|
|
6505
6280
|
return newAssertion;
|
|
6506
6281
|
}, "propertyGetter"),
|
|
6507
6282
|
configurable: true
|
|
6508
6283
|
});
|
|
6284
|
+
events.dispatchEvent(new PluginEvent("addProperty", name, getter));
|
|
6509
6285
|
}
|
|
6510
6286
|
__name(addProperty, "addProperty");
|
|
6511
6287
|
|
|
@@ -6513,10 +6289,9 @@ __name(addProperty, "addProperty");
|
|
|
6513
6289
|
var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
|
|
6514
6290
|
}, "length");
|
|
6515
6291
|
function addLengthGuard(fn, assertionName, isChainable) {
|
|
6516
|
-
if (!fnLengthDesc.configurable)
|
|
6517
|
-
return fn;
|
|
6292
|
+
if (!fnLengthDesc.configurable) return fn;
|
|
6518
6293
|
Object.defineProperty(fn, "length", {
|
|
6519
|
-
get: function() {
|
|
6294
|
+
get: /* @__PURE__ */ __name(function() {
|
|
6520
6295
|
if (isChainable) {
|
|
6521
6296
|
throw Error(
|
|
6522
6297
|
"Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.'
|
|
@@ -6525,7 +6300,7 @@ function addLengthGuard(fn, assertionName, isChainable) {
|
|
|
6525
6300
|
throw Error(
|
|
6526
6301
|
"Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".'
|
|
6527
6302
|
);
|
|
6528
|
-
}
|
|
6303
|
+
}, "get")
|
|
6529
6304
|
});
|
|
6530
6305
|
return fn;
|
|
6531
6306
|
}
|
|
@@ -6533,14 +6308,14 @@ __name(addLengthGuard, "addLengthGuard");
|
|
|
6533
6308
|
|
|
6534
6309
|
// lib/chai/utils/getProperties.js
|
|
6535
6310
|
function getProperties(object) {
|
|
6536
|
-
|
|
6311
|
+
let result = Object.getOwnPropertyNames(object);
|
|
6537
6312
|
function addProperty2(property) {
|
|
6538
6313
|
if (result.indexOf(property) === -1) {
|
|
6539
6314
|
result.push(property);
|
|
6540
6315
|
}
|
|
6541
6316
|
}
|
|
6542
6317
|
__name(addProperty2, "addProperty");
|
|
6543
|
-
|
|
6318
|
+
let proto = Object.getPrototypeOf(object);
|
|
6544
6319
|
while (proto !== null) {
|
|
6545
6320
|
Object.getOwnPropertyNames(proto).forEach(addProperty2);
|
|
6546
6321
|
proto = Object.getPrototypeOf(proto);
|
|
@@ -6552,8 +6327,7 @@ __name(getProperties, "getProperties");
|
|
|
6552
6327
|
// lib/chai/utils/proxify.js
|
|
6553
6328
|
var builtins = ["__flags", "__methods", "_obj", "assert"];
|
|
6554
6329
|
function proxify(obj, nonChainableMethodName) {
|
|
6555
|
-
if (!isProxyEnabled())
|
|
6556
|
-
return obj;
|
|
6330
|
+
if (!isProxyEnabled()) return obj;
|
|
6557
6331
|
return new Proxy(obj, {
|
|
6558
6332
|
get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
|
|
6559
6333
|
if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
|
|
@@ -6562,15 +6336,15 @@ function proxify(obj, nonChainableMethodName) {
|
|
|
6562
6336
|
"Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".'
|
|
6563
6337
|
);
|
|
6564
6338
|
}
|
|
6565
|
-
|
|
6566
|
-
|
|
6339
|
+
let suggestion = null;
|
|
6340
|
+
let suggestionDistance = 4;
|
|
6567
6341
|
getProperties(target).forEach(function(prop) {
|
|
6568
6342
|
if (
|
|
6569
6343
|
// we actually mean to check `Object.prototype` here
|
|
6570
6344
|
// eslint-disable-next-line no-prototype-builtins
|
|
6571
6345
|
!Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1
|
|
6572
6346
|
) {
|
|
6573
|
-
|
|
6347
|
+
let dist = stringDistanceCapped(property, prop, suggestionDistance);
|
|
6574
6348
|
if (dist < suggestionDistance) {
|
|
6575
6349
|
suggestion = prop;
|
|
6576
6350
|
suggestionDistance = dist;
|
|
@@ -6597,7 +6371,7 @@ function stringDistanceCapped(strA, strB, cap) {
|
|
|
6597
6371
|
if (Math.abs(strA.length - strB.length) >= cap) {
|
|
6598
6372
|
return cap;
|
|
6599
6373
|
}
|
|
6600
|
-
|
|
6374
|
+
let memo = [];
|
|
6601
6375
|
for (let i = 0; i <= strA.length; i++) {
|
|
6602
6376
|
memo[i] = Array(strB.length + 1).fill(0);
|
|
6603
6377
|
memo[i][0] = i;
|
|
@@ -6606,7 +6380,7 @@ function stringDistanceCapped(strA, strB, cap) {
|
|
|
6606
6380
|
memo[0][j] = j;
|
|
6607
6381
|
}
|
|
6608
6382
|
for (let i = 1; i <= strA.length; i++) {
|
|
6609
|
-
|
|
6383
|
+
let ch = strA.charCodeAt(i - 1);
|
|
6610
6384
|
for (let j = 1; j <= strB.length; j++) {
|
|
6611
6385
|
if (Math.abs(i - j) >= cap) {
|
|
6612
6386
|
memo[i][j] = cap;
|
|
@@ -6625,41 +6399,40 @@ __name(stringDistanceCapped, "stringDistanceCapped");
|
|
|
6625
6399
|
|
|
6626
6400
|
// lib/chai/utils/addMethod.js
|
|
6627
6401
|
function addMethod(ctx, name, method) {
|
|
6628
|
-
|
|
6402
|
+
let methodWrapper = /* @__PURE__ */ __name(function() {
|
|
6629
6403
|
if (!flag(this, "lockSsfi")) {
|
|
6630
6404
|
flag(this, "ssfi", methodWrapper);
|
|
6631
6405
|
}
|
|
6632
|
-
|
|
6633
|
-
if (result !== void 0)
|
|
6634
|
-
|
|
6635
|
-
var newAssertion = new Assertion();
|
|
6406
|
+
let result = method.apply(this, arguments);
|
|
6407
|
+
if (result !== void 0) return result;
|
|
6408
|
+
let newAssertion = new Assertion();
|
|
6636
6409
|
transferFlags(this, newAssertion);
|
|
6637
6410
|
return newAssertion;
|
|
6638
6411
|
}, "methodWrapper");
|
|
6639
6412
|
addLengthGuard(methodWrapper, name, false);
|
|
6640
6413
|
ctx[name] = proxify(methodWrapper, name);
|
|
6414
|
+
events.dispatchEvent(new PluginEvent("addMethod", name, method));
|
|
6641
6415
|
}
|
|
6642
6416
|
__name(addMethod, "addMethod");
|
|
6643
6417
|
|
|
6644
6418
|
// lib/chai/utils/overwriteProperty.js
|
|
6645
6419
|
function overwriteProperty(ctx, name, getter) {
|
|
6646
|
-
|
|
6420
|
+
let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
|
|
6647
6421
|
}, "_super");
|
|
6648
|
-
if (_get && "function" === typeof _get.get)
|
|
6649
|
-
_super = _get.get;
|
|
6422
|
+
if (_get && "function" === typeof _get.get) _super = _get.get;
|
|
6650
6423
|
Object.defineProperty(ctx, name, {
|
|
6651
6424
|
get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
|
|
6652
6425
|
if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
|
|
6653
6426
|
flag(this, "ssfi", overwritingPropertyGetter);
|
|
6654
6427
|
}
|
|
6655
|
-
|
|
6428
|
+
let origLockSsfi = flag(this, "lockSsfi");
|
|
6656
6429
|
flag(this, "lockSsfi", true);
|
|
6657
|
-
|
|
6430
|
+
let result = getter(_super).call(this);
|
|
6658
6431
|
flag(this, "lockSsfi", origLockSsfi);
|
|
6659
6432
|
if (result !== void 0) {
|
|
6660
6433
|
return result;
|
|
6661
6434
|
}
|
|
6662
|
-
|
|
6435
|
+
let newAssertion = new Assertion();
|
|
6663
6436
|
transferFlags(this, newAssertion);
|
|
6664
6437
|
return newAssertion;
|
|
6665
6438
|
}, "overwritingPropertyGetter"),
|
|
@@ -6670,23 +6443,22 @@ __name(overwriteProperty, "overwriteProperty");
|
|
|
6670
6443
|
|
|
6671
6444
|
// lib/chai/utils/overwriteMethod.js
|
|
6672
6445
|
function overwriteMethod(ctx, name, method) {
|
|
6673
|
-
|
|
6446
|
+
let _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
|
|
6674
6447
|
throw new Error(name + " is not a function");
|
|
6675
6448
|
}, "_super");
|
|
6676
|
-
if (_method && "function" === typeof _method)
|
|
6677
|
-
|
|
6678
|
-
var overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
6449
|
+
if (_method && "function" === typeof _method) _super = _method;
|
|
6450
|
+
let overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
6679
6451
|
if (!flag(this, "lockSsfi")) {
|
|
6680
6452
|
flag(this, "ssfi", overwritingMethodWrapper);
|
|
6681
6453
|
}
|
|
6682
|
-
|
|
6454
|
+
let origLockSsfi = flag(this, "lockSsfi");
|
|
6683
6455
|
flag(this, "lockSsfi", true);
|
|
6684
|
-
|
|
6456
|
+
let result = method(_super).apply(this, arguments);
|
|
6685
6457
|
flag(this, "lockSsfi", origLockSsfi);
|
|
6686
6458
|
if (result !== void 0) {
|
|
6687
6459
|
return result;
|
|
6688
6460
|
}
|
|
6689
|
-
|
|
6461
|
+
let newAssertion = new Assertion();
|
|
6690
6462
|
transferFlags(this, newAssertion);
|
|
6691
6463
|
return newAssertion;
|
|
6692
6464
|
}, "overwritingMethodWrapper");
|
|
@@ -6700,19 +6472,26 @@ var canSetPrototype = typeof Object.setPrototypeOf === "function";
|
|
|
6700
6472
|
var testFn = /* @__PURE__ */ __name(function() {
|
|
6701
6473
|
}, "testFn");
|
|
6702
6474
|
var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
|
|
6703
|
-
|
|
6704
|
-
if (typeof propDesc !== "object")
|
|
6705
|
-
return true;
|
|
6475
|
+
let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
|
|
6476
|
+
if (typeof propDesc !== "object") return true;
|
|
6706
6477
|
return !propDesc.configurable;
|
|
6707
6478
|
});
|
|
6708
6479
|
var call = Function.prototype.call;
|
|
6709
6480
|
var apply = Function.prototype.apply;
|
|
6481
|
+
var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent extends PluginEvent {
|
|
6482
|
+
constructor(type3, name, fn, chainingBehavior) {
|
|
6483
|
+
super(type3, name, fn);
|
|
6484
|
+
this.chainingBehavior = chainingBehavior;
|
|
6485
|
+
}
|
|
6486
|
+
};
|
|
6487
|
+
__name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
|
|
6488
|
+
var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
|
|
6710
6489
|
function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
6711
6490
|
if (typeof chainingBehavior !== "function") {
|
|
6712
6491
|
chainingBehavior = /* @__PURE__ */ __name(function() {
|
|
6713
6492
|
}, "chainingBehavior");
|
|
6714
6493
|
}
|
|
6715
|
-
|
|
6494
|
+
let chainableBehavior = {
|
|
6716
6495
|
method,
|
|
6717
6496
|
chainingBehavior
|
|
6718
6497
|
};
|
|
@@ -6723,31 +6502,31 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6723
6502
|
Object.defineProperty(ctx, name, {
|
|
6724
6503
|
get: /* @__PURE__ */ __name(function chainableMethodGetter() {
|
|
6725
6504
|
chainableBehavior.chainingBehavior.call(this);
|
|
6726
|
-
|
|
6505
|
+
let chainableMethodWrapper = /* @__PURE__ */ __name(function() {
|
|
6727
6506
|
if (!flag(this, "lockSsfi")) {
|
|
6728
6507
|
flag(this, "ssfi", chainableMethodWrapper);
|
|
6729
6508
|
}
|
|
6730
|
-
|
|
6509
|
+
let result = chainableBehavior.method.apply(this, arguments);
|
|
6731
6510
|
if (result !== void 0) {
|
|
6732
6511
|
return result;
|
|
6733
6512
|
}
|
|
6734
|
-
|
|
6513
|
+
let newAssertion = new Assertion();
|
|
6735
6514
|
transferFlags(this, newAssertion);
|
|
6736
6515
|
return newAssertion;
|
|
6737
6516
|
}, "chainableMethodWrapper");
|
|
6738
6517
|
addLengthGuard(chainableMethodWrapper, name, true);
|
|
6739
6518
|
if (canSetPrototype) {
|
|
6740
|
-
|
|
6519
|
+
let prototype = Object.create(this);
|
|
6741
6520
|
prototype.call = call;
|
|
6742
6521
|
prototype.apply = apply;
|
|
6743
6522
|
Object.setPrototypeOf(chainableMethodWrapper, prototype);
|
|
6744
6523
|
} else {
|
|
6745
|
-
|
|
6524
|
+
let asserterNames = Object.getOwnPropertyNames(ctx);
|
|
6746
6525
|
asserterNames.forEach(function(asserterName) {
|
|
6747
6526
|
if (excludeNames.indexOf(asserterName) !== -1) {
|
|
6748
6527
|
return;
|
|
6749
6528
|
}
|
|
6750
|
-
|
|
6529
|
+
let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
|
|
6751
6530
|
Object.defineProperty(chainableMethodWrapper, asserterName, pd);
|
|
6752
6531
|
});
|
|
6753
6532
|
}
|
|
@@ -6756,29 +6535,37 @@ function addChainableMethod(ctx, name, method, chainingBehavior) {
|
|
|
6756
6535
|
}, "chainableMethodGetter"),
|
|
6757
6536
|
configurable: true
|
|
6758
6537
|
});
|
|
6538
|
+
events.dispatchEvent(
|
|
6539
|
+
new PluginAddChainableMethodEvent(
|
|
6540
|
+
"addChainableMethod",
|
|
6541
|
+
name,
|
|
6542
|
+
method,
|
|
6543
|
+
chainingBehavior
|
|
6544
|
+
)
|
|
6545
|
+
);
|
|
6759
6546
|
}
|
|
6760
6547
|
__name(addChainableMethod, "addChainableMethod");
|
|
6761
6548
|
|
|
6762
6549
|
// lib/chai/utils/overwriteChainableMethod.js
|
|
6763
6550
|
function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
|
|
6764
|
-
|
|
6765
|
-
|
|
6551
|
+
let chainableBehavior = ctx.__methods[name];
|
|
6552
|
+
let _chainingBehavior = chainableBehavior.chainingBehavior;
|
|
6766
6553
|
chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
|
|
6767
|
-
|
|
6554
|
+
let result = chainingBehavior(_chainingBehavior).call(this);
|
|
6768
6555
|
if (result !== void 0) {
|
|
6769
6556
|
return result;
|
|
6770
6557
|
}
|
|
6771
|
-
|
|
6558
|
+
let newAssertion = new Assertion();
|
|
6772
6559
|
transferFlags(this, newAssertion);
|
|
6773
6560
|
return newAssertion;
|
|
6774
6561
|
}, "overwritingChainableMethodGetter");
|
|
6775
|
-
|
|
6562
|
+
let _method = chainableBehavior.method;
|
|
6776
6563
|
chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
|
|
6777
|
-
|
|
6564
|
+
let result = method(_method).apply(this, arguments);
|
|
6778
6565
|
if (result !== void 0) {
|
|
6779
6566
|
return result;
|
|
6780
6567
|
}
|
|
6781
|
-
|
|
6568
|
+
let newAssertion = new Assertion();
|
|
6782
6569
|
transferFlags(this, newAssertion);
|
|
6783
6570
|
return newAssertion;
|
|
6784
6571
|
}, "overwritingChainableMethodWrapper");
|
|
@@ -6793,8 +6580,7 @@ __name(compareByInspect, "compareByInspect");
|
|
|
6793
6580
|
|
|
6794
6581
|
// lib/chai/utils/getOwnEnumerablePropertySymbols.js
|
|
6795
6582
|
function getOwnEnumerablePropertySymbols(obj) {
|
|
6796
|
-
if (typeof Object.getOwnPropertySymbols !== "function")
|
|
6797
|
-
return [];
|
|
6583
|
+
if (typeof Object.getOwnPropertySymbols !== "function") return [];
|
|
6798
6584
|
return Object.getOwnPropertySymbols(obj).filter(function(sym) {
|
|
6799
6585
|
return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
|
|
6800
6586
|
});
|
|
@@ -6812,21 +6598,20 @@ var isNaN2 = Number.isNaN;
|
|
|
6812
6598
|
|
|
6813
6599
|
// lib/chai/utils/getOperator.js
|
|
6814
6600
|
function isObjectType(obj) {
|
|
6815
|
-
|
|
6816
|
-
|
|
6601
|
+
let objectType = type(obj);
|
|
6602
|
+
let objectTypes = ["Array", "Object", "Function"];
|
|
6817
6603
|
return objectTypes.indexOf(objectType) !== -1;
|
|
6818
6604
|
}
|
|
6819
6605
|
__name(isObjectType, "isObjectType");
|
|
6820
6606
|
function getOperator(obj, args) {
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6607
|
+
let operator = flag(obj, "operator");
|
|
6608
|
+
let negate = flag(obj, "negate");
|
|
6609
|
+
let expected = args[3];
|
|
6610
|
+
let msg = negate ? args[2] : args[1];
|
|
6825
6611
|
if (operator) {
|
|
6826
6612
|
return operator;
|
|
6827
6613
|
}
|
|
6828
|
-
if (typeof msg === "function")
|
|
6829
|
-
msg = msg();
|
|
6614
|
+
if (typeof msg === "function") msg = msg();
|
|
6830
6615
|
msg = msg || "";
|
|
6831
6616
|
if (!msg) {
|
|
6832
6617
|
return void 0;
|
|
@@ -6834,7 +6619,7 @@ function getOperator(obj, args) {
|
|
|
6834
6619
|
if (/\shave\s/.test(msg)) {
|
|
6835
6620
|
return void 0;
|
|
6836
6621
|
}
|
|
6837
|
-
|
|
6622
|
+
let isObject = isObjectType(expected);
|
|
6838
6623
|
if (/\snot\s/.test(msg)) {
|
|
6839
6624
|
return isObject ? "notDeepStrictEqual" : "notStrictEqual";
|
|
6840
6625
|
}
|
|
@@ -6914,10 +6699,9 @@ var functionTypes = {
|
|
|
6914
6699
|
asyncgeneratorfunction: ["asyncgeneratorfunction"]
|
|
6915
6700
|
};
|
|
6916
6701
|
function an(type3, msg) {
|
|
6917
|
-
if (msg)
|
|
6918
|
-
flag2(this, "message", msg);
|
|
6702
|
+
if (msg) flag2(this, "message", msg);
|
|
6919
6703
|
type3 = type3.toLowerCase();
|
|
6920
|
-
|
|
6704
|
+
let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
|
|
6921
6705
|
const detectedType = type(obj).toLowerCase();
|
|
6922
6706
|
if (functionTypes["function"].includes(type3)) {
|
|
6923
6707
|
this.assert(
|
|
@@ -6945,11 +6729,10 @@ function includeChainingBehavior() {
|
|
|
6945
6729
|
}
|
|
6946
6730
|
__name(includeChainingBehavior, "includeChainingBehavior");
|
|
6947
6731
|
function include(val, msg) {
|
|
6948
|
-
if (msg)
|
|
6949
|
-
|
|
6950
|
-
var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
|
|
6732
|
+
if (msg) flag2(this, "message", msg);
|
|
6733
|
+
let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
|
|
6951
6734
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
6952
|
-
|
|
6735
|
+
let included = false;
|
|
6953
6736
|
switch (objType) {
|
|
6954
6737
|
case "string":
|
|
6955
6738
|
included = obj.indexOf(val) !== -1;
|
|
@@ -6987,7 +6770,7 @@ function include(val, msg) {
|
|
|
6987
6770
|
included = obj.indexOf(val) !== -1;
|
|
6988
6771
|
}
|
|
6989
6772
|
break;
|
|
6990
|
-
default:
|
|
6773
|
+
default: {
|
|
6991
6774
|
if (val !== Object(val)) {
|
|
6992
6775
|
throw new AssertionError(
|
|
6993
6776
|
flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(),
|
|
@@ -6995,9 +6778,11 @@ function include(val, msg) {
|
|
|
6995
6778
|
ssfi
|
|
6996
6779
|
);
|
|
6997
6780
|
}
|
|
6998
|
-
|
|
6781
|
+
let props = Object.keys(val);
|
|
6782
|
+
let firstErr = null;
|
|
6783
|
+
let numErrs = 0;
|
|
6999
6784
|
props.forEach(function(prop) {
|
|
7000
|
-
|
|
6785
|
+
let propAssertion = new Assertion(obj);
|
|
7001
6786
|
transferFlags(this, propAssertion, true);
|
|
7002
6787
|
flag2(propAssertion, "lockSsfi", true);
|
|
7003
6788
|
if (!negate || props.length === 1) {
|
|
@@ -7010,8 +6795,7 @@ function include(val, msg) {
|
|
|
7010
6795
|
if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
|
|
7011
6796
|
throw err;
|
|
7012
6797
|
}
|
|
7013
|
-
if (firstErr === null)
|
|
7014
|
-
firstErr = err;
|
|
6798
|
+
if (firstErr === null) firstErr = err;
|
|
7015
6799
|
numErrs++;
|
|
7016
6800
|
}
|
|
7017
6801
|
}, this);
|
|
@@ -7019,6 +6803,7 @@ function include(val, msg) {
|
|
|
7019
6803
|
throw firstErr;
|
|
7020
6804
|
}
|
|
7021
6805
|
return;
|
|
6806
|
+
}
|
|
7022
6807
|
}
|
|
7023
6808
|
this.assert(
|
|
7024
6809
|
included,
|
|
@@ -7102,7 +6887,7 @@ Assertion.addProperty("NaN", function() {
|
|
|
7102
6887
|
);
|
|
7103
6888
|
});
|
|
7104
6889
|
function assertExist() {
|
|
7105
|
-
|
|
6890
|
+
let val = flag2(this, "object");
|
|
7106
6891
|
this.assert(
|
|
7107
6892
|
val !== null && val !== void 0,
|
|
7108
6893
|
"expected #{this} to exist",
|
|
@@ -7113,7 +6898,7 @@ __name(assertExist, "assertExist");
|
|
|
7113
6898
|
Assertion.addProperty("exist", assertExist);
|
|
7114
6899
|
Assertion.addProperty("exists", assertExist);
|
|
7115
6900
|
Assertion.addProperty("empty", function() {
|
|
7116
|
-
|
|
6901
|
+
let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
|
|
7117
6902
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7118
6903
|
switch (type(val).toLowerCase()) {
|
|
7119
6904
|
case "array":
|
|
@@ -7131,9 +6916,10 @@ Assertion.addProperty("empty", function() {
|
|
|
7131
6916
|
void 0,
|
|
7132
6917
|
ssfi
|
|
7133
6918
|
);
|
|
7134
|
-
case "function":
|
|
7135
|
-
|
|
6919
|
+
case "function": {
|
|
6920
|
+
const msg = flagMsg + ".empty was passed a function " + getName(val);
|
|
7136
6921
|
throw new AssertionError(msg.trim(), void 0, ssfi);
|
|
6922
|
+
}
|
|
7137
6923
|
default:
|
|
7138
6924
|
if (val !== Object(val)) {
|
|
7139
6925
|
throw new AssertionError(
|
|
@@ -7151,7 +6937,7 @@ Assertion.addProperty("empty", function() {
|
|
|
7151
6937
|
);
|
|
7152
6938
|
});
|
|
7153
6939
|
function checkArguments() {
|
|
7154
|
-
|
|
6940
|
+
let obj = flag2(this, "object"), type3 = type(obj);
|
|
7155
6941
|
this.assert(
|
|
7156
6942
|
"Arguments" === type3,
|
|
7157
6943
|
"expected #{this} to be arguments but got " + type3,
|
|
@@ -7162,11 +6948,10 @@ __name(checkArguments, "checkArguments");
|
|
|
7162
6948
|
Assertion.addProperty("arguments", checkArguments);
|
|
7163
6949
|
Assertion.addProperty("Arguments", checkArguments);
|
|
7164
6950
|
function assertEqual(val, msg) {
|
|
7165
|
-
if (msg)
|
|
7166
|
-
|
|
7167
|
-
var obj = flag2(this, "object");
|
|
6951
|
+
if (msg) flag2(this, "message", msg);
|
|
6952
|
+
let obj = flag2(this, "object");
|
|
7168
6953
|
if (flag2(this, "deep")) {
|
|
7169
|
-
|
|
6954
|
+
let prevLockSsfi = flag2(this, "lockSsfi");
|
|
7170
6955
|
flag2(this, "lockSsfi", true);
|
|
7171
6956
|
this.eql(val);
|
|
7172
6957
|
flag2(this, "lockSsfi", prevLockSsfi);
|
|
@@ -7186,9 +6971,8 @@ Assertion.addMethod("equal", assertEqual);
|
|
|
7186
6971
|
Assertion.addMethod("equals", assertEqual);
|
|
7187
6972
|
Assertion.addMethod("eq", assertEqual);
|
|
7188
6973
|
function assertEql(obj, msg) {
|
|
7189
|
-
if (msg)
|
|
7190
|
-
|
|
7191
|
-
var eql = flag2(this, "eql");
|
|
6974
|
+
if (msg) flag2(this, "message", msg);
|
|
6975
|
+
let eql = flag2(this, "eql");
|
|
7192
6976
|
this.assert(
|
|
7193
6977
|
eql(obj, flag2(this, "object")),
|
|
7194
6978
|
"expected #{this} to deeply equal #{exp}",
|
|
@@ -7202,9 +6986,8 @@ __name(assertEql, "assertEql");
|
|
|
7202
6986
|
Assertion.addMethod("eql", assertEql);
|
|
7203
6987
|
Assertion.addMethod("eqls", assertEql);
|
|
7204
6988
|
function assertAbove(n, msg) {
|
|
7205
|
-
if (msg)
|
|
7206
|
-
|
|
7207
|
-
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
|
|
6989
|
+
if (msg) flag2(this, "message", msg);
|
|
6990
|
+
let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
|
|
7208
6991
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7209
6992
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7210
6993
|
}
|
|
@@ -7221,7 +7004,7 @@ function assertAbove(n, msg) {
|
|
|
7221
7004
|
ssfi
|
|
7222
7005
|
);
|
|
7223
7006
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7224
|
-
|
|
7007
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7225
7008
|
throw new AssertionError(
|
|
7226
7009
|
msgPrefix + "expected " + printObj + " to be a number or a date",
|
|
7227
7010
|
void 0,
|
|
@@ -7229,7 +7012,7 @@ function assertAbove(n, msg) {
|
|
|
7229
7012
|
);
|
|
7230
7013
|
}
|
|
7231
7014
|
if (doLength) {
|
|
7232
|
-
|
|
7015
|
+
let descriptor = "length", itemsCount;
|
|
7233
7016
|
if (objType === "map" || objType === "set") {
|
|
7234
7017
|
descriptor = "size";
|
|
7235
7018
|
itemsCount = obj.size;
|
|
@@ -7257,9 +7040,8 @@ Assertion.addMethod("above", assertAbove);
|
|
|
7257
7040
|
Assertion.addMethod("gt", assertAbove);
|
|
7258
7041
|
Assertion.addMethod("greaterThan", assertAbove);
|
|
7259
7042
|
function assertLeast(n, msg) {
|
|
7260
|
-
if (msg)
|
|
7261
|
-
|
|
7262
|
-
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7043
|
+
if (msg) flag2(this, "message", msg);
|
|
7044
|
+
let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7263
7045
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7264
7046
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7265
7047
|
}
|
|
@@ -7268,7 +7050,7 @@ function assertLeast(n, msg) {
|
|
|
7268
7050
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7269
7051
|
errorMessage = msgPrefix + "the argument to least must be a number";
|
|
7270
7052
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7271
|
-
|
|
7053
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7272
7054
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7273
7055
|
} else {
|
|
7274
7056
|
shouldThrow = false;
|
|
@@ -7277,7 +7059,7 @@ function assertLeast(n, msg) {
|
|
|
7277
7059
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7278
7060
|
}
|
|
7279
7061
|
if (doLength) {
|
|
7280
|
-
|
|
7062
|
+
let descriptor = "length", itemsCount;
|
|
7281
7063
|
if (objType === "map" || objType === "set") {
|
|
7282
7064
|
descriptor = "size";
|
|
7283
7065
|
itemsCount = obj.size;
|
|
@@ -7305,9 +7087,8 @@ Assertion.addMethod("least", assertLeast);
|
|
|
7305
7087
|
Assertion.addMethod("gte", assertLeast);
|
|
7306
7088
|
Assertion.addMethod("greaterThanOrEqual", assertLeast);
|
|
7307
7089
|
function assertBelow(n, msg) {
|
|
7308
|
-
if (msg)
|
|
7309
|
-
|
|
7310
|
-
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7090
|
+
if (msg) flag2(this, "message", msg);
|
|
7091
|
+
let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7311
7092
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7312
7093
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7313
7094
|
}
|
|
@@ -7316,7 +7097,7 @@ function assertBelow(n, msg) {
|
|
|
7316
7097
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7317
7098
|
errorMessage = msgPrefix + "the argument to below must be a number";
|
|
7318
7099
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7319
|
-
|
|
7100
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7320
7101
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7321
7102
|
} else {
|
|
7322
7103
|
shouldThrow = false;
|
|
@@ -7325,7 +7106,7 @@ function assertBelow(n, msg) {
|
|
|
7325
7106
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7326
7107
|
}
|
|
7327
7108
|
if (doLength) {
|
|
7328
|
-
|
|
7109
|
+
let descriptor = "length", itemsCount;
|
|
7329
7110
|
if (objType === "map" || objType === "set") {
|
|
7330
7111
|
descriptor = "size";
|
|
7331
7112
|
itemsCount = obj.size;
|
|
@@ -7353,9 +7134,8 @@ Assertion.addMethod("below", assertBelow);
|
|
|
7353
7134
|
Assertion.addMethod("lt", assertBelow);
|
|
7354
7135
|
Assertion.addMethod("lessThan", assertBelow);
|
|
7355
7136
|
function assertMost(n, msg) {
|
|
7356
|
-
if (msg)
|
|
7357
|
-
|
|
7358
|
-
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7137
|
+
if (msg) flag2(this, "message", msg);
|
|
7138
|
+
let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
|
|
7359
7139
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7360
7140
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7361
7141
|
}
|
|
@@ -7364,7 +7144,7 @@ function assertMost(n, msg) {
|
|
|
7364
7144
|
} else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
|
|
7365
7145
|
errorMessage = msgPrefix + "the argument to most must be a number";
|
|
7366
7146
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7367
|
-
|
|
7147
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7368
7148
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7369
7149
|
} else {
|
|
7370
7150
|
shouldThrow = false;
|
|
@@ -7373,7 +7153,7 @@ function assertMost(n, msg) {
|
|
|
7373
7153
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7374
7154
|
}
|
|
7375
7155
|
if (doLength) {
|
|
7376
|
-
|
|
7156
|
+
let descriptor = "length", itemsCount;
|
|
7377
7157
|
if (objType === "map" || objType === "set") {
|
|
7378
7158
|
descriptor = "size";
|
|
7379
7159
|
itemsCount = obj.size;
|
|
@@ -7401,9 +7181,8 @@ Assertion.addMethod("most", assertMost);
|
|
|
7401
7181
|
Assertion.addMethod("lte", assertMost);
|
|
7402
7182
|
Assertion.addMethod("lessThanOrEqual", assertMost);
|
|
7403
7183
|
Assertion.addMethod("within", function(start, finish, msg) {
|
|
7404
|
-
if (msg)
|
|
7405
|
-
|
|
7406
|
-
var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
|
|
7184
|
+
if (msg) flag2(this, "message", msg);
|
|
7185
|
+
let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
|
|
7407
7186
|
if (doLength && objType !== "map" && objType !== "set") {
|
|
7408
7187
|
new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
|
|
7409
7188
|
}
|
|
@@ -7412,7 +7191,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7412
7191
|
} else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
|
|
7413
7192
|
errorMessage = msgPrefix + "the arguments to within must be numbers";
|
|
7414
7193
|
} else if (!doLength && objType !== "date" && !isNumeric(obj)) {
|
|
7415
|
-
|
|
7194
|
+
let printObj = objType === "string" ? "'" + obj + "'" : obj;
|
|
7416
7195
|
errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
|
|
7417
7196
|
} else {
|
|
7418
7197
|
shouldThrow = false;
|
|
@@ -7421,7 +7200,7 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7421
7200
|
throw new AssertionError(errorMessage, void 0, ssfi);
|
|
7422
7201
|
}
|
|
7423
7202
|
if (doLength) {
|
|
7424
|
-
|
|
7203
|
+
let descriptor = "length", itemsCount;
|
|
7425
7204
|
if (objType === "map" || objType === "set") {
|
|
7426
7205
|
descriptor = "size";
|
|
7427
7206
|
itemsCount = obj.size;
|
|
@@ -7442,13 +7221,13 @@ Assertion.addMethod("within", function(start, finish, msg) {
|
|
|
7442
7221
|
}
|
|
7443
7222
|
});
|
|
7444
7223
|
function assertInstanceOf(constructor, msg) {
|
|
7445
|
-
if (msg)
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7224
|
+
if (msg) flag2(this, "message", msg);
|
|
7225
|
+
let target = flag2(this, "object");
|
|
7226
|
+
let ssfi = flag2(this, "ssfi");
|
|
7227
|
+
let flagMsg = flag2(this, "message");
|
|
7228
|
+
let isInstanceOf;
|
|
7450
7229
|
try {
|
|
7451
|
-
|
|
7230
|
+
isInstanceOf = target instanceof constructor;
|
|
7452
7231
|
} catch (err) {
|
|
7453
7232
|
if (err instanceof TypeError) {
|
|
7454
7233
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
@@ -7460,7 +7239,7 @@ function assertInstanceOf(constructor, msg) {
|
|
|
7460
7239
|
}
|
|
7461
7240
|
throw err;
|
|
7462
7241
|
}
|
|
7463
|
-
|
|
7242
|
+
let name = getName(constructor);
|
|
7464
7243
|
if (name == null) {
|
|
7465
7244
|
name = "an unnamed constructor";
|
|
7466
7245
|
}
|
|
@@ -7474,9 +7253,8 @@ __name(assertInstanceOf, "assertInstanceOf");
|
|
|
7474
7253
|
Assertion.addMethod("instanceof", assertInstanceOf);
|
|
7475
7254
|
Assertion.addMethod("instanceOf", assertInstanceOf);
|
|
7476
7255
|
function assertProperty(name, val, msg) {
|
|
7477
|
-
if (msg)
|
|
7478
|
-
|
|
7479
|
-
var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
|
|
7256
|
+
if (msg) flag2(this, "message", msg);
|
|
7257
|
+
let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
|
|
7480
7258
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7481
7259
|
if (isNested) {
|
|
7482
7260
|
if (nameType !== "string") {
|
|
@@ -7509,22 +7287,16 @@ function assertProperty(name, val, msg) {
|
|
|
7509
7287
|
ssfi
|
|
7510
7288
|
);
|
|
7511
7289
|
}
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
if (isDeep)
|
|
7515
|
-
|
|
7516
|
-
if (
|
|
7517
|
-
descriptor += "own ";
|
|
7518
|
-
if (isNested)
|
|
7519
|
-
descriptor += "nested ";
|
|
7290
|
+
let isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
7291
|
+
let descriptor = "";
|
|
7292
|
+
if (isDeep) descriptor += "deep ";
|
|
7293
|
+
if (isOwn) descriptor += "own ";
|
|
7294
|
+
if (isNested) descriptor += "nested ";
|
|
7520
7295
|
descriptor += "property ";
|
|
7521
|
-
|
|
7522
|
-
if (isOwn)
|
|
7523
|
-
|
|
7524
|
-
else
|
|
7525
|
-
hasProperty2 = pathInfo.exists;
|
|
7526
|
-
else
|
|
7527
|
-
hasProperty2 = hasProperty(obj, name);
|
|
7296
|
+
let hasProperty2;
|
|
7297
|
+
if (isOwn) hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
|
|
7298
|
+
else if (isNested) hasProperty2 = pathInfo.exists;
|
|
7299
|
+
else hasProperty2 = hasProperty(obj, name);
|
|
7528
7300
|
if (!negate || arguments.length === 1) {
|
|
7529
7301
|
this.assert(
|
|
7530
7302
|
hasProperty2,
|
|
@@ -7557,11 +7329,10 @@ function assertOwnPropertyDescriptor(name, descriptor, msg) {
|
|
|
7557
7329
|
msg = descriptor;
|
|
7558
7330
|
descriptor = null;
|
|
7559
7331
|
}
|
|
7560
|
-
if (msg)
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
var eql = flag2(this, "eql");
|
|
7332
|
+
if (msg) flag2(this, "message", msg);
|
|
7333
|
+
let obj = flag2(this, "object");
|
|
7334
|
+
let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
|
|
7335
|
+
let eql = flag2(this, "eql");
|
|
7565
7336
|
if (actualDescriptor && descriptor) {
|
|
7566
7337
|
this.assert(
|
|
7567
7338
|
eql(descriptor, actualDescriptor),
|
|
@@ -7588,9 +7359,8 @@ function assertLengthChain() {
|
|
|
7588
7359
|
}
|
|
7589
7360
|
__name(assertLengthChain, "assertLengthChain");
|
|
7590
7361
|
function assertLength(n, msg) {
|
|
7591
|
-
if (msg)
|
|
7592
|
-
|
|
7593
|
-
var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
|
|
7362
|
+
if (msg) flag2(this, "message", msg);
|
|
7363
|
+
let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
|
|
7594
7364
|
switch (objType) {
|
|
7595
7365
|
case "map":
|
|
7596
7366
|
case "set":
|
|
@@ -7613,9 +7383,8 @@ __name(assertLength, "assertLength");
|
|
|
7613
7383
|
Assertion.addChainableMethod("length", assertLength, assertLengthChain);
|
|
7614
7384
|
Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
|
|
7615
7385
|
function assertMatch(re, msg) {
|
|
7616
|
-
if (msg)
|
|
7617
|
-
|
|
7618
|
-
var obj = flag2(this, "object");
|
|
7386
|
+
if (msg) flag2(this, "message", msg);
|
|
7387
|
+
let obj = flag2(this, "object");
|
|
7619
7388
|
this.assert(
|
|
7620
7389
|
re.exec(obj),
|
|
7621
7390
|
"expected #{this} to match " + re,
|
|
@@ -7626,9 +7395,8 @@ __name(assertMatch, "assertMatch");
|
|
|
7626
7395
|
Assertion.addMethod("match", assertMatch);
|
|
7627
7396
|
Assertion.addMethod("matches", assertMatch);
|
|
7628
7397
|
Assertion.addMethod("string", function(str, msg) {
|
|
7629
|
-
if (msg)
|
|
7630
|
-
|
|
7631
|
-
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7398
|
+
if (msg) flag2(this, "message", msg);
|
|
7399
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7632
7400
|
new Assertion(obj, flagMsg, ssfi, true).is.a("string");
|
|
7633
7401
|
this.assert(
|
|
7634
7402
|
~obj.indexOf(str),
|
|
@@ -7637,9 +7405,9 @@ Assertion.addMethod("string", function(str, msg) {
|
|
|
7637
7405
|
);
|
|
7638
7406
|
});
|
|
7639
7407
|
function assertKeys(keys) {
|
|
7640
|
-
|
|
7408
|
+
let obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
|
|
7641
7409
|
flagMsg = flagMsg ? flagMsg + ": " : "";
|
|
7642
|
-
|
|
7410
|
+
let mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
|
|
7643
7411
|
if (objType === "Map" || objType === "Set") {
|
|
7644
7412
|
deepStr = isDeep ? "deeply " : "";
|
|
7645
7413
|
actual = [];
|
|
@@ -7673,7 +7441,7 @@ function assertKeys(keys) {
|
|
|
7673
7441
|
if (!keys.length) {
|
|
7674
7442
|
throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
|
|
7675
7443
|
}
|
|
7676
|
-
|
|
7444
|
+
let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
|
|
7677
7445
|
if (!any && !all) {
|
|
7678
7446
|
all = true;
|
|
7679
7447
|
}
|
|
@@ -7698,7 +7466,7 @@ function assertKeys(keys) {
|
|
|
7698
7466
|
keys = keys.map(function(key) {
|
|
7699
7467
|
return inspect2(key);
|
|
7700
7468
|
});
|
|
7701
|
-
|
|
7469
|
+
let last = keys.pop();
|
|
7702
7470
|
if (all) {
|
|
7703
7471
|
str = keys.join(", ") + ", and " + last;
|
|
7704
7472
|
}
|
|
@@ -7723,9 +7491,8 @@ __name(assertKeys, "assertKeys");
|
|
|
7723
7491
|
Assertion.addMethod("keys", assertKeys);
|
|
7724
7492
|
Assertion.addMethod("key", assertKeys);
|
|
7725
7493
|
function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
7726
|
-
if (msg)
|
|
7727
|
-
|
|
7728
|
-
var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
|
|
7494
|
+
if (msg) flag2(this, "message", msg);
|
|
7495
|
+
let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
|
|
7729
7496
|
new Assertion(obj, flagMsg, ssfi, true).is.a("function");
|
|
7730
7497
|
if (isRegExp2(errorLike) || typeof errorLike === "string") {
|
|
7731
7498
|
errMsgMatcher = errorLike;
|
|
@@ -7739,12 +7506,12 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7739
7506
|
errorWasThrown = true;
|
|
7740
7507
|
caughtErr = err;
|
|
7741
7508
|
}
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7509
|
+
let everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
|
|
7510
|
+
let everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
|
|
7511
|
+
let errorLikeFail = false;
|
|
7512
|
+
let errMsgMatcherFail = false;
|
|
7746
7513
|
if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
|
|
7747
|
-
|
|
7514
|
+
let errorLikeString = "an error";
|
|
7748
7515
|
if (errorLike instanceof Error) {
|
|
7749
7516
|
errorLikeString = "#{exp}";
|
|
7750
7517
|
} else if (errorLike) {
|
|
@@ -7771,7 +7538,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7771
7538
|
}
|
|
7772
7539
|
if (errorLike && caughtErr) {
|
|
7773
7540
|
if (errorLike instanceof Error) {
|
|
7774
|
-
|
|
7541
|
+
let isCompatibleInstance = check_error_exports.compatibleInstance(
|
|
7775
7542
|
caughtErr,
|
|
7776
7543
|
errorLike
|
|
7777
7544
|
);
|
|
@@ -7789,7 +7556,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7789
7556
|
}
|
|
7790
7557
|
}
|
|
7791
7558
|
}
|
|
7792
|
-
|
|
7559
|
+
let isCompatibleConstructor = check_error_exports.compatibleConstructor(
|
|
7793
7560
|
caughtErr,
|
|
7794
7561
|
errorLike
|
|
7795
7562
|
);
|
|
@@ -7808,11 +7575,11 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
|
|
|
7808
7575
|
}
|
|
7809
7576
|
}
|
|
7810
7577
|
if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
|
|
7811
|
-
|
|
7578
|
+
let placeholder = "including";
|
|
7812
7579
|
if (isRegExp2(errMsgMatcher)) {
|
|
7813
7580
|
placeholder = "matching";
|
|
7814
7581
|
}
|
|
7815
|
-
|
|
7582
|
+
let isCompatibleMessage = check_error_exports.compatibleMessage(
|
|
7816
7583
|
caughtErr,
|
|
7817
7584
|
errMsgMatcher
|
|
7818
7585
|
);
|
|
@@ -7846,9 +7613,8 @@ Assertion.addMethod("throw", assertThrows);
|
|
|
7846
7613
|
Assertion.addMethod("throws", assertThrows);
|
|
7847
7614
|
Assertion.addMethod("Throw", assertThrows);
|
|
7848
7615
|
function respondTo(method, msg) {
|
|
7849
|
-
if (msg)
|
|
7850
|
-
|
|
7851
|
-
var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
|
|
7616
|
+
if (msg) flag2(this, "message", msg);
|
|
7617
|
+
let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
|
|
7852
7618
|
this.assert(
|
|
7853
7619
|
"function" === typeof context,
|
|
7854
7620
|
"expected #{this} to respond to " + inspect2(method),
|
|
@@ -7862,10 +7628,9 @@ Assertion.addProperty("itself", function() {
|
|
|
7862
7628
|
flag2(this, "itself", true);
|
|
7863
7629
|
});
|
|
7864
7630
|
function satisfy(matcher, msg) {
|
|
7865
|
-
if (msg)
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
var result = matcher(obj);
|
|
7631
|
+
if (msg) flag2(this, "message", msg);
|
|
7632
|
+
let obj = flag2(this, "object");
|
|
7633
|
+
let result = matcher(obj);
|
|
7869
7634
|
this.assert(
|
|
7870
7635
|
result,
|
|
7871
7636
|
"expected #{this} to satisfy " + objDisplay(matcher),
|
|
@@ -7878,27 +7643,28 @@ __name(satisfy, "satisfy");
|
|
|
7878
7643
|
Assertion.addMethod("satisfy", satisfy);
|
|
7879
7644
|
Assertion.addMethod("satisfies", satisfy);
|
|
7880
7645
|
function closeTo(expected, delta, msg) {
|
|
7881
|
-
if (msg)
|
|
7882
|
-
|
|
7883
|
-
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7646
|
+
if (msg) flag2(this, "message", msg);
|
|
7647
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7884
7648
|
new Assertion(obj, flagMsg, ssfi, true).is.numeric;
|
|
7885
7649
|
let message = "A `delta` value is required for `closeTo`";
|
|
7886
|
-
if (delta == void 0)
|
|
7650
|
+
if (delta == void 0) {
|
|
7887
7651
|
throw new AssertionError(
|
|
7888
7652
|
flagMsg ? `${flagMsg}: ${message}` : message,
|
|
7889
7653
|
void 0,
|
|
7890
7654
|
ssfi
|
|
7891
7655
|
);
|
|
7656
|
+
}
|
|
7892
7657
|
new Assertion(delta, flagMsg, ssfi, true).is.numeric;
|
|
7893
7658
|
message = "A `expected` value is required for `closeTo`";
|
|
7894
|
-
if (expected == void 0)
|
|
7659
|
+
if (expected == void 0) {
|
|
7895
7660
|
throw new AssertionError(
|
|
7896
7661
|
flagMsg ? `${flagMsg}: ${message}` : message,
|
|
7897
7662
|
void 0,
|
|
7898
7663
|
ssfi
|
|
7899
7664
|
);
|
|
7665
|
+
}
|
|
7900
7666
|
new Assertion(expected, flagMsg, ssfi, true).is.numeric;
|
|
7901
|
-
const abs = /* @__PURE__ */ __name((x) => x <
|
|
7667
|
+
const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs");
|
|
7902
7668
|
const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
|
|
7903
7669
|
this.assert(
|
|
7904
7670
|
strip(abs(obj - expected)) <= delta,
|
|
@@ -7913,40 +7679,33 @@ function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
|
|
|
7913
7679
|
let superset = Array.from(_superset);
|
|
7914
7680
|
let subset = Array.from(_subset);
|
|
7915
7681
|
if (!contains) {
|
|
7916
|
-
if (subset.length !== superset.length)
|
|
7917
|
-
return false;
|
|
7682
|
+
if (subset.length !== superset.length) return false;
|
|
7918
7683
|
superset = superset.slice();
|
|
7919
7684
|
}
|
|
7920
7685
|
return subset.every(function(elem, idx) {
|
|
7921
|
-
if (ordered)
|
|
7922
|
-
return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
|
|
7686
|
+
if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
|
|
7923
7687
|
if (!cmp) {
|
|
7924
|
-
|
|
7925
|
-
if (matchIdx === -1)
|
|
7926
|
-
|
|
7927
|
-
if (!contains)
|
|
7928
|
-
superset.splice(matchIdx, 1);
|
|
7688
|
+
let matchIdx = superset.indexOf(elem);
|
|
7689
|
+
if (matchIdx === -1) return false;
|
|
7690
|
+
if (!contains) superset.splice(matchIdx, 1);
|
|
7929
7691
|
return true;
|
|
7930
7692
|
}
|
|
7931
|
-
return superset.some(function(elem2,
|
|
7932
|
-
if (!cmp(elem, elem2))
|
|
7933
|
-
|
|
7934
|
-
if (!contains)
|
|
7935
|
-
superset.splice(matchIdx2, 1);
|
|
7693
|
+
return superset.some(function(elem2, matchIdx) {
|
|
7694
|
+
if (!cmp(elem, elem2)) return false;
|
|
7695
|
+
if (!contains) superset.splice(matchIdx, 1);
|
|
7936
7696
|
return true;
|
|
7937
7697
|
});
|
|
7938
7698
|
});
|
|
7939
7699
|
}
|
|
7940
7700
|
__name(isSubsetOf, "isSubsetOf");
|
|
7941
7701
|
Assertion.addMethod("members", function(subset, msg) {
|
|
7942
|
-
if (msg)
|
|
7943
|
-
|
|
7944
|
-
var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7702
|
+
if (msg) flag2(this, "message", msg);
|
|
7703
|
+
let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7945
7704
|
new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
|
|
7946
7705
|
new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7706
|
+
let contains = flag2(this, "contains");
|
|
7707
|
+
let ordered = flag2(this, "ordered");
|
|
7708
|
+
let subject, failMsg, failNegateMsg;
|
|
7950
7709
|
if (contains) {
|
|
7951
7710
|
subject = ordered ? "an ordered superset" : "a superset";
|
|
7952
7711
|
failMsg = "expected #{this} to be " + subject + " of #{exp}";
|
|
@@ -7956,7 +7715,7 @@ Assertion.addMethod("members", function(subset, msg) {
|
|
|
7956
7715
|
failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
|
|
7957
7716
|
failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
|
|
7958
7717
|
}
|
|
7959
|
-
|
|
7718
|
+
let cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0;
|
|
7960
7719
|
this.assert(
|
|
7961
7720
|
isSubsetOf(subset, obj, cmp, contains, ordered),
|
|
7962
7721
|
failMsg,
|
|
@@ -7967,9 +7726,8 @@ Assertion.addMethod("members", function(subset, msg) {
|
|
|
7967
7726
|
);
|
|
7968
7727
|
});
|
|
7969
7728
|
Assertion.addProperty("iterable", function(msg) {
|
|
7970
|
-
if (msg)
|
|
7971
|
-
|
|
7972
|
-
var obj = flag2(this, "object");
|
|
7729
|
+
if (msg) flag2(this, "message", msg);
|
|
7730
|
+
let obj = flag2(this, "object");
|
|
7973
7731
|
this.assert(
|
|
7974
7732
|
obj != void 0 && obj[Symbol.iterator],
|
|
7975
7733
|
"expected #{this} to be an iterable",
|
|
@@ -7978,9 +7736,8 @@ Assertion.addProperty("iterable", function(msg) {
|
|
|
7978
7736
|
);
|
|
7979
7737
|
});
|
|
7980
7738
|
function oneOf(list, msg) {
|
|
7981
|
-
if (msg)
|
|
7982
|
-
|
|
7983
|
-
var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
|
|
7739
|
+
if (msg) flag2(this, "message", msg);
|
|
7740
|
+
let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
|
|
7984
7741
|
new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
|
|
7985
7742
|
if (contains) {
|
|
7986
7743
|
this.assert(
|
|
@@ -8017,11 +7774,10 @@ function oneOf(list, msg) {
|
|
|
8017
7774
|
__name(oneOf, "oneOf");
|
|
8018
7775
|
Assertion.addMethod("oneOf", oneOf);
|
|
8019
7776
|
function assertChanges(subject, prop, msg) {
|
|
8020
|
-
if (msg)
|
|
8021
|
-
|
|
8022
|
-
var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7777
|
+
if (msg) flag2(this, "message", msg);
|
|
7778
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8023
7779
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
8024
|
-
|
|
7780
|
+
let initial;
|
|
8025
7781
|
if (!prop) {
|
|
8026
7782
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8027
7783
|
initial = subject();
|
|
@@ -8030,8 +7786,8 @@ function assertChanges(subject, prop, msg) {
|
|
|
8030
7786
|
initial = subject[prop];
|
|
8031
7787
|
}
|
|
8032
7788
|
fn();
|
|
8033
|
-
|
|
8034
|
-
|
|
7789
|
+
let final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
7790
|
+
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8035
7791
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8036
7792
|
flag2(this, "initialDeltaValue", initial);
|
|
8037
7793
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8047,11 +7803,10 @@ __name(assertChanges, "assertChanges");
|
|
|
8047
7803
|
Assertion.addMethod("change", assertChanges);
|
|
8048
7804
|
Assertion.addMethod("changes", assertChanges);
|
|
8049
7805
|
function assertIncreases(subject, prop, msg) {
|
|
8050
|
-
if (msg)
|
|
8051
|
-
|
|
8052
|
-
var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7806
|
+
if (msg) flag2(this, "message", msg);
|
|
7807
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8053
7808
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
8054
|
-
|
|
7809
|
+
let initial;
|
|
8055
7810
|
if (!prop) {
|
|
8056
7811
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8057
7812
|
initial = subject();
|
|
@@ -8061,8 +7816,8 @@ function assertIncreases(subject, prop, msg) {
|
|
|
8061
7816
|
}
|
|
8062
7817
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
8063
7818
|
fn();
|
|
8064
|
-
|
|
8065
|
-
|
|
7819
|
+
let final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
7820
|
+
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8066
7821
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8067
7822
|
flag2(this, "initialDeltaValue", initial);
|
|
8068
7823
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8078,11 +7833,10 @@ __name(assertIncreases, "assertIncreases");
|
|
|
8078
7833
|
Assertion.addMethod("increase", assertIncreases);
|
|
8079
7834
|
Assertion.addMethod("increases", assertIncreases);
|
|
8080
7835
|
function assertDecreases(subject, prop, msg) {
|
|
8081
|
-
if (msg)
|
|
8082
|
-
|
|
8083
|
-
var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
7836
|
+
if (msg) flag2(this, "message", msg);
|
|
7837
|
+
let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
|
|
8084
7838
|
new Assertion(fn, flagMsg, ssfi, true).is.a("function");
|
|
8085
|
-
|
|
7839
|
+
let initial;
|
|
8086
7840
|
if (!prop) {
|
|
8087
7841
|
new Assertion(subject, flagMsg, ssfi, true).is.a("function");
|
|
8088
7842
|
initial = subject();
|
|
@@ -8092,8 +7846,8 @@ function assertDecreases(subject, prop, msg) {
|
|
|
8092
7846
|
}
|
|
8093
7847
|
new Assertion(initial, flagMsg, ssfi, true).is.a("number");
|
|
8094
7848
|
fn();
|
|
8095
|
-
|
|
8096
|
-
|
|
7849
|
+
let final = prop === void 0 || prop === null ? subject() : subject[prop];
|
|
7850
|
+
let msgObj = prop === void 0 || prop === null ? initial : "." + prop;
|
|
8097
7851
|
flag2(this, "deltaMsgObj", msgObj);
|
|
8098
7852
|
flag2(this, "initialDeltaValue", initial);
|
|
8099
7853
|
flag2(this, "finalDeltaValue", final);
|
|
@@ -8109,14 +7863,13 @@ __name(assertDecreases, "assertDecreases");
|
|
|
8109
7863
|
Assertion.addMethod("decrease", assertDecreases);
|
|
8110
7864
|
Assertion.addMethod("decreases", assertDecreases);
|
|
8111
7865
|
function assertDelta(delta, msg) {
|
|
8112
|
-
if (msg)
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
var expression;
|
|
7866
|
+
if (msg) flag2(this, "message", msg);
|
|
7867
|
+
let msgObj = flag2(this, "deltaMsgObj");
|
|
7868
|
+
let initial = flag2(this, "initialDeltaValue");
|
|
7869
|
+
let final = flag2(this, "finalDeltaValue");
|
|
7870
|
+
let behavior = flag2(this, "deltaBehavior");
|
|
7871
|
+
let realDelta = flag2(this, "realDelta");
|
|
7872
|
+
let expression;
|
|
8120
7873
|
if (behavior === "change") {
|
|
8121
7874
|
expression = Math.abs(final - initial) === Math.abs(delta);
|
|
8122
7875
|
} else {
|
|
@@ -8131,8 +7884,8 @@ function assertDelta(delta, msg) {
|
|
|
8131
7884
|
__name(assertDelta, "assertDelta");
|
|
8132
7885
|
Assertion.addMethod("by", assertDelta);
|
|
8133
7886
|
Assertion.addProperty("extensible", function() {
|
|
8134
|
-
|
|
8135
|
-
|
|
7887
|
+
let obj = flag2(this, "object");
|
|
7888
|
+
let isExtensible = obj === Object(obj) && Object.isExtensible(obj);
|
|
8136
7889
|
this.assert(
|
|
8137
7890
|
isExtensible,
|
|
8138
7891
|
"expected #{this} to be extensible",
|
|
@@ -8140,8 +7893,8 @@ Assertion.addProperty("extensible", function() {
|
|
|
8140
7893
|
);
|
|
8141
7894
|
});
|
|
8142
7895
|
Assertion.addProperty("sealed", function() {
|
|
8143
|
-
|
|
8144
|
-
|
|
7896
|
+
let obj = flag2(this, "object");
|
|
7897
|
+
let isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
|
|
8145
7898
|
this.assert(
|
|
8146
7899
|
isSealed,
|
|
8147
7900
|
"expected #{this} to be sealed",
|
|
@@ -8149,8 +7902,8 @@ Assertion.addProperty("sealed", function() {
|
|
|
8149
7902
|
);
|
|
8150
7903
|
});
|
|
8151
7904
|
Assertion.addProperty("frozen", function() {
|
|
8152
|
-
|
|
8153
|
-
|
|
7905
|
+
let obj = flag2(this, "object");
|
|
7906
|
+
let isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
|
|
8154
7907
|
this.assert(
|
|
8155
7908
|
isFrozen,
|
|
8156
7909
|
"expected #{this} to be frozen",
|
|
@@ -8158,7 +7911,7 @@ Assertion.addProperty("frozen", function() {
|
|
|
8158
7911
|
);
|
|
8159
7912
|
});
|
|
8160
7913
|
Assertion.addProperty("finite", function(_msg) {
|
|
8161
|
-
|
|
7914
|
+
let obj = flag2(this, "object");
|
|
8162
7915
|
this.assert(
|
|
8163
7916
|
typeof obj === "number" && isFinite(obj),
|
|
8164
7917
|
"expected #{this} to be a finite number",
|
|
@@ -8196,8 +7949,8 @@ function compareSubset(expected, actual) {
|
|
|
8196
7949
|
}
|
|
8197
7950
|
}
|
|
8198
7951
|
return Object.keys(expected).every(function(key) {
|
|
8199
|
-
|
|
8200
|
-
|
|
7952
|
+
let expectedValue = expected[key];
|
|
7953
|
+
let actualValue = actual[key];
|
|
8201
7954
|
if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
|
|
8202
7955
|
return compareSubset(expectedValue, actualValue);
|
|
8203
7956
|
}
|
|
@@ -8271,7 +8024,7 @@ function loadShould() {
|
|
|
8271
8024
|
get: shouldGetter,
|
|
8272
8025
|
configurable: true
|
|
8273
8026
|
});
|
|
8274
|
-
|
|
8027
|
+
let should2 = {};
|
|
8275
8028
|
should2.fail = function(actual, expected, message, operator) {
|
|
8276
8029
|
if (arguments.length < 2) {
|
|
8277
8030
|
message = actual;
|
|
@@ -8317,7 +8070,7 @@ var Should = loadShould;
|
|
|
8317
8070
|
|
|
8318
8071
|
// lib/chai/interface/assert.js
|
|
8319
8072
|
function assert(express, errmsg) {
|
|
8320
|
-
|
|
8073
|
+
let test2 = new Assertion(null, null, assert, true);
|
|
8321
8074
|
test2.assert(express, errmsg, "[ negation message unavailable ]");
|
|
8322
8075
|
}
|
|
8323
8076
|
__name(assert, "assert");
|
|
@@ -8344,7 +8097,7 @@ assert.isNotOk = function(val, msg) {
|
|
|
8344
8097
|
new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
|
|
8345
8098
|
};
|
|
8346
8099
|
assert.equal = function(act, exp, msg) {
|
|
8347
|
-
|
|
8100
|
+
let test2 = new Assertion(act, msg, assert.equal, true);
|
|
8348
8101
|
test2.assert(
|
|
8349
8102
|
exp == flag(test2, "object"),
|
|
8350
8103
|
"expected #{this} to equal #{exp}",
|
|
@@ -8355,7 +8108,7 @@ assert.equal = function(act, exp, msg) {
|
|
|
8355
8108
|
);
|
|
8356
8109
|
};
|
|
8357
8110
|
assert.notEqual = function(act, exp, msg) {
|
|
8358
|
-
|
|
8111
|
+
let test2 = new Assertion(act, msg, assert.notEqual, true);
|
|
8359
8112
|
test2.assert(
|
|
8360
8113
|
exp != flag(test2, "object"),
|
|
8361
8114
|
"expected #{this} to not equal #{exp}",
|
|
@@ -8712,7 +8465,7 @@ assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
|
|
|
8712
8465
|
errMsgMatcher = errorLike;
|
|
8713
8466
|
errorLike = null;
|
|
8714
8467
|
}
|
|
8715
|
-
|
|
8468
|
+
let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(
|
|
8716
8469
|
errorLike,
|
|
8717
8470
|
errMsgMatcher
|
|
8718
8471
|
);
|
|
@@ -8729,7 +8482,7 @@ assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
|
|
|
8729
8482
|
);
|
|
8730
8483
|
};
|
|
8731
8484
|
assert.operator = function(val, operator, val2, msg) {
|
|
8732
|
-
|
|
8485
|
+
let ok;
|
|
8733
8486
|
switch (operator) {
|
|
8734
8487
|
case "==":
|
|
8735
8488
|
ok = val == val2;
|
|
@@ -8763,7 +8516,7 @@ assert.operator = function(val, operator, val2, msg) {
|
|
|
8763
8516
|
assert.operator
|
|
8764
8517
|
);
|
|
8765
8518
|
}
|
|
8766
|
-
|
|
8519
|
+
let test2 = new Assertion(ok, msg, assert.operator, true);
|
|
8767
8520
|
test2.assert(
|
|
8768
8521
|
true === flag(test2, "object"),
|
|
8769
8522
|
"expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2),
|
|
@@ -8917,7 +8670,7 @@ assert.changes = function(fn, obj, prop, msg) {
|
|
|
8917
8670
|
};
|
|
8918
8671
|
assert.changesBy = function(fn, obj, prop, delta, msg) {
|
|
8919
8672
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8920
|
-
|
|
8673
|
+
let tmpMsg = delta;
|
|
8921
8674
|
delta = prop;
|
|
8922
8675
|
msg = tmpMsg;
|
|
8923
8676
|
} else if (arguments.length === 3) {
|
|
@@ -8938,7 +8691,7 @@ assert.doesNotChange = function(fn, obj, prop, msg) {
|
|
|
8938
8691
|
};
|
|
8939
8692
|
assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
8940
8693
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8941
|
-
|
|
8694
|
+
let tmpMsg = delta;
|
|
8942
8695
|
delta = prop;
|
|
8943
8696
|
msg = tmpMsg;
|
|
8944
8697
|
} else if (arguments.length === 3) {
|
|
@@ -8956,7 +8709,7 @@ assert.increases = function(fn, obj, prop, msg) {
|
|
|
8956
8709
|
};
|
|
8957
8710
|
assert.increasesBy = function(fn, obj, prop, delta, msg) {
|
|
8958
8711
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8959
|
-
|
|
8712
|
+
let tmpMsg = delta;
|
|
8960
8713
|
delta = prop;
|
|
8961
8714
|
msg = tmpMsg;
|
|
8962
8715
|
} else if (arguments.length === 3) {
|
|
@@ -8977,7 +8730,7 @@ assert.doesNotIncrease = function(fn, obj, prop, msg) {
|
|
|
8977
8730
|
};
|
|
8978
8731
|
assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
8979
8732
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8980
|
-
|
|
8733
|
+
let tmpMsg = delta;
|
|
8981
8734
|
delta = prop;
|
|
8982
8735
|
msg = tmpMsg;
|
|
8983
8736
|
} else if (arguments.length === 3) {
|
|
@@ -8995,7 +8748,7 @@ assert.decreases = function(fn, obj, prop, msg) {
|
|
|
8995
8748
|
};
|
|
8996
8749
|
assert.decreasesBy = function(fn, obj, prop, delta, msg) {
|
|
8997
8750
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
8998
|
-
|
|
8751
|
+
let tmpMsg = delta;
|
|
8999
8752
|
delta = prop;
|
|
9000
8753
|
msg = tmpMsg;
|
|
9001
8754
|
} else if (arguments.length === 3) {
|
|
@@ -9016,7 +8769,7 @@ assert.doesNotDecrease = function(fn, obj, prop, msg) {
|
|
|
9016
8769
|
};
|
|
9017
8770
|
assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
|
|
9018
8771
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9019
|
-
|
|
8772
|
+
let tmpMsg = delta;
|
|
9020
8773
|
delta = prop;
|
|
9021
8774
|
msg = tmpMsg;
|
|
9022
8775
|
} else if (arguments.length === 3) {
|
|
@@ -9027,7 +8780,7 @@ assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
|
|
|
9027
8780
|
};
|
|
9028
8781
|
assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
|
|
9029
8782
|
if (arguments.length === 4 && typeof obj === "function") {
|
|
9030
|
-
|
|
8783
|
+
let tmpMsg = delta;
|
|
9031
8784
|
delta = prop;
|
|
9032
8785
|
msg = tmpMsg;
|
|
9033
8786
|
} else if (arguments.length === 3) {
|
|
@@ -9112,284 +8865,44 @@ function use(fn) {
|
|
|
9112
8865
|
return exports;
|
|
9113
8866
|
}
|
|
9114
8867
|
__name(use, "use");
|
|
9115
|
-
/*!
|
|
9116
|
-
* Chai - flag utility
|
|
9117
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9118
|
-
* MIT Licensed
|
|
9119
|
-
*/
|
|
9120
|
-
/*!
|
|
9121
|
-
* Chai - test utility
|
|
9122
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9123
|
-
* MIT Licensed
|
|
9124
|
-
*/
|
|
9125
|
-
/*!
|
|
9126
|
-
* Chai - expectTypes utility
|
|
9127
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9128
|
-
* MIT Licensed
|
|
9129
|
-
*/
|
|
9130
|
-
/*!
|
|
9131
|
-
* Chai - getActual utility
|
|
9132
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9133
|
-
* MIT Licensed
|
|
9134
|
-
*/
|
|
9135
|
-
/*!
|
|
9136
|
-
* Chai - message composition utility
|
|
9137
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9138
|
-
* MIT Licensed
|
|
9139
|
-
*/
|
|
9140
|
-
/*!
|
|
9141
|
-
* Chai - transferFlags utility
|
|
9142
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9143
|
-
* MIT Licensed
|
|
9144
|
-
*/
|
|
9145
|
-
/*!
|
|
9146
|
-
* chai
|
|
9147
|
-
* http://chaijs.com
|
|
9148
|
-
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9149
|
-
* MIT Licensed
|
|
9150
|
-
*/
|
|
9151
|
-
/*!
|
|
9152
|
-
* Chai - isProxyEnabled helper
|
|
9153
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9154
|
-
* MIT Licensed
|
|
9155
|
-
*/
|
|
9156
|
-
/*!
|
|
9157
|
-
* Chai - addProperty utility
|
|
9158
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9159
|
-
* MIT Licensed
|
|
9160
|
-
*/
|
|
9161
|
-
/*!
|
|
9162
|
-
* Chai - addLengthGuard utility
|
|
9163
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9164
|
-
* MIT Licensed
|
|
9165
|
-
*/
|
|
9166
|
-
/*!
|
|
9167
|
-
* Chai - getProperties utility
|
|
9168
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9169
|
-
* MIT Licensed
|
|
9170
|
-
*/
|
|
9171
|
-
/*!
|
|
9172
|
-
* Chai - proxify utility
|
|
9173
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9174
|
-
* MIT Licensed
|
|
9175
|
-
*/
|
|
9176
|
-
/*!
|
|
9177
|
-
* Chai - addMethod utility
|
|
9178
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9179
|
-
* MIT Licensed
|
|
9180
|
-
*/
|
|
9181
|
-
/*!
|
|
9182
|
-
* Chai - overwriteProperty utility
|
|
9183
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9184
|
-
* MIT Licensed
|
|
9185
|
-
*/
|
|
9186
|
-
/*!
|
|
9187
|
-
* Chai - overwriteMethod utility
|
|
9188
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9189
|
-
* MIT Licensed
|
|
9190
|
-
*/
|
|
9191
|
-
/*!
|
|
9192
|
-
* Chai - addChainingMethod utility
|
|
9193
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9194
|
-
* MIT Licensed
|
|
9195
|
-
*/
|
|
9196
|
-
/*!
|
|
9197
|
-
* Chai - overwriteChainableMethod utility
|
|
9198
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9199
|
-
* MIT Licensed
|
|
9200
|
-
*/
|
|
9201
|
-
/*!
|
|
9202
|
-
* Chai - compareByInspect utility
|
|
9203
|
-
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
9204
|
-
* MIT Licensed
|
|
9205
|
-
*/
|
|
9206
|
-
/*!
|
|
9207
|
-
* Chai - getOwnEnumerablePropertySymbols utility
|
|
9208
|
-
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
9209
|
-
* MIT Licensed
|
|
9210
|
-
*/
|
|
9211
|
-
/*!
|
|
9212
|
-
* Chai - getOwnEnumerableProperties utility
|
|
9213
|
-
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
9214
|
-
* MIT Licensed
|
|
9215
|
-
*/
|
|
9216
|
-
/*!
|
|
9217
|
-
* Chai - isNaN utility
|
|
9218
|
-
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
|
9219
|
-
* MIT Licensed
|
|
9220
|
-
*/
|
|
9221
|
-
/*!
|
|
9222
|
-
* chai
|
|
9223
|
-
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
|
9224
|
-
* MIT Licensed
|
|
9225
|
-
*/
|
|
9226
|
-
/*!
|
|
9227
|
-
* chai
|
|
9228
|
-
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
|
9229
|
-
* MIT Licensed
|
|
9230
|
-
*/
|
|
9231
|
-
/*! Bundled license information:
|
|
9232
|
-
|
|
9233
|
-
deep-eql/index.js:
|
|
9234
|
-
(*!
|
|
9235
|
-
* deep-eql
|
|
9236
|
-
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
9237
|
-
* MIT Licensed
|
|
9238
|
-
*)
|
|
9239
|
-
(*!
|
|
9240
|
-
* Check to see if the MemoizeMap has recorded a result of the two operands
|
|
9241
|
-
*
|
|
9242
|
-
* @param {Mixed} leftHandOperand
|
|
9243
|
-
* @param {Mixed} rightHandOperand
|
|
9244
|
-
* @param {MemoizeMap} memoizeMap
|
|
9245
|
-
* @returns {Boolean|null} result
|
|
9246
|
-
*)
|
|
9247
|
-
(*!
|
|
9248
|
-
* Set the result of the equality into the MemoizeMap
|
|
9249
|
-
*
|
|
9250
|
-
* @param {Mixed} leftHandOperand
|
|
9251
|
-
* @param {Mixed} rightHandOperand
|
|
9252
|
-
* @param {MemoizeMap} memoizeMap
|
|
9253
|
-
* @param {Boolean} result
|
|
9254
|
-
*)
|
|
9255
|
-
(*!
|
|
9256
|
-
* Primary Export
|
|
9257
|
-
*)
|
|
9258
|
-
(*!
|
|
9259
|
-
* The main logic of the `deepEqual` function.
|
|
9260
|
-
*
|
|
9261
|
-
* @param {Mixed} leftHandOperand
|
|
9262
|
-
* @param {Mixed} rightHandOperand
|
|
9263
|
-
* @param {Object} [options] (optional) Additional options
|
|
9264
|
-
* @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
|
|
9265
|
-
* @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
|
|
9266
|
-
complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
|
|
9267
|
-
references to blow the stack.
|
|
9268
|
-
* @return {Boolean} equal match
|
|
9269
|
-
*)
|
|
9270
|
-
(*!
|
|
9271
|
-
* Compare two Regular Expressions for equality.
|
|
9272
|
-
*
|
|
9273
|
-
* @param {RegExp} leftHandOperand
|
|
9274
|
-
* @param {RegExp} rightHandOperand
|
|
9275
|
-
* @return {Boolean} result
|
|
9276
|
-
*)
|
|
9277
|
-
(*!
|
|
9278
|
-
* Compare two Sets/Maps for equality. Faster than other equality functions.
|
|
9279
|
-
*
|
|
9280
|
-
* @param {Set} leftHandOperand
|
|
9281
|
-
* @param {Set} rightHandOperand
|
|
9282
|
-
* @param {Object} [options] (Optional)
|
|
9283
|
-
* @return {Boolean} result
|
|
9284
|
-
*)
|
|
9285
|
-
(*!
|
|
9286
|
-
* Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
|
|
9287
|
-
*
|
|
9288
|
-
* @param {Iterable} leftHandOperand
|
|
9289
|
-
* @param {Iterable} rightHandOperand
|
|
9290
|
-
* @param {Object} [options] (Optional)
|
|
9291
|
-
* @return {Boolean} result
|
|
9292
|
-
*)
|
|
9293
|
-
(*!
|
|
9294
|
-
* Simple equality for generator objects such as those returned by generator functions.
|
|
9295
|
-
*
|
|
9296
|
-
* @param {Iterable} leftHandOperand
|
|
9297
|
-
* @param {Iterable} rightHandOperand
|
|
9298
|
-
* @param {Object} [options] (Optional)
|
|
9299
|
-
* @return {Boolean} result
|
|
9300
|
-
*)
|
|
9301
|
-
(*!
|
|
9302
|
-
* Determine if the given object has an @@iterator function.
|
|
9303
|
-
*
|
|
9304
|
-
* @param {Object} target
|
|
9305
|
-
* @return {Boolean} `true` if the object has an @@iterator function.
|
|
9306
|
-
*)
|
|
9307
|
-
(*!
|
|
9308
|
-
* Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
|
|
9309
|
-
* This will consume the iterator - which could have side effects depending on the @@iterator implementation.
|
|
9310
|
-
*
|
|
9311
|
-
* @param {Object} target
|
|
9312
|
-
* @returns {Array} an array of entries from the @@iterator function
|
|
9313
|
-
*)
|
|
9314
|
-
(*!
|
|
9315
|
-
* Gets all entries from a Generator. This will consume the generator - which could have side effects.
|
|
9316
|
-
*
|
|
9317
|
-
* @param {Generator} target
|
|
9318
|
-
* @returns {Array} an array of entries from the Generator.
|
|
9319
|
-
*)
|
|
9320
|
-
(*!
|
|
9321
|
-
* Gets all own and inherited enumerable keys from a target.
|
|
9322
|
-
*
|
|
9323
|
-
* @param {Object} target
|
|
9324
|
-
* @returns {Array} an array of own and inherited enumerable keys from the target.
|
|
9325
|
-
*)
|
|
9326
|
-
(*!
|
|
9327
|
-
* Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
|
|
9328
|
-
* each key. If any value of the given key is not equal, the function will return false (early).
|
|
9329
|
-
*
|
|
9330
|
-
* @param {Mixed} leftHandOperand
|
|
9331
|
-
* @param {Mixed} rightHandOperand
|
|
9332
|
-
* @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
|
|
9333
|
-
* @param {Object} [options] (Optional)
|
|
9334
|
-
* @return {Boolean} result
|
|
9335
|
-
*)
|
|
9336
|
-
(*!
|
|
9337
|
-
* Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
|
|
9338
|
-
* for each enumerable key in the object.
|
|
9339
|
-
*
|
|
9340
|
-
* @param {Mixed} leftHandOperand
|
|
9341
|
-
* @param {Mixed} rightHandOperand
|
|
9342
|
-
* @param {Object} [options] (Optional)
|
|
9343
|
-
* @return {Boolean} result
|
|
9344
|
-
*)
|
|
9345
|
-
(*!
|
|
9346
|
-
* Returns true if the argument is a primitive.
|
|
9347
|
-
*
|
|
9348
|
-
* This intentionally returns true for all objects that can be compared by reference,
|
|
9349
|
-
* including functions and symbols.
|
|
9350
|
-
*
|
|
9351
|
-
* @param {Mixed} value
|
|
9352
|
-
* @return {Boolean} result
|
|
9353
|
-
*)
|
|
9354
|
-
*/
|
|
9355
8868
|
|
|
9356
8869
|
const MATCHERS_OBJECT = Symbol.for("matchers-object");
|
|
9357
8870
|
const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
|
|
9358
8871
|
const GLOBAL_EXPECT = Symbol.for("expect-global");
|
|
9359
8872
|
const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object");
|
|
9360
8873
|
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
8874
|
+
C.green;
|
|
8875
|
+
C.red;
|
|
8876
|
+
C.inverse;
|
|
8877
|
+
C.bold;
|
|
8878
|
+
C.dim;
|
|
9366
8879
|
|
|
9367
8880
|
// Extracted out of jasmine 2.5.2
|
|
9368
8881
|
function equals(a, b, customTesters, strictCheck) {
|
|
9369
8882
|
customTesters = customTesters || [];
|
|
9370
|
-
return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
|
|
8883
|
+
return eq(a, b, [], [], customTesters, strictCheck ? hasKey$1 : hasDefinedKey);
|
|
9371
8884
|
}
|
|
9372
8885
|
function isAsymmetric(obj) {
|
|
9373
8886
|
return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch);
|
|
9374
8887
|
}
|
|
9375
|
-
function asymmetricMatch(a, b) {
|
|
8888
|
+
function asymmetricMatch(a, b, customTesters) {
|
|
9376
8889
|
const asymmetricA = isAsymmetric(a);
|
|
9377
8890
|
const asymmetricB = isAsymmetric(b);
|
|
9378
8891
|
if (asymmetricA && asymmetricB) {
|
|
9379
8892
|
return undefined;
|
|
9380
8893
|
}
|
|
9381
8894
|
if (asymmetricA) {
|
|
9382
|
-
return a.asymmetricMatch(b);
|
|
8895
|
+
return a.asymmetricMatch(b, customTesters);
|
|
9383
8896
|
}
|
|
9384
8897
|
if (asymmetricB) {
|
|
9385
|
-
return b.asymmetricMatch(a);
|
|
8898
|
+
return b.asymmetricMatch(a, customTesters);
|
|
9386
8899
|
}
|
|
9387
8900
|
}
|
|
9388
8901
|
// Equality function lovingly adapted from isEqual in
|
|
9389
8902
|
// [Underscore](http://underscorejs.org)
|
|
9390
8903
|
function eq(a, b, aStack, bStack, customTesters, hasKey) {
|
|
9391
8904
|
let result = true;
|
|
9392
|
-
const asymmetricResult = asymmetricMatch(a, b);
|
|
8905
|
+
const asymmetricResult = asymmetricMatch(a, b, customTesters);
|
|
9393
8906
|
if (asymmetricResult !== undefined) {
|
|
9394
8907
|
return asymmetricResult;
|
|
9395
8908
|
}
|
|
@@ -9530,10 +9043,10 @@ function keys(obj, hasKey) {
|
|
|
9530
9043
|
return keys.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
|
|
9531
9044
|
}
|
|
9532
9045
|
function hasDefinedKey(obj, key) {
|
|
9533
|
-
return hasKey(obj, key) && obj[key] !== undefined;
|
|
9046
|
+
return hasKey$1(obj, key) && obj[key] !== undefined;
|
|
9534
9047
|
}
|
|
9535
|
-
function hasKey(obj, key) {
|
|
9536
|
-
return Object.
|
|
9048
|
+
function hasKey$1(obj, key) {
|
|
9049
|
+
return Object.hasOwn(obj, key);
|
|
9537
9050
|
}
|
|
9538
9051
|
function isA(typeName, value) {
|
|
9539
9052
|
return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
|
|
@@ -9542,7 +9055,7 @@ function isDomNode(obj) {
|
|
|
9542
9055
|
return obj !== null && typeof obj === "object" && "nodeType" in obj && typeof obj.nodeType === "number" && "nodeName" in obj && typeof obj.nodeName === "string" && "isEqualNode" in obj && typeof obj.isEqualNode === "function";
|
|
9543
9056
|
}
|
|
9544
9057
|
|
|
9545
|
-
if (!Object.
|
|
9058
|
+
if (!Object.hasOwn(globalThis, MATCHERS_OBJECT)) {
|
|
9546
9059
|
const globalState = new WeakMap();
|
|
9547
9060
|
const matchers = Object.create(null);
|
|
9548
9061
|
const customEqualityTesters = [];
|
|
@@ -9559,6 +9072,13 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
|
9559
9072
|
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, { get: () => asymmetricMatchers });
|
|
9560
9073
|
}
|
|
9561
9074
|
|
|
9075
|
+
const KEYS_TO_HANDLE = ["oneOf", "anyOf", "allOf", "not", "$ref"];
|
|
9076
|
+
function isPlainObject(value) {
|
|
9077
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9078
|
+
}
|
|
9079
|
+
function hasKey(obj, key) {
|
|
9080
|
+
return key in obj;
|
|
9081
|
+
}
|
|
9562
9082
|
const extendedDefu = createDefu((obj, key, value) => {
|
|
9563
9083
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
9564
9084
|
obj[key] = [.../* @__PURE__ */ new Set([...obj[key], ...value])].sort();
|
|
@@ -9571,6 +9091,21 @@ const extendedDefu = createDefu((obj, key, value) => {
|
|
|
9571
9091
|
delete obj[key];
|
|
9572
9092
|
return true;
|
|
9573
9093
|
}
|
|
9094
|
+
if (!isPlainObject(obj)) {
|
|
9095
|
+
return false;
|
|
9096
|
+
}
|
|
9097
|
+
const objRecord = obj;
|
|
9098
|
+
function replaceKey(obj2, oldKey, newKey) {
|
|
9099
|
+
if (oldKey in obj2) {
|
|
9100
|
+
obj2[newKey] = obj2[oldKey];
|
|
9101
|
+
delete obj2[oldKey];
|
|
9102
|
+
}
|
|
9103
|
+
}
|
|
9104
|
+
for (const key2 of KEYS_TO_HANDLE) {
|
|
9105
|
+
if (hasKey(objRecord, key2)) {
|
|
9106
|
+
replaceKey(objRecord, key2, key2);
|
|
9107
|
+
}
|
|
9108
|
+
}
|
|
9574
9109
|
return false;
|
|
9575
9110
|
});
|
|
9576
9111
|
function patchJsonSchema({
|
|
@@ -9777,6 +9312,17 @@ async function loadLocalJSONFile(path) {
|
|
|
9777
9312
|
return void 0;
|
|
9778
9313
|
}
|
|
9779
9314
|
|
|
9315
|
+
function getApiTypeConfig(config, apiType) {
|
|
9316
|
+
if (!config) {
|
|
9317
|
+
return {};
|
|
9318
|
+
}
|
|
9319
|
+
const apiTypeKey = `${apiType}-api`;
|
|
9320
|
+
const apiTypeConfig = config[apiTypeKey] || {};
|
|
9321
|
+
return {
|
|
9322
|
+
rules: apiTypeConfig.rules ?? config.rules,
|
|
9323
|
+
patches: apiTypeConfig.patches ?? config.patches
|
|
9324
|
+
};
|
|
9325
|
+
}
|
|
9780
9326
|
const API_GEN_CONFIG_FILENAME = "api-gen.config.json";
|
|
9781
9327
|
async function loadApiGenConfig(params = {}) {
|
|
9782
9328
|
try {
|
|
@@ -9785,7 +9331,22 @@ async function loadApiGenConfig(params = {}) {
|
|
|
9785
9331
|
// name: "api-gen", // file should be "api-gen.config.json"
|
|
9786
9332
|
encoding: "utf-8"
|
|
9787
9333
|
});
|
|
9788
|
-
|
|
9334
|
+
const parsedConfig = lib.parse(config);
|
|
9335
|
+
if (parsedConfig.rules && !params.silent) {
|
|
9336
|
+
console.warn(
|
|
9337
|
+
c.yellow(
|
|
9338
|
+
`\u26A0\uFE0F Deprecation warning: Root-level 'rules' in ${API_GEN_CONFIG_FILENAME} is deprecated. Use 'store-api.rules' or 'admin-api.rules' instead.`
|
|
9339
|
+
)
|
|
9340
|
+
);
|
|
9341
|
+
}
|
|
9342
|
+
if (parsedConfig.patches && !params.silent) {
|
|
9343
|
+
console.warn(
|
|
9344
|
+
c.yellow(
|
|
9345
|
+
`\u26A0\uFE0F Deprecation warning: Root-level 'patches' in ${API_GEN_CONFIG_FILENAME} is deprecated. Use 'store-api.patches' or 'admin-api.patches' instead.`
|
|
9346
|
+
)
|
|
9347
|
+
);
|
|
9348
|
+
}
|
|
9349
|
+
return parsedConfig;
|
|
9789
9350
|
} catch (error) {
|
|
9790
9351
|
if (!params.silent) {
|
|
9791
9352
|
console.error(
|
|
@@ -10559,8 +10120,9 @@ async function generate(args) {
|
|
|
10559
10120
|
silent: true
|
|
10560
10121
|
// we allow to not have the config file in this command
|
|
10561
10122
|
});
|
|
10123
|
+
const apiTypeConfig = getApiTypeConfig(configJSON, args.apiType);
|
|
10562
10124
|
const jsonOverrides = await loadJsonOverrides({
|
|
10563
|
-
paths:
|
|
10125
|
+
paths: apiTypeConfig.patches,
|
|
10564
10126
|
apiType: args.apiType
|
|
10565
10127
|
});
|
|
10566
10128
|
if (args.debug) {
|
|
@@ -10796,15 +10358,20 @@ let adminApiClient;
|
|
|
10796
10358
|
let storeApiClient;
|
|
10797
10359
|
function getAdminApiClient() {
|
|
10798
10360
|
if (!adminApiClient) {
|
|
10361
|
+
const credentials = process.env.SHOPWARE_ADMIN_CLIENT_SECRET ? {
|
|
10362
|
+
grant_type: "client_credentials",
|
|
10363
|
+
client_id: process.env.SHOPWARE_ADMIN_CLIENT_ID || "",
|
|
10364
|
+
client_secret: process.env.SHOPWARE_ADMIN_CLIENT_SECRET
|
|
10365
|
+
} : {
|
|
10366
|
+
grant_type: "password",
|
|
10367
|
+
client_id: "administration",
|
|
10368
|
+
scope: "write",
|
|
10369
|
+
username: process.env.SHOPWARE_ADMIN_USERNAME || "",
|
|
10370
|
+
password: process.env.SHOPWARE_ADMIN_PASSWORD || ""
|
|
10371
|
+
};
|
|
10799
10372
|
adminApiClient = createAdminAPIClient({
|
|
10800
10373
|
baseURL: `${process.env.OPENAPI_JSON_URL}/api`,
|
|
10801
|
-
credentials
|
|
10802
|
-
grant_type: "password",
|
|
10803
|
-
client_id: "administration",
|
|
10804
|
-
scopes: "write",
|
|
10805
|
-
username: process.env.SHOPWARE_ADMIN_USERNAME || "",
|
|
10806
|
-
password: process.env.SHOPWARE_ADMIN_PASSWORD || ""
|
|
10807
|
-
}
|
|
10374
|
+
credentials
|
|
10808
10375
|
});
|
|
10809
10376
|
}
|
|
10810
10377
|
return adminApiClient;
|
|
@@ -10819,6 +10386,29 @@ function getStoreApiClient() {
|
|
|
10819
10386
|
return storeApiClient;
|
|
10820
10387
|
}
|
|
10821
10388
|
|
|
10389
|
+
function validateAdminEnvVars(env) {
|
|
10390
|
+
const hasClientSecret = !!env.SHOPWARE_ADMIN_CLIENT_SECRET?.trim();
|
|
10391
|
+
const hasClientId = !!env.SHOPWARE_ADMIN_CLIENT_ID?.trim();
|
|
10392
|
+
if (hasClientSecret || hasClientId) {
|
|
10393
|
+
const missing2 = [];
|
|
10394
|
+
if (!hasClientId) {
|
|
10395
|
+
missing2.push("SHOPWARE_ADMIN_CLIENT_ID");
|
|
10396
|
+
}
|
|
10397
|
+
if (!hasClientSecret) {
|
|
10398
|
+
missing2.push("SHOPWARE_ADMIN_CLIENT_SECRET");
|
|
10399
|
+
}
|
|
10400
|
+
return missing2;
|
|
10401
|
+
}
|
|
10402
|
+
const missing = [];
|
|
10403
|
+
if (!env.SHOPWARE_ADMIN_USERNAME) {
|
|
10404
|
+
missing.push("SHOPWARE_ADMIN_USERNAME");
|
|
10405
|
+
}
|
|
10406
|
+
if (!env.SHOPWARE_ADMIN_PASSWORD) {
|
|
10407
|
+
missing.push("SHOPWARE_ADMIN_PASSWORD");
|
|
10408
|
+
}
|
|
10409
|
+
return missing;
|
|
10410
|
+
}
|
|
10411
|
+
|
|
10822
10412
|
const SCHEMA_ENDPOINT = "_info/openapi3.json";
|
|
10823
10413
|
const STORE_API_ENDPOINT = `/store-api/${SCHEMA_ENDPOINT}`;
|
|
10824
10414
|
const ADMIN_API_ENDPOINT = `/api/${SCHEMA_ENDPOINT}`;
|
|
@@ -10832,16 +10422,7 @@ async function loadSchema(args) {
|
|
|
10832
10422
|
const isAdminApi = args.apiType === "admin";
|
|
10833
10423
|
const outputFilename = args.filename ? args.filename : `${args.apiType}ApiSchema.json`;
|
|
10834
10424
|
const OPENAPI_JSON_URL = process.env.OPENAPI_JSON_URL;
|
|
10835
|
-
const
|
|
10836
|
-
if (isAdminApi) {
|
|
10837
|
-
requiredEnvVars.push("SHOPWARE_ADMIN_USERNAME");
|
|
10838
|
-
requiredEnvVars.push("SHOPWARE_ADMIN_PASSWORD");
|
|
10839
|
-
} else {
|
|
10840
|
-
requiredEnvVars.push("OPENAPI_ACCESS_KEY");
|
|
10841
|
-
}
|
|
10842
|
-
const missingEnvVars = requiredEnvVars.filter(
|
|
10843
|
-
(envVar) => !process.env[envVar]
|
|
10844
|
-
);
|
|
10425
|
+
const missingEnvVars = isAdminApi ? validateAdminEnvVars(process.env) : process.env.OPENAPI_ACCESS_KEY ? [] : ["OPENAPI_ACCESS_KEY"];
|
|
10845
10426
|
try {
|
|
10846
10427
|
if (missingEnvVars.length || !OPENAPI_JSON_URL) {
|
|
10847
10428
|
console.error(
|
|
@@ -10926,7 +10507,7 @@ function isUppercase(char = "") {
|
|
|
10926
10507
|
return char !== char.toLowerCase();
|
|
10927
10508
|
}
|
|
10928
10509
|
function splitByCase(str, separators) {
|
|
10929
|
-
const splitters = STR_SPLITTERS;
|
|
10510
|
+
const splitters = separators ?? STR_SPLITTERS;
|
|
10930
10511
|
const parts = [];
|
|
10931
10512
|
if (!str || typeof str !== "string") {
|
|
10932
10513
|
return parts;
|
|
@@ -10969,10 +10550,10 @@ function upperFirst(str) {
|
|
|
10969
10550
|
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
10970
10551
|
}
|
|
10971
10552
|
function pascalCase(str, opts) {
|
|
10972
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(p)).join("") : "";
|
|
10553
|
+
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
|
|
10973
10554
|
}
|
|
10974
10555
|
function kebabCase(str, joiner) {
|
|
10975
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner) : "";
|
|
10556
|
+
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
10976
10557
|
}
|
|
10977
10558
|
function snakeCase(str) {
|
|
10978
10559
|
return kebabCase(str || "", "_");
|
|
@@ -11053,7 +10634,8 @@ async function validateJson(args) {
|
|
|
11053
10634
|
if (!configJSON) {
|
|
11054
10635
|
process.exit(1);
|
|
11055
10636
|
}
|
|
11056
|
-
const
|
|
10637
|
+
const apiTypeConfig = getApiTypeConfig(configJSON, args.apiType);
|
|
10638
|
+
const rulesToProcess = apiTypeConfig.rules || [];
|
|
11057
10639
|
if (!rulesToProcess.length) {
|
|
11058
10640
|
console.error(
|
|
11059
10641
|
c.red(
|
|
@@ -11064,7 +10646,7 @@ async function validateJson(args) {
|
|
|
11064
10646
|
}
|
|
11065
10647
|
const errors = [];
|
|
11066
10648
|
const jsonOverrides = await loadJsonOverrides({
|
|
11067
|
-
paths:
|
|
10649
|
+
paths: apiTypeConfig.patches,
|
|
11068
10650
|
apiType: args.apiType
|
|
11069
10651
|
});
|
|
11070
10652
|
if (args.debug) {
|
|
@@ -11185,4 +10767,4 @@ async function validateJson(args) {
|
|
|
11185
10767
|
}
|
|
11186
10768
|
}
|
|
11187
10769
|
|
|
11188
|
-
export { generate as g, loadSchema as l, validateJson as v };
|
|
10770
|
+
export { generate as a, commonjsGlobal as c, getAugmentedNamespace as g, loadSchema as l, validateJson as v };
|