@spyglassmc/json 0.1.2 → 0.3.1
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/lib/checker/JsonChecker.d.ts +1 -1
- package/lib/checker/JsonChecker.js +1 -2
- package/lib/checker/index.d.ts +2 -2
- package/lib/checker/index.js +2 -18
- package/lib/checker/primitives/boolean.d.ts +2 -2
- package/lib/checker/primitives/boolean.js +6 -10
- package/lib/checker/primitives/index.d.ts +6 -6
- package/lib/checker/primitives/index.js +6 -22
- package/lib/checker/primitives/list.d.ts +2 -2
- package/lib/checker/primitives/list.js +12 -17
- package/lib/checker/primitives/number.d.ts +1 -1
- package/lib/checker/primitives/number.js +12 -15
- package/lib/checker/primitives/object.d.ts +2 -2
- package/lib/checker/primitives/object.js +36 -50
- package/lib/checker/primitives/string.d.ts +6 -6
- package/lib/checker/primitives/string.js +16 -45
- package/lib/checker/primitives/util.d.ts +2 -2
- package/lib/checker/primitives/util.js +15 -24
- package/lib/colorizer/index.d.ts +1 -1
- package/lib/colorizer/index.js +12 -42
- package/lib/completer/index.d.ts +1 -1
- package/lib/completer/index.js +24 -54
- package/lib/formatter/index.d.ts +1 -1
- package/lib/formatter/index.js +5 -32
- package/lib/index.d.ts +7 -7
- package/lib/index.js +11 -41
- package/lib/node/JsonAstNode.d.ts +4 -4
- package/lib/node/JsonAstNode.js +25 -51
- package/lib/node/index.d.ts +1 -1
- package/lib/node/index.js +1 -17
- package/lib/parser/array.d.ts +1 -1
- package/lib/parser/array.js +4 -31
- package/lib/parser/boolean.d.ts +1 -1
- package/lib/parser/boolean.js +5 -32
- package/lib/parser/entry.d.ts +1 -1
- package/lib/parser/entry.js +15 -42
- package/lib/parser/index.d.ts +5 -5
- package/lib/parser/index.js +5 -21
- package/lib/parser/null.d.ts +1 -1
- package/lib/parser/null.js +4 -31
- package/lib/parser/number.d.ts +1 -1
- package/lib/parser/number.js +2 -29
- package/lib/parser/object.d.ts +1 -1
- package/lib/parser/object.js +5 -32
- package/lib/parser/string.d.ts +1 -1
- package/lib/parser/string.js +4 -31
- package/package.json +4 -3
- package/lib/util.d.ts +0 -1
- package/lib/util.js +0 -2
package/lib/node/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./JsonAstNode"), exports);
|
|
1
|
+
export * from './JsonAstNode.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/lib/parser/array.d.ts
CHANGED
package/lib/parser/array.js
CHANGED
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.array = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const entry_1 = require("./entry");
|
|
29
|
-
const array = (src, ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { entry } from './entry.js';
|
|
3
|
+
export const array = (src, ctx) => {
|
|
30
4
|
const parser = core.list({
|
|
31
5
|
start: '[',
|
|
32
|
-
value:
|
|
6
|
+
value: entry,
|
|
33
7
|
sep: ',',
|
|
34
8
|
trailingSep: false,
|
|
35
9
|
end: ']',
|
|
@@ -38,5 +12,4 @@ const array = (src, ctx) => {
|
|
|
38
12
|
ans.type = 'json:array';
|
|
39
13
|
return ans;
|
|
40
14
|
};
|
|
41
|
-
exports.array = array;
|
|
42
15
|
//# sourceMappingURL=array.js.map
|
package/lib/parser/boolean.d.ts
CHANGED
package/lib/parser/boolean.js
CHANGED
|
@@ -1,48 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.boolean = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const core_1 = require("@spyglassmc/core");
|
|
29
|
-
const boolean = (src, ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { Range } from '@spyglassmc/core';
|
|
3
|
+
export const boolean = (src, ctx) => {
|
|
30
4
|
const start = src.cursor;
|
|
31
5
|
if (src.trySkip('false')) {
|
|
32
6
|
return {
|
|
33
7
|
type: 'json:boolean',
|
|
34
|
-
range:
|
|
8
|
+
range: Range.create(start, src),
|
|
35
9
|
value: false,
|
|
36
10
|
};
|
|
37
11
|
}
|
|
38
12
|
if (src.trySkip('true')) {
|
|
39
13
|
return {
|
|
40
14
|
type: 'json:boolean',
|
|
41
|
-
range:
|
|
15
|
+
range: Range.create(start, src),
|
|
42
16
|
value: true,
|
|
43
17
|
};
|
|
44
18
|
}
|
|
45
19
|
return core.Failure;
|
|
46
20
|
};
|
|
47
|
-
exports.boolean = boolean;
|
|
48
21
|
//# sourceMappingURL=boolean.js.map
|
package/lib/parser/entry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as core from '@spyglassmc/core';
|
|
2
|
-
import type { JsonNode } from '../node';
|
|
2
|
+
import type { JsonNode } from '../node/index.js';
|
|
3
3
|
export declare function json(dumpErrors?: boolean): core.Parser<JsonNode>;
|
|
4
4
|
export declare const entry: core.Parser<JsonNode>;
|
|
5
5
|
//# sourceMappingURL=entry.d.ts.map
|
package/lib/parser/entry.js
CHANGED
|
@@ -1,46 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.entry = exports.json = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const array_1 = require("./array");
|
|
29
|
-
const boolean_1 = require("./boolean");
|
|
30
|
-
const null_1 = require("./null");
|
|
31
|
-
const number_1 = require("./number");
|
|
32
|
-
const object_1 = require("./object");
|
|
33
|
-
const string_1 = require("./string");
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { array } from './array.js';
|
|
3
|
+
import { boolean } from './boolean.js';
|
|
4
|
+
import { null_ } from './null.js';
|
|
5
|
+
import { number } from './number.js';
|
|
6
|
+
import { object } from './object.js';
|
|
7
|
+
import { string } from './string.js';
|
|
34
8
|
const LegalNumberStart = new Set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-']);
|
|
35
|
-
function json(dumpErrors = false) {
|
|
9
|
+
export function json(dumpErrors = false) {
|
|
36
10
|
return (src, ctx) => {
|
|
37
11
|
const result = core.select([
|
|
38
|
-
{ predicate: src => src.tryPeek('['), parser:
|
|
39
|
-
{ predicate: src => src.tryPeek('false') || src.tryPeek('true'), parser:
|
|
40
|
-
{ predicate: src => src.tryPeek('null'), parser:
|
|
41
|
-
{ predicate: src => LegalNumberStart.has(src.peek()), parser:
|
|
42
|
-
{ predicate: src => src.tryPeek('{'), parser:
|
|
43
|
-
{ parser:
|
|
12
|
+
{ predicate: src => src.tryPeek('['), parser: array },
|
|
13
|
+
{ predicate: src => src.tryPeek('false') || src.tryPeek('true'), parser: boolean },
|
|
14
|
+
{ predicate: src => src.tryPeek('null'), parser: null_ },
|
|
15
|
+
{ predicate: src => LegalNumberStart.has(src.peek()), parser: number },
|
|
16
|
+
{ predicate: src => src.tryPeek('{'), parser: object },
|
|
17
|
+
{ parser: string },
|
|
44
18
|
])(src, ctx);
|
|
45
19
|
if (dumpErrors) {
|
|
46
20
|
ctx.err.dump();
|
|
@@ -48,6 +22,5 @@ function json(dumpErrors = false) {
|
|
|
48
22
|
return result;
|
|
49
23
|
};
|
|
50
24
|
}
|
|
51
|
-
|
|
52
|
-
exports.entry = json(true);
|
|
25
|
+
export const entry = json(true);
|
|
53
26
|
//# sourceMappingURL=entry.js.map
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './array';
|
|
2
|
-
export * from './entry';
|
|
3
|
-
export * from './number';
|
|
4
|
-
export * from './object';
|
|
5
|
-
export * from './string';
|
|
1
|
+
export * from './array.js';
|
|
2
|
+
export * from './entry.js';
|
|
3
|
+
export * from './number.js';
|
|
4
|
+
export * from './object.js';
|
|
5
|
+
export * from './string.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/parser/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./array"), exports);
|
|
18
|
-
__exportStar(require("./entry"), exports);
|
|
19
|
-
__exportStar(require("./number"), exports);
|
|
20
|
-
__exportStar(require("./object"), exports);
|
|
21
|
-
__exportStar(require("./string"), exports);
|
|
1
|
+
export * from './array.js';
|
|
2
|
+
export * from './entry.js';
|
|
3
|
+
export * from './number.js';
|
|
4
|
+
export * from './object.js';
|
|
5
|
+
export * from './string.js';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/lib/parser/null.d.ts
CHANGED
package/lib/parser/null.js
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.null_ = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const core_1 = require("@spyglassmc/core");
|
|
29
|
-
const null_ = (src, ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { Range } from '@spyglassmc/core';
|
|
3
|
+
export const null_ = (src, ctx) => {
|
|
30
4
|
const start = src.cursor;
|
|
31
5
|
if (src.trySkip('null')) {
|
|
32
6
|
return {
|
|
33
7
|
type: 'json:null',
|
|
34
|
-
range:
|
|
8
|
+
range: Range.create(start, src),
|
|
35
9
|
};
|
|
36
10
|
}
|
|
37
11
|
return core.Failure;
|
|
38
12
|
};
|
|
39
|
-
exports.null_ = null_;
|
|
40
13
|
//# sourceMappingURL=null.js.map
|
package/lib/parser/number.d.ts
CHANGED
package/lib/parser/number.js
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.number = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const number = (src, ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
export const number = (src, ctx) => {
|
|
29
3
|
const parser = core.float({
|
|
30
4
|
// Regex form of the chart from https://www.json.org.
|
|
31
5
|
pattern: /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?$/,
|
|
@@ -34,5 +8,4 @@ const number = (src, ctx) => {
|
|
|
34
8
|
ans.type = 'json:number';
|
|
35
9
|
return ans;
|
|
36
10
|
};
|
|
37
|
-
exports.number = number;
|
|
38
11
|
//# sourceMappingURL=number.js.map
|
package/lib/parser/object.d.ts
CHANGED
package/lib/parser/object.js
CHANGED
|
@@ -1,38 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.object = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
const entry_1 = require("./entry");
|
|
29
|
-
const string_1 = require("./string");
|
|
30
|
-
const object = (src, ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { entry } from './entry.js';
|
|
3
|
+
import { string } from './string.js';
|
|
4
|
+
export const object = (src, ctx) => {
|
|
31
5
|
return core.setType('json:object', core.record({
|
|
32
6
|
start: '{',
|
|
33
|
-
pair: { key:
|
|
7
|
+
pair: { key: string, sep: ':', value: entry, end: ',', trailingEnd: false },
|
|
34
8
|
end: '}',
|
|
35
9
|
}))(src, ctx);
|
|
36
10
|
};
|
|
37
|
-
exports.object = object;
|
|
38
11
|
//# sourceMappingURL=object.js.map
|
package/lib/parser/string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as core from '@spyglassmc/core';
|
|
2
|
-
import type { JsonStringNode } from '../node';
|
|
2
|
+
import type { JsonStringNode } from '../node/index.js';
|
|
3
3
|
export declare const JsonStringOptions: core.StringOptions;
|
|
4
4
|
export declare const string: core.Parser<JsonStringNode>;
|
|
5
5
|
//# sourceMappingURL=string.d.ts.map
|
package/lib/parser/string.js
CHANGED
|
@@ -1,42 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.string = exports.JsonStringOptions = void 0;
|
|
27
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
-
exports.JsonStringOptions = {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
export const JsonStringOptions = {
|
|
29
3
|
escapable: {
|
|
30
4
|
characters: ['b', 'f', 'n', 'r', 't'],
|
|
31
5
|
unicode: true,
|
|
32
6
|
},
|
|
33
7
|
quotes: ['"'],
|
|
34
8
|
};
|
|
35
|
-
const string = (src, ctx) => {
|
|
36
|
-
const parser = core.string(
|
|
9
|
+
export const string = (src, ctx) => {
|
|
10
|
+
const parser = core.string(JsonStringOptions);
|
|
37
11
|
const ans = parser(src, ctx);
|
|
38
12
|
ans.type = 'json:string';
|
|
39
13
|
return ans;
|
|
40
14
|
};
|
|
41
|
-
exports.string = string;
|
|
42
15
|
//# sourceMappingURL=string.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/json",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "lib/index.js",
|
|
5
6
|
"types": "lib/index.d.ts",
|
|
6
7
|
"author": "Misode",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"url": "https://github.com/SpyglassMC/Spyglass/issues"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@spyglassmc/core": "0.
|
|
28
|
-
"@spyglassmc/locales": "0.
|
|
28
|
+
"@spyglassmc/core": "0.4.0",
|
|
29
|
+
"@spyglassmc/locales": "0.3.0"
|
|
29
30
|
}
|
|
30
31
|
}
|
package/lib/util.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=util.d.ts.map
|
package/lib/util.js
DELETED