@bscotch/yy 0.2.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 +43 -0
- package/dist/Yy.d.ts +23 -0
- package/dist/Yy.d.ts.map +1 -0
- package/dist/Yy.js +79 -0
- package/dist/Yy.js.map +1 -0
- package/dist/Yy.parse.d.ts +5 -0
- package/dist/Yy.parse.d.ts.map +1 -0
- package/dist/Yy.parse.js +241 -0
- package/dist/Yy.parse.js.map +1 -0
- package/dist/Yy.stringify.d.ts +6 -0
- package/dist/Yy.stringify.d.ts.map +1 -0
- package/dist/Yy.stringify.js +131 -0
- package/dist/Yy.stringify.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# GameMaker `yy` and `yyp` parser/stringifier
|
|
2
|
+
|
|
3
|
+
Read and write GameMaker's `.yyp` and `.yy` files!
|
|
4
|
+
|
|
5
|
+
[GameMaker](https://gamemaker.io/en) projects consist of a variety of filetypes, with much of the core metadata described in the project root `.yyp` file and resource-specific `.yy` files. Being able to manipulate these files programmatically, outside of GameMaker's editor, is useful for building custom pipelines.
|
|
6
|
+
|
|
7
|
+
This package provides parsing, stringifying, and reading/writing of GameMaker's `.yyp` and `.yy` files.
|
|
8
|
+
|
|
9
|
+
## Why use this package?
|
|
10
|
+
|
|
11
|
+
`yy` and `yyp` files are JSON-ish, but don't follow the JSON spec. In general, existing JSON utilities either won't be able to read `yy` files successfully or will write them differently from how GameMaker does it. In the latter case the files might still be functional, but will be reformatted by GameMaker and therefore act as a source of version control noise.
|
|
12
|
+
|
|
13
|
+
How these files depart from JSON:
|
|
14
|
+
|
|
15
|
+
- The files include trailing slashes, which are invalid in JSON
|
|
16
|
+
- Files can include large integers that are beyond the range of default `Number` types
|
|
17
|
+
- The spacing behavior does not match typical JSON prettifying behavior
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Node.js v16+
|
|
22
|
+
- A Node.js project in which you want to use this package.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
In your project root:
|
|
27
|
+
|
|
28
|
+
- npm install @bscotch/yy
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
In your Node code:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// In Typescript, or in an ES6 module:
|
|
36
|
+
import { Yy } from '@bscotch/yy';
|
|
37
|
+
|
|
38
|
+
// Has sync and async versions.
|
|
39
|
+
let parsedFile = Yy.readSync('./my-project.yyp');
|
|
40
|
+
parsedFile = await Yy.read('./my-project.yyp');
|
|
41
|
+
|
|
42
|
+
const reStringified = Yy.stringify(parsedFile);
|
|
43
|
+
```
|
package/dist/Yy.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class Yy {
|
|
2
|
+
/**
|
|
3
|
+
* Stringify an object into a Yy-formatted string,
|
|
4
|
+
* including trailing commas.
|
|
5
|
+
*
|
|
6
|
+
* Supports BigInt.
|
|
7
|
+
*/
|
|
8
|
+
static stringify(yyObject: any): string;
|
|
9
|
+
static parse<T = unknown>(yyString: string): T;
|
|
10
|
+
static read<T = unknown>(filePath: string): Promise<T>;
|
|
11
|
+
static readSync<T = unknown>(filePath: string): T;
|
|
12
|
+
/**
|
|
13
|
+
* If the file already exists
|
|
14
|
+
* its contents will be read first and the
|
|
15
|
+
* new content will only be written if it
|
|
16
|
+
* is different. This is to reduce file-watcher
|
|
17
|
+
* noise, since excess file-write events can
|
|
18
|
+
* cause problems with GameMaker.
|
|
19
|
+
*/
|
|
20
|
+
static write(filePath: string, yyData: any): Promise<void>;
|
|
21
|
+
static writeSync(filePath: string, yyData: any): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Yy.d.ts.map
|
package/dist/Yy.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.d.ts","sourceRoot":"","sources":["../src/Yy.ts"],"names":[],"mappings":"AAMA,qBAAa,EAAE;IACb;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG;IAI9B,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;WAIjC,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI5D,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;IAIjD;;;;;;;OAOG;WACU,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;IAiBhD,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;CAY/C"}
|
package/dist/Yy.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import fsp from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { parseYy } from './Yy.parse.js';
|
|
5
|
+
import { stringifyYy } from './Yy.stringify.js';
|
|
6
|
+
export class Yy {
|
|
7
|
+
/**
|
|
8
|
+
* Stringify an object into a Yy-formatted string,
|
|
9
|
+
* including trailing commas.
|
|
10
|
+
*
|
|
11
|
+
* Supports BigInt.
|
|
12
|
+
*/
|
|
13
|
+
static stringify(yyObject) {
|
|
14
|
+
return stringifyYy(yyObject);
|
|
15
|
+
}
|
|
16
|
+
static parse(yyString) {
|
|
17
|
+
return parseYy(yyString);
|
|
18
|
+
}
|
|
19
|
+
static async read(filePath) {
|
|
20
|
+
return parseYy(await fsp.readFile(filePath, 'utf8'));
|
|
21
|
+
}
|
|
22
|
+
static readSync(filePath) {
|
|
23
|
+
return parseYy(fs.readFileSync(filePath, 'utf8'));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* If the file already exists
|
|
27
|
+
* its contents will be read first and the
|
|
28
|
+
* new content will only be written if it
|
|
29
|
+
* is different. This is to reduce file-watcher
|
|
30
|
+
* noise, since excess file-write events can
|
|
31
|
+
* cause problems with GameMaker.
|
|
32
|
+
*/
|
|
33
|
+
static async write(filePath, yyData) {
|
|
34
|
+
const stringifiedStuff = stringifyYy(yyData);
|
|
35
|
+
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
36
|
+
// Only clobber if the target is a file with different
|
|
37
|
+
// contents. This is to prevent file-watcher triggers from
|
|
38
|
+
// creating noise.
|
|
39
|
+
if (await exists(filePath)) {
|
|
40
|
+
// If the existing file is identical, do nothing.
|
|
41
|
+
const currentContent = await fsp.readFile(filePath, 'utf8');
|
|
42
|
+
if (currentContent === stringifiedStuff) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
await fsp.writeFile(filePath, stringifiedStuff);
|
|
47
|
+
}
|
|
48
|
+
static writeSync(filePath, yyData) {
|
|
49
|
+
const stringifiedStuff = stringifyYy(yyData);
|
|
50
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
51
|
+
if (existsSync(filePath)) {
|
|
52
|
+
// If the existing file is identical, do nothing.
|
|
53
|
+
const currentContent = fs.readFileSync(filePath, 'utf8');
|
|
54
|
+
if (currentContent === stringifiedStuff) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
fs.writeFileSync(filePath, stringifiedStuff);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function exists(filepath) {
|
|
62
|
+
try {
|
|
63
|
+
await fsp.stat(filepath);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function existsSync(filepath) {
|
|
71
|
+
try {
|
|
72
|
+
fs.statSync(filepath);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=Yy.js.map
|
package/dist/Yy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.js","sourceRoot":"","sources":["../src/Yy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,EAAE;IACb;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,QAAa;QAC5B,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAc,QAAgB;QACxC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAc,QAAgB;QAC7C,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAc,QAAgB;QAC3C,OAAO,OAAO,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,MAAW;QAC9C,MAAM,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.parse.d.ts","sourceRoot":"","sources":["../src/Yy.parse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,OAyPrC"}
|
package/dist/Yy.parse.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Modified from public domain code: https://github.com/sidorares/json-bigint/blob/master/lib/parse.js
|
|
3
|
+
*/
|
|
4
|
+
const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
|
|
5
|
+
const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
|
|
6
|
+
const escapee = {
|
|
7
|
+
'"': '"',
|
|
8
|
+
'\\': '\\',
|
|
9
|
+
'/': '/',
|
|
10
|
+
b: '\b',
|
|
11
|
+
f: '\f',
|
|
12
|
+
n: '\n',
|
|
13
|
+
r: '\r',
|
|
14
|
+
t: '\t',
|
|
15
|
+
};
|
|
16
|
+
export function parseYy(source) {
|
|
17
|
+
// Clear trailing commas
|
|
18
|
+
source = source.replace(/,(\s*[}\]])/g, '$1');
|
|
19
|
+
/** Index of the current character */
|
|
20
|
+
let at = 0;
|
|
21
|
+
/** The current character */
|
|
22
|
+
let ch = ' ';
|
|
23
|
+
const text = source;
|
|
24
|
+
function error(m) {
|
|
25
|
+
throw {
|
|
26
|
+
name: 'SyntaxError',
|
|
27
|
+
message: m,
|
|
28
|
+
at: at,
|
|
29
|
+
text: text,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function next(c) {
|
|
33
|
+
// If a c parameter is provided, verify that it matches the current character.
|
|
34
|
+
if (c && c !== ch) {
|
|
35
|
+
error("Expected '" + c + "' instead of '" + ch + "'");
|
|
36
|
+
}
|
|
37
|
+
// Get the next character. When there are no more characters,
|
|
38
|
+
// return the empty string.
|
|
39
|
+
ch = text.charAt(at);
|
|
40
|
+
at += 1;
|
|
41
|
+
return ch;
|
|
42
|
+
}
|
|
43
|
+
function number() {
|
|
44
|
+
// Parse a number value.
|
|
45
|
+
let str = '';
|
|
46
|
+
if (ch === '-') {
|
|
47
|
+
str = '-';
|
|
48
|
+
next('-');
|
|
49
|
+
}
|
|
50
|
+
while (ch >= '0' && ch <= '9') {
|
|
51
|
+
str += ch;
|
|
52
|
+
next();
|
|
53
|
+
}
|
|
54
|
+
if (ch === '.') {
|
|
55
|
+
str += '.';
|
|
56
|
+
while (next() && ch >= '0' && ch <= '9') {
|
|
57
|
+
str += ch;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (ch === 'e' || ch === 'E') {
|
|
61
|
+
str += ch;
|
|
62
|
+
next();
|
|
63
|
+
if (ch === '-' || ch === '+') {
|
|
64
|
+
str += ch;
|
|
65
|
+
next();
|
|
66
|
+
}
|
|
67
|
+
while (ch >= '0' && ch <= '9') {
|
|
68
|
+
str += ch;
|
|
69
|
+
next();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Store as a BigInt if
|
|
73
|
+
// 1. it's an integer, and
|
|
74
|
+
// 2. it's too big to store as a vanilla number.
|
|
75
|
+
// (BigInts can only be parsed from purely-numeric strings)
|
|
76
|
+
const num = +str;
|
|
77
|
+
if (!str.includes('.')) {
|
|
78
|
+
const asBigInt = BigInt(str);
|
|
79
|
+
if (asBigInt > Number.MAX_SAFE_INTEGER) {
|
|
80
|
+
return asBigInt;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return num;
|
|
84
|
+
}
|
|
85
|
+
function string() {
|
|
86
|
+
// Parse a string value.
|
|
87
|
+
let hex, i, string = '', uffff;
|
|
88
|
+
// When parsing for string values, we must look for " and \ characters.
|
|
89
|
+
if (ch === '"') {
|
|
90
|
+
let startAt = at;
|
|
91
|
+
while (next()) {
|
|
92
|
+
if (ch === '"') {
|
|
93
|
+
if (at - 1 > startAt)
|
|
94
|
+
string += text.substring(startAt, at - 1);
|
|
95
|
+
next();
|
|
96
|
+
return string;
|
|
97
|
+
}
|
|
98
|
+
if (ch === '\\') {
|
|
99
|
+
if (at - 1 > startAt)
|
|
100
|
+
string += text.substring(startAt, at - 1);
|
|
101
|
+
next();
|
|
102
|
+
if (ch === 'u') {
|
|
103
|
+
uffff = 0;
|
|
104
|
+
for (i = 0; i < 4; i += 1) {
|
|
105
|
+
hex = parseInt(next(), 16);
|
|
106
|
+
if (!isFinite(hex)) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
uffff = uffff * 16 + hex;
|
|
110
|
+
}
|
|
111
|
+
string += String.fromCharCode(uffff);
|
|
112
|
+
}
|
|
113
|
+
else if (typeof escapee[ch] === 'string') {
|
|
114
|
+
string += escapee[ch];
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
startAt = at;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
error('Bad string');
|
|
124
|
+
}
|
|
125
|
+
function white() {
|
|
126
|
+
// Skip whitespace.
|
|
127
|
+
while (ch && ch <= ' ') {
|
|
128
|
+
next();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function word() {
|
|
132
|
+
// true, false, or null.
|
|
133
|
+
switch (ch) {
|
|
134
|
+
case 't':
|
|
135
|
+
next('t');
|
|
136
|
+
next('r');
|
|
137
|
+
next('u');
|
|
138
|
+
next('e');
|
|
139
|
+
return true;
|
|
140
|
+
case 'f':
|
|
141
|
+
next('f');
|
|
142
|
+
next('a');
|
|
143
|
+
next('l');
|
|
144
|
+
next('s');
|
|
145
|
+
next('e');
|
|
146
|
+
return false;
|
|
147
|
+
case 'n':
|
|
148
|
+
next('n');
|
|
149
|
+
next('u');
|
|
150
|
+
next('l');
|
|
151
|
+
next('l');
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
error("Unexpected '" + ch + "'");
|
|
155
|
+
}
|
|
156
|
+
function value() {
|
|
157
|
+
// Parse a JSON value. It could be an object, an array, a string, a number,
|
|
158
|
+
// or a word.
|
|
159
|
+
white();
|
|
160
|
+
switch (ch) {
|
|
161
|
+
case '{':
|
|
162
|
+
return object();
|
|
163
|
+
case '[':
|
|
164
|
+
return array();
|
|
165
|
+
case '"':
|
|
166
|
+
return string();
|
|
167
|
+
case '-':
|
|
168
|
+
return number();
|
|
169
|
+
default:
|
|
170
|
+
return ch >= '0' && ch <= '9' ? number() : word();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function array() {
|
|
174
|
+
// Parse an array value.
|
|
175
|
+
const array = [];
|
|
176
|
+
if (ch === '[') {
|
|
177
|
+
next('[');
|
|
178
|
+
white();
|
|
179
|
+
if (ch === ']') {
|
|
180
|
+
next(']');
|
|
181
|
+
return array; // empty array
|
|
182
|
+
}
|
|
183
|
+
while (ch) {
|
|
184
|
+
array.push(value());
|
|
185
|
+
white();
|
|
186
|
+
if (ch === ']') {
|
|
187
|
+
next(']');
|
|
188
|
+
return array;
|
|
189
|
+
}
|
|
190
|
+
next(',');
|
|
191
|
+
white();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
error('Bad array');
|
|
195
|
+
}
|
|
196
|
+
function object() {
|
|
197
|
+
// Parse an object value.
|
|
198
|
+
let key;
|
|
199
|
+
const obj = Object.create(null);
|
|
200
|
+
if (ch === '{') {
|
|
201
|
+
next('{');
|
|
202
|
+
white();
|
|
203
|
+
if (ch === '}') {
|
|
204
|
+
next('}');
|
|
205
|
+
return obj; // empty object
|
|
206
|
+
}
|
|
207
|
+
while (ch) {
|
|
208
|
+
key = string();
|
|
209
|
+
white();
|
|
210
|
+
next(':');
|
|
211
|
+
if (Object.hasOwnProperty.call(obj, key)) {
|
|
212
|
+
error('Duplicate key "' + key + '"');
|
|
213
|
+
}
|
|
214
|
+
if (suspectProtoRx.test(key) === true) {
|
|
215
|
+
error('Object contains forbidden prototype property');
|
|
216
|
+
}
|
|
217
|
+
else if (suspectConstructorRx.test(key) === true) {
|
|
218
|
+
error('Object contains forbidden constructor property');
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
obj[key] = value();
|
|
222
|
+
}
|
|
223
|
+
white();
|
|
224
|
+
if (ch === '}') {
|
|
225
|
+
next('}');
|
|
226
|
+
return obj;
|
|
227
|
+
}
|
|
228
|
+
next(',');
|
|
229
|
+
white();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
error('Bad object');
|
|
233
|
+
}
|
|
234
|
+
const result = value();
|
|
235
|
+
white();
|
|
236
|
+
if (ch) {
|
|
237
|
+
error('Syntax error');
|
|
238
|
+
}
|
|
239
|
+
return result;
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=Yy.parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.parse.js","sourceRoot":"","sources":["../src/Yy.parse.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,cAAc,GAClB,yIAAyI,CAAC;AAC5I,MAAM,oBAAoB,GACxB,0JAA0J,CAAC;AAE7J,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,GAAG;IACR,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;CACR,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,wBAAwB;IACxB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IA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,CAAC;IACR,IAAI,EAAE,EAAE;QACN,KAAK,CAAC,cAAc,CAAC,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.stringify.d.ts","sourceRoot":"","sources":["../src/Yy.stringify.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,UAgItC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const escapable =
|
|
2
|
+
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
3
|
+
/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
|
4
|
+
const meta = {
|
|
5
|
+
// table of character substitutions
|
|
6
|
+
'\b': '\\b',
|
|
7
|
+
'\t': '\\t',
|
|
8
|
+
'\n': '\\n',
|
|
9
|
+
'\f': '\\f',
|
|
10
|
+
'\r': '\\r',
|
|
11
|
+
'"': '\\"',
|
|
12
|
+
'\\': '\\\\',
|
|
13
|
+
};
|
|
14
|
+
const eol = `\r\n`; // GMS2 writes Windows-style line endings.
|
|
15
|
+
function quote(string) {
|
|
16
|
+
// If the string contains no control characters, no quote characters, and no
|
|
17
|
+
// backslash characters, then we can safely slap some quotes around it.
|
|
18
|
+
// Otherwise we must also replace the offending characters with safe escape
|
|
19
|
+
// sequences.
|
|
20
|
+
escapable.lastIndex = 0;
|
|
21
|
+
return escapable.test(string)
|
|
22
|
+
? '"' +
|
|
23
|
+
string.replace(escapable, function (a) {
|
|
24
|
+
const c = meta[a];
|
|
25
|
+
return typeof c === 'string'
|
|
26
|
+
? c
|
|
27
|
+
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
28
|
+
}) +
|
|
29
|
+
'"'
|
|
30
|
+
: '"' + string + '"';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Jsonify, with GameMaker-like JSON and allowing for BigInts.
|
|
34
|
+
* Based on {@link https://github.com/sidorares/json-bigint/blob/master/lib/stringify.js}
|
|
35
|
+
*/
|
|
36
|
+
export function stringifyYy(yyData) {
|
|
37
|
+
let gap = '';
|
|
38
|
+
let level = 0; // Level 1 are root elements
|
|
39
|
+
const indent = ' ';
|
|
40
|
+
function stringify(key, holder) {
|
|
41
|
+
// Produce a string from holder[key].
|
|
42
|
+
let value = holder[key];
|
|
43
|
+
const mind = gap;
|
|
44
|
+
const startingLevel = level;
|
|
45
|
+
// Allow for custom number objects (e.g. NumberFixed),
|
|
46
|
+
// by directly converting any Number-extended instances
|
|
47
|
+
// to strings.
|
|
48
|
+
if (value instanceof Number) {
|
|
49
|
+
return String(value);
|
|
50
|
+
}
|
|
51
|
+
// If the value has a toJSON method, call it to obtain a replacement value.
|
|
52
|
+
value = value?.toJSON?.(key) ?? value;
|
|
53
|
+
// What happens next depends on the value's type.
|
|
54
|
+
switch (typeof value) {
|
|
55
|
+
case 'string':
|
|
56
|
+
return quote(value);
|
|
57
|
+
case 'number':
|
|
58
|
+
// JSON numbers must be finite. Encode non-finite numbers as null.
|
|
59
|
+
return isFinite(value) ? String(value) : 'null';
|
|
60
|
+
case 'boolean':
|
|
61
|
+
case 'bigint':
|
|
62
|
+
// If the value is a boolean or null, convert it to a string. Note:
|
|
63
|
+
// typeof null does not produce 'null'. The case is included here in
|
|
64
|
+
// the remote chance that this gets fixed someday.
|
|
65
|
+
return String(value);
|
|
66
|
+
// If the type is 'object', we might be dealing with an object or an array or
|
|
67
|
+
// null.
|
|
68
|
+
case 'object': {
|
|
69
|
+
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
|
70
|
+
// so watch out for that case.
|
|
71
|
+
if (!value) {
|
|
72
|
+
return 'null';
|
|
73
|
+
}
|
|
74
|
+
// Make an array to hold the partial results of stringifying this object value.
|
|
75
|
+
gap += indent;
|
|
76
|
+
level++;
|
|
77
|
+
// Is the value an array?
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
// Stringify every element. Use null as a placeholder
|
|
80
|
+
// for non-JSON values.
|
|
81
|
+
const jsonifiedValues = value.map((_, i) => stringify(i, value) || 'null');
|
|
82
|
+
// Join all of the elements together, separated with commas, and wrap them in
|
|
83
|
+
// brackets.
|
|
84
|
+
const v = jsonifiedValues.length === 0
|
|
85
|
+
? '[]'
|
|
86
|
+
: `[${eol}` +
|
|
87
|
+
gap +
|
|
88
|
+
jsonifiedValues.join(`,${eol}` + gap) +
|
|
89
|
+
`,${eol}` +
|
|
90
|
+
mind +
|
|
91
|
+
']';
|
|
92
|
+
gap = mind;
|
|
93
|
+
level = startingLevel;
|
|
94
|
+
return v;
|
|
95
|
+
}
|
|
96
|
+
const includeGaps = level <= 2;
|
|
97
|
+
const partial = [];
|
|
98
|
+
Object.keys(value).forEach(function (k) {
|
|
99
|
+
const v = stringify(k, value);
|
|
100
|
+
if (v) {
|
|
101
|
+
partial.push(quote(k) + (includeGaps ? ': ' : ':') + v);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
// Join all of the member texts together, separated with commas,
|
|
105
|
+
// and wrap them in braces.
|
|
106
|
+
const v = partial.length === 0
|
|
107
|
+
? '{}'
|
|
108
|
+
: includeGaps
|
|
109
|
+
? `{${eol}` +
|
|
110
|
+
gap +
|
|
111
|
+
partial.join(`,${eol}` + gap) +
|
|
112
|
+
`,${eol}` +
|
|
113
|
+
mind +
|
|
114
|
+
'}'
|
|
115
|
+
: '{' + partial.join(',') + ',}';
|
|
116
|
+
gap = mind;
|
|
117
|
+
level = startingLevel;
|
|
118
|
+
return v;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// If there is a replacer, it must be a function or an array.
|
|
124
|
+
// Otherwise, throw an error.
|
|
125
|
+
// Make a fake root object containing our value under the key of ''.
|
|
126
|
+
// Return the result of stringifying the value.
|
|
127
|
+
return stringify('', {
|
|
128
|
+
'': yyData,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=Yy.stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Yy.stringify.js","sourceRoot":"","sources":["../src/Yy.stringify.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS;AACb,2EAA2E;AAC3E,yHAAyH,CAAC;AAC5H,MAAM,IAAI,GAAG;IACX,mCAAmC;IACnC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,0CAA0C;AAE9D,SAAS,KAAK,CAAC,MAAc;IAC3B,4EAA4E;IAC5E,uEAAuE;IACvE,2EAA2E;IAC3E,aAAa;IAEb,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC;IACxB,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;QAC3B,CAAC,CAAC,GAAG;YACD,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC;gBACnC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAsB,CAAC,CAAC;gBACvC,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC;YACF,GAAG;QACP,CAAC,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAW;IACrC,IAAI,GAAG,GAA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AAI;4BACJ,GAAG;wBACL,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACrC,GAAG,GAAG,IAAI,CAAC;gBACX,KAAK,GAAG,aAAa,CAAC;gBACtB,OAAO,CAAC,CAAC;aACV;SACF;QACD,OAAO;IACT,CAAC;IAED,6DAA6D;IAC7D,6BAA6B;IAE7B,oEAAoE;IACpE,+CAA+C;IAE/C,OAAO,SAAS,CAAC,EAAE,EAAE;QACnB,EAAE,EAAE,MAAM;KACX,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bscotch/yy",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Stringify, parse, read, and write GameMaker yy and yyp files.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"yy",
|
|
7
|
+
"yyp",
|
|
8
|
+
"game maker",
|
|
9
|
+
"gamemaker",
|
|
10
|
+
"yoyo",
|
|
11
|
+
"json",
|
|
12
|
+
"parse",
|
|
13
|
+
"stringify",
|
|
14
|
+
"file",
|
|
15
|
+
"read",
|
|
16
|
+
"write"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"tslib": "^2.4.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@bscotch/utility": "^6.1.1",
|
|
32
|
+
"chai": "^4.3.6",
|
|
33
|
+
"typescript": "^4.8.0-beta"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc --build",
|
|
40
|
+
"test": "treb test",
|
|
41
|
+
"watch": "tsc --build --watch"
|
|
42
|
+
}
|
|
43
|
+
}
|