@graffy/testing 0.15.25-alpha.1 → 0.15.25-alpha.3
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/index.cjs +13 -24
- package/index.mjs +20 -22
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __objRest = (source, exclude) => {
|
|
6
|
-
var target = {};
|
|
7
|
-
for (var prop in source)
|
|
8
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
9
|
-
target[prop] = source[prop];
|
|
10
|
-
if (source != null && __getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
12
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
13
|
-
target[prop] = source[prop];
|
|
14
|
-
}
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports[Symbol.toStringTag] = "Module";
|
|
19
|
-
var common = require("@graffy/common");
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const common = require("@graffy/common");
|
|
20
4
|
function mockBackend(options = {}) {
|
|
21
5
|
const state = [];
|
|
22
6
|
const watcher = common.makeWatcher();
|
|
@@ -61,9 +45,8 @@ function format(graph, indent = "") {
|
|
|
61
45
|
graph = [graph];
|
|
62
46
|
if (!graph.length)
|
|
63
47
|
return "[]";
|
|
64
|
-
return "\n" + graph.map(
|
|
65
|
-
|
|
66
|
-
return [
|
|
48
|
+
return "\n" + graph.map(
|
|
49
|
+
({ key, end, children, version, path, value, ...rest }) => [
|
|
67
50
|
lastPrintedVersion === version ? "" : "<@" + (lastPrintedVersion = version) + ">\n",
|
|
68
51
|
indent,
|
|
69
52
|
end ? interval(key, end) : escape(key),
|
|
@@ -73,14 +56,20 @@ function format(graph, indent = "") {
|
|
|
73
56
|
children ? " {" : "",
|
|
74
57
|
children ? format(children, indent + " ") : "",
|
|
75
58
|
children ? " }" : ""
|
|
76
|
-
].join("")
|
|
77
|
-
|
|
59
|
+
].join("")
|
|
60
|
+
).join("\n");
|
|
78
61
|
}
|
|
79
62
|
function inspect() {
|
|
80
63
|
return format(this);
|
|
81
64
|
}
|
|
82
65
|
function pretty(query) {
|
|
83
|
-
return JSON.stringify(query, null, 4).replace(
|
|
66
|
+
return JSON.stringify(query, null, 4).replace(
|
|
67
|
+
/\[(\s*)([\s\S]*?)\},*/g,
|
|
68
|
+
(_, space, inner) => "[" + space + inner.replace(/\n\s+/g, " ") + "},"
|
|
69
|
+
).replace(
|
|
70
|
+
/[^\u0020-\u007e,\u000a]/g,
|
|
71
|
+
(char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4)
|
|
72
|
+
);
|
|
84
73
|
}
|
|
85
74
|
const put = (obj) => {
|
|
86
75
|
Object.defineProperty(obj, "$put", { value: true });
|
package/index.mjs
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var __objRest = (source, exclude) => {
|
|
5
|
-
var target = {};
|
|
6
|
-
for (var prop in source)
|
|
7
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
8
|
-
target[prop] = source[prop];
|
|
9
|
-
if (source != null && __getOwnPropSymbols)
|
|
10
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
11
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
12
|
-
target[prop] = source[prop];
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
1
|
import { makeWatcher, slice, merge } from "@graffy/common";
|
|
17
2
|
function mockBackend(options = {}) {
|
|
18
3
|
const state = [];
|
|
@@ -58,9 +43,8 @@ function format(graph, indent = "") {
|
|
|
58
43
|
graph = [graph];
|
|
59
44
|
if (!graph.length)
|
|
60
45
|
return "[]";
|
|
61
|
-
return "\n" + graph.map(
|
|
62
|
-
|
|
63
|
-
return [
|
|
46
|
+
return "\n" + graph.map(
|
|
47
|
+
({ key, end, children, version, path, value, ...rest }) => [
|
|
64
48
|
lastPrintedVersion === version ? "" : "<@" + (lastPrintedVersion = version) + ">\n",
|
|
65
49
|
indent,
|
|
66
50
|
end ? interval(key, end) : escape(key),
|
|
@@ -70,14 +54,20 @@ function format(graph, indent = "") {
|
|
|
70
54
|
children ? " {" : "",
|
|
71
55
|
children ? format(children, indent + " ") : "",
|
|
72
56
|
children ? " }" : ""
|
|
73
|
-
].join("")
|
|
74
|
-
|
|
57
|
+
].join("")
|
|
58
|
+
).join("\n");
|
|
75
59
|
}
|
|
76
60
|
function inspect() {
|
|
77
61
|
return format(this);
|
|
78
62
|
}
|
|
79
63
|
function pretty(query) {
|
|
80
|
-
return JSON.stringify(query, null, 4).replace(
|
|
64
|
+
return JSON.stringify(query, null, 4).replace(
|
|
65
|
+
/\[(\s*)([\s\S]*?)\},*/g,
|
|
66
|
+
(_, space, inner) => "[" + space + inner.replace(/\n\s+/g, " ") + "},"
|
|
67
|
+
).replace(
|
|
68
|
+
/[^\u0020-\u007e,\u000a]/g,
|
|
69
|
+
(char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4)
|
|
70
|
+
);
|
|
81
71
|
}
|
|
82
72
|
const put = (obj) => {
|
|
83
73
|
Object.defineProperty(obj, "$put", { value: true });
|
|
@@ -92,4 +82,12 @@ const keyref = ($key, $ref, obj = {}) => {
|
|
|
92
82
|
ref($ref, obj);
|
|
93
83
|
return obj;
|
|
94
84
|
};
|
|
95
|
-
export {
|
|
85
|
+
export {
|
|
86
|
+
format,
|
|
87
|
+
inspect,
|
|
88
|
+
keyref,
|
|
89
|
+
mockBackend,
|
|
90
|
+
pretty,
|
|
91
|
+
put,
|
|
92
|
+
ref
|
|
93
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graffy/testing",
|
|
3
3
|
"description": "Testing and debugging utilities for Graffy.",
|
|
4
4
|
"author": "aravind (https://github.com/aravindet)",
|
|
5
|
-
"version": "0.15.25-alpha.
|
|
5
|
+
"version": "0.15.25-alpha.3",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"exports": {
|
|
8
8
|
"import": "./index.mjs",
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@graffy/common": "0.15.25-alpha.
|
|
19
|
+
"@graffy/common": "0.15.25-alpha.3"
|
|
20
20
|
}
|
|
21
21
|
}
|