@noma.to/qwik-testing-library 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -7
- package/lib/_virtual/_commonjsHelpers.qwik.cjs +2 -0
- package/lib/_virtual/_commonjsHelpers.qwik.mjs +2 -0
- package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +4 -0
- package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +4 -0
- package/lib/index.qwik.cjs +4 -0
- package/lib/index.qwik.mjs +4 -0
- package/lib/lib/mock.qwik.cjs +14 -0
- package/lib/lib/mock.qwik.mjs +14 -0
- package/lib/lib/qwik-testing-library.qwik.cjs +4 -0
- package/lib/lib/qwik-testing-library.qwik.mjs +4 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +425 -0
- package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +425 -0
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.cjs +1967 -0
- package/lib/node_modules/.pnpm/@vitest_expect@2.1.1/node_modules/@vitest/expect/dist/index.qwik.mjs +1967 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1202 -0
- package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1202 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.cjs +665 -0
- package/lib/node_modules/.pnpm/@vitest_runner@2.1.1/node_modules/@vitest/runner/dist/index.qwik.mjs +665 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.cjs +1641 -0
- package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.1/node_modules/@vitest/snapshot/dist/index.qwik.mjs +1641 -0
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.cjs +148 -0
- package/lib/node_modules/.pnpm/@vitest_spy@2.1.1/node_modules/@vitest/spy/dist/index.qwik.mjs +148 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs +158 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs +158 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.cjs +1731 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/diff.qwik.mjs +1731 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +81 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +81 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.cjs +216 -0
- package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/source-map.qwik.mjs +216 -0
- package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.cjs +3905 -0
- package/lib/node_modules/.pnpm/chai@5.1.1/node_modules/chai/chai.qwik.mjs +3905 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/array.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/class.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.cjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/date.qwik.mjs +13 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.cjs +30 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/error.qwik.mjs +31 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.cjs +11 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/function.qwik.mjs +12 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.cjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/html.qwik.mjs +36 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.cjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs +130 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.cjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/map.qwik.mjs +26 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.cjs +19 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/number.qwik.mjs +20 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.cjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/object.qwik.mjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.cjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/promise.qwik.mjs +18 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/set.qwik.mjs +17 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.cjs +24 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/string.qwik.mjs +25 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
- package/lib/node_modules/.pnpm/loupe@3.1.1/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.cjs +968 -0
- package/lib/node_modules/.pnpm/magic-string@0.30.11/node_modules/magic-string/dist/magic-string.es.qwik.mjs +968 -0
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +101 -0
- package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +101 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +7 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +8 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
- package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
- package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +6 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +6 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +16 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +16 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +2556 -0
- package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +2556 -0
- package/lib-types/lib/mock.d.ts +34 -0
- package/lib-types/lib/qwik-testing-library.d.ts +2 -1
- package/package.json +9 -8
package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
4
|
+
function normalizeWindowsPath(input = "") {
|
|
5
|
+
if (!input) {
|
|
6
|
+
return input;
|
|
7
|
+
}
|
|
8
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
9
|
+
}
|
|
10
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
11
|
+
function cwd() {
|
|
12
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
13
|
+
return process.cwd().replace(/\\/g, "/");
|
|
14
|
+
}
|
|
15
|
+
return "/";
|
|
16
|
+
}
|
|
17
|
+
const resolve = function(...arguments_) {
|
|
18
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
19
|
+
let resolvedPath = "";
|
|
20
|
+
let resolvedAbsolute = false;
|
|
21
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
22
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
23
|
+
if (!path || path.length === 0) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
27
|
+
resolvedAbsolute = isAbsolute(path);
|
|
28
|
+
}
|
|
29
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
30
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
31
|
+
return `/${resolvedPath}`;
|
|
32
|
+
}
|
|
33
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
34
|
+
};
|
|
35
|
+
function normalizeString(path, allowAboveRoot) {
|
|
36
|
+
let res = "";
|
|
37
|
+
let lastSegmentLength = 0;
|
|
38
|
+
let lastSlash = -1;
|
|
39
|
+
let dots = 0;
|
|
40
|
+
let char = null;
|
|
41
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
42
|
+
if (index < path.length) {
|
|
43
|
+
char = path[index];
|
|
44
|
+
} else if (char === "/") {
|
|
45
|
+
break;
|
|
46
|
+
} else {
|
|
47
|
+
char = "/";
|
|
48
|
+
}
|
|
49
|
+
if (char === "/") {
|
|
50
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
51
|
+
else if (dots === 2) {
|
|
52
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
53
|
+
if (res.length > 2) {
|
|
54
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
55
|
+
if (lastSlashIndex === -1) {
|
|
56
|
+
res = "";
|
|
57
|
+
lastSegmentLength = 0;
|
|
58
|
+
} else {
|
|
59
|
+
res = res.slice(0, lastSlashIndex);
|
|
60
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
61
|
+
}
|
|
62
|
+
lastSlash = index;
|
|
63
|
+
dots = 0;
|
|
64
|
+
continue;
|
|
65
|
+
} else if (res.length > 0) {
|
|
66
|
+
res = "";
|
|
67
|
+
lastSegmentLength = 0;
|
|
68
|
+
lastSlash = index;
|
|
69
|
+
dots = 0;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (allowAboveRoot) {
|
|
74
|
+
res += res.length > 0 ? "/.." : "..";
|
|
75
|
+
lastSegmentLength = 2;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
if (res.length > 0) {
|
|
79
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
80
|
+
} else {
|
|
81
|
+
res = path.slice(lastSlash + 1, index);
|
|
82
|
+
}
|
|
83
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
84
|
+
}
|
|
85
|
+
lastSlash = index;
|
|
86
|
+
dots = 0;
|
|
87
|
+
} else if (char === "." && dots !== -1) {
|
|
88
|
+
++dots;
|
|
89
|
+
} else {
|
|
90
|
+
dots = -1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return res;
|
|
94
|
+
}
|
|
95
|
+
const isAbsolute = function(p) {
|
|
96
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
97
|
+
};
|
|
98
|
+
exports.b = normalizeString;
|
|
99
|
+
exports.i = isAbsolute;
|
|
100
|
+
exports.n = normalizeWindowsPath;
|
|
101
|
+
exports.r = resolve;
|
package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
2
|
+
function normalizeWindowsPath(input = "") {
|
|
3
|
+
if (!input) {
|
|
4
|
+
return input;
|
|
5
|
+
}
|
|
6
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
7
|
+
}
|
|
8
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
9
|
+
function cwd() {
|
|
10
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
11
|
+
return process.cwd().replace(/\\/g, "/");
|
|
12
|
+
}
|
|
13
|
+
return "/";
|
|
14
|
+
}
|
|
15
|
+
const resolve = function(...arguments_) {
|
|
16
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
17
|
+
let resolvedPath = "";
|
|
18
|
+
let resolvedAbsolute = false;
|
|
19
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
20
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
21
|
+
if (!path || path.length === 0) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
25
|
+
resolvedAbsolute = isAbsolute(path);
|
|
26
|
+
}
|
|
27
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
28
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
29
|
+
return `/${resolvedPath}`;
|
|
30
|
+
}
|
|
31
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
32
|
+
};
|
|
33
|
+
function normalizeString(path, allowAboveRoot) {
|
|
34
|
+
let res = "";
|
|
35
|
+
let lastSegmentLength = 0;
|
|
36
|
+
let lastSlash = -1;
|
|
37
|
+
let dots = 0;
|
|
38
|
+
let char = null;
|
|
39
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
40
|
+
if (index < path.length) {
|
|
41
|
+
char = path[index];
|
|
42
|
+
} else if (char === "/") {
|
|
43
|
+
break;
|
|
44
|
+
} else {
|
|
45
|
+
char = "/";
|
|
46
|
+
}
|
|
47
|
+
if (char === "/") {
|
|
48
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
49
|
+
else if (dots === 2) {
|
|
50
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
51
|
+
if (res.length > 2) {
|
|
52
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
53
|
+
if (lastSlashIndex === -1) {
|
|
54
|
+
res = "";
|
|
55
|
+
lastSegmentLength = 0;
|
|
56
|
+
} else {
|
|
57
|
+
res = res.slice(0, lastSlashIndex);
|
|
58
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
59
|
+
}
|
|
60
|
+
lastSlash = index;
|
|
61
|
+
dots = 0;
|
|
62
|
+
continue;
|
|
63
|
+
} else if (res.length > 0) {
|
|
64
|
+
res = "";
|
|
65
|
+
lastSegmentLength = 0;
|
|
66
|
+
lastSlash = index;
|
|
67
|
+
dots = 0;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (allowAboveRoot) {
|
|
72
|
+
res += res.length > 0 ? "/.." : "..";
|
|
73
|
+
lastSegmentLength = 2;
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
if (res.length > 0) {
|
|
77
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
78
|
+
} else {
|
|
79
|
+
res = path.slice(lastSlash + 1, index);
|
|
80
|
+
}
|
|
81
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
82
|
+
}
|
|
83
|
+
lastSlash = index;
|
|
84
|
+
dots = 0;
|
|
85
|
+
} else if (char === "." && dots !== -1) {
|
|
86
|
+
++dots;
|
|
87
|
+
} else {
|
|
88
|
+
dots = -1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return res;
|
|
92
|
+
}
|
|
93
|
+
const isAbsolute = function(p) {
|
|
94
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
normalizeString as b,
|
|
98
|
+
isAbsolute as i,
|
|
99
|
+
normalizeWindowsPath as n,
|
|
100
|
+
resolve as r
|
|
101
|
+
};
|
package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const chunkBVHSVHOK = require("./chunk-BVHSVHOK.qwik.cjs");
|
|
4
|
+
var f = chunkBVHSVHOK.c(false);
|
|
5
|
+
exports.createColors = chunkBVHSVHOK.c;
|
|
6
|
+
exports.isSupported = chunkBVHSVHOK.b;
|
|
7
|
+
exports.default = f;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var f = {
|
|
4
|
+
reset: [0, 0],
|
|
5
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
6
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
7
|
+
italic: [3, 23],
|
|
8
|
+
underline: [4, 24],
|
|
9
|
+
inverse: [7, 27],
|
|
10
|
+
hidden: [8, 28],
|
|
11
|
+
strikethrough: [9, 29],
|
|
12
|
+
black: [30, 39],
|
|
13
|
+
red: [31, 39],
|
|
14
|
+
green: [32, 39],
|
|
15
|
+
yellow: [33, 39],
|
|
16
|
+
blue: [34, 39],
|
|
17
|
+
magenta: [35, 39],
|
|
18
|
+
cyan: [36, 39],
|
|
19
|
+
white: [37, 39],
|
|
20
|
+
gray: [90, 39],
|
|
21
|
+
bgBlack: [40, 49],
|
|
22
|
+
bgRed: [41, 49],
|
|
23
|
+
bgGreen: [42, 49],
|
|
24
|
+
bgYellow: [43, 49],
|
|
25
|
+
bgBlue: [44, 49],
|
|
26
|
+
bgMagenta: [45, 49],
|
|
27
|
+
bgCyan: [46, 49],
|
|
28
|
+
bgWhite: [47, 49],
|
|
29
|
+
blackBright: [90, 39],
|
|
30
|
+
redBright: [91, 39],
|
|
31
|
+
greenBright: [92, 39],
|
|
32
|
+
yellowBright: [93, 39],
|
|
33
|
+
blueBright: [94, 39],
|
|
34
|
+
magentaBright: [95, 39],
|
|
35
|
+
cyanBright: [96, 39],
|
|
36
|
+
whiteBright: [97, 39],
|
|
37
|
+
bgBlackBright: [100, 49],
|
|
38
|
+
bgRedBright: [101, 49],
|
|
39
|
+
bgGreenBright: [102, 49],
|
|
40
|
+
bgYellowBright: [103, 49],
|
|
41
|
+
bgBlueBright: [104, 49],
|
|
42
|
+
bgMagentaBright: [105, 49],
|
|
43
|
+
bgCyanBright: [106, 49],
|
|
44
|
+
bgWhiteBright: [107, 49]
|
|
45
|
+
}, h = Object.entries(f);
|
|
46
|
+
function a(n) {
|
|
47
|
+
return String(n);
|
|
48
|
+
}
|
|
49
|
+
a.open = "";
|
|
50
|
+
a.close = "";
|
|
51
|
+
function C(n = false) {
|
|
52
|
+
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
53
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
54
|
+
}
|
|
55
|
+
function p(n = false) {
|
|
56
|
+
let e = C(n), i = (r, t, c, o) => {
|
|
57
|
+
let l = "", s = 0;
|
|
58
|
+
do
|
|
59
|
+
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
60
|
+
while (~o);
|
|
61
|
+
return l + r.substring(s);
|
|
62
|
+
}, g = (r, t, c = r) => {
|
|
63
|
+
let o = (l) => {
|
|
64
|
+
let s = String(l), b = s.indexOf(t, r.length);
|
|
65
|
+
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
66
|
+
};
|
|
67
|
+
return o.open = r, o.close = t, o;
|
|
68
|
+
}, u = {
|
|
69
|
+
isColorSupported: e
|
|
70
|
+
}, d = (r) => `\x1B[${r}m`;
|
|
71
|
+
for (let [r, t] of h)
|
|
72
|
+
u[r] = e ? g(
|
|
73
|
+
d(t[0]),
|
|
74
|
+
d(t[1]),
|
|
75
|
+
t[2]
|
|
76
|
+
) : a;
|
|
77
|
+
return u;
|
|
78
|
+
}
|
|
79
|
+
exports.b = C;
|
|
80
|
+
exports.c = p;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var f = {
|
|
2
|
+
reset: [0, 0],
|
|
3
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
4
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
5
|
+
italic: [3, 23],
|
|
6
|
+
underline: [4, 24],
|
|
7
|
+
inverse: [7, 27],
|
|
8
|
+
hidden: [8, 28],
|
|
9
|
+
strikethrough: [9, 29],
|
|
10
|
+
black: [30, 39],
|
|
11
|
+
red: [31, 39],
|
|
12
|
+
green: [32, 39],
|
|
13
|
+
yellow: [33, 39],
|
|
14
|
+
blue: [34, 39],
|
|
15
|
+
magenta: [35, 39],
|
|
16
|
+
cyan: [36, 39],
|
|
17
|
+
white: [37, 39],
|
|
18
|
+
gray: [90, 39],
|
|
19
|
+
bgBlack: [40, 49],
|
|
20
|
+
bgRed: [41, 49],
|
|
21
|
+
bgGreen: [42, 49],
|
|
22
|
+
bgYellow: [43, 49],
|
|
23
|
+
bgBlue: [44, 49],
|
|
24
|
+
bgMagenta: [45, 49],
|
|
25
|
+
bgCyan: [46, 49],
|
|
26
|
+
bgWhite: [47, 49],
|
|
27
|
+
blackBright: [90, 39],
|
|
28
|
+
redBright: [91, 39],
|
|
29
|
+
greenBright: [92, 39],
|
|
30
|
+
yellowBright: [93, 39],
|
|
31
|
+
blueBright: [94, 39],
|
|
32
|
+
magentaBright: [95, 39],
|
|
33
|
+
cyanBright: [96, 39],
|
|
34
|
+
whiteBright: [97, 39],
|
|
35
|
+
bgBlackBright: [100, 49],
|
|
36
|
+
bgRedBright: [101, 49],
|
|
37
|
+
bgGreenBright: [102, 49],
|
|
38
|
+
bgYellowBright: [103, 49],
|
|
39
|
+
bgBlueBright: [104, 49],
|
|
40
|
+
bgMagentaBright: [105, 49],
|
|
41
|
+
bgCyanBright: [106, 49],
|
|
42
|
+
bgWhiteBright: [107, 49]
|
|
43
|
+
}, h = Object.entries(f);
|
|
44
|
+
function a(n) {
|
|
45
|
+
return String(n);
|
|
46
|
+
}
|
|
47
|
+
a.open = "";
|
|
48
|
+
a.close = "";
|
|
49
|
+
function C(n = false) {
|
|
50
|
+
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
51
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
52
|
+
}
|
|
53
|
+
function p(n = false) {
|
|
54
|
+
let e = C(n), i = (r, t, c, o) => {
|
|
55
|
+
let l = "", s = 0;
|
|
56
|
+
do
|
|
57
|
+
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
58
|
+
while (~o);
|
|
59
|
+
return l + r.substring(s);
|
|
60
|
+
}, g = (r, t, c = r) => {
|
|
61
|
+
let o = (l) => {
|
|
62
|
+
let s = String(l), b = s.indexOf(t, r.length);
|
|
63
|
+
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
64
|
+
};
|
|
65
|
+
return o.open = r, o.close = t, o;
|
|
66
|
+
}, u = {
|
|
67
|
+
isColorSupported: e
|
|
68
|
+
}, d = (r) => `\x1B[${r}m`;
|
|
69
|
+
for (let [r, t] of h)
|
|
70
|
+
u[r] = e ? g(
|
|
71
|
+
d(t[0]),
|
|
72
|
+
d(t[1]),
|
|
73
|
+
t[2]
|
|
74
|
+
) : a;
|
|
75
|
+
return u;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
C as b,
|
|
79
|
+
p as c
|
|
80
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function d(e, t) {
|
|
4
|
+
if (!e)
|
|
5
|
+
throw new Error(t);
|
|
6
|
+
}
|
|
7
|
+
function y(e, t) {
|
|
8
|
+
return typeof t === e;
|
|
9
|
+
}
|
|
10
|
+
function w(e) {
|
|
11
|
+
return e instanceof Promise;
|
|
12
|
+
}
|
|
13
|
+
function f(e, t, n) {
|
|
14
|
+
Object.defineProperty(e, t, n);
|
|
15
|
+
}
|
|
16
|
+
function l(e, t, n) {
|
|
17
|
+
Object.defineProperty(e, t, { value: n });
|
|
18
|
+
}
|
|
19
|
+
var u = Symbol.for("tinyspy:spy");
|
|
20
|
+
var x = /* @__PURE__ */ new Set(), P = (e) => {
|
|
21
|
+
e.called = false, e.callCount = 0, e.calls = [], e.results = [], e.resolves = [], e.next = [];
|
|
22
|
+
}, K = (e) => (f(e, u, { value: { reset: () => P(e[u]) } }), e[u]), T = (e) => e[u] || K(e);
|
|
23
|
+
function m(e) {
|
|
24
|
+
d(
|
|
25
|
+
y("function", e) || y("undefined", e),
|
|
26
|
+
"cannot spy on a non-function value"
|
|
27
|
+
);
|
|
28
|
+
let t = function(...s) {
|
|
29
|
+
let r = T(t);
|
|
30
|
+
r.called = true, r.callCount++, r.calls.push(s);
|
|
31
|
+
let S = r.next.shift();
|
|
32
|
+
if (S) {
|
|
33
|
+
r.results.push(S);
|
|
34
|
+
let [o, g] = S;
|
|
35
|
+
if (o === "ok")
|
|
36
|
+
return g;
|
|
37
|
+
throw g;
|
|
38
|
+
}
|
|
39
|
+
let p, c = "ok", a = r.results.length;
|
|
40
|
+
if (r.impl)
|
|
41
|
+
try {
|
|
42
|
+
new.target ? p = Reflect.construct(r.impl, s, new.target) : p = r.impl.apply(this, s), c = "ok";
|
|
43
|
+
} catch (o) {
|
|
44
|
+
throw p = o, c = "error", r.results.push([c, o]), o;
|
|
45
|
+
}
|
|
46
|
+
let R = [c, p];
|
|
47
|
+
return w(p) && p.then(
|
|
48
|
+
(o) => r.resolves[a] = ["ok", o],
|
|
49
|
+
(o) => r.resolves[a] = ["error", o]
|
|
50
|
+
), r.results.push(R), p;
|
|
51
|
+
};
|
|
52
|
+
l(t, "_isMockFunction", true), l(t, "length", e ? e.length : 0), l(t, "name", e && e.name || "spy");
|
|
53
|
+
let n = T(t);
|
|
54
|
+
return n.reset(), n.impl = e, t;
|
|
55
|
+
}
|
|
56
|
+
var k = (e, t) => Object.getOwnPropertyDescriptor(e, t), O = (e, t) => {
|
|
57
|
+
t != null && typeof t == "function" && t.prototype != null && Object.setPrototypeOf(e.prototype, t.prototype);
|
|
58
|
+
};
|
|
59
|
+
function C(e, t, n) {
|
|
60
|
+
d(
|
|
61
|
+
!y("undefined", e),
|
|
62
|
+
"spyOn could not find an object to spy upon"
|
|
63
|
+
), d(
|
|
64
|
+
y("object", e) || y("function", e),
|
|
65
|
+
"cannot spyOn on a primitive value"
|
|
66
|
+
);
|
|
67
|
+
let [s, r] = (() => {
|
|
68
|
+
if (!y("object", t))
|
|
69
|
+
return [t, "value"];
|
|
70
|
+
if ("getter" in t && "setter" in t)
|
|
71
|
+
throw new Error("cannot spy on both getter and setter");
|
|
72
|
+
if ("getter" in t)
|
|
73
|
+
return [t.getter, "get"];
|
|
74
|
+
if ("setter" in t)
|
|
75
|
+
return [t.setter, "set"];
|
|
76
|
+
throw new Error("specify getter or setter to spy on");
|
|
77
|
+
})(), S = k(e, s), p = Object.getPrototypeOf(e), c = p && k(p, s), a = S || c;
|
|
78
|
+
d(
|
|
79
|
+
a || s in e,
|
|
80
|
+
`${String(s)} does not exist`
|
|
81
|
+
);
|
|
82
|
+
let R = false;
|
|
83
|
+
r === "value" && a && !a.value && a.get && (r = "get", R = true, n = a.get());
|
|
84
|
+
let o;
|
|
85
|
+
a ? o = a[r] : r !== "value" ? o = () => e[s] : o = e[s];
|
|
86
|
+
let g = (v) => {
|
|
87
|
+
let { value: M, ...h } = a || {
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true
|
|
90
|
+
};
|
|
91
|
+
r !== "value" && delete h.writable, h[r] = v, f(e, s, h);
|
|
92
|
+
}, b = () => a ? f(e, s, a) : g(o);
|
|
93
|
+
n || (n = o);
|
|
94
|
+
let i = m(n);
|
|
95
|
+
r === "value" && O(i, o);
|
|
96
|
+
let I = i[u];
|
|
97
|
+
return l(I, "restore", b), l(I, "getOriginal", () => R ? o() : o), l(I, "willCall", (v) => (I.impl = v, i)), g(
|
|
98
|
+
R ? () => (O(i, n), i) : i
|
|
99
|
+
), x.add(i), i;
|
|
100
|
+
}
|
|
101
|
+
exports.createInternalSpy = m;
|
|
102
|
+
exports.getInternalState = T;
|
|
103
|
+
exports.internalSpyOn = C;
|
|
104
|
+
exports.spies = x;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
function d(e, t) {
|
|
2
|
+
if (!e)
|
|
3
|
+
throw new Error(t);
|
|
4
|
+
}
|
|
5
|
+
function y(e, t) {
|
|
6
|
+
return typeof t === e;
|
|
7
|
+
}
|
|
8
|
+
function w(e) {
|
|
9
|
+
return e instanceof Promise;
|
|
10
|
+
}
|
|
11
|
+
function f(e, t, n) {
|
|
12
|
+
Object.defineProperty(e, t, n);
|
|
13
|
+
}
|
|
14
|
+
function l(e, t, n) {
|
|
15
|
+
Object.defineProperty(e, t, { value: n });
|
|
16
|
+
}
|
|
17
|
+
var u = Symbol.for("tinyspy:spy");
|
|
18
|
+
var x = /* @__PURE__ */ new Set(), P = (e) => {
|
|
19
|
+
e.called = false, e.callCount = 0, e.calls = [], e.results = [], e.resolves = [], e.next = [];
|
|
20
|
+
}, K = (e) => (f(e, u, { value: { reset: () => P(e[u]) } }), e[u]), T = (e) => e[u] || K(e);
|
|
21
|
+
function m(e) {
|
|
22
|
+
d(
|
|
23
|
+
y("function", e) || y("undefined", e),
|
|
24
|
+
"cannot spy on a non-function value"
|
|
25
|
+
);
|
|
26
|
+
let t = function(...s) {
|
|
27
|
+
let r = T(t);
|
|
28
|
+
r.called = true, r.callCount++, r.calls.push(s);
|
|
29
|
+
let S = r.next.shift();
|
|
30
|
+
if (S) {
|
|
31
|
+
r.results.push(S);
|
|
32
|
+
let [o, g] = S;
|
|
33
|
+
if (o === "ok")
|
|
34
|
+
return g;
|
|
35
|
+
throw g;
|
|
36
|
+
}
|
|
37
|
+
let p, c = "ok", a = r.results.length;
|
|
38
|
+
if (r.impl)
|
|
39
|
+
try {
|
|
40
|
+
new.target ? p = Reflect.construct(r.impl, s, new.target) : p = r.impl.apply(this, s), c = "ok";
|
|
41
|
+
} catch (o) {
|
|
42
|
+
throw p = o, c = "error", r.results.push([c, o]), o;
|
|
43
|
+
}
|
|
44
|
+
let R = [c, p];
|
|
45
|
+
return w(p) && p.then(
|
|
46
|
+
(o) => r.resolves[a] = ["ok", o],
|
|
47
|
+
(o) => r.resolves[a] = ["error", o]
|
|
48
|
+
), r.results.push(R), p;
|
|
49
|
+
};
|
|
50
|
+
l(t, "_isMockFunction", true), l(t, "length", e ? e.length : 0), l(t, "name", e && e.name || "spy");
|
|
51
|
+
let n = T(t);
|
|
52
|
+
return n.reset(), n.impl = e, t;
|
|
53
|
+
}
|
|
54
|
+
var k = (e, t) => Object.getOwnPropertyDescriptor(e, t), O = (e, t) => {
|
|
55
|
+
t != null && typeof t == "function" && t.prototype != null && Object.setPrototypeOf(e.prototype, t.prototype);
|
|
56
|
+
};
|
|
57
|
+
function C(e, t, n) {
|
|
58
|
+
d(
|
|
59
|
+
!y("undefined", e),
|
|
60
|
+
"spyOn could not find an object to spy upon"
|
|
61
|
+
), d(
|
|
62
|
+
y("object", e) || y("function", e),
|
|
63
|
+
"cannot spyOn on a primitive value"
|
|
64
|
+
);
|
|
65
|
+
let [s, r] = (() => {
|
|
66
|
+
if (!y("object", t))
|
|
67
|
+
return [t, "value"];
|
|
68
|
+
if ("getter" in t && "setter" in t)
|
|
69
|
+
throw new Error("cannot spy on both getter and setter");
|
|
70
|
+
if ("getter" in t)
|
|
71
|
+
return [t.getter, "get"];
|
|
72
|
+
if ("setter" in t)
|
|
73
|
+
return [t.setter, "set"];
|
|
74
|
+
throw new Error("specify getter or setter to spy on");
|
|
75
|
+
})(), S = k(e, s), p = Object.getPrototypeOf(e), c = p && k(p, s), a = S || c;
|
|
76
|
+
d(
|
|
77
|
+
a || s in e,
|
|
78
|
+
`${String(s)} does not exist`
|
|
79
|
+
);
|
|
80
|
+
let R = false;
|
|
81
|
+
r === "value" && a && !a.value && a.get && (r = "get", R = true, n = a.get());
|
|
82
|
+
let o;
|
|
83
|
+
a ? o = a[r] : r !== "value" ? o = () => e[s] : o = e[s];
|
|
84
|
+
let g = (v) => {
|
|
85
|
+
let { value: M, ...h } = a || {
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true
|
|
88
|
+
};
|
|
89
|
+
r !== "value" && delete h.writable, h[r] = v, f(e, s, h);
|
|
90
|
+
}, b = () => a ? f(e, s, a) : g(o);
|
|
91
|
+
n || (n = o);
|
|
92
|
+
let i = m(n);
|
|
93
|
+
r === "value" && O(i, o);
|
|
94
|
+
let I = i[u];
|
|
95
|
+
return l(I, "restore", b), l(I, "getOriginal", () => R ? o() : o), l(I, "willCall", (v) => (I.impl = v, i)), g(
|
|
96
|
+
R ? () => (O(i, n), i) : i
|
|
97
|
+
), x.add(i), i;
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
m as createInternalSpy,
|
|
101
|
+
T as getInternalState,
|
|
102
|
+
C as internalSpyOn,
|
|
103
|
+
x as spies
|
|
104
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
4
|
+
function getDefaultExportFromCjs(x) {
|
|
5
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6
|
+
}
|
|
7
|
+
exports.c = commonjsGlobal;
|
|
8
|
+
exports.g = getDefaultExportFromCjs;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
+
function getDefaultExportFromCjs(x) {
|
|
3
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
commonjsGlobal as c,
|
|
7
|
+
getDefaultExportFromCjs as g
|
|
8
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const RealDate = Date;
|
|
4
|
+
let now = null;
|
|
5
|
+
class MockDate extends RealDate {
|
|
6
|
+
constructor(y, m, d, h, M, s, ms) {
|
|
7
|
+
super();
|
|
8
|
+
let date;
|
|
9
|
+
switch (arguments.length) {
|
|
10
|
+
case 0:
|
|
11
|
+
if (now !== null) {
|
|
12
|
+
date = new RealDate(now.valueOf());
|
|
13
|
+
} else {
|
|
14
|
+
date = new RealDate();
|
|
15
|
+
}
|
|
16
|
+
break;
|
|
17
|
+
case 1:
|
|
18
|
+
date = new RealDate(y);
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
d = typeof d === "undefined" ? 1 : d;
|
|
22
|
+
h = h || 0;
|
|
23
|
+
M = M || 0;
|
|
24
|
+
s = s || 0;
|
|
25
|
+
ms = ms || 0;
|
|
26
|
+
date = new RealDate(y, m, d, h, M, s, ms);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
Object.setPrototypeOf(date, MockDate.prototype);
|
|
30
|
+
return date;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
MockDate.UTC = RealDate.UTC;
|
|
34
|
+
MockDate.now = function() {
|
|
35
|
+
return new MockDate().valueOf();
|
|
36
|
+
};
|
|
37
|
+
MockDate.parse = function(dateString) {
|
|
38
|
+
return RealDate.parse(dateString);
|
|
39
|
+
};
|
|
40
|
+
MockDate.toString = function() {
|
|
41
|
+
return RealDate.toString();
|
|
42
|
+
};
|
|
43
|
+
function mockDate(date) {
|
|
44
|
+
const dateObj = new RealDate(date.valueOf());
|
|
45
|
+
if (Number.isNaN(dateObj.getTime())) {
|
|
46
|
+
throw new TypeError(`mockdate: The time set is an invalid date: ${date}`);
|
|
47
|
+
}
|
|
48
|
+
globalThis.Date = MockDate;
|
|
49
|
+
now = dateObj.valueOf();
|
|
50
|
+
}
|
|
51
|
+
function resetDate() {
|
|
52
|
+
globalThis.Date = RealDate;
|
|
53
|
+
}
|
|
54
|
+
exports.R = RealDate;
|
|
55
|
+
exports.m = mockDate;
|
|
56
|
+
exports.r = resetDate;
|