diff --git a/package-lock.json b/package-lock.json index 80ba434..e953879 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "bit-field": "^1.9.0", "js-yaml": "^4.1.0" }, "devDependencies": { @@ -252,6 +253,28 @@ "node": ">=0.4.0" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -384,6 +407,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bit-field": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/bit-field/-/bit-field-1.9.0.tgz", + "integrity": "sha512-/rVbn/yK2UBwfrlwUnNFM/MtYC5zsX+5fq8kC4J9uAPPVFWJW332TFjFlD9qMeWxwtHR014Rg5JyrLbSI9Vrlw==", + "dependencies": { + "fs-extra": "^11.2.0", + "onml": "^2.1.0", + "tspan": "^0.4.0", + "yargs": "^17.7.2" + }, + "bin": { + "bitfield": "bin/bitfield.js" + } + }, "node_modules/brace-expansion": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", @@ -430,6 +467,35 @@ "fsevents": "~2.3.2" } }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "node_modules/commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -550,6 +616,11 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -583,6 +654,14 @@ "errno": "cli.js" } }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -733,6 +812,19 @@ "node": ">= 0.8" } }, + "node_modules/fs-extra": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", + "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -747,6 +839,14 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -759,6 +859,11 @@ "node": ">= 6" } }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, "node_modules/gray-matter": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", @@ -922,6 +1027,14 @@ "node": ">=0.10.0" } }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -969,6 +1082,17 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/junk": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", @@ -1237,6 +1361,14 @@ "node": ">= 0.8" } }, + "node_modules/onml": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/onml/-/onml-2.1.0.tgz", + "integrity": "sha512-fvaSZRzprpwLFge/mcwE0CItfniNisVNamDdMK1FQUjh4ArQZ8ZWSkDaJbZc3XaANKZHq0xIa8NJpZ2HSe3oXA==", + "dependencies": { + "sax": "^1.2.1" + } + }, "node_modules/parse-srcset": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", @@ -1370,6 +1502,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + }, "node_modules/section-matter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", @@ -1474,6 +1619,30 @@ "node": ">= 0.8" } }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", @@ -1520,12 +1689,25 @@ "node": ">=0.6" } }, + "node_modules/tspan": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/tspan/-/tspan-0.4.0.tgz", + "integrity": "sha512-0ELL9tpLpTqLliFyQySaxgCO43buCML+j3TI4E1LuSI8wkzITGEVhZCyMvv/A+3ek9KpgALhhgnZESRLTbN+iw==" + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -1541,6 +1723,22 @@ "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw==", "dev": true }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/ws": { "version": "8.18.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", @@ -1561,6 +1759,39 @@ "optional": true } } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } } }, "dependencies": { @@ -1733,6 +1964,19 @@ "acorn": "^8.11.0" } }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, "anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1828,6 +2072,17 @@ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true }, + "bit-field": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/bit-field/-/bit-field-1.9.0.tgz", + "integrity": "sha512-/rVbn/yK2UBwfrlwUnNFM/MtYC5zsX+5fq8kC4J9uAPPVFWJW332TFjFlD9qMeWxwtHR014Rg5JyrLbSI9Vrlw==", + "requires": { + "fs-extra": "^11.2.0", + "onml": "^2.1.0", + "tspan": "^0.4.0", + "yargs": "^17.7.2" + } + }, "brace-expansion": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", @@ -1863,6 +2118,29 @@ "readdirp": "~3.6.0" } }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -1947,6 +2225,11 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, "encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -1968,6 +2251,11 @@ "prr": "~1.0.1" } }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==" + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -2076,6 +2364,16 @@ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", "dev": true }, + "fs-extra": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", + "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -2083,6 +2381,11 @@ "dev": true, "optional": true }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -2092,6 +2395,11 @@ "is-glob": "^4.0.1" } }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, "gray-matter": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", @@ -2213,6 +2521,11 @@ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -2248,6 +2561,15 @@ "argparse": "^2.0.1" } }, + "jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "junk": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", @@ -2441,6 +2763,14 @@ "ee-first": "1.1.1" } }, + "onml": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/onml/-/onml-2.1.0.tgz", + "integrity": "sha512-fvaSZRzprpwLFge/mcwE0CItfniNisVNamDdMK1FQUjh4ArQZ8ZWSkDaJbZc3XaANKZHq0xIa8NJpZ2HSe3oXA==", + "requires": { + "sax": "^1.2.1" + } + }, "parse-srcset": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", @@ -2538,6 +2868,16 @@ } } }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "sax": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + }, "section-matter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", @@ -2618,6 +2958,24 @@ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, "strip-bom-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", @@ -2649,12 +3007,22 @@ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "dev": true }, + "tspan": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/tspan/-/tspan-0.4.0.tgz", + "integrity": "sha512-0ELL9tpLpTqLliFyQySaxgCO43buCML+j3TI4E1LuSI8wkzITGEVhZCyMvv/A+3ek9KpgALhhgnZESRLTbN+iw==" + }, "uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", "dev": true }, + "universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==" + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -2667,12 +3035,46 @@ "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw==", "dev": true }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, "ws": { "version": "8.18.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", "dev": true, "requires": {} + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" } } } diff --git a/package.json b/package.json index 7c0a436..39325ad 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@11ty/eleventy": "^3.1.2" }, "dependencies": { + "bit-field": "^1.9.0", "js-yaml": "^4.1.0" } } diff --git a/src/instructions/instruction.njk b/src/instructions/instruction.njk index e998332..321c6a1 100644 --- a/src/instructions/instruction.njk +++ b/src/instructions/instruction.njk @@ -18,23 +18,19 @@ eleventyComputed:

