@noma.to/qwik-testing-library 1.3.0 → 1.3.2

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.
Files changed (96) hide show
  1. package/README.md +12 -2
  2. package/lib/index.qwik.cjs +0 -4
  3. package/lib/index.qwik.mjs +0 -4
  4. package/lib/lib/qwik-testing-library.qwik.cjs +1 -5
  5. package/lib/lib/qwik-testing-library.qwik.mjs +2 -6
  6. package/lib/lib/qwikloader.qwik.cjs +1 -1
  7. package/lib/lib/qwikloader.qwik.mjs +1 -1
  8. package/lib-types/lib/qwik-testing-library.d.ts +1 -2
  9. package/package.json +9 -9
  10. package/lib/lib/mock.qwik.cjs +0 -14
  11. package/lib/lib/mock.qwik.mjs +0 -14
  12. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +0 -89
  13. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +0 -89
  14. package/lib/node_modules/.pnpm/@vitest_expect@2.1.8/node_modules/@vitest/expect/dist/index.qwik.cjs +0 -2051
  15. package/lib/node_modules/.pnpm/@vitest_expect@2.1.8/node_modules/@vitest/expect/dist/index.qwik.mjs +0 -2051
  16. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +0 -1208
  17. package/lib/node_modules/.pnpm/@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +0 -1208
  18. package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +0 -44
  19. package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +0 -44
  20. package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/index.qwik.cjs +0 -671
  21. package/lib/node_modules/.pnpm/@vitest_runner@2.1.8/node_modules/@vitest/runner/dist/index.qwik.mjs +0 -671
  22. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.8/node_modules/@vitest/snapshot/dist/index.qwik.cjs +0 -2044
  23. package/lib/node_modules/.pnpm/@vitest_snapshot@2.1.8/node_modules/@vitest/snapshot/dist/index.qwik.mjs +0 -2044
  24. package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.cjs +0 -148
  25. package/lib/node_modules/.pnpm/@vitest_spy@2.1.8/node_modules/@vitest/spy/dist/index.qwik.mjs +0 -148
  26. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +0 -162
  27. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +0 -162
  28. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/diff.qwik.cjs +0 -1739
  29. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/diff.qwik.mjs +0 -1739
  30. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/error.qwik.cjs +0 -137
  31. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/error.qwik.mjs +0 -137
  32. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/helpers.qwik.cjs +0 -150
  33. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/helpers.qwik.mjs +0 -150
  34. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -472
  35. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -472
  36. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/source-map.qwik.cjs +0 -216
  37. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/source-map.qwik.mjs +0 -216
  38. package/lib/node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.qwik.cjs +0 -3937
  39. package/lib/node_modules/.pnpm/chai@5.1.2/node_modules/chai/chai.qwik.mjs +0 -3937
  40. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/arguments.qwik.cjs +0 -9
  41. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/arguments.qwik.mjs +0 -10
  42. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/array.qwik.cjs +0 -16
  43. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/array.qwik.mjs +0 -17
  44. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/bigint.qwik.cjs +0 -9
  45. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/bigint.qwik.mjs +0 -10
  46. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/class.qwik.cjs +0 -16
  47. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/class.qwik.mjs +0 -17
  48. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/date.qwik.cjs +0 -12
  49. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/date.qwik.mjs +0 -13
  50. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/error.qwik.cjs +0 -36
  51. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/error.qwik.mjs +0 -37
  52. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/function.qwik.cjs +0 -11
  53. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/function.qwik.mjs +0 -12
  54. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/helpers.qwik.cjs +0 -160
  55. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/helpers.qwik.mjs +0 -160
  56. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/html.qwik.cjs +0 -36
  57. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/html.qwik.mjs +0 -36
  58. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/index.qwik.cjs +0 -130
  59. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs +0 -130
  60. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/map.qwik.cjs +0 -25
  61. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/map.qwik.mjs +0 -26
  62. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/number.qwik.cjs +0 -19
  63. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/number.qwik.mjs +0 -20
  64. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/object.qwik.cjs +0 -24
  65. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/object.qwik.mjs +0 -25
  66. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/promise.qwik.cjs +0 -17
  67. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/promise.qwik.mjs +0 -18
  68. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/regexp.qwik.cjs +0 -9
  69. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/regexp.qwik.mjs +0 -10
  70. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/set.qwik.cjs +0 -16
  71. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/set.qwik.mjs +0 -17
  72. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/string.qwik.cjs +0 -23
  73. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/string.qwik.mjs +0 -24
  74. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/symbol.qwik.cjs +0 -8
  75. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/symbol.qwik.mjs +0 -9
  76. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/typedarray.qwik.cjs +0 -34
  77. package/lib/node_modules/.pnpm/loupe@3.1.2/node_modules/loupe/lib/typedarray.qwik.mjs +0 -35
  78. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs +0 -979
  79. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.mjs +0 -979
  80. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.cjs +0 -101
  81. package/lib/node_modules/.pnpm/pathe@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.qwik.mjs +0 -101
  82. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +0 -7
  83. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +0 -8
  84. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +0 -80
  85. package/lib/node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +0 -80
  86. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +0 -104
  87. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +0 -104
  88. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -8
  89. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -8
  90. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -56
  91. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -56
  92. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +0 -66
  93. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +0 -66
  94. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.cjs +0 -2749
  95. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.mjs +0 -2749
  96. package/lib-types/lib/mock.d.ts +0 -34
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const diff = require("./diff.qwik.cjs");
4
- const chunk_commonjsHelpers = require("./chunk-_commonjsHelpers.qwik.cjs");
5
- require("../../../../../tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.cjs");
6
- require("../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.cjs");
7
- const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
8
- const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
9
- function isImmutable(v) {
10
- return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
11
- }
12
- const OBJECT_PROTO = Object.getPrototypeOf({});
13
- function getUnserializableMessage(err) {
14
- if (err instanceof Error) {
15
- return `<unserializable>: ${err.message}`;
16
- }
17
- if (typeof err === "string") {
18
- return `<unserializable>: ${err}`;
19
- }
20
- return "<unserializable>";
21
- }
22
- function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
23
- if (!val || typeof val === "string") {
24
- return val;
25
- }
26
- if (typeof val === "function") {
27
- return `Function<${val.name || "anonymous"}>`;
28
- }
29
- if (typeof val === "symbol") {
30
- return val.toString();
31
- }
32
- if (typeof val !== "object") {
33
- return val;
34
- }
35
- if (isImmutable(val)) {
36
- return serializeValue(val.toJSON(), seen);
37
- }
38
- if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") {
39
- return "Promise";
40
- }
41
- if (typeof Element !== "undefined" && val instanceof Element) {
42
- return val.tagName;
43
- }
44
- if (typeof val.asymmetricMatch === "function") {
45
- return `${val.toString()} ${chunk_commonjsHelpers.f(val.sample)}`;
46
- }
47
- if (typeof val.toJSON === "function") {
48
- return serializeValue(val.toJSON(), seen);
49
- }
50
- if (seen.has(val)) {
51
- return seen.get(val);
52
- }
53
- if (Array.isArray(val)) {
54
- const clone = new Array(val.length);
55
- seen.set(val, clone);
56
- val.forEach((e, i) => {
57
- try {
58
- clone[i] = serializeValue(e, seen);
59
- } catch (err) {
60
- clone[i] = getUnserializableMessage(err);
61
- }
62
- });
63
- return clone;
64
- } else {
65
- const clone = /* @__PURE__ */ Object.create(null);
66
- seen.set(val, clone);
67
- let obj = val;
68
- while (obj && obj !== OBJECT_PROTO) {
69
- Object.getOwnPropertyNames(obj).forEach((key) => {
70
- if (key in clone) {
71
- return;
72
- }
73
- try {
74
- clone[key] = serializeValue(val[key], seen);
75
- } catch (err) {
76
- delete clone[key];
77
- clone[key] = getUnserializableMessage(err);
78
- }
79
- });
80
- obj = Object.getPrototypeOf(obj);
81
- }
82
- return clone;
83
- }
84
- }
85
- function normalizeErrorMessage(message) {
86
- return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
87
- }
88
- function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
89
- if (!_err || typeof _err !== "object") {
90
- return { message: String(_err) };
91
- }
92
- const err = _err;
93
- if (err.stack) {
94
- err.stackStr = String(err.stack);
95
- }
96
- if (err.name) {
97
- err.nameStr = String(err.name);
98
- }
99
- if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) {
100
- err.diff = diff.printDiffOrStringify(err.actual, err.expected, {
101
- ...diffOptions,
102
- ...err.diffOptions
103
- });
104
- }
105
- if (typeof err.expected !== "string") {
106
- err.expected = chunk_commonjsHelpers.s(err.expected, 10);
107
- }
108
- if (typeof err.actual !== "string") {
109
- err.actual = chunk_commonjsHelpers.s(err.actual, 10);
110
- }
111
- try {
112
- if (typeof err.message === "string") {
113
- err.message = normalizeErrorMessage(err.message);
114
- }
115
- } catch {
116
- }
117
- try {
118
- if (!seen.has(err) && typeof err.cause === "object") {
119
- seen.add(err);
120
- err.cause = processError(err.cause, diffOptions, seen);
121
- }
122
- } catch {
123
- }
124
- try {
125
- return serializeValue(err);
126
- } catch (e) {
127
- return serializeValue(
128
- new Error(
129
- `Failed to fully serialize error: ${e == null ? void 0 : e.message}
130
- Inner error message: ${err == null ? void 0 : err.message}`
131
- )
132
- );
133
- }
134
- }
135
- exports.processError = processError;
136
- exports.serializeError = serializeValue;
137
- exports.serializeValue = serializeValue;
@@ -1,137 +0,0 @@
1
- import { printDiffOrStringify } from "./diff.qwik.mjs";
2
- import { s as stringify, f as format } from "./chunk-_commonjsHelpers.qwik.mjs";
3
- import "../../../../../tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs";
4
- import "../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs";
5
- const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
6
- const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
7
- function isImmutable(v) {
8
- return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
9
- }
10
- const OBJECT_PROTO = Object.getPrototypeOf({});
11
- function getUnserializableMessage(err) {
12
- if (err instanceof Error) {
13
- return `<unserializable>: ${err.message}`;
14
- }
15
- if (typeof err === "string") {
16
- return `<unserializable>: ${err}`;
17
- }
18
- return "<unserializable>";
19
- }
20
- function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
21
- if (!val || typeof val === "string") {
22
- return val;
23
- }
24
- if (typeof val === "function") {
25
- return `Function<${val.name || "anonymous"}>`;
26
- }
27
- if (typeof val === "symbol") {
28
- return val.toString();
29
- }
30
- if (typeof val !== "object") {
31
- return val;
32
- }
33
- if (isImmutable(val)) {
34
- return serializeValue(val.toJSON(), seen);
35
- }
36
- if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") {
37
- return "Promise";
38
- }
39
- if (typeof Element !== "undefined" && val instanceof Element) {
40
- return val.tagName;
41
- }
42
- if (typeof val.asymmetricMatch === "function") {
43
- return `${val.toString()} ${format(val.sample)}`;
44
- }
45
- if (typeof val.toJSON === "function") {
46
- return serializeValue(val.toJSON(), seen);
47
- }
48
- if (seen.has(val)) {
49
- return seen.get(val);
50
- }
51
- if (Array.isArray(val)) {
52
- const clone = new Array(val.length);
53
- seen.set(val, clone);
54
- val.forEach((e, i) => {
55
- try {
56
- clone[i] = serializeValue(e, seen);
57
- } catch (err) {
58
- clone[i] = getUnserializableMessage(err);
59
- }
60
- });
61
- return clone;
62
- } else {
63
- const clone = /* @__PURE__ */ Object.create(null);
64
- seen.set(val, clone);
65
- let obj = val;
66
- while (obj && obj !== OBJECT_PROTO) {
67
- Object.getOwnPropertyNames(obj).forEach((key) => {
68
- if (key in clone) {
69
- return;
70
- }
71
- try {
72
- clone[key] = serializeValue(val[key], seen);
73
- } catch (err) {
74
- delete clone[key];
75
- clone[key] = getUnserializableMessage(err);
76
- }
77
- });
78
- obj = Object.getPrototypeOf(obj);
79
- }
80
- return clone;
81
- }
82
- }
83
- function normalizeErrorMessage(message) {
84
- return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
85
- }
86
- function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
87
- if (!_err || typeof _err !== "object") {
88
- return { message: String(_err) };
89
- }
90
- const err = _err;
91
- if (err.stack) {
92
- err.stackStr = String(err.stack);
93
- }
94
- if (err.name) {
95
- err.nameStr = String(err.name);
96
- }
97
- if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) {
98
- err.diff = printDiffOrStringify(err.actual, err.expected, {
99
- ...diffOptions,
100
- ...err.diffOptions
101
- });
102
- }
103
- if (typeof err.expected !== "string") {
104
- err.expected = stringify(err.expected, 10);
105
- }
106
- if (typeof err.actual !== "string") {
107
- err.actual = stringify(err.actual, 10);
108
- }
109
- try {
110
- if (typeof err.message === "string") {
111
- err.message = normalizeErrorMessage(err.message);
112
- }
113
- } catch {
114
- }
115
- try {
116
- if (!seen.has(err) && typeof err.cause === "object") {
117
- seen.add(err);
118
- err.cause = processError(err.cause, diffOptions, seen);
119
- }
120
- } catch {
121
- }
122
- try {
123
- return serializeValue(err);
124
- } catch (e) {
125
- return serializeValue(
126
- new Error(
127
- `Failed to fully serialize error: ${e == null ? void 0 : e.message}
128
- Inner error message: ${err == null ? void 0 : err.message}`
129
- )
130
- );
131
- }
132
- }
133
- export {
134
- processError,
135
- serializeValue as serializeError,
136
- serializeValue
137
- };
@@ -1,150 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function createSimpleStackTrace(options) {
4
- const { message = "$$stack trace error", stackTraceLimit = 1 } = options;
5
- const limit = Error.stackTraceLimit;
6
- const prepareStackTrace = Error.prepareStackTrace;
7
- Error.stackTraceLimit = stackTraceLimit;
8
- Error.prepareStackTrace = (e) => e.stack;
9
- const err = new Error(message);
10
- const stackTrace = err.stack || "";
11
- Error.prepareStackTrace = prepareStackTrace;
12
- Error.stackTraceLimit = limit;
13
- return stackTrace;
14
- }
15
- function assertTypes(value, name, types) {
16
- const receivedType = typeof value;
17
- const pass = types.includes(receivedType);
18
- if (!pass) {
19
- throw new TypeError(
20
- `${name} value must be ${types.join(" or ")}, received "${receivedType}"`
21
- );
22
- }
23
- }
24
- function toArray(array) {
25
- if (array === null || array === void 0) {
26
- array = [];
27
- }
28
- if (Array.isArray(array)) {
29
- return array;
30
- }
31
- return [array];
32
- }
33
- function isObject(item) {
34
- return item != null && typeof item === "object" && !Array.isArray(item);
35
- }
36
- function isFinalObj(obj) {
37
- return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
38
- }
39
- function getType(value) {
40
- return Object.prototype.toString.apply(value).slice(8, -1);
41
- }
42
- function collectOwnProperties(obj, collector) {
43
- const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
44
- Object.getOwnPropertyNames(obj).forEach(collect);
45
- Object.getOwnPropertySymbols(obj).forEach(collect);
46
- }
47
- function getOwnProperties(obj) {
48
- const ownProps = /* @__PURE__ */ new Set();
49
- if (isFinalObj(obj)) {
50
- return [];
51
- }
52
- collectOwnProperties(obj, ownProps);
53
- return Array.from(ownProps);
54
- }
55
- const defaultCloneOptions = { forceWritable: false };
56
- function deepClone(val, options = defaultCloneOptions) {
57
- const seen = /* @__PURE__ */ new WeakMap();
58
- return clone(val, seen, options);
59
- }
60
- function clone(val, seen, options = defaultCloneOptions) {
61
- let k, out;
62
- if (seen.has(val)) {
63
- return seen.get(val);
64
- }
65
- if (Array.isArray(val)) {
66
- out = Array.from({ length: k = val.length });
67
- seen.set(val, out);
68
- while (k--) {
69
- out[k] = clone(val[k], seen, options);
70
- }
71
- return out;
72
- }
73
- if (Object.prototype.toString.call(val) === "[object Object]") {
74
- out = Object.create(Object.getPrototypeOf(val));
75
- seen.set(val, out);
76
- const props = getOwnProperties(val);
77
- for (const k2 of props) {
78
- const descriptor = Object.getOwnPropertyDescriptor(val, k2);
79
- if (!descriptor) {
80
- continue;
81
- }
82
- const cloned = clone(val[k2], seen, options);
83
- if (options.forceWritable) {
84
- Object.defineProperty(out, k2, {
85
- enumerable: descriptor.enumerable,
86
- configurable: true,
87
- writable: true,
88
- value: cloned
89
- });
90
- } else if ("get" in descriptor) {
91
- Object.defineProperty(out, k2, {
92
- ...descriptor,
93
- get() {
94
- return cloned;
95
- }
96
- });
97
- } else {
98
- Object.defineProperty(out, k2, {
99
- ...descriptor,
100
- value: cloned
101
- });
102
- }
103
- }
104
- return out;
105
- }
106
- return val;
107
- }
108
- function objectAttr(source, path, defaultValue = void 0) {
109
- const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
110
- let result = source;
111
- for (const p of paths) {
112
- result = new Object(result)[p];
113
- if (result === void 0) {
114
- return defaultValue;
115
- }
116
- }
117
- return result;
118
- }
119
- function createDefer() {
120
- let resolve = null;
121
- let reject = null;
122
- const p = new Promise((_resolve, _reject) => {
123
- resolve = _resolve;
124
- reject = _reject;
125
- });
126
- p.resolve = resolve;
127
- p.reject = reject;
128
- return p;
129
- }
130
- function isNegativeNaN(val) {
131
- if (!Number.isNaN(val)) {
132
- return false;
133
- }
134
- const f64 = new Float64Array(1);
135
- f64[0] = val;
136
- const u32 = new Uint32Array(f64.buffer);
137
- const isNegative = u32[1] >>> 31 === 1;
138
- return isNegative;
139
- }
140
- exports.assertTypes = assertTypes;
141
- exports.clone = clone;
142
- exports.createDefer = createDefer;
143
- exports.createSimpleStackTrace = createSimpleStackTrace;
144
- exports.deepClone = deepClone;
145
- exports.getOwnProperties = getOwnProperties;
146
- exports.getType = getType;
147
- exports.isNegativeNaN = isNegativeNaN;
148
- exports.isObject = isObject;
149
- exports.objectAttr = objectAttr;
150
- exports.toArray = toArray;
@@ -1,150 +0,0 @@
1
- function createSimpleStackTrace(options) {
2
- const { message = "$$stack trace error", stackTraceLimit = 1 } = options;
3
- const limit = Error.stackTraceLimit;
4
- const prepareStackTrace = Error.prepareStackTrace;
5
- Error.stackTraceLimit = stackTraceLimit;
6
- Error.prepareStackTrace = (e) => e.stack;
7
- const err = new Error(message);
8
- const stackTrace = err.stack || "";
9
- Error.prepareStackTrace = prepareStackTrace;
10
- Error.stackTraceLimit = limit;
11
- return stackTrace;
12
- }
13
- function assertTypes(value, name, types) {
14
- const receivedType = typeof value;
15
- const pass = types.includes(receivedType);
16
- if (!pass) {
17
- throw new TypeError(
18
- `${name} value must be ${types.join(" or ")}, received "${receivedType}"`
19
- );
20
- }
21
- }
22
- function toArray(array) {
23
- if (array === null || array === void 0) {
24
- array = [];
25
- }
26
- if (Array.isArray(array)) {
27
- return array;
28
- }
29
- return [array];
30
- }
31
- function isObject(item) {
32
- return item != null && typeof item === "object" && !Array.isArray(item);
33
- }
34
- function isFinalObj(obj) {
35
- return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
36
- }
37
- function getType(value) {
38
- return Object.prototype.toString.apply(value).slice(8, -1);
39
- }
40
- function collectOwnProperties(obj, collector) {
41
- const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
42
- Object.getOwnPropertyNames(obj).forEach(collect);
43
- Object.getOwnPropertySymbols(obj).forEach(collect);
44
- }
45
- function getOwnProperties(obj) {
46
- const ownProps = /* @__PURE__ */ new Set();
47
- if (isFinalObj(obj)) {
48
- return [];
49
- }
50
- collectOwnProperties(obj, ownProps);
51
- return Array.from(ownProps);
52
- }
53
- const defaultCloneOptions = { forceWritable: false };
54
- function deepClone(val, options = defaultCloneOptions) {
55
- const seen = /* @__PURE__ */ new WeakMap();
56
- return clone(val, seen, options);
57
- }
58
- function clone(val, seen, options = defaultCloneOptions) {
59
- let k, out;
60
- if (seen.has(val)) {
61
- return seen.get(val);
62
- }
63
- if (Array.isArray(val)) {
64
- out = Array.from({ length: k = val.length });
65
- seen.set(val, out);
66
- while (k--) {
67
- out[k] = clone(val[k], seen, options);
68
- }
69
- return out;
70
- }
71
- if (Object.prototype.toString.call(val) === "[object Object]") {
72
- out = Object.create(Object.getPrototypeOf(val));
73
- seen.set(val, out);
74
- const props = getOwnProperties(val);
75
- for (const k2 of props) {
76
- const descriptor = Object.getOwnPropertyDescriptor(val, k2);
77
- if (!descriptor) {
78
- continue;
79
- }
80
- const cloned = clone(val[k2], seen, options);
81
- if (options.forceWritable) {
82
- Object.defineProperty(out, k2, {
83
- enumerable: descriptor.enumerable,
84
- configurable: true,
85
- writable: true,
86
- value: cloned
87
- });
88
- } else if ("get" in descriptor) {
89
- Object.defineProperty(out, k2, {
90
- ...descriptor,
91
- get() {
92
- return cloned;
93
- }
94
- });
95
- } else {
96
- Object.defineProperty(out, k2, {
97
- ...descriptor,
98
- value: cloned
99
- });
100
- }
101
- }
102
- return out;
103
- }
104
- return val;
105
- }
106
- function objectAttr(source, path, defaultValue = void 0) {
107
- const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
108
- let result = source;
109
- for (const p of paths) {
110
- result = new Object(result)[p];
111
- if (result === void 0) {
112
- return defaultValue;
113
- }
114
- }
115
- return result;
116
- }
117
- function createDefer() {
118
- let resolve = null;
119
- let reject = null;
120
- const p = new Promise((_resolve, _reject) => {
121
- resolve = _resolve;
122
- reject = _reject;
123
- });
124
- p.resolve = resolve;
125
- p.reject = reject;
126
- return p;
127
- }
128
- function isNegativeNaN(val) {
129
- if (!Number.isNaN(val)) {
130
- return false;
131
- }
132
- const f64 = new Float64Array(1);
133
- f64[0] = val;
134
- const u32 = new Uint32Array(f64.buffer);
135
- const isNegative = u32[1] >>> 31 === 1;
136
- return isNegative;
137
- }
138
- export {
139
- assertTypes,
140
- clone,
141
- createDefer,
142
- createSimpleStackTrace,
143
- deepClone,
144
- getOwnProperties,
145
- getType,
146
- isNegativeNaN,
147
- isObject,
148
- objectAttr,
149
- toArray
150
- };