@noma.to/qwik-testing-library 1.0.4 → 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 +61 -0
- 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 +5 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
function inspectArguments(args, options) {
|
|
4
|
+
if (args.length === 0)
|
|
5
|
+
return "Arguments[]";
|
|
6
|
+
options.truncate -= 13;
|
|
7
|
+
return `Arguments[ ${helpers.inspectList(args, options)} ]`;
|
|
8
|
+
}
|
|
9
|
+
module.exports = inspectArguments;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { inspectList } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectArguments(args, options) {
|
|
3
|
+
if (args.length === 0)
|
|
4
|
+
return "Arguments[]";
|
|
5
|
+
options.truncate -= 13;
|
|
6
|
+
return `Arguments[ ${inspectList(args, options)} ]`;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
inspectArguments as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
function inspectArray(array, options) {
|
|
4
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
5
|
+
if (!array.length && !nonIndexProperties.length)
|
|
6
|
+
return "[]";
|
|
7
|
+
options.truncate -= 4;
|
|
8
|
+
const listContents = helpers.inspectList(array, options);
|
|
9
|
+
options.truncate -= listContents.length;
|
|
10
|
+
let propertyContents = "";
|
|
11
|
+
if (nonIndexProperties.length) {
|
|
12
|
+
propertyContents = helpers.inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, helpers.inspectProperty);
|
|
13
|
+
}
|
|
14
|
+
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
15
|
+
}
|
|
16
|
+
module.exports = inspectArray;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { inspectList, inspectProperty } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectArray(array, options) {
|
|
3
|
+
const nonIndexProperties = Object.keys(array).slice(array.length);
|
|
4
|
+
if (!array.length && !nonIndexProperties.length)
|
|
5
|
+
return "[]";
|
|
6
|
+
options.truncate -= 4;
|
|
7
|
+
const listContents = inspectList(array, options);
|
|
8
|
+
options.truncate -= listContents.length;
|
|
9
|
+
let propertyContents = "";
|
|
10
|
+
if (nonIndexProperties.length) {
|
|
11
|
+
propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
|
|
12
|
+
}
|
|
13
|
+
return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
inspectArray as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
function inspectBigInt(number, options) {
|
|
4
|
+
let nums = helpers.truncate(number.toString(), options.truncate - 1);
|
|
5
|
+
if (nums !== helpers.truncator)
|
|
6
|
+
nums += "n";
|
|
7
|
+
return options.stylize(nums, "bigint");
|
|
8
|
+
}
|
|
9
|
+
module.exports = inspectBigInt;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { truncate, truncator } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectBigInt(number, options) {
|
|
3
|
+
let nums = truncate(number.toString(), options.truncate - 1);
|
|
4
|
+
if (nums !== truncator)
|
|
5
|
+
nums += "n";
|
|
6
|
+
return options.stylize(nums, "bigint");
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
inspectBigInt as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const object = require("./object.qwik.cjs");
|
|
3
|
+
const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
4
|
+
function inspectClass(value, options) {
|
|
5
|
+
let name = "";
|
|
6
|
+
if (toStringTag && toStringTag in value) {
|
|
7
|
+
name = value[toStringTag];
|
|
8
|
+
}
|
|
9
|
+
name = name || value.constructor.name;
|
|
10
|
+
if (!name || name === "_class") {
|
|
11
|
+
name = "<Anonymous Class>";
|
|
12
|
+
}
|
|
13
|
+
options.truncate -= name.length;
|
|
14
|
+
return `${name}${object(value, options)}`;
|
|
15
|
+
}
|
|
16
|
+
module.exports = inspectClass;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import inspectObject from "./object.qwik.mjs";
|
|
2
|
+
const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
3
|
+
function inspectClass(value, options) {
|
|
4
|
+
let name = "";
|
|
5
|
+
if (toStringTag && toStringTag in value) {
|
|
6
|
+
name = value[toStringTag];
|
|
7
|
+
}
|
|
8
|
+
name = name || value.constructor.name;
|
|
9
|
+
if (!name || name === "_class") {
|
|
10
|
+
name = "<Anonymous Class>";
|
|
11
|
+
}
|
|
12
|
+
options.truncate -= name.length;
|
|
13
|
+
return `${name}${inspectObject(value, options)}`;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
inspectClass as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
function inspectDate(dateObject, options) {
|
|
4
|
+
const stringRepresentation = dateObject.toJSON();
|
|
5
|
+
if (stringRepresentation === null) {
|
|
6
|
+
return "Invalid Date";
|
|
7
|
+
}
|
|
8
|
+
const split = stringRepresentation.split("T");
|
|
9
|
+
const date = split[0];
|
|
10
|
+
return options.stylize(`${date}T${helpers.truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
11
|
+
}
|
|
12
|
+
module.exports = inspectDate;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { truncate } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectDate(dateObject, options) {
|
|
3
|
+
const stringRepresentation = dateObject.toJSON();
|
|
4
|
+
if (stringRepresentation === null) {
|
|
5
|
+
return "Invalid Date";
|
|
6
|
+
}
|
|
7
|
+
const split = stringRepresentation.split("T");
|
|
8
|
+
const date = split[0];
|
|
9
|
+
return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
inspectDate as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
const errorKeys = [
|
|
4
|
+
"stack",
|
|
5
|
+
"line",
|
|
6
|
+
"column",
|
|
7
|
+
"name",
|
|
8
|
+
"message",
|
|
9
|
+
"fileName",
|
|
10
|
+
"lineNumber",
|
|
11
|
+
"columnNumber",
|
|
12
|
+
"number",
|
|
13
|
+
"description"
|
|
14
|
+
];
|
|
15
|
+
function inspectObject(error, options) {
|
|
16
|
+
const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
|
|
17
|
+
const name = error.name;
|
|
18
|
+
options.truncate -= name.length;
|
|
19
|
+
let message = "";
|
|
20
|
+
if (typeof error.message === "string") {
|
|
21
|
+
message = helpers.truncate(error.message, options.truncate);
|
|
22
|
+
} else {
|
|
23
|
+
properties.unshift("message");
|
|
24
|
+
}
|
|
25
|
+
message = message ? `: ${message}` : "";
|
|
26
|
+
options.truncate -= message.length + 5;
|
|
27
|
+
const propertyContents = helpers.inspectList(properties.map((key) => [key, error[key]]), options, helpers.inspectProperty);
|
|
28
|
+
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
29
|
+
}
|
|
30
|
+
module.exports = inspectObject;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { truncate, inspectList, inspectProperty } from "./helpers.qwik.mjs";
|
|
2
|
+
const errorKeys = [
|
|
3
|
+
"stack",
|
|
4
|
+
"line",
|
|
5
|
+
"column",
|
|
6
|
+
"name",
|
|
7
|
+
"message",
|
|
8
|
+
"fileName",
|
|
9
|
+
"lineNumber",
|
|
10
|
+
"columnNumber",
|
|
11
|
+
"number",
|
|
12
|
+
"description"
|
|
13
|
+
];
|
|
14
|
+
function inspectObject(error, options) {
|
|
15
|
+
const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
|
|
16
|
+
const name = error.name;
|
|
17
|
+
options.truncate -= name.length;
|
|
18
|
+
let message = "";
|
|
19
|
+
if (typeof error.message === "string") {
|
|
20
|
+
message = truncate(error.message, options.truncate);
|
|
21
|
+
} else {
|
|
22
|
+
properties.unshift("message");
|
|
23
|
+
}
|
|
24
|
+
message = message ? `: ${message}` : "";
|
|
25
|
+
options.truncate -= message.length + 5;
|
|
26
|
+
const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
|
|
27
|
+
return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
inspectObject as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
3
|
+
function inspectFunction(func, options) {
|
|
4
|
+
const functionType = func[Symbol.toStringTag] || "Function";
|
|
5
|
+
const name = func.name;
|
|
6
|
+
if (!name) {
|
|
7
|
+
return options.stylize(`[${functionType}]`, "special");
|
|
8
|
+
}
|
|
9
|
+
return options.stylize(`[${functionType} ${helpers.truncate(name, options.truncate - 11)}]`, "special");
|
|
10
|
+
}
|
|
11
|
+
module.exports = inspectFunction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { truncate } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectFunction(func, options) {
|
|
3
|
+
const functionType = func[Symbol.toStringTag] || "Function";
|
|
4
|
+
const name = func.name;
|
|
5
|
+
if (!name) {
|
|
6
|
+
return options.stylize(`[${functionType}]`, "special");
|
|
7
|
+
}
|
|
8
|
+
return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
inspectFunction as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const ansiColors = {
|
|
4
|
+
bold: ["1", "22"],
|
|
5
|
+
dim: ["2", "22"],
|
|
6
|
+
italic: ["3", "23"],
|
|
7
|
+
underline: ["4", "24"],
|
|
8
|
+
// 5 & 6 are blinking
|
|
9
|
+
inverse: ["7", "27"],
|
|
10
|
+
hidden: ["8", "28"],
|
|
11
|
+
strike: ["9", "29"],
|
|
12
|
+
// 10-20 are fonts
|
|
13
|
+
// 21-29 are resets for 1-9
|
|
14
|
+
black: ["30", "39"],
|
|
15
|
+
red: ["31", "39"],
|
|
16
|
+
green: ["32", "39"],
|
|
17
|
+
yellow: ["33", "39"],
|
|
18
|
+
blue: ["34", "39"],
|
|
19
|
+
magenta: ["35", "39"],
|
|
20
|
+
cyan: ["36", "39"],
|
|
21
|
+
white: ["37", "39"],
|
|
22
|
+
brightblack: ["30;1", "39"],
|
|
23
|
+
brightred: ["31;1", "39"],
|
|
24
|
+
brightgreen: ["32;1", "39"],
|
|
25
|
+
brightyellow: ["33;1", "39"],
|
|
26
|
+
brightblue: ["34;1", "39"],
|
|
27
|
+
brightmagenta: ["35;1", "39"],
|
|
28
|
+
brightcyan: ["36;1", "39"],
|
|
29
|
+
brightwhite: ["37;1", "39"],
|
|
30
|
+
grey: ["90", "39"]
|
|
31
|
+
};
|
|
32
|
+
const styles = {
|
|
33
|
+
special: "cyan",
|
|
34
|
+
number: "yellow",
|
|
35
|
+
bigint: "yellow",
|
|
36
|
+
boolean: "yellow",
|
|
37
|
+
undefined: "grey",
|
|
38
|
+
null: "bold",
|
|
39
|
+
string: "green",
|
|
40
|
+
symbol: "green",
|
|
41
|
+
date: "magenta",
|
|
42
|
+
regexp: "red"
|
|
43
|
+
};
|
|
44
|
+
const truncator = "…";
|
|
45
|
+
function colorise(value, styleType) {
|
|
46
|
+
const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
|
|
47
|
+
if (!color) {
|
|
48
|
+
return String(value);
|
|
49
|
+
}
|
|
50
|
+
return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
|
|
51
|
+
}
|
|
52
|
+
function normaliseOptions({
|
|
53
|
+
showHidden = false,
|
|
54
|
+
depth = 2,
|
|
55
|
+
colors = false,
|
|
56
|
+
customInspect = true,
|
|
57
|
+
showProxy = false,
|
|
58
|
+
maxArrayLength = Infinity,
|
|
59
|
+
breakLength = Infinity,
|
|
60
|
+
seen = [],
|
|
61
|
+
// eslint-disable-next-line no-shadow
|
|
62
|
+
truncate: truncate2 = Infinity,
|
|
63
|
+
stylize = String
|
|
64
|
+
} = {}, inspect) {
|
|
65
|
+
const options = {
|
|
66
|
+
showHidden: Boolean(showHidden),
|
|
67
|
+
depth: Number(depth),
|
|
68
|
+
colors: Boolean(colors),
|
|
69
|
+
customInspect: Boolean(customInspect),
|
|
70
|
+
showProxy: Boolean(showProxy),
|
|
71
|
+
maxArrayLength: Number(maxArrayLength),
|
|
72
|
+
breakLength: Number(breakLength),
|
|
73
|
+
truncate: Number(truncate2),
|
|
74
|
+
seen,
|
|
75
|
+
inspect,
|
|
76
|
+
stylize
|
|
77
|
+
};
|
|
78
|
+
if (options.colors) {
|
|
79
|
+
options.stylize = colorise;
|
|
80
|
+
}
|
|
81
|
+
return options;
|
|
82
|
+
}
|
|
83
|
+
function isHighSurrogate(char) {
|
|
84
|
+
return char >= "\uD800" && char <= "\uDBFF";
|
|
85
|
+
}
|
|
86
|
+
function truncate(string, length, tail = truncator) {
|
|
87
|
+
string = String(string);
|
|
88
|
+
const tailLength = tail.length;
|
|
89
|
+
const stringLength = string.length;
|
|
90
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
91
|
+
return tail;
|
|
92
|
+
}
|
|
93
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
94
|
+
let end = length - tailLength;
|
|
95
|
+
if (end > 0 && isHighSurrogate(string[end - 1])) {
|
|
96
|
+
end = end - 1;
|
|
97
|
+
}
|
|
98
|
+
return `${string.slice(0, end)}${tail}`;
|
|
99
|
+
}
|
|
100
|
+
return string;
|
|
101
|
+
}
|
|
102
|
+
function inspectList(list, options, inspectItem, separator = ", ") {
|
|
103
|
+
inspectItem = inspectItem || options.inspect;
|
|
104
|
+
const size = list.length;
|
|
105
|
+
if (size === 0)
|
|
106
|
+
return "";
|
|
107
|
+
const originalLength = options.truncate;
|
|
108
|
+
let output = "";
|
|
109
|
+
let peek = "";
|
|
110
|
+
let truncated = "";
|
|
111
|
+
for (let i = 0; i < size; i += 1) {
|
|
112
|
+
const last = i + 1 === list.length;
|
|
113
|
+
const secondToLast = i + 2 === list.length;
|
|
114
|
+
truncated = `${truncator}(${list.length - i})`;
|
|
115
|
+
const value = list[i];
|
|
116
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
117
|
+
const string = peek || inspectItem(value, options) + (last ? "" : separator);
|
|
118
|
+
const nextLength = output.length + string.length;
|
|
119
|
+
const truncatedLength = nextLength + truncated.length;
|
|
120
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
|
|
127
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
output += string;
|
|
131
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
132
|
+
truncated = `${truncator}(${list.length - i - 1})`;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
truncated = "";
|
|
136
|
+
}
|
|
137
|
+
return `${output}${truncated}`;
|
|
138
|
+
}
|
|
139
|
+
function quoteComplexKey(key) {
|
|
140
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
141
|
+
return key;
|
|
142
|
+
}
|
|
143
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
144
|
+
}
|
|
145
|
+
function inspectProperty([key, value], options) {
|
|
146
|
+
options.truncate -= 2;
|
|
147
|
+
if (typeof key === "string") {
|
|
148
|
+
key = quoteComplexKey(key);
|
|
149
|
+
} else if (typeof key !== "number") {
|
|
150
|
+
key = `[${options.inspect(key, options)}]`;
|
|
151
|
+
}
|
|
152
|
+
options.truncate -= key.length;
|
|
153
|
+
value = options.inspect(value, options);
|
|
154
|
+
return `${key}: ${value}`;
|
|
155
|
+
}
|
|
156
|
+
exports.inspectList = inspectList;
|
|
157
|
+
exports.inspectProperty = inspectProperty;
|
|
158
|
+
exports.normaliseOptions = normaliseOptions;
|
|
159
|
+
exports.truncate = truncate;
|
|
160
|
+
exports.truncator = truncator;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const ansiColors = {
|
|
2
|
+
bold: ["1", "22"],
|
|
3
|
+
dim: ["2", "22"],
|
|
4
|
+
italic: ["3", "23"],
|
|
5
|
+
underline: ["4", "24"],
|
|
6
|
+
// 5 & 6 are blinking
|
|
7
|
+
inverse: ["7", "27"],
|
|
8
|
+
hidden: ["8", "28"],
|
|
9
|
+
strike: ["9", "29"],
|
|
10
|
+
// 10-20 are fonts
|
|
11
|
+
// 21-29 are resets for 1-9
|
|
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
|
+
brightblack: ["30;1", "39"],
|
|
21
|
+
brightred: ["31;1", "39"],
|
|
22
|
+
brightgreen: ["32;1", "39"],
|
|
23
|
+
brightyellow: ["33;1", "39"],
|
|
24
|
+
brightblue: ["34;1", "39"],
|
|
25
|
+
brightmagenta: ["35;1", "39"],
|
|
26
|
+
brightcyan: ["36;1", "39"],
|
|
27
|
+
brightwhite: ["37;1", "39"],
|
|
28
|
+
grey: ["90", "39"]
|
|
29
|
+
};
|
|
30
|
+
const styles = {
|
|
31
|
+
special: "cyan",
|
|
32
|
+
number: "yellow",
|
|
33
|
+
bigint: "yellow",
|
|
34
|
+
boolean: "yellow",
|
|
35
|
+
undefined: "grey",
|
|
36
|
+
null: "bold",
|
|
37
|
+
string: "green",
|
|
38
|
+
symbol: "green",
|
|
39
|
+
date: "magenta",
|
|
40
|
+
regexp: "red"
|
|
41
|
+
};
|
|
42
|
+
const truncator = "…";
|
|
43
|
+
function colorise(value, styleType) {
|
|
44
|
+
const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
|
|
45
|
+
if (!color) {
|
|
46
|
+
return String(value);
|
|
47
|
+
}
|
|
48
|
+
return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
|
|
49
|
+
}
|
|
50
|
+
function normaliseOptions({
|
|
51
|
+
showHidden = false,
|
|
52
|
+
depth = 2,
|
|
53
|
+
colors = false,
|
|
54
|
+
customInspect = true,
|
|
55
|
+
showProxy = false,
|
|
56
|
+
maxArrayLength = Infinity,
|
|
57
|
+
breakLength = Infinity,
|
|
58
|
+
seen = [],
|
|
59
|
+
// eslint-disable-next-line no-shadow
|
|
60
|
+
truncate: truncate2 = Infinity,
|
|
61
|
+
stylize = String
|
|
62
|
+
} = {}, inspect) {
|
|
63
|
+
const options = {
|
|
64
|
+
showHidden: Boolean(showHidden),
|
|
65
|
+
depth: Number(depth),
|
|
66
|
+
colors: Boolean(colors),
|
|
67
|
+
customInspect: Boolean(customInspect),
|
|
68
|
+
showProxy: Boolean(showProxy),
|
|
69
|
+
maxArrayLength: Number(maxArrayLength),
|
|
70
|
+
breakLength: Number(breakLength),
|
|
71
|
+
truncate: Number(truncate2),
|
|
72
|
+
seen,
|
|
73
|
+
inspect,
|
|
74
|
+
stylize
|
|
75
|
+
};
|
|
76
|
+
if (options.colors) {
|
|
77
|
+
options.stylize = colorise;
|
|
78
|
+
}
|
|
79
|
+
return options;
|
|
80
|
+
}
|
|
81
|
+
function isHighSurrogate(char) {
|
|
82
|
+
return char >= "\uD800" && char <= "\uDBFF";
|
|
83
|
+
}
|
|
84
|
+
function truncate(string, length, tail = truncator) {
|
|
85
|
+
string = String(string);
|
|
86
|
+
const tailLength = tail.length;
|
|
87
|
+
const stringLength = string.length;
|
|
88
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
89
|
+
return tail;
|
|
90
|
+
}
|
|
91
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
92
|
+
let end = length - tailLength;
|
|
93
|
+
if (end > 0 && isHighSurrogate(string[end - 1])) {
|
|
94
|
+
end = end - 1;
|
|
95
|
+
}
|
|
96
|
+
return `${string.slice(0, end)}${tail}`;
|
|
97
|
+
}
|
|
98
|
+
return string;
|
|
99
|
+
}
|
|
100
|
+
function inspectList(list, options, inspectItem, separator = ", ") {
|
|
101
|
+
inspectItem = inspectItem || options.inspect;
|
|
102
|
+
const size = list.length;
|
|
103
|
+
if (size === 0)
|
|
104
|
+
return "";
|
|
105
|
+
const originalLength = options.truncate;
|
|
106
|
+
let output = "";
|
|
107
|
+
let peek = "";
|
|
108
|
+
let truncated = "";
|
|
109
|
+
for (let i = 0; i < size; i += 1) {
|
|
110
|
+
const last = i + 1 === list.length;
|
|
111
|
+
const secondToLast = i + 2 === list.length;
|
|
112
|
+
truncated = `${truncator}(${list.length - i})`;
|
|
113
|
+
const value = list[i];
|
|
114
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
115
|
+
const string = peek || inspectItem(value, options) + (last ? "" : separator);
|
|
116
|
+
const nextLength = output.length + string.length;
|
|
117
|
+
const truncatedLength = nextLength + truncated.length;
|
|
118
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
|
|
125
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
output += string;
|
|
129
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
130
|
+
truncated = `${truncator}(${list.length - i - 1})`;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
truncated = "";
|
|
134
|
+
}
|
|
135
|
+
return `${output}${truncated}`;
|
|
136
|
+
}
|
|
137
|
+
function quoteComplexKey(key) {
|
|
138
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
139
|
+
return key;
|
|
140
|
+
}
|
|
141
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
142
|
+
}
|
|
143
|
+
function inspectProperty([key, value], options) {
|
|
144
|
+
options.truncate -= 2;
|
|
145
|
+
if (typeof key === "string") {
|
|
146
|
+
key = quoteComplexKey(key);
|
|
147
|
+
} else if (typeof key !== "number") {
|
|
148
|
+
key = `[${options.inspect(key, options)}]`;
|
|
149
|
+
}
|
|
150
|
+
options.truncate -= key.length;
|
|
151
|
+
value = options.inspect(value, options);
|
|
152
|
+
return `${key}: ${value}`;
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
inspectList,
|
|
156
|
+
inspectProperty,
|
|
157
|
+
normaliseOptions,
|
|
158
|
+
truncate,
|
|
159
|
+
truncator
|
|
160
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const helpers = require("./helpers.qwik.cjs");
|
|
4
|
+
function inspectAttribute([key, value], options) {
|
|
5
|
+
options.truncate -= 3;
|
|
6
|
+
if (!value) {
|
|
7
|
+
return `${options.stylize(String(key), "yellow")}`;
|
|
8
|
+
}
|
|
9
|
+
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
10
|
+
}
|
|
11
|
+
function inspectHTMLCollection(collection, options) {
|
|
12
|
+
return helpers.inspectList(collection, options, inspectHTML, "\n");
|
|
13
|
+
}
|
|
14
|
+
function inspectHTML(element, options) {
|
|
15
|
+
const properties = element.getAttributeNames();
|
|
16
|
+
const name = element.tagName.toLowerCase();
|
|
17
|
+
const head = options.stylize(`<${name}`, "special");
|
|
18
|
+
const headClose = options.stylize(`>`, "special");
|
|
19
|
+
const tail = options.stylize(`</${name}>`, "special");
|
|
20
|
+
options.truncate -= name.length * 2 + 5;
|
|
21
|
+
let propertyContents = "";
|
|
22
|
+
if (properties.length > 0) {
|
|
23
|
+
propertyContents += " ";
|
|
24
|
+
propertyContents += helpers.inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
|
|
25
|
+
}
|
|
26
|
+
options.truncate -= propertyContents.length;
|
|
27
|
+
const truncate = options.truncate;
|
|
28
|
+
let children = inspectHTMLCollection(element.children, options);
|
|
29
|
+
if (children && children.length > truncate) {
|
|
30
|
+
children = `${helpers.truncator}(${element.children.length})`;
|
|
31
|
+
}
|
|
32
|
+
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
33
|
+
}
|
|
34
|
+
exports.default = inspectHTML;
|
|
35
|
+
exports.inspectAttribute = inspectAttribute;
|
|
36
|
+
exports.inspectHTMLCollection = inspectHTMLCollection;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { inspectList, truncator } from "./helpers.qwik.mjs";
|
|
2
|
+
function inspectAttribute([key, value], options) {
|
|
3
|
+
options.truncate -= 3;
|
|
4
|
+
if (!value) {
|
|
5
|
+
return `${options.stylize(String(key), "yellow")}`;
|
|
6
|
+
}
|
|
7
|
+
return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
|
|
8
|
+
}
|
|
9
|
+
function inspectHTMLCollection(collection, options) {
|
|
10
|
+
return inspectList(collection, options, inspectHTML, "\n");
|
|
11
|
+
}
|
|
12
|
+
function inspectHTML(element, options) {
|
|
13
|
+
const properties = element.getAttributeNames();
|
|
14
|
+
const name = element.tagName.toLowerCase();
|
|
15
|
+
const head = options.stylize(`<${name}`, "special");
|
|
16
|
+
const headClose = options.stylize(`>`, "special");
|
|
17
|
+
const tail = options.stylize(`</${name}>`, "special");
|
|
18
|
+
options.truncate -= name.length * 2 + 5;
|
|
19
|
+
let propertyContents = "";
|
|
20
|
+
if (properties.length > 0) {
|
|
21
|
+
propertyContents += " ";
|
|
22
|
+
propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
|
|
23
|
+
}
|
|
24
|
+
options.truncate -= propertyContents.length;
|
|
25
|
+
const truncate = options.truncate;
|
|
26
|
+
let children = inspectHTMLCollection(element.children, options);
|
|
27
|
+
if (children && children.length > truncate) {
|
|
28
|
+
children = `${truncator}(${element.children.length})`;
|
|
29
|
+
}
|
|
30
|
+
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
inspectHTML as default,
|
|
34
|
+
inspectAttribute,
|
|
35
|
+
inspectHTMLCollection
|
|
36
|
+
};
|