@brillout/json-serializer 0.5.15 → 0.5.17
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/dist/cjs/parse.d.ts +8 -2
- package/dist/cjs/parse.js +26 -10
- package/dist/cjs/stringify.d.ts +3 -2
- package/dist/cjs/stringify.js +14 -13
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/types.js +2 -2
- package/dist/cjs/utils/isCallable.js +1 -2
- package/dist/cjs/utils/isObject.js +1 -2
- package/dist/cjs/utils/isReactElement.js +1 -2
- package/dist/cjs/utils/replacerWithPath.js +1 -2
- package/dist/esm/parse.d.ts +8 -2
- package/dist/esm/parse.js +23 -7
- package/dist/esm/stringify.d.ts +3 -2
- package/dist/esm/stringify.js +12 -10
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +2 -2
- package/package.json +31 -33
package/dist/cjs/parse.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { parse };
|
|
2
2
|
export { parseTransform };
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Options = {
|
|
4
|
+
reviver?: (key: undefined | string, value: string, parser: (str: string) => unknown) => {
|
|
5
|
+
replacement: unknown;
|
|
6
|
+
resolved?: boolean;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare function parse(str: string, options?: Options): unknown;
|
|
10
|
+
declare function parseTransform(value: unknown, options?: Options): unknown;
|
package/dist/cjs/parse.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parse = parse;
|
|
4
|
+
exports.parseTransform = parseTransform;
|
|
4
5
|
const types_1 = require("./types");
|
|
5
|
-
function parse(str) {
|
|
6
|
+
function parse(str, options = {}) {
|
|
6
7
|
// We don't use the reviver option in `JSON.parse(str, reviver)` because it doesn't support `undefined` values
|
|
7
8
|
const value = JSON.parse(str);
|
|
8
|
-
return parseTransform(value);
|
|
9
|
+
return parseTransform(value, options);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
function parseTransform(value) {
|
|
11
|
+
function parseTransform(value, options = {}) {
|
|
12
12
|
if (typeof value === 'string') {
|
|
13
|
-
return reviver(value);
|
|
13
|
+
return reviver(value, options);
|
|
14
14
|
}
|
|
15
15
|
if (
|
|
16
16
|
// Also matches arrays
|
|
@@ -18,16 +18,32 @@ function parseTransform(value) {
|
|
|
18
18
|
value !== null) {
|
|
19
19
|
Object.entries(value).forEach(([key, val]) => {
|
|
20
20
|
;
|
|
21
|
-
value[key] = parseTransform(val);
|
|
21
|
+
value[key] = parseTransform(val, options);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
return value;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
function reviver(value, options) {
|
|
27
|
+
var _a;
|
|
28
|
+
const parser = (str) => parse(str, options);
|
|
29
|
+
{
|
|
30
|
+
const res = (_a = options.reviver) === null || _a === void 0 ? void 0 : _a.call(options,
|
|
31
|
+
// TO-DO/eventually: provide key if some user needs it
|
|
32
|
+
undefined, value, parser);
|
|
33
|
+
if (res) {
|
|
34
|
+
if (typeof res.replacement !== 'string') {
|
|
35
|
+
return res.replacement;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
value = res.replacement;
|
|
39
|
+
if (res.resolved)
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
28
44
|
for (const { match, deserialize } of types_1.types) {
|
|
29
45
|
if (match(value)) {
|
|
30
|
-
return deserialize(value,
|
|
46
|
+
return deserialize(value, parser);
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
49
|
return value;
|
package/dist/cjs/stringify.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ declare function stringify(value: unknown, { forbidReactElements, space, valueNa
|
|
|
6
6
|
space?: number;
|
|
7
7
|
valueName?: string;
|
|
8
8
|
sortObjectKeys?: boolean;
|
|
9
|
-
replacer?: (this: Iterable, key: string, value: unknown) =>
|
|
9
|
+
replacer?: (this: Iterable, key: string, value: unknown, serializer: (value: unknown) => string) => {
|
|
10
10
|
replacement: unknown;
|
|
11
|
-
|
|
11
|
+
resolved?: boolean;
|
|
12
|
+
} | undefined;
|
|
12
13
|
}): string;
|
|
13
14
|
type ErrAddendum = {
|
|
14
15
|
messageCore: `cannot serialize ${string} because it's a function` | `cannot serialize ${string} because it's a React element`;
|
package/dist/cjs/stringify.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stringify = stringify;
|
|
4
|
+
exports.isJsonSerializerError = isJsonSerializerError;
|
|
4
5
|
const types_1 = require("./types");
|
|
5
6
|
const isReactElement_1 = require("./utils/isReactElement");
|
|
6
7
|
const isCallable_1 = require("./utils/isCallable");
|
|
7
8
|
const isObject_1 = require("./utils/isObject");
|
|
8
9
|
const replacerWithPath_1 = require("./utils/replacerWithPath");
|
|
9
|
-
function stringify(value, { forbidReactElements, space, valueName, sortObjectKeys,
|
|
10
|
-
// Used by Vike: https://github.com/vikejs/vike/blob/b4ba6b70e6bdc2e1f460c0d2e4c3faae5d0a733c/vike/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.ts#L78
|
|
11
|
-
replacer: replacerUserProvided, } = {}) {
|
|
10
|
+
function stringify(value, { forbidReactElements, space, valueName, sortObjectKeys, replacer: replacerUserProvided, } = {}) {
|
|
12
11
|
// The only error `JSON.stringify()` can throw is `TypeError "cyclic object value"`.
|
|
13
12
|
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#exceptions
|
|
14
13
|
// - This means we have total of 3 possible errors while serializing:
|
|
@@ -17,11 +16,16 @@ replacer: replacerUserProvided, } = {}) {
|
|
|
17
16
|
// - React elements
|
|
18
17
|
const serializer = (val) => JSON.stringify(val, (0, replacerWithPath_1.replacerWithPath)(replacer), space);
|
|
19
18
|
return serializer(value);
|
|
20
|
-
function replacer(key,
|
|
19
|
+
function replacer(key, valueAfterJSON, path) {
|
|
20
|
+
const valueOriginal = this[key];
|
|
21
|
+
let value = valueOriginal;
|
|
21
22
|
{
|
|
22
|
-
const ret = replacerUserProvided === null || replacerUserProvided === void 0 ? void 0 : replacerUserProvided.call(this, key,
|
|
23
|
-
if (ret)
|
|
24
|
-
|
|
23
|
+
const ret = replacerUserProvided === null || replacerUserProvided === void 0 ? void 0 : replacerUserProvided.call(this, key, valueAfterJSON, serializer);
|
|
24
|
+
if (ret) {
|
|
25
|
+
value = ret.replacement;
|
|
26
|
+
if (ret.resolved !== false)
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
if (forbidReactElements && (0, isReactElement_1.isReactElement)(value)) {
|
|
27
31
|
throw genErr({
|
|
@@ -41,11 +45,10 @@ replacer: replacerUserProvided, } = {}) {
|
|
|
41
45
|
problematicValueName: path.length === 0 ? functionName : undefined,
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
|
-
const valueOriginal = this[key];
|
|
45
48
|
for (const { is, serialize } of types_1.types.slice().reverse()) {
|
|
46
|
-
if (is(
|
|
49
|
+
if (is(value)) {
|
|
47
50
|
//@ts-ignore
|
|
48
|
-
return serialize(
|
|
51
|
+
return serialize(value, serializer);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
if (sortObjectKeys && (0, isObject_1.isObject)(value)) {
|
|
@@ -60,7 +63,6 @@ replacer: replacerUserProvided, } = {}) {
|
|
|
60
63
|
return value;
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
exports.stringify = stringify;
|
|
64
66
|
function genErr({ value, valueType, path, rootValueName, problematicValueName, }) {
|
|
65
67
|
const subjectName = getSubjectName({ path, rootValueName, problematicValueName });
|
|
66
68
|
const messageCore = `cannot serialize ${subjectName} because it's a ${valueType}`;
|
|
@@ -81,7 +83,6 @@ const stamp = '_isJsonSerializerError';
|
|
|
81
83
|
function isJsonSerializerError(thing) {
|
|
82
84
|
return (0, isObject_1.isObject)(thing) && thing[stamp] === true;
|
|
83
85
|
}
|
|
84
|
-
exports.isJsonSerializerError = isJsonSerializerError;
|
|
85
86
|
function getSubjectName({ path, rootValueName, problematicValueName, }) {
|
|
86
87
|
const pathString = getPathString(path, !rootValueName);
|
|
87
88
|
let subjectName;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type Type<ValueType, IntermediateType> = {
|
|
|
4
4
|
is: (val: unknown) => asserts val is ValueType;
|
|
5
5
|
match: (str: string) => boolean;
|
|
6
6
|
serialize: (val: ValueType, serializer: (val: IntermediateType) => string) => string;
|
|
7
|
-
deserialize: (str: string,
|
|
7
|
+
deserialize: (str: string, parser: (str: string) => IntermediateType) => ValueType;
|
|
8
8
|
};
|
package/dist/cjs/types.js
CHANGED
|
@@ -60,13 +60,13 @@ const types = [
|
|
|
60
60
|
is: (val) => val instanceof Map,
|
|
61
61
|
match: (str) => str.startsWith('!Map:'),
|
|
62
62
|
serialize: (val, serializer) => '!Map:' + serializer(Array.from(val.entries())),
|
|
63
|
-
deserialize: (str,
|
|
63
|
+
deserialize: (str, parser) => new Map(parser(str.slice('!Map:'.length))),
|
|
64
64
|
}),
|
|
65
65
|
ts({
|
|
66
66
|
is: (val) => val instanceof Set,
|
|
67
67
|
match: (str) => str.startsWith('!Set:'),
|
|
68
68
|
serialize: (val, serializer) => '!Set:' + serializer(Array.from(val.values())),
|
|
69
|
-
deserialize: (str,
|
|
69
|
+
deserialize: (str, parser) => new Set(parser(str.slice('!Set:'.length))),
|
|
70
70
|
}),
|
|
71
71
|
// Avoid collisions with the special strings defined above
|
|
72
72
|
ts({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCallable =
|
|
3
|
+
exports.isCallable = isCallable;
|
|
4
4
|
function isCallable(thing) {
|
|
5
5
|
return thing instanceof Function || typeof thing === 'function';
|
|
6
6
|
}
|
|
7
|
-
exports.isCallable = isCallable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObject =
|
|
3
|
+
exports.isObject = isObject;
|
|
4
4
|
function isObject(value) {
|
|
5
5
|
if (typeof value !== 'object' || value === null) {
|
|
6
6
|
return false;
|
|
@@ -10,4 +10,3 @@ function isObject(value) {
|
|
|
10
10
|
}
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
|
-
exports.isObject = isObject;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isReactElement =
|
|
3
|
+
exports.isReactElement = isReactElement;
|
|
4
4
|
function isReactElement(value) {
|
|
5
5
|
return (typeof value === 'object' &&
|
|
6
6
|
value !== null &&
|
|
7
7
|
String(value['$$typeof']) === 'Symbol(react.element)');
|
|
8
8
|
}
|
|
9
|
-
exports.isReactElement = isReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replacerWithPath =
|
|
3
|
+
exports.replacerWithPath = replacerWithPath;
|
|
4
4
|
function replacerWithPath(replacer) {
|
|
5
5
|
const pathMap = new WeakMap();
|
|
6
6
|
return function (key, value) {
|
|
@@ -16,7 +16,6 @@ function replacerWithPath(replacer) {
|
|
|
16
16
|
return replacer.call(this, key, value, path);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
exports.replacerWithPath = replacerWithPath;
|
|
20
19
|
function isIterable(value) {
|
|
21
20
|
return value === Object(value);
|
|
22
21
|
}
|
package/dist/esm/parse.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { parse };
|
|
2
2
|
export { parseTransform };
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Options = {
|
|
4
|
+
reviver?: (key: undefined | string, value: string, parser: (str: string) => unknown) => {
|
|
5
|
+
replacement: unknown;
|
|
6
|
+
resolved?: boolean;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare function parse(str: string, options?: Options): unknown;
|
|
10
|
+
declare function parseTransform(value: unknown, options?: Options): unknown;
|
package/dist/esm/parse.js
CHANGED
|
@@ -2,14 +2,14 @@ export { parse };
|
|
|
2
2
|
// Used by Vike: https://github.com/vikejs/vike/blob/b4ba6b70e6bdc2e1f460c0d2e4c3faae5d0a733c/vike/shared/page-configs/serialize/parseConfigValuesSerialized.ts#L13
|
|
3
3
|
export { parseTransform };
|
|
4
4
|
import { types } from './types';
|
|
5
|
-
function parse(str) {
|
|
5
|
+
function parse(str, options = {}) {
|
|
6
6
|
// We don't use the reviver option in `JSON.parse(str, reviver)` because it doesn't support `undefined` values
|
|
7
7
|
const value = JSON.parse(str);
|
|
8
|
-
return parseTransform(value);
|
|
8
|
+
return parseTransform(value, options);
|
|
9
9
|
}
|
|
10
|
-
function parseTransform(value) {
|
|
10
|
+
function parseTransform(value, options = {}) {
|
|
11
11
|
if (typeof value === 'string') {
|
|
12
|
-
return reviver(value);
|
|
12
|
+
return reviver(value, options);
|
|
13
13
|
}
|
|
14
14
|
if (
|
|
15
15
|
// Also matches arrays
|
|
@@ -17,15 +17,31 @@ function parseTransform(value) {
|
|
|
17
17
|
value !== null) {
|
|
18
18
|
Object.entries(value).forEach(([key, val]) => {
|
|
19
19
|
;
|
|
20
|
-
value[key] = parseTransform(val);
|
|
20
|
+
value[key] = parseTransform(val, options);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
return value;
|
|
24
24
|
}
|
|
25
|
-
function reviver(value) {
|
|
25
|
+
function reviver(value, options) {
|
|
26
|
+
const parser = (str) => parse(str, options);
|
|
27
|
+
{
|
|
28
|
+
const res = options.reviver?.(
|
|
29
|
+
// TO-DO/eventually: provide key if some user needs it
|
|
30
|
+
undefined, value, parser);
|
|
31
|
+
if (res) {
|
|
32
|
+
if (typeof res.replacement !== 'string') {
|
|
33
|
+
return res.replacement;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
value = res.replacement;
|
|
37
|
+
if (res.resolved)
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
26
42
|
for (const { match, deserialize } of types) {
|
|
27
43
|
if (match(value)) {
|
|
28
|
-
return deserialize(value,
|
|
44
|
+
return deserialize(value, parser);
|
|
29
45
|
}
|
|
30
46
|
}
|
|
31
47
|
return value;
|
package/dist/esm/stringify.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ declare function stringify(value: unknown, { forbidReactElements, space, valueNa
|
|
|
6
6
|
space?: number;
|
|
7
7
|
valueName?: string;
|
|
8
8
|
sortObjectKeys?: boolean;
|
|
9
|
-
replacer?: (this: Iterable, key: string, value: unknown) =>
|
|
9
|
+
replacer?: (this: Iterable, key: string, value: unknown, serializer: (value: unknown) => string) => {
|
|
10
10
|
replacement: unknown;
|
|
11
|
-
|
|
11
|
+
resolved?: boolean;
|
|
12
|
+
} | undefined;
|
|
12
13
|
}): string;
|
|
13
14
|
type ErrAddendum = {
|
|
14
15
|
messageCore: `cannot serialize ${string} because it's a function` | `cannot serialize ${string} because it's a React element`;
|
package/dist/esm/stringify.js
CHANGED
|
@@ -5,9 +5,7 @@ import { isReactElement } from './utils/isReactElement';
|
|
|
5
5
|
import { isCallable } from './utils/isCallable';
|
|
6
6
|
import { isObject } from './utils/isObject';
|
|
7
7
|
import { replacerWithPath } from './utils/replacerWithPath';
|
|
8
|
-
function stringify(value, { forbidReactElements, space, valueName, sortObjectKeys,
|
|
9
|
-
// Used by Vike: https://github.com/vikejs/vike/blob/b4ba6b70e6bdc2e1f460c0d2e4c3faae5d0a733c/vike/node/plugin/plugins/importUserCode/v1-design/getConfigValuesSerialized.ts#L78
|
|
10
|
-
replacer: replacerUserProvided, } = {}) {
|
|
8
|
+
function stringify(value, { forbidReactElements, space, valueName, sortObjectKeys, replacer: replacerUserProvided, } = {}) {
|
|
11
9
|
// The only error `JSON.stringify()` can throw is `TypeError "cyclic object value"`.
|
|
12
10
|
// - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#exceptions
|
|
13
11
|
// - This means we have total of 3 possible errors while serializing:
|
|
@@ -16,11 +14,16 @@ replacer: replacerUserProvided, } = {}) {
|
|
|
16
14
|
// - React elements
|
|
17
15
|
const serializer = (val) => JSON.stringify(val, replacerWithPath(replacer), space);
|
|
18
16
|
return serializer(value);
|
|
19
|
-
function replacer(key,
|
|
17
|
+
function replacer(key, valueAfterJSON, path) {
|
|
18
|
+
const valueOriginal = this[key];
|
|
19
|
+
let value = valueOriginal;
|
|
20
20
|
{
|
|
21
|
-
const ret = replacerUserProvided?.call(this, key,
|
|
22
|
-
if (ret)
|
|
23
|
-
|
|
21
|
+
const ret = replacerUserProvided?.call(this, key, valueAfterJSON, serializer);
|
|
22
|
+
if (ret) {
|
|
23
|
+
value = ret.replacement;
|
|
24
|
+
if (ret.resolved !== false)
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
if (forbidReactElements && isReactElement(value)) {
|
|
26
29
|
throw genErr({
|
|
@@ -40,11 +43,10 @@ replacer: replacerUserProvided, } = {}) {
|
|
|
40
43
|
problematicValueName: path.length === 0 ? functionName : undefined,
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
|
-
const valueOriginal = this[key];
|
|
44
46
|
for (const { is, serialize } of types.slice().reverse()) {
|
|
45
|
-
if (is(
|
|
47
|
+
if (is(value)) {
|
|
46
48
|
//@ts-ignore
|
|
47
|
-
return serialize(
|
|
49
|
+
return serialize(value, serializer);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
if (sortObjectKeys && isObject(value)) {
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type Type<ValueType, IntermediateType> = {
|
|
|
4
4
|
is: (val: unknown) => asserts val is ValueType;
|
|
5
5
|
match: (str: string) => boolean;
|
|
6
6
|
serialize: (val: ValueType, serializer: (val: IntermediateType) => string) => string;
|
|
7
|
-
deserialize: (str: string,
|
|
7
|
+
deserialize: (str: string, parser: (str: string) => IntermediateType) => ValueType;
|
|
8
8
|
};
|
package/dist/esm/types.js
CHANGED
|
@@ -58,13 +58,13 @@ const types = [
|
|
|
58
58
|
is: (val) => val instanceof Map,
|
|
59
59
|
match: (str) => str.startsWith('!Map:'),
|
|
60
60
|
serialize: (val, serializer) => '!Map:' + serializer(Array.from(val.entries())),
|
|
61
|
-
deserialize: (str,
|
|
61
|
+
deserialize: (str, parser) => new Map(parser(str.slice('!Map:'.length))),
|
|
62
62
|
}),
|
|
63
63
|
ts({
|
|
64
64
|
is: (val) => val instanceof Set,
|
|
65
65
|
match: (str) => str.startsWith('!Set:'),
|
|
66
66
|
serialize: (val, serializer) => '!Set:' + serializer(Array.from(val.values())),
|
|
67
|
-
deserialize: (str,
|
|
67
|
+
deserialize: (str, parser) => new Set(parser(str.slice('!Set:'.length))),
|
|
68
68
|
}),
|
|
69
69
|
// Avoid collisions with the special strings defined above
|
|
70
70
|
ts({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/json-serializer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"description": "Same as JSON but with added support for `Date`, `undefined`, `Map`, `Set`, and more.",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -16,47 +16,19 @@
|
|
|
16
16
|
"default": "./dist/esm/stringify.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"========= Dev": "",
|
|
21
|
-
"dev": "pnpm run tsc:watch:cjs",
|
|
22
|
-
"========= Build": "",
|
|
23
|
-
"build": "rm -rf dist/ && pnpm run tsc:esm && pnpm run tsc:cjs",
|
|
24
|
-
"tsc:esm": "tsc",
|
|
25
|
-
"tsc:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
26
|
-
"tsc:watch:esm": "tsc --incremental --watch",
|
|
27
|
-
"tsc:watch:cjs": "tsc --incremental --watch --project ./tsconfig.cjs.json",
|
|
28
|
-
"========= Test": "",
|
|
29
|
-
"test": "vitest",
|
|
30
|
-
"========= Build readme.md": "",
|
|
31
|
-
"docs": "mdocs",
|
|
32
|
-
"========= Formatting": "",
|
|
33
|
-
"format": "pnpm run format:biome",
|
|
34
|
-
"format:prettier": "git ls-files | egrep '\\.(json|js|jsx|css|ts|tsx|vue|mjs|cjs)$' | grep --invert-match package.json | xargs pnpm exec prettier --write",
|
|
35
|
-
"format:biome": "biome format --write .",
|
|
36
|
-
"format:check": "biome format . || echo Fix formatting by running: $ pnpm -w run format",
|
|
37
|
-
"========= Release": "",
|
|
38
|
-
"release": "release-me patch",
|
|
39
|
-
"========= Reset": "",
|
|
40
|
-
"reset": "git clean -Xdf && pnpm install && pnpm run build"
|
|
41
|
-
},
|
|
42
19
|
"devDependencies": {
|
|
43
20
|
"@biomejs/biome": "^1.7.2",
|
|
44
21
|
"@brillout/mdocs": "^0.1.30",
|
|
45
|
-
"@brillout/release-me": "^0.
|
|
46
|
-
"@types/node": "^
|
|
22
|
+
"@brillout/release-me": "^0.4.7",
|
|
23
|
+
"@types/node": "^24.0.10",
|
|
47
24
|
"@types/react": "^18.2.21",
|
|
48
25
|
"lodash.isequal": "^4.5.0",
|
|
49
26
|
"prettier": "^3.2.5",
|
|
50
27
|
"react": "^17.0.2",
|
|
51
|
-
"typescript": "^5.
|
|
28
|
+
"typescript": "^5.8.3",
|
|
52
29
|
"vitest": "^0.34.3"
|
|
53
30
|
},
|
|
54
31
|
"// Use @vitest/snapshot PR https://github.com/vitest-dev/vitest/pull/3961": "",
|
|
55
|
-
"pnpm": {
|
|
56
|
-
"overrides": {
|
|
57
|
-
"vitest>@vitest/snapshot": "npm:@brillout/vitest-snapshot@0.35.0-prerelease"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
32
|
"files": [
|
|
61
33
|
"dist/",
|
|
62
34
|
"*.d.ts",
|
|
@@ -67,5 +39,31 @@
|
|
|
67
39
|
"license": "MIT",
|
|
68
40
|
"publishConfig": {
|
|
69
41
|
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"========= Dev": "",
|
|
45
|
+
"dev": "pnpm run tsc:watch:cjs",
|
|
46
|
+
"========= Build": "",
|
|
47
|
+
"build": "rm -rf dist/ && pnpm run tsc:esm && pnpm run tsc:cjs",
|
|
48
|
+
"tsc:esm": "tsc",
|
|
49
|
+
"tsc:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
50
|
+
"tsc:watch:esm": "tsc --incremental --watch",
|
|
51
|
+
"tsc:watch:cjs": "tsc --incremental --watch --project ./tsconfig.cjs.json",
|
|
52
|
+
"========= Test": "",
|
|
53
|
+
"test": "vitest",
|
|
54
|
+
"========= Build readme.md": "",
|
|
55
|
+
"docs": "mdocs",
|
|
56
|
+
"========= Formatting": "",
|
|
57
|
+
"format": "pnpm run format:biome",
|
|
58
|
+
"format:prettier": "git ls-files | egrep '\\.(json|js|jsx|css|ts|tsx|vue|mjs|cjs)$' | grep --invert-match package.json | xargs pnpm exec prettier --write",
|
|
59
|
+
"format:biome": "biome format --write .",
|
|
60
|
+
"format:check": "biome format . || echo Fix formatting by running: $ pnpm -w run format",
|
|
61
|
+
"========= Reset": "",
|
|
62
|
+
"reset": "git clean -Xdf && pnpm install && pnpm run build",
|
|
63
|
+
"========= Release": "",
|
|
64
|
+
"release": "release-me patch",
|
|
65
|
+
"release:minor": "release-me minor",
|
|
66
|
+
"release:major": "release-me major",
|
|
67
|
+
"release:commit": "release-me commit"
|
|
70
68
|
}
|
|
71
|
-
}
|
|
69
|
+
}
|