@bscotch/yy 0.6.0 → 0.6.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/LICENSE.md +23 -0
- package/dist/Yy.d.ts +6859 -6829
- package/dist/Yy.d.ts.map +1 -1
- package/dist/Yy.js +247 -246
- package/dist/Yy.js.map +1 -1
- package/dist/Yy.parse.d.ts +5 -5
- package/dist/Yy.parse.js +240 -240
- package/dist/Yy.stringify.d.ts +6 -6
- package/dist/Yy.stringify.js +129 -129
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +16 -16
- package/dist/index.d.ts +8 -8
- package/dist/index.js +8 -8
- package/dist/types/YyBase.d.ts +46 -46
- package/dist/types/YyBase.js +37 -37
- package/dist/types/YyObject.d.ts +454 -462
- package/dist/types/YyObject.d.ts.map +1 -1
- package/dist/types/YyObject.js +108 -108
- package/dist/types/YyRoom.d.ts +1474 -1507
- package/dist/types/YyRoom.d.ts.map +1 -1
- package/dist/types/YyRoom.js +155 -155
- package/dist/types/YyScript.d.ts +45 -47
- package/dist/types/YyScript.d.ts.map +1 -1
- package/dist/types/YyScript.js +8 -8
- package/dist/types/YySound.d.ts +107 -115
- package/dist/types/YySound.d.ts.map +1 -1
- package/dist/types/YySound.js +61 -61
- package/dist/types/YySprite.d.ts +5438 -5446
- package/dist/types/YySprite.d.ts.map +1 -1
- package/dist/types/YySprite.js +417 -417
- package/dist/types/YySprite.lib.d.ts +221 -215
- package/dist/types/YySprite.lib.d.ts.map +1 -1
- package/dist/types/YySprite.lib.js +35 -35
- package/dist/types/Yyp.d.ts +604 -604
- package/dist/types/Yyp.js +101 -101
- package/dist/types/utility.d.ts +64 -64
- package/dist/types/utility.js +104 -104
- package/package.json +16 -11
- package/dist/Schema.d.ts +0 -1
- package/dist/Schema.d.ts.map +0 -1
- package/dist/Schema.js +0 -2
- package/dist/Schema.js.map +0 -1
package/dist/Yy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
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1C;;;;;;;;;;;;;;;OAeG;WACU,KAAK,CAAC,CAAC,SAAS,WAAW,EACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,MAAM,EAAE,CAAC,GACR,OAAO,CAAC,OAAO,CAAC;IA0BnB;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,SAAS,WAAW,EACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,MAAM,EAAE,CAAC,GACR,OAAO;IAoBV,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,EACvD,MAAM,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACnC,MAAM,EAAE,CAAC,GACR,YAAY,CAAC,CAAC,CAAC;IAKlB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM;IAqDxD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;CAsD9D"}
|
package/dist/Yy.js
CHANGED
|
@@ -1,247 +1,248 @@
|
|
|
1
|
-
import { sortKeysByReference } from '@bscotch/utility';
|
|
2
|
-
import { ok } from 'assert';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import fsp from 'fs/promises';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import { parseYy } from './Yy.parse.js';
|
|
8
|
-
import { stringifyYy } from './Yy.stringify.js';
|
|
9
|
-
import { yyObjectSchema } from './types/YyObject.js';
|
|
10
|
-
import { yyRoomSchema } from './types/YyRoom.js';
|
|
11
|
-
import { yyScriptSchema } from './types/YyScript.js';
|
|
12
|
-
import { yySoundSchema } from './types/YySound.js';
|
|
13
|
-
import { yySpriteSchema } from './types/YySprite.js';
|
|
14
|
-
import { yypSchema } from './types/Yyp.js';
|
|
15
|
-
const anyObject = z.object({}).passthrough();
|
|
16
|
-
export const yySchemas = {
|
|
17
|
-
project: yypSchema,
|
|
18
|
-
animcurves: anyObject,
|
|
19
|
-
extensions: anyObject,
|
|
20
|
-
fonts: anyObject,
|
|
21
|
-
notes: anyObject,
|
|
22
|
-
objects: yyObjectSchema,
|
|
23
|
-
paths: anyObject,
|
|
24
|
-
rooms: yyRoomSchema,
|
|
25
|
-
scripts: yyScriptSchema,
|
|
26
|
-
sequences: anyObject,
|
|
27
|
-
shaders: anyObject,
|
|
28
|
-
sounds: yySoundSchema,
|
|
29
|
-
sprites: yySpriteSchema,
|
|
30
|
-
tilesets: anyObject,
|
|
31
|
-
timelines: anyObject,
|
|
32
|
-
};
|
|
33
|
-
Object.freeze(yySchemas);
|
|
34
|
-
Object.seal(yySchemas);
|
|
35
|
-
|
|
36
|
-
// Hide the constructor since it's not meant to be used.
|
|
37
|
-
constructor() { }
|
|
38
|
-
static schemas = yySchemas;
|
|
39
|
-
static getSchema(ref) {
|
|
40
|
-
const schema = typeof ref === 'string' ? Yy.schemas[ref] : ref;
|
|
41
|
-
ok(schema, `No schema found for ${ref}`);
|
|
42
|
-
return schema;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Stringify an object into a Yy-formatted string,
|
|
46
|
-
* including trailing commas. If a schema is provided,
|
|
47
|
-
* it will be used to validate and populate defaults before
|
|
48
|
-
* stringifying.
|
|
49
|
-
*/
|
|
50
|
-
static stringify(yyObject, schema) {
|
|
51
|
-
if (typeof schema === 'string') {
|
|
52
|
-
schema = Yy.schemas[schema];
|
|
53
|
-
}
|
|
54
|
-
return stringifyYy(schema ? schema.parse(yyObject) : yyObject);
|
|
55
|
-
}
|
|
56
|
-
static parse(yyString, schema) {
|
|
57
|
-
return parseYy(yyString, schema && Yy.getSchema(schema));
|
|
58
|
-
}
|
|
59
|
-
static async read(filePath, schema) {
|
|
60
|
-
return Yy.parse(await fsp.readFile(filePath, 'utf8'), schema);
|
|
61
|
-
}
|
|
62
|
-
static readSync(filePath, schema) {
|
|
63
|
-
return Yy.parse(fs.readFileSync(filePath, 'utf8'), schema);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* If the file already exists
|
|
67
|
-
* its contents will be read first and the
|
|
68
|
-
* new content will only be written if it
|
|
69
|
-
* is different. This is to reduce file-watcher
|
|
70
|
-
* noise, since excess file-write events can
|
|
71
|
-
* cause problems with GameMaker.
|
|
72
|
-
*
|
|
73
|
-
* If the file already exists, the new file will
|
|
74
|
-
* have its keys sorted to match it (also to
|
|
75
|
-
* reduce file-watcher and Git noise).
|
|
76
|
-
*
|
|
77
|
-
* Calls that result in a no-op because the existing
|
|
78
|
-
* file matches return `false`, while calls that *do*
|
|
79
|
-
* write to disk return `true`.
|
|
80
|
-
*/
|
|
81
|
-
static async write(filePath, yyData, schema) {
|
|
82
|
-
let populated = schema ? Yy.populate(yyData, schema) : yyData;
|
|
83
|
-
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
84
|
-
// Only clobber if the target is a file with different
|
|
85
|
-
// contents. This is to prevent file-watcher triggers from
|
|
86
|
-
// creating noise.
|
|
87
|
-
if (await exists(filePath)) {
|
|
88
|
-
// If the existing file is identical, do nothing.
|
|
89
|
-
// (Read it without the schema first, so that we have
|
|
90
|
-
// a record of *key order*).
|
|
91
|
-
const currentRawContent = (await Yy.read(filePath));
|
|
92
|
-
// Fully parse/populate it so we can compare normalized-to-normalized
|
|
93
|
-
const currentParsedContent = schema
|
|
94
|
-
? Yy.populate(currentRawContent, schema)
|
|
95
|
-
: currentRawContent;
|
|
96
|
-
if (Yy.areEqual(currentParsedContent, populated)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
// Sort the keys prior to writing to minimize git noise.
|
|
100
|
-
populated = sortKeysByReference(populated, currentRawContent);
|
|
101
|
-
}
|
|
102
|
-
await fsp.writeFile(filePath, Yy.stringify(populated));
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Synchronous version of {@link Yy.write}.
|
|
107
|
-
*/
|
|
108
|
-
static writeSync(filePath, yyData, schema) {
|
|
109
|
-
let populated = schema ? Yy.populate(yyData, schema) : yyData;
|
|
110
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
111
|
-
if (existsSync(filePath)) {
|
|
112
|
-
const currentRawContent = Yy.readSync(filePath);
|
|
113
|
-
// Fully parse/populate it so we can compare normalized-to-normalized
|
|
114
|
-
const currentParsedContent = schema
|
|
115
|
-
? Yy.populate(currentRawContent, schema)
|
|
116
|
-
: currentRawContent;
|
|
117
|
-
if (Yy.areEqual(currentParsedContent, populated)) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
// Sort the keys prior to writing to minimize git noise.
|
|
121
|
-
populated = sortKeysByReference(populated, currentRawContent);
|
|
122
|
-
}
|
|
123
|
-
const stringified = Yy.stringify(populated);
|
|
124
|
-
fs.writeFileSync(filePath, stringified);
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
static populate(yyData, schema) {
|
|
128
|
-
const foundSchema = Yy.getSchema(schema);
|
|
129
|
-
return foundSchema.parse(yyData);
|
|
130
|
-
}
|
|
131
|
-
static diff(firstYy, secondYy) {
|
|
132
|
-
const diff = {};
|
|
133
|
-
function normalize(value) {
|
|
134
|
-
if (value !== null &&
|
|
135
|
-
typeof value === 'object' &&
|
|
136
|
-
Symbol.toPrimitive in value &&
|
|
137
|
-
typeof value[Symbol.toPrimitive] === 'function') {
|
|
138
|
-
// @ts-expect-error
|
|
139
|
-
value = value[Symbol.toPrimitive]('default');
|
|
140
|
-
}
|
|
141
|
-
return value;
|
|
142
|
-
}
|
|
143
|
-
function recurse(left, right, path) {
|
|
144
|
-
// Convert to primitives if necessary
|
|
145
|
-
left = normalize(left);
|
|
146
|
-
right = normalize(right);
|
|
147
|
-
if (left === right) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (left === null || right === null) {
|
|
151
|
-
diff[path] = { left, right };
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
if (Array.isArray(left) && Array.isArray(right)) {
|
|
155
|
-
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
156
|
-
recurse(left[i], right[i], `${path}/${i}`);
|
|
157
|
-
}
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (typeof left === 'object' && typeof right === 'object') {
|
|
161
|
-
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
162
|
-
for (const key of keys) {
|
|
163
|
-
if (typeof key !== 'string') {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
// @ts-expect-error
|
|
167
|
-
recurse(left[key], right[key], `${path}/${key}`);
|
|
168
|
-
}
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
// If we get here, then the values are different.
|
|
172
|
-
diff[path] = { left, right };
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
recurse(firstYy, secondYy, '');
|
|
176
|
-
return diff;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Check for functional equality between two Yy objects.
|
|
180
|
-
*/
|
|
181
|
-
static areEqual(firstYy, secondYy) {
|
|
182
|
-
if (firstYy != secondYy) {
|
|
183
|
-
if (typeof firstYy !== typeof secondYy) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
// If they are objects/array, then we need to do a deep comparison.
|
|
187
|
-
if (Array.isArray(firstYy) && Array.isArray(secondYy)) {
|
|
188
|
-
if (firstYy.length !== secondYy.length) {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
for (let i = 0; i < firstYy.length; i++) {
|
|
192
|
-
if (!Yy.areEqual(firstYy[i], secondYy[i])) {
|
|
193
|
-
return false;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
if (firstYy &&
|
|
199
|
-
secondYy &&
|
|
200
|
-
typeof firstYy === 'object' &&
|
|
201
|
-
typeof secondYy === 'object') {
|
|
202
|
-
// If both have primitive versions, compare those
|
|
203
|
-
const asPrimitives = [firstYy, secondYy].map((obj) => obj[Symbol.toPrimitive]?.('default'));
|
|
204
|
-
if (asPrimitives[0] !== undefined &&
|
|
205
|
-
asPrimitives[1] == asPrimitives[0]) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
const firstKeys = Object.keys(firstYy);
|
|
209
|
-
const secondKeys = Object.keys(secondYy);
|
|
210
|
-
// There could be different number of keys despite functional equality,
|
|
211
|
-
// if any keys have undefined values.
|
|
212
|
-
for (const key of firstKeys) {
|
|
213
|
-
if (!Yy.areEqual(firstYy[key], secondYy[key])) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
for (const key of secondKeys) {
|
|
218
|
-
if (!Yy.areEqual(firstYy[key], secondYy[key])) {
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
1
|
+
import { sortKeysByReference } from '@bscotch/utility';
|
|
2
|
+
import { ok } from 'assert';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import fsp from 'fs/promises';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { parseYy } from './Yy.parse.js';
|
|
8
|
+
import { stringifyYy } from './Yy.stringify.js';
|
|
9
|
+
import { yyObjectSchema } from './types/YyObject.js';
|
|
10
|
+
import { yyRoomSchema } from './types/YyRoom.js';
|
|
11
|
+
import { yyScriptSchema } from './types/YyScript.js';
|
|
12
|
+
import { yySoundSchema } from './types/YySound.js';
|
|
13
|
+
import { yySpriteSchema } from './types/YySprite.js';
|
|
14
|
+
import { yypSchema } from './types/Yyp.js';
|
|
15
|
+
const anyObject = z.object({}).passthrough();
|
|
16
|
+
export const yySchemas = {
|
|
17
|
+
project: yypSchema,
|
|
18
|
+
animcurves: anyObject,
|
|
19
|
+
extensions: anyObject,
|
|
20
|
+
fonts: anyObject,
|
|
21
|
+
notes: anyObject,
|
|
22
|
+
objects: yyObjectSchema,
|
|
23
|
+
paths: anyObject,
|
|
24
|
+
rooms: yyRoomSchema,
|
|
25
|
+
scripts: yyScriptSchema,
|
|
26
|
+
sequences: anyObject,
|
|
27
|
+
shaders: anyObject,
|
|
28
|
+
sounds: yySoundSchema,
|
|
29
|
+
sprites: yySpriteSchema,
|
|
30
|
+
tilesets: anyObject,
|
|
31
|
+
timelines: anyObject,
|
|
32
|
+
};
|
|
33
|
+
Object.freeze(yySchemas);
|
|
34
|
+
Object.seal(yySchemas);
|
|
35
|
+
class Yy {
|
|
36
|
+
// Hide the constructor since it's not meant to be used.
|
|
37
|
+
constructor() { }
|
|
38
|
+
static schemas = yySchemas;
|
|
39
|
+
static getSchema(ref) {
|
|
40
|
+
const schema = typeof ref === 'string' ? Yy.schemas[ref] : ref;
|
|
41
|
+
ok(schema, `No schema found for ${ref}`);
|
|
42
|
+
return schema;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Stringify an object into a Yy-formatted string,
|
|
46
|
+
* including trailing commas. If a schema is provided,
|
|
47
|
+
* it will be used to validate and populate defaults before
|
|
48
|
+
* stringifying.
|
|
49
|
+
*/
|
|
50
|
+
static stringify(yyObject, schema) {
|
|
51
|
+
if (typeof schema === 'string') {
|
|
52
|
+
schema = Yy.schemas[schema];
|
|
53
|
+
}
|
|
54
|
+
return stringifyYy(schema ? schema.parse(yyObject) : yyObject);
|
|
55
|
+
}
|
|
56
|
+
static parse(yyString, schema) {
|
|
57
|
+
return parseYy(yyString, schema && Yy.getSchema(schema));
|
|
58
|
+
}
|
|
59
|
+
static async read(filePath, schema) {
|
|
60
|
+
return Yy.parse(await fsp.readFile(filePath, 'utf8'), schema);
|
|
61
|
+
}
|
|
62
|
+
static readSync(filePath, schema) {
|
|
63
|
+
return Yy.parse(fs.readFileSync(filePath, 'utf8'), schema);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* If the file already exists
|
|
67
|
+
* its contents will be read first and the
|
|
68
|
+
* new content will only be written if it
|
|
69
|
+
* is different. This is to reduce file-watcher
|
|
70
|
+
* noise, since excess file-write events can
|
|
71
|
+
* cause problems with GameMaker.
|
|
72
|
+
*
|
|
73
|
+
* If the file already exists, the new file will
|
|
74
|
+
* have its keys sorted to match it (also to
|
|
75
|
+
* reduce file-watcher and Git noise).
|
|
76
|
+
*
|
|
77
|
+
* Calls that result in a no-op because the existing
|
|
78
|
+
* file matches return `false`, while calls that *do*
|
|
79
|
+
* write to disk return `true`.
|
|
80
|
+
*/
|
|
81
|
+
static async write(filePath, yyData, schema) {
|
|
82
|
+
let populated = schema ? Yy.populate(yyData, schema) : yyData;
|
|
83
|
+
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
84
|
+
// Only clobber if the target is a file with different
|
|
85
|
+
// contents. This is to prevent file-watcher triggers from
|
|
86
|
+
// creating noise.
|
|
87
|
+
if (await exists(filePath)) {
|
|
88
|
+
// If the existing file is identical, do nothing.
|
|
89
|
+
// (Read it without the schema first, so that we have
|
|
90
|
+
// a record of *key order*).
|
|
91
|
+
const currentRawContent = (await Yy.read(filePath));
|
|
92
|
+
// Fully parse/populate it so we can compare normalized-to-normalized
|
|
93
|
+
const currentParsedContent = schema
|
|
94
|
+
? Yy.populate(currentRawContent, schema)
|
|
95
|
+
: currentRawContent;
|
|
96
|
+
if (Yy.areEqual(currentParsedContent, populated)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
// Sort the keys prior to writing to minimize git noise.
|
|
100
|
+
populated = sortKeysByReference(populated, currentRawContent);
|
|
101
|
+
}
|
|
102
|
+
await fsp.writeFile(filePath, Yy.stringify(populated));
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Synchronous version of {@link Yy.write}.
|
|
107
|
+
*/
|
|
108
|
+
static writeSync(filePath, yyData, schema) {
|
|
109
|
+
let populated = schema ? Yy.populate(yyData, schema) : yyData;
|
|
110
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
111
|
+
if (existsSync(filePath)) {
|
|
112
|
+
const currentRawContent = Yy.readSync(filePath);
|
|
113
|
+
// Fully parse/populate it so we can compare normalized-to-normalized
|
|
114
|
+
const currentParsedContent = schema
|
|
115
|
+
? Yy.populate(currentRawContent, schema)
|
|
116
|
+
: currentRawContent;
|
|
117
|
+
if (Yy.areEqual(currentParsedContent, populated)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
// Sort the keys prior to writing to minimize git noise.
|
|
121
|
+
populated = sortKeysByReference(populated, currentRawContent);
|
|
122
|
+
}
|
|
123
|
+
const stringified = Yy.stringify(populated);
|
|
124
|
+
fs.writeFileSync(filePath, stringified);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
static populate(yyData, schema) {
|
|
128
|
+
const foundSchema = Yy.getSchema(schema);
|
|
129
|
+
return foundSchema.parse(yyData);
|
|
130
|
+
}
|
|
131
|
+
static diff(firstYy, secondYy) {
|
|
132
|
+
const diff = {};
|
|
133
|
+
function normalize(value) {
|
|
134
|
+
if (value !== null &&
|
|
135
|
+
typeof value === 'object' &&
|
|
136
|
+
Symbol.toPrimitive in value &&
|
|
137
|
+
typeof value[Symbol.toPrimitive] === 'function') {
|
|
138
|
+
// @ts-expect-error
|
|
139
|
+
value = value[Symbol.toPrimitive]('default');
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
function recurse(left, right, path) {
|
|
144
|
+
// Convert to primitives if necessary
|
|
145
|
+
left = normalize(left);
|
|
146
|
+
right = normalize(right);
|
|
147
|
+
if (left === right) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (left === null || right === null) {
|
|
151
|
+
diff[path] = { left, right };
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
155
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
156
|
+
recurse(left[i], right[i], `${path}/${i}`);
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (typeof left === 'object' && typeof right === 'object') {
|
|
161
|
+
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
162
|
+
for (const key of keys) {
|
|
163
|
+
if (typeof key !== 'string') {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
// @ts-expect-error
|
|
167
|
+
recurse(left[key], right[key], `${path}/${key}`);
|
|
168
|
+
}
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
// If we get here, then the values are different.
|
|
172
|
+
diff[path] = { left, right };
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
recurse(firstYy, secondYy, '');
|
|
176
|
+
return diff;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Check for functional equality between two Yy objects.
|
|
180
|
+
*/
|
|
181
|
+
static areEqual(firstYy, secondYy) {
|
|
182
|
+
if (firstYy != secondYy) {
|
|
183
|
+
if (typeof firstYy !== typeof secondYy) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
// If they are objects/array, then we need to do a deep comparison.
|
|
187
|
+
if (Array.isArray(firstYy) && Array.isArray(secondYy)) {
|
|
188
|
+
if (firstYy.length !== secondYy.length) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
for (let i = 0; i < firstYy.length; i++) {
|
|
192
|
+
if (!Yy.areEqual(firstYy[i], secondYy[i])) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
if (firstYy &&
|
|
199
|
+
secondYy &&
|
|
200
|
+
typeof firstYy === 'object' &&
|
|
201
|
+
typeof secondYy === 'object') {
|
|
202
|
+
// If both have primitive versions, compare those
|
|
203
|
+
const asPrimitives = [firstYy, secondYy].map((obj) => obj[Symbol.toPrimitive]?.('default'));
|
|
204
|
+
if (asPrimitives[0] !== undefined &&
|
|
205
|
+
asPrimitives[1] == asPrimitives[0]) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
const firstKeys = Object.keys(firstYy);
|
|
209
|
+
const secondKeys = Object.keys(secondYy);
|
|
210
|
+
// There could be different number of keys despite functional equality,
|
|
211
|
+
// if any keys have undefined values.
|
|
212
|
+
for (const key of firstKeys) {
|
|
213
|
+
if (!Yy.areEqual(firstYy[key], secondYy[key])) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
for (const key of secondKeys) {
|
|
218
|
+
if (!Yy.areEqual(firstYy[key], secondYy[key])) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
export { Yy };
|
|
230
|
+
async function exists(filepath) {
|
|
231
|
+
try {
|
|
232
|
+
await fsp.stat(filepath);
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function existsSync(filepath) {
|
|
240
|
+
try {
|
|
241
|
+
fs.statSync(filepath);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
247
248
|
//# sourceMappingURL=Yy.js.map
|
package/dist/Yy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Yy.js","sourceRoot":"","sources":["../src/Yy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAU,CAAC,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgB3C,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAG7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,SAAS;IAC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QACF,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB;IAClC,IAAI;QACF,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
|
package/dist/Yy.parse.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Modified from public domain code: https://github.com/sidorares/json-bigint/blob/master/lib/parse.js
|
|
3
|
-
*/
|
|
4
|
-
import { Schema, z } from 'zod';
|
|
5
|
-
export declare function parseYy<T extends Schema | undefined>(source: string, schema?: T): T extends Schema ? z.infer<T> : unknown;
|
|
1
|
+
/**
|
|
2
|
+
* @file Modified from public domain code: https://github.com/sidorares/json-bigint/blob/master/lib/parse.js
|
|
3
|
+
*/
|
|
4
|
+
import { Schema, z } from 'zod';
|
|
5
|
+
export declare function parseYy<T extends Schema | undefined>(source: string, schema?: T): T extends Schema ? z.infer<T> : unknown;
|
|
6
6
|
//# sourceMappingURL=Yy.parse.d.ts.map
|