@arcanejs/diff 0.3.0 → 0.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.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # `@arcanejs/diff`
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/%40arcanejs%2Fdiff)](https://www.npmjs.com/package/@arcanejs/diff)
4
+
5
+ This package provides an easy way to:
6
+
7
+ - Create diffs by comparing objects
8
+ - Update objects by applying diffs
9
+
10
+ This library is written in TypeScript,
11
+ and produces diffs that are type-safe,
12
+ and can only be applied to objects that match the type
13
+ of the objects being compared.
14
+
15
+ This package is part of the
16
+ [`arcanejs` project](https://github.com/arcanejs/arcanejs#arcanejs),
17
+ and is used to maintain a copy of a JSON tree in downstream clients in real-time
18
+ via websockets.
19
+
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { diffJson, Diff } from '@arcanejs/diff/diff';
24
+ import { patchJson } from '@arcanejs/diff/patch';
25
+
26
+ type E = {
27
+ foo: string;
28
+ bar?: number[];
29
+ };
30
+
31
+ const a: E = { foo: 'bar' };
32
+ const b: E = { foo: 'baz', bar: [1] };
33
+
34
+ const diffA: Diff<E> = diffJson(a, b);
35
+
36
+ const resultA = patchJson(a, diffA);
37
+
38
+ console.log(resultB); // { foo: 'baz', bar: [1] }
39
+
40
+ const c = { baz: 'foo' };
41
+
42
+ const resultB = patchJson(c, diffA); // TypeScript Type Error: Property 'baz' is missing in type '{ foo: string; bar?: number[] | undefined; }' but required in type '{ baz: string; }'
43
+ ```
@@ -0,0 +1,81 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/diff.ts
2
+ var jsonTypeMatches = (a, b) => typeof a === typeof b && Array.isArray(a) === Array.isArray(b) && a === null === (b === null);
3
+ var diffJson = (a, b) => {
4
+ if (a === b) {
5
+ return { type: "match" };
6
+ }
7
+ if (!jsonTypeMatches(a, b)) {
8
+ throw new Error("Types don't match, unable to diff");
9
+ }
10
+ if (Array.isArray(a) && Array.isArray(b)) {
11
+ if (a.length === b.length) {
12
+ const changes = [];
13
+ for (let i = 0; i < a.length; i++) {
14
+ const d = diffJson(a[i], b[i]);
15
+ if (d.type !== "match") {
16
+ changes.push({ i, diff: d });
17
+ }
18
+ }
19
+ if (changes.length === 0) {
20
+ return { type: "match" };
21
+ }
22
+ return { type: "modified-a", changes };
23
+ } else {
24
+ let start = 0;
25
+ while (start < a.length && start < b.length && diffJson(a[start], b[start]).type === "match") {
26
+ start++;
27
+ }
28
+ let endIndexA = a.length - 1;
29
+ let endIndexB = b.length - 1;
30
+ while (endIndexA >= start && endIndexB >= start && diffJson(a[endIndexA], b[endIndexB]).type === "match") {
31
+ endIndexA--;
32
+ endIndexB--;
33
+ }
34
+ const count = endIndexA - start + 1;
35
+ const items = b.slice(start, endIndexB + 1);
36
+ return { type: "splice", start, count, items };
37
+ }
38
+ }
39
+ if (a === null || b === null) {
40
+ return { type: "value", before: a, after: b };
41
+ }
42
+ if (Array.isArray(a) || Array.isArray(b)) {
43
+ return { type: "value", before: a, after: b };
44
+ }
45
+ if (typeof a === "object" && typeof b === "object") {
46
+ const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
47
+ const changes = {};
48
+ const additions = {};
49
+ const deletions = {};
50
+ for (const key of keys) {
51
+ const valueA = a[key];
52
+ const valueB = b[key];
53
+ if (valueA === void 0 && valueB !== void 0) {
54
+ additions[key] = valueB;
55
+ } else if (valueB === void 0 && valueA !== void 0) {
56
+ deletions[key] = valueA;
57
+ } else if (valueA !== void 0 && valueB !== void 0) {
58
+ const d = diffJson(valueA, valueB);
59
+ if (d.type !== "match") {
60
+ changes[key] = d;
61
+ }
62
+ }
63
+ }
64
+ const result = {
65
+ type: "modified-o",
66
+ ...Object.keys(changes).length === 0 ? {} : { changes },
67
+ ...Object.keys(additions).length === 0 ? {} : { additions },
68
+ ...Object.keys(deletions).length === 0 ? {} : { deletions }
69
+ };
70
+ if (result.changes || result.additions || result.deletions) {
71
+ return result;
72
+ } else {
73
+ return { type: "match" };
74
+ }
75
+ }
76
+ return { type: "value", before: a, after: b };
77
+ };
78
+
79
+
80
+
81
+ exports.diffJson = diffJson;
@@ -0,0 +1,52 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/patch.ts
2
+ var patchJson = (old, diff) => {
3
+ if (diff.type === "match") {
4
+ return old;
5
+ }
6
+ if (diff.type === "value") {
7
+ return diff.after;
8
+ }
9
+ if (diff.type === "splice") {
10
+ if (!Array.isArray(old)) {
11
+ throw new Error("Cannot apply splice diff to non-array value");
12
+ }
13
+ const result = [...old];
14
+ result.splice(diff.start, diff.count, ...diff.items);
15
+ return result;
16
+ }
17
+ if (diff.type === "modified-a") {
18
+ if (!Array.isArray(old)) {
19
+ throw new Error("Cannot apply changes diff to non-array value");
20
+ }
21
+ const result = [...old];
22
+ for (const { i, diff: d } of diff.changes) {
23
+ result[i] = patchJson(old[i], d);
24
+ }
25
+ return result;
26
+ }
27
+ if (Array.isArray(old)) {
28
+ throw new Error("Unexpected array type");
29
+ }
30
+ if (diff.type === "modified-o") {
31
+ if (typeof old !== "object" || old === null) {
32
+ throw new Error("Cannot apply modified diff to non-object value");
33
+ }
34
+ const result = { ...old, ...diff.additions };
35
+ for (const key of Object.keys(diff.changes || {})) {
36
+ const changes = _optionalChain([diff, 'access', _ => _.changes, 'optionalAccess', _2 => _2[key]]);
37
+ if (changes) {
38
+ result[key] = patchJson(old[key], changes);
39
+ }
40
+ }
41
+ for (const keu of Object.keys(diff.deletions || {})) {
42
+ delete result[keu];
43
+ }
44
+ return result;
45
+ }
46
+ const _n = diff;
47
+ throw new Error(`Unknown diff type: ${_n}`);
48
+ };
49
+
50
+
51
+
52
+ exports.patchJson = patchJson;
package/dist/diff.d.mts CHANGED
@@ -6,22 +6,22 @@ type JSONArray = JSONValue[];
6
6
  type JSONValue = JSONPrimitive | JSONObject | JSONArray;
7
7
  type PossibleRecursiveDiff<V extends JSONValue | undefined> = V extends JSONValue ? NestedDiff<V> : never;
8
8
  type NestedDiff<V extends JSONValue> = (V extends JSONPrimitive ? {
9
- type: "value";
9
+ type: 'value';
10
10
  before: V;
11
11
  after: V;
12
12
  } : never) | (V extends JSONArray ? {
13
- type: "splice";
13
+ type: 'splice';
14
14
  start: number;
15
15
  count: number;
16
16
  items: V;
17
17
  } : never) | (V extends JSONArray ? {
18
- type: "modified-a";
18
+ type: 'modified-a';
19
19
  changes: Array<{
20
20
  i: number;
21
21
  diff: PossibleRecursiveDiff<V[number]>;
22
22
  }>;
23
23
  } : never) | (V extends JSONObject ? {
24
- type: "modified-o";
24
+ type: 'modified-o';
25
25
  additions?: {
26
26
  [K in keyof V]: V[K];
27
27
  };
@@ -33,7 +33,7 @@ type NestedDiff<V extends JSONValue> = (V extends JSONPrimitive ? {
33
33
  };
34
34
  } : never);
35
35
  type Diff<V extends JSONValue> = NestedDiff<V> | {
36
- type: "match";
36
+ type: 'match';
37
37
  };
38
38
  declare const diffJson: <V extends JSONValue>(a: V | undefined, b: V | undefined) => Diff<V>;
39
39
 
package/dist/diff.d.ts CHANGED
@@ -6,22 +6,22 @@ type JSONArray = JSONValue[];
6
6
  type JSONValue = JSONPrimitive | JSONObject | JSONArray;
7
7
  type PossibleRecursiveDiff<V extends JSONValue | undefined> = V extends JSONValue ? NestedDiff<V> : never;
8
8
  type NestedDiff<V extends JSONValue> = (V extends JSONPrimitive ? {
9
- type: "value";
9
+ type: 'value';
10
10
  before: V;
11
11
  after: V;
12
12
  } : never) | (V extends JSONArray ? {
13
- type: "splice";
13
+ type: 'splice';
14
14
  start: number;
15
15
  count: number;
16
16
  items: V;
17
17
  } : never) | (V extends JSONArray ? {
18
- type: "modified-a";
18
+ type: 'modified-a';
19
19
  changes: Array<{
20
20
  i: number;
21
21
  diff: PossibleRecursiveDiff<V[number]>;
22
22
  }>;
23
23
  } : never) | (V extends JSONObject ? {
24
- type: "modified-o";
24
+ type: 'modified-o';
25
25
  additions?: {
26
26
  [K in keyof V]: V[K];
27
27
  };
@@ -33,7 +33,7 @@ type NestedDiff<V extends JSONValue> = (V extends JSONPrimitive ? {
33
33
  };
34
34
  } : never);
35
35
  type Diff<V extends JSONValue> = NestedDiff<V> | {
36
- type: "match";
36
+ type: 'match';
37
37
  };
38
38
  declare const diffJson: <V extends JSONValue>(a: V | undefined, b: V | undefined) => Diff<V>;
39
39
 
package/dist/diff.js CHANGED
@@ -1,105 +1,6 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/diff.ts
21
- var diff_exports = {};
22
- __export(diff_exports, {
23
- diffJson: () => diffJson
24
- });
25
- module.exports = __toCommonJS(diff_exports);
26
- var jsonTypeMatches = (a, b) => typeof a === typeof b && Array.isArray(a) === Array.isArray(b) && a === null === (b === null);
27
- var diffJson = (a, b) => {
28
- if (a === b) {
29
- return { type: "match" };
30
- }
31
- if (!jsonTypeMatches(a, b)) {
32
- throw new Error("Types don't match, unable to diff");
33
- }
34
- if (Array.isArray(a) && Array.isArray(b)) {
35
- if (a.length === b.length) {
36
- const changes = [];
37
- for (let i = 0; i < a.length; i++) {
38
- const d = diffJson(a[i], b[i]);
39
- if (d.type !== "match") {
40
- changes.push({ i, diff: d });
41
- }
42
- }
43
- if (changes.length === 0) {
44
- return { type: "match" };
45
- }
46
- return { type: "modified-a", changes };
47
- } else {
48
- let start = 0;
49
- while (start < a.length && start < b.length && diffJson(a[start], b[start]).type === "match") {
50
- start++;
51
- }
52
- let endIndexA = a.length - 1;
53
- let endIndexB = b.length - 1;
54
- while (endIndexA >= start && endIndexB >= start && diffJson(a[endIndexA], b[endIndexB]).type === "match") {
55
- endIndexA--;
56
- endIndexB--;
57
- }
58
- const count = endIndexA - start + 1;
59
- const items = b.slice(start, endIndexB + 1);
60
- return { type: "splice", start, count, items };
61
- }
62
- }
63
- if (a === null || b === null) {
64
- return { type: "value", before: a, after: b };
65
- }
66
- if (Array.isArray(a) || Array.isArray(b)) {
67
- return { type: "value", before: a, after: b };
68
- }
69
- if (typeof a === "object" && typeof b === "object") {
70
- const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
71
- const changes = {};
72
- const additions = {};
73
- const deletions = {};
74
- for (const key of keys) {
75
- const valueA = a[key];
76
- const valueB = b[key];
77
- if (valueA === void 0 && valueB !== void 0) {
78
- additions[key] = valueB;
79
- } else if (valueB === void 0 && valueA !== void 0) {
80
- deletions[key] = valueA;
81
- } else if (valueA !== void 0 && valueB !== void 0) {
82
- const d = diffJson(valueA, valueB);
83
- if (d.type !== "match") {
84
- changes[key] = d;
85
- }
86
- }
87
- }
88
- const result = {
89
- type: "modified-o",
90
- ...Object.keys(changes).length === 0 ? {} : { changes },
91
- ...Object.keys(additions).length === 0 ? {} : { additions },
92
- ...Object.keys(deletions).length === 0 ? {} : { deletions }
93
- };
94
- if (result.changes || result.additions || result.deletions) {
95
- return result;
96
- } else {
97
- return { type: "match" };
98
- }
99
- }
100
- return { type: "value", before: a, after: b };
101
- };
102
- // Annotate the CommonJS export names for ESM import in node:
103
- 0 && (module.exports = {
104
- diffJson
105
- });
3
+ var _chunk6R7Z62HKjs = require('./chunk-6R7Z62HK.js');
4
+
5
+
6
+ exports.diffJson = _chunk6R7Z62HKjs.diffJson;
package/dist/index.js CHANGED
@@ -1,158 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- diffJson: () => diffJson,
24
- patchJson: () => patchJson
25
- });
26
- module.exports = __toCommonJS(src_exports);
3
+ var _chunk6R7Z62HKjs = require('./chunk-6R7Z62HK.js');
27
4
 
28
- // src/diff.ts
29
- var jsonTypeMatches = (a, b) => typeof a === typeof b && Array.isArray(a) === Array.isArray(b) && a === null === (b === null);
30
- var diffJson = (a, b) => {
31
- if (a === b) {
32
- return { type: "match" };
33
- }
34
- if (!jsonTypeMatches(a, b)) {
35
- throw new Error("Types don't match, unable to diff");
36
- }
37
- if (Array.isArray(a) && Array.isArray(b)) {
38
- if (a.length === b.length) {
39
- const changes = [];
40
- for (let i = 0; i < a.length; i++) {
41
- const d = diffJson(a[i], b[i]);
42
- if (d.type !== "match") {
43
- changes.push({ i, diff: d });
44
- }
45
- }
46
- if (changes.length === 0) {
47
- return { type: "match" };
48
- }
49
- return { type: "modified-a", changes };
50
- } else {
51
- let start = 0;
52
- while (start < a.length && start < b.length && diffJson(a[start], b[start]).type === "match") {
53
- start++;
54
- }
55
- let endIndexA = a.length - 1;
56
- let endIndexB = b.length - 1;
57
- while (endIndexA >= start && endIndexB >= start && diffJson(a[endIndexA], b[endIndexB]).type === "match") {
58
- endIndexA--;
59
- endIndexB--;
60
- }
61
- const count = endIndexA - start + 1;
62
- const items = b.slice(start, endIndexB + 1);
63
- return { type: "splice", start, count, items };
64
- }
65
- }
66
- if (a === null || b === null) {
67
- return { type: "value", before: a, after: b };
68
- }
69
- if (Array.isArray(a) || Array.isArray(b)) {
70
- return { type: "value", before: a, after: b };
71
- }
72
- if (typeof a === "object" && typeof b === "object") {
73
- const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
74
- const changes = {};
75
- const additions = {};
76
- const deletions = {};
77
- for (const key of keys) {
78
- const valueA = a[key];
79
- const valueB = b[key];
80
- if (valueA === void 0 && valueB !== void 0) {
81
- additions[key] = valueB;
82
- } else if (valueB === void 0 && valueA !== void 0) {
83
- deletions[key] = valueA;
84
- } else if (valueA !== void 0 && valueB !== void 0) {
85
- const d = diffJson(valueA, valueB);
86
- if (d.type !== "match") {
87
- changes[key] = d;
88
- }
89
- }
90
- }
91
- const result = {
92
- type: "modified-o",
93
- ...Object.keys(changes).length === 0 ? {} : { changes },
94
- ...Object.keys(additions).length === 0 ? {} : { additions },
95
- ...Object.keys(deletions).length === 0 ? {} : { deletions }
96
- };
97
- if (result.changes || result.additions || result.deletions) {
98
- return result;
99
- } else {
100
- return { type: "match" };
101
- }
102
- }
103
- return { type: "value", before: a, after: b };
104
- };
105
5
 
106
- // src/patch.ts
107
- var patchJson = (old, diff) => {
108
- if (diff.type === "match") {
109
- return old;
110
- }
111
- if (diff.type === "value") {
112
- return diff.after;
113
- }
114
- if (diff.type === "splice") {
115
- if (!Array.isArray(old)) {
116
- throw new Error("Cannot apply splice diff to non-array value");
117
- }
118
- const result = [...old];
119
- result.splice(diff.start, diff.count, ...diff.items);
120
- return result;
121
- }
122
- if (diff.type === "modified-a") {
123
- if (!Array.isArray(old)) {
124
- throw new Error("Cannot apply changes diff to non-array value");
125
- }
126
- const result = [...old];
127
- for (const { i, diff: d } of diff.changes) {
128
- result[i] = patchJson(old[i], d);
129
- }
130
- return result;
131
- }
132
- if (Array.isArray(old)) {
133
- throw new Error("Unexpected array type");
134
- }
135
- if (diff.type === "modified-o") {
136
- if (typeof old !== "object" || old === null) {
137
- throw new Error("Cannot apply modified diff to non-object value");
138
- }
139
- const result = { ...old, ...diff.additions };
140
- for (const key of Object.keys(diff.changes || {})) {
141
- const changes = diff.changes?.[key];
142
- if (changes) {
143
- result[key] = patchJson(old[key], changes);
144
- }
145
- }
146
- for (const keu of Object.keys(diff.deletions || {})) {
147
- delete result[keu];
148
- }
149
- return result;
150
- }
151
- const _n = diff;
152
- throw new Error(`Unknown diff type: ${_n}`);
153
- };
154
- // Annotate the CommonJS export names for ESM import in node:
155
- 0 && (module.exports = {
156
- diffJson,
157
- patchJson
158
- });
6
+ var _chunkHLUKTMHVjs = require('./chunk-HLUKTMHV.js');
7
+
8
+
9
+
10
+ exports.diffJson = _chunk6R7Z62HKjs.diffJson; exports.patchJson = _chunkHLUKTMHVjs.patchJson;
package/dist/patch.js CHANGED
@@ -1,76 +1,6 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/patch.ts
21
- var patch_exports = {};
22
- __export(patch_exports, {
23
- patchJson: () => patchJson
24
- });
25
- module.exports = __toCommonJS(patch_exports);
26
- var patchJson = (old, diff) => {
27
- if (diff.type === "match") {
28
- return old;
29
- }
30
- if (diff.type === "value") {
31
- return diff.after;
32
- }
33
- if (diff.type === "splice") {
34
- if (!Array.isArray(old)) {
35
- throw new Error("Cannot apply splice diff to non-array value");
36
- }
37
- const result = [...old];
38
- result.splice(diff.start, diff.count, ...diff.items);
39
- return result;
40
- }
41
- if (diff.type === "modified-a") {
42
- if (!Array.isArray(old)) {
43
- throw new Error("Cannot apply changes diff to non-array value");
44
- }
45
- const result = [...old];
46
- for (const { i, diff: d } of diff.changes) {
47
- result[i] = patchJson(old[i], d);
48
- }
49
- return result;
50
- }
51
- if (Array.isArray(old)) {
52
- throw new Error("Unexpected array type");
53
- }
54
- if (diff.type === "modified-o") {
55
- if (typeof old !== "object" || old === null) {
56
- throw new Error("Cannot apply modified diff to non-object value");
57
- }
58
- const result = { ...old, ...diff.additions };
59
- for (const key of Object.keys(diff.changes || {})) {
60
- const changes = diff.changes?.[key];
61
- if (changes) {
62
- result[key] = patchJson(old[key], changes);
63
- }
64
- }
65
- for (const keu of Object.keys(diff.deletions || {})) {
66
- delete result[keu];
67
- }
68
- return result;
69
- }
70
- const _n = diff;
71
- throw new Error(`Unknown diff type: ${_n}`);
72
- };
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- patchJson
76
- });
3
+ var _chunkHLUKTMHVjs = require('./chunk-HLUKTMHV.js');
4
+
5
+
6
+ exports.patchJson = _chunkHLUKTMHVjs.patchJson;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcanejs/diff",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "description": "Create and apply JSON diffs of JSON objects",
6
6
  "keywords": [
@@ -22,16 +22,19 @@
22
22
  },
23
23
  "exports": {
24
24
  ".": {
25
+ "@arcanejs/source": "./src/index.ts",
25
26
  "import": "./dist/index.mjs",
26
27
  "require": "./dist/index.js",
27
28
  "types": "./dist/index.d.ts"
28
29
  },
29
30
  "./diff": {
31
+ "@arcanejs/source": "./src/diff.ts",
30
32
  "import": "./dist/diff.mjs",
31
33
  "require": "./dist/diff.js",
32
34
  "types": "./dist/diff.d.ts"
33
35
  },
34
36
  "./patch": {
37
+ "@arcanejs/source": "./src/patch.ts",
35
38
  "import": "./dist/patch.mjs",
36
39
  "require": "./dist/patch.js",
37
40
  "types": "./dist/patch.d.ts"
@@ -46,8 +49,8 @@
46
49
  "ts-jest": "^29.2.0",
47
50
  "tsup": "^8.1.0",
48
51
  "typescript": "^5.3.3",
49
- "@arcanejs/eslint-config": "0.0.0",
50
- "@arcanejs/typescript-config": "0.0.0"
52
+ "@arcanejs/eslint-config": "^0.0.0",
53
+ "@arcanejs/typescript-config": "^0.0.0"
51
54
  },
52
55
  "files": [
53
56
  "dist"
@@ -58,7 +61,6 @@
58
61
  "scripts": {
59
62
  "lint": "eslint . --max-warnings 0",
60
63
  "build": "tsup",
61
- "dev": "tsup --watch",
62
64
  "test": "jest",
63
65
  "test:watch": "jest --watch"
64
66
  }