From ed079e11b7a11d84a0e531f1979e9ddddcfde7e0 Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 00:32:47 -0600 Subject: [PATCH 01/27] =?UTF-8?q?=F0=9F=94=A7=20Add=20`%blockitem`=20suppo?= =?UTF-8?q?rt=20to=20mcdoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc/src/type/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mcdoc/src/type/index.ts b/packages/mcdoc/src/type/index.ts index 4dcaa97fd..278241919 100644 --- a/packages/mcdoc/src/type/index.ts +++ b/packages/mcdoc/src/type/index.ts @@ -24,6 +24,7 @@ export const StaticIndexKeywords = Object.freeze( 'none', 'unknown', 'spawnitem', + 'blockitem', ] as const, ) export type StaticIndexKeyword = (typeof StaticIndexKeywords)[number] From 1ce6eb071532e374bea5a08cae44dec1e412c1aa Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 00:34:18 -0600 Subject: [PATCH 02/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20redundant=20locale?= =?UTF-8?q?=20file=20name=20in=20mcdoc-cli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc-cli/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcdoc-cli/src/index.ts b/packages/mcdoc-cli/src/index.ts index d1e9ede35..8414ee15f 100644 --- a/packages/mcdoc-cli/src/index.ts +++ b/packages/mcdoc-cli/src/index.ts @@ -413,7 +413,7 @@ await CLI.scriptName('mcdoc') console.warn(internal_locales) } await fs.writeFile( - join('out', 'locale', 'locale.en-us.json'), + join('out', 'locale', 'en-us.json'), JSON.stringify(locales, undefined, 3), ) } From fd7449ddfd0f542d44ecd52d6b387960cfce8c62 Mon Sep 17 00:00:00 2001 From: SpyglassCrafter Date: Sun, 19 May 2024 06:35:39 +0000 Subject: [PATCH 03/27] =?UTF-8?q?=20=F0=9F=94=96=20v2024.5.19+1ce6eb=20[ci?= =?UTF-8?q?=20skip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit core: 0.4.5 (unchanged) discord-bot: 0.3.6 -> 0.3.7 (patch) java-edition: 0.3.6 -> 0.3.7 (patch) json: 0.3.6 (unchanged) language-server: 0.4.5 -> 0.4.6 (patch) locales: 0.3.5 (unchanged) mcdoc: 0.3.6 -> 0.3.7 (patch) mcdoc-cli: 0.1.5 -> 0.1.6 (patch) mcfunction: 0.2.7 (unchanged) nbt: 0.3.6 -> 0.3.7 (patch) playground: 0.2.6 -> 0.2.7 (patch) vscode-extension: 0.3.6 -> 0.3.7 (patch) --- .packages.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.packages.json b/.packages.json index ec52876db..a101de1ac 100644 --- a/.packages.json +++ b/.packages.json @@ -17,7 +17,7 @@ ], "released": { "commit": "b6ecdcad78be7a44ef564afdfc9c51daedf38de8", - "version": "0.3.6" + "version": "0.3.7" } }, "java-edition": { @@ -31,7 +31,7 @@ ], "released": { "commit": "25de684da837dd553684e912490f92cf8c9c4e1f", - "version": "0.3.6" + "version": "0.3.7" } }, "json": { @@ -53,7 +53,7 @@ ], "released": { "commit": "449e7c655e263425192fe41948904017543ad0cb", - "version": "0.4.5" + "version": "0.4.6" } }, "locales": { @@ -68,8 +68,8 @@ "locales" ], "released": { - "commit": "25de684da837dd553684e912490f92cf8c9c4e1f", - "version": "0.3.6" + "commit": "ed079e11b7a11d84a0e531f1979e9ddddcfde7e0", + "version": "0.3.7" } }, "mcdoc-cli": { @@ -78,8 +78,8 @@ "mcdoc" ], "released": { - "commit": "15961aa1c7ce7d4ea72f2a6fccf478c044d90281", - "version": "0.1.5" + "commit": "1ce6eb071532e374bea5a08cae44dec1e412c1aa", + "version": "0.1.6" } }, "mcfunction": { @@ -100,7 +100,7 @@ ], "released": { "commit": "b626aff40da287707d03c8d451989fb91ac5f9c3", - "version": "0.3.6" + "version": "0.3.7" } }, "playground": { @@ -112,7 +112,7 @@ ], "released": { "commit": "f0d861382044f94ea005b1cfd11fc7e2d57d5663", - "version": "0.2.6" + "version": "0.2.7" } }, "vscode-extension": { @@ -121,7 +121,7 @@ ], "released": { "commit": "449e7c655e263425192fe41948904017543ad0cb", - "version": "0.3.6" + "version": "0.3.7" } } } From d9848358bb3a1e41b40e28e61b9c5771946e724b Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Sun, 19 May 2024 17:16:58 +0200 Subject: [PATCH 04/27] =?UTF-8?q?=E2=9C=A8=20Improve=20JSON=20number=20par?= =?UTF-8?q?sing=20result=20(#1158)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/test-out/service/Operations.spec.js | 53 --- .../core/test-out/service/StateProxy.spec.js | 231 ------------ .../json/test-out/parser/array.spec.js | 336 ++++++++++++++++-- .../json/test-out/parser/number.spec.js | 298 ++++++++++++++++ .../json/test-out/parser/object.spec.js | 42 ++- packages/json/src/formatter/index.ts | 5 +- packages/json/src/node/JsonAstNode.ts | 5 +- packages/json/src/parser/array.ts | 23 +- packages/json/src/parser/boolean.ts | 2 +- packages/json/src/parser/number.ts | 28 +- packages/json/src/parser/object.ts | 5 +- packages/json/src/parser/string.ts | 13 +- packages/json/test/parser/number.spec.ts | 28 ++ 13 files changed, 715 insertions(+), 354 deletions(-) delete mode 100644 __snapshots__/packages/core/test-out/service/Operations.spec.js delete mode 100644 __snapshots__/packages/core/test-out/service/StateProxy.spec.js create mode 100644 __snapshots__/packages/json/test-out/parser/number.spec.js create mode 100644 packages/json/test/parser/number.spec.ts diff --git a/__snapshots__/packages/core/test-out/service/Operations.spec.js b/__snapshots__/packages/core/test-out/service/Operations.spec.js deleted file mode 100644 index d11d3fe69..000000000 --- a/__snapshots__/packages/core/test-out/service/Operations.spec.js +++ /dev/null @@ -1,53 +0,0 @@ -exports['Operations Should add operations to parent correctly 1'] = { - "foo": 1, - "bar": 2, - "baz": 3 -} - -exports['Operations Should add operations to parent correctly 2'] = { - "foo": 42, - "bar": 2, - "baz": 3 -} - -exports['Operations Should add operations to parent correctly 3'] = { - "foo": 69, - "bar": 10, - "baz": 3 -} - -exports['Operations Should add operations to parent correctly 4'] = { - "foo": 1, - "bar": 2, - "baz": 3 -} - -exports['Operations Should add operations to parent correctly 5'] = { - "foo": 69, - "bar": 10, - "baz": 3 -} - -exports['Operations Should redo and undo correctly 1'] = { - "foo": 1, - "bar": 2, - "baz": 3 -} - -exports['Operations Should redo and undo correctly 2'] = { - "foo": 42, - "bar": 91, - "baz": 3 -} - -exports['Operations Should redo and undo correctly 3'] = { - "foo": 1, - "bar": 2, - "baz": 3 -} - -exports['Operations Should redo and undo correctly 4'] = { - "foo": 42, - "bar": 91, - "baz": 3 -} diff --git a/__snapshots__/packages/core/test-out/service/StateProxy.spec.js b/__snapshots__/packages/core/test-out/service/StateProxy.spec.js deleted file mode 100644 index 090fd8734..000000000 --- a/__snapshots__/packages/core/test-out/service/StateProxy.spec.js +++ /dev/null @@ -1,231 +0,0 @@ -exports['StateProxy Should branch off correctly 1'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 2'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 3'] = { - "symbols": { - "advancement": { - "foo": { - "category": "not_advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 4'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 5'] = { - "symbols": { - "advancement": { - "foo": { - "category": "not_not_advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 6'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "symbol" - } - ] - } -} - -exports['StateProxy Should branch off correctly 7'] = { - "symbols": { - "advancement": { - "foo": { - "category": "not_not_advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol" - } - ] - } -} - -exports['StateProxy Should create enumerable proxy 1'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "symbol" - } - ] - } -} - -exports['StateProxy Should undo and redo changes correctly 1'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "symbol" - } - ] - } -} - -exports['StateProxy Should undo and redo changes correctly 2'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - }, - "bar": { - "category": "advancement", - "data": 42 - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol", - "symbol": { - "category": "advancement", - "data": 42 - } - } - ] - } -} - -exports['StateProxy Should undo and redo changes correctly 3'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "symbol" - } - ] - } -} - -exports['StateProxy Should undo and redo changes correctly 4'] = { - "symbols": { - "advancement": { - "foo": { - "category": "advancement" - }, - "bar": { - "category": "advancement", - "data": 42 - } - } - }, - "node": { - "type": "file", - "children": [ - { - "type": "modified_symbol", - "symbol": { - "category": "advancement", - "data": 42 - } - } - ] - } -} diff --git a/__snapshots__/packages/json/test-out/parser/array.spec.js b/__snapshots__/packages/json/test-out/parser/array.spec.js index cc79d0fb6..815698a3b 100644 --- a/__snapshots__/packages/json/test-out/parser/array.spec.js +++ b/__snapshots__/packages/json/test-out/parser/array.spec.js @@ -488,20 +488,54 @@ exports['JSON array parser array() Parse "[1,2,]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } }, "sep": { "start": 2, @@ -517,20 +551,54 @@ exports['JSON array parser array() Parse "[1,2,]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + }, "range": { "start": 3, "end": 4 - }, - "value": 2 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + }, "range": { "start": 3, "end": 4 - }, - "value": 2 + } }, "sep": { "start": 4, @@ -568,20 +636,54 @@ exports['JSON array parser array() Parse "[1,2]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } }, "sep": { "start": 2, @@ -597,20 +699,54 @@ exports['JSON array parser array() Parse "[1,2]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + }, "range": { "start": 3, "end": 4 - }, - "value": 2 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 3, + "end": 4 + }, + "value": "2" + }, "range": { "start": 3, "end": 4 - }, - "value": 2 + } } } ] @@ -635,20 +771,54 @@ exports['JSON array parser array() Parse "[1]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 1, + "end": 2 + }, + "value": "1" + }, "range": { "start": 1, "end": 2 - }, - "value": 1 + } } } ] @@ -687,20 +857,54 @@ exports['JSON array parser array() Parse "[[1],2]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + }, "range": { "start": 2, "end": 3 - }, - "value": 1 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + }, "range": { "start": 2, "end": 3 - }, - "value": 1 + } } } ] @@ -722,20 +926,54 @@ exports['JSON array parser array() Parse "[[1],2]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + }, "range": { "start": 2, "end": 3 - }, - "value": 1 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 2, + "end": 3 + }, + "value": "1" + }, "range": { "start": 2, "end": 3 - }, - "value": 1 + } } } ] @@ -754,20 +992,54 @@ exports['JSON array parser array() Parse "[[1],2]" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 5, + "end": 6 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 5, + "end": 6 + }, + "value": "2" + }, "range": { "start": 5, "end": 6 - }, - "value": 2 + } } ], "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 5, + "end": 6 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 5, + "end": 6 + }, + "value": "2" + }, "range": { "start": 5, "end": 6 - }, - "value": 2 + } } } ] diff --git a/__snapshots__/packages/json/test-out/parser/number.spec.js b/__snapshots__/packages/json/test-out/parser/number.spec.js new file mode 100644 index 000000000..0502bf573 --- /dev/null +++ b/__snapshots__/packages/json/test-out/parser/number.spec.js @@ -0,0 +1,298 @@ +exports['JSON number parser number() Parse "+1" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 2 + }, + "value": 1 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 2 + }, + "value": 1 + }, + "range": { + "start": 0, + "end": 2 + } + }, + "errors": [ + { + "range": { + "start": 0, + "end": 2 + }, + "message": "Illegal float numeral that doesn't follow /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][-+]?\\d+)?$/", + "severity": 3 + } + ] +} + +exports['JSON number parser number() Parse "-1" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 0, + "end": 2 + }, + "value": "-1" + } + ], + "value": { + "type": "long", + "range": { + "start": 0, + "end": 2 + }, + "value": "-1" + }, + "range": { + "start": 0, + "end": 2 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "0" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 0, + "end": 1 + }, + "value": "0" + } + ], + "value": { + "type": "long", + "range": { + "start": 0, + "end": 1 + }, + "value": "0" + }, + "range": { + "start": 0, + "end": 1 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "0.0" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 0 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 0 + }, + "range": { + "start": 0, + "end": 3 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 0, + "end": 1 + }, + "value": "1" + } + ], + "value": { + "type": "long", + "range": { + "start": 0, + "end": 1 + }, + "value": "1" + }, + "range": { + "start": 0, + "end": 1 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1.0" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 1 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 1 + }, + "range": { + "start": 0, + "end": 3 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1.0232E2" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 8 + }, + "value": 102.32 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 8 + }, + "value": 102.32 + }, + "range": { + "start": 0, + "end": 8 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1.2" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 1.2 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 3 + }, + "value": 1.2 + }, + "range": { + "start": 0, + "end": 3 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1.342E-10" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 9 + }, + "value": 1.342e-10 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 9 + }, + "value": 1.342e-10 + }, + "range": { + "start": 0, + "end": 9 + } + }, + "errors": [] +} + +exports['JSON number parser number() Parse "1E12" 1'] = { + "node": { + "type": "json:number", + "children": [ + { + "type": "float", + "range": { + "start": 0, + "end": 4 + }, + "value": 1000000000000 + } + ], + "value": { + "type": "float", + "range": { + "start": 0, + "end": 4 + }, + "value": 1000000000000 + }, + "range": { + "start": 0, + "end": 4 + } + }, + "errors": [] +} diff --git a/__snapshots__/packages/json/test-out/parser/object.spec.js b/__snapshots__/packages/json/test-out/parser/object.spec.js index 18c75db6c..996841447 100644 --- a/__snapshots__/packages/json/test-out/parser/object.spec.js +++ b/__snapshots__/packages/json/test-out/parser/object.spec.js @@ -1203,11 +1203,28 @@ exports['JSON object parser object() Parse "{1: 2}" 1'] = { "children": [ { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 4, + "end": 5 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 4, + "end": 5 + }, + "value": "2" + }, "range": { "start": 4, "end": 5 - }, - "value": 2 + } } ], "sep": { @@ -1216,11 +1233,28 @@ exports['JSON object parser object() Parse "{1: 2}" 1'] = { }, "value": { "type": "json:number", + "children": [ + { + "type": "long", + "range": { + "start": 4, + "end": 5 + }, + "value": "2" + } + ], + "value": { + "type": "long", + "range": { + "start": 4, + "end": 5 + }, + "value": "2" + }, "range": { "start": 4, "end": 5 - }, - "value": 2 + } } } ] diff --git a/packages/json/src/formatter/index.ts b/packages/json/src/formatter/index.ts index c431ec981..60211dcd4 100644 --- a/packages/json/src/formatter/index.ts +++ b/packages/json/src/formatter/index.ts @@ -37,6 +37,9 @@ const object: Formatter = (node, ctx) => { return `{\n${fields.join(',\n')}\n${ctx.indent()}}` } +const number: Formatter = (node, ctx) => + ctx.meta.getFormatter(node.value.type)(node.value, ctx) + export function register(meta: MetaRegistry): void { meta.registerFormatter('json:array', array) meta.registerFormatter( @@ -44,7 +47,7 @@ export function register(meta: MetaRegistry): void { core.formatter.boolean, ) meta.registerFormatter('json:null', () => 'null') - meta.registerFormatter('json:number', core.formatter.float) + meta.registerFormatter('json:number', number) meta.registerFormatter('json:object', object) meta.registerFormatter('json:string', core.formatter.string) } diff --git a/packages/json/src/node/JsonAstNode.ts b/packages/json/src/node/JsonAstNode.ts index 0ba3df749..edea766a4 100644 --- a/packages/json/src/node/JsonAstNode.ts +++ b/packages/json/src/node/JsonAstNode.ts @@ -156,9 +156,10 @@ export namespace JsonStringNode { export interface JsonNumberExpectation extends JsonBaseExpectation { readonly type: 'json:number' } -export interface JsonNumberNode extends core.FloatBaseNode, JsonBaseAstNode { +export interface JsonNumberNode extends JsonBaseAstNode, core.AstNode { readonly type: 'json:number' - readonly value: number + readonly children: [core.LongNode | core.FloatNode] + readonly value: core.LongNode | core.FloatNode } export namespace JsonNumberNode { /* istanbul ignore next */ diff --git a/packages/json/src/parser/array.ts b/packages/json/src/parser/array.ts index c0546741b..da33d6b0d 100644 --- a/packages/json/src/parser/array.ts +++ b/packages/json/src/parser/array.ts @@ -2,15 +2,14 @@ import * as core from '@spyglassmc/core' import type { JsonArrayNode } from '../node/index.js' import { entry } from './entry.js' -export const array: core.Parser = (src, ctx) => { - const parser = core.list({ - start: '[', - value: entry, - sep: ',', - trailingSep: false, - end: ']', - }) - const ans = parser(src, ctx) as core.Mutable - ans.type = 'json:array' - return ans -} +export const array: core.Parser = (ctx, src) => + core.setType( + 'json:array', + core.list({ + start: '[', + value: entry, + sep: ',', + trailingSep: false, + end: ']', + }), + )(ctx, src) diff --git a/packages/json/src/parser/boolean.ts b/packages/json/src/parser/boolean.ts index 99daa8d14..9f6d10329 100644 --- a/packages/json/src/parser/boolean.ts +++ b/packages/json/src/parser/boolean.ts @@ -2,7 +2,7 @@ import * as core from '@spyglassmc/core' import { Range } from '@spyglassmc/core' import type { JsonBooleanNode } from '../node/index.js' -export const boolean: core.Parser = (src, ctx) => { +export const boolean: core.Parser = (src, _ctx) => { const start = src.cursor if (src.trySkip('false')) { return { diff --git a/packages/json/src/parser/number.ts b/packages/json/src/parser/number.ts index bd1c10eb7..e0d6f7a07 100644 --- a/packages/json/src/parser/number.ts +++ b/packages/json/src/parser/number.ts @@ -2,11 +2,25 @@ import * as core from '@spyglassmc/core' import type { JsonNumberNode } from '../node/index.js' export const number: core.Parser = (src, ctx) => { - const parser = core.float({ - // Regex form of the chart from https://www.json.org. - pattern: /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?$/, - }) - const ans = parser(src, ctx) as core.Mutable - ans.type = 'json:number' - return ans as JsonNumberNode + const value = core.select([ + { + regex: /^-?(?:0|[1-9]\d*)(?!\d|[.eE])/, + parser: core.long({ + pattern: /^-?(?:0|[1-9]\d*)$/, + }), + }, + { + parser: core.float({ + // Regex form of the chart from https://www.json.org. + pattern: /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?$/, + }), + }, + ])(src, ctx) + + return { + type: 'json:number', + children: [value], + value: value, + range: value.range, + } } diff --git a/packages/json/src/parser/object.ts b/packages/json/src/parser/object.ts index 58e058fe2..46a0cc190 100644 --- a/packages/json/src/parser/object.ts +++ b/packages/json/src/parser/object.ts @@ -3,8 +3,8 @@ import type { JsonObjectNode } from '../node/index.js' import { entry } from './entry.js' import { string } from './string.js' -export const object: core.InfallibleParser = (src, ctx) => { - return core.setType( +export const object: core.InfallibleParser = (src, ctx) => + core.setType( 'json:object', core.record({ start: '{', @@ -18,4 +18,3 @@ export const object: core.InfallibleParser = (src, ctx) => { end: '}', }), )(src, ctx) -} diff --git a/packages/json/src/parser/string.ts b/packages/json/src/parser/string.ts index 07e288437..ee054cd01 100644 --- a/packages/json/src/parser/string.ts +++ b/packages/json/src/parser/string.ts @@ -9,11 +9,8 @@ export const JsonStringOptions: core.StringOptions = { quotes: ['"'], } -export const string: core.Parser = (src, ctx) => { - const parser = core.string(JsonStringOptions) - const ans = parser(src, ctx) as core.Mutable< - JsonStringNode | core.StringNode - > - ans.type = 'json:string' - return ans as JsonStringNode -} +export const string: core.Parser = (src, ctx) => + core.setType( + 'json:string', + core.string(JsonStringOptions), + )(src, ctx) diff --git a/packages/json/test/parser/number.spec.ts b/packages/json/test/parser/number.spec.ts new file mode 100644 index 000000000..25979da38 --- /dev/null +++ b/packages/json/test/parser/number.spec.ts @@ -0,0 +1,28 @@ +import { + showWhitespaceGlyph, + testParser, +} from '@spyglassmc/core/test-out/utils.js' +import snapshot from 'snap-shot-it' +import { number } from '../../lib/parser/number.js' + +describe('JSON number parser', () => { + describe('number()', () => { + const cases: { content: string }[] = [ + { content: '1' }, + { content: '1.2' }, + { content: '1.0' }, + { content: '0.0' }, + { content: '0' }, + { content: '-1' }, + { content: '+1' }, + { content: '1E12' }, + { content: '1.0232E2' }, + { content: '1.342E-10' }, + ] + for (const { content } of cases) { + it(`Parse "${showWhitespaceGlyph(content)}"`, () => { + snapshot(testParser(number, content)) + }) + } + }) +}) From 42dbc014068b184829a7e091bf7313c11b457ddd Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Sun, 19 May 2024 17:26:48 +0200 Subject: [PATCH 05/27] =?UTF-8?q?=F0=9F=94=A8=20Better=20type=20for=20nume?= =?UTF-8?q?ric=20mcdoc=20literals=20(#1145)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__fixture__/attributed_types.spec.js | 6 +- .../random_number_generator.spec.js | 2 +- .../__fixture__/enum/duplicated_keys.spec.js | 4 +- .../test-out/__fixture__/enum/string.spec.js | 2 +- .../test-out/__fixture__/simple_types.spec.js | 7 +- .../__fixture__/struct/nested_spread.spec.js | 2 +- .../__fixture__/struct/simple.spec.js | 2 +- .../__fixture__/type_alias/attributed.spec.js | 2 +- .../test-out/parser/syntax/attribute.spec.js | 8 +- .../parser/syntax/type/literalType.spec.js | 4 +- docs/user/mcdoc/index.adoc | 4 +- packages/mcdoc/src/binder/index.ts | 28 ++++-- packages/mcdoc/src/node/index.ts | 15 ++-- packages/mcdoc/src/parser/index.ts | 88 ++++++++++++++++--- packages/mcdoc/src/type/index.ts | 50 ++++------- 15 files changed, 139 insertions(+), 85 deletions(-) diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js index 570b317f3..df65ba37b 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js @@ -84,7 +84,7 @@ exports['mcdoc __fixture__ attributed types 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.19 } } @@ -725,7 +725,7 @@ exports['mcdoc __fixture__ attributed types 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 199, "end": 200 @@ -759,7 +759,7 @@ exports['mcdoc __fixture__ attributed types 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 214, "end": 215 diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js index cb407d2da..a4fbcf57c 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js @@ -624,7 +624,7 @@ exports['mcdoc __fixture__ dispatcher/random number generator 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.18 } } diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/duplicated_keys.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/duplicated_keys.spec.js index 9ba15460d..e63c154c9 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/duplicated_keys.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/duplicated_keys.spec.js @@ -191,7 +191,7 @@ exports['mcdoc __fixture__ enum/duplicated keys 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 30, "end": 32 @@ -234,7 +234,7 @@ exports['mcdoc __fixture__ enum/duplicated keys 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 46, "end": 48 diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/string.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/string.spec.js index 1319e28ee..33686d6f8 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/string.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/enum/string.spec.js @@ -40,7 +40,7 @@ exports['mcdoc __fixture__ enum/string 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.19 } } diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/simple_types.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/simple_types.spec.js index c5c410835..b50e255a6 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/simple_types.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/simple_types.spec.js @@ -390,9 +390,8 @@ exports['mcdoc __fixture__ simple types 1'] = { "typeDef": { "kind": "literal", "value": { - "kind": "number", - "value": 42, - "suffix": "l" + "kind": "long", + "value": 42 } } }, @@ -1497,7 +1496,7 @@ exports['mcdoc __fixture__ simple types 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 249, "end": 251 diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js index 9025d1c33..5ec87beba 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js @@ -40,7 +40,7 @@ exports['mcdoc __fixture__ struct/nested spread 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.17 } } diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js index 5a6cf965f..7f87aa65c 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js @@ -47,7 +47,7 @@ exports['mcdoc __fixture__ struct/simple 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.19 } } diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js index c4c83891a..433beeb3d 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js @@ -36,7 +36,7 @@ exports['mcdoc __fixture__ type alias/attributed 1'] = { "value": { "kind": "literal", "value": { - "kind": "number", + "kind": "double", "value": 1.18 } } diff --git a/__snapshots__/packages/mcdoc/test-out/parser/syntax/attribute.spec.js b/__snapshots__/packages/mcdoc/test-out/parser/syntax/attribute.spec.js index 4951fb54c..ae470d9c6 100644 --- a/__snapshots__/packages/mcdoc/test-out/parser/syntax/attribute.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/parser/syntax/attribute.spec.js @@ -305,7 +305,7 @@ exports['mcdoc attribute Parse "#[bitfield=enum (int) {↓⮀⮀⮀⮀⮀Foo = 1 "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 35, "end": 36 @@ -339,7 +339,7 @@ exports['mcdoc attribute Parse "#[bitfield=enum (int) {↓⮀⮀⮀⮀⮀Foo = 1 "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 49, "end": 50 @@ -373,7 +373,7 @@ exports['mcdoc attribute Parse "#[bitfield=enum (int) {↓⮀⮀⮀⮀⮀Foo = 1 "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 63, "end": 64 @@ -565,7 +565,7 @@ exports['mcdoc attribute Parse "#[vector(dimension=3,integer=true)]" 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 19, "end": 20 diff --git a/__snapshots__/packages/mcdoc/test-out/parser/syntax/type/literalType.spec.js b/__snapshots__/packages/mcdoc/test-out/parser/syntax/type/literalType.spec.js index 15f82f9cf..9333f930e 100644 --- a/__snapshots__/packages/mcdoc/test-out/parser/syntax/type/literalType.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/parser/syntax/type/literalType.spec.js @@ -74,7 +74,7 @@ exports['mcdoc literalType Parse "1b" 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 0, "end": 1 @@ -113,7 +113,7 @@ exports['mcdoc literalType Parse "42" 1'] = { "type": "mcdoc:typed_number", "children": [ { - "type": "float", + "type": "integer", "range": { "start": 0, "end": 2 diff --git a/docs/user/mcdoc/index.adoc b/docs/user/mcdoc/index.adoc index 304a287d3..e58bce7cc 100644 --- a/docs/user/mcdoc/index.adoc +++ b/docs/user/mcdoc/index.adoc @@ -187,7 +187,9 @@ Scientific notation may be used with the letter `e` (case-insensitive). **SYNTAX (TOKEN)** [[t-typed-number,TYPED_NUMBER]] -<>:: <> ++[++`b` `B` `d` `D` `f` `F` `l` `L` `s` `S`++]++^?^ +<>:: + <> ++[++`b` `B` `s` `S` `l` `L`++]++^?^ | + + <> ++[++`d` `D` `f` `F`++]++^?^ **** A typed number is similar to a number used in SNBTs syntax-wise. diff --git a/packages/mcdoc/src/binder/index.ts b/packages/mcdoc/src/binder/index.ts index 98940109d..3b9b68bf7 100644 --- a/packages/mcdoc/src/binder/index.ts +++ b/packages/mcdoc/src/binder/index.ts @@ -77,6 +77,7 @@ import { UnionTypeNode, UseStatementNode, } from '../node/index.js' +import type { LiteralNumberCaseInsensitiveSuffix } from '../parser/index.js' import type { Attribute, AttributeTree, @@ -84,8 +85,6 @@ import type { DynamicIndex, EnumTypeField, Index, - LiteralNumberCaseInsensitiveSuffix, - LiteralNumberSuffix, LiteralValue, McdocType, NumericRange, @@ -1215,9 +1214,11 @@ function convertLiteralValue( } else if (TypedNumberNode.is(node)) { const { suffix, value } = TypedNumberNode.destruct(node) return { - kind: 'number', + kind: convertLiteralNumberSuffix(suffix, ctx) ?? + (value.type === 'integer' + ? 'int' + : 'double'), value: value.value, - suffix: convertLiteralNumberSuffix(suffix, ctx), } } else { return { @@ -1230,11 +1231,22 @@ function convertLiteralValue( function convertLiteralNumberSuffix( node: LiteralNode | undefined, ctx: McdocBinderContext, -): LiteralNumberSuffix | undefined { +): NumericTypeKind | undefined { const suffix = node?.value as LiteralNumberCaseInsensitiveSuffix | undefined - return suffix?.toLowerCase() as - | Lowercase> - | undefined + switch (suffix?.toLowerCase()) { + case 'b': + return 'byte' + case 's': + return 'short' + case 'l': + return 'long' + case 'f': + return 'float' + case 'd': + return 'double' + default: + return undefined + } } function convertNumericType( diff --git a/packages/mcdoc/src/node/index.ts b/packages/mcdoc/src/node/index.ts index 6959102cf..b4c81617c 100644 --- a/packages/mcdoc/src/node/index.ts +++ b/packages/mcdoc/src/node/index.ts @@ -1,13 +1,9 @@ -import type { - AstNode, - ColorTokenType, - IntegerNode, - SymbolBaseNode, -} from '@spyglassmc/core' +import type { AstNode, ColorTokenType, SymbolBaseNode } from '@spyglassmc/core' import { atArray, CommentNode, FloatNode, + IntegerNode, ResourceLocationNode, StringNode, } from '@spyglassmc/core' @@ -427,15 +423,16 @@ export namespace LiteralTypeValueNode { export interface TypedNumberNode extends AstNode { type: 'mcdoc:typed_number' - children: (FloatNode | LiteralNode)[] + children: (FloatNode | IntegerNode | LiteralNode)[] } export namespace TypedNumberNode { export function destruct(node: TypedNumberNode): { - value: FloatNode + value: FloatNode | IntegerNode suffix?: LiteralNode } { return { - value: node.children.find(FloatNode.is)!, + value: node.children.find(FloatNode.is) ?? + node.children.find(IntegerNode.is)!, suffix: node.children.find(LiteralNode.is), } } diff --git a/packages/mcdoc/src/parser/index.ts b/packages/mcdoc/src/parser/index.ts index 26ed29ea7..217a852fd 100644 --- a/packages/mcdoc/src/parser/index.ts +++ b/packages/mcdoc/src/parser/index.ts @@ -86,7 +86,6 @@ import type { } from '../node/index.js' import { RangeExclusiveChar } from '../node/index.js' import { - LiteralNumberCaseInsensitiveSuffixes, NumericTypeFloatKinds, NumericTypeIntKinds, PrimitiveArrayValueKinds, @@ -694,15 +693,84 @@ export const float: InfallibleParser = core.float({ /^[-+]?(?:[0-9]+(?:[eE][-+]?[0-9]+)?|[0-9]*\.[0-9]+(?:[eE][-+]?[0-9]+)?)$/, }) +export const integer: InfallibleParser = core.integer({ + pattern: /^(?:0|[-+]?[1-9][0-9]*)$/, +}) +export const LiteralIntSuffixes = Object.freeze( + [ + 'b', + 's', + 'l', + ] as const, +) +export type LiteralIntSuffix = (typeof LiteralIntSuffixes)[number] +export const LiteralIntCaseInsensitiveSuffixes = Object.freeze( + [ + ...LiteralIntSuffixes, + 'B', + 'S', + 'L', + ] as const, +) +export type LiteralIntCaseInsensitiveSuffix = + (typeof LiteralIntCaseInsensitiveSuffixes)[number] +export const LiteralFloatSuffixes = Object.freeze( + [ + 'f', + 'd', + ] as const, +) +export type LiteralFloatSuffix = (typeof LiteralFloatSuffixes)[number] +export const LiteralFloatCaseInsensitiveSuffixes = Object.freeze( + [ + ...LiteralFloatSuffixes, + 'F', + 'D', + ] as const, +) +export type LiteralFloatCaseInsensitiveSuffix = + (typeof LiteralFloatCaseInsensitiveSuffixes)[number] +export const LiteralNumberSuffixes = Object.freeze( + [ + ...LiteralIntSuffixes, + ...LiteralFloatSuffixes, + ] as const, +) +export type LiteralNumberSuffix = (typeof LiteralNumberSuffixes)[number] +export const LiteralNumberCaseInsensitiveSuffixes = Object.freeze( + [ + ...LiteralNumberSuffixes, + ...LiteralIntCaseInsensitiveSuffixes, + ...LiteralFloatCaseInsensitiveSuffixes, + ] as const, +) +export type LiteralNumberCaseInsensitiveSuffix = + (typeof LiteralNumberCaseInsensitiveSuffixes)[number] + export const typedNumber: InfallibleParser = setType( 'mcdoc:typed_number', - sequence([ - float, - optional( - keyword(LiteralNumberCaseInsensitiveSuffixes, { - colorTokenType: 'keyword', - }), - ), + select([ + { + regex: /^(?:\+|-)?\d+(?!\d|[.dfe])/i, + parser: sequence([ + integer, + optional( + keyword(LiteralIntCaseInsensitiveSuffixes, { + colorTokenType: 'keyword', + }), + ), + ]), + }, + { + parser: sequence([ + float, + optional( + keyword(LiteralFloatCaseInsensitiveSuffixes, { + colorTokenType: 'keyword', + }), + ), + ]), + }, ]), ) @@ -995,10 +1063,6 @@ export const booleanType: Parser = typeBase( keyword('boolean', { colorTokenType: 'type' }), ) -export const integer: InfallibleParser = core.integer({ - pattern: /^(?:0|[-+]?[1-9][0-9]*)$/, -}) - function range< P extends InfallibleParser | InfallibleParser, >( diff --git a/packages/mcdoc/src/type/index.ts b/packages/mcdoc/src/type/index.ts index 278241919..6e7cbec48 100644 --- a/packages/mcdoc/src/type/index.ts +++ b/packages/mcdoc/src/type/index.ts @@ -138,45 +138,25 @@ export interface StringType { } export type LiteralValue = - | { - kind: 'boolean' - value: boolean - } - | { - kind: 'string' - value: string - } - | { - kind: 'number' - value: number - suffix: 'b' | 's' | 'l' | 'f' | 'd' | undefined - } + | LiteralBooleanValue + | LiteralStringValue + | LiteralNumericValue +export interface LiteralBooleanValue { + kind: 'boolean' + value: boolean +} +export interface LiteralStringValue { + kind: 'string' + value: string +} +export interface LiteralNumericValue { + kind: NumericTypeKind + value: number +} export interface LiteralType { kind: 'literal' value: LiteralValue } -export const LiteralNumberSuffixes = Object.freeze( - [ - 'b', - 's', - 'l', - 'f', - 'd', - ] as const, -) -export type LiteralNumberSuffix = (typeof LiteralNumberSuffixes)[number] -export const LiteralNumberCaseInsensitiveSuffixes = Object.freeze( - [ - ...LiteralNumberSuffixes, - 'B', - 'S', - 'L', - 'F', - 'D', - ] as const, -) -export type LiteralNumberCaseInsensitiveSuffix = - (typeof LiteralNumberCaseInsensitiveSuffixes)[number] export interface NumericType { kind: NumericTypeKind From 5c9576525a7a8bee2ce900295e2e52fec9316a41 Mon Sep 17 00:00:00 2001 From: SPGoding Date: Sun, 19 May 2024 14:01:57 -0500 Subject: [PATCH 06/27] =?UTF-8?q?=F0=9F=94=A8=20Fix=20building=20issues=20?= =?UTF-8?q?on=20MacOS=20(#1146)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/playground/esbuild.js | 5 ++++- packages/vscode-extension/esbuild.mjs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/playground/esbuild.js b/packages/playground/esbuild.js index febd9556d..157be7aec 100755 --- a/packages/playground/esbuild.js +++ b/packages/playground/esbuild.js @@ -16,7 +16,10 @@ try { platform: 'node', target: ['firefox89', 'chrome93'], bundle: true, - external: ['electron', 'vscode'], + // fsevents is a MacOS specific native extension used by chokidar for file + // watching and should not be bundled: + // https://github.com/SpyglassMC/Spyglass/issues/1143 + external: ['electron', 'fsevents', 'vscode'], sourcemap: isDev, minify: !isDev, }) diff --git a/packages/vscode-extension/esbuild.mjs b/packages/vscode-extension/esbuild.mjs index eaa573198..8736fc2a8 100755 --- a/packages/vscode-extension/esbuild.mjs +++ b/packages/vscode-extension/esbuild.mjs @@ -17,7 +17,10 @@ try { target: 'node16.13', bundle: true, outdir: './dist', - external: ['electron', 'vscode'], + // fsevents is a MacOS specific native extension used by chokidar for file + // watching and should not be bundled: + // https://github.com/SpyglassMC/Spyglass/issues/1143 + external: ['electron', 'fsevents', 'vscode'], sourcemap: isDev, minify: !isDev, }) From 13a9c9bf1b4045853a083451b7de9fc43a982231 Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 23:16:45 -0600 Subject: [PATCH 07/27] =?UTF-8?q?=F0=9F=9A=A7=20`/mcdoc-cli@v0.2`:=20Add?= =?UTF-8?q?=20most=20missing=20doc=20comments=20to=20locale=20file,=20add?= =?UTF-8?q?=20`update=5Flocales`=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 54 +- packages/mcdoc-cli/.gitignore | 1 + packages/mcdoc-cli/package.json | 6 +- packages/mcdoc-cli/src/generate/index.ts | 608 ++++++++++++++++++ packages/mcdoc-cli/src/index.ts | 323 ++-------- .../mcdoc-cli/src/update_locales/index.ts | 119 ++++ 6 files changed, 840 insertions(+), 271 deletions(-) create mode 100644 packages/mcdoc-cli/src/generate/index.ts create mode 100644 packages/mcdoc-cli/src/update_locales/index.ts diff --git a/package-lock.json b/package-lock.json index 02d002f76..392fa7a5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3945,6 +3945,11 @@ "node": ">=0.4.0" } }, + "node_modules/destr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.3.tgz", + "integrity": "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==" + }, "node_modules/didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -7601,6 +7606,11 @@ } } }, + "node_modules/node-fetch-native": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", + "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==" + }, "node_modules/node-loader": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.0.0.tgz", @@ -7924,6 +7934,16 @@ "node": ">=0.10.0" } }, + "node_modules/ofetch": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.4.tgz", + "integrity": "sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==", + "dependencies": { + "destr": "^2.0.3", + "node-fetch-native": "^1.6.3", + "ufo": "^1.5.3" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -9876,6 +9896,11 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", + "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==" + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -10981,12 +11006,13 @@ }, "packages/mcdoc-cli": { "name": "@spyglassmc/mcdoc-cli", - "version": "0.1.3", + "version": "0.2.0", "license": "MIT", "dependencies": { "fs-extra": "^11.1.1", "klaw": "^4.1.0", "line-column": "^1.0.2", + "ofetch": "^1.3.4", "yargs": "17.6.2" }, "bin": { @@ -12081,6 +12107,7 @@ "fs-extra": "^11.1.1", "klaw": "^4.1.0", "line-column": "^1.0.2", + "ofetch": "^1.3.4", "typescript": "^5.4.5", "yargs": "17.6.2" }, @@ -14090,6 +14117,11 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, + "destr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.3.tgz", + "integrity": "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==" + }, "didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -16736,6 +16768,11 @@ "whatwg-url": "^5.0.0" } }, + "node-fetch-native": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", + "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==" + }, "node-loader": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/node-loader/-/node-loader-2.0.0.tgz", @@ -16978,6 +17015,16 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "ofetch": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.4.tgz", + "integrity": "sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==", + "requires": { + "destr": "^2.0.3", + "node-fetch-native": "^1.6.3", + "ufo": "^1.5.3" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -18406,6 +18453,11 @@ "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true }, + "ufo": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", + "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==" + }, "unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", diff --git a/packages/mcdoc-cli/.gitignore b/packages/mcdoc-cli/.gitignore index ce8268e4b..c70940e50 100644 --- a/packages/mcdoc-cli/.gitignore +++ b/packages/mcdoc-cli/.gitignore @@ -1,3 +1,4 @@ vanilla-mcdoc +testing-mcdoc cache out \ No newline at end of file diff --git a/packages/mcdoc-cli/package.json b/packages/mcdoc-cli/package.json index 4ef39c835..ee8b88785 100644 --- a/packages/mcdoc-cli/package.json +++ b/packages/mcdoc-cli/package.json @@ -1,6 +1,6 @@ { "name": "@spyglassmc/mcdoc-cli", - "version": "0.1.5", + "version": "0.2.0", "type": "module", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -24,12 +24,14 @@ "scripts": { "release": "npm publish", "release:dry": "npm publish --dry-run", - "test": "rm -rf vanilla-mcdoc && rm -rf src/out && git clone https://github.com/SpyglassMC/vanilla-mcdoc && cd src && npx tsx src/index.mts generate ../vanilla-mcdoc/ -p -m -l" + "setup": "git clone https://github.com/SpyglassMC/vanilla-mcdoc", + "test": "rm -rf out/generated/module/* && cd vanilla-mcdoc && git pull && cd .. && tsc -b && node lib/index.js generate vanilla-mcdoc/ -l -m -p" }, "dependencies": { "fs-extra": "^11.1.1", "klaw": "^4.1.0", "line-column": "^1.0.2", + "ofetch": "^1.3.4", "yargs": "17.6.2" }, "devDependencies": { diff --git a/packages/mcdoc-cli/src/generate/index.ts b/packages/mcdoc-cli/src/generate/index.ts new file mode 100644 index 000000000..8747456a8 --- /dev/null +++ b/packages/mcdoc-cli/src/generate/index.ts @@ -0,0 +1,608 @@ +import { join, parse } from 'path' +import { fileURLToPath, pathToFileURL } from 'url' + +import fs from 'fs-extra' +import lineColumn from 'line-column' + +import type { AstNode } from '@spyglassmc/core' +import type { Service } from '@spyglassmc/core' +import type walk from 'klaw' +import type { Logger } from '../index.js' + +type Args = { + locale?: boolean + module?: boolean + pretty?: boolean + verbose?: boolean + dry?: boolean +} + +export async function generate(project_path: string, generated_path: string, args: Args, doc_file: walk.Item, service: Service, logger: Logger) { + const symbols = [] + + let errors = 0 + + const internal_locales: Record = {} + + const locales: Record = {} + + const DocumentUri = pathToFileURL(doc_file.path).toString() + + const doc_contents = await fs.readFile(doc_file.path, 'utf-8') + + await service.project.onDidOpen( + DocumentUri, + 'mcdoc', + 0, + doc_contents, + ) + + const check = await service.project.ensureClientManagedChecked( + DocumentUri, + ) + + if (check && check.doc && check.node) { + const { doc, node } = check + + const path = parse(fileURLToPath(doc.uri)) + + let resource = join( + path.dir.replace(`${project_path}`, ''), + path.name, + ).replace(/^[\/\\]/, '') + + // remove windows cruft + if (resource.includes('\\')) resource = resource.replaceAll('\\', '/') + + logger.info(`parsing ${resource}\n`) + + if (node.children[0]) { + const children = node.children + + function flattenChild( + parent: string, + self: string, + _parent: Partial | undefined, + _child: Partial, + ) { + const child: any = {} + + const known_error = false + + /* @ts-ignore */ + child.self = self + + /* @ts-ignore */ + if (_child.parent) child.parent = parent + + /* @ts-ignore */ + if (_child.parentMap) child.parentMap = parent + + if (_child.children) { + child.children = [] + for ( + const [i, __child] of Object.entries( + _child.children, + ) + ) { + /* @ts-ignore */ + child.children[Number(i)] = flattenChild( + self, + `${self}[${i}]`, + _child, + __child, + ) + } + } + + child.type = _child.type + + if (child.type === 'resource_location') { + /* @ts-ignore */ + child.namespace = _child.namespace + /* @ts-ignore */ + child.path = _child.path + } + + if (Object.hasOwn(_child, 'isOptional')) { + /* @ts-ignore */ + child.isOptional = _child.isOptional + } + + if (Object.hasOwn(_child, 'colorTokenType')) { + /* @ts-ignore */ + child.colorTokenType = _child.colorTokenType + } + + // if you want to keep your sanity, avoid looking at this function + function setLocale(end: string) { + let container + if (doc_file.path.endsWith(`${resource.split('/').slice(-1)[0]}.mcdoc`)) { + const threeBack = _parent?.parent?.parent + + if (threeBack?.type === 'mcdoc:struct') { + const identifierIndex = threeBack?.children?.findIndex(child => child.type === 'mcdoc:identifier') + + if (identifierIndex && identifierIndex !== -1) { + /* @ts-ignore */ + container = threeBack?.children?.[identifierIndex].value + } else { + /* @ts-ignore */ + const fourBack = threeBack?.parent + + switch (fourBack?.type) { + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier')?.value + const sixBack = fourBack.parent?.parent + /* @ts-ignore */ + const foundRoot = sixBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (key) { + if (foundRoot) { + container = `${foundRoot}.${key}` + } else { + // This is another nested anonymous struct + // TODO: Yeah this should be recursive and smarter but I'm lazy + /* @ts-ignore */ + const parentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const actualRoot = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${actualRoot}.${parentKey}.${key}` + } + } else { + // This is another nested anonymous struct + // TODO: Yeah this should be recursive and smarter but I'm lazy + /* @ts-ignore */ + const parentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const actualRoot = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${actualRoot}.${parentKey}.__map_key.__struct` + } + } break; + case 'mcdoc:type/union': { + switch (fourBack?.parent?.type) { + case 'mcdoc:struct/field/spread': { + /* @ts-ignore */ + const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][0][1][0][0][0] + // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][1][1][0][0][0] + if (root) { + container = `${root}.__spread.__union.__struct_${self.split('][').slice(-4)[0]}` // THIS IS REALLY REALLY BAD + } else { + logger.warn('Could not find root for union spread') + } + } break; + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const parentKey = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${parentKey}.__union.__struct_${self.split('][').slice(-2)[0]}` // THIS IS REALLY REALLY BAD + } break; + case 'mcdoc:dispatch_statement': { + /* @ts-ignore */ + const registry = fourBack.parent.children?.find(child => child.type === 'resource_location')?.path?.join('_') + + /* @ts-ignore */ + const key = fourBack.parent.children?.find(child => child.type === 'mcdoc:index_body')?.children?.[0]?.value + + const indexGuess = self.split('][').slice(-6)[0] // THIS IS REALLY REALLY BAD + + if (indexGuess === '45') { + container = `__dispatch.${registry}.${key}.__union.__struct_${self.split('][').slice(-4)[0] }` + } else { + container = `__dispatch.${registry}.${key}.__union.__struct_${indexGuess}` + } + } break; + case 'mcdoc:type_alias': { + /* @ts-ignore */ + container = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + } break; + default: { + // TODO: there's more cases here, but I'm done for now + // console.log('aa ', fourBack?.parent?.type) + } + } + } break; + case 'mcdoc:type/list': { + const fiveBack = fourBack?.parent + switch (fiveBack?.type) { + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const key = fiveBack.children?.find(child => child.type === 'mcdoc:identifier')?.value + const sevenBack = fiveBack.parent?.parent + /* @ts-ignore */ + const foundRoot = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (foundRoot) { + container = `${foundRoot}.${key}.__struct_list` + } else { + // This is another nested anonymous struct + switch (sevenBack?.parent?.type) { + case 'mcdoc:type/list': { + /* @ts-ignore */ + const nineBack = sevenBack.parent?.parent + /* @ts-ignore */ + const parentKey = nineBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + // Credits husk + /* @ts-ignore */ + const actualRoot = nineBack?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + if (actualRoot) { + container = `${actualRoot}.__struct_list.${parentKey}.__struct_list.${key}.__struct_list` + } else { + logger.warn('Could not find root for a bunch of nested struct lists, probably don\'t do this') + } + } break; + case 'mcdoc:type/union': { + /* @ts-ignore */ + const actualRoot = sevenBack.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + // block state definition, this is fragile + + if (actualRoot) { + container = `${actualRoot}.__struct_union.${key}.__struct_list` + } else { + logger.warn('Could not find root for struct list within struct union, this should be fixed') + } + } + } + } + } break; + case 'mcdoc:type_alias': { + /* @ts-ignore */ + const root = fiveBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.__struct_list` + } break; + } + } break; + case 'mcdoc:type_alias': { + /* @ts-ignore */ + const root = fourBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (root) { + container = root + } else { + logger.warn('Could not find root for type alias, hint:' + self) + } + } break; + case 'mcdoc:dispatch_statement': { + // anonymous struct + container = `__dispatch.__struct${self.split('][').slice(-5)[0]}` // THIS IS REALLY REALLY BAD + } break; + } + // anonymous struct + switch (fourBack?.type) { + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier')?.value + const sixBack = fourBack.parent?.parent + /* @ts-ignore */ + const parentKey = sixBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (key) { + if (parentKey) { + container = `${parentKey}.${key}` + } else { + // memories + /* @ts-ignore */ + const actualParentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${actualParentKey}.${key}` + } + } else { + // advancement criteria trigger + const sevenBack = fourBack?.parent?.parent?.parent + /* @ts-ignore */ + const parentKey = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = sevenBack?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${parentKey}.__map_key.__struct` + } + } break; + case 'mcdoc:type/union': { + if (!container) { // yes + switch (fourBack?.parent?.type) { + case 'mcdoc:type_alias': { + /* @ts-ignore */ + const root = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + container = `${root}.__union.__struct_${self.split('][').slice(-4)[0]}` // THIS IS REALLY REALLY BAD + } break; + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const parentKey = fourBack?.parent.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${parentKey}` + } break; + case 'mcdoc:dispatch_statement': { + // kill + + const indexGuess = self.split('][').slice(-6)[0] + if (indexGuess === '45') { + container = `__dispatch.__struct_${self.split('][').slice(-4)[0]}` + } else { + container = `__dispatch.__struct_${indexGuess}` // THIS IS REALLY REALLY BAD + } + } break; + case 'mcdoc:type/union': { + // book lines + const sevenBack = fourBack?.parent?.parent?.parent + /* @ts-ignore */ + const parentKey = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = sevenBack?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${parentKey}.__union_list.__struct` + } break; + case 'mcdoc:type/list': { + // texture meta + /* @ts-ignore */ + const parentKey = fourBack?.parent.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const rootKey = fourBack?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + /* @ts-ignore */ + const root = fourBack?.parent?.parent?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${rootKey}.${parentKey}.__union_list.__struct` + } break; + } + } + } break; + } + } + } else { + const threeBack = _parent?.parent?.parent + switch (threeBack?.type) { + case 'mcdoc:enum': { + /* @ts-ignore */ + const root = threeBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (root) { + container = root + } else { + // inline enum + /* @ts-ignore */ + const parentKey = threeBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const root = threeBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + if (root) { + container = `${root}.${parentKey}` + } else { + /* @ts-ignore */ + const rootKey = threeBack?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const root = threeBack?.parent?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${rootKey}.${parentKey}` + } + } + } break; + case 'file': { + switch (_parent?.type) { + case 'mcdoc:struct': { + /* @ts-ignore */ + container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + } break; + case 'mcdoc:dispatch_statement': { + if (_parent?.children) { + /* @ts-ignore */ + container = _parent?.children?.find(child => child.type === 'resource_location')?.path?.join('_') + } + } break; + case 'mcdoc:enum': { + /* @ts-ignore */ + container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + } break; + case 'mcdoc:type_alias': { + /* @ts-ignore */ + container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + } break; + } + } break; + case 'mcdoc:struct/field/pair': { + /* @ts-ignore */ + const key = threeBack.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const root = threeBack.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + + container = `${root}.${key}` + } + } + } + } + const key = `mcdoc.${resource.replace(/\//g, '.')}${container ? `.${container}` : ''}.${end}` + + let value = internal_locales[parent].join('').trimEnd() + + /// remove windows cruft + if (value.includes('\r')) value = value.replaceAll('\r', '') + + locales[key] = value + } + + /* @ts-ignore */ + if (Object.hasOwn(_child, 'value')) { + /* @ts-ignore */ + child.value = _child.value + + if (internal_locales[parent]) { + if (child.value === 'dispatch') { + const dispatchValue = _parent?.children?.slice(-1)[0] + + if (dispatchValue) { + if (dispatchValue.type === 'mcdoc:struct') { + /* @ts-ignore */ + const key = dispatchValue.children?.[1]?.value + + if (key) { + setLocale(`__dispatch.${key}`) + } else { + /// anonymous struct + setLocale(`__dispatch_${self.split('][').slice(-2)[0]}`) // THIS IS REALLY REALLY BAD + } + } else { + /* @ts-ignore */ + const key = `${_parent?.children?.[3]?.children?.[0].value}`.replace(/[\%\, ]/, '__') // should be sanitized enough + + setLocale(`__dispatch.${key}`) + } + } + } else { + setLocale(child.value) + } + + delete internal_locales[parent] + } + } + + if ( + child.type === 'mcdoc:struct/map_key' && + internal_locales[parent] + ) { + const attributes = _child.children?.[0]?.children?.[0]?.children + /* @ts-ignore */ + if (attributes && attributes.length === 1 && !attributes[0].children && attributes[0].value === 'id') { + /* @ts-ignore */ + setLocale(_child.children?.[0].children?.[1].value) + } else { + logger.warn('Could not find good path, using __map_key. hint: ' + self) + setLocale('__map_key') + } + + delete internal_locales[parent] + } + + if (Object.hasOwn(_child, 'comment')) { + /* @ts-ignore */ + const comment: string = _child.comment + child.comment = comment + + if ( + !args.dry && args.locale && + _parent?.type === 'mcdoc:doc_comments' + ) { + const key = parent.replace(/\[\d+\]$/, '') + + if (!internal_locales[key]) { + internal_locales[key] = [] + } + + internal_locales[key].push(comment.slice(1)) + } + } + + if (_child.hover) child.hover = _child.hover + + if (_child.color) child.color = _child.color + + if (child.type !== 'error') return child + else { + errors++ + + const lc = lineColumn(doc_contents) + + function range( + range: { start: number; end: number }, + ) { + const start = lc.fromIndex(range.start) + const end = lc.fromIndex(range.end) + + return `L${start?.line}${start?.col ? `:C${start?.col}` : '' + } -> L${end?.line}${end?.col ? `:C${end?.col}` : '' + }` + } + + if (!known_error) { + console.warn(`mcdoc error(s):`) + /* @ts-ignore */ + if (_child.parent?.parserErrors.length !== 0) { + console.warn(' parser:') + /* @ts-ignore */ + _child.parent?.parserErrors.forEach(error => { + console.warn( + ` ${error.message}\n Location: ${range(error.range) + }. Severity ${error.severity}.`, + ) + }) + } + + /* @ts-ignore */ + if (_child.parent?.binderErrors.length !== 0) { + console.warn(' binder:') + /* @ts-ignore */ + _child.parent?.binderErrors.forEach(error => { + console.warn( + ` ${error.message}\n Location: ${range(error.range) + }. Severity ${error.severity}.`, + ) + }) + } + } + console.warn(`error @ ${doc_file.path}\n\n`) + return false + } + } + + children.forEach((child, i) => { + /* @ts-ignore */ + children[i] = flattenChild( + resource, + `${resource}.[${i}]`, + undefined, + child, + ) + }) + + const symbol = { + resource, + + children, + } + + symbols.push(symbol) + + if (!args.dry && args.module) { + const dir = + parse(join(generated_path, 'module', resource)).dir + + if (dir !== '') await fs.ensureDir(dir) + + await fs.writeFile( + join(generated_path, 'module', `${resource}.mcdoc.json`), + JSON.stringify(symbol), + ) + + if (args.pretty) { + await fs.writeFile( + join( + generated_path, + 'module', + `${resource}.pretty.mcdoc.json`, + ), + JSON.stringify(symbol, undefined, 3), + ) + } + } + } + } + + return [symbols, locales, errors] as [{ resource: string, children: AstNode[] }[], typeof locales, number] +} \ No newline at end of file diff --git a/packages/mcdoc-cli/src/index.ts b/packages/mcdoc-cli/src/index.ts index 8414ee15f..ca48ce996 100644 --- a/packages/mcdoc-cli/src/index.ts +++ b/packages/mcdoc-cli/src/index.ts @@ -1,14 +1,12 @@ #!/usr/bin/env -S node -import { dirname, join, parse, resolve } from 'path' +import { dirname, join, resolve } from 'path' import { fileURLToPath, pathToFileURL } from 'url' import fs from 'fs-extra' import walk from 'klaw' -import lineColumn from 'line-column' import yargs from 'yargs' import { hideBin } from 'yargs/helpers' -import type { AstNode } from '@spyglassmc/core' import { ConfigService, fileUtil, @@ -18,14 +16,25 @@ import { import { NodeJsExternals } from '@spyglassmc/core/lib/nodejs.js' import * as mcdoc from '@spyglassmc/mcdoc' -const parentPath = dirname(fileURLToPath(import.meta.url)) -const cacheRoot = join(parentPath, 'cache') +import { generate } from './generate/index.js' +import { update_locales } from './update_locales/index.js' + +import type { AstNode } from '@spyglassmc/core' + +const cache_root = join(dirname(fileURLToPath(import.meta.url)), 'cache') const CLI = yargs(hideBin(process.argv)) -function removeWindowsCruft(str: string) { - if (str.includes('\r')) return str.replaceAll('\r', '') - return str +export type Logger = { + log: (...log_args: any[]) => void, + + warn: (...log_args: any[]) => void, + + error: (...log_args: any[]) => void, + + info: (...log_args: any[]) => void, + + trace: (message?: any, ...params: any) => void, } await CLI.scriptName('mcdoc') @@ -77,14 +86,13 @@ await CLI.scriptName('mcdoc') if (args.module) include.push('modules') console.info( - `Generating JSON files${ - args.locale || args.module - ? `, including ${include.join(', ')}` - : '' + `Generating JSON files${args.locale || args.module + ? `, including ${include.join(', ')}` + : '' }`, ) - const logger = { + const logger: Logger = { log: (...log_args: any[]) => args.verbose ? console.log(...log_args) : false, @@ -99,15 +107,15 @@ await CLI.scriptName('mcdoc') console.trace(message, ...params), } - const projectPath = resolve(process.cwd(), args.source) + const project_path = resolve(process.cwd(), args.source) - await fileUtil.ensureDir(NodeJsExternals, projectPath) + await fileUtil.ensureDir(NodeJsExternals, project_path) const service = new Service({ logger, project: { cacheRoot: fileUtil.ensureEndingSlash( - pathToFileURL(cacheRoot).toString(), + pathToFileURL(cache_root).toString(), ), defaultConfig: ConfigService.merge(VanillaConfig, { env: { dependencies: [] }, @@ -115,7 +123,7 @@ await CLI.scriptName('mcdoc') externals: NodeJsExternals, initializers: [mcdoc.initialize], projectRoot: fileUtil.ensureEndingSlash( - pathToFileURL(projectPath).toString(), + pathToFileURL(project_path).toString(), ), }, }) @@ -123,294 +131,68 @@ await CLI.scriptName('mcdoc') await service.project.ready() await service.project.cacheService.save() - const generated = join('out', 'generated') + const generated_path = join('out', 'generated') if (args.dry !== true) { - await fs.ensureDir(generated) + await fs.ensureDir(generated_path) if (args.module) { - await fs.ensureDir(join(generated, 'module')) + await fs.ensureDir(join(generated_path, 'module')) } if (args.locale) { await fs.ensureDir(join('out', 'locale')) } } - const symbols = [] - - const internal_locales: Record = {} + const symbols: { resource: string, children: AstNode[] }[] = [] - const locales: Record = {} + let locales: Record = {} let errors = 0 - for await (const doc_file of walk(projectPath)) { + for await (const doc_file of walk(project_path)) { if (doc_file.path.endsWith('.mcdoc')) { - const DocumentUri = pathToFileURL(doc_file.path).toString() + const response = await generate(project_path, generated_path, args, doc_file, service, logger) - const doc_contents = await fs.readFile(doc_file.path, 'utf-8') - - await service.project.onDidOpen( - DocumentUri, - 'mcdoc', - 0, - doc_contents, - ) - - const check = await service.project.ensureClientManagedChecked( - DocumentUri, - ) - - if (check && check.doc && check.node) { - const { doc, node } = check - - const path = parse(fileURLToPath(doc.uri)) - - const resource = join( - path.dir.replace(`${projectPath}`, ''), - path.name, - ).replace(/^\//, '') - - logger.info(`parsing ${resource}\n`) - - if (node.children[0]) { - const children = node.children - - function flattenChild( - parent: string, - self: string, - _parent: Partial | undefined, - _child: Partial, - ) { - const child: any = {} - - const known_error = false - - /* @ts-ignore */ - child.self = self - - /* @ts-ignore */ - if (_child.parent) child.parent = parent - - /* @ts-ignore */ - if (_child.parentMap) child.parentMap = parent - - if (_child.children) { - child.children = [] - for ( - const [i, __child] of Object.entries( - _child.children, - ) - ) { - /* @ts-ignore */ - child.children[Number(i)] = flattenChild( - self, - `${self}[${i}]`, - _child, - __child, - ) - } - } - - child.type = _child.type - - if (child.type === 'resource_location') { - /* @ts-ignore */ - child.namespace = _child.namespace - /* @ts-ignore */ - child.path = _child.path - } - - if (Object.hasOwn(_child, 'isOptional')) { - /* @ts-ignore */ - child.isOptional = _child.isOptional - } - - if (Object.hasOwn(_child, 'colorTokenType')) { - /* @ts-ignore */ - child.colorTokenType = _child.colorTokenType - } - - /* @ts-ignore */ - if (Object.hasOwn(_child, 'value')) { - /* @ts-ignore */ - child.value = _child.value - - if (internal_locales[parent]) { - locales[ - `mcdoc.${ - resource.replace(/[\/\\]/g, '.') - }.${child.value}` - ] = removeWindowsCruft( - internal_locales[parent].join('').trimEnd(), - ) - - delete internal_locales[parent] - } - } - - if ( - child.type === 'mcdoc:struct/map_key' && - internal_locales[parent] - ) { - locales[ - `mcdoc.${ - resource.replace(/[\/\\]/g, '.') - }.map_key` - ] = removeWindowsCruft( - internal_locales[parent].join('').trimEnd(), - ) - - delete internal_locales[parent] - } - - if (Object.hasOwn(_child, 'comment')) { - /* @ts-ignore */ - const comment: string = _child.comment - child.comment = comment - - if ( - !args.dry && args.locale && - _parent?.type === 'mcdoc:doc_comments' - ) { - const key = parent.replace(/\[\d+\]$/, '') - - if (!internal_locales[key]) { - internal_locales[key] = [] - } - - internal_locales[key].push(comment.slice(1)) - } - } - - if (_child.hover) child.hover = _child.hover - - if (_child.color) child.color = _child.color - - if (child.type !== 'error') return child - else { - errors++ - - const lc = lineColumn(doc_contents) - - function range( - range: { start: number; end: number }, - ) { - const start = lc.fromIndex(range.start) - const end = lc.fromIndex(range.end) - - return `L${start?.line}${ - start?.col ? `:C${start?.col}` : '' - } -> L${end?.line}${ - end?.col ? `:C${end?.col}` : '' - }` - } - - if (!known_error) { - console.warn(`mcdoc error(s):`) - /* @ts-ignore */ - if (_child.parent?.parserErrors.length !== 0) { - console.warn(' parser:') - /* @ts-ignore */ - _child.parent?.parserErrors.forEach(error => { - console.warn( - ` ${error.message}\n Location: ${ - range(error.range) - }. Severity ${error.severity}.`, - ) - }) - } - - /* @ts-ignore */ - if (_child.parent?.binderErrors.length !== 0) { - console.warn(' binder:') - /* @ts-ignore */ - _child.parent?.binderErrors.forEach(error => { - console.warn( - ` ${error.message}\n Location: ${ - range(error.range) - }. Severity ${error.severity}.`, - ) - }) - } - } - console.warn(`error @ ${doc_file.path}\n\n`) - return false - } - } - - children.forEach((child, i) => { - /* @ts-ignore */ - children[i] = flattenChild( - resource, - `${resource}.[${i}]`, - undefined, - child, - ) - }) - - const symbol = { - resource, - - children, - } - - symbols.push(symbol) - - if (!args.dry && args.module) { - const dir = - parse(join(generated, 'module', resource)).dir - - if (dir !== '') await fs.ensureDir(dir) - - await fs.writeFile( - join(generated, 'module', `${resource}.mcdoc.json`), - JSON.stringify(symbol), - ) - - if (args.pretty) { - await fs.writeFile( - join( - generated, - 'module', - `${resource}.pretty.mcdoc.json`, - ), - JSON.stringify(symbol, undefined, 3), - ) - } - } - } - } + symbols.push(...response[0]) + locales = { ...locales, ...response[1] } + errors += response[2] } } if (!args.dry) { await fs.writeFile( - join(generated, 'generated.mcdoc.json'), + join(generated_path, 'generated.mcdoc.json'), JSON.stringify(symbols), ) if (args.pretty) { await fs.writeFile( - join(generated, 'generated.pretty.mcdoc.json'), + join(generated_path, 'generated.pretty.mcdoc.json'), JSON.stringify(symbols, undefined, 3), ) } if (args.module) { await fs.writeFile( - join(generated, 'module', 'index.json'), + join(generated_path, 'module', 'index.json'), JSON.stringify(symbols.map(symbol => symbol.resource)), ) } if (args.locale) { - const orphaned_doc = Object.keys(internal_locales) - if (orphaned_doc.length !== 0) { - console.warn( - `parsing error, ${orphaned_doc.length} orphaned doc comments or incorrectly parsed markup comments`, - ) - console.warn(internal_locales) + const locale_path = join('out', 'locale', 'en-us.json') + if (await fs.exists(locale_path)) { + const old_locales = JSON.parse(await fs.readFile(locale_path, 'utf-8')) + + await fs.ensureDir(join('out', 'meta')) + + await fs.writeFile(join('out', 'meta', 'locale.json'), JSON.stringify({ + old_keys: Object.keys(old_locales), + old_values: Object.values(old_locales), + new_keys: Object.keys(locales), + new_values: Object.values(locales), + }, undefined, 3)) } await fs.writeFile( join('out', 'locale', 'en-us.json'), @@ -424,6 +206,11 @@ await CLI.scriptName('mcdoc') await service.project.close() }, ) + .command( + 'update_locales', + 'Attempt automatic upgrade of locales.', + update_locales, + ) .strict() .demandCommand(1) .parse() diff --git a/packages/mcdoc-cli/src/update_locales/index.ts b/packages/mcdoc-cli/src/update_locales/index.ts new file mode 100644 index 000000000..c230faae4 --- /dev/null +++ b/packages/mcdoc-cli/src/update_locales/index.ts @@ -0,0 +1,119 @@ +import { join } from 'path' + +import fs from 'fs-extra' + +import walk from 'klaw' +import { ofetch } from 'ofetch' + +type MetaLocale = { + old_keys: string[], + old_values: string[], + new_keys: string[], + new_values: string[], +} + +export async function update_locales() { + console.log('Reading locale diff') + + const locales: MetaLocale = JSON.parse(await fs.readFile(join('out', 'meta', 'locale.json'), 'utf-8')) + + const removed_keys: [string, string][] = [] + const added_keys: [string, string][] = [] + + let moved_keys_count = 0 + const moved_keys: Record = {} + let changed_values_count = 0 + const changed_values: [key: string, [from: string, to: string]][] = [] + + for (let i = 0; i < locales.old_keys.length; i++) { + let keyRemoved = false + const keyIndex = locales.new_keys.indexOf(locales.old_keys[i]) + if (keyIndex === -1) { + keyRemoved = true + } + let valueRemoved = false + const valueIndex = locales.new_values.indexOf(locales.old_values[i]) + if (valueIndex === -1) { + valueRemoved = true + } + if (keyRemoved && valueRemoved) { + removed_keys.push([locales.old_keys[i], locales.old_values[i]]) + } else if (keyRemoved && !valueRemoved) { + if (locales.new_values.filter(value => value === locales.old_values[i]).length > 1) { + removed_keys.push([locales.old_keys[i], locales.old_values[i]]) + console.log('Duplicate key removed:', locales.old_keys[i]) + } else { + // the key was moved + moved_keys[locales.old_keys[i]] = locales.new_keys[valueIndex] + moved_keys_count++ + } + } else { + // value changed + changed_values.push([locales.old_keys[i], [locales.old_values[i], locales.new_values[keyIndex]]]) + changed_values_count++ + } + } + for (let i = 0; i < locales.new_keys.length; i++) { + if (!moved_keys[locales.new_keys[i]] && !locales.old_keys.includes(locales.new_keys[i])) { + added_keys.push([locales.new_keys[i], locales.new_values[i]]) + } + } + console.log(`Removed ${removed_keys.length} keys:`, removed_keys) + console.log(`Added ${added_keys.length} keys:`, added_keys) + console.log(`Moved ${moved_keys_count} keys:`, moved_keys) + console.log(`Changed ${changed_values_count} values:`, changed_values) + if (moved_keys_count > 0) { + console.log('Moving keys') + for await (const locale_file of walk(join('out', 'locale'))) { + if (!locale_file.path.endsWith('en-us.json')) { + const locale = JSON.parse(await fs.readFile(locale_file.path, 'utf-8')) + + let have_moved = 0 + + for (const key of Object.keys(moved_keys)) { + if (locale[key]) { + locale[moved_keys[key]] = locale[key] + delete locale[key] + + have_moved++ + } + } + + await fs.writeFile(locale_file.path, JSON.stringify(locale, undefined, 3)) + + if (have_moved > 0) { + console.log(`Moved ${have_moved} keys in ${locale_file.path}`) + } + } + } + } + const webhook = process.env.TRANSLATION_UPDATE_WEBHOOK + + if (changed_values_count > 0 && webhook) { + console.log('Notifying translators about changed values') + + let description = '' + + for (const [key, [from, to]] of changed_values) { + const isPeriod = to.slice(-1) + + if (isPeriod !== '.' && from.slice(0, -1) !== to) { + description += `- \`${key}\` changed, before/after:\n - \`${from}\`\n - \`${to}\`\n` + } + } + + await ofetch(webhook, { + method: 'POST', + body: { + content: '', + embeds: [ + { + color: 1863349, + title: 'mcdoc translation key values changed in en-us.json', + description, + }, + ], + }, + }) + } +} \ No newline at end of file From 106fe7fd4c51b0f9cb105a76fd9426a53eb0d833 Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 23:20:42 -0600 Subject: [PATCH 08/27] =?UTF-8?q?=F0=9F=A7=B9=20Fix=20formatting=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc-cli/src/generate/index.ts | 807 ++++++++++++------ packages/mcdoc-cli/src/index.ts | 51 +- .../mcdoc-cli/src/update_locales/index.ts | 41 +- 3 files changed, 608 insertions(+), 291 deletions(-) diff --git a/packages/mcdoc-cli/src/generate/index.ts b/packages/mcdoc-cli/src/generate/index.ts index 8747456a8..8fc12cfc6 100644 --- a/packages/mcdoc-cli/src/generate/index.ts +++ b/packages/mcdoc-cli/src/generate/index.ts @@ -11,13 +11,20 @@ import type { Logger } from '../index.js' type Args = { locale?: boolean - module?: boolean - pretty?: boolean - verbose?: boolean - dry?: boolean + module?: boolean + pretty?: boolean + verbose?: boolean + dry?: boolean } -export async function generate(project_path: string, generated_path: string, args: Args, doc_file: walk.Item, service: Service, logger: Logger) { +export async function generate( + project_path: string, + generated_path: string, + args: Args, + doc_file: walk.Item, + service: Service, + logger: Logger, +) { const symbols = [] let errors = 0 @@ -117,11 +124,17 @@ export async function generate(project_path: string, generated_path: string, arg // if you want to keep your sanity, avoid looking at this function function setLocale(end: string) { let container - if (doc_file.path.endsWith(`${resource.split('/').slice(-1)[0]}.mcdoc`)) { + if ( + doc_file.path.endsWith( + `${resource.split('/').slice(-1)[0]}.mcdoc`, + ) + ) { const threeBack = _parent?.parent?.parent if (threeBack?.type === 'mcdoc:struct') { - const identifierIndex = threeBack?.children?.findIndex(child => child.type === 'mcdoc:identifier') + const identifierIndex = threeBack?.children?.findIndex( + child => child.type === 'mcdoc:identifier', + ) if (identifierIndex && identifierIndex !== -1) { /* @ts-ignore */ @@ -131,304 +144,560 @@ export async function generate(project_path: string, generated_path: string, arg const fourBack = threeBack?.parent switch (fourBack?.type) { - case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ - const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier')?.value - const sixBack = fourBack.parent?.parent - /* @ts-ignore */ - const foundRoot = sixBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - if (key) { - if (foundRoot) { - container = `${foundRoot}.${key}` - } else { - // This is another nested anonymous struct - // TODO: Yeah this should be recursive and smarter but I'm lazy - /* @ts-ignore */ - const parentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - /* @ts-ignore */ - const actualRoot = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - container = `${actualRoot}.${parentKey}.${key}` - } - } else { - // This is another nested anonymous struct - // TODO: Yeah this should be recursive and smarter but I'm lazy + case 'mcdoc:struct/field/pair': + { /* @ts-ignore */ - const parentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const key = fourBack.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value + const sixBack = fourBack.parent?.parent /* @ts-ignore */ - const actualRoot = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const foundRoot = sixBack?.children?.find( + child => child.type === 'mcdoc:identifier', + )?.value - container = `${actualRoot}.${parentKey}.__map_key.__struct` - } - } break; - case 'mcdoc:type/union': { - switch (fourBack?.parent?.type) { - case 'mcdoc:struct/field/spread': { - /* @ts-ignore */ - const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][0][1][0][0][0] - // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][1][1][0][0][0] - if (root) { - container = `${root}.__spread.__union.__struct_${self.split('][').slice(-4)[0]}` // THIS IS REALLY REALLY BAD + if (key) { + if (foundRoot) { + container = `${foundRoot}.${key}` } else { - logger.warn('Could not find root for union spread') + // This is another nested anonymous struct + // TODO: Yeah this should be recursive and smarter but I'm lazy + /* @ts-ignore */ + const parentKey = sixBack?.parent + ?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value + /* @ts-ignore */ + const actualRoot = sixBack?.parent + ?.parent?.parent?.children?.find( + child => + child.type === + 'mcdoc:identifier', + )?.value + + container = + `${actualRoot}.${parentKey}.${key}` } - } break; - case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ - const parentKey = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - + } else { + // This is another nested anonymous struct + // TODO: Yeah this should be recursive and smarter but I'm lazy /* @ts-ignore */ - const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - container = `${root}.${parentKey}.__union.__struct_${self.split('][').slice(-2)[0]}` // THIS IS REALLY REALLY BAD - } break; - case 'mcdoc:dispatch_statement': { + const parentKey = sixBack?.parent?.children + ?.find(child => + child.type === 'mcdoc:identifier' + )?.value /* @ts-ignore */ - const registry = fourBack.parent.children?.find(child => child.type === 'resource_location')?.path?.join('_') + const actualRoot = sixBack?.parent?.parent + ?.parent?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value - /* @ts-ignore */ - const key = fourBack.parent.children?.find(child => child.type === 'mcdoc:index_body')?.children?.[0]?.value - - const indexGuess = self.split('][').slice(-6)[0] // THIS IS REALLY REALLY BAD - - if (indexGuess === '45') { - container = `__dispatch.${registry}.${key}.__union.__struct_${self.split('][').slice(-4)[0] }` - } else { - container = `__dispatch.${registry}.${key}.__union.__struct_${indexGuess}` + container = + `${actualRoot}.${parentKey}.__map_key.__struct` + } + } + break + case 'mcdoc:type/union': + { + switch (fourBack?.parent?.type) { + case 'mcdoc:struct/field/spread': + { + /* @ts-ignore */ + const root = fourBack?.parent?.parent + ?.parent?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][0][1][0][0][0] + // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][1][1][0][0][0] + if (root) { + container = + `${root}.__spread.__union.__struct_${ + self.split('][').slice(-4)[0] + }` // THIS IS REALLY REALLY BAD + } else { + logger.warn( + 'Could not find root for union spread', + ) + } + } + break + case 'mcdoc:struct/field/pair': + { + /* @ts-ignore */ + const parentKey = fourBack?.parent + ?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + /* @ts-ignore */ + const root = fourBack?.parent?.parent + ?.parent?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + container = + `${root}.${parentKey}.__union.__struct_${ + self.split('][').slice(-2)[0] + }` // THIS IS REALLY REALLY BAD + } + break + case 'mcdoc:dispatch_statement': + { + /* @ts-ignore */ + const registry = fourBack.parent + .children?.find(child => + child.type === + 'resource_location' + )?.path?.join('_') + + /* @ts-ignore */ + const key = fourBack.parent.children + ?.find(child => + child.type === + 'mcdoc:index_body' + )?.children?.[0]?.value + + const indexGuess = + self.split('][').slice(-6)[0] // THIS IS REALLY REALLY BAD + + if (indexGuess === '45') { + container = + `__dispatch.${registry}.${key}.__union.__struct_${ + self.split('][').slice(-4)[0] + }` + } else { + container = + `__dispatch.${registry}.${key}.__union.__struct_${indexGuess}` + } + } + break + case 'mcdoc:type_alias': + { + /* @ts-ignore */ + container = fourBack?.parent?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + } + break + default: { + // TODO: there's more cases here, but I'm done for now + // console.log('aa ', fourBack?.parent?.type) } - } break; - case 'mcdoc:type_alias': { - /* @ts-ignore */ - container = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - } break; - default: { - // TODO: there's more cases here, but I'm done for now - // console.log('aa ', fourBack?.parent?.type) } } - } break; - case 'mcdoc:type/list': { - const fiveBack = fourBack?.parent - switch (fiveBack?.type) { - case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ - const key = fiveBack.children?.find(child => child.type === 'mcdoc:identifier')?.value - const sevenBack = fiveBack.parent?.parent - /* @ts-ignore */ - const foundRoot = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - if (foundRoot) { - container = `${foundRoot}.${key}.__struct_list` - } else { - // This is another nested anonymous struct - switch (sevenBack?.parent?.type) { - case 'mcdoc:type/list': { - /* @ts-ignore */ - const nineBack = sevenBack.parent?.parent - /* @ts-ignore */ - const parentKey = nineBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - // Credits husk - /* @ts-ignore */ - const actualRoot = nineBack?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - if (actualRoot) { - container = `${actualRoot}.__struct_list.${parentKey}.__struct_list.${key}.__struct_list` - } else { - logger.warn('Could not find root for a bunch of nested struct lists, probably don\'t do this') - } - } break; - case 'mcdoc:type/union': { - /* @ts-ignore */ - const actualRoot = sevenBack.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - // block state definition, this is fragile - - if (actualRoot) { - container = `${actualRoot}.__struct_union.${key}.__struct_list` - } else { - logger.warn('Could not find root for struct list within struct union, this should be fixed') + break + case 'mcdoc:type/list': + { + const fiveBack = fourBack?.parent + switch (fiveBack?.type) { + case 'mcdoc:struct/field/pair': + { + /* @ts-ignore */ + const key = fiveBack.children?.find( + child => + child.type === + 'mcdoc:identifier', + )?.value + const sevenBack = fiveBack.parent + ?.parent + /* @ts-ignore */ + const foundRoot = sevenBack?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + if (foundRoot) { + container = + `${foundRoot}.${key}.__struct_list` + } else { + // This is another nested anonymous struct + switch (sevenBack?.parent?.type) { + case 'mcdoc:type/list': + { + /* @ts-ignore */ + const nineBack = sevenBack + .parent?.parent + /* @ts-ignore */ + const parentKey = nineBack + ?.children?.find( + child => + child.type === + 'mcdoc:identifier', + )?.value + // Credits husk + /* @ts-ignore */ + const actualRoot = + nineBack?.parent + ?.parent?.parent + ?.parent?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + if (actualRoot) { + container = + `${actualRoot}.__struct_list.${parentKey}.__struct_list.${key}.__struct_list` + } else { + logger.warn( + "Could not find root for a bunch of nested struct lists, probably don't do this", + ) + } + } + break + case 'mcdoc:type/union': { + /* @ts-ignore */ + const actualRoot = sevenBack + .parent?.parent?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + // block state definition, this is fragile + + if (actualRoot) { + container = + `${actualRoot}.__struct_union.${key}.__struct_list` + } else { + logger.warn( + 'Could not find root for struct list within struct union, this should be fixed', + ) + } + } } } } - } - } break; - case 'mcdoc:type_alias': { - /* @ts-ignore */ - const root = fiveBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - container = `${root}.__struct_list` - } break; + break + case 'mcdoc:type_alias': + { + /* @ts-ignore */ + const root = fiveBack?.children?.find( + child => + child.type === + 'mcdoc:identifier', + )?.value + + container = `${root}.__struct_list` + } + break + } } - } break; - case 'mcdoc:type_alias': { - /* @ts-ignore */ - const root = fourBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + break + case 'mcdoc:type_alias': + { + /* @ts-ignore */ + const root = fourBack?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value - if (root) { - container = root - } else { - logger.warn('Could not find root for type alias, hint:' + self) + if (root) { + container = root + } else { + logger.warn( + 'Could not find root for type alias, hint:' + + self, + ) + } + } + break + case 'mcdoc:dispatch_statement': + { + // anonymous struct + container = `__dispatch.__struct${ + self.split('][').slice(-5)[0] + }` // THIS IS REALLY REALLY BAD } - } break; - case 'mcdoc:dispatch_statement': { - // anonymous struct - container = `__dispatch.__struct${self.split('][').slice(-5)[0]}` // THIS IS REALLY REALLY BAD - } break; + break } // anonymous struct switch (fourBack?.type) { - case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ - const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier')?.value - const sixBack = fourBack.parent?.parent - /* @ts-ignore */ - const parentKey = sixBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value + case 'mcdoc:struct/field/pair': + { + /* @ts-ignore */ + const key = fourBack.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value + const sixBack = fourBack.parent?.parent + /* @ts-ignore */ + const parentKey = sixBack?.children?.find( + child => child.type === 'mcdoc:identifier', + )?.value + + if (key) { + if (parentKey) { + container = `${parentKey}.${key}` + } else { + // memories + /* @ts-ignore */ + const actualParentKey = sixBack?.parent + ?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value - if (key) { - if (parentKey) { - container = `${parentKey}.${key}` + /* @ts-ignore */ + const root = sixBack?.parent?.parent + ?.parent?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value + + container = + `${root}.${actualParentKey}.${key}` + } } else { - // memories + // advancement criteria trigger + const sevenBack = fourBack?.parent?.parent + ?.parent /* @ts-ignore */ - const actualParentKey = sixBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const parentKey = sevenBack?.children?.find( + child => + child.type === 'mcdoc:identifier', + )?.value /* @ts-ignore */ - const root = sixBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const root = sevenBack?.parent?.parent + ?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value - container = `${root}.${actualParentKey}.${key}` + container = + `${root}.${parentKey}.__map_key.__struct` } - } else { - // advancement criteria trigger - const sevenBack = fourBack?.parent?.parent?.parent - /* @ts-ignore */ - const parentKey = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - /* @ts-ignore */ - const root = sevenBack?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - container = `${root}.${parentKey}.__map_key.__struct` } - } break; - case 'mcdoc:type/union': { - if (!container) { // yes - switch (fourBack?.parent?.type) { - case 'mcdoc:type_alias': { - /* @ts-ignore */ - const root = fourBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - container = `${root}.__union.__struct_${self.split('][').slice(-4)[0]}` // THIS IS REALLY REALLY BAD - } break; - case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ - const parentKey = fourBack?.parent.children?.find(child => child.type === 'mcdoc:identifier')?.value - - /* @ts-ignore */ - const root = fourBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - container = `${root}.${parentKey}` - } break; - case 'mcdoc:dispatch_statement': { - // kill - - const indexGuess = self.split('][').slice(-6)[0] - if (indexGuess === '45') { - container = `__dispatch.__struct_${self.split('][').slice(-4)[0]}` - } else { - container = `__dispatch.__struct_${indexGuess}` // THIS IS REALLY REALLY BAD - } - } break; - case 'mcdoc:type/union': { - // book lines - const sevenBack = fourBack?.parent?.parent?.parent - /* @ts-ignore */ - const parentKey = sevenBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - /* @ts-ignore */ - const root = sevenBack?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + break + case 'mcdoc:type/union': + { + if (!container) { // yes + switch (fourBack?.parent?.type) { + case 'mcdoc:type_alias': + { + /* @ts-ignore */ + const root = fourBack?.parent + ?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + container = + `${root}.__union.__struct_${ + self.split('][').slice(-4)[0] + }` // THIS IS REALLY REALLY BAD + } + break + case 'mcdoc:struct/field/pair': + { + /* @ts-ignore */ + const parentKey = fourBack?.parent + .children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value - container = `${root}.${parentKey}.__union_list.__struct` - } break; - case 'mcdoc:type/list': { - // texture meta - /* @ts-ignore */ - const parentKey = fourBack?.parent.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const root = fourBack?.parent + ?.parent?.parent?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + container = `${root}.${parentKey}` + } + break + case 'mcdoc:dispatch_statement': + { + // kill + + const indexGuess = + self.split('][').slice(-6)[0] + if (indexGuess === '45') { + container = + `__dispatch.__struct_${ + self.split('][').slice( + -4, + )[0] + }` + } else { + container = + `__dispatch.__struct_${indexGuess}` // THIS IS REALLY REALLY BAD + } + } + break + case 'mcdoc:type/union': + { + // book lines + const sevenBack = fourBack?.parent + ?.parent?.parent + /* @ts-ignore */ + const parentKey = sevenBack + ?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value - /* @ts-ignore */ - const rootKey = fourBack?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const root = sevenBack?.parent + ?.parent?.children?.find( + child => + child.type === + 'mcdoc:identifier', + )?.value + + container = + `${root}.${parentKey}.__union_list.__struct` + } + break + case 'mcdoc:type/list': + { + // texture meta + /* @ts-ignore */ + const parentKey = fourBack?.parent + .parent?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value - /* @ts-ignore */ - const root = fourBack?.parent?.parent?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + /* @ts-ignore */ + const rootKey = fourBack?.parent + ?.parent?.parent?.parent?.parent + ?.children?.find(child => + child.type === + 'mcdoc:identifier' + )?.value - container = `${root}.${rootKey}.${parentKey}.__union_list.__struct` - } break; + /* @ts-ignore */ + const root = fourBack?.parent + ?.parent?.parent?.parent?.parent + ?.parent?.parent?.children + ?.find(child => + child.type === + 'mcdoc:identifier' + )?.value + + container = + `${root}.${rootKey}.${parentKey}.__union_list.__struct` + } + break + } } } - } break; + break } } } else { const threeBack = _parent?.parent?.parent switch (threeBack?.type) { - case 'mcdoc:enum': { - /* @ts-ignore */ - const root = threeBack?.children?.find(child => child.type === 'mcdoc:identifier')?.value - - if (root) { - container = root - } else { - // inline enum + case 'mcdoc:enum': + { /* @ts-ignore */ - const parentKey = threeBack?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - /* @ts-ignore */ - const root = threeBack?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const root = threeBack?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value if (root) { - container = `${root}.${parentKey}` + container = root } else { + // inline enum /* @ts-ignore */ - const rootKey = threeBack?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const parentKey = threeBack?.parent?.children + ?.find(child => + child.type === 'mcdoc:identifier' + )?.value /* @ts-ignore */ - const root = threeBack?.parent?.parent?.parent?.parent?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value + const root = threeBack?.parent?.parent?.parent + ?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value - container = `${root}.${rootKey}.${parentKey}` - } - } - } break; - case 'file': { - switch (_parent?.type) { - case 'mcdoc:struct': { - /* @ts-ignore */ - container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - } break; - case 'mcdoc:dispatch_statement': { - if (_parent?.children) { + if (root) { + container = `${root}.${parentKey}` + } else { + /* @ts-ignore */ + const rootKey = threeBack?.parent?.parent + ?.parent?.parent?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value /* @ts-ignore */ - container = _parent?.children?.find(child => child.type === 'resource_location')?.path?.join('_') + const root = threeBack?.parent?.parent + ?.parent?.parent?.parent?.parent + ?.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value + + container = + `${root}.${rootKey}.${parentKey}` } - } break; - case 'mcdoc:enum': { - /* @ts-ignore */ - container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - } break; - case 'mcdoc:type_alias': { - /* @ts-ignore */ - container = _parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - } break; + } } - } break; + break + case 'file': + { + switch (_parent?.type) { + case 'mcdoc:struct': + { + /* @ts-ignore */ + container = _parent?.children?.find( + child => + child.type === 'mcdoc:identifier', + )?.value + } + break + case 'mcdoc:dispatch_statement': + { + if (_parent?.children) { + /* @ts-ignore */ + container = _parent?.children?.find( + child => + child.type === + 'resource_location', + )?.path?.join('_') + } + } + break + case 'mcdoc:enum': + { + /* @ts-ignore */ + container = _parent?.children?.find( + child => + child.type === 'mcdoc:identifier', + )?.value + } + break + case 'mcdoc:type_alias': + { + /* @ts-ignore */ + container = _parent?.children?.find( + child => + child.type === 'mcdoc:identifier', + )?.value + } + break + } + } + break case 'mcdoc:struct/field/pair': { /* @ts-ignore */ - const key = threeBack.children?.find(child => child.type === 'mcdoc:identifier')?.value + const key = threeBack.children?.find(child => + child.type === 'mcdoc:identifier' + )?.value /* @ts-ignore */ - const root = threeBack.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier')?.value - + const root = threeBack.parent?.parent?.children + ?.find(child => child.type === 'mcdoc:identifier') + ?.value + container = `${root}.${key}` } } } } - const key = `mcdoc.${resource.replace(/\//g, '.')}${container ? `.${container}` : ''}.${end}` + const key = `mcdoc.${resource.replace(/\//g, '.')}${ + container ? `.${container}` : '' + }.${end}` let value = internal_locales[parent].join('').trimEnd() @@ -446,7 +715,7 @@ export async function generate(project_path: string, generated_path: string, arg if (internal_locales[parent]) { if (child.value === 'dispatch') { const dispatchValue = _parent?.children?.slice(-1)[0] - + if (dispatchValue) { if (dispatchValue.type === 'mcdoc:struct') { /* @ts-ignore */ @@ -456,11 +725,15 @@ export async function generate(project_path: string, generated_path: string, arg setLocale(`__dispatch.${key}`) } else { /// anonymous struct - setLocale(`__dispatch_${self.split('][').slice(-2)[0]}`) // THIS IS REALLY REALLY BAD + setLocale( + `__dispatch_${self.split('][').slice(-2)[0]}`, + ) // THIS IS REALLY REALLY BAD } } else { /* @ts-ignore */ - const key = `${_parent?.children?.[3]?.children?.[0].value}`.replace(/[\%\, ]/, '__') // should be sanitized enough + const key = `${ + _parent?.children?.[3]?.children?.[0].value + }`.replace(/[\%\, ]/, '__') // should be sanitized enough setLocale(`__dispatch.${key}`) } @@ -479,11 +752,16 @@ export async function generate(project_path: string, generated_path: string, arg ) { const attributes = _child.children?.[0]?.children?.[0]?.children /* @ts-ignore */ - if (attributes && attributes.length === 1 && !attributes[0].children && attributes[0].value === 'id') { + if ( + attributes && attributes.length === 1 && + !attributes[0].children && attributes[0].value === 'id' + ) { /* @ts-ignore */ setLocale(_child.children?.[0].children?.[1].value) } else { - logger.warn('Could not find good path, using __map_key. hint: ' + self) + logger.warn( + 'Could not find good path, using __map_key. hint: ' + self, + ) setLocale('__map_key') } @@ -525,9 +803,9 @@ export async function generate(project_path: string, generated_path: string, arg const start = lc.fromIndex(range.start) const end = lc.fromIndex(range.end) - return `L${start?.line}${start?.col ? `:C${start?.col}` : '' - } -> L${end?.line}${end?.col ? `:C${end?.col}` : '' - }` + return `L${start?.line}${ + start?.col ? `:C${start?.col}` : '' + } -> L${end?.line}${end?.col ? `:C${end?.col}` : ''}` } if (!known_error) { @@ -538,7 +816,8 @@ export async function generate(project_path: string, generated_path: string, arg /* @ts-ignore */ _child.parent?.parserErrors.forEach(error => { console.warn( - ` ${error.message}\n Location: ${range(error.range) + ` ${error.message}\n Location: ${ + range(error.range) }. Severity ${error.severity}.`, ) }) @@ -550,7 +829,8 @@ export async function generate(project_path: string, generated_path: string, arg /* @ts-ignore */ _child.parent?.binderErrors.forEach(error => { console.warn( - ` ${error.message}\n Location: ${range(error.range) + ` ${error.message}\n Location: ${ + range(error.range) }. Severity ${error.severity}.`, ) }) @@ -580,8 +860,7 @@ export async function generate(project_path: string, generated_path: string, arg symbols.push(symbol) if (!args.dry && args.module) { - const dir = - parse(join(generated_path, 'module', resource)).dir + const dir = parse(join(generated_path, 'module', resource)).dir if (dir !== '') await fs.ensureDir(dir) @@ -604,5 +883,9 @@ export async function generate(project_path: string, generated_path: string, arg } } - return [symbols, locales, errors] as [{ resource: string, children: AstNode[] }[], typeof locales, number] -} \ No newline at end of file + return [symbols, locales, errors] as [ + { resource: string; children: AstNode[] }[], + typeof locales, + number, + ] +} diff --git a/packages/mcdoc-cli/src/index.ts b/packages/mcdoc-cli/src/index.ts index ca48ce996..033a0acdc 100644 --- a/packages/mcdoc-cli/src/index.ts +++ b/packages/mcdoc-cli/src/index.ts @@ -26,15 +26,15 @@ const cache_root = join(dirname(fileURLToPath(import.meta.url)), 'cache') const CLI = yargs(hideBin(process.argv)) export type Logger = { - log: (...log_args: any[]) => void, + log: (...log_args: any[]) => void - warn: (...log_args: any[]) => void, + warn: (...log_args: any[]) => void - error: (...log_args: any[]) => void, + error: (...log_args: any[]) => void - info: (...log_args: any[]) => void, + info: (...log_args: any[]) => void - trace: (message?: any, ...params: any) => void, + trace: (message?: any, ...params: any) => void } await CLI.scriptName('mcdoc') @@ -86,9 +86,10 @@ await CLI.scriptName('mcdoc') if (args.module) include.push('modules') console.info( - `Generating JSON files${args.locale || args.module - ? `, including ${include.join(', ')}` - : '' + `Generating JSON files${ + args.locale || args.module + ? `, including ${include.join(', ')}` + : '' }`, ) @@ -144,7 +145,7 @@ await CLI.scriptName('mcdoc') } } - const symbols: { resource: string, children: AstNode[] }[] = [] + const symbols: { resource: string; children: AstNode[] }[] = [] let locales: Record = {} @@ -152,7 +153,14 @@ await CLI.scriptName('mcdoc') for await (const doc_file of walk(project_path)) { if (doc_file.path.endsWith('.mcdoc')) { - const response = await generate(project_path, generated_path, args, doc_file, service, logger) + const response = await generate( + project_path, + generated_path, + args, + doc_file, + service, + logger, + ) symbols.push(...response[0]) locales = { ...locales, ...response[1] } @@ -183,16 +191,25 @@ await CLI.scriptName('mcdoc') if (args.locale) { const locale_path = join('out', 'locale', 'en-us.json') if (await fs.exists(locale_path)) { - const old_locales = JSON.parse(await fs.readFile(locale_path, 'utf-8')) + const old_locales = JSON.parse( + await fs.readFile(locale_path, 'utf-8'), + ) await fs.ensureDir(join('out', 'meta')) - await fs.writeFile(join('out', 'meta', 'locale.json'), JSON.stringify({ - old_keys: Object.keys(old_locales), - old_values: Object.values(old_locales), - new_keys: Object.keys(locales), - new_values: Object.values(locales), - }, undefined, 3)) + await fs.writeFile( + join('out', 'meta', 'locale.json'), + JSON.stringify( + { + old_keys: Object.keys(old_locales), + old_values: Object.values(old_locales), + new_keys: Object.keys(locales), + new_values: Object.values(locales), + }, + undefined, + 3, + ), + ) } await fs.writeFile( join('out', 'locale', 'en-us.json'), diff --git a/packages/mcdoc-cli/src/update_locales/index.ts b/packages/mcdoc-cli/src/update_locales/index.ts index c230faae4..6beae465d 100644 --- a/packages/mcdoc-cli/src/update_locales/index.ts +++ b/packages/mcdoc-cli/src/update_locales/index.ts @@ -6,16 +6,18 @@ import walk from 'klaw' import { ofetch } from 'ofetch' type MetaLocale = { - old_keys: string[], - old_values: string[], - new_keys: string[], - new_values: string[], + old_keys: string[] + old_values: string[] + new_keys: string[] + new_values: string[] } export async function update_locales() { console.log('Reading locale diff') - const locales: MetaLocale = JSON.parse(await fs.readFile(join('out', 'meta', 'locale.json'), 'utf-8')) + const locales: MetaLocale = JSON.parse( + await fs.readFile(join('out', 'meta', 'locale.json'), 'utf-8'), + ) const removed_keys: [string, string][] = [] const added_keys: [string, string][] = [] @@ -39,7 +41,10 @@ export async function update_locales() { if (keyRemoved && valueRemoved) { removed_keys.push([locales.old_keys[i], locales.old_values[i]]) } else if (keyRemoved && !valueRemoved) { - if (locales.new_values.filter(value => value === locales.old_values[i]).length > 1) { + if ( + locales.new_values.filter(value => value === locales.old_values[i]) + .length > 1 + ) { removed_keys.push([locales.old_keys[i], locales.old_values[i]]) console.log('Duplicate key removed:', locales.old_keys[i]) } else { @@ -49,12 +54,18 @@ export async function update_locales() { } } else { // value changed - changed_values.push([locales.old_keys[i], [locales.old_values[i], locales.new_values[keyIndex]]]) + changed_values.push([locales.old_keys[i], [ + locales.old_values[i], + locales.new_values[keyIndex], + ]]) changed_values_count++ } } for (let i = 0; i < locales.new_keys.length; i++) { - if (!moved_keys[locales.new_keys[i]] && !locales.old_keys.includes(locales.new_keys[i])) { + if ( + !moved_keys[locales.new_keys[i]] && + !locales.old_keys.includes(locales.new_keys[i]) + ) { added_keys.push([locales.new_keys[i], locales.new_values[i]]) } } @@ -66,7 +77,9 @@ export async function update_locales() { console.log('Moving keys') for await (const locale_file of walk(join('out', 'locale'))) { if (!locale_file.path.endsWith('en-us.json')) { - const locale = JSON.parse(await fs.readFile(locale_file.path, 'utf-8')) + const locale = JSON.parse( + await fs.readFile(locale_file.path, 'utf-8'), + ) let have_moved = 0 @@ -79,7 +92,10 @@ export async function update_locales() { } } - await fs.writeFile(locale_file.path, JSON.stringify(locale, undefined, 3)) + await fs.writeFile( + locale_file.path, + JSON.stringify(locale, undefined, 3), + ) if (have_moved > 0) { console.log(`Moved ${have_moved} keys in ${locale_file.path}`) @@ -98,7 +114,8 @@ export async function update_locales() { const isPeriod = to.slice(-1) if (isPeriod !== '.' && from.slice(0, -1) !== to) { - description += `- \`${key}\` changed, before/after:\n - \`${from}\`\n - \`${to}\`\n` + description += + `- \`${key}\` changed, before/after:\n - \`${from}\`\n - \`${to}\`\n` } } @@ -116,4 +133,4 @@ export async function update_locales() { }, }) } -} \ No newline at end of file +} From d71c65b6bc3f9756fc13d26a9b07afd1563e9927 Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 23:27:15 -0600 Subject: [PATCH 09/27] =?UTF-8?q?=F0=9F=90=9B=20Move=20ts-ignore=20comment?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc-cli/src/generate/index.ts | 96 ++++++++++++------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/packages/mcdoc-cli/src/generate/index.ts b/packages/mcdoc-cli/src/generate/index.ts index 8fc12cfc6..8b97a5d52 100644 --- a/packages/mcdoc-cli/src/generate/index.ts +++ b/packages/mcdoc-cli/src/generate/index.ts @@ -146,14 +146,14 @@ export async function generate( switch (fourBack?.type) { case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value const sixBack = fourBack.parent?.parent - /* @ts-ignore */ const foundRoot = sixBack?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value if (key) { @@ -162,17 +162,17 @@ export async function generate( } else { // This is another nested anonymous struct // TODO: Yeah this should be recursive and smarter but I'm lazy - /* @ts-ignore */ const parentKey = sixBack?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const actualRoot = sixBack?.parent ?.parent?.parent?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value container = @@ -181,15 +181,15 @@ export async function generate( } else { // This is another nested anonymous struct // TODO: Yeah this should be recursive and smarter but I'm lazy - /* @ts-ignore */ const parentKey = sixBack?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const actualRoot = sixBack?.parent?.parent ?.parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -202,11 +202,11 @@ export async function generate( switch (fourBack?.parent?.type) { case 'mcdoc:struct/field/spread': { - /* @ts-ignore */ const root = fourBack?.parent?.parent ?.parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value // java/server/world/entity/mob/breedable/llama.[0][2][4][2][9][0][0][1][0][0][0] @@ -225,18 +225,18 @@ export async function generate( break case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const parentKey = fourBack?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = fourBack?.parent?.parent ?.parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -247,18 +247,18 @@ export async function generate( break case 'mcdoc:dispatch_statement': { - /* @ts-ignore */ const registry = fourBack.parent .children?.find(child => child.type === 'resource_location' + /* @ts-ignore */ )?.path?.join('_') - /* @ts-ignore */ const key = fourBack.parent.children ?.find(child => child.type === 'mcdoc:index_body' + /* @ts-ignore */ )?.children?.[0]?.value const indexGuess = @@ -277,11 +277,11 @@ export async function generate( break case 'mcdoc:type_alias': { - /* @ts-ignore */ container = fourBack?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value } break @@ -298,19 +298,19 @@ export async function generate( switch (fiveBack?.type) { case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const key = fiveBack.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value const sevenBack = fiveBack.parent ?.parent - /* @ts-ignore */ const foundRoot = sevenBack?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value if (foundRoot) { @@ -321,7 +321,6 @@ export async function generate( switch (sevenBack?.parent?.type) { case 'mcdoc:type/list': { - /* @ts-ignore */ const nineBack = sevenBack .parent?.parent /* @ts-ignore */ @@ -330,9 +329,9 @@ export async function generate( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value // Credits husk - /* @ts-ignore */ const actualRoot = nineBack?.parent ?.parent?.parent @@ -340,6 +339,7 @@ export async function generate( ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value if (actualRoot) { container = @@ -352,12 +352,12 @@ export async function generate( } break case 'mcdoc:type/union': { - /* @ts-ignore */ const actualRoot = sevenBack .parent?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value // block state definition, this is fragile @@ -377,11 +377,11 @@ export async function generate( break case 'mcdoc:type_alias': { - /* @ts-ignore */ const root = fiveBack?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value container = `${root}.__struct_list` @@ -392,9 +392,9 @@ export async function generate( break case 'mcdoc:type_alias': { - /* @ts-ignore */ const root = fourBack?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value if (root) { @@ -420,14 +420,14 @@ export async function generate( switch (fourBack?.type) { case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const key = fourBack.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value const sixBack = fourBack.parent?.parent - /* @ts-ignore */ const parentKey = sixBack?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value if (key) { @@ -435,16 +435,16 @@ export async function generate( container = `${parentKey}.${key}` } else { // memories - /* @ts-ignore */ const actualParentKey = sixBack?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = sixBack?.parent?.parent ?.parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -454,16 +454,16 @@ export async function generate( // advancement criteria trigger const sevenBack = fourBack?.parent?.parent ?.parent - /* @ts-ignore */ const parentKey = sevenBack?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = sevenBack?.parent?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -477,11 +477,11 @@ export async function generate( switch (fourBack?.parent?.type) { case 'mcdoc:type_alias': { - /* @ts-ignore */ const root = fourBack?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = `${root}.__union.__struct_${ @@ -491,19 +491,19 @@ export async function generate( break case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const parentKey = fourBack?.parent .children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = fourBack?.parent ?.parent?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = `${root}.${parentKey}` @@ -533,19 +533,19 @@ export async function generate( // book lines const sevenBack = fourBack?.parent ?.parent?.parent - /* @ts-ignore */ const parentKey = sevenBack ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = sevenBack?.parent ?.parent?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value container = @@ -555,28 +555,28 @@ export async function generate( case 'mcdoc:type/list': { // texture meta - /* @ts-ignore */ const parentKey = fourBack?.parent .parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const rootKey = fourBack?.parent ?.parent?.parent?.parent?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = fourBack?.parent ?.parent?.parent?.parent?.parent ?.parent?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -594,39 +594,39 @@ export async function generate( switch (threeBack?.type) { case 'mcdoc:enum': { - /* @ts-ignore */ const root = threeBack?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value if (root) { container = root } else { // inline enum - /* @ts-ignore */ const parentKey = threeBack?.parent?.children ?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = threeBack?.parent?.parent?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value if (root) { container = `${root}.${parentKey}` } else { - /* @ts-ignore */ const rootKey = threeBack?.parent?.parent ?.parent?.parent?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = threeBack?.parent?.parent ?.parent?.parent?.parent?.parent ?.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value container = @@ -640,40 +640,40 @@ export async function generate( switch (_parent?.type) { case 'mcdoc:struct': { - /* @ts-ignore */ container = _parent?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value } break case 'mcdoc:dispatch_statement': { if (_parent?.children) { - /* @ts-ignore */ container = _parent?.children?.find( child => child.type === 'resource_location', + /* @ts-ignore */ )?.path?.join('_') } } break case 'mcdoc:enum': { - /* @ts-ignore */ container = _parent?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value } break case 'mcdoc:type_alias': { - /* @ts-ignore */ container = _parent?.children?.find( child => child.type === 'mcdoc:identifier', + /* @ts-ignore */ )?.value } break @@ -681,13 +681,13 @@ export async function generate( } break case 'mcdoc:struct/field/pair': { - /* @ts-ignore */ const key = threeBack.children?.find(child => child.type === 'mcdoc:identifier' + /* @ts-ignore */ )?.value - /* @ts-ignore */ const root = threeBack.parent?.parent?.children ?.find(child => child.type === 'mcdoc:identifier') + /* @ts-ignore */ ?.value container = `${root}.${key}` @@ -730,10 +730,10 @@ export async function generate( ) // THIS IS REALLY REALLY BAD } } else { - /* @ts-ignore */ const key = `${ - _parent?.children?.[3]?.children?.[0].value - }`.replace(/[\%\, ]/, '__') // should be sanitized enough + /* @ts-ignore */ + _parent?.children?.[3]?.children?.[0].value}` + .replace(/[\%\, ]/, '__') // should be sanitized enough setLocale(`__dispatch.${key}`) } @@ -751,9 +751,9 @@ export async function generate( internal_locales[parent] ) { const attributes = _child.children?.[0]?.children?.[0]?.children - /* @ts-ignore */ if ( attributes && attributes.length === 1 && + /* @ts-ignore */ !attributes[0].children && attributes[0].value === 'id' ) { /* @ts-ignore */ From d5d09d6887b7263e4fe5eef04a9ed8df1afe6a07 Mon Sep 17 00:00:00 2001 From: SpyglassCrafter Date: Mon, 20 May 2024 05:29:01 +0000 Subject: [PATCH 10/27] =?UTF-8?q?=20=F0=9F=94=96=20v2024.5.20+d71c65=20[ci?= =?UTF-8?q?=20skip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit core: 0.4.5 (unchanged) discord-bot: 0.3.7 -> 0.3.8 (patch) java-edition: 0.3.7 -> 0.3.8 (patch) json: 0.3.6 -> 0.3.7 (minor) language-server: 0.4.6 -> 0.4.7 (patch) locales: 0.3.5 (unchanged) mcdoc: 0.3.7 -> 0.3.8 (patch) mcdoc-cli: 0.1.6 -> 0.1.7 (patch) mcfunction: 0.2.7 (unchanged) nbt: 0.3.7 -> 0.3.8 (patch) playground: 0.2.7 -> 0.2.8 (patch) vscode-extension: 0.3.7 -> 0.3.8 (patch) --- .packages.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.packages.json b/.packages.json index a101de1ac..a99483995 100644 --- a/.packages.json +++ b/.packages.json @@ -17,7 +17,7 @@ ], "released": { "commit": "b6ecdcad78be7a44ef564afdfc9c51daedf38de8", - "version": "0.3.7" + "version": "0.3.8" } }, "java-edition": { @@ -31,7 +31,7 @@ ], "released": { "commit": "25de684da837dd553684e912490f92cf8c9c4e1f", - "version": "0.3.7" + "version": "0.3.8" } }, "json": { @@ -40,8 +40,8 @@ "locales" ], "released": { - "commit": "ad778e38026c1cadc82aac43329a19b69eb71686", - "version": "0.3.6" + "commit": "d9848358bb3a1e41b40e28e61b9c5771946e724b", + "version": "0.3.7" } }, "language-server": { @@ -53,7 +53,7 @@ ], "released": { "commit": "449e7c655e263425192fe41948904017543ad0cb", - "version": "0.4.6" + "version": "0.4.7" } }, "locales": { @@ -68,8 +68,8 @@ "locales" ], "released": { - "commit": "ed079e11b7a11d84a0e531f1979e9ddddcfde7e0", - "version": "0.3.7" + "commit": "42dbc014068b184829a7e091bf7313c11b457ddd", + "version": "0.3.8" } }, "mcdoc-cli": { @@ -78,8 +78,8 @@ "mcdoc" ], "released": { - "commit": "1ce6eb071532e374bea5a08cae44dec1e412c1aa", - "version": "0.1.6" + "commit": "d71c65b6bc3f9756fc13d26a9b07afd1563e9927", + "version": "0.1.7" } }, "mcfunction": { @@ -100,7 +100,7 @@ ], "released": { "commit": "b626aff40da287707d03c8d451989fb91ac5f9c3", - "version": "0.3.7" + "version": "0.3.8" } }, "playground": { @@ -111,8 +111,8 @@ "mcdoc" ], "released": { - "commit": "f0d861382044f94ea005b1cfd11fc7e2d57d5663", - "version": "0.2.7" + "commit": "5c9576525a7a8bee2ce900295e2e52fec9316a41", + "version": "0.2.8" } }, "vscode-extension": { @@ -120,8 +120,8 @@ "language-server" ], "released": { - "commit": "449e7c655e263425192fe41948904017543ad0cb", - "version": "0.3.7" + "commit": "5c9576525a7a8bee2ce900295e2e52fec9316a41", + "version": "0.3.8" } } } From 834d1686f943372aa8f30b0adc21619a8f4da18e Mon Sep 17 00:00:00 2001 From: MulverineX Date: Sun, 19 May 2024 23:35:47 -0600 Subject: [PATCH 11/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20npmignore=20in=20`mc?= =?UTF-8?q?doc-cli`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mcdoc-cli/.npmignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/mcdoc-cli/.npmignore b/packages/mcdoc-cli/.npmignore index 7989d9135..bb0d373eb 100644 --- a/packages/mcdoc-cli/.npmignore +++ b/packages/mcdoc-cli/.npmignore @@ -1,7 +1,7 @@ * */** -!lib/**/*.mjs -!lib/**/*.d.mts +!lib/**/*.js +!lib/**/*.d.ts !package.json !README.md From 7ecab07abcfe13af837703f59c4ac5043363befa Mon Sep 17 00:00:00 2001 From: SpyglassCrafter Date: Mon, 20 May 2024 05:36:40 +0000 Subject: [PATCH 12/27] =?UTF-8?q?=20=F0=9F=94=96=20v2024.5.20+834d16=20[ci?= =?UTF-8?q?=20skip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit core: 0.4.5 (unchanged) discord-bot: 0.3.8 (unchanged) java-edition: 0.3.8 (unchanged) json: 0.3.7 (unchanged) language-server: 0.4.7 (unchanged) locales: 0.3.5 (unchanged) mcdoc: 0.3.8 (unchanged) mcdoc-cli: 0.1.7 -> 0.1.8 (patch) mcfunction: 0.2.7 (unchanged) nbt: 0.3.8 (unchanged) playground: 0.2.8 (unchanged) vscode-extension: 0.3.8 (unchanged) --- .packages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.packages.json b/.packages.json index a99483995..7b8110fa4 100644 --- a/.packages.json +++ b/.packages.json @@ -78,8 +78,8 @@ "mcdoc" ], "released": { - "commit": "d71c65b6bc3f9756fc13d26a9b07afd1563e9927", - "version": "0.1.7" + "commit": "834d1686f943372aa8f30b0adc21619a8f4da18e", + "version": "0.1.8" } }, "mcfunction": { From a1f81c34a8e19907d0fee9dd4a3f7c4d68d63dd7 Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Mon, 20 May 2024 22:15:26 +0200 Subject: [PATCH 13/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20message=20reporting?= =?UTF-8?q?=20breaking=20on=20empty=20string=20(#1155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __snapshots__/packages/core/test-out/parser/long.spec.js | 8 ++++---- packages/core/src/service/ErrorReporter.ts | 3 +++ packages/locales/src/index.ts | 2 +- packages/locales/src/locales/en.json | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/__snapshots__/packages/core/test-out/parser/long.spec.js b/__snapshots__/packages/core/test-out/parser/long.spec.js index e0a091e86..2230865ac 100644 --- a/__snapshots__/packages/core/test-out/parser/long.spec.js +++ b/__snapshots__/packages/core/test-out/parser/long.spec.js @@ -34,7 +34,7 @@ exports['long() long() long() Parse "+" 1'] = { "start": 0, "end": 1 }, - "message": "", + "message": "Illegal long numeral that doesn't follow /^[+-]?(?:0|[1-9][0-9]*)$/", "severity": 3 } ] @@ -91,7 +91,7 @@ exports['long() long() long() Parse "0123" 1'] = { "start": 0, "end": 4 }, - "message": "", + "message": "Illegal long numeral that doesn't follow /^[+-]?(?:0|[1-9][0-9]*)$/", "severity": 3 } ] @@ -204,7 +204,7 @@ exports['long() long(min, max, onOutOfRange) long(1, undefined, false) Parse "0" "start": 0, "end": 1 }, - "message": "Expected ", + "message": "Expected a long between 1 and +∞", "severity": 3 } ] @@ -273,7 +273,7 @@ exports['long() long(min, max, onOutOfRange) long(undefined, 6, false) Parse "9" "start": 0, "end": 1 }, - "message": "Expected ", + "message": "Expected a long between -∞ and 6", "severity": 3 } ] diff --git a/packages/core/src/service/ErrorReporter.ts b/packages/core/src/service/ErrorReporter.ts index 6841ed323..206ec8460 100644 --- a/packages/core/src/service/ErrorReporter.ts +++ b/packages/core/src/service/ErrorReporter.ts @@ -16,6 +16,9 @@ export class ErrorReporter { severity = ErrorSeverity.Error, info?: LanguageErrorInfo, ): void { + if (message.trim() === '') { + throw new Error('Tried to report an error with no message') + } this.errors.push( LanguageError.create(message, Range.get(range), severity, info), ) diff --git a/packages/locales/src/index.ts b/packages/locales/src/index.ts index 997c1ac2b..75e4311f6 100644 --- a/packages/locales/src/index.ts +++ b/packages/locales/src/index.ts @@ -29,7 +29,7 @@ type Parameter = export function localize(key: string, ...params: Parameter[]): string { const value: string | undefined = Locales[language][key] ?? Locales.en[key] - return _resolveLocalePlaceholders(value, params) ?? '' + return _resolveLocalePlaceholders(value, params) ?? key } export function localeQuote(content: string) { diff --git a/packages/locales/src/locales/en.json b/packages/locales/src/locales/en.json index 8742873c5..bed4277cf 100644 --- a/packages/locales/src/locales/en.json +++ b/packages/locales/src/locales/en.json @@ -65,6 +65,7 @@ "linter-config-validator.name-convention.type": "Expects a string that contains a regular expression describing the name", "linter-config-validator.wrapper": "%0%. See [the documentation](%1) for more information", "long": "a long", + "long.between": "a long between %0% and %1%", "mcfunction.checker.command.data-modify-unapplicable-operation": "Operation %0% can only be used on %1%; the target path has type %2% instead", "mcfunction.completer.block.states.default-value": "Default: %0%", "mcfunction.parser.entity-selector.arguments.not-applicable": "%0% is not applicable here", @@ -153,6 +154,7 @@ "parser.integer.illegal": "Illegal integer that doesn't follow %0%", "parser.list.value": "a value", "parser.list.trailing-sep": "Trailing separation", + "parser.long.illegal": "Illegal long numeral that doesn't follow %0%", "parser.record.key": "a key", "parser.record.trailing-end": "Trailing separation", "parser.record.unexpected-char": "Unexpected character %0%", From d6c395f54e322065e5bb318bf16ea54a7d98e7c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 02:58:56 -0500 Subject: [PATCH 14/27] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20rexml=20from?= =?UTF-8?q?=203.2.5=20to=203.2.8=20in=20/docs=20(#1153)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index b0310c880..87b67cf66 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -63,11 +63,13 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - rexml (3.2.5) + rexml (3.2.8) + strscan (>= 3.0.9) rouge (3.30.0) safe_yaml (1.0.5) sassc (2.4.0) ffi (~> 1.9) + strscan (3.1.0) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (1.8.0) From 2b74e1ff633f56db439c6084d1bb72c16f536a88 Mon Sep 17 00:00:00 2001 From: Nico314159 Date: Wed, 22 May 2024 13:04:25 -0700 Subject: [PATCH 15/27] Implement 1.20.5+ item slots (#1179) --- packages/core/test/utils.ts | 2 +- .../src/mcfunction/common/index.ts | 50 ++++++++++++------- .../src/mcfunction/completer/argument.ts | 10 ++-- .../src/mcfunction/parser/argument.ts | 6 ++- packages/mcfunction/src/completer/index.ts | 4 +- 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/packages/core/test/utils.ts b/packages/core/test/utils.ts index d3149cf62..65abc82f5 100644 --- a/packages/core/test/utils.ts +++ b/packages/core/test/utils.ts @@ -58,7 +58,7 @@ export function mockProjectData(data: Partial = {}): ProjectData { return { cacheRoot, config: data.config ?? VanillaConfig, - ctx: data.ctx ?? {}, + ctx: data.ctx ?? { loadedVersion: '1.15' }, downloader, ensureBindingStarted: data.ensureBindingStarted!, externals, diff --git a/packages/java-edition/src/mcfunction/common/index.ts b/packages/java-edition/src/mcfunction/common/index.ts index a63852daf..ab0df9f87 100644 --- a/packages/java-edition/src/mcfunction/common/index.ts +++ b/packages/java-edition/src/mcfunction/common/index.ts @@ -1,4 +1,5 @@ import * as core from '@spyglassmc/core' +import { ReleaseVersion } from '../../dependency/index.js' export const ColorArgumentValues = [...core.Color.ColorNames, 'reset'] @@ -11,24 +12,37 @@ export const GamemodeArgumentValues = [ 'spectator', ] -export const ItemSlotArgumentValues = [ - ...[...Array(54).keys()].map((n) => `container.${n}`), - ...[...Array(27).keys()].map((n) => `enderchest.${n}`), - ...[...Array(15).keys()].map((n) => `horse.${n}`), - ...[...Array(9).keys()].map((n) => `hotbar.${n}`), - ...[...Array(27).keys()].map((n) => `inventory.${n}`), - ...[...Array(8).keys()].map((n) => `villager.${n}`), - 'armor.chest', - 'armor.feet', - 'armor.head', - 'armor.legs', - 'horse.armor', - 'horse.chest', - 'horse.saddle', - 'weapon', - 'weapon.mainhand', - 'weapon.offhand', -] +export function getItemSlotArgumentValues(ctx: core.ContextBase) { + const release = ctx.project['loadedVersion'] as ReleaseVersion + const output = [ + ...[...Array(54).keys()].map((n) => `container.${n}`), + ...[...Array(27).keys()].map((n) => `enderchest.${n}`), + ...[...Array(15).keys()].map((n) => `horse.${n}`), + ...[...Array(9).keys()].map((n) => `hotbar.${n}`), + ...[...Array(27).keys()].map((n) => `inventory.${n}`), + ...[...Array(8).keys()].map((n) => `villager.${n}`), + 'armor.chest', + 'armor.feet', + 'armor.head', + 'armor.legs', + 'horse.chest', + 'horse.saddle', + 'weapon', + 'weapon.mainhand', + 'weapon.offhand', + ] + if (ReleaseVersion.cmp(release, '1.20.5') >= 0) { + output.push( + ...[...Array(4).keys()].map((n) => `player.crafting.${n}`), + 'armor.body', + 'contents', + 'player.cursor', + ) + } else { + output.push('horse.armor') + } + return output +} export const OperationArgumentValues = [ '=', diff --git a/packages/java-edition/src/mcfunction/completer/argument.ts b/packages/java-edition/src/mcfunction/completer/argument.ts index af92cc3b7..2e06ec5eb 100644 --- a/packages/java-edition/src/mcfunction/completer/argument.ts +++ b/packages/java-edition/src/mcfunction/completer/argument.ts @@ -1,6 +1,7 @@ import type { Arrayable, Completer, + CompleterContext, MetaRegistry, RegistryCategory, WorldgenFileCategory, @@ -31,8 +32,8 @@ import { ColorArgumentValues, EntityAnchorArgumentValues, GamemodeArgumentValues, + getItemSlotArgumentValues, HeightmapValues, - ItemSlotArgumentValues, MirrorValues, OperationArgumentValues, RotationValues, @@ -58,8 +59,9 @@ import type { ArgumentTreeNode } from '../tree/index.js' export const getMockNodes: mcf.completer.MockNodesGetter = ( rawTreeNode, - range, + ctx: CompleterContext, ): Arrayable => { + const range = ctx.offset const treeNode = rawTreeNode as ArgumentTreeNode switch (treeNode.parser) { @@ -118,7 +120,9 @@ export const getMockNodes: mcf.completer.MockNodesGetter = ( case 'minecraft:item_predicate': return ItemNode.mock(range, true) case 'minecraft:item_slot': - return LiteralNode.mock(range, { pool: ItemSlotArgumentValues }) + return LiteralNode.mock(range, { + pool: getItemSlotArgumentValues(ctx), + }) case 'minecraft:item_stack': return ItemNode.mock(range, false) case 'minecraft:mob_effect': diff --git a/packages/java-edition/src/mcfunction/parser/argument.ts b/packages/java-edition/src/mcfunction/parser/argument.ts index 981f9ddf8..411569405 100644 --- a/packages/java-edition/src/mcfunction/parser/argument.ts +++ b/packages/java-edition/src/mcfunction/parser/argument.ts @@ -9,8 +9,8 @@ import { ColorArgumentValues, EntityAnchorArgumentValues, GamemodeArgumentValues, + getItemSlotArgumentValues, HeightmapValues, - ItemSlotArgumentValues, MirrorValues, OperationArgumentValues, RotationValues, @@ -189,7 +189,9 @@ export const argument: mcf.ArgumentParserGetter = ( case 'minecraft:item_predicate': return wrap(itemPredicate) case 'minecraft:item_slot': - return wrap(core.literal(...ItemSlotArgumentValues)) + return wrap((src, ctx) => { + return core.literal(...getItemSlotArgumentValues(ctx))(src, ctx) + }) case 'minecraft:item_stack': return wrap(itemStack) case 'minecraft:message': diff --git a/packages/mcfunction/src/completer/index.ts b/packages/mcfunction/src/completer/index.ts index c5dc0dd8c..96280603d 100644 --- a/packages/mcfunction/src/completer/index.ts +++ b/packages/mcfunction/src/completer/index.ts @@ -13,7 +13,7 @@ import { export type MockNodesGetter = ( treeNode: ArgumentTreeNode, - range: core.RangeLike, + range: core.CompleterContext, ) => core.Arrayable /** @@ -79,7 +79,7 @@ export function command( }) ), ...argumentTreeNodes.flatMap(([_name, treeNode]) => - core.Arrayable.toArray(getMockNodes(treeNode, ctx.offset)).flatMap( + core.Arrayable.toArray(getMockNodes(treeNode, ctx)).flatMap( (n) => core.completer.dispatch(n, ctx), ) ), From 9a303cc7fe1430b7c7629e65e27bbb19ac58971a Mon Sep 17 00:00:00 2001 From: Afro Date: Wed, 22 May 2024 22:21:45 -0400 Subject: [PATCH 16/27] =?UTF-8?q?=F0=9F=94=A7=20Add=20long=20timeout=20arg?= =?UTF-8?q?=20to=20unit=20test=20launch=20configuration=20(#1189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index cb4b95ef3..20a4cc65b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -26,6 +26,7 @@ "request": "launch", "name": "Run Unit Tests", "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": ["--timeout", "999999"], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } From d99eeb6d03d4d0c4676ef6d075127fbbe905af67 Mon Sep 17 00:00:00 2001 From: SPGoding Date: Wed, 22 May 2024 21:22:37 -0500 Subject: [PATCH 17/27] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20dprint=20(?= =?UTF-8?q?#1191)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dprint.jsonc | 4 +- package-lock.json | 180 +++++++++- package.json | 2 +- .../java-edition/src/mcfunction/tree/patch.ts | 307 +++++++++--------- packages/mcfunction/src/completer/index.ts | 4 +- 5 files changed, 328 insertions(+), 169 deletions(-) diff --git a/.dprint.jsonc b/.dprint.jsonc index 9c8784576..230b2f689 100644 --- a/.dprint.jsonc +++ b/.dprint.jsonc @@ -13,10 +13,8 @@ ], "excludes": [ "**/node_modules", - // cannot format due to bug of dprint - "packages/java-edition/src/mcfunction/tree/patch.ts" ], "plugins": [ - "https://plugins.dprint.dev/typescript-0.85.0.wasm" + "https://plugins.dprint.dev/typescript-0.90.5.wasm" ] } diff --git a/package-lock.json b/package-lock.json index 392fa7a5f..0557fe583 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "all-contributors-cli": "^6.25.0", "benchmark": "^2.1.4", "circular-dependency-plugin": "^5.2.2", - "dprint": "^0.37.1", + "dprint": "^0.45.1", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", "gitmoji-cli": "^8.1.1", @@ -543,6 +543,97 @@ "node": ">=10.0.0" } }, + "node_modules/@dprint/darwin-arm64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.45.1.tgz", + "integrity": "sha512-pH0/uKLJ5SJPoHhOwLWFMhCmL0BY3FzWQbull8OGMK/FRkIPgOl2adZSovtUZpUMGWyDOzIWH1fW9X2DuMhnEg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/darwin-x64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.45.1.tgz", + "integrity": "sha512-YUj421LmBLDlxpIER3pORKfQmpmXD50n5mClHjpZrnl17WTiHtQ+jHvDJdJoxH2eS66W0mQyxLoGo5SfFfiM7A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/linux-arm64-glibc": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.45.1.tgz", + "integrity": "sha512-lJ7s/pOQWRJ0mstjZQnVyX2/3QRXZ9cpFHJDZ7e81Y8QSn/iqxTrnK0DPgxUrDG8hYKQmWQdQLU4sP5DKBz0Jg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-arm64-musl": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.45.1.tgz", + "integrity": "sha512-un2awe1L1sAJLsCPSEUrE0/cgupdzbYFoyBOutyU1zHR9KQn47AtIDw+chvuinU4xleHDuEGyXGuJ6NE+Ky6vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-glibc": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.45.1.tgz", + "integrity": "sha512-5Civht90S/g8zlyYB7n4oH78p+sLbNqeFCFuImJRK7uRxZwCRya7lji6RwlB6DQ7qngVqovTHj9RLOYfZzfVlg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-musl": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.45.1.tgz", + "integrity": "sha512-p2/gjnHDd8GRCvtey5HZO4o/He6pSmY/zpcCuIXprFW9P0vNlEj3DFhz4FPpOKXM+csrsVWWs2E0T/xr5QZtVg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/win32-x64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.45.1.tgz", + "integrity": "sha512-2l78XM7KsW46P2Yv6uPB3fE+y92EsBlrCxi+RVQ0pbznPFdMdkLyGgaCuh683zdld14jHlaADpIQ7YchGAEMAg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@esbuild/android-arm": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", @@ -4100,17 +4191,22 @@ } }, "node_modules/dprint": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.37.1.tgz", - "integrity": "sha512-MVKIVOvk5FSiZQFFZlLv1KiB4zZXAirlZ/m8vtyKu2PTFnkD5d6jVv4aNHvd7M6f1ToganNZ/CqhSwpgadn8Ug==", + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.45.1.tgz", + "integrity": "sha512-OYefcDgxd6jSdig/Cfkw1vdvyiOIRruCPnqGBbXpc95buDt9kvwL+Lic1OHc+SaQSsQub0BUZMd5+TNgy8Sh3A==", "dev": true, "hasInstallScript": true, - "dependencies": { - "https-proxy-agent": "=5.0.1", - "yauzl": "=2.10.0" - }, "bin": { "dprint": "bin.js" + }, + "optionalDependencies": { + "@dprint/darwin-arm64": "0.45.1", + "@dprint/darwin-x64": "0.45.1", + "@dprint/linux-arm64-glibc": "0.45.1", + "@dprint/linux-arm64-musl": "0.45.1", + "@dprint/linux-x64-glibc": "0.45.1", + "@dprint/linux-x64-musl": "0.45.1", + "@dprint/win32-x64": "0.45.1" } }, "node_modules/duplexer2": { @@ -11542,6 +11638,55 @@ "integrity": "sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg==", "dev": true }, + "@dprint/darwin-arm64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.45.1.tgz", + "integrity": "sha512-pH0/uKLJ5SJPoHhOwLWFMhCmL0BY3FzWQbull8OGMK/FRkIPgOl2adZSovtUZpUMGWyDOzIWH1fW9X2DuMhnEg==", + "dev": true, + "optional": true + }, + "@dprint/darwin-x64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.45.1.tgz", + "integrity": "sha512-YUj421LmBLDlxpIER3pORKfQmpmXD50n5mClHjpZrnl17WTiHtQ+jHvDJdJoxH2eS66W0mQyxLoGo5SfFfiM7A==", + "dev": true, + "optional": true + }, + "@dprint/linux-arm64-glibc": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.45.1.tgz", + "integrity": "sha512-lJ7s/pOQWRJ0mstjZQnVyX2/3QRXZ9cpFHJDZ7e81Y8QSn/iqxTrnK0DPgxUrDG8hYKQmWQdQLU4sP5DKBz0Jg==", + "dev": true, + "optional": true + }, + "@dprint/linux-arm64-musl": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.45.1.tgz", + "integrity": "sha512-un2awe1L1sAJLsCPSEUrE0/cgupdzbYFoyBOutyU1zHR9KQn47AtIDw+chvuinU4xleHDuEGyXGuJ6NE+Ky6vw==", + "dev": true, + "optional": true + }, + "@dprint/linux-x64-glibc": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.45.1.tgz", + "integrity": "sha512-5Civht90S/g8zlyYB7n4oH78p+sLbNqeFCFuImJRK7uRxZwCRya7lji6RwlB6DQ7qngVqovTHj9RLOYfZzfVlg==", + "dev": true, + "optional": true + }, + "@dprint/linux-x64-musl": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.45.1.tgz", + "integrity": "sha512-p2/gjnHDd8GRCvtey5HZO4o/He6pSmY/zpcCuIXprFW9P0vNlEj3DFhz4FPpOKXM+csrsVWWs2E0T/xr5QZtVg==", + "dev": true, + "optional": true + }, + "@dprint/win32-x64": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.45.1.tgz", + "integrity": "sha512-2l78XM7KsW46P2Yv6uPB3fE+y92EsBlrCxi+RVQ0pbznPFdMdkLyGgaCuh683zdld14jHlaADpIQ7YchGAEMAg==", + "dev": true, + "optional": true + }, "@esbuild/android-arm": { "version": "0.17.18", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.18.tgz", @@ -14238,13 +14383,18 @@ } }, "dprint": { - "version": "0.37.1", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.37.1.tgz", - "integrity": "sha512-MVKIVOvk5FSiZQFFZlLv1KiB4zZXAirlZ/m8vtyKu2PTFnkD5d6jVv4aNHvd7M6f1ToganNZ/CqhSwpgadn8Ug==", - "dev": true, - "requires": { - "https-proxy-agent": "=5.0.1", - "yauzl": "=2.10.0" + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.45.1.tgz", + "integrity": "sha512-OYefcDgxd6jSdig/Cfkw1vdvyiOIRruCPnqGBbXpc95buDt9kvwL+Lic1OHc+SaQSsQub0BUZMd5+TNgy8Sh3A==", + "dev": true, + "requires": { + "@dprint/darwin-arm64": "0.45.1", + "@dprint/darwin-x64": "0.45.1", + "@dprint/linux-arm64-glibc": "0.45.1", + "@dprint/linux-arm64-musl": "0.45.1", + "@dprint/linux-x64-glibc": "0.45.1", + "@dprint/linux-x64-musl": "0.45.1", + "@dprint/win32-x64": "0.45.1" } }, "duplexer2": { diff --git a/package.json b/package.json index def1d473e..2f1b863f2 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "all-contributors-cli": "^6.25.0", "benchmark": "^2.1.4", "circular-dependency-plugin": "^5.2.2", - "dprint": "^0.37.1", + "dprint": "^0.45.1", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", "gitmoji-cli": "^8.1.1", diff --git a/packages/java-edition/src/mcfunction/tree/patch.ts b/packages/java-edition/src/mcfunction/tree/patch.ts index 6379cdd44..30faedf01 100644 --- a/packages/java-edition/src/mcfunction/tree/patch.ts +++ b/packages/java-edition/src/mcfunction/tree/patch.ts @@ -16,44 +16,46 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, ...(ReleaseVersion.cmp(release, '1.16') >= 0 ? { - attribute: { - children: { - target: { - children: { - attribute: { - properties: { - category: 'attribute', - }, - children: { - modifier: { - children: { - add: { - children: { - uuid: { - properties: { - category: 'attribute_modifier_uuid', - usageType: 'definition', - }, + attribute: { + children: { + target: { + children: { + attribute: { + properties: { + category: 'attribute', + }, + children: { + modifier: { + children: { + add: { + children: { + uuid: { + properties: { + category: + 'attribute_modifier_uuid', + usageType: 'definition', }, }, }, - remove: { - children: { - uuid: { - properties: { - category: 'attribute_modifier_uuid', - }, + }, + remove: { + children: { + uuid: { + properties: { + category: + 'attribute_modifier_uuid', }, }, }, - value: { - children: { - get: { - children: { - uuid: { - properties: { - category: 'attribute_modifier_uuid', - }, + }, + value: { + children: { + get: { + children: { + uuid: { + properties: { + category: + 'attribute_modifier_uuid', }, }, }, @@ -67,7 +69,8 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, }, }, - } + }, + } : {}), ban: { permission: 3, @@ -182,46 +185,49 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, ...(ReleaseVersion.cmp(release, '1.17') >= 0 ? { - item: { - children: { - replace: { - children: { - block: { - children: { - pos: { - children: { - slot: { - children: { - from: { - children: { - block: { - children: { - source: { - children: { - sourceSlot: { - children: { - modifier: { - properties: { - category: 'item_modifier', + item: { + children: { + replace: { + children: { + block: { + children: { + pos: { + children: { + slot: { + children: { + from: { + children: { + block: { + children: { + source: { + children: { + sourceSlot: { + children: { + modifier: { + properties: + { + category: + 'item_modifier', }, - }, }, }, }, }, }, }, - entity: { - children: { - source: { - children: { - sourceSlot: { - children: { - modifier: { - properties: { - category: 'item_modifier', + }, + entity: { + children: { + source: { + children: { + sourceSlot: { + children: { + modifier: { + properties: + { + category: + 'item_modifier', }, - }, }, }, }, @@ -236,42 +242,46 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, }, }, - entity: { - children: { - targets: { - children: { - slot: { - children: { - from: { - children: { - block: { - children: { - source: { - children: { - sourceSlot: { - children: { - modifier: { - properties: { - category: 'item_modifier', + }, + entity: { + children: { + targets: { + children: { + slot: { + children: { + from: { + children: { + block: { + children: { + source: { + children: { + sourceSlot: { + children: { + modifier: { + properties: + { + category: + 'item_modifier', }, - }, }, }, }, }, }, }, - entity: { - children: { - source: { - children: { - sourceSlot: { - children: { - modifier: { - properties: { - category: 'item_modifier', + }, + entity: { + children: { + source: { + children: { + sourceSlot: { + children: { + modifier: { + properties: + { + category: + 'item_modifier', }, - }, }, }, }, @@ -288,18 +298,18 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, }, }, - modify: { - children: { - block: { - children: { - pos: { - children: { - slot: { - children: { - modifier: { - properties: { - category: 'item_modifier', - }, + }, + modify: { + children: { + block: { + children: { + pos: { + children: { + slot: { + children: { + modifier: { + properties: { + category: 'item_modifier', }, }, }, @@ -307,16 +317,16 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, }, }, - entity: { - children: { - targets: { - children: { - slot: { - children: { - modifier: { - properties: { - category: 'item_modifier', - }, + }, + entity: { + children: { + targets: { + children: { + slot: { + children: { + modifier: { + properties: { + category: 'item_modifier', }, }, }, @@ -328,17 +338,18 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, }, }, - } + }, + } : {}), help: { permission: 0, }, ...(ReleaseVersion.cmp(release, '1.18') >= 0 ? { - jfr: { - permission: 4, - }, - } + jfr: { + permission: 4, + }, + } : {}), kick: { permission: 3, @@ -348,16 +359,16 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, ...(ReleaseVersion.cmp(release, '1.16') >= 0 ? { - locatebiome: { - children: { - biome: { - properties: { - category: 'worldgen/biome', - }, + locatebiome: { + children: { + biome: { + properties: { + category: 'worldgen/biome', }, }, }, - } + }, + } : {}), loot: { children: { @@ -427,27 +438,27 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, ...(ReleaseVersion.cmp(release, '1.17') >= 0 ? { - perf: { - permission: 4, - }, - } + perf: { + permission: 4, + }, + } : {}), ...(ReleaseVersion.cmp(release, '1.19') >= 0 ? { - place: { - children: { - template: { - children: { - template: { - properties: { - category: 'structure' - } - } - } - } - } + place: { + children: { + template: { + children: { + template: { + properties: { + category: 'structure', + }, + }, + }, + }, }, - } + }, + } : {}), playsound: Sound, publish: { @@ -592,10 +603,10 @@ export function getPatch(release: ReleaseVersion): PartialRootTreeNode { }, ...(ReleaseVersion.cmp(release, '1.20.2') >= 0 ? { - tick: { - permission: 3, - }, - } + tick: { + permission: 3, + }, + } : {}), tm: { permission: 0, diff --git a/packages/mcfunction/src/completer/index.ts b/packages/mcfunction/src/completer/index.ts index 96280603d..84af390b8 100644 --- a/packages/mcfunction/src/completer/index.ts +++ b/packages/mcfunction/src/completer/index.ts @@ -44,8 +44,8 @@ export function command( ): core.Completer { return (node, ctx) => { const index = core.AstNode.findChildIndex(node, ctx.offset, true) - const selectedChildNode: DeepReadonly | undefined = - node.children[index]?.children[0] + const selectedChildNode: DeepReadonly | undefined = node + .children[index]?.children[0] if (selectedChildNode) { return core.completer.dispatch(selectedChildNode, ctx) } From 6439d5f357290eee725cca886eea47e4f99700a1 Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Thu, 23 May 2024 04:24:54 +0200 Subject: [PATCH 18/27] =?UTF-8?q?=F0=9F=9A=A7=20Remove=20attributed=20type?= =?UTF-8?q?=20in=20favor=20of=20attributes=20array=20on=20all=20types=20(#?= =?UTF-8?q?1182)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__fixture__/attributed_types.spec.js | 494 ++++++++++++------ .../random_number_generator.spec.js | 69 ++- .../__fixture__/struct/nested_spread.spec.js | 94 ++-- .../__fixture__/struct/simple.spec.js | 13 +- .../__fixture__/type_alias/attributed.spec.js | 29 +- .../java-edition/src/json/checker/index.ts | 5 - packages/mcdoc/src/binder/index.ts | 26 +- packages/mcdoc/src/type/index.ts | 139 +++-- packages/mcdoc/test/__fixture__.mcdoc | 1 + packages/nbt/src/checker/index.ts | 5 - 10 files changed, 541 insertions(+), 334 deletions(-) diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js index df65ba37b..57a329f6f 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/attributed_types.spec.js @@ -30,13 +30,12 @@ exports['mcdoc __fixture__ attributed types 1'] = { "::test::NoValue": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "deprecated" - }, - "child": { - "kind": "boolean" - } + "kind": "boolean", + "attributes": [ + { + "name": "deprecated" + } + ] } }, "subcategory": "type_alias", @@ -78,20 +77,19 @@ exports['mcdoc __fixture__ attributed types 1'] = { "::test::SimpleValue": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "since", - "value": { - "kind": "literal", + "kind": "boolean", + "attributes": [ + { + "name": "since", "value": { - "kind": "double", - "value": 1.19 + "kind": "literal", + "value": { + "kind": "double", + "value": 1.19 + } } } - }, - "child": { - "kind": "boolean" - } + ] } }, "subcategory": "type_alias", @@ -130,32 +128,32 @@ exports['mcdoc __fixture__ attributed types 1'] = { } ] }, - "::test::TreeValue": { + "::test::Multiple": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "id", - "value": { - "kind": "tree", - "values": { - "registry": { - "kind": "literal", - "value": { - "kind": "string", - "value": "worldgen/biome" - } - }, - "tags": { - "kind": "reference", - "path": "::test::allowed" + "kind": "boolean", + "attributes": [ + { + "name": "since", + "value": { + "kind": "literal", + "value": { + "kind": "double", + "value": 1.17 + } + } + }, + { + "name": "until", + "value": { + "kind": "literal", + "value": { + "kind": "double", + "value": 1.2 } } } - }, - "child": { - "kind": "string" - } + ] } }, "subcategory": "type_alias", @@ -164,7 +162,7 @@ exports['mcdoc __fixture__ attributed types 1'] = { "uri": "file:///test.mcdoc", "range": { "start": 83, - "end": 92 + "end": 91 }, "posRange": { "start": { @@ -173,12 +171,12 @@ exports['mcdoc __fixture__ attributed types 1'] = { }, "end": { "line": 2, - "character": 14 + "character": 13 } }, "fullRange": { "start": 78, - "end": 148 + "end": 130 }, "fullPosRange": { "start": { @@ -194,35 +192,31 @@ exports['mcdoc __fixture__ attributed types 1'] = { } ] }, - "::test::EnumValue": { + "::test::TreeValue": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "bitfield", - "value": { - "kind": "tree", - "values": { - "0": { - "kind": "enum", - "enumKind": "int", - "values": [ - { - "identifier": "HandAll", - "value": 1 - }, - { - "identifier": "BootsAll", - "value": 2 + "kind": "string", + "attributes": [ + { + "name": "id", + "value": { + "kind": "tree", + "values": { + "registry": { + "kind": "literal", + "value": { + "kind": "string", + "value": "worldgen/biome" } - ] + }, + "tags": { + "kind": "reference", + "path": "::test::allowed" + } } } } - }, - "child": { - "kind": "int" - } + ] } }, "subcategory": "type_alias", @@ -230,8 +224,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "uri": "file:///test.mcdoc", "range": { - "start": 153, - "end": 162 + "start": 135, + "end": 144 }, "posRange": { "start": { @@ -244,8 +238,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { } }, "fullRange": { - "start": 148, - "end": 224 + "start": 130, + "end": 200 }, "fullPosRange": { "start": { @@ -253,7 +247,73 @@ exports['mcdoc __fixture__ attributed types 1'] = { "character": 0 }, "end": { - "line": 6, + "line": 4, + "character": 0 + } + }, + "contributor": "binder" + } + ] + }, + "::test::EnumValue": { + "data": { + "typeDef": { + "kind": "int", + "attributes": [ + { + "name": "bitfield", + "value": { + "kind": "tree", + "values": { + "0": { + "kind": "enum", + "enumKind": "int", + "values": [ + { + "identifier": "HandAll", + "value": 1 + }, + { + "identifier": "BootsAll", + "value": 2 + } + ] + } + } + } + } + ] + } + }, + "subcategory": "type_alias", + "definition": [ + { + "uri": "file:///test.mcdoc", + "range": { + "start": 205, + "end": 214 + }, + "posRange": { + "start": { + "line": 4, + "character": 5 + }, + "end": { + "line": 4, + "character": 14 + } + }, + "fullRange": { + "start": 200, + "end": 276 + }, + "fullPosRange": { + "start": { + "line": 4, + "character": 0 + }, + "end": { + "line": 7, "character": 7 } }, @@ -283,16 +343,16 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "uri": "file:///test.mcdoc", "range": { - "start": 176, - "end": 180 + "start": 228, + "end": 232 }, "posRange": { "start": { - "line": 3, + "line": 4, "character": 28 }, "end": { - "line": 3, + "line": 4, "character": 32 } }, @@ -307,7 +367,7 @@ exports['mcdoc __fixture__ attributed types 1'] = { "type": "file", "range": { "start": 0, - "end": 224 + "end": 276 }, "children": [ { @@ -489,7 +549,143 @@ exports['mcdoc __fixture__ attributed types 1'] = { "type": "mcdoc:identifier", "range": { "start": 83, - "end": 92 + "end": 91 + }, + "value": "Multiple", + "symbol": { + "category": "mcdoc", + "path": [ + "::test::Multiple" + ] + } + }, + { + "type": "mcdoc:type/boolean", + "children": [ + { + "type": "mcdoc:attribute", + "children": [ + { + "type": "mcdoc:identifier", + "range": { + "start": 96, + "end": 101 + }, + "value": "since" + }, + { + "type": "mcdoc:type/literal", + "children": [ + { + "type": "mcdoc:typed_number", + "children": [ + { + "type": "float", + "range": { + "start": 102, + "end": 106 + }, + "value": 1.17 + } + ], + "range": { + "start": 102, + "end": 106 + } + } + ], + "range": { + "start": 102, + "end": 106 + } + } + ], + "range": { + "start": 94, + "end": 108 + } + }, + { + "type": "mcdoc:attribute", + "children": [ + { + "type": "mcdoc:identifier", + "range": { + "start": 110, + "end": 115 + }, + "value": "until" + }, + { + "type": "mcdoc:type/literal", + "children": [ + { + "type": "mcdoc:typed_number", + "children": [ + { + "type": "float", + "range": { + "start": 116, + "end": 120 + }, + "value": 1.2 + } + ], + "range": { + "start": 116, + "end": 120 + } + } + ], + "range": { + "start": 116, + "end": 120 + } + } + ], + "range": { + "start": 108, + "end": 122 + } + }, + { + "type": "mcdoc:literal", + "range": { + "start": 122, + "end": 129 + }, + "value": "boolean", + "colorTokenType": "type" + } + ], + "range": { + "start": 94, + "end": 130 + } + } + ], + "range": { + "start": 78, + "end": 130 + } + }, + { + "type": "mcdoc:type_alias", + "children": [ + { + "type": "mcdoc:literal", + "range": { + "start": 130, + "end": 134 + }, + "value": "type", + "colorTokenType": "keyword" + }, + { + "type": "mcdoc:identifier", + "range": { + "start": 135, + "end": 144 }, "value": "TreeValue", "symbol": { @@ -508,16 +704,16 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 97, - "end": 99 + "start": 149, + "end": 151 }, "value": "id" }, { "type": "mcdoc:attribute/tree", "range": { - "start": 100, - "end": 138 + "start": 152, + "end": 190 }, "children": [ { @@ -526,8 +722,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 100, - "end": 108 + "start": 152, + "end": 160 }, "value": "registry" }, @@ -537,8 +733,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "string", "range": { - "start": 109, - "end": 125 + "start": 161, + "end": 177 }, "value": "worldgen/biome", "valueMap": [ @@ -548,23 +744,23 @@ exports['mcdoc __fixture__ attributed types 1'] = { "end": 0 }, "outer": { - "start": 110, - "end": 110 + "start": 162, + "end": 162 } } ] } ], "range": { - "start": 109, - "end": 125 + "start": 161, + "end": 177 } }, { "type": "mcdoc:identifier", "range": { - "start": 126, - "end": 130 + "start": 178, + "end": 182 }, "value": "tags" }, @@ -577,27 +773,27 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 131, - "end": 138 + "start": 183, + "end": 190 }, "value": "allowed" } ], "range": { - "start": 131, - "end": 138 + "start": 183, + "end": 190 } } ], "range": { - "start": 131, - "end": 138 + "start": 183, + "end": 190 } } ], "range": { - "start": 100, - "end": 138 + "start": 152, + "end": 190 } } ], @@ -605,29 +801,29 @@ exports['mcdoc __fixture__ attributed types 1'] = { } ], "range": { - "start": 95, - "end": 141 + "start": 147, + "end": 193 } }, { "type": "mcdoc:literal", "range": { - "start": 141, - "end": 147 + "start": 193, + "end": 199 }, "value": "string", "colorTokenType": "type" } ], "range": { - "start": 95, - "end": 148 + "start": 147, + "end": 200 } } ], "range": { - "start": 78, - "end": 148 + "start": 130, + "end": 200 } }, { @@ -636,8 +832,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:literal", "range": { - "start": 148, - "end": 152 + "start": 200, + "end": 204 }, "value": "type", "colorTokenType": "keyword" @@ -645,8 +841,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 153, - "end": 162 + "start": 205, + "end": 214 }, "value": "EnumValue", "symbol": { @@ -665,16 +861,16 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 167, - "end": 175 + "start": 219, + "end": 227 }, "value": "bitfield" }, { "type": "mcdoc:attribute/tree", "range": { - "start": 176, - "end": 218 + "start": 228, + "end": 270 }, "children": [ { @@ -686,8 +882,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:literal", "range": { - "start": 176, - "end": 180 + "start": 228, + "end": 232 }, "value": "enum", "colorTokenType": "keyword", @@ -701,8 +897,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:literal", "range": { - "start": 181, - "end": 184 + "start": 233, + "end": 236 }, "value": "int", "colorTokenType": "type" @@ -716,8 +912,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 189, - "end": 196 + "start": 241, + "end": 248 }, "value": "HandAll" }, @@ -727,21 +923,21 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "integer", "range": { - "start": 199, - "end": 200 + "start": 251, + "end": 252 }, "value": 1 } ], "range": { - "start": 199, - "end": 200 + "start": 251, + "end": 252 } } ], "range": { - "start": 189, - "end": 200 + "start": 241, + "end": 252 } }, { @@ -750,8 +946,8 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "mcdoc:identifier", "range": { - "start": 203, - "end": 211 + "start": 255, + "end": 263 }, "value": "BootsAll" }, @@ -761,39 +957,39 @@ exports['mcdoc __fixture__ attributed types 1'] = { { "type": "integer", "range": { - "start": 214, - "end": 215 + "start": 266, + "end": 267 }, "value": 2 } ], "range": { - "start": 214, - "end": 215 + "start": 266, + "end": 267 } } ], "range": { - "start": 203, - "end": 215 + "start": 255, + "end": 267 } } ], "range": { - "start": 186, - "end": 218 + "start": 238, + "end": 270 } } ], "range": { - "start": 176, - "end": 218 + "start": 228, + "end": 270 } } ], "range": { - "start": 176, - "end": 218 + "start": 228, + "end": 270 } } ], @@ -801,35 +997,35 @@ exports['mcdoc __fixture__ attributed types 1'] = { } ], "range": { - "start": 165, - "end": 221 + "start": 217, + "end": 273 } }, { "type": "mcdoc:literal", "range": { - "start": 221, - "end": 224 + "start": 273, + "end": 276 }, "value": "int", "colorTokenType": "type" } ], "range": { - "start": 165, - "end": 224 + "start": 217, + "end": 276 } } ], "range": { - "start": 148, - "end": 224 + "start": 200, + "end": 276 } } ], "range": { "start": 0, - "end": 224 + "end": 276 } } ], diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js index a4fbcf57c..1957d20f3 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/dispatcher/random_number_generator.spec.js @@ -618,45 +618,44 @@ exports['mcdoc __fixture__ dispatcher/random number generator 1'] = { "binomial": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "since", - "value": { - "kind": "literal", - "value": { - "kind": "double", - "value": 1.18 + "kind": "struct", + "fields": [ + { + "kind": "pair", + "key": "n", + "type": { + "kind": "int", + "valueRange": { + "kind": 0, + "min": 0 + } } - } - }, - "child": { - "kind": "struct", - "fields": [ - { - "kind": "pair", - "key": "n", - "type": { - "kind": "int", - "valueRange": { - "kind": 0, - "min": 0 - } + }, + { + "kind": "pair", + "key": "p", + "type": { + "kind": "float", + "valueRange": { + "kind": 0, + "min": 0, + "max": 1 } - }, - { - "kind": "pair", - "key": "p", - "type": { - "kind": "float", - "valueRange": { - "kind": 0, - "min": 0, - "max": 1 - } + } + } + ], + "attributes": [ + { + "name": "since", + "value": { + "kind": "literal", + "value": { + "kind": "double", + "value": 1.18 } } - ] - } + } + ] } }, "definition": [ diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js index 5ec87beba..190a14fb1 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/nested_spread.spec.js @@ -47,31 +47,30 @@ exports['mcdoc __fixture__ struct/nested spread 1'] = { } ], "type": { - "kind": "attributed", - "attribute": { - "name": "expandable" - }, - "child": { - "kind": "struct", - "fields": [ - { - "kind": "spread", - "type": { - "kind": "dispatcher", - "parallelIndices": [ - { - "kind": "dynamic", - "accessor": [ - "%parent", - "type" - ] - } - ], - "registry": "minecraft:carver_config" - } + "kind": "struct", + "fields": [ + { + "kind": "spread", + "type": { + "kind": "dispatcher", + "parallelIndices": [ + { + "kind": "dynamic", + "accessor": [ + "%parent", + "type" + ] + } + ], + "registry": "minecraft:carver_config" } - ] - } + } + ], + "attributes": [ + { + "name": "expandable" + } + ] } } ] @@ -116,31 +115,30 @@ exports['mcdoc __fixture__ struct/nested spread 1'] = { "::test::": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "expandable" - }, - "child": { - "kind": "struct", - "fields": [ - { - "kind": "spread", - "type": { - "kind": "dispatcher", - "parallelIndices": [ - { - "kind": "dynamic", - "accessor": [ - "%parent", - "type" - ] - } - ], - "registry": "minecraft:carver_config" - } + "kind": "struct", + "fields": [ + { + "kind": "spread", + "type": { + "kind": "dispatcher", + "parallelIndices": [ + { + "kind": "dynamic", + "accessor": [ + "%parent", + "type" + ] + } + ], + "registry": "minecraft:carver_config" } - ] - } + } + ], + "attributes": [ + { + "name": "expandable" + } + ] } }, "subcategory": "struct", diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js index 7f87aa65c..cf29857c3 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/struct/simple.spec.js @@ -55,13 +55,12 @@ exports['mcdoc __fixture__ struct/simple 1'] = { ], "key": "Bar", "type": { - "kind": "attributed", - "attribute": { - "name": "id" - }, - "child": { - "kind": "string" - } + "kind": "string", + "attributes": [ + { + "name": "id" + } + ] }, "optional": true } diff --git a/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js b/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js index 433beeb3d..1d16fecef 100644 --- a/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js +++ b/__snapshots__/packages/mcdoc/test-out/__fixture__/type_alias/attributed.spec.js @@ -30,24 +30,23 @@ exports['mcdoc __fixture__ type alias/attributed 1'] = { "::test::Foo": { "data": { "typeDef": { - "kind": "attributed", - "attribute": { - "name": "since", - "value": { - "kind": "literal", + "kind": "literal", + "value": { + "kind": "boolean", + "value": true + }, + "attributes": [ + { + "name": "since", "value": { - "kind": "double", - "value": 1.18 + "kind": "literal", + "value": { + "kind": "double", + "value": 1.18 + } } } - }, - "child": { - "kind": "literal", - "value": { - "kind": "boolean", - "value": true - } - } + ] } }, "subcategory": "type_alias", diff --git a/packages/java-edition/src/json/checker/index.ts b/packages/java-edition/src/json/checker/index.ts index 97459a489..a25ae3939 100644 --- a/packages/java-edition/src/json/checker/index.ts +++ b/packages/java-edition/src/json/checker/index.ts @@ -184,7 +184,6 @@ export function fieldValue(type: mcdoc.McdocType): core.SyncChecker { type.kind !== 'literal' && type.kind !== 'reference' && type.kind !== 'union' && - type.kind !== 'attributed' && type.kind !== 'unsafe' && type.kind !== 'concrete' && type.kind !== 'indexed' && @@ -340,10 +339,6 @@ export function fieldValue(type: mcdoc.McdocType): core.SyncChecker { )(node, ctx) } break - case 'attributed': - // TODO: don't just ignore the attribute - fieldValue(type.child)(node, ctx) - break } } } diff --git a/packages/mcdoc/src/binder/index.ts b/packages/mcdoc/src/binder/index.ts index 3b9b68bf7..4712677bd 100644 --- a/packages/mcdoc/src/binder/index.ts +++ b/packages/mcdoc/src/binder/index.ts @@ -228,8 +228,7 @@ function hoist(node: ModuleNode, ctx: McdocBinderContext): void { if (typeParams) { bindTypeParamBlock(node, typeParams, ans, ctx) } - ans.typeDef = attributeType(ans.typeDef, attributes, ctx) - + appendAttributes(ans.typeDef, attributes, ctx) return ans }) } @@ -397,7 +396,7 @@ async function bindDispatchStatement( if (typeParams) { bindTypeParamBlock(node, typeParams, data, ctx) } - data.typeDef = attributeType(data.typeDef, attributes, ctx) + appendAttributes(data.typeDef, attributes, ctx) for (const key of parallelIndices) { if (DynamicIndexNode.is(key)) { @@ -848,25 +847,24 @@ function wrapType( } } } - ans = attributeType(ans, attributes, ctx) + ans.attributes = convertAttributes(attributes, ctx) return ans } -function attributeType( - type: McdocType, +function appendAttributes( + typeDef: McdocType, attributes: AttributeNode[], ctx: McdocBinderContext, -): McdocType { - for (const attribute of attributes) { - type = { - kind: 'attributed', - attribute: convertAttribute(attribute, ctx), - child: type, +) { + const convertedAttributes = convertAttributes(attributes, ctx) + if (convertedAttributes) { + if (typeDef.attributes) { + typeDef.attributes = [...typeDef.attributes, ...convertedAttributes] + } else { + typeDef.attributes = convertedAttributes } } - return type } - function convertAttributes( nodes: AttributeNode[], ctx: McdocBinderContext, diff --git a/packages/mcdoc/src/type/index.ts b/packages/mcdoc/src/type/index.ts index 6e7cbec48..13bf24441 100644 --- a/packages/mcdoc/src/type/index.ts +++ b/packages/mcdoc/src/type/index.ts @@ -48,68 +48,61 @@ export interface DispatcherData { parallelIndices: ParallelIndices } -export interface DispatcherType extends DispatcherData { +export interface DispatcherType extends DispatcherData, McdocBaseType { kind: 'dispatcher' } -export interface StructType { +export interface StructType extends McdocBaseType { kind: 'struct' fields: StructTypeField[] } export type StructTypeField = StructTypePairField | StructTypeSpreadField -export interface StructTypePairField { +export interface StructTypePairField extends McdocBaseType { kind: 'pair' - attributes?: Attribute[] key: string | McdocType type: McdocType optional?: boolean } -export interface StructTypeSpreadField { +export interface StructTypeSpreadField extends McdocBaseType { kind: 'spread' - attributes?: Attribute[] type: McdocType } -export interface EnumType { +export interface EnumType extends McdocBaseType { kind: 'enum' enumKind?: EnumKind values: EnumTypeField[] } -export interface EnumTypeField { - attributes?: Attribute[] +export interface EnumTypeField extends McdocBaseType { identifier: string value: string | number | bigint } -export interface ReferenceType { +export interface ReferenceType extends McdocBaseType { kind: 'reference' path?: string } -export interface UnionType { +export interface UnionType + extends McdocBaseType +{ kind: 'union' members: T[] } -export interface AttributedType { - kind: 'attributed' - attribute: Attribute - child: McdocType -} - -export interface IndexedType { +export interface IndexedType extends McdocBaseType { kind: 'indexed' parallelIndices: Index[] child: McdocType } -export interface TemplateType { +export interface TemplateType extends McdocBaseType { kind: 'template' child: McdocType typeParams: { path: string }[] } -export interface ConcreteType { +export interface ConcreteType extends McdocBaseType { kind: 'concrete' child: McdocType typeArgs: McdocType[] @@ -128,11 +121,11 @@ export function createEmptyUnion( } } -export interface KeywordType { +export interface KeywordType extends McdocBaseType { kind: 'any' | 'boolean' | 'unsafe' } -export interface StringType { +export interface StringType extends McdocBaseType { kind: 'string' lengthRange?: NumericRange } @@ -153,12 +146,12 @@ export interface LiteralNumericValue { kind: NumericTypeKind value: number } -export interface LiteralType { +export interface LiteralType extends McdocBaseType { kind: 'literal' value: LiteralValue } -export interface NumericType { +export interface NumericType extends McdocBaseType { kind: NumericTypeKind valueRange?: NumericRange } @@ -181,7 +174,7 @@ export const NumericTypeKinds = Object.freeze( ) export type NumericTypeKind = (typeof NumericTypeKinds)[number] -export interface PrimitiveArrayType { +export interface PrimitiveArrayType extends McdocBaseType { kind: 'byte_array' | 'int_array' | 'long_array' valueRange?: NumericRange lengthRange?: NumericRange @@ -199,17 +192,21 @@ export const PrimitiveArrayKinds = Object.freeze( ) export type PrimitiveArrayKind = (typeof PrimitiveArrayKinds)[number] -export interface ListType { +export interface ListType extends McdocBaseType { kind: 'list' item: McdocType lengthRange?: NumericRange } -export interface TupleType { +export interface TupleType extends McdocBaseType { kind: 'tuple' items: McdocType[] } +export interface McdocBaseType { + attributes?: Attribute[] +} + export type McdocType = | DispatcherType | EnumType @@ -223,7 +220,6 @@ export type McdocType = | StructType | TupleType | UnionType - | AttributedType | IndexedType | TemplateType | ConcreteType @@ -264,89 +260,120 @@ export namespace McdocType { if (type === undefined) { return '' } + let attributesString = '' + if (type.attributes?.length) { + for (const attribute of type.attributes) { + attributesString += `#[${attribute.name}${ + attribute.value ? '=' : '' + }] ` + } + } + let typeString: string switch (type.kind) { case 'any': case 'boolean': - return type.kind - case 'attributed': - return `#[${type.attribute.name}${ - type.attribute.value ? '=' : '' - }] ${toString(type.child)}` + typeString = type.kind + break case 'byte': - return `byte${rangeToString(type.valueRange)}` + typeString = `byte${rangeToString(type.valueRange)}` + break case 'byte_array': - return `byte${rangeToString(type.valueRange)}[]${ + typeString = `byte${rangeToString(type.valueRange)}[]${ rangeToString( type.lengthRange, ) }` + break case 'concrete': - return `${toString(type.child)}${ + typeString = `${toString(type.child)}${ type.typeArgs.length ? `<${type.typeArgs.map(toString).join(', ')}>` : '' }` + break case 'dispatcher': - return `${type.registry ?? 'spyglass:unknown'}[${ + typeString = `${type.registry ?? 'spyglass:unknown'}[${ indicesToString( type.parallelIndices, ) }]` + break case 'double': - return `double${rangeToString(type.valueRange)}` + typeString = `double${rangeToString(type.valueRange)}` + break case 'enum': - return '' + typeString = '' + break case 'float': - return `float${rangeToString(type.valueRange)}` + typeString = `float${rangeToString(type.valueRange)}` + break case 'indexed': - return `${toString(type.child)}${ + typeString = `${toString(type.child)}${ indicesToString(type.parallelIndices) }` + break case 'int': - return `int${rangeToString(type.valueRange)}` + typeString = `int${rangeToString(type.valueRange)}` + break case 'int_array': - return `int${rangeToString(type.valueRange)}[]${ + typeString = `int${rangeToString(type.valueRange)}[]${ rangeToString( type.lengthRange, ) }` + break case 'list': - return `[${toString(type.item)}]${rangeToString(type.lengthRange)}` + typeString = `[${toString(type.item)}]${ + rangeToString(type.lengthRange) + }` + break case 'literal': - return `${type.value}` + typeString = `${type.value}` + break case 'long': - return `long${rangeToString(type.valueRange)}` + typeString = `long${rangeToString(type.valueRange)}` + break case 'long_array': - return `long${rangeToString(type.valueRange)}[]${ + typeString = `long${rangeToString(type.valueRange)}[]${ rangeToString( type.lengthRange, ) }` + break case 'reference': - return type.path ?? '' + typeString = type.path ?? '' + break case 'short': - return `short${rangeToString(type.valueRange)}` + typeString = `short${rangeToString(type.valueRange)}` + break case 'string': - return `string${rangeToString(type.lengthRange)}` + typeString = `string${rangeToString(type.lengthRange)}` + break case 'struct': - return '' + typeString = '' + break case 'template': - return `${toString(type.child)}${ + typeString = `${toString(type.child)}${ type.typeParams.length ? `<${type.typeParams.map((v) => `?${v.path}`).join(', ')}>` : '' }` + break case 'tuple': - return `[${type.items.map((v) => toString(v)).join(',')}${ + typeString = `[${type.items.map((v) => toString(v)).join(',')}${ type.items.length === 1 ? ',' : '' }]` + break case 'union': - return `(${type.members.map(toString).join(' | ')})` + typeString = `(${type.members.map(toString).join(' | ')})` + break case 'unsafe': - return 'unsafe' + typeString = 'unsafe' + break default: - return Dev.assertNever(type) + Dev.assertNever(type) } + return attributesString + typeString } } diff --git a/packages/mcdoc/test/__fixture__.mcdoc b/packages/mcdoc/test/__fixture__.mcdoc index 0342af834..4318c804c 100644 --- a/packages/mcdoc/test/__fixture__.mcdoc +++ b/packages/mcdoc/test/__fixture__.mcdoc @@ -71,6 +71,7 @@ type TupleTest1 = [string, boolean] //== attributed types type NoValue = #[deprecated] boolean type SimpleValue = #[since=1.19] boolean +type Multiple = #[since=1.17] #[until=1.20] boolean type TreeValue = #[id(registry="worldgen/biome",tags=allowed)] string type EnumValue = #[bitfield(enum(int) { HandAll = 1, diff --git a/packages/nbt/src/checker/index.ts b/packages/nbt/src/checker/index.ts index 1e48430ec..a04b1dd28 100644 --- a/packages/nbt/src/checker/index.ts +++ b/packages/nbt/src/checker/index.ts @@ -431,7 +431,6 @@ export function fieldValue( type.kind !== 'literal' && type.kind !== 'reference' && type.kind !== 'union' && - type.kind !== 'attributed' && type.kind !== 'unsafe' && type.kind !== 'concrete' && type.kind !== 'indexed' && @@ -624,10 +623,6 @@ export function fieldValue( )(node, ctx) } break - case 'attributed': - // TODO: don't just ignore the attribute - fieldValue(type.child, options)(node, ctx) - break } } } From 50c218550a29a174f0a2ad914835672ed53b65ba Mon Sep 17 00:00:00 2001 From: SPGoding Date: Wed, 22 May 2024 21:26:34 -0500 Subject: [PATCH 19/27] =?UTF-8?q?=F0=9F=94=A5=20Remove=20CommandTreeRegist?= =?UTF-8?q?ry=20(#1190)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/java-edition/src/mcfunction/index.ts | 17 +++--- .../src/mcfunction/signatureHelpProvider.ts | 5 +- packages/mcfunction/src/completer/index.ts | 4 +- packages/mcfunction/src/parser/entry.ts | 6 +-- packages/mcfunction/src/tree/index.ts | 1 - packages/mcfunction/src/tree/registry.ts | 52 ------------------- 6 files changed, 13 insertions(+), 72 deletions(-) delete mode 100644 packages/mcfunction/src/tree/registry.ts diff --git a/packages/java-edition/src/mcfunction/index.ts b/packages/java-edition/src/mcfunction/index.ts index 9809bbbea..dbb908cda 100644 --- a/packages/java-edition/src/mcfunction/index.ts +++ b/packages/java-edition/src/mcfunction/index.ts @@ -1,4 +1,4 @@ -import type * as core from '@spyglassmc/core' +import * as core from '@spyglassmc/core' import * as mcf from '@spyglassmc/mcfunction' import type { McmetaCommands, ReleaseVersion } from '../dependency/index.js' import * as checker from './checker/index.js' @@ -22,17 +22,14 @@ export const initialize = ( ) => { const { meta } = ctx + const tree = core.merge(commands, getPatch(releaseVersion)) + mcf.initialize(ctx) - mcf.CommandTreeRegistry.instance.register( - releaseVersion, - commands, - getPatch(releaseVersion), - ) meta.registerLanguage('mcfunction', { extensions: ['.mcfunction'], - parser: mcf.entry(releaseVersion, parser.argument), - completer: mcf.completer.entry(releaseVersion, completer.getMockNodes), + parser: mcf.entry(tree, parser.argument), + completer: mcf.completer.entry(tree, completer.getMockNodes), triggerCharacters: [ ' ', '[', @@ -56,7 +53,7 @@ export const initialize = ( meta.registerParser( 'mcfunction:command', mcf.command( - mcf.CommandTreeRegistry.instance.get(releaseVersion), + tree, parser.argument, ), ) @@ -66,5 +63,5 @@ export const initialize = ( completer.register(meta) meta.registerInlayHintProvider(inlayHintProvider) - meta.registerSignatureHelpProvider(signatureHelpProvider(releaseVersion)) + meta.registerSignatureHelpProvider(signatureHelpProvider(tree)) } diff --git a/packages/java-edition/src/mcfunction/signatureHelpProvider.ts b/packages/java-edition/src/mcfunction/signatureHelpProvider.ts index ee2a6bb77..0653f3175 100644 --- a/packages/java-edition/src/mcfunction/signatureHelpProvider.ts +++ b/packages/java-edition/src/mcfunction/signatureHelpProvider.ts @@ -1,15 +1,14 @@ import * as core from '@spyglassmc/core' import * as mcf from '@spyglassmc/mcfunction' +import type { RootTreeNode } from '../dependency' /** * Only command options that can be satisfied by the current command node will be listed in `signatures`. * Only parameters at and immediately after the `offset` will be listed in `parameters`. */ export function signatureHelpProvider( - commandTreeName: string, + rootTreeNode: RootTreeNode, ): core.SignatureHelpProvider> { - const rootTreeNode = mcf.CommandTreeRegistry.instance.get(commandTreeName) - return (fileNode, ctx) => { if (fileNode.children[0]?.type !== 'mcfunction:entry') { // Not mcfunction. diff --git a/packages/mcfunction/src/completer/index.ts b/packages/mcfunction/src/completer/index.ts index 84af390b8..43706f756 100644 --- a/packages/mcfunction/src/completer/index.ts +++ b/packages/mcfunction/src/completer/index.ts @@ -6,7 +6,6 @@ import { CommandNode } from '../node/index.js' import type { ArgumentTreeNode, RootTreeNode } from '../tree/index.js' import { categorizeTreeChildren, - CommandTreeRegistry, redirect, resolveParentTreeNode, } from '../tree/index.js' @@ -21,11 +20,10 @@ export type MockNodesGetter = ( * will be used for completing the argument. */ export function entry( - commandTreeName: string, + tree: RootTreeNode, getMockNodes: MockNodesGetter, ): core.Completer { return (node, ctx) => { - const tree = CommandTreeRegistry.instance.get(commandTreeName) const childNode = core.AstNode.findChild(node, ctx.offset, true) if (core.CommentNode.is(childNode) || CommandMacroNode.is(childNode)) { return [] diff --git a/packages/mcfunction/src/parser/entry.ts b/packages/mcfunction/src/parser/entry.ts index c4522e9aa..5e0496aa5 100644 --- a/packages/mcfunction/src/parser/entry.ts +++ b/packages/mcfunction/src/parser/entry.ts @@ -4,7 +4,7 @@ import type { CommandNode, McfunctionNode, } from '../node/index.js' -import { CommandTreeRegistry } from '../tree/index.js' +import type { RootTreeNode } from '../tree/index.js' import type { ArgumentParserGetter } from './argument.js' import { command } from './command.js' @@ -12,7 +12,7 @@ import { command } from './command.js' * @throws When there's no command tree associated with `commandTreeName`. */ export function entry( - commandTreeName: string, + commandTree: RootTreeNode, argument: ArgumentParserGetter, ): core.Parser { return (src, ctx) => { @@ -35,7 +35,7 @@ export function entry( } } else { result = command( - CommandTreeRegistry.instance.get(commandTreeName), + commandTree, argument, )(src, ctx) } diff --git a/packages/mcfunction/src/tree/index.ts b/packages/mcfunction/src/tree/index.ts index 9f07290a1..67ceecd42 100644 --- a/packages/mcfunction/src/tree/index.ts +++ b/packages/mcfunction/src/tree/index.ts @@ -1,3 +1,2 @@ -export * from './registry.js' export * from './type.js' export * from './util.js' diff --git a/packages/mcfunction/src/tree/registry.ts b/packages/mcfunction/src/tree/registry.ts deleted file mode 100644 index 6d9fadcfa..000000000 --- a/packages/mcfunction/src/tree/registry.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { merge } from '@spyglassmc/core' -import type { PartialRootTreeNode, RootTreeNode } from './type.js' - -/* istanbul ignore next */ -/** - * The registry for mcfunction command trees. - * This is a singleton; use the `instance` static property to get an instance. - */ -export class CommandTreeRegistry { - readonly #trees = new Map() - - /** - * Register command tree for an arbitrary version. - * - * @param version The game version. e.g. `1.15-tdn`. - * @param tree The command tree for this version. - * @param treePatch A custom command tree patch that will be merged onto `tree`. - */ - public register( - version: string, - tree: RootTreeNode, - treePatch?: PartialRootTreeNode, - ): void { - this.#trees.set(version, treePatch ? merge(tree, treePatch) : tree) - } - - /** - * @throws When there's no command tree associated with the version. - */ - public get(version: string): RootTreeNode { - const ans = this.#trees.get(version) - if (!ans) { - throw new Error(`No command tree exist for version “${version}”`) - } - return ans - } - - /** - * An instance of `CommandTreeRegistry`. - */ - public static get instance(): CommandTreeRegistry { - return this._instance ?? (this._instance = new CommandTreeRegistry()) - } - private constructor() { - if (CommandTreeRegistry._instance) { - throw new Error( - 'Use the `instance` static property to get an instance.', - ) - } - } - private static _instance: CommandTreeRegistry -} From 0c5e505c3ba7ae5ae81af6ac52ca83fea4629fbb Mon Sep 17 00:00:00 2001 From: Afro Date: Thu, 23 May 2024 17:53:36 -0400 Subject: [PATCH 20/27] =?UTF-8?q?=F0=9F=94=A7=20Add=20`import/no-duplicate?= =?UTF-8?q?s`=20lint=20rule=20(#1181)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.cjs | 4 +- package-lock.json | 2933 ++++++++++++++--- package.json | 9 +- .../src/common/externals/BrowserExternals.ts | 5 +- .../src/common/externals/NodeJsExternals.ts | 2 +- packages/core/src/service/Downloader.ts | 5 +- packages/core/src/service/Profiler.ts | 6 +- packages/core/src/service/Project.ts | 4 +- packages/core/src/symbol/SymbolUtil.ts | 12 +- packages/core/test/utils.ts | 11 +- packages/java-edition/src/index.ts | 2 +- packages/mcdoc-cli/package.json | 2 +- packages/mcdoc-cli/src/generate/index.ts | 3 +- packages/mcfunction/src/completer/index.ts | 3 +- scripts/tsconfig.json | 3 +- 15 files changed, 2487 insertions(+), 517 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 983eb2df1..86417c0f6 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -12,7 +12,8 @@ module.exports = { "project": "./packages/**/tsconfig.json" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "import" ], "ignorePatterns": [ "**/*.js", @@ -38,6 +39,7 @@ module.exports = { "@typescript-eslint/prefer-for-of": "warn", "@typescript-eslint/prefer-readonly": "warn", "@typescript-eslint/no-floating-promises": "error", + "import/no-duplicates": "error", "indent": "off", "no-fallthrough": "warn", "no-restricted-syntax": [ diff --git a/package-lock.json b/package-lock.json index 0557fe583..e01cadfac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,14 +17,16 @@ "@types/node": "^18.16.3", "@types/snap-shot-core": "^10.2.0", "@types/webpack": "^5.28.1", - "@typescript-eslint/eslint-plugin": "^5.59.1", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.9.0", + "@typescript-eslint/parser": "^7.9.0", "all-contributors-cli": "^6.25.0", "benchmark": "^2.1.4", "circular-dependency-plugin": "^5.2.2", "dprint": "^0.45.1", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.1", "gitmoji-cli": "^8.1.1", "mocha": "^10.2.0", "node-loader": "^2.0.0", @@ -39,6 +41,9 @@ "webpack": "^5.81.0", "webpack-cli": "^5.0.2", "wireit": "^0.9.5" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" } }, "node_modules/@babel/code-frame": { @@ -1002,23 +1007,23 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", - "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", - "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.1", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -1069,22 +1074,22 @@ } }, "node_modules/@eslint/js": { - "version": "8.39.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz", - "integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -1105,9 +1110,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "node_modules/@inquirer/figures": { @@ -1576,6 +1581,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/@types/jsonfile": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.2.tgz", @@ -1639,12 +1650,6 @@ "integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA==", "dev": true }, - "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", - "dev": true - }, "node_modules/@types/snap-shot-core": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/@types/snap-shot-core/-/snap-shot-core-10.2.0.tgz", @@ -1707,32 +1712,31 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.1.tgz", - "integrity": "sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==", - "dev": true, - "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/type-utils": "5.59.1", - "@typescript-eslint/utils": "5.59.1", - "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz", + "integrity": "sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/type-utils": "7.9.0", + "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1740,55 +1744,27 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/parser": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.1.tgz", - "integrity": "sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.9.0.tgz", + "integrity": "sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/typescript-estree": "5.59.1", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/typescript-estree": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1814,16 +1790,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz", - "integrity": "sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.9.0.tgz", + "integrity": "sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1" + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1831,25 +1807,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.1.tgz", - "integrity": "sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.9.0.tgz", + "integrity": "sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.59.1", - "@typescript-eslint/utils": "5.59.1", + "@typescript-eslint/typescript-estree": "7.9.0", + "@typescript-eslint/utils": "7.9.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1875,12 +1851,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.1.tgz", - "integrity": "sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.9.0.tgz", + "integrity": "sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1888,21 +1864,22 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz", - "integrity": "sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.9.0.tgz", + "integrity": "sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1914,6 +1891,15 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1931,6 +1917,21 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", @@ -1944,60 +1945,50 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.1.tgz", - "integrity": "sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.9.0.tgz", + "integrity": "sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/typescript-estree": "5.59.1", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/typescript-estree": "7.9.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz", - "integrity": "sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.9.0.tgz", + "integrity": "sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "7.9.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz", @@ -2207,9 +2198,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2665,6 +2656,42 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -2673,6 +2700,84 @@ "node": ">=8" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/ast-types": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", @@ -2712,6 +2817,21 @@ "when-exit": "^2.1.1" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -3692,6 +3812,57 @@ "node": ">= 14" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/datapack-language-server": { "resolved": "packages/vscode-extension", "link": true @@ -3950,9 +4121,9 @@ } }, "node_modules/deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "node_modules/default-require-extensions": { @@ -4014,6 +4185,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/degenerator": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", @@ -4285,6 +4473,66 @@ "node": ">=4" } }, + "node_modules/es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -4312,27 +4560,79 @@ "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", "dev": true }, - "node_modules/es6-error": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", - "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", - "dev": true - }, - "node_modules/esbuild": { - "version": "0.17.18", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", - "integrity": "sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w==", + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" + "dependencies": { + "es-errors": "^1.3.0" }, "engines": { - "node": ">=12" + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.18", - "@esbuild/android-arm64": "0.17.18", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.17.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.18.tgz", + "integrity": "sha512-z1lix43jBs6UKjcZVKOw2xx69ffE2aG0PygLL5qJ9OS/gy0Ewd1gW/PUQIOIQGXBHWNywSc0floSKoMFF8aK2w==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.18", + "@esbuild/android-arm64": "0.17.18", "@esbuild/android-x64": "0.17.18", "@esbuild/darwin-arm64": "0.17.18", "@esbuild/darwin-x64": "0.17.18", @@ -4434,27 +4734,28 @@ } }, "node_modules/eslint": { - "version": "8.39.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz", - "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.2", - "@eslint/js": "8.39.0", - "@humanwhocodes/config-array": "^0.11.8", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.0", - "espree": "^9.5.1", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -4462,22 +4763,19 @@ "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -4502,6 +4800,146 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*" + } + }, + "node_modules/eslint-import-resolver-typescript/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", + "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -4516,9 +4954,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4621,9 +5059,9 @@ } }, "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -4773,14 +5211,14 @@ } }, "node_modules/espree": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", - "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4977,9 +5415,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -5000,7 +5438,7 @@ "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, "node_modules/fastest-levenshtein": { @@ -5226,6 +5664,15 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -5340,6 +5787,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/fuse.js": { "version": "6.6.2", "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz", @@ -5406,6 +5880,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/get-uri": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", @@ -5922,9 +6425,9 @@ } }, "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -5948,6 +6451,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -6009,24 +6528,12 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -6039,6 +6546,15 @@ "node": ">=0.10.0" } }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -6093,6 +6609,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-yarn": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-3.0.0.tgz", @@ -6244,9 +6775,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "engines": { "node": ">= 4" } @@ -6433,6 +6964,20 @@ "node": ">=8" } }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/interpret": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", @@ -6461,6 +7006,34 @@ "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", "dev": true }, + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -6472,6 +7045,34 @@ "node": ">=8" } }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -6485,12 +7086,42 @@ } }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6556,6 +7187,18 @@ "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-npm": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-6.0.0.tgz", @@ -6576,6 +7219,21 @@ "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -6606,6 +7264,37 @@ "node": ">=0.10.0" } }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", @@ -6615,6 +7304,51 @@ "node": ">=8" } }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -6633,6 +7367,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -6867,16 +7613,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/js-sdsl": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", - "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7643,12 +8379,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -7987,47 +8717,132 @@ "node": ">=8" } }, - "node_modules/nyc/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "node_modules/nyc/node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/nyc/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", "dev": true, "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" }, "engines": { - "node": ">=6" + "node": ">= 0.4" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "node_modules/object.values": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/ofetch": { @@ -8073,9 +8888,9 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "dependencies": { "deep-is": "^0.1.3", @@ -8083,7 +8898,7 @@ "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" }, "engines": { "node": ">= 0.8.0" @@ -8530,6 +9345,15 @@ "node": ">=4" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -8803,6 +9627,24 @@ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", "dev": true }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/registry-auth-token": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", @@ -8866,13 +9708,17 @@ "dev": true }, "node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -8893,6 +9739,15 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/responselike": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", @@ -8999,11 +9854,52 @@ "npm": ">=2.0.0" } }, + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -9108,6 +10004,21 @@ "node": ">= 0.4" } }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -9147,6 +10058,24 @@ "node": ">=8" } }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -9541,6 +10470,55 @@ "node": ">=8" } }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -9553,6 +10531,15 @@ "node": ">=0.10.0" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-dirs": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", @@ -9606,6 +10593,18 @@ "node": ">=4" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/tapable": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", @@ -9779,6 +10778,18 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-loader": { "version": "9.4.2", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", @@ -9928,27 +10939,36 @@ } } }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { - "tslib": "^1.8.1" + "minimist": "^1.2.0" }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + "bin": { + "json5": "lib/cli.js" } }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -9970,6 +10990,79 @@ "node": ">=8" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -9997,6 +11090,21 @@ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==" }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -10614,12 +11722,47 @@ "integrity": "sha512-u9J+toaf3CCxCAzM/484qNAxQE75rFdVgiFEEV8Xps2gzYhf0tx73s1WXDQhkwV17E3MxRMz40m7Ekd2/121Lg==", "dev": true }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/widest-line": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", @@ -11102,7 +12245,7 @@ }, "packages/mcdoc-cli": { "name": "@spyglassmc/mcdoc-cli", - "version": "0.2.0", + "version": "0.1.0-PLACEHOLDER", "license": "MIT", "dependencies": { "fs-extra": "^11.1.1", @@ -11851,20 +12994,20 @@ } }, "@eslint-community/regexpp": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz", - "integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true }, "@eslint/eslintrc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz", - "integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.1", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -11900,19 +13043,19 @@ } }, "@eslint/js": { - "version": "8.39.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.39.0.tgz", - "integrity": "sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true }, "@humanwhocodes/config-array": { - "version": "0.11.8", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", - "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "requires": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" } }, @@ -11923,9 +13066,9 @@ "dev": true }, "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "dev": true }, "@inquirer/figures": { @@ -12423,6 +13566,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "@types/jsonfile": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.2.tgz", @@ -12485,12 +13634,6 @@ "integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA==", "dev": true }, - "@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", - "dev": true - }, "@types/snap-shot-core": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/@types/snap-shot-core/-/snap-shot-core-10.2.0.tgz", @@ -12553,49 +13696,32 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.1.tgz", - "integrity": "sha512-AVi0uazY5quFB9hlp2Xv+ogpfpk77xzsgsIEWyVS7uK/c7MZ5tw7ZPbapa0SbfkqE0fsAMkz5UwtgMLVk2BQAg==", - "dev": true, - "requires": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/type-utils": "5.59.1", - "@typescript-eslint/utils": "5.59.1", - "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "dependencies": { - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true - } + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz", + "integrity": "sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/type-utils": "7.9.0", + "@typescript-eslint/utils": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" } }, "@typescript-eslint/parser": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.1.tgz", - "integrity": "sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.9.0.tgz", + "integrity": "sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/typescript-estree": "5.59.1", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/typescript-estree": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", "debug": "^4.3.4" }, "dependencies": { @@ -12611,25 +13737,25 @@ } }, "@typescript-eslint/scope-manager": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz", - "integrity": "sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.9.0.tgz", + "integrity": "sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1" + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0" } }, "@typescript-eslint/type-utils": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.1.tgz", - "integrity": "sha512-ZMWQ+Oh82jWqWzvM3xU+9y5U7MEMVv6GLioM3R5NJk6uvP47kZ7YvlgSHJ7ERD6bOY7Q4uxWm25c76HKEwIjZw==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.9.0.tgz", + "integrity": "sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.59.1", - "@typescript-eslint/utils": "5.59.1", + "@typescript-eslint/typescript-estree": "7.9.0", + "@typescript-eslint/utils": "7.9.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.3.0" }, "dependencies": { "debug": { @@ -12644,26 +13770,36 @@ } }, "@typescript-eslint/types": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.1.tgz", - "integrity": "sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.9.0.tgz", + "integrity": "sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz", - "integrity": "sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.9.0.tgz", + "integrity": "sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/visitor-keys": "5.59.1", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/visitor-keys": "7.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -12673,6 +13809,15 @@ "ms": "2.1.2" } }, + "minimatch": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, "semver": { "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", @@ -12682,39 +13827,33 @@ } }, "@typescript-eslint/utils": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.1.tgz", - "integrity": "sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.9.0.tgz", + "integrity": "sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==", "dev": true, "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.59.1", - "@typescript-eslint/types": "5.59.1", - "@typescript-eslint/typescript-estree": "5.59.1", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" - }, - "dependencies": { - "semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true - } + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.9.0", + "@typescript-eslint/types": "7.9.0", + "@typescript-eslint/typescript-estree": "7.9.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz", - "integrity": "sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA==", + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.9.0.tgz", + "integrity": "sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.59.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "7.9.0", + "eslint-visitor-keys": "^3.4.3" } }, + "@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "@webassemblyjs/ast": { "version": "1.11.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz", @@ -12901,9 +14040,9 @@ "dev": true }, "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true }, "acorn-import-assertions": { @@ -13254,11 +14393,89 @@ "sprintf-js": "~1.0.2" } }, + "array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "requires": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + } + }, + "array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + } + }, "array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" }, + "array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + } + }, + "array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + } + }, + "array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + } + }, "ast-types": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", @@ -13297,6 +14514,15 @@ "when-exit": "^2.1.1" } }, + "available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "requires": { + "possible-typed-array-names": "^1.0.0" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -14004,6 +15230,39 @@ "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "dev": true }, + "data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "requires": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + } + }, + "data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + } + }, + "data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "requires": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + } + }, "datapack-language-server": { "version": "file:packages/vscode-extension", "requires": { @@ -14198,9 +15457,9 @@ "dev": true }, "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "default-require-extensions": { @@ -14246,6 +15505,17 @@ "gopd": "^1.0.1" } }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, "degenerator": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", @@ -14458,6 +15728,60 @@ "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", "dev": true }, + "es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + } + }, "es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -14479,6 +15803,46 @@ "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", "dev": true }, + "es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "requires": { + "es-errors": "^1.3.0" + } + }, + "es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + } + }, + "es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", @@ -14569,27 +15933,28 @@ } }, "eslint": { - "version": "8.39.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.39.0.tgz", - "integrity": "sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.2", - "@eslint/js": "8.39.0", - "@humanwhocodes/config-array": "^0.11.8", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.0", - "espree": "^9.5.1", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -14597,22 +15962,19 @@ "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "dependencies": { @@ -14678,9 +16040,9 @@ "dev": true }, "eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -14787,6 +16149,119 @@ "dev": true, "requires": {} }, + "eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-import-resolver-typescript": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "dev": true, + "requires": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + } + } + }, + "eslint-module-utils": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", + "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", + "dev": true, + "requires": { + "debug": "^3.2.7" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "requires": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + } + } + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -14798,20 +16273,20 @@ } }, "eslint-visitor-keys": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz", - "integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true }, "espree": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz", - "integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "requires": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.0" + "eslint-visitor-keys": "^3.4.1" } }, "esprima": { @@ -14946,9 +16421,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -14966,7 +16441,7 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, "fastest-levenshtein": { @@ -15127,6 +16602,15 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", @@ -15213,6 +16697,24 @@ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, + "function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, "fuse.js": { "version": "6.6.2", "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz", @@ -15249,11 +16751,31 @@ "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "dev": true }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "requires": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + } + }, + "get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } }, "get-uri": { "version": "6.0.3", @@ -15613,9 +17135,9 @@ } }, "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -15629,6 +17151,16 @@ } } }, + "globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "requires": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + } + }, "globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -15675,21 +17207,12 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, - "grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -15699,6 +17222,12 @@ "ansi-regex": "^2.0.0" } }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -15732,6 +17261,15 @@ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", "dev": true }, + "has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.3" + } + }, "has-yarn": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-3.0.0.tgz", @@ -15835,9 +17373,9 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==" }, "import-fresh": { "version": "3.3.0", @@ -15975,6 +17513,17 @@ } } }, + "internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + } + }, "interpret": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", @@ -15999,6 +17548,25 @@ } } }, + "is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -16007,6 +17575,22 @@ "binary-extensions": "^2.0.0" } }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, "is-ci": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", @@ -16017,12 +17601,30 @@ } }, "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "requires": { + "is-typed-array": "^1.1.13" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, "requires": { - "has": "^1.0.3" + "has-tostringtag": "^1.0.0" } }, "is-extglob": { @@ -16064,6 +17666,12 @@ "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" }, + "is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true + }, "is-npm": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-6.0.0.tgz", @@ -16075,6 +17683,15 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -16096,12 +17713,58 @@ "isobject": "^3.0.1" } }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7" + } + }, "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dev": true, + "requires": { + "which-typed-array": "^1.1.14" + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -16114,6 +17777,15 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -16296,12 +17968,6 @@ } } }, - "js-sdsl": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz", - "integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16886,12 +18552,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -17165,6 +18825,64 @@ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" }, + "object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + } + }, + "object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + } + }, + "object.values": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, "ofetch": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.4.tgz", @@ -17201,9 +18919,9 @@ } }, "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "requires": { "deep-is": "^0.1.3", @@ -17211,7 +18929,7 @@ "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" } }, "ora": { @@ -17521,6 +19239,12 @@ "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", "dev": true }, + "possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -17736,6 +19460,18 @@ "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", "dev": true }, + "regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "dev": true, + "requires": { + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + } + }, "registry-auth-token": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", @@ -17781,13 +19517,14 @@ "dev": true }, "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } }, "resolve-alpn": { @@ -17802,6 +19539,12 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, "responselike": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", @@ -17869,11 +19612,42 @@ "tslib": "^1.9.0" } }, + "safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "requires": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -17951,6 +19725,18 @@ "has-property-descriptors": "^1.0.2" } }, + "set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + } + }, "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", @@ -17981,6 +19767,18 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + } + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -18281,6 +20079,40 @@ } } }, + "string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + } + }, + "string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -18290,6 +20122,12 @@ "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + }, "strip-dirs": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", @@ -18331,6 +20169,12 @@ "has-flag": "^3.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "tapable": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", @@ -18463,6 +20307,13 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "requires": {} + }, "ts-loader": { "version": "9.4.2", "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", @@ -18558,21 +20409,35 @@ "yn": "3.1.1" } }, + "tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -18588,6 +20453,58 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" + } + }, + "typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + } + }, + "typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + } + }, + "typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" + } + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -18608,6 +20525,18 @@ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==" }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, "unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -19077,12 +21006,38 @@ "integrity": "sha512-u9J+toaf3CCxCAzM/484qNAxQE75rFdVgiFEEV8Xps2gzYhf0tx73s1WXDQhkwV17E3MxRMz40m7Ekd2/121Lg==", "dev": true }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + } + }, "widest-line": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", diff --git a/package.json b/package.json index 2f1b863f2..72d5a5796 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "private": true, "version": "1.0.0", "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, "scripts": { "build": "wireit", "build:dev": "wireit", @@ -54,14 +57,16 @@ "@types/node": "^18.16.3", "@types/snap-shot-core": "^10.2.0", "@types/webpack": "^5.28.1", - "@typescript-eslint/eslint-plugin": "^5.59.1", - "@typescript-eslint/parser": "^5.59.1", + "@typescript-eslint/eslint-plugin": "^7.9.0", + "@typescript-eslint/parser": "^7.9.0", "all-contributors-cli": "^6.25.0", "benchmark": "^2.1.4", "circular-dependency-plugin": "^5.2.2", "dprint": "^0.45.1", "eslint": "^8.39.0", "eslint-config-prettier": "^8.8.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.1", "gitmoji-cli": "^8.1.1", "mocha": "^10.2.0", "node-loader": "^2.0.0", diff --git a/packages/core/src/common/externals/BrowserExternals.ts b/packages/core/src/common/externals/BrowserExternals.ts index 55fc00b12..eb06968f5 100644 --- a/packages/core/src/common/externals/BrowserExternals.ts +++ b/packages/core/src/common/externals/BrowserExternals.ts @@ -19,7 +19,10 @@ import type { type Listener = (...args: unknown[]) => unknown class BrowserEventEmitter implements ExternalEventEmitter { - #listeners = new Map; once: Set }>() + readonly #listeners = new Map< + string, + { all: Set; once: Set } + >() emit(eventName: string, ...args: unknown[]): boolean { const listeners = this.#listeners.get(eventName) diff --git a/packages/core/src/common/externals/NodeJsExternals.ts b/packages/core/src/common/externals/NodeJsExternals.ts index 373faf33b..ea2a9c13f 100644 --- a/packages/core/src/common/externals/NodeJsExternals.ts +++ b/packages/core/src/common/externals/NodeJsExternals.ts @@ -165,7 +165,7 @@ const uriToPath = (uri: string | Uri) => const uriFromPath = (path: string) => url.pathToFileURL(path).toString() class ChokidarWatcherWrapper extends EventEmitter implements FsWatcher { - #watcher: chokidar.FSWatcher + readonly #watcher: chokidar.FSWatcher constructor(watcher: chokidar.FSWatcher) { super() diff --git a/packages/core/src/service/Downloader.ts b/packages/core/src/service/Downloader.ts index 8e0b70ec3..470fa2d90 100644 --- a/packages/core/src/service/Downloader.ts +++ b/packages/core/src/service/Downloader.ts @@ -14,7 +14,10 @@ export interface DownloaderDownloadOut { } export class Downloader { - #memoryCache = new Map() + readonly #memoryCache = new Map< + string, + { buffer: Uint8Array; time: number } + >() constructor( private readonly cacheRoot: RootUriString, diff --git a/packages/core/src/service/Profiler.ts b/packages/core/src/service/Profiler.ts index d3cb9ba06..ac3987f82 100644 --- a/packages/core/src/service/Profiler.ts +++ b/packages/core/src/service/Profiler.ts @@ -27,7 +27,7 @@ export interface Profiler { class TopNImpl implements Profiler { #finalized = false - #startTime: number + readonly #startTime: number #lastTime: number #taskCount = 0 #topTasks: [string, number][] = [] @@ -100,9 +100,9 @@ const TotalTaskName = 'Total' class TotalImpl implements Profiler { #finalized = false - #startTime: number + readonly #startTime: number #lastTime: number - #tasks: [string, number][] = [] + readonly #tasks: [string, number][] = [] #longestTaskNameLength = 0 constructor(private readonly id: string, private readonly logger: Logger) { diff --git a/packages/core/src/service/Project.ts b/packages/core/src/service/Project.ts index f77e5ea80..e56d93759 100644 --- a/packages/core/src/service/Project.ts +++ b/packages/core/src/service/Project.ts @@ -222,7 +222,7 @@ export class Project implements ExternalEventEmitter { return this.#ctx } - #cacheRoot: RootUriString + readonly #cacheRoot: RootUriString /** * File URI to a directory where all cache files of Spyglass should be stored. */ @@ -683,7 +683,7 @@ export class Project implements ExternalEventEmitter { } private static readonly TextDocumentCacheMaxLength = 268435456 - #textDocumentCache = new Map< + readonly #textDocumentCache = new Map< string, Promise | TextDocument >() diff --git a/packages/core/src/symbol/SymbolUtil.ts b/packages/core/src/symbol/SymbolUtil.ts index c2232b0fb..a4c58b1d9 100644 --- a/packages/core/src/symbol/SymbolUtil.ts +++ b/packages/core/src/symbol/SymbolUtil.ts @@ -56,13 +56,13 @@ interface DocAndNode { } export class SymbolUtil implements ExternalEventEmitter { - #global: SymbolTable + readonly #global: SymbolTable - #eventEmitter: ExternalEventEmitter - #eventEmitterConstructor: Externals['event']['EventEmitter'] + readonly #eventEmitter: ExternalEventEmitter + readonly #eventEmitterConstructor: Externals['event']['EventEmitter'] - #trimmableSymbols = new Set() - #cache: { + readonly #trimmableSymbols = new Set() + readonly #cache: { [contributor: string]: UriSymbolCache } = Object.create(null) @@ -987,7 +987,7 @@ export class SymbolQuery { * The map where the queried symbol is stored. `undefined` if the map hasn't been created yet. */ #map: SymbolMap | undefined - #parentSymbol: Symbol | undefined + readonly #parentSymbol: Symbol | undefined /** * The queried symbol. `undefined` if the symbol hasn't been created yet. */ diff --git a/packages/core/test/utils.ts b/packages/core/test/utils.ts index 65abc82f5..29d761748 100644 --- a/packages/core/test/utils.ts +++ b/packages/core/test/utils.ts @@ -224,11 +224,14 @@ export interface SimpleProjectState { } export class SimpleProject { - #colorTokens: ColorToken[] = [] - #global: SymbolTable = Object.create(null) + readonly #colorTokens: ColorToken[] = [] + readonly #global: SymbolTable = Object.create(null) #nodes: Record> = Object.create(null) - #symbols = new SymbolUtil(this.#global, NodeJsExternals.event.EventEmitter) + readonly #symbols = new SymbolUtil( + this.#global, + NodeJsExternals.event.EventEmitter, + ) #hasDumped = false @@ -286,7 +289,7 @@ export class SimpleProject { } } - #bindingInProgressUris = new Set() + readonly #bindingInProgressUris = new Set() private async bindSingleFile( uri: string, content: string = this.files.find((f) => f.uri === uri)?.content!, diff --git a/packages/java-edition/src/index.ts b/packages/java-edition/src/index.ts index 8395e9ad2..cf4590d46 100644 --- a/packages/java-edition/src/index.ts +++ b/packages/java-edition/src/index.ts @@ -3,9 +3,9 @@ import * as mcdoc from '@spyglassmc/mcdoc' import * as nbt from '@spyglassmc/nbt' import { uriBinder } from './binder/index.js' import type { McmetaSummary } from './dependency/index.js' -import { getVanillaDatapack } from './dependency/index.js' import { getMcmetaSummary, + getVanillaDatapack, getVanillaMcdoc, getVersions, PackMcmeta, diff --git a/packages/mcdoc-cli/package.json b/packages/mcdoc-cli/package.json index ee8b88785..b750198b3 100644 --- a/packages/mcdoc-cli/package.json +++ b/packages/mcdoc-cli/package.json @@ -1,6 +1,6 @@ { "name": "@spyglassmc/mcdoc-cli", - "version": "0.2.0", + "version": "0.1.0-PLACEHOLDER", "type": "module", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/mcdoc-cli/src/generate/index.ts b/packages/mcdoc-cli/src/generate/index.ts index 8b97a5d52..7a8475fcf 100644 --- a/packages/mcdoc-cli/src/generate/index.ts +++ b/packages/mcdoc-cli/src/generate/index.ts @@ -4,8 +4,7 @@ import { fileURLToPath, pathToFileURL } from 'url' import fs from 'fs-extra' import lineColumn from 'line-column' -import type { AstNode } from '@spyglassmc/core' -import type { Service } from '@spyglassmc/core' +import type { AstNode, Service } from '@spyglassmc/core' import type walk from 'klaw' import type { Logger } from '../index.js' diff --git a/packages/mcfunction/src/completer/index.ts b/packages/mcfunction/src/completer/index.ts index 43706f756..ad4d348b8 100644 --- a/packages/mcfunction/src/completer/index.ts +++ b/packages/mcfunction/src/completer/index.ts @@ -1,8 +1,7 @@ import type { DeepReadonly } from '@spyglassmc/core' import * as core from '@spyglassmc/core' import type { McfunctionNode } from '../node/index.js' -import { CommandMacroNode } from '../node/index.js' -import { CommandNode } from '../node/index.js' +import { CommandMacroNode, CommandNode } from '../node/index.js' import type { ArgumentTreeNode, RootTreeNode } from '../tree/index.js' import { categorizeTreeChildren, diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 820d724de..0302e4b08 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../packages/tsconfig-base.json", "compilerOptions": { - "module": "CommonJS", + "module": "NodeNext", + "moduleResolution": "NodeNext", "noEmit": true } } From a8431ea723df1b94b3f968d01de3f79d1a49fd99 Mon Sep 17 00:00:00 2001 From: SPGoding Date: Thu, 23 May 2024 16:54:49 -0500 Subject: [PATCH 21/27] =?UTF-8?q?=F0=9F=90=9B=20Fix=20computing=20relative?= =?UTF-8?q?=20URIs=20(#1177)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/service/CacheService.ts | 2 +- packages/core/src/service/fileUtil.ts | 45 ++++++++++++++++++- packages/core/test/service/fileUtil.spec.ts | 50 +++++++++++++++++++++ 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/packages/core/src/service/CacheService.ts b/packages/core/src/service/CacheService.ts index 4224d553a..2d269c087 100644 --- a/packages/core/src/service/CacheService.ts +++ b/packages/core/src/service/CacheService.ts @@ -182,7 +182,7 @@ export class CacheService { } for (const [uri, checksum] of Object.entries(this.checksums.files)) { - if (unchangedRoots.some((root) => uri.startsWith(root))) { + if (unchangedRoots.some((root) => fileUtil.isSubUriOf(uri, root))) { ans.unchangedFiles.push(uri) continue } diff --git a/packages/core/src/service/fileUtil.ts b/packages/core/src/service/fileUtil.ts index 9faefeeb4..1b5d9085e 100644 --- a/packages/core/src/service/fileUtil.ts +++ b/packages/core/src/service/fileUtil.ts @@ -6,6 +6,46 @@ export type RootUriString = `${string}/` export type FileExtension = `.${string}` export namespace fileUtil { + /** + * Get the relative URI of `target` based from `base`. + * + * @returns The relative URI, or `undefined` if `target` is not under `base`. + */ + export function getRelativeUriFromBase( + target: string, + base: string, + ): string | undefined { + const baseUri = new Uri(base) + const targetUri = new Uri(target) + + if (baseUri.origin !== targetUri.origin) { + // Different scheme, hostname, and/or port + return undefined + } + + const baseComponents = baseUri.pathname.split('/') + .filter((v) => !!v) + const targetComponents = targetUri.pathname.split('/') + .filter((v) => !!v) + + if ( + baseComponents.length > targetComponents.length || + baseComponents.some((bc, i) => + decodeURIComponent(bc) !== decodeURIComponent(targetComponents[i]) + ) + ) { + return undefined + } + + return targetComponents.slice(baseComponents.length).map( + encodeURIComponent, + ).join('/') + } + + export function isSubUriOf(uri: string, base: string): boolean { + return getRelativeUriFromBase(uri, base) !== undefined + } + /** * @param rootUris The root URIs. Each URI in this array must end with a slash (`/`). * @param uri The target file URI. @@ -25,8 +65,9 @@ export namespace fileUtil { rootUris: readonly RootUriString[], ): Generator { for (const root of rootUris) { - if (uri.startsWith(root)) { - yield decodeURIComponent(uri.slice(root.length)) + const rel = getRelativeUriFromBase(uri, root) + if (rel !== undefined) { + yield rel } } return undefined diff --git a/packages/core/test/service/fileUtil.spec.ts b/packages/core/test/service/fileUtil.spec.ts index 607a3f8de..0f363ae13 100644 --- a/packages/core/test/service/fileUtil.spec.ts +++ b/packages/core/test/service/fileUtil.spec.ts @@ -3,6 +3,56 @@ import { describe, it } from 'mocha' import { fileUtil } from '../../lib/index.js' describe('fileUtil', () => { + describe('getRelativeUriFromBase()', () => { + const bases: string[] = [ + 'file:///c%3A/Users/admin/', + 'file:///c:/Users/admin/', + ] + const suites: { uri: string; expected: string | undefined }[] = [ + { uri: 'file:///c%3A/Users/admin/', expected: '' }, + { uri: 'file:///c%3A/Users/admin/foo.mcdoc', expected: 'foo.mcdoc' }, + { + uri: 'file:///c%3A/Users/admin/foo/bar.mcdoc', + expected: 'foo/bar.mcdoc', + }, + { uri: 'file:///c:/Users/admin/', expected: '' }, + { uri: 'file:///c:/Users/admin/foo.mcdoc', expected: 'foo.mcdoc' }, + { + // Should treat multiple slashes in a row in pathname as a single slash. + uri: 'file:///c://///Users///admin//foo.mcdoc', + expected: 'foo.mcdoc', + }, + { + uri: 'file:///c:/Users/admin/foo/bar.mcdoc', + expected: 'foo/bar.mcdoc', + }, + { uri: 'file:///qux.mcdoc', expected: undefined }, + ] + for (const { uri, expected } of suites) { + for (const base of bases) { + it(`Should return '${expected}' for '${uri}' when base is '${base}'`, () => { + assert.strictEqual( + fileUtil.getRelativeUriFromBase(uri, base), + expected, + ) + }) + } + } + }) + describe('isSubUriOf()', () => { + const root: string = 'file:///c%3A/Users/admin/' + const suites: { uri: string; expected: boolean }[] = [ + { uri: 'file:///c%3A/Users/admin/', expected: true }, + { uri: 'file:///c%3A/Users/admin/foo.mcdoc', expected: true }, + { uri: 'file:///c:/Users/admin/foo.mcdoc', expected: true }, + { uri: 'file:///qux.mcdoc', expected: false }, + ] + for (const { uri, expected } of suites) { + it(`Should return '${expected}' for '${uri}'`, () => { + assert.strictEqual(fileUtil.isSubUriOf(uri, root), expected) + }) + } + }) describe('getRel()', () => { const rootUris: `${string}/`[] = [ 'file:///root1/subdir/', From 9d415a9b8d06e9367fa2e0434f291aeae8e57766 Mon Sep 17 00:00:00 2001 From: SPGoding Date: Thu, 23 May 2024 22:21:28 -0500 Subject: [PATCH 22/27] =?UTF-8?q?=F0=9F=A6=BA=20Add=20tree=20patch=20valid?= =?UTF-8?q?ator=20(#1192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/service/Context.ts | 2 + packages/core/src/service/Project.ts | 7 ++++ packages/core/src/service/Service.ts | 1 + packages/core/test/utils.ts | 1 + packages/java-edition/src/mcfunction/index.ts | 4 ++ .../src/mcfunction/tree/patchValidator.ts | 37 +++++++++++++++++++ packages/language-server/src/server.ts | 2 +- 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 packages/java-edition/src/mcfunction/tree/patchValidator.ts diff --git a/packages/core/src/service/Context.ts b/packages/core/src/service/Context.ts index 848538082..f9ed4061f 100644 --- a/packages/core/src/service/Context.ts +++ b/packages/core/src/service/Context.ts @@ -17,6 +17,7 @@ import type { ProjectData } from './Project.js' export interface ContextBase { fs: FileService + isDebugging: boolean logger: Logger meta: MetaRegistry profilers: ProfilerFactory @@ -27,6 +28,7 @@ export namespace ContextBase { export function create(project: ProjectData): ContextBase { return { fs: project.fs, + isDebugging: project.isDebugging, logger: project.logger, meta: project.meta, profilers: project.profilers, diff --git a/packages/core/src/service/Project.ts b/packages/core/src/service/Project.ts index e56d93759..9f8e88052 100644 --- a/packages/core/src/service/Project.ts +++ b/packages/core/src/service/Project.ts @@ -52,6 +52,7 @@ export type ProjectInitializerContext = Pick< | 'config' | 'downloader' | 'externals' + | 'isDebugging' | 'logger' | 'meta' | 'projectRoot' @@ -75,6 +76,7 @@ export interface ProjectOptions { externals: Externals fs?: FileService initializers?: readonly ProjectInitializer[] + isDebugging?: boolean logger?: Logger profilers?: ProfilerFactory /** @@ -115,6 +117,7 @@ export type ProjectData = Pick< | 'ensureBindingStarted' | 'externals' | 'fs' + | 'isDebugging' | 'logger' | 'meta' | 'profilers' @@ -191,6 +194,7 @@ export class Project implements ExternalEventEmitter { readonly downloader: Downloader readonly externals: Externals readonly fs: FileService + readonly isDebugging: boolean readonly logger: Logger readonly meta = new MetaRegistry() readonly profilers: ProfilerFactory @@ -329,6 +333,7 @@ export class Project implements ExternalEventEmitter { externals, fs = FileService.create(externals, cacheRoot), initializers = [], + isDebugging = false, logger = Logger.create(), profilers = ProfilerFactory.noop(), projectRoot, @@ -338,6 +343,7 @@ export class Project implements ExternalEventEmitter { this.externals = externals this.fs = fs this.#initializers = initializers + this.isDebugging = isDebugging this.logger = logger this.profilers = profilers this.projectRoot = projectRoot @@ -430,6 +436,7 @@ export class Project implements ExternalEventEmitter { config: this.config, downloader: this.downloader, externals: this.externals, + isDebugging: this.isDebugging, logger: this.logger, meta: this.meta, projectRoot: this.projectRoot, diff --git a/packages/core/src/service/Service.ts b/packages/core/src/service/Service.ts index 77697dc0c..c8c90a2c6 100644 --- a/packages/core/src/service/Service.ts +++ b/packages/core/src/service/Service.ts @@ -55,6 +55,7 @@ export class Service { this.logger = logger this.profilers = profilers this.project = new Project({ + isDebugging, logger, profilers, ...project, diff --git a/packages/core/test/utils.ts b/packages/core/test/utils.ts index 29d761748..2f484cd22 100644 --- a/packages/core/test/utils.ts +++ b/packages/core/test/utils.ts @@ -63,6 +63,7 @@ export function mockProjectData(data: Partial = {}): ProjectData { ensureBindingStarted: data.ensureBindingStarted!, externals, fs: data.fs ?? FileService.create(externals, cacheRoot), + isDebugging: false, logger, meta: data.meta ?? new MetaRegistry(), profilers: data.profilers ?? ProfilerFactory.noop(), diff --git a/packages/java-edition/src/mcfunction/index.ts b/packages/java-edition/src/mcfunction/index.ts index dbb908cda..1cd93606a 100644 --- a/packages/java-edition/src/mcfunction/index.ts +++ b/packages/java-edition/src/mcfunction/index.ts @@ -8,6 +8,7 @@ import { inlayHintProvider } from './inlayHintProvider.js' import * as parser from './parser/index.js' import { signatureHelpProvider } from './signatureHelpProvider.js' import { getPatch } from './tree/patch.js' +import { validatePatchedTree } from './tree/patchValidator.js' export * as checker from './checker/index.js' export * as colorizer from './colorizer/index.js' @@ -23,6 +24,9 @@ export const initialize = ( const { meta } = ctx const tree = core.merge(commands, getPatch(releaseVersion)) + if (ctx.isDebugging) { + validatePatchedTree(tree, ctx.logger) + } mcf.initialize(ctx) diff --git a/packages/java-edition/src/mcfunction/tree/patchValidator.ts b/packages/java-edition/src/mcfunction/tree/patchValidator.ts new file mode 100644 index 000000000..5604fc964 --- /dev/null +++ b/packages/java-edition/src/mcfunction/tree/patchValidator.ts @@ -0,0 +1,37 @@ +import type * as core from '@spyglassmc/core' +import type { RootTreeNode, TreeNode } from '@spyglassmc/mcfunction' + +/** + * A set of parsers that must be patched with a `properties` field. + */ +const PatchRequiredParsers = new Set([ + 'minecraft:nbt_compound_tag', + 'minecraft:nbt_path', + 'minecraft:nbt_tag', + 'minecraft:resource_location', + 'minecraft:uuid', +]) + +/** + * Validate that parsers requiring patches have been patched in the tree. + */ +export function validatePatchedTree(tree: RootTreeNode, logger: core.Logger) { + walk(tree, []) + + function walk(node: TreeNode, path: readonly string[]) { + if ( + node.type === 'argument' && PatchRequiredParsers.has(node.parser) && + !node.properties + ) { + logger.warn( + `[validatePatchedTree] Patch required: ${node.parser} at ${ + path.join('.') + }`, + ) + } + + for (const [key, value] of Object.entries(node.children ?? {})) { + walk(value, [...path, key]) + } + } +} diff --git a/packages/language-server/src/server.ts b/packages/language-server/src/server.ts index f361a40fb..23b78516d 100644 --- a/packages/language-server/src/server.ts +++ b/packages/language-server/src/server.ts @@ -89,7 +89,7 @@ connection.onInitialize(async (params) => { try { service = new core.Service({ - isDebugging: initializationOptions?.inDevelopmentMode && false, + isDebugging: initializationOptions?.inDevelopmentMode, logger, profilers: new core.ProfilerFactory(logger, [ 'cache#load', From 50d61723204c5c0a4fcbf2b71549c59b65813017 Mon Sep 17 00:00:00 2001 From: NeunEinser Date: Fri, 24 May 2024 23:19:45 +0200 Subject: [PATCH 23/27] =?UTF-8?q?=F0=9F=94=A7=20Update=20to=20ES2023=20(#1?= =?UTF-8?q?188)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Misode --- package-lock.json | 2 +- packages/tsconfig-base.json | 4 ++++ packages/vscode-extension/package.json | 10 ++-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index e01cadfac..a5de3db07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12339,7 +12339,7 @@ "vscode-test": "^1.5.2" }, "engines": { - "vscode": "^1.67.0" + "vscode": "^1.82.0" } } }, diff --git a/packages/tsconfig-base.json b/packages/tsconfig-base.json index 40c849544..12298a571 100644 --- a/packages/tsconfig-base.json +++ b/packages/tsconfig-base.json @@ -5,6 +5,10 @@ "module": "ES2022", "moduleResolution": "Bundler", "target": "ES2022", + "lib": [ + "ES2023", + "DOM" + ], "alwaysStrict": true, "experimentalDecorators": true, diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json index 054dc11b8..a139fe131 100644 --- a/packages/vscode-extension/package.json +++ b/packages/vscode-extension/package.json @@ -61,7 +61,7 @@ "url": "https://github.com/SpyglassMC/Spyglass/issues" }, "engines": { - "vscode": "^1.67.0" + "vscode": "^1.82.0" }, "displayName": "%spyglassmc.displayName%", "description": "%spyglassmc.description%", @@ -252,12 +252,6 @@ "activationEvents": [ "workspaceContains:**/pack.mcmeta", "workspaceContains:**/*.mcdoc", - "workspaceContains:**/*.mcfunction", - "onLanguage:mcdoc", - "onLanguage:mcfunction", - "onCommand:spyglassmc.createFile", - "onCommand:spyglassmc.dataHackPubify", - "onCommand:spyglassmc.regenerateCache", - "onCommand:spyglassmc.showCacheRoot" + "workspaceContains:**/*.mcfunction" ] } From 4e561a95e01a9b79f2b5bdfb7e2abd5d357eae94 Mon Sep 17 00:00:00 2001 From: SPGoding Date: Fri, 24 May 2024 20:08:37 -0500 Subject: [PATCH 24/27] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Enabl?= =?UTF-8?q?e=20source=20maps=20in=20stack=20traces=20(#1201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vscode-extension/.vscodeignore | 1 + packages/vscode-extension/src/extension.mts | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/vscode-extension/.vscodeignore b/packages/vscode-extension/.vscodeignore index aa6ad4312..06a1888fb 100644 --- a/packages/vscode-extension/.vscodeignore +++ b/packages/vscode-extension/.vscodeignore @@ -2,6 +2,7 @@ */** !dist/*.js +!dist/*.js.map !resource/*.json !CHANGELOG.md !icon.png diff --git a/packages/vscode-extension/src/extension.mts b/packages/vscode-extension/src/extension.mts index 01727bbc8..ecf50a305 100644 --- a/packages/vscode-extension/src/extension.mts +++ b/packages/vscode-extension/src/extension.mts @@ -13,10 +13,20 @@ let client: lc.LanguageClient export function activate(context: vsc.ExtensionContext) { // The server is implemented in node const serverModule = context.asAbsolutePath(path.join('dist', 'server.js')) - // The debug options for the server - // --inspect=6037: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging + + const runOptions = { + execArgv: [ + '--enable-source-maps', + ], + } const debugOptions = { - execArgv: ['--nolazy', '--inspect=6037', '--expose-gc'], + execArgv: [ + '--nolazy', + // Run the server in Node's Inspector mode so VS Code can attach to the server for debugging + '--inspect=6037', + '--expose-gc', + '--enable-source-maps', + ], } // If the extension is launched in debug mode then the debug server options are used @@ -25,6 +35,7 @@ export function activate(context: vsc.ExtensionContext) { run: { module: serverModule, transport: lc.TransportKind.ipc, + options: runOptions, }, debug: { module: serverModule, From c4cea4fa5f6a4a0f141e40986529e767f42b20b0 Mon Sep 17 00:00:00 2001 From: Calverin <38361803+Calverin@users.noreply.github.com> Date: Sun, 26 May 2024 15:23:39 -0400 Subject: [PATCH 25/27] =?UTF-8?q?=E2=9C=A8=20Macro=20Highlighting=20and=20?= =?UTF-8?q?Error=20Checking=20(#1196)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mcfunction/test-out/parser/macro.spec.js | 413 ++++++++++++++++++ .../core/src/processor/colorizer/Colorizer.ts | 5 +- .../src/mcfunction/signatureHelpProvider.ts | 12 +- packages/locales/src/locales/en.json | 3 + packages/mcfunction/src/colorizer/index.ts | 15 +- packages/mcfunction/src/colorizer/macro.ts | 38 ++ packages/mcfunction/src/completer/index.ts | 4 +- packages/mcfunction/src/node/command.ts | 19 +- packages/mcfunction/src/node/entry.ts | 5 +- packages/mcfunction/src/node/index.ts | 1 + packages/mcfunction/src/node/macro.ts | 36 ++ packages/mcfunction/src/parser/entry.ts | 16 +- packages/mcfunction/src/parser/index.ts | 1 + packages/mcfunction/src/parser/macro.ts | 116 +++++ packages/mcfunction/test/parser/macro.spec.ts | 28 ++ 15 files changed, 665 insertions(+), 47 deletions(-) create mode 100644 __snapshots__/packages/mcfunction/test-out/parser/macro.spec.js create mode 100644 packages/mcfunction/src/colorizer/macro.ts create mode 100644 packages/mcfunction/src/node/macro.ts create mode 100644 packages/mcfunction/src/parser/macro.ts create mode 100644 packages/mcfunction/test/parser/macro.spec.ts diff --git a/__snapshots__/packages/mcfunction/test-out/parser/macro.spec.js b/__snapshots__/packages/mcfunction/test-out/parser/macro.spec.js new file mode 100644 index 000000000..d5f1b5a38 --- /dev/null +++ b/__snapshots__/packages/mcfunction/test-out/parser/macro.spec.js @@ -0,0 +1,413 @@ +exports['mcfunction parser macro() Parse "$say $() bar" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 12 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 5 + }, + "value": "say " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 5, + "end": 8 + }, + "value": "" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 8, + "end": 12 + }, + "value": " bar" + } + ] + }, + "errors": [ + { + "range": { + "start": 5, + "end": 8 + }, + "message": "Expected a macro key", + "severity": 3 + } + ] +} + +exports['mcfunction parser macro() Parse "$say $(foo bar" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 15 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 5 + }, + "value": "say " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 5, + "end": 15 + }, + "value": "foo bar" + } + ] + }, + "errors": [ + { + "range": { + "start": 7, + "end": 14 + }, + "message": "Expected “)”", + "severity": 3 + }, + { + "range": { + "start": 7, + "end": 14 + }, + "message": "Illegal key character: “ ”", + "severity": 3 + } + ] +} + +exports['mcfunction parser macro() Parse "$say $(invalid.key) bar" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 23 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 5 + }, + "value": "say " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 5, + "end": 19 + }, + "value": "invalid.key" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 19, + "end": 23 + }, + "value": " bar" + } + ] + }, + "errors": [ + { + "range": { + "start": 7, + "end": 18 + }, + "message": "Illegal key character: “.”", + "severity": 3 + } + ] +} + +exports['mcfunction parser macro() Parse "$say $(message)" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 15 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 5 + }, + "value": "say " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 5, + "end": 15 + }, + "value": "message" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser macro() Parse "$say no macro argument specified" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 32 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 32 + }, + "value": "say no macro argument specified" + } + ] + }, + "errors": [ + { + "range": { + "start": 1, + "end": 32 + }, + "message": "Expected at least one macro argument", + "severity": 3 + } + ] +} + +exports['mcfunction parser macro() Parse "$scoreboard players set $mode settings $(value)" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 47 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 39 + }, + "value": "scoreboard players set $mode settings " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 39, + "end": 47 + }, + "value": "value" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser macro() Parse "$summon cow $(x).1 $(y)30.0 $(z).0" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 34 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 12 + }, + "value": "summon cow " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 12, + "end": 16 + }, + "value": "x" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 16, + "end": 19 + }, + "value": ".1 " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 19, + "end": 23 + }, + "value": "y" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 23, + "end": 28 + }, + "value": "30.0 " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 28, + "end": 32 + }, + "value": "z" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 32, + "end": 34 + }, + "value": ".0" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser macro() Parse "$tag @s add $(tag)_40" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 21 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 12 + }, + "value": "tag @s add " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 12, + "end": 18 + }, + "value": "tag" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 18, + "end": 21 + }, + "value": "_40" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser macro() Parse "$tellraw $(player) $(text)" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 26 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 9 + }, + "value": "tellraw " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 9, + "end": 18 + }, + "value": "player" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 18, + "end": 19 + }, + "value": " " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 19, + "end": 26 + }, + "value": "text" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser macro() Parse "$tellraw $(players) ["$ Hello everyone! $"]" 1'] = { + "node": { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 43 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 9 + }, + "value": "tellraw " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 9, + "end": 19 + }, + "value": "players" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 19, + "end": 43 + }, + "value": " [\"$ Hello everyone! $\"]" + } + ] + }, + "errors": [] +} diff --git a/packages/core/src/processor/colorizer/Colorizer.ts b/packages/core/src/processor/colorizer/Colorizer.ts index f3d71a6a7..7fca4ea6d 100644 --- a/packages/core/src/processor/colorizer/Colorizer.ts +++ b/packages/core/src/processor/colorizer/Colorizer.ts @@ -71,6 +71,9 @@ export namespace ColorToken { // Built-in LSP semantic tokens: https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocument_semanticTokens +/* + * Hint: during development, the `Developer: Inspect Editor Tokens and Scopes` command in VS Code helps a lot with deciding on the color for nodes. + */ export const ColorTokenTypes = Object.freeze( [ 'comment', @@ -80,12 +83,10 @@ export const ColorTokenTypes = Object.freeze( 'keyword', 'modifier', 'number', - 'operator', 'property', 'string', 'struct', 'type', - 'type', 'variable', // Below are custom types. 'error', diff --git a/packages/java-edition/src/mcfunction/signatureHelpProvider.ts b/packages/java-edition/src/mcfunction/signatureHelpProvider.ts index 0653f3175..58cf20723 100644 --- a/packages/java-edition/src/mcfunction/signatureHelpProvider.ts +++ b/packages/java-edition/src/mcfunction/signatureHelpProvider.ts @@ -16,6 +16,10 @@ export function signatureHelpProvider( } const node = getSelectedCommandNode(fileNode, ctx.offset) + if (!mcf.CommandNode.is(node)) { + // Not a command node. + return undefined + } const argumentNodes = node ? node.children : [] const options = getOptions(rootTreeNode, argumentNodes) @@ -66,15 +70,13 @@ export function signatureHelpProvider( function getSelectedCommandNode( fileNode: core.DeepReadonly>, offset: number, -): mcf.CommandNode | undefined { - return core.AstNode.findChild(fileNode.children[0], offset, true) as - | mcf.CommandNode - | undefined +) { + return core.AstNode.findChild(fileNode.children[0], offset, true) } function getOptions( rootTreeNode: mcf.RootTreeNode, - argumentNodes: mcf.CommandNode['children'], + argumentNodes: core.DeepReadonly, ): string[][] { const current: string[] = [] let treeNode: mcf.TreeNode | undefined = rootTreeNode diff --git a/packages/locales/src/locales/en.json b/packages/locales/src/locales/en.json index bed4277cf..5284e923b 100644 --- a/packages/locales/src/locales/en.json +++ b/packages/locales/src/locales/en.json @@ -75,6 +75,9 @@ "mcfunction.parser.entity-selector.player-name.too-long": "Player names cannot be longer than %0% characters", "mcfunction.parser.eoc-unexpected": "Expected more arguments", "mcfunction.parser.leading-slash": "a leading slash %0%", + "mcfunction.parser.macro.at-least-one": "at least one macro argument", + "mcfunction.parser.macro.illegal": "Illegal key character: “%0%”", + "mcfunction.parser.macro.key": "a macro key", "mcfunction.parser.no-permission": "Permission level %0% is required, which is higher than %1% defined in config", "mcfunction.parser.objective.too-long": "Objective names cannot be longer than %0% characters", "mcfunction.parser.range.min>max": "The minimum value %0% is larger than the maximum value %1%", diff --git a/packages/mcfunction/src/colorizer/index.ts b/packages/mcfunction/src/colorizer/index.ts index afe707a78..217826ac3 100644 --- a/packages/mcfunction/src/colorizer/index.ts +++ b/packages/mcfunction/src/colorizer/index.ts @@ -1,15 +1,12 @@ import * as core from '@spyglassmc/core' import type { - CommandMacroNode, LiteralCommandChildNode, + MacroNode, TrailingCommandChildNode, } from '../node/index.js' +import { macro } from './macro.js' export function register(meta: core.MetaRegistry) { - meta.registerColorizer( - 'mcfunction:command_macro', - macro, - ) meta.registerColorizer( 'mcfunction:command_child/literal', core.colorizer.literal, @@ -18,8 +15,8 @@ export function register(meta: core.MetaRegistry) { 'mcfunction:command_child/trailing', core.colorizer.error, ) -} - -export const macro: core.Colorizer = (node, ctx) => { - return [core.ColorToken.create(node, 'string')] + meta.registerColorizer( + 'mcfunction:macro', + macro, + ) } diff --git a/packages/mcfunction/src/colorizer/macro.ts b/packages/mcfunction/src/colorizer/macro.ts new file mode 100644 index 000000000..cedeaa21d --- /dev/null +++ b/packages/mcfunction/src/colorizer/macro.ts @@ -0,0 +1,38 @@ +import * as core from '@spyglassmc/core' +import type { MacroNode } from '../node/macro' + +export const macro: core.Colorizer = (node, ctx) => { + const tokens: core.ColorToken[] = [] + tokens.push( + core.ColorToken.create( + core.Range.create(node.range.start, node.range.start + 1), + 'literal', + ), + ) // Dollar Sign + for (const child of node.children) { + if (child.type === 'mcfunction:macro/other') { + tokens.push(core.ColorToken.create(child.range, 'string')) + } else { + const { start, end } = child.range + // $( + tokens.push( + core.ColorToken.create( + core.Range.create(start, start + 2), + 'literal', + ), + ) + // Key + tokens.push( + core.ColorToken.create( + core.Range.create(start + 2, end - 1), + 'property', + ), + ) + // ) + tokens.push( + core.ColorToken.create(core.Range.create(end - 1, end), 'literal'), + ) + } + } + return tokens +} diff --git a/packages/mcfunction/src/completer/index.ts b/packages/mcfunction/src/completer/index.ts index ad4d348b8..4fc3fabdc 100644 --- a/packages/mcfunction/src/completer/index.ts +++ b/packages/mcfunction/src/completer/index.ts @@ -1,7 +1,7 @@ import type { DeepReadonly } from '@spyglassmc/core' import * as core from '@spyglassmc/core' import type { McfunctionNode } from '../node/index.js' -import { CommandMacroNode, CommandNode } from '../node/index.js' +import { CommandNode, MacroNode } from '../node/index.js' import type { ArgumentTreeNode, RootTreeNode } from '../tree/index.js' import { categorizeTreeChildren, @@ -24,7 +24,7 @@ export function entry( ): core.Completer { return (node, ctx) => { const childNode = core.AstNode.findChild(node, ctx.offset, true) - if (core.CommentNode.is(childNode) || CommandMacroNode.is(childNode)) { + if (core.CommentNode.is(childNode) || MacroNode.is(childNode)) { return [] } else { return command(tree, getMockNodes)( diff --git a/packages/mcfunction/src/node/command.ts b/packages/mcfunction/src/node/command.ts index a20efff8b..715728a56 100644 --- a/packages/mcfunction/src/node/command.ts +++ b/packages/mcfunction/src/node/command.ts @@ -6,8 +6,10 @@ export interface CommandNode extends core.SequenceNode { } export namespace CommandNode { /* istanbul ignore next */ - export function is(node: core.AstNode): node is CommandNode { - return (node as CommandNode).type === 'mcfunction:command' + export function is | undefined>( + node: T, + ): node is core.InheritReadonly { + return (node as CommandNode | undefined)?.type === 'mcfunction:command' } export function mock(range: core.RangeLike): CommandNode { @@ -19,19 +21,6 @@ export namespace CommandNode { } } -export interface CommandMacroNode extends core.AstNode { - type: 'mcfunction:command_macro' -} - -export namespace CommandMacroNode { - export function is | undefined>( - obj: T, - ): obj is core.InheritReadonly { - return (obj as CommandMacroNode | undefined)?.type === - 'mcfunction:command_macro' - } -} - export interface CommandChildNode extends core.AstNode { type: 'mcfunction:command_child' /** diff --git a/packages/mcfunction/src/node/entry.ts b/packages/mcfunction/src/node/entry.ts index b85c1c11b..b49fd8d23 100644 --- a/packages/mcfunction/src/node/entry.ts +++ b/packages/mcfunction/src/node/entry.ts @@ -1,8 +1,9 @@ import type * as core from '@spyglassmc/core' -import type { CommandMacroNode, CommandNode } from './command.js' +import type { CommandNode } from './command.js' +import type { MacroNode } from './macro.js' export interface McfunctionNode - extends core.SequenceNode + extends core.SequenceNode { type: 'mcfunction:entry' } diff --git a/packages/mcfunction/src/node/index.ts b/packages/mcfunction/src/node/index.ts index 1d9e7a602..541617616 100644 --- a/packages/mcfunction/src/node/index.ts +++ b/packages/mcfunction/src/node/index.ts @@ -1,2 +1,3 @@ export * from './command.js' export * from './entry.js' +export * from './macro.js' diff --git a/packages/mcfunction/src/node/macro.ts b/packages/mcfunction/src/node/macro.ts new file mode 100644 index 000000000..46f2bfb98 --- /dev/null +++ b/packages/mcfunction/src/node/macro.ts @@ -0,0 +1,36 @@ +import * as core from '@spyglassmc/core' + +export interface MacroNode + extends core.SequenceNode +{ + type: 'mcfunction:macro' + slash?: core.Range + children: (MacroOtherNode | MacroArgumentNode)[] +} +export namespace MacroNode { + /* istanbul ignore next */ + export function is | undefined>( + obj: T, + ): obj is core.InheritReadonly { + return (obj as MacroNode | undefined)?.type === + 'mcfunction:macro' + } + + export function mock(range: core.RangeLike): MacroNode { + return { + type: 'mcfunction:macro', + range: core.Range.get(range), + children: [], + } + } +} + +export interface MacroOtherNode extends core.AstNode { + type: 'mcfunction:macro/other' + value?: string +} + +export interface MacroArgumentNode extends core.AstNode { + type: 'mcfunction:macro/argument' + value?: string +} diff --git a/packages/mcfunction/src/parser/entry.ts b/packages/mcfunction/src/parser/entry.ts index 5e0496aa5..059ddcacf 100644 --- a/packages/mcfunction/src/parser/entry.ts +++ b/packages/mcfunction/src/parser/entry.ts @@ -1,12 +1,9 @@ import * as core from '@spyglassmc/core' -import type { - CommandMacroNode, - CommandNode, - McfunctionNode, -} from '../node/index.js' +import type { CommandNode, MacroNode, McfunctionNode } from '../node/index.js' import type { RootTreeNode } from '../tree/index.js' import type { ArgumentParserGetter } from './argument.js' import { command } from './command.js' +import { macro } from './macro.js' /** * @throws When there's no command tree associated with `commandTreeName`. @@ -23,16 +20,11 @@ export function entry( } while (src.skipWhitespace().canReadInLine()) { - let result: core.CommentNode | CommandNode | CommandMacroNode + let result: core.CommentNode | CommandNode | MacroNode if (src.peek() === '#') { result = comment(src, ctx) as core.CommentNode } else if (src.peek() === '$') { - const start = src.cursor - src.skipLine() - result = { - type: 'mcfunction:command_macro', - range: core.Range.create(start, src), - } + result = macro()(src, ctx) as MacroNode } else { result = command( commandTree, diff --git a/packages/mcfunction/src/parser/index.ts b/packages/mcfunction/src/parser/index.ts index 807926441..a6b168016 100644 --- a/packages/mcfunction/src/parser/index.ts +++ b/packages/mcfunction/src/parser/index.ts @@ -3,3 +3,4 @@ export * from './command.js' export * from './common.js' export * from './entry.js' export * from './literal.js' +export * from './macro.js' diff --git a/packages/mcfunction/src/parser/macro.ts b/packages/mcfunction/src/parser/macro.ts new file mode 100644 index 000000000..361a98176 --- /dev/null +++ b/packages/mcfunction/src/parser/macro.ts @@ -0,0 +1,116 @@ +import * as core from '@spyglassmc/core' +import { localeQuote, localize } from '@spyglassmc/locales' +import type { MacroNode } from '../node/index.js' + +/** + * Parse a macro line. + */ +export function macro(): core.Parser { + return ( + src: core.Source, + ctx: core.ParserContext, + ): core.Result => { + const ans: MacroNode = { + type: 'mcfunction:macro', + range: core.Range.create(src.cursor), + children: [], + } + + // Skip the starting '$' + src.skip() + + let start = src.cursor + let hasMacroArgs = false + + while (src.canReadInLine()) { + src.skipUntilOrEnd(core.LF, core.CR, '$') + if (src.peek(2) === '$(') { + hasMacroArgs = true + // Add the other stuff before this macro key + const other = src.sliceToCursor(start) + if (other.length > 0) { + ans.children.push({ + type: 'mcfunction:macro/other', + range: core.Range.create(start, src.cursor), + value: other, + }) + start = src.cursor + } + // Parse the macro key + const key = validateMacroArgument(src, ctx, start) + + ans.children.push({ + type: 'mcfunction:macro/argument', + range: core.Range.create(start, src.cursor), + value: key, + }) + start = src.cursor + } else { + if (src.peek() === '$') { + src.skip() + } + if (!src.canReadInLine()) { + // No more macro arguments, add the remaining other stuff + ans.children.push({ + type: 'mcfunction:macro/other', + range: core.Range.create(start, src.cursor), + value: src.sliceToCursor(start), + }) + } + } + } + + // A line with no macro arguments is invalid + if (!hasMacroArgs) { + ctx.err.report( + localize( + 'expected', + localize('mcfunction.parser.macro.at-least-one'), + ), + core.Range.create(start, src.cursor), + ) + } + + ans.range.end = src.cursor + return ans + } +} + +/** + * Error checking for a macro argument/key. + */ +function validateMacroArgument( + src: core.Source, + ctx: core.ParserContext, + start: number, +): string { + src.skip(2) + const keyStart = src.cursor + src.skipUntilOrEnd(core.LF, core.CR, ')') + if (src.peek() != ')') { + // Macro key was not closed + ctx.err.report( + localize('expected', localeQuote(')')), + core.Range.create(keyStart, src.cursor), + ) + } else if (src.cursor <= keyStart) { + // Encountered $() + ctx.err.report( + localize('expected', localize('mcfunction.parser.macro.key')), + core.Range.create(start, src.cursor + 1), + ) + } + const key = src.sliceToCursor(keyStart) + const matchedInvalid = key.replace(/[a-zA-Z0-9_]*/, '') + if (matchedInvalid.length > 0) { + ctx.err.report( + localize( + 'mcfunction.parser.macro.illegal', + matchedInvalid.charAt(0), + ), + core.Range.create(keyStart, src.cursor), + ) + } + src.skip() + return key +} diff --git a/packages/mcfunction/test/parser/macro.spec.ts b/packages/mcfunction/test/parser/macro.spec.ts new file mode 100644 index 000000000..9b12982e9 --- /dev/null +++ b/packages/mcfunction/test/parser/macro.spec.ts @@ -0,0 +1,28 @@ +import { + showWhitespaceGlyph, + testParser, +} from '@spyglassmc/core/test-out/utils.js' +import { describe, it } from 'mocha' +import snapshot from 'snap-shot-it' +import { macro } from '../../lib/parser/index.js' + +describe('mcfunction parser macro()', () => { + const cases: { content: string }[] = [ + { content: '$say $(message)' }, + { content: '$tag @s add $(tag)_40' }, + { content: '$scoreboard players set $mode settings $(value)' }, + { content: '$tellraw $(player) $(text)' }, + { content: '$tellraw $(players) ["$ Hello everyone! $"]' }, + { content: '$summon cow $(x).1 $(y)30.0 $(z).0' }, + { content: '$say $(foo bar' }, + { content: '$say $() bar' }, + { content: '$say $(invalid.key) bar' }, + { content: '$say no macro argument specified' }, + ] + for (const { content } of cases) { + it(`Parse "${showWhitespaceGlyph(content)}"`, () => { + const parser = macro() + snapshot(testParser(parser, content)) + }) + } +}) From 24201305e6e088f7d54096976986011cc796715d Mon Sep 17 00:00:00 2001 From: Afro Date: Sun, 26 May 2024 16:21:34 -0400 Subject: [PATCH 26/27] =?UTF-8?q?=E2=9C=A8=20Add=20parser=20support=20for?= =?UTF-8?q?=20backslash=20continuation=20(#1180)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/test-out/parser/util.spec.js | 200 +++ .../mcfunction/test-out/parser/entry.spec.js | 1401 +++++++++++++++++ packages/core/src/parser/util.ts | 86 +- packages/core/src/source/Source.ts | 9 +- packages/core/test/parser/util.spec.ts | 47 +- packages/core/test/source/Source.spec.ts | 28 + packages/java-edition/src/mcfunction/index.ts | 2 +- .../test/mcfunction/parser/argument.spec.ts | 4 +- packages/locales/src/locales/en.json | 1 + packages/mcfunction/src/parser/entry.ts | 17 +- .../mcfunction/test/parser/command.spec.ts | 34 +- packages/mcfunction/test/parser/entry.spec.ts | 45 + packages/mcfunction/test/parser/utils.ts | 34 + 13 files changed, 1862 insertions(+), 46 deletions(-) create mode 100644 __snapshots__/packages/mcfunction/test-out/parser/entry.spec.js create mode 100644 packages/mcfunction/test/parser/entry.spec.ts create mode 100644 packages/mcfunction/test/parser/utils.ts diff --git a/__snapshots__/packages/core/test-out/parser/util.spec.js b/__snapshots__/packages/core/test-out/parser/util.spec.js index 66806b622..55a444c2f 100644 --- a/__snapshots__/packages/core/test-out/parser/util.spec.js +++ b/__snapshots__/packages/core/test-out/parser/util.spec.js @@ -93,6 +93,206 @@ exports['any() Parse "qux" with "foo | bar" 1'] = { "errors": [] } +exports['concatOnTrailingBackslash() Parse "true" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 4 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "true↓" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 4 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵ ↓ " 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 0 + } + }, + "errors": [ + { + "range": { + "start": 0, + "end": 0 + }, + "message": "Expected “false” or “true”", + "severity": 3 + } + ] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵ ↓ e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 8 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵ ↓ ⧵↓ e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 11 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵ ↓" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 0 + } + }, + "errors": [ + { + "range": { + "start": 3, + "end": 6 + }, + "message": "A line continuation cannot be the end of the file", + "severity": 3 + }, + { + "range": { + "start": 0, + "end": 0 + }, + "message": "Expected “false” or “true”", + "severity": 3 + } + ] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵ ↓e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 7 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 0 + } + }, + "errors": [ + { + "range": { + "start": 3, + "end": 4 + }, + "message": "A line continuation cannot be the end of the file", + "severity": 3 + }, + { + "range": { + "start": 0, + "end": 0 + }, + "message": "Expected “false” or “true”", + "severity": 3 + } + ] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵e ⧵ ↓ e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 0 + } + }, + "errors": [ + { + "range": { + "start": 0, + "end": 0 + }, + "message": "Expected “false” or “true”", + "severity": 3 + } + ] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵↓ e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 7 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵↓e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 6 + }, + "value": true + }, + "errors": [] +} + +exports['concatOnTrailingBackslash() Parse "tru⧵↓↓e" 1'] = { + "node": { + "type": "boolean", + "range": { + "start": 0, + "end": 0 + } + }, + "errors": [ + { + "range": { + "start": 0, + "end": 0 + }, + "message": "Expected “false” or “true”", + "severity": 3 + } + ] +} + exports['dumpErrors() should not output errors when wrapped with `dumpErrors()` 1'] = { "node": { "type": "boolean", diff --git a/__snapshots__/packages/mcfunction/test-out/parser/entry.spec.js b/__snapshots__/packages/mcfunction/test-out/parser/entry.spec.js new file mode 100644 index 000000000..38648cb50 --- /dev/null +++ b/__snapshots__/packages/mcfunction/test-out/parser/entry.spec.js @@ -0,0 +1,1401 @@ +exports['mcfunction parser entry() Parse "" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 0 + }, + "children": [] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "# this is a comment ⧵ ↓ still a comment" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 39 + }, + "children": [ + { + "type": "comment", + "range": { + "start": 0, + "end": 39 + }, + "comment": " this is a comment still a comment" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "# this is a comment" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 19 + }, + "children": [ + { + "type": "comment", + "range": { + "start": 0, + "end": 19 + }, + "comment": " this is a comment" + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "# this is a comment↓say hi↓$this is a $(macro) ↓" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 48 + }, + "children": [ + { + "type": "comment", + "range": { + "start": 0, + "end": 19 + }, + "comment": " this is a comment" + }, + { + "type": "mcfunction:command", + "range": { + "start": 20, + "end": 26 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 20, + "end": 23 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 20, + "end": 23 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 24, + "end": 26 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 24, + "end": 26 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + }, + { + "type": "mcfunction:macro", + "range": { + "start": 27, + "end": 47 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 28, + "end": 38 + }, + "value": "this is a " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 38, + "end": 46 + }, + "value": "macro" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 46, + "end": 47 + }, + "value": " " + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "$ this is a $(macro) command" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 28 + }, + "children": [ + { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 28 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 12 + }, + "value": " this is a " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 12, + "end": 20 + }, + "value": "macro" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 20, + "end": 28 + }, + "value": " command" + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "$ this is a $(macro) ⧵ ↓ this is $(still) a macro" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 49 + }, + "children": [ + { + "type": "mcfunction:macro", + "range": { + "start": 0, + "end": 49 + }, + "children": [ + { + "type": "mcfunction:macro/other", + "range": { + "start": 1, + "end": 12 + }, + "value": " this is a " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 12, + "end": 20 + }, + "value": "macro" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 20, + "end": 33 + }, + "value": " this is " + }, + { + "type": "mcfunction:macro/argument", + "range": { + "start": 33, + "end": 41 + }, + "value": "still" + }, + { + "type": "mcfunction:macro/other", + "range": { + "start": 41, + "end": 49 + }, + "value": " a macro" + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "execute if true if true run say hi" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 34 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 34 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 7 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 7 + }, + "value": "execute" + } + ], + "path": [ + "execute" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 8, + "end": 10 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 8, + "end": 10 + }, + "value": "if" + } + ], + "path": [ + "execute", + "if" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 11, + "end": 15 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 11, + "end": 15 + }, + "value": "true" + } + ], + "path": [ + "execute", + "if", + "true" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 16, + "end": 18 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 16, + "end": 18 + }, + "value": "if" + } + ], + "path": [ + "execute", + "if" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 19, + "end": 23 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 19, + "end": 23 + }, + "value": "true" + } + ], + "path": [ + "execute", + "if", + "true" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 24, + "end": 27 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 24, + "end": 27 + }, + "value": "run" + } + ], + "path": [ + "execute", + "run" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 28, + "end": 31 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 28, + "end": 31 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 32, + "end": 34 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 32, + "end": 34 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "say hi" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 6 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "say hi" without backslash continuation 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 6 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "say hi↓say hi" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 6 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + }, + { + "type": "mcfunction:command", + "range": { + "start": 7, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 7, + "end": 10 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 7, + "end": 10 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 11, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 11, + "end": 13 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "say hi↓say hi" without backslash continuation 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 6 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 6 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + }, + { + "type": "mcfunction:command", + "range": { + "start": 7, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 7, + "end": 10 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 7, + "end": 10 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 11, + "end": 13 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 11, + "end": 13 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "say trailing ⧵↓ data" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 12 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 12 + }, + "value": "trailing" + } + ], + "path": [ + "say", + "trailing" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 12, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command_child/trailing", + "range": { + "start": 12, + "end": 20 + }, + "value": " data" + } + ], + "path": [] + } + ] + } + ] + }, + "errors": [ + { + "range": { + "start": 4, + "end": 12 + }, + "message": "Expected “hi”", + "severity": 3 + }, + { + "range": { + "start": 12, + "end": 20 + }, + "message": "Trailing data encountered: “ data”", + "severity": 3 + } + ] +} + +exports['mcfunction parser entry() Parse "say trailing ⧵↓ data" without backslash continuation 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 14 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 4, + "end": 12 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 4, + "end": 12 + }, + "value": "trailing" + } + ], + "path": [ + "say", + "trailing" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 12, + "end": 14 + }, + "children": [ + { + "type": "mcfunction:command_child/trailing", + "range": { + "start": 12, + "end": 14 + }, + "value": " \\" + } + ], + "path": [] + } + ] + }, + { + "type": "mcfunction:command", + "range": { + "start": 16, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 16, + "end": 20 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 16, + "end": 20 + }, + "value": "data" + } + ], + "path": [ + "data" + ] + } + ] + } + ] + }, + "errors": [ + { + "range": { + "start": 4, + "end": 12 + }, + "message": "Expected “hi”", + "severity": 3 + }, + { + "range": { + "start": 12, + "end": 14 + }, + "message": "Trailing data encountered: “ \\”", + "severity": 3 + }, + { + "range": { + "start": 16, + "end": 20 + }, + "message": "Expected “execute” or “say”", + "severity": 3 + } + ] +} + +exports['mcfunction parser entry() Parse "say ⧵↓ hi ↓ # comment start ⧵↓ end ↓ say hi" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 43 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 10 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 7, + "end": 9 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 7, + "end": 9 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + }, + { + "type": "comment", + "range": { + "start": 12, + "end": 35 + }, + "comment": " comment start end " + }, + { + "type": "mcfunction:command", + "range": { + "start": 37, + "end": 43 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 37, + "end": 40 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 37, + "end": 40 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 41, + "end": 43 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 41, + "end": 43 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "sa⧵ ↓ y ⧵ ↓ hi" 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 9 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 9 + }, + "value": "say" + } + ], + "path": [ + "say" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 14, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 14, + "end": 16 + }, + "value": "hi" + } + ], + "path": [ + "say", + "hi" + ] + } + ] + } + ] + }, + "errors": [] +} + +exports['mcfunction parser entry() Parse "sa⧵ ↓ y ⧵ ↓ hi" without backslash continuation 1'] = { + "node": { + "type": "mcfunction:entry", + "range": { + "start": 0, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command", + "range": { + "start": 0, + "end": 5 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 0, + "end": 3 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 0, + "end": 3 + }, + "value": "sa\\" + } + ], + "path": [ + "sa\\" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 3, + "end": 5 + }, + "children": [ + { + "type": "mcfunction:command_child/trailing", + "range": { + "start": 3, + "end": 5 + }, + "value": " " + } + ], + "path": [] + } + ] + }, + { + "type": "mcfunction:command", + "range": { + "start": 8, + "end": 12 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 8, + "end": 9 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 8, + "end": 9 + }, + "value": "y" + } + ], + "path": [ + "y" + ] + }, + { + "type": "mcfunction:command_child", + "range": { + "start": 9, + "end": 12 + }, + "children": [ + { + "type": "mcfunction:command_child/trailing", + "range": { + "start": 9, + "end": 12 + }, + "value": " \\ " + } + ], + "path": [] + } + ] + }, + { + "type": "mcfunction:command", + "range": { + "start": 14, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command_child", + "range": { + "start": 14, + "end": 16 + }, + "children": [ + { + "type": "mcfunction:command_child/literal", + "range": { + "start": 14, + "end": 16 + }, + "value": "hi" + } + ], + "path": [ + "hi" + ] + } + ] + } + ] + }, + "errors": [ + { + "range": { + "start": 0, + "end": 3 + }, + "message": "Expected “execute” or “say”", + "severity": 3 + }, + { + "range": { + "start": 3, + "end": 5 + }, + "message": "Trailing data encountered: “ ”", + "severity": 3 + }, + { + "range": { + "start": 8, + "end": 9 + }, + "message": "Expected “execute” or “say”", + "severity": 3 + }, + { + "range": { + "start": 9, + "end": 12 + }, + "message": "Trailing data encountered: “ \\ ”", + "severity": 3 + }, + { + "range": { + "start": 14, + "end": 16 + }, + "message": "Expected “execute” or “say”", + "severity": 3 + } + ] +} diff --git a/packages/core/src/parser/util.ts b/packages/core/src/parser/util.ts index ae589f85a..4dd2616d5 100644 --- a/packages/core/src/parser/util.ts +++ b/packages/core/src/parser/util.ts @@ -1,9 +1,10 @@ -import type { AstNode } from '../node/index.js' +import { localize } from '@spyglassmc/locales' +import type { AstNode, ErrorNode } from '../node/index.js' import { SequenceUtil, SequenceUtilDiscriminator } from '../node/index.js' import type { ParserContext } from '../service/index.js' import { ErrorReporter } from '../service/index.js' -import type { ErrorSeverity, ReadonlySource, Source } from '../source/index.js' -import { Range } from '../source/index.js' +import type { ErrorSeverity, ReadonlySource } from '../source/index.js' +import { IndexMap, Range, Source } from '../source/index.js' import type { InfallibleParser, Parser, Result, Returnable } from './Parser.js' import { Failure } from './Parser.js' @@ -478,17 +479,17 @@ export function validate( */ export function stopBefore( parser: InfallibleParser, - ...teminators: (string | readonly string[])[] + ...terminators: (string | readonly string[])[] ): InfallibleParser export function stopBefore( parser: Parser, - ...teminators: (string | readonly string[])[] + ...terminators: (string | readonly string[])[] ): Parser export function stopBefore( parser: Parser, - ...teminators: (string | readonly string[])[] + ...terminators: (string | readonly string[])[] ): Parser { - const flatTerminators = teminators.flat() + const flatTerminators = terminators.flat() return (src, ctx): Result => { const tmpSrc = src.clone() // Cut tmpSrc.string before the nearest terminator. @@ -506,6 +507,77 @@ export function stopBefore( } } +/** + * @returns A parser that is based on the passed-in `parser`, but concatenates lines + * together when we reach, in order: + * - a backslash + * - whitespace (optional) + * - a newline + * - whitespace (optional) + */ +export function concatOnTrailingBackslash( + parser: InfallibleParser, +): InfallibleParser +export function concatOnTrailingBackslash( + parser: Parser, +): Parser +export function concatOnTrailingBackslash( + parser: Parser, +): Parser { + return (src, ctx): Result => { + let wrappedStr = src.sliceToCursor(0) + const wrappedSrcCursor = wrappedStr.length + const indexMap: IndexMap = [] + + while (src.canRead()) { + wrappedStr += src.readUntil('\\') + if (!src.canRead()) { + break + } + + // If we get here, then `src.cursor` is at a backslash + if (src.hasNonSpaceAheadInLine(1)) { + wrappedStr += src.read() + continue + } + + // Create an index map that skips from the trailing backslash to the + // next line's first non-whitespace character + const from = src.getCharRange() + src.nextLine() + + // Minecraft raises a `Line continuation at end of file` if a backslash + // (+ optional whitespace to the next line) is right before the end of the file + if (!src.canRead()) { + const ans: ErrorNode = { + type: 'error', + range: Range.span(from, src), + } + ctx.err.report( + localize('parser.line-continuation-end-of-file'), + ans, + ) + } + + src.skipSpace() + const to = src.getCharRange(-1) + indexMap.push({ + inner: Range.create(wrappedStr.length), + outer: Range.span(from, to), + }) + } + + const wrappedSrc = new Source( + wrappedStr, + IndexMap.merge(src.indexMap, indexMap), + ) + wrappedSrc.innerCursor = wrappedSrcCursor + const ans = parser(wrappedSrc, ctx) + src.cursor = wrappedSrc.cursor + return ans + } +} + /** * @returns A parser that is based on the passed-in `parser`, but will only read the acceptable characters. */ diff --git a/packages/core/src/source/Source.ts b/packages/core/src/source/Source.ts index 126126b01..9c9e2590c 100644 --- a/packages/core/src/source/Source.ts +++ b/packages/core/src/source/Source.ts @@ -103,9 +103,14 @@ export class ReadonlySource { return regex.test(this.peekRemaining()) } - hasNonSpaceAheadInLine(): boolean { + /** + * If there is a non-space character between `cursor + offset` (inclusive) and the next newline, returns `true`. Otherwise returns `false`. + * + * @param offset Defaults to 0. + */ + hasNonSpaceAheadInLine(offset = 0): boolean { for ( - let cursor = this.innerCursor; + let cursor = this.innerCursor + offset; cursor < this.string.length; cursor++ ) { diff --git a/packages/core/test/parser/util.spec.ts b/packages/core/test/parser/util.spec.ts index adb115871..bb3d6b99c 100644 --- a/packages/core/test/parser/util.spec.ts +++ b/packages/core/test/parser/util.spec.ts @@ -8,7 +8,14 @@ import type { Result, Source, } from '../../lib/index.js' -import { any, boolean, dumpErrors, Failure, Range } from '../../lib/index.js' +import { + any, + boolean, + concatOnTrailingBackslash, + dumpErrors, + Failure, + Range, +} from '../../lib/index.js' import { showWhitespaceGlyph, testParser } from '../utils.js' interface LiteralNode extends AstNode { @@ -119,3 +126,41 @@ describe('dumpErrors()', () => { }) } }) + +describe('concatOnTrailingBackslash()', () => { + const parsers: { + parser: Parser + suites: Array<{ + content: string + }> + }[] = [ + { + parser: boolean, + suites: [ + { content: 'true' }, + { content: 'true\n' }, + { content: 'tru\\\ne' }, + { content: 'tru\\ \ne' }, + { content: 'tru\\\n e' }, + { content: 'tru\\ \n e' }, + { content: 'tru\\ \n \\\n e' }, + { content: 'tru\\e \\ \n e' }, + { content: 'tru\\\n\ne' }, + { content: 'tru\\' }, + { content: 'tru\\ \n' }, + { content: 'tru\\ \n ' }, + ], + }, + ] + for (const { parser, suites } of parsers) { + for (const { content } of suites) { + it( + `Parse "${showWhitespaceGlyph(content)}"`, + () => { + const wrappedParser = concatOnTrailingBackslash(parser) + snapshot(testParser(wrappedParser, content)) + }, + ) + } + } +}) diff --git a/packages/core/test/source/Source.spec.ts b/packages/core/test/source/Source.spec.ts index d2d80391b..a4d152f68 100644 --- a/packages/core/test/source/Source.spec.ts +++ b/packages/core/test/source/Source.spec.ts @@ -522,6 +522,34 @@ describe('Source', () => { ) } }) + describe('hasNonSpaceAheadInLine', () => { + const suites: { + string: string + cursor: number + offset?: number + expected: boolean + }[] = [ + { string: 'foo', cursor: 0, expected: true }, + { string: 'foo', cursor: 2, expected: true }, + { string: 'foo', cursor: 3, expected: false }, + { string: 'foo ', cursor: 3, expected: false }, + { string: 'fooo ', cursor: 3, expected: true }, + { string: 'foooo ', cursor: 3, offset: 1, expected: true }, + { string: 'foooo ', cursor: 3, offset: 2, expected: false }, + ] + for (const { string, cursor, offset, expected } of suites) { + it( + `Should return ${expected} for from ${ + markOffsetInString(string, cursor + (offset ?? 0)) + }}`, + () => { + const src = new Source(string) + src.cursor = cursor + assert.strictEqual(src.hasNonSpaceAheadInLine(offset), expected) + }, + ) + } + }) describe('static', () => { describe('isBrigadierQuote()', () => { const suites: { c: string; expected: boolean }[] = [ diff --git a/packages/java-edition/src/mcfunction/index.ts b/packages/java-edition/src/mcfunction/index.ts index 1cd93606a..d5a26344d 100644 --- a/packages/java-edition/src/mcfunction/index.ts +++ b/packages/java-edition/src/mcfunction/index.ts @@ -32,7 +32,7 @@ export const initialize = ( meta.registerLanguage('mcfunction', { extensions: ['.mcfunction'], - parser: mcf.entry(tree, parser.argument), + parser: mcf.entry(tree, parser.argument, true), completer: mcf.completer.entry(tree, completer.getMockNodes), triggerCharacters: [ ' ', diff --git a/packages/java-edition/test/mcfunction/parser/argument.spec.ts b/packages/java-edition/test/mcfunction/parser/argument.spec.ts index ccd79ae85..3aa7cdee8 100644 --- a/packages/java-edition/test/mcfunction/parser/argument.spec.ts +++ b/packages/java-edition/test/mcfunction/parser/argument.spec.ts @@ -73,7 +73,9 @@ const Suites: Partial< 'minecraft:color': [{ content: ['red', 'green'] }], 'minecraft:column_pos': [{ content: ['0 0', '~ ~', '~1 ~-2'] }], 'minecraft:component': [ - { content: ['"hello world"', '""', '{"text":"hello world"}', '[""]'] }, + { + content: ['"hello world"', '""', '{"text":"hello world"}', '[""]'], + }, ], 'minecraft:dimension': [ { content: ['minecraft:overworld', 'minecraft:the_nether'] }, diff --git a/packages/locales/src/locales/en.json b/packages/locales/src/locales/en.json index 5284e923b..6d3ca1bdd 100644 --- a/packages/locales/src/locales/en.json +++ b/packages/locales/src/locales/en.json @@ -155,6 +155,7 @@ "objective-not-following-convention": "Invalid objective %0% which doesn't follow %1% convention", "parser.float.illegal": "Illegal float numeral that doesn't follow %0%", "parser.integer.illegal": "Illegal integer that doesn't follow %0%", + "parser.line-continuation-end-of-file": "A line continuation cannot be the end of the file", "parser.list.value": "a value", "parser.list.trailing-sep": "Trailing separation", "parser.long.illegal": "Illegal long numeral that doesn't follow %0%", diff --git a/packages/mcfunction/src/parser/entry.ts b/packages/mcfunction/src/parser/entry.ts index 059ddcacf..624eda15d 100644 --- a/packages/mcfunction/src/parser/entry.ts +++ b/packages/mcfunction/src/parser/entry.ts @@ -8,7 +8,7 @@ import { macro } from './macro.js' /** * @throws When there's no command tree associated with `commandTreeName`. */ -export function entry( +function mcfunction( commandTree: RootTreeNode, argument: ArgumentParserGetter, ): core.Parser { @@ -44,3 +44,18 @@ export function entry( const comment = core.comment({ singleLinePrefixes: new Set(['#']), }) + +/** + * @param supportsBackslashContinuation Whether or not to concatenate lines together on trailing backslashes. + * Disabled by default. + */ +export const entry = ( + commandTree: RootTreeNode, + argument: ArgumentParserGetter, + supportsBackslashContinuation = false, +) => { + const parser = mcfunction(commandTree, argument) + return supportsBackslashContinuation + ? core.concatOnTrailingBackslash(parser) + : parser +} diff --git a/packages/mcfunction/test/parser/command.spec.ts b/packages/mcfunction/test/parser/command.spec.ts index 59a47afe7..e572bbea9 100644 --- a/packages/mcfunction/test/parser/command.spec.ts +++ b/packages/mcfunction/test/parser/command.spec.ts @@ -6,41 +6,9 @@ import { fail } from 'assert' import { describe, it } from 'mocha' import snapshot from 'snap-shot-it' import { command } from '../../lib/parser/index.js' -import type { RootTreeNode } from '../../lib/tree/index.js' +import { tree } from './utils.js' describe('mcfunction parser command()', () => { - const tree: RootTreeNode = { - type: 'root', - children: { - execute: { - type: 'literal', - children: { - if: { - type: 'literal', - children: { - true: { - type: 'literal', - executable: true, - redirect: ['execute'], - }, - }, - }, - run: { - type: 'literal', - }, - }, - }, - say: { - type: 'literal', - children: { - hi: { - type: 'literal', - executable: true, - }, - }, - }, - }, - } const cases: { content: string }[] = [ { content: '' }, { content: 's' }, diff --git a/packages/mcfunction/test/parser/entry.spec.ts b/packages/mcfunction/test/parser/entry.spec.ts new file mode 100644 index 000000000..63aa5ccef --- /dev/null +++ b/packages/mcfunction/test/parser/entry.spec.ts @@ -0,0 +1,45 @@ +import { + mockProjectData, + showWhitespaceGlyph, + testParser, +} from '@spyglassmc/core/test-out/utils.js' +import { describe, it } from 'mocha' +import snapshot from 'snap-shot-it' +import { entry } from '../../lib/parser/index.js' +import { tree } from './utils.js' + +describe('mcfunction parser entry()', () => { + const cases: { content: string }[] = [ + { content: '' }, + { content: 'say hi' }, + { content: 'say hi\nsay hi' }, + { content: '# this is a comment' }, + { content: '$ this is a $(macro) command' }, + { content: '# this is a comment\nsay hi\n$this is a $(macro) \n' }, + { content: 'execute if true if true run say hi' }, + { content: '# this is a comment \\ \n still a comment' }, + { content: '$ this is a $(macro) \\ \n this is $(still) a macro' }, + { content: 'sa\\ \n y \\ \n hi' }, + { content: 'say trailing \\\n data' }, + { content: 'say \\\n hi \n # comment start \\\n end \n say hi' }, + ] + for (const { content } of cases) { + it(`Parse "${showWhitespaceGlyph(content)}"`, () => { + const parser = entry(tree, () => undefined, true) + snapshot(testParser(parser, content)) + }) + } + + const casesWithoutBackslashContinuation: { content: string }[] = [ + { content: 'say hi' }, + { content: 'say hi\nsay hi' }, + { content: 'sa\\ \n y \\ \n hi' }, + { content: 'say trailing \\\n data' }, + ] + for (const { content } of casesWithoutBackslashContinuation) { + it(`Parse "${showWhitespaceGlyph(content)}" without backslash continuation`, () => { + const parser = entry(tree, () => undefined) + snapshot(testParser(parser, content)) + }) + } +}) diff --git a/packages/mcfunction/test/parser/utils.ts b/packages/mcfunction/test/parser/utils.ts new file mode 100644 index 000000000..2f39aa69f --- /dev/null +++ b/packages/mcfunction/test/parser/utils.ts @@ -0,0 +1,34 @@ +import type { RootTreeNode } from '../../lib/index.js' + +export const tree: RootTreeNode = { + type: 'root', + children: { + execute: { + type: 'literal', + children: { + if: { + type: 'literal', + children: { + true: { + type: 'literal', + executable: true, + redirect: ['execute'], + }, + }, + }, + run: { + type: 'literal', + }, + }, + }, + say: { + type: 'literal', + children: { + hi: { + type: 'literal', + executable: true, + }, + }, + }, + }, +} From aef1665ad22f9322dfcf6906641bc7767a67ff11 Mon Sep 17 00:00:00 2001 From: Misode Date: Sun, 26 May 2024 22:23:01 +0200 Subject: [PATCH 27/27] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20new=20p?= =?UTF-8?q?article=20format=20(#1202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/mcfunction/completer/argument.ts | 5 ++++ .../src/mcfunction/node/argument.ts | 5 +++- .../src/mcfunction/parser/argument.ts | 25 ++++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/java-edition/src/mcfunction/completer/argument.ts b/packages/java-edition/src/mcfunction/completer/argument.ts index 2e06ec5eb..0c1239fb1 100644 --- a/packages/java-edition/src/mcfunction/completer/argument.ts +++ b/packages/java-edition/src/mcfunction/completer/argument.ts @@ -28,6 +28,7 @@ import * as json from '@spyglassmc/json' import { localeQuote, localize } from '@spyglassmc/locales' import type * as mcf from '@spyglassmc/mcfunction' import { getTagValues } from '../../common/index.js' +import { ReleaseVersion } from '../../dependency/common.js' import { ColorArgumentValues, EntityAnchorArgumentValues, @@ -298,6 +299,10 @@ const particle: Completer = (node, ctx) => { if (child) { return completer.dispatch(child, ctx) } + const release = ctx.project['loadedVersion'] as ReleaseVersion | undefined + if (!release || ReleaseVersion.cmp(release, '1.20.5') >= 0) { + return [] + } const id = ResourceLocationNode.toString(node.id, 'short') const map: Record = { diff --git a/packages/java-edition/src/mcfunction/node/argument.ts b/packages/java-edition/src/mcfunction/node/argument.ts index 8ef2ff453..ed9335c1e 100644 --- a/packages/java-edition/src/mcfunction/node/argument.ts +++ b/packages/java-edition/src/mcfunction/node/argument.ts @@ -368,12 +368,15 @@ export namespace ObjectiveCriteriaNode { export interface ParticleNode extends core.AstNode { type: 'mcfunction:particle' children?: ( + | core.ResourceLocationNode + // Until 1.20.5 | core.FloatNode | core.IntegerNode - | core.ResourceLocationNode | BlockNode | ItemNode | VectorNode + // Since 1.20.5 + | nbt.NbtCompoundNode )[] id: core.ResourceLocationNode } diff --git a/packages/java-edition/src/mcfunction/parser/argument.ts b/packages/java-edition/src/mcfunction/parser/argument.ts index 411569405..d2a765a7a 100644 --- a/packages/java-edition/src/mcfunction/parser/argument.ts +++ b/packages/java-edition/src/mcfunction/parser/argument.ts @@ -534,7 +534,26 @@ const message: core.InfallibleParser = (src, ctx) => { return ans } -export const particle: core.InfallibleParser = (() => { +export const particle: core.InfallibleParser = (src, ctx) => { + const release = ctx.project['loadedVersion'] as ReleaseVersion | undefined + if (!release || ReleaseVersion.cmp(release, '1.20.5') >= 0) { + return core.map( + sequence([ + core.resourceLocation({ category: 'particle_type' }), + core.optional(core.failOnEmpty(nbt.parser.compound)), + ]), + (res) => { + const ans: ParticleNode = { + type: 'mcfunction:particle', + range: res.range, + children: res.children, + id: res.children.find(core.ResourceLocationNode.is)!, + } + return ans + }, + )(src, ctx) + } + type CN = Exclude[number] const sep = core.map(mcf.sep, () => []) const vec = vector({ dimension: 3 }) @@ -591,8 +610,8 @@ export const particle: core.InfallibleParser = (() => { } return ans }, - ) -})() + )(src, ctx) +} function range( type: 'float',