@spyglassmc/java-edition 0.1.2 → 0.3.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.
Files changed (77) hide show
  1. package/lib/binder/index.d.ts +1 -1
  2. package/lib/binder/index.js +11 -17
  3. package/lib/common/index.js +6 -33
  4. package/lib/dependency/common.js +6 -9
  5. package/lib/dependency/index.d.ts +6 -6
  6. package/lib/dependency/index.js +18 -49
  7. package/lib/dependency/mcmeta.d.ts +2 -2
  8. package/lib/dependency/mcmeta.js +8 -37
  9. package/lib/index.d.ts +3 -3
  10. package/lib/index.js +21 -48
  11. package/lib/json/checker/data/advancement.d.ts +13 -13
  12. package/lib/json/checker/data/advancement.js +263 -266
  13. package/lib/json/checker/data/biome.d.ts +3 -3
  14. package/lib/json/checker/data/biome.js +98 -101
  15. package/lib/json/checker/data/common.d.ts +1 -1
  16. package/lib/json/checker/data/common.js +145 -152
  17. package/lib/json/checker/data/dimension.d.ts +3 -3
  18. package/lib/json/checker/data/dimension.js +148 -151
  19. package/lib/json/checker/data/feature.d.ts +8 -8
  20. package/lib/json/checker/data/feature.js +370 -373
  21. package/lib/json/checker/data/index.d.ts +2 -2
  22. package/lib/json/checker/data/index.js +36 -39
  23. package/lib/json/checker/data/loot_table.d.ts +7 -7
  24. package/lib/json/checker/data/loot_table.js +125 -128
  25. package/lib/json/checker/data/recipe.d.ts +1 -1
  26. package/lib/json/checker/data/recipe.js +25 -28
  27. package/lib/json/checker/data/structure.d.ts +7 -7
  28. package/lib/json/checker/data/structure.js +80 -83
  29. package/lib/json/checker/data/tag.d.ts +6 -6
  30. package/lib/json/checker/data/tag.js +23 -26
  31. package/lib/json/checker/data/text_component.d.ts +1 -1
  32. package/lib/json/checker/data/text_component.js +61 -64
  33. package/lib/json/checker/index.js +14 -19
  34. package/lib/json/checker/util/advancement.d.ts +1 -1
  35. package/lib/json/checker/util/advancement.js +6 -10
  36. package/lib/json/checker/util/block_states.d.ts +1 -1
  37. package/lib/json/checker/util/block_states.js +25 -53
  38. package/lib/json/checker/util/color.d.ts +1 -1
  39. package/lib/json/checker/util/color.js +24 -29
  40. package/lib/json/checker/util/index.d.ts +7 -7
  41. package/lib/json/checker/util/index.js +7 -23
  42. package/lib/json/checker/util/nbt.d.ts +1 -1
  43. package/lib/json/checker/util/nbt.js +23 -28
  44. package/lib/json/checker/util/recipe.d.ts +1 -1
  45. package/lib/json/checker/util/recipe.js +4 -8
  46. package/lib/json/checker/util/uuid.d.ts +1 -1
  47. package/lib/json/checker/util/uuid.js +4 -7
  48. package/lib/json/checker/util/version.d.ts +2 -2
  49. package/lib/json/checker/util/version.js +7 -13
  50. package/lib/json/index.d.ts +1 -1
  51. package/lib/json/index.js +4 -31
  52. package/lib/mcfunction/checker/index.d.ts +1 -1
  53. package/lib/mcfunction/checker/index.js +24 -53
  54. package/lib/mcfunction/colorizer/index.d.ts +1 -1
  55. package/lib/mcfunction/colorizer/index.js +6 -35
  56. package/lib/mcfunction/common/index.js +7 -33
  57. package/lib/mcfunction/completer/argument.js +93 -120
  58. package/lib/mcfunction/completer/index.d.ts +1 -1
  59. package/lib/mcfunction/completer/index.js +1 -17
  60. package/lib/mcfunction/index.d.ts +5 -5
  61. package/lib/mcfunction/index.js +16 -43
  62. package/lib/mcfunction/inlayHintProvider.js +3 -30
  63. package/lib/mcfunction/node/argument.d.ts +7 -7
  64. package/lib/mcfunction/node/argument.js +38 -63
  65. package/lib/mcfunction/node/index.d.ts +1 -1
  66. package/lib/mcfunction/node/index.js +1 -17
  67. package/lib/mcfunction/parser/argument.d.ts +1 -1
  68. package/lib/mcfunction/parser/argument.js +72 -100
  69. package/lib/mcfunction/parser/index.d.ts +1 -1
  70. package/lib/mcfunction/parser/index.js +1 -17
  71. package/lib/mcfunction/signatureHelpProvider.js +3 -30
  72. package/lib/mcfunction/tree/argument.js +1 -2
  73. package/lib/mcfunction/tree/index.d.ts +1 -1
  74. package/lib/mcfunction/tree/index.js +1 -17
  75. package/lib/mcfunction/tree/patch.d.ts +1 -1
  76. package/lib/mcfunction/tree/patch.js +5 -9
  77. package/package.json +8 -7
@@ -1,88 +1,60 @@
1
- "use strict";
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 __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.blockStateList = exports.blockStateMap = void 0;
27
- const core = __importStar(require("@spyglassmc/core"));
28
- const checker_1 = require("@spyglassmc/json/lib/checker");
29
- const common_1 = require("../../../common");
30
- function blockStateMap({ category, id, ids, tag, mixedTypes, requireAll }) {
1
+ import * as core from '@spyglassmc/core';
2
+ import { any, boolean, intRange, listOf, literal, object, opt, record, simpleString } from '@spyglassmc/json/lib/checker/index.js';
3
+ import { getTagValues } from '../../../common/index.js';
4
+ export function blockStateMap({ category, id, ids, tag, mixedTypes, requireAll }) {
31
5
  return (node, ctx) => {
32
6
  if (tag) {
33
- ids = (0, common_1.getTagValues)(`tag/${category ?? 'block'}`, tag, ctx);
7
+ ids = getTagValues(`tag/${category ?? 'block'}`, tag, ctx);
34
8
  }
35
9
  else if (id) {
36
10
  ids = [id];
37
11
  }
38
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
39
- if (!ids?.length || !ctx.ensureChecked) {
40
- const values = mixedTypes ? (0, checker_1.any)([checker_1.boolean, checker_1.simpleString, intBounds()]) : checker_1.simpleString;
41
- (0, checker_1.object)(checker_1.simpleString, () => requireAll ? values : (0, checker_1.opt)(values))(node, ctx);
12
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
13
+ if (!ids?.length || !ctx.ensureBindingStarted) {
14
+ const values = mixedTypes ? any([boolean, simpleString, intBounds()]) : simpleString;
15
+ object(simpleString, () => requireAll ? values : opt(values))(node, ctx);
42
16
  return;
43
17
  }
44
18
  const states = core.getStates(category ?? 'block', ids, ctx);
45
- (0, checker_1.object)(Object.keys(states), (state) => {
19
+ object(Object.keys(states), (state) => {
46
20
  const values = states[state] ?? [];
47
- const checkers = [(0, checker_1.literal)(values)];
21
+ const checkers = [literal(values)];
48
22
  if (mixedTypes && values.length) {
49
23
  if (['true', 'false'].includes(values[0])) {
50
- checkers.push(checker_1.boolean);
24
+ checkers.push(boolean);
51
25
  }
52
26
  else if (values[0].match(/^\d+$/)) {
53
27
  checkers.push(intBounds(parseInt(values[0]), parseInt(values[values.length - 1])));
54
28
  }
55
29
  }
56
- const checker = checkers.length > 1 ? (0, checker_1.any)(checkers) : checkers[0];
57
- return requireAll ? checker : (0, checker_1.opt)(checker);
30
+ const checker = checkers.length > 1 ? any(checkers) : checkers[0];
31
+ return requireAll ? checker : opt(checker);
58
32
  })(node, ctx);
59
33
  };
60
34
  }
61
- exports.blockStateMap = blockStateMap;
62
- function blockStateList({ category, id, ids, tag }) {
35
+ export function blockStateList({ category, id, ids, tag }) {
63
36
  return (node, ctx) => {
64
37
  if (tag) {
65
- ids = (0, common_1.getTagValues)(`tag/${category ?? 'block'}`, tag, ctx);
38
+ ids = getTagValues(`tag/${category ?? 'block'}`, tag, ctx);
66
39
  }
67
40
  else if (id) {
68
41
  ids = [id];
69
42
  }
70
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
71
- if (!ids?.length || !ctx.ensureChecked) {
72
- (0, checker_1.listOf)(checker_1.simpleString)(node, ctx);
43
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
44
+ if (!ids?.length || !ctx.ensureBindingStarted) {
45
+ listOf(simpleString)(node, ctx);
73
46
  return;
74
47
  }
75
48
  const states = core.getStates(category ?? 'block', ids, ctx);
76
- (0, checker_1.listOf)((0, checker_1.literal)(Object.keys(states)))(node, ctx);
49
+ listOf(literal(Object.keys(states)))(node, ctx);
77
50
  };
78
51
  }
79
- exports.blockStateList = blockStateList;
80
52
  function intBounds(min = undefined, max = undefined) {
81
- return (0, checker_1.any)([
82
- (0, checker_1.intRange)(min, max),
83
- (0, checker_1.record)({
84
- min: (0, checker_1.opt)((0, checker_1.intRange)(min, max)),
85
- max: (0, checker_1.opt)((0, checker_1.intRange)(min, max)),
53
+ return any([
54
+ intRange(min, max),
55
+ record({
56
+ min: opt(intRange(min, max)),
57
+ max: opt(intRange(min, max)),
86
58
  }),
87
59
  ]);
88
60
  }
@@ -1,4 +1,4 @@
1
- import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
1
+ import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
2
2
  export declare function stringColor(): JsonChecker;
3
3
  export declare function intColor(): JsonChecker;
4
4
  //# sourceMappingURL=color.d.ts.map
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.intColor = exports.stringColor = void 0;
4
- const core_1 = require("@spyglassmc/core");
5
- const json_1 = require("@spyglassmc/json");
6
- const locales_1 = require("@spyglassmc/locales");
7
- function stringColor() {
1
+ import { Color, ColorFormat, Failure, parseStringValue, Range } from '@spyglassmc/core';
2
+ import { JsonNumberNode, JsonStringNode } from '@spyglassmc/json';
3
+ import { localize } from '@spyglassmc/locales';
4
+ export function stringColor() {
8
5
  const HexPattern = /^[0-9a-f]{1,6}$/i;
9
6
  const parser = (src, ctx) => {
10
7
  let value = 0;
@@ -15,50 +12,48 @@ function stringColor() {
15
12
  value = parseInt(remaining, 16);
16
13
  }
17
14
  else {
18
- ctx.err.report((0, locales_1.localize)('expected', (0, locales_1.localize)('json.checker.string.hex-color')), core_1.Range.create(start, src));
15
+ ctx.err.report(localize('expected', localize('json.checker.string.hex-color')), Range.create(start, src));
19
16
  }
20
17
  }
21
18
  else {
22
19
  const remaining = src.readRemaining();
23
- if (core_1.Color.NamedColors.has(remaining)) {
24
- value = core_1.Color.NamedColors.get(remaining);
20
+ if (Color.NamedColors.has(remaining)) {
21
+ value = Color.NamedColors.get(remaining);
25
22
  }
26
23
  else {
27
- ctx.err.report((0, locales_1.localize)('expected', core_1.Color.ColorNames), core_1.Range.create(start, src));
24
+ ctx.err.report(localize('expected', Color.ColorNames), Range.create(start, src));
28
25
  }
29
26
  }
30
- return core_1.Color.fromCompositeInt(value);
27
+ return Color.fromCompositeInt(value);
31
28
  };
32
29
  return (node, ctx) => {
33
- ctx.ops.set(node, 'expectation', [{ type: 'json:string', typedoc: 'String("Color")', pool: core_1.Color.ColorNames }]);
34
- if (!json_1.JsonStringNode.is(node)) {
35
- ctx.err.report((0, locales_1.localize)('expected', (0, locales_1.localize)('string')), node);
30
+ node.expectation = [{ type: 'json:string', typedoc: 'String("Color")', pool: Color.ColorNames }];
31
+ if (!JsonStringNode.is(node)) {
32
+ ctx.err.report(localize('expected', localize('string')), node);
36
33
  }
37
34
  else {
38
- const result = (0, core_1.parseStringValue)(parser, node.value, node.valueMap, ctx);
39
- if (result !== core_1.Failure) {
40
- ctx.ops.set(node, 'color', {
35
+ const result = parseStringValue(parser, node.value, node.valueMap, ctx);
36
+ if (result !== Failure) {
37
+ node.color = {
41
38
  value: result,
42
- format: [core_1.ColorFormat.HexRGB],
39
+ format: [ColorFormat.HexRGB],
43
40
  range: { start: node.range.start + 1, end: node.range.end - 1 },
44
- });
41
+ };
45
42
  }
46
43
  }
47
44
  };
48
45
  }
49
- exports.stringColor = stringColor;
50
- function intColor() {
46
+ export function intColor() {
51
47
  return (node, ctx) => {
52
- if (!json_1.JsonNumberNode.is(node) || !Number.isInteger(node.value)) {
53
- ctx.err.report((0, locales_1.localize)('expected', (0, locales_1.localize)('integer')), node);
48
+ if (!JsonNumberNode.is(node) || !Number.isInteger(node.value)) {
49
+ ctx.err.report(localize('expected', localize('integer')), node);
54
50
  }
55
51
  else {
56
- ctx.ops.set(node, 'color', {
57
- value: core_1.Color.fromCompositeInt(node.value),
58
- format: [core_1.ColorFormat.CompositeInt],
59
- });
52
+ node.color = {
53
+ value: Color.fromCompositeInt(node.value),
54
+ format: [ColorFormat.CompositeInt],
55
+ };
60
56
  }
61
57
  };
62
58
  }
63
- exports.intColor = intColor;
64
59
  //# sourceMappingURL=color.js.map
@@ -1,8 +1,8 @@
1
- export * from './advancement';
2
- export * from './block_states';
3
- export * from './color';
4
- export * from './nbt';
5
- export * from './recipe';
6
- export * from './uuid';
7
- export * from './version';
1
+ export * from './advancement.js';
2
+ export * from './block_states.js';
3
+ export * from './color.js';
4
+ export * from './nbt.js';
5
+ export * from './recipe.js';
6
+ export * from './uuid.js';
7
+ export * from './version.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,24 +1,8 @@
1
- "use strict";
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("./advancement"), exports);
18
- __exportStar(require("./block_states"), exports);
19
- __exportStar(require("./color"), exports);
20
- __exportStar(require("./nbt"), exports);
21
- __exportStar(require("./recipe"), exports);
22
- __exportStar(require("./uuid"), exports);
23
- __exportStar(require("./version"), exports);
1
+ export * from './advancement.js';
2
+ export * from './block_states.js';
3
+ export * from './color.js';
4
+ export * from './nbt.js';
5
+ export * from './recipe.js';
6
+ export * from './uuid.js';
7
+ export * from './version.js';
24
8
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
1
+ import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
2
2
  interface DefinitionOptions {
3
3
  definition: `::${string}::${string}`;
4
4
  }
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nbtPath = exports.nbt = void 0;
4
- const core_1 = require("@spyglassmc/core");
5
- const checker_1 = require("@spyglassmc/json/lib/checker");
6
- const nbt_1 = require("@spyglassmc/nbt");
7
- const common_1 = require("../../../common");
8
- function nbt(options) {
1
+ import { ResourceLocation } from '@spyglassmc/core';
2
+ import { simpleString, string } from '@spyglassmc/json/lib/checker/index.js';
3
+ import { checker as nbtChecker } from '@spyglassmc/nbt';
4
+ import { getTagValues } from '../../../common/index.js';
5
+ export function nbt(options) {
9
6
  if (isDefinitionOptions(options)) {
10
7
  return definitionNbt(options);
11
8
  }
@@ -13,59 +10,57 @@ function nbt(options) {
13
10
  return registryNbt(options);
14
11
  }
15
12
  }
16
- exports.nbt = nbt;
17
13
  function isDefinitionOptions(options) {
18
14
  return typeof options.definition === 'string';
19
15
  }
20
16
  function definitionNbt({ definition }) {
21
17
  return (node, ctx) => {
22
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
23
- if (!ctx.ensureChecked) {
24
- (0, checker_1.simpleString)(node, ctx);
18
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
19
+ if (!ctx.ensureBindingStarted) {
20
+ simpleString(node, ctx);
25
21
  return;
26
22
  }
27
23
  const parser = ctx.meta.getParserLazily('nbt:compound');
28
- const checker = nbt_1.checker.definition(definition);
29
- (0, checker_1.string)('nbt', parser, checker)(node, ctx);
24
+ const checker = nbtChecker.definition(definition);
25
+ string('nbt', parser, checker)(node, ctx);
30
26
  };
31
27
  }
32
28
  function registryNbt(options) {
33
29
  return (node, ctx) => {
34
30
  const ids = getIds(options, ctx);
35
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
36
- if (!ctx.ensureChecked) {
37
- (0, checker_1.simpleString)(node, ctx);
31
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
32
+ if (!ctx.ensureBindingStarted) {
33
+ simpleString(node, ctx);
38
34
  return;
39
35
  }
40
36
  const parser = ctx.meta.getParser('nbt:compound');
41
- const checker = nbt_1.checker.index(options.registry, ids);
42
- (0, checker_1.string)('nbt', parser, checker)(node, ctx);
37
+ const checker = nbtChecker.index(options.registry, ids);
38
+ string('nbt', parser, checker)(node, ctx);
43
39
  };
44
40
  }
45
- function nbtPath(options) {
41
+ export function nbtPath(options) {
46
42
  return (node, ctx) => {
47
43
  const ids = getIds(options, ctx);
48
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
49
- if (!ctx.ensureChecked) {
50
- (0, checker_1.simpleString)(node, ctx);
44
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
45
+ if (!ctx.ensureBindingStarted) {
46
+ simpleString(node, ctx);
51
47
  return;
52
48
  }
53
49
  const parser = ctx.meta.getParser('nbt:path');
54
- const checker = nbt_1.checker.path(options.registry, ids);
55
- (0, checker_1.string)('nbt_path', parser, checker)(node, ctx);
50
+ const checker = nbtChecker.path(options.registry, ids);
51
+ string('nbt_path', parser, checker)(node, ctx);
56
52
  };
57
53
  }
58
- exports.nbtPath = nbtPath;
59
54
  function getIds({ registry, id, idOrTag, ids, tag }, ctx) {
60
55
  if (idOrTag) {
61
56
  idOrTag.startsWith('#') ? tag = idOrTag.slice(1) : id = idOrTag;
62
57
  }
63
58
  if (tag && (registry === 'block' || registry === 'item' || registry === 'entity_type')) {
64
- ids = (0, common_1.getTagValues)(`tag/${registry}`, tag, ctx);
59
+ ids = getTagValues(`tag/${registry}`, tag, ctx);
65
60
  }
66
61
  else if (id) {
67
62
  ids = [id];
68
63
  }
69
- return ids?.map(core_1.ResourceLocation.lengthen);
64
+ return ids?.map(ResourceLocation.lengthen);
70
65
  }
71
66
  //# sourceMappingURL=nbt.js.map
@@ -1,6 +1,6 @@
1
1
  import type { PairNode } from '@spyglassmc/core';
2
2
  import type { JsonNode, JsonStringNode } from '@spyglassmc/json';
3
- import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
3
+ import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
4
4
  export declare const recipeGroup: JsonChecker;
5
5
  export declare function patternKeys(props: PairNode<JsonStringNode, JsonNode>[]): string[];
6
6
  //# sourceMappingURL=recipe.d.ts.map
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patternKeys = exports.recipeGroup = void 0;
4
- const core_1 = require("@spyglassmc/core");
5
- const checker_1 = require("@spyglassmc/json/lib/checker");
6
- exports.recipeGroup = (0, checker_1.string)('recipe_group', (0, core_1.symbol)('recipe_group'));
7
- function patternKeys(props) {
1
+ import { symbol } from '@spyglassmc/core';
2
+ import { string } from '@spyglassmc/json/lib/checker/index.js';
3
+ export const recipeGroup = string('recipe_group', symbol('recipe_group'));
4
+ export function patternKeys(props) {
8
5
  return [...new Set((props
9
6
  .find(p => p.key?.value === 'pattern' && p.value?.type === 'json:array')?.value?.children ?? [])
10
7
  .map(n => n.value)
@@ -12,5 +9,4 @@ function patternKeys(props) {
12
9
  .flatMap(n => [...n.value])
13
10
  .filter(v => v !== ' '))];
14
11
  }
15
- exports.patternKeys = patternKeys;
16
12
  //# sourceMappingURL=recipe.js.map
@@ -1,2 +1,2 @@
1
- export declare const uuid: import("@spyglassmc/json/lib/checker").JsonChecker;
1
+ export declare const uuid: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
2
2
  //# sourceMappingURL=uuid.d.ts.map
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uuid = void 0;
4
- const locales_1 = require("@spyglassmc/locales");
5
- const checker_1 = require("@spyglassmc/json/lib/checker");
1
+ import { string } from '@spyglassmc/json/lib/checker/index.js';
2
+ import { localize } from '@spyglassmc/locales';
6
3
  const UuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7
- exports.uuid = (0, checker_1.string)(undefined, undefined, (node, ctx) => {
4
+ export const uuid = string(undefined, undefined, (node, ctx) => {
8
5
  if (!node.value.match(UuidRegex)) {
9
- ctx.err.report((0, locales_1.localize)('expected', (0, locales_1.localize)('uuid')), node);
6
+ ctx.err.report(localize('expected', localize('uuid')), node);
10
7
  }
11
8
  });
12
9
  //# sourceMappingURL=uuid.js.map
@@ -1,5 +1,5 @@
1
- import type { JsonChecker, JsonCheckerContext, record } from '@spyglassmc/json/lib/checker';
2
- import { ReleaseVersion } from '../../../dependency';
1
+ import type { JsonChecker, JsonCheckerContext, record } from '@spyglassmc/json/lib/checker/index.js';
2
+ import { ReleaseVersion } from '../../../dependency/index.js';
3
3
  declare type CheckerRecord = Parameters<typeof record>[0];
4
4
  export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: string[]): string[];
5
5
  export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: JsonChecker | undefined): JsonChecker | undefined;
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deprecated = exports.renamed = exports.versioned = void 0;
4
- const checker_1 = require("@spyglassmc/json/lib/checker");
5
- const dependency_1 = require("../../../dependency");
1
+ import { deprecate } from '@spyglassmc/json/lib/checker/index.js';
2
+ import { ReleaseVersion } from '../../../dependency/index.js';
6
3
  function getVersion(ctx) {
7
4
  return ctx.project['loadedVersion'];
8
5
  }
9
6
  function cmpVersion(ctx, target) {
10
- return dependency_1.ReleaseVersion.cmp(getVersion(ctx), target);
7
+ return ReleaseVersion.cmp(getVersion(ctx), target);
11
8
  }
12
- function versioned(ctx, arg1, arg2, arg3) {
9
+ export function versioned(ctx, arg1, arg2, arg3) {
13
10
  if (typeof arg1 === 'string') {
14
11
  const check = cmpVersion(ctx, arg1) >= 0;
15
12
  if (arg2 === undefined) {
@@ -35,20 +32,17 @@ function versioned(ctx, arg1, arg2, arg3) {
35
32
  }
36
33
  }
37
34
  }
38
- exports.versioned = versioned;
39
- function renamed(ctx, from, version, to, checker) {
35
+ export function renamed(ctx, from, version, to, checker) {
40
36
  return versioned(ctx, {
41
37
  [from]: checker,
42
38
  }, version, {
43
39
  [to]: checker,
44
40
  });
45
41
  }
46
- exports.renamed = renamed;
47
- function deprecated(ctx, version, checker) {
42
+ export function deprecated(ctx, version, checker) {
48
43
  if (cmpVersion(ctx, version) < 0) {
49
44
  return checker;
50
45
  }
51
- return (0, checker_1.deprecate)(checker);
46
+ return deprecate(checker);
52
47
  }
53
- exports.deprecated = deprecated;
54
48
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
1
  import type * as core from '@spyglassmc/core';
2
- export * as checker from './checker';
2
+ export * as checker from './checker/index.js';
3
3
  export declare const initialize: (ctx: core.ProjectInitializerContext) => void;
4
4
  //# sourceMappingURL=index.d.ts.map
package/lib/json/index.js CHANGED
@@ -1,36 +1,9 @@
1
- "use strict";
2
1
  /* istanbul ignore file */
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.initialize = exports.checker = void 0;
28
- const json = __importStar(require("@spyglassmc/json"));
29
- const checker = __importStar(require("./checker"));
30
- exports.checker = __importStar(require("./checker"));
31
- const initialize = (ctx) => {
2
+ import * as json from '@spyglassmc/json';
3
+ import * as checker from './checker/index.js';
4
+ export * as checker from './checker/index.js';
5
+ export const initialize = (ctx) => {
32
6
  json.initialize(ctx);
33
7
  checker.register(ctx.meta);
34
8
  };
35
- exports.initialize = initialize;
36
9
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import * as mcf from '@spyglassmc/mcfunction';
3
- import { EntityNode } from '../node';
3
+ import { EntityNode } from '../node/index.js';
4
4
  export declare const command: core.Checker<mcf.CommandNode>;
5
5
  export declare const getTypesFromEntity: (entity: EntityNode, ctx: core.CheckerContext) => core.FullResourceLocation[] | undefined;
6
6
  export declare function register(meta: core.MetaRegistry): void;