diff --git a/.env b/.env index c583a330..a0d8f87c 100644 --- a/.env +++ b/.env @@ -1,3 +1 @@ -HOST=kaitai.lorthiz.ovh -WORKER_LIB_KAITAI_STREAM_URL=https://ide.kaitai.io/lib/_npm/kaitai-struct/KaitaiStream.js -WORKER_LIB_ZLIB_URL=https://ide.kaitai.io/lib/_npm/pako/pako_inflate.min.js \ No newline at end of file +HOST=kaitai.lorthiz.ovh \ No newline at end of file diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 00000000..6e67b91c --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,6 @@ +{ + "node-option": [ + "experimental-specifier-resolution=node", + "loader=ts-node/esm" + ] +} diff --git a/README.md b/README.md index fb247af5..b3e8ac6a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Online editor / visualizer for Kaitai Struct .ksy files ## screenshots -![Example screenshot of a .zip file](public/docs/zip_example.png) -![Example screenshot of a .png file](public/docs/png_example.png) +![Example screenshot of a .zip file](docs/zip_example.png) +![Example screenshot of a .png file](docs/png_example.png) For more screenshots [visit the Features wiki page](https://github.com/kaitai-io/kaitai_struct_webide/wiki/Features) diff --git a/build-related/vendor_license.js b/build-related/vendor_license.js index 41feea41..d66731f2 100644 --- a/build-related/vendor_license.js +++ b/build-related/vendor_license.js @@ -18,7 +18,6 @@ function main() { const vendorYaml = readFileSync(filename, "utf8"); const vendor = jsyaml.load(vendorYaml, { schema: jsyaml.CORE_SCHEMA, filename }); let licResult = ""; - let wikiResult = "# 3rd-party libraries\n\n"; const libs = Object.entries(vendor.libs); libs.sort(([lib1Name], [lib2Name]) => lib1Name.localeCompare(lib2Name)) for (const [libName, lib] of libs) { @@ -39,19 +38,14 @@ function main() { licResult += ` License applies to files used for generating minified sources.\n`; licResult += "\n"; - wikiResult += `## ${libName}\n`; - if (lib["website"]) { licResult += `Website: ${lib["website"]}\n`; - wikiResult += `Website: ${lib["website"]}\n\n`; } if (lib["source"]) { licResult += `Source: ${lib["source"]}\n`; - wikiResult += `Source: ${lib["source"]}\n\n`; } - wikiResult += `License: ${lib["licenseName"]} (${lib["licenseUrl"]})\n\n`; licResult += "=".repeat(80) + "\n"; licResult += @@ -62,7 +56,6 @@ function main() { } writeFileSync("public/LICENSE-3RD-PARTY.txt", licResult.trim()); - writeFileSync("public/docs/wiki/3rd-party-libraries.md", wikiResult.trim()); } main(); diff --git a/public/docs/png_example.png b/docs/png_example.png similarity index 100% rename from public/docs/png_example.png rename to docs/png_example.png diff --git a/public/docs/zip_example.png b/docs/zip_example.png similarity index 100% rename from public/docs/zip_example.png rename to docs/zip_example.png diff --git a/package-lock.json b/package-lock.json index a0695860..28992a86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,15 +28,20 @@ "@parcel/optimizer-data-url": "^2.12.0", "@parcel/transformer-inline-string": "^2.12.0", "@parcel/transformer-vue": "^2.12.0", + "@types/chai": "^5.0.0", "@types/dateformat": "^5.0.2", "@types/js-yaml": "^4.0.9", - "@types/node": "^22.7.5", + "@types/mocha": "^10.0.9", + "@types/node": "^22.7.7", + "chai": "^5.1.1", + "mocha": "^10.7.3", "parcel": "^2.12.0", "parcel-reporter-static-files-copy": "^1.5.3", "process": "^0.11.10", - "serve": "^14.2.3", + "serve": "^14.2.4", + "ts-node": "^10.9.2", "tslint": "^6.1.3", - "typescript": "^4.4.4" + "typescript": "^5.6.3" } }, "node_modules/@babel/code-frame": { @@ -172,6 +177,18 @@ "node": ">=6.9.0" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@heroicons/vue": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@heroicons/vue/-/vue-2.1.5.tgz", @@ -185,11 +202,30 @@ "resolved": "https://registry.npmjs.org/@imengyu/vue3-context-menu/-/vue3-context-menu-1.4.3.tgz", "integrity": "sha512-W2rT+xllLSg+u/Z36jE+mrjzO8gCIw0YDDyBxywuASmwrBotU4deftW8Zz9GK/QEHBRNyV5nBINZJo2J257Wlg==" }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@lezer/common": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", @@ -2173,6 +2209,36 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/chai": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.0.0.tgz", + "integrity": "sha512-+DwhEHAaFPPdJ2ral3kNHFQXnTfscEEFsUxzD+d7nlcLrFK23JtNjH71RGasTcHb88b4vVi4mTyfpf8u2L8bdA==", + "dev": true + }, "node_modules/@types/dateformat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@types/dateformat/-/dateformat-5.0.2.tgz", @@ -2185,6 +2251,12 @@ "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", "dev": true }, + "node_modules/@types/mocha": { + "version": "10.0.9", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.9.tgz", + "integrity": "sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q==", + "dev": true + }, "node_modules/@types/node": { "version": "22.7.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.7.tgz", @@ -2403,6 +2475,30 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.13.0.tgz", + "integrity": "sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/ajv": { "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", @@ -2469,6 +2565,15 @@ "node": ">=8" } }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", @@ -2496,6 +2601,19 @@ "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", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/arch": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", @@ -2527,6 +2645,15 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2550,6 +2677,18 @@ "node": ">=0.6" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -2635,6 +2774,12 @@ "node": ">=8" } }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, "node_modules/browserslist": { "version": "4.24.0", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", @@ -2726,6 +2871,22 @@ } ] }, + "node_modules/chai": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.1.tgz", + "integrity": "sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==", + "dev": true, + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2757,6 +2918,39 @@ "url": "https://github.com/chalk/chalk-template?sponsor=1" } }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "engines": { + "node": ">= 16" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/chrome-trace-event": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", @@ -2795,6 +2989,75 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/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==", + "dev": true + }, + "node_modules/cliui/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==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/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==", + "dev": true, + "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/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -2921,6 +3184,12 @@ } } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3090,6 +3359,27 @@ "ms": "2.0.0" } }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -3323,12 +3613,51 @@ "node": ">=8" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -3338,6 +3667,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "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==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-port": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", @@ -3380,6 +3718,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3424,6 +3774,15 @@ "node": ">= 0.4" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, "node_modules/htmlnano": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/htmlnano/-/htmlnano-2.1.1.tgz", @@ -3561,6 +3920,18 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-core-module": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", @@ -3636,6 +4007,15 @@ "node": ">=0.12.0" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-port-reachable": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-port-reachable/-/is-port-reachable-4.0.0.tgz", @@ -3660,6 +4040,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -4027,6 +4419,43 @@ "lie": "3.1.1" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loupe": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", + "dev": true + }, "node_modules/magic-string": { "version": "0.30.12", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", @@ -4035,6 +4464,12 @@ "@jridgewell/sourcemap-codec": "^1.5.0" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/mdn-data": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", @@ -4146,6 +4581,153 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mocha": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", + "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/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/mocha/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/monaco-editor": { "version": "0.52.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.0.tgz", @@ -4274,6 +4856,15 @@ "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", "dev": true }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -4343,6 +4934,36 @@ "integrity": "sha512-JTo+4+4Fw7FreyAvlSLjb1BBVaxEQAacmjD3jjuyPZclpbEghTvQZbXBb2qPd2LeIMxiHwXBZUcpmG2Gl/mDEA==", "dev": true }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -4422,6 +5043,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -4458,6 +5088,15 @@ "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", "dev": true }, + "node_modules/pathval": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "dev": true, + "engines": { + "node": ">= 14.16" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -4625,6 +5264,15 @@ "node": ">=6" } }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -4664,6 +5312,18 @@ "node": ">=0.10.0" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -4692,6 +5352,15 @@ "node": ">=0.10.0" } }, + "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==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -4759,6 +5428,15 @@ "node": ">=10" } }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/serve": { "version": "14.2.4", "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.4.tgz", @@ -5042,6 +5720,55 @@ "node": ">=8.0" } }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/tslib": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", @@ -5215,16 +5942,16 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/undici-types": { @@ -5291,6 +6018,12 @@ "node": ">= 4" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -5356,6 +6089,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/workerpool": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", + "dev": true + }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -5390,6 +6129,131 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": 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==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs/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==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/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==", + "dev": true + }, + "node_modules/yargs/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==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 683244c4..2824c595 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "directories": { "doc": "docs" }, + "type": "module", "dependencies": { "@heroicons/vue": "^2.1.5", "@imengyu/vue3-context-menu": "^1.4.3", @@ -26,24 +27,29 @@ "@parcel/optimizer-data-url": "^2.12.0", "@parcel/transformer-inline-string": "^2.12.0", "@parcel/transformer-vue": "^2.12.0", + "@types/chai": "^5.0.0", "@types/dateformat": "^5.0.2", "@types/js-yaml": "^4.0.9", - "@types/node": "^22.7.5", + "@types/mocha": "^10.0.9", + "@types/node": "^22.7.7", + "chai": "^5.1.1", + "mocha": "^10.7.3", "parcel": "^2.12.0", "parcel-reporter-static-files-copy": "^1.5.3", "process": "^0.11.10", - "serve": "^14.2.3", + "serve": "^14.2.4", + "ts-node": "^10.9.2", "tslint": "^6.1.3", - "typescript": "^4.4.4" + "typescript": "^5.6.3" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "mocha 'test/**'", "generate-formats": "node build-related/genKaitaiFsFiles.js", "generate-license": "node build-related/vendor_license.js", "build-workers": "sh build-related/build_language_workers.sh", "serve": "serve dist", "parcel-run": "npm run build-workers && parcel index.html --no-cache", - "parcel-build": "npm run build-workers && parcel build index.html --no-optimize --no-source-maps" + "parcel-build": "npm run build-workers && parcel build index.html --no-source-maps" }, "repository": { "type": "git", @@ -61,6 +67,12 @@ }, { "staticPath": "LICENSE.txt" + }, + { + "staticPath": "./node_modules/kaitai-struct/KaitaiStream.js" + }, + { + "staticPath": "./node_modules/pako/dist/pako_inflate.js" } ] } diff --git a/public/docs/feature_converter.gif b/public/docs/feature_converter.gif deleted file mode 100644 index 24f337c3..00000000 Binary files a/public/docs/feature_converter.gif and /dev/null differ diff --git a/public/docs/feature_debugging.gif b/public/docs/feature_debugging.gif deleted file mode 100644 index b6c9ce56..00000000 Binary files a/public/docs/feature_debugging.gif and /dev/null differ diff --git a/public/docs/feature_drag_and_drop.gif b/public/docs/feature_drag_and_drop.gif deleted file mode 100644 index 9267508a..00000000 Binary files a/public/docs/feature_drag_and_drop.gif and /dev/null differ diff --git a/public/docs/feature_field_selection.gif b/public/docs/feature_field_selection.gif deleted file mode 100644 index cc96310c..00000000 Binary files a/public/docs/feature_field_selection.gif and /dev/null differ diff --git a/public/docs/feature_filetree.gif b/public/docs/feature_filetree.gif deleted file mode 100644 index 96d24def..00000000 Binary files a/public/docs/feature_filetree.gif and /dev/null differ diff --git a/public/docs/feature_generate_parser.gif b/public/docs/feature_generate_parser.gif deleted file mode 100644 index 2fcf6166..00000000 Binary files a/public/docs/feature_generate_parser.gif and /dev/null differ diff --git a/public/docs/feature_hexviewer_save.gif b/public/docs/feature_hexviewer_save.gif deleted file mode 100644 index 2f1b6d0d..00000000 Binary files a/public/docs/feature_hexviewer_save.gif and /dev/null differ diff --git a/public/docs/wiki/3rd-party-libraries.md b/public/docs/wiki/3rd-party-libraries.md deleted file mode 100644 index 094c37b6..00000000 --- a/public/docs/wiki/3rd-party-libraries.md +++ /dev/null @@ -1,69 +0,0 @@ -# 3rd-party libraries - -## BigInteger.js -Source: https://github.com/peterolson/BigInteger.js - -License: Unlicense (https://raw.githubusercontent.com/peterolson/BigInteger.js/master/LICENSE) - -## bowser -Source: https://github.com/ded/bowser - -License: MIT (https://raw.githubusercontent.com/ded/bowser/master/LICENSE) - -## dateformat -Source: https://github.com/felixge/node-dateformat - -License: MIT (https://raw.githubusercontent.com/felixge/node-dateformat/master/LICENSE) - -## GoldenLayout -Website: https://www.golden-layout.com/ - -Source: https://github.com/deepstreamIO/golden-layout - -License: MIT (https://raw.githubusercontent.com/deepstreamIO/golden-layout/master/LICENSE) - -## jQuery -Website: https://jquery.com/ - -Source: https://github.com/jquery/jquery - -License: MIT (https://raw.githubusercontent.com/jquery/jquery/master/LICENSE.txt) - -## js-yaml -Source: https://github.com/nodeca/js-yaml - -License: MIT (https://github.com/nodeca/js-yaml/blob/master/LICENSE) - -## Kaitai Struct Compiler -Website: http://kaitai.io/ - -Source: https://github.com/kaitai-io/kaitai_struct_compiler - -License: GPL-3.0 (https://raw.githubusercontent.com/kaitai-io/kaitai_struct_compiler/master/LICENSE) - -## Kaitai Struct JavaScript Runtime -Source: https://github.com/kaitai-io/kaitai_struct_javascript_runtime - -License: Apache-2.0 (https://raw.githubusercontent.com/kaitai-io/kaitai_struct_javascript_runtime/master/LICENSE) - -## localForage -Source: https://github.com/localForage/localForage - -License: Apache-2.0 (https://raw.githubusercontent.com/localForage/localForage/master/LICENSE) - -## Monaco Editor -Website: https://microsoft.github.io/monaco-editor - -Source: https://github.com/microsoft/monaco-editor - -License: MIT (https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt) - -## pako -Source: https://github.com/nodeca/pako - -License: MIT (https://raw.githubusercontent.com/nodeca/pako/master/LICENSE) - -## Vue.js -Source: https://github.com/vuejs/vue - -License: MIT (https://raw.githubusercontent.com/vuejs/vue/dev/LICENSE) \ No newline at end of file diff --git a/src/Components/FileTree/Actions/FileTreeDragMoveAction.ts b/src/Components/FileTree/Actions/FileTreeDragMoveAction.ts new file mode 100644 index 00000000..d197f23d --- /dev/null +++ b/src/Components/FileTree/Actions/FileTreeDragMoveAction.ts @@ -0,0 +1,67 @@ +import {FileSystemPath} from "../FileSystemsTypes"; +import {useFileSystems} from "../Store/FileSystemsStore"; +import {updateCurrentlyLoadedFilesIfNeeded} from "./FileTreeRenameAction"; +import {TreeNodeDisplay, TreeNodeDisplayType} from "../FileSystemVisitors/FileSystemFileTreeMapper"; +import {FILE_SYSTEM_TYPE_KAITAI} from "../FileSystems/KaitaiFileSystem"; + +export class FileTreeDragMoveActionHelper { + public static validateDropTarget = (item: TreeNodeDisplay, oldPath: FileSystemPath, newPath: FileSystemPath): boolean => { + if (item.storeId === FILE_SYSTEM_TYPE_KAITAI) return; + if (oldPath.isTheSame(newPath)) { + return false; + } + if (oldPath.isNestedIn(newPath)) { + return false; + } + return true; + }; + + public static prepareOldAndNewPaths = (event: DragEvent, item: TreeNodeDisplay) => { + const droppedElementPathIdentifier = event.dataTransfer.getData("draggedFileTreeItem"); + const oldPath = FileSystemPath.fromFullPathWithStore(droppedElementPathIdentifier); + const isNodeFile = [TreeNodeDisplayType.BINARY_FILE, TreeNodeDisplayType.KSY_FILE].indexOf(item.type) !== -1; + let newPath; + if (isNodeFile) { + const pathParts = item.fullPath.split("/"); + pathParts.pop(); + newPath = FileSystemPath.of(item.storeId, pathParts.join("/")); + } else { + newPath = FileSystemPath.fromFullPathWithStore(item.fullPathWithStore); + } + + return [oldPath, newPath]; + }; +} + +export const FileTreeDragMoveAction = async (oldPath: FileSystemPath, newPath: FileSystemPath) => { + const lastDroppedPathElement = oldPath.getLastPathElement(); + const fileSystemsStore = useFileSystems(); + const filesToMoveFromDirectory = await fileSystemsStore.listAllItemsInPath(oldPath); + const oldPathIsFileOrEmptyDirectory = filesToMoveFromDirectory.length === 0; + try { + if (oldPathIsFileOrEmptyDirectory) { + const newPathCopy = newPath.clone(); + newPathCopy.append(lastDroppedPathElement); + await fileSystemsStore.move(oldPath, newPathCopy); + updateCurrentlyLoadedFilesIfNeeded(oldPath, newPathCopy); + fileSystemsStore.selectPath(newPathCopy); + } else { + for (const fileRelativePath of filesToMoveFromDirectory) { + const oldPathCopy = oldPath.clone(); + oldPathCopy.append(fileRelativePath); + + const newPathCopy = newPath.clone(); + newPathCopy.append(lastDroppedPathElement); + newPathCopy.append(fileRelativePath); + + await fileSystemsStore.move(oldPathCopy, newPathCopy); + updateCurrentlyLoadedFilesIfNeeded(oldPathCopy, newPathCopy); + } + fileSystemsStore.selectPath(newPath); + } + fileSystemsStore.openPath(newPath); + fileSystemsStore.deletePath(oldPath); + } catch (exception) { + console.log(exception); + } +}; \ No newline at end of file diff --git a/src/Components/FileTree/Actions/FileTreeMoveAction.ts b/src/Components/FileTree/Actions/FileTreeRenameAction.ts similarity index 78% rename from src/Components/FileTree/Actions/FileTreeMoveAction.ts rename to src/Components/FileTree/Actions/FileTreeRenameAction.ts index 5e575bd0..ed8242f6 100644 --- a/src/Components/FileTree/Actions/FileTreeMoveAction.ts +++ b/src/Components/FileTree/Actions/FileTreeRenameAction.ts @@ -2,7 +2,7 @@ import {FileSystemPath} from "../FileSystemsTypes"; import {useFileSystems} from "../Store/FileSystemsStore"; import {useAppStore} from "../../../Stores/AppStore"; -const updateCurrentlyLoadedFilesIfNeeded = (currentPath: FileSystemPath, newPath: FileSystemPath) => { +export const updateCurrentlyLoadedFilesIfNeeded = (currentPath: FileSystemPath, newPath: FileSystemPath) => { const fileSystemAppStore = useAppStore(); if (fileSystemAppStore.selectedKsyInfo.isPartOf(currentPath)) { const newCurrentlyLoadedFilePath = fileSystemAppStore.selectedKsyInfo.replacePathPart(currentPath, newPath); @@ -15,9 +15,9 @@ const updateCurrentlyLoadedFilesIfNeeded = (currentPath: FileSystemPath, newPath } }; -export const FileTreeMoveAction = async (oldPath: FileSystemPath, newPath: FileSystemPath) => { +export const FileTreeRenameAction = async (oldPath: FileSystemPath, newPath: FileSystemPath) => { const fileSystemsStore = useFileSystems(); await fileSystemsStore.move(oldPath, newPath); updateCurrentlyLoadedFilesIfNeeded(oldPath, newPath); - fileSystemsStore.selectPath(newPath) -} \ No newline at end of file + fileSystemsStore.selectPath(newPath); +}; \ No newline at end of file diff --git a/src/Components/FileTree/ContextMenu/Actions/FileTreeCtxActionRename.ts b/src/Components/FileTree/ContextMenu/Actions/FileTreeCtxActionRename.ts index 3e3d7695..b631ad7b 100644 --- a/src/Components/FileTree/ContextMenu/Actions/FileTreeCtxActionRename.ts +++ b/src/Components/FileTree/ContextMenu/Actions/FileTreeCtxActionRename.ts @@ -6,7 +6,7 @@ import {useTextModalInputStore} from "../../../Modals/TextInputModal/TextInputMo import {useAppStore} from "../../../../Stores/AppStore"; import {FileSystemPath} from "../../FileSystemsTypes"; import {FILE_SYSTEM_TYPE_KAITAI} from "../../FileSystems/KaitaiFileSystem"; -import {FileTreeMoveAction} from "../../Actions/FileTreeMoveAction"; +import {FileTreeRenameAction} from "../../Actions/FileTreeRenameAction"; export const FileTreeCtxActionRename = (item: TreeNodeDisplay): MenuItem => { @@ -21,7 +21,7 @@ export const FileTreeCtxActionRename = (item: TreeNodeDisplay): MenuItem => { const oldPath = FileSystemPath.fromFullPathWithStore(item.fullPathWithStore); const newPath = FileSystemPath.of(item.storeId, newFullPathString); - FileTreeMoveAction(oldPath, newPath); + FileTreeRenameAction(oldPath, newPath); }, }); }; diff --git a/src/Components/FileTree/FileSystemVisitors/FileSystemFilesCollector.ts b/src/Components/FileTree/FileSystemVisitors/FileSystemFilesCollector.ts index b09fd99a..c9489a2e 100644 --- a/src/Components/FileTree/FileSystemVisitors/FileSystemFilesCollector.ts +++ b/src/Components/FileTree/FileSystemVisitors/FileSystemFilesCollector.ts @@ -2,6 +2,7 @@ import {FileSystemItem, ITEM_MODE_DIRECTORY, ITEM_MODE_FILE} from "../FileSystem export class FileSystemFilesCollector { public static collectFileNames(fsItem: FileSystemItem): string[] { + if (!fsItem) return []; return new FileSystemFilesCollector().collectFiles(fsItem); } diff --git a/src/Components/FileTree/FileSystemVisitors/FileSystemPathCollector.ts b/src/Components/FileTree/FileSystemVisitors/FileSystemPathCollector.ts new file mode 100644 index 00000000..813d72f6 --- /dev/null +++ b/src/Components/FileTree/FileSystemVisitors/FileSystemPathCollector.ts @@ -0,0 +1,64 @@ +import {FileSystemItem, ITEM_MODE_DIRECTORY, ITEM_MODE_FILE} from "../FileSystemsTypes"; + +export class FileSystemPathCollector { + public static collectPaths(fsItem: FileSystemItem): string[] { + if (fsItem === null) return []; + return new FileSystemPathCollector().collectFiles(fsItem); + } + + private readonly collectedPaths: string[]; + private currentPathParts: string[] = []; + + private constructor() { + this.collectedPaths = []; + } + + private collectFiles(fsItem: FileSystemItem) { + this.visitRootNode(fsItem); + return this.collectedPaths; + } + + private pushCurrentPath() { + this.collectedPaths.push(this.currentPathParts.join("/")); + } + + private visitRootNode(fsItem: FileSystemItem) { + if (fsItem.type === ITEM_MODE_FILE) { + return; + } else { + this.visitChildren(fsItem); + } + } + + private visitChildren(fsItem: FileSystemItem) { + const children = Object.entries(fsItem.children || {}); + + children.forEach(([key, child]) => { + this.visitNode(key, child); + }); + } + + private visitNode(key: string, fsItem: FileSystemItem) { + this.currentPathParts.push(key); + + switch (fsItem.type) { + case ITEM_MODE_FILE: { + this.pushCurrentPath(); + break; + } + case ITEM_MODE_DIRECTORY: { + const children = Object.entries(fsItem.children || {}); + if (children.length === 0) { + this.pushCurrentPath(); + } else { + this.visitChildren(fsItem); + } + break; + } + } + + this.currentPathParts.pop(); + + } + +} \ No newline at end of file diff --git a/src/Components/FileTree/FileSystems/KaitaiFileSystem.ts b/src/Components/FileTree/FileSystems/KaitaiFileSystem.ts index a1c55f5f..385a56ab 100644 --- a/src/Components/FileTree/FileSystems/KaitaiFileSystem.ts +++ b/src/Components/FileTree/FileSystems/KaitaiFileSystem.ts @@ -41,9 +41,12 @@ export class KaitaiFileSystem implements FileSystem { return Promise.reject("KaitaiFileSystem.delete is not supported!"); } - move(oldPath: string, newPath: string): Promise { + listAllFilesInPath(path: string): Promise { return Promise.reject("KaitaiFileSystem.move is not supported!"); + } + move(oldPath: string, newPath: string): Promise { + return Promise.reject("KaitaiFileSystem.move is not supported!"); } } diff --git a/src/Components/FileTree/FileSystems/LocalStorageFileSystem.ts b/src/Components/FileTree/FileSystems/LocalStorageFileSystem.ts index 7ccc5ed7..7b22e396 100644 --- a/src/Components/FileTree/FileSystems/LocalStorageFileSystem.ts +++ b/src/Components/FileTree/FileSystems/LocalStorageFileSystem.ts @@ -2,6 +2,7 @@ import {FsItemHelper} from "../Utils/FsItemHelper"; import {FileSystem, FileSystemItem, ITEM_MODE_DIRECTORY, ITEM_MODE_FILE} from "../FileSystemsTypes"; import {LocalForageForLocalStorageWrapper} from "../Utils/LocalForageForLocalStorageWrapper"; import {toRaw} from "vue"; +import {FileSystemPathCollector} from "../FileSystemVisitors/FileSystemPathCollector"; export const FILE_SYSTEM_TYPE_LOCAL = "local"; @@ -84,15 +85,21 @@ export class LocalStorageFileSystem implements FileSystem { const newPathInfo = FsItemHelper.getInfoAboutPath(this.root, newPath); delete oldPathInfo.parentNode.children[oldPathInfo.nodeName]; newPathInfo.parentNode.children[newPathInfo.nodeName] = oldPathInfo.node; - if(oldPathInfo.node.type === ITEM_MODE_FILE) { - const oldFileForageKey = LocalStorageFileSystem.fileLocalForageKey(oldPathInfo.nodeName) - const newFileForageKey = LocalStorageFileSystem.fileLocalForageKey(newPathInfo.nodeName) - const content = await LocalForageForLocalStorageWrapper.getFile(oldFileForageKey) - await LocalForageForLocalStorageWrapper.saveFile(newFileForageKey, content) + if (oldPathInfo.node.type === ITEM_MODE_FILE) { + const oldFileForageKey = LocalStorageFileSystem.fileLocalForageKey(oldPathInfo.nodeName); + const newFileForageKey = LocalStorageFileSystem.fileLocalForageKey(newPathInfo.nodeName); + const content = await LocalForageForLocalStorageWrapper.getFile(oldFileForageKey); + await LocalForageForLocalStorageWrapper.saveFile(newFileForageKey, content); } await this.updateTreeInDatabase(); return Promise.resolve(undefined); } - + listAllFilesInPath(path: string): Promise { + if (path === "") { + return Promise.resolve(FileSystemPathCollector.collectPaths(this.root)); + } + const foundFolder = FsItemHelper.findNodeInRoot(this.root, path.split("/")); + return Promise.resolve(FileSystemPathCollector.collectPaths(foundFolder)); + } } \ No newline at end of file diff --git a/src/Components/FileTree/FileSystemsTypes.ts b/src/Components/FileTree/FileSystemsTypes.ts index 67b3b1c5..9f941177 100644 --- a/src/Components/FileTree/FileSystemsTypes.ts +++ b/src/Components/FileTree/FileSystemsTypes.ts @@ -25,7 +25,11 @@ export class FileSystemPath { } public isInTheSameStore(other: FileSystemPath) { - return this.storeId === other.storeId + return this.storeId === other.storeId; + } + + public clone() { + return FileSystemPath.of(this.storeId, this.path); } public isTheSame(other: FileSystemPath) { @@ -38,10 +42,41 @@ export class FileSystemPath { this.path.startsWith(other.path); } + public isNestedIn(other: FileSystemPath) { + if (this.storeId !== other.storeId) { + return false; + } + const pathABCParts = this.path.split("/"); + const pathABCDEParts = other.path.split("/"); + if(pathABCDEParts.length < pathABCParts.length) { + return false; + } + for (let i = 0; i < pathABCParts.length; ++i) { + if(pathABCParts[i] !== pathABCDEParts[i]) return false; + } + return true; + } + + public getLastPathElement() { + const pathParts = this.path.split("/"); + return pathParts[pathParts.length - 1]; + } + + public append(pathPart: string) { + if (!pathPart || pathPart.length === 0) return; + if (this.path.length === 0) { + this.path += pathPart; + } else { + console.log(this.path, pathPart); + this.path += `/${pathPart}`; + } + } + public replacePathPart(oldFragment: FileSystemPath, newFragment: FileSystemPath): FileSystemPath { const newPath = this.path.replace(oldFragment.path, newFragment.path); return FileSystemPath.of(this.storeId, newPath); } + public toString() { return `${this.storeId}:${this.path}`; } @@ -60,5 +95,7 @@ export interface FileSystem { delete(filePath: string): Promise; + listAllFilesInPath(path: string): Promise; + move(oldPath: string, newPath: string): Promise; } diff --git a/src/Components/FileTree/FileTreeNode.vue b/src/Components/FileTree/FileTreeNode.vue index 22d20027..09bd3eb9 100644 --- a/src/Components/FileTree/FileTreeNode.vue +++ b/src/Components/FileTree/FileTreeNode.vue @@ -2,11 +2,13 @@ import {useFileSystems} from "./Store/FileSystemsStore"; import {TreeNodeDisplay, TreeNodeDisplayType} from "./FileSystemVisitors/FileSystemFileTreeMapper"; import FileStoreTreeNodeIcon from "./FileTreeNodeIcon.vue"; -import {computed, toRaw} from "vue"; +import {computed, ref, toRaw} from "vue"; import {useAppStore} from "../../Stores/AppStore"; import ContextMenu from "@imengyu/vue3-context-menu"; import {prepareContextMenuOptions} from "./ContextMenu/FileTreeNodeContextMenu"; import {FileSystemPath} from "./FileSystemsTypes"; +import {FILE_SYSTEM_TYPE_KAITAI} from "./FileSystems/KaitaiFileSystem"; +import {FileTreeDragMoveAction, FileTreeDragMoveActionHelper,} from "./Actions/FileTreeDragMoveAction"; const store = useFileSystems(); const appStore = useAppStore(); @@ -14,6 +16,8 @@ const props = defineProps<{ item: TreeNodeDisplay }>(); +const draggingOver = ref(false); + const activateRow = () => { store.selectPath(FileSystemPath.fromFullPathWithStore(props.item.fullPathWithStore)); }; @@ -56,16 +60,48 @@ const isSelected = computed(() => { const nodeFileIsLoadedInEditor = computed(() => { return appStore.selectedBinaryInfo.toString() === props.item.fullPathWithStore - || appStore.selectedKsyInfo.toString() === props.item.fullPathWithStore -}) + || appStore.selectedKsyInfo.toString() === props.item.fullPathWithStore; +}); + + +const drop = async (event: DragEvent) => { + event.preventDefault(); + draggingOver.value = false; + const [oldPath, newPath] = FileTreeDragMoveActionHelper.prepareOldAndNewPaths(event, props.item); + const canDrop = FileTreeDragMoveActionHelper.validateDropTarget(props.item, oldPath, newPath); + if (!canDrop) return; + FileTreeDragMoveAction(oldPath, newPath); +}; + +const dragStart = (event: DragEvent) => { + event.dataTransfer.setData("draggedFileTreeItem", props.item.fullPathWithStore); + store.selectPath(FileSystemPath.fromFullPathWithStore(props.item.fullPathWithStore)); +}; + +const dragOver = (event: DragEvent) => { + event.preventDefault(); + const [oldPath, newPath] = FileTreeDragMoveActionHelper.prepareOldAndNewPaths(event, props.item); + draggingOver.value = FileTreeDragMoveActionHelper.validateDropTarget(props.item, oldPath, newPath); +}; +const dragLeave = (event: DragEvent) => { + event.preventDefault(); + draggingOver.value = false; +};