Encoding

+

Type: {{ inst.encodingType or "" }}

-
-
- {% set fields = inst.encoding.fields %} - {% for f in fields %} -
-
{{ f.label }}
-
bits {{ f.from }}..{{ f.to }}
-
- {% endfor %} -
-
- {% if inst.encoding.funct7 %}
funct7: {{ inst.encoding.funct7 }}
{% endif %} - {% if inst.encoding.funct3 %}
funct3: {{ inst.encoding.funct3 }}
{% endif %} - {% if inst.encoding.opcode %}
opcode: {{ inst.encoding.opcode }}
{% endif %} -
+ +
+ {{ inst.bitfieldSVG | safe }} +
+ +
+ {% if inst.encoding.funct7 %}
funct7: {{ inst.encoding.funct7 }}
{% endif %} + {% if inst.encoding.funct3 %}
funct3: {{ inst.encoding.funct3 }}
{% endif %} + {% if inst.encoding.opcode %}
opcode: {{ inst.encoding.opcode }}
{% endif %}
+
@@ -47,12 +43,18 @@ eleventyComputed: + diff --git a/src/lib/loadInstructions.js b/src/lib/loadInstructions.js index 6ac9210..7bf0784 100644 --- a/src/lib/loadInstructions.js +++ b/src/lib/loadInstructions.js @@ -1,6 +1,17 @@ +// ----------------------------------------------------------------------------- +// RISC-V Unified Database Instruction Loader +// ----------------------------------------------------------------------------- + +// This script loads RISC-V instruction YAML files from the Unified Database, +// extracts encoding information (match bits + variable positions), and +// generates compact bitfield layouts for visualization using `bit-field`. + + const fs = require("fs"); const path = require("path"); const yaml = require("js-yaml"); +const render = require("bit-field/lib/render"); +const onml = require("onml"); const INST_ROOT = path.join(process.cwd(), "riscv-unified-db", "spec", "std", "isa", "inst"); let cache = null; @@ -10,47 +21,116 @@ function readYamlFile(p) { return yaml.load(txt); } +/* +Parse a match bit string (e.g., "0100000----------101-----0010011") +into an array of single characters, each representing one bit. + +Returns null if the string isn’t 16 or 32 bits long. +*/ function parseMatchBits(matchStr) { - if (!matchStr || matchStr.length !== 32) return null; + if (!matchStr) return null; + if (matchStr.length !== 32 && matchStr.length !== 16) return null; return matchStr.split(""); } +/* +Parse a bitfield location string into numeric segments. +Example: + "31-25|11-7" → [ {from:31,to:25}, {from:11,to:7} ] + +Each segment defines one contiguous region of bits, and fields can have +multiple disjoint segments (like immediates in S- or B-type instructions). +*/ +function parseLocationSegments(loc) { + if (loc === undefined || loc === null) return []; + return String(loc) + .split("|") + .map(part => part.trim()) + .filter(Boolean) + .map(part => { + const [hiStr, loStr] = part.split("-").map(n => n.trim()); + const hi = parseInt(hiStr, 10); + const lo = loStr !== undefined && loStr !== "" ? parseInt(loStr, 10) : hi; + if (Number.isNaN(hi) || Number.isNaN(lo)) return null; + return { + from: Math.max(hi, lo), + to: Math.min(hi, lo) + }; + }) + .filter(Boolean) + .sort((a, b) => (b.from - a.from) || (b.to - a.to)); +} + + +/* +Extract all variable and constant fields from an instruction definition. + +This function handles both flat encodings and multi-variant encodings +(e.g., RV32 / RV64). It returns an array of field descriptors like: + + [ + { label: "funct7=0100000", from: 31, to: 25, width: 7, kind: "const" }, + { label: "rs2", from: 24, to: 20, width: 5, kind: "var" }, + ... + ] + +These field objects describe what appears at each bit position. +*/ function computeFields(doc) { const fields = []; if (!doc.encoding) return fields; - const match = parseMatchBits(doc.encoding.match || ""); - const vars = Array.isArray(doc.encoding.variables) ? doc.encoding.variables : []; + + let enc = doc.encoding; + if (!enc.match && !enc.variables) { + // pick RV32 first, otherwise first available sub-encoding + const variants = Object.keys(enc); // e.g., ["RV32", "RV64"] + const chosenKey = variants.includes("RV32") ? "RV32" : variants[0]; + enc = enc[chosenKey] || {}; + } + + const match = parseMatchBits(enc.match || ""); + const vars = Array.isArray(enc.variables) ? enc.variables : []; + + // --- Parse variable fields (e.g., rd, rs1, imm) --- for (const v of vars) { - const loc = String(v.location); - let hi; - let lo; - if (loc.includes("-")) { - [hi, lo] = loc.split("-").map(n => parseInt(n, 10)); - } else { - hi = lo = parseInt(loc, 10); - } - const width = hi - lo + 1; - fields.push({ label: v.name, from: hi, to: lo, width, kind: "var" }); + const segments = parseLocationSegments(v.location); + if (segments.length === 0) continue; + // Find the overall high/low bits and width + const from = Math.max(...segments.map(s => s.from)); + const to = Math.min(...segments.map(s => s.to)); + const width = segments.reduce((sum, s) => sum + (s.from - s.to + 1), 0); + fields.push({ label: v.name, from, to, width, kind: "var", segments }); } + + // --- Parse constant bit regions from the match pattern --- + // (bits that are fixed 0/1, not "-") if (match) { - const sliceBits = (hi, lo) => match.slice(31 - hi, 32 - lo).join(""); - const opcode = sliceBits(6, 0); - if (/^[01]{7}$/.test(opcode)) { - fields.push({ label: "opcode=" + opcode, from: 6, to: 0, width: 7, kind: "const" }); - } - const funct3 = sliceBits(14, 12); - if (/^[01]{3}$/.test(funct3)) { - fields.push({ label: "funct3=" + funct3, from: 14, to: 12, width: 3, kind: "const" }); - } - const funct7 = sliceBits(31, 25); - if (/^[01]{7}$/.test(funct7) && !/^[-]{7}$/.test(funct7)) { - fields.push({ label: "funct7=" + funct7, from: 31, to: 25, width: 7, kind: "const" }); + let bit = match.length - 1; + while (bit >= 0) { + const hi = bit; + while (bit >= 0 && match[match.length - 1 - bit] !== "-") bit--; + const lo = bit + 1; + const width = hi - lo + 1; + if (width <= 0) { bit--; continue; } + + const bits = match.slice(match.length - 1 - hi, match.length - lo).join(""); + + // Label common constant fields if their positions match + let label = bits; + if (hi === 31 && lo === 25) label = `funct7=${bits}`; + else if (hi === 14 && lo === 12) label = `funct3=${bits}`; + else if (hi === 6 && lo === 0) label = `opcode=${bits}`; + else label = `const=${bits}`; + + fields.push({ label, from: hi, to: lo, width, kind: "const" }); } } + fields.sort((a, b) => b.from - a.from); return fields; } + function detectEncodingType(doc) { if (!doc.encoding || !Array.isArray(doc.encoding.variables)) return undefined; const vars = Object.fromEntries(doc.encoding.variables.map(v => [v.name, String(v.location)])); @@ -84,6 +164,56 @@ function slugifyExtension(ext) { .replace(/[^a-z0-9]+/g, "-") .replace(/^-+|-+$/g, "") || "unknown"; } +/* +Example of expanding multi-segment fields into individual contiguous entries. + +Before expansion: +fields = [ + { label: "imm", from: 31, to: 7, segments: [ { from: 31, to: 25 }, { from: 11, to: 7 } ] }, +] + +After expansion: +expanded = [ + { label: "imm", from: 31, to: 25 }, + { label: "imm", from: 11, to: 7 } +] + +This ensures that each disjoint bit range (like imm[31:25] and imm[11:7]) +is rendered as its own segment in the bitfield diagram rather than one +continuous bar spanning bits 31–7. +*/ + +function expandBitfieldFields(fields, totalBits = 32) { + const expanded = []; + + // Expand multi-segment fields into individual entries + for (const field of fields) { + const segments = Array.isArray(field.segments) && field.segments.length + ? field.segments + : [{ from: field.from, to: field.to }]; + + for (const seg of segments) { + const hi = seg.from; + const lo = seg.to; + const width = hi - lo + 1; + if (width <= 0) continue; + const label = + segments.length > 1 + ? `${field.label}` + : field.label; + expanded.push({ + label, + from: hi, + to: lo, + width, + kind: field.kind + }); + } + } + expanded.sort((a, b) => b.from - a.from); + return expanded; +} + module.exports = function loadInstructions() { if (cache) return cache; @@ -137,6 +267,34 @@ module.exports = function loadInstructions() { } } + const totalBits = doc.encoding?.match?.length === 16 ? 16 : 32; + const filledFields = expandBitfieldFields(fields, totalBits); + const bitfieldJSON = { + reg: filledFields.map(f => { + let name = f.label; + // Constant fields have their label part before "=" removed (e.g., "funct7=0000000" → "0000000"). + if (f.kind === "const" && typeof name === "string") { + const idx = name.indexOf("="); + if (idx !== -1 && idx + 1 < name.length) { + name = name.slice(idx + 1); + } + } + return { + name, + bits: f.width + }; + }) + }; + + let bitfieldSVG = ""; + try { + const segments = bitfieldJSON.reg.slice().reverse(); + const jsonml = render(segments, { bits: totalBits, vflip: false }); // MSB→LSB order + bitfieldSVG = onml.stringify(jsonml); + } catch (err) { + console.warn(`Failed to render SVG for ${name}:`, err); + } + instructions.push({ name, longName, @@ -155,7 +313,8 @@ module.exports = function loadInstructions() { funct7 }, extension, - extensionSlug: slugifyExtension(extension) + extensionSlug: slugifyExtension(extension), + bitfieldSVG }); } }