diff --git a/extension/bwcontest/.prettierignore b/extension/bwcontest/.prettierignore new file mode 100644 index 0000000..baa198e --- /dev/null +++ b/extension/bwcontest/.prettierignore @@ -0,0 +1,2 @@ +node_modules +compiled \ No newline at end of file diff --git a/extension/bwcontest/.prettierrc b/extension/bwcontest/.prettierrc index 5a8ba17..9573023 100644 --- a/extension/bwcontest/.prettierrc +++ b/extension/bwcontest/.prettierrc @@ -1,8 +1,8 @@ { - "tabWidth": 2, - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "pluginSearchDirs": ["."] + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/extension/bwcontest/.vscode/extensions.json b/extension/bwcontest/.vscode/extensions.json index 978d630..e6cd984 100644 --- a/extension/bwcontest/.vscode/extensions.json +++ b/extension/bwcontest/.vscode/extensions.json @@ -1,5 +1,3 @@ { - "recommendations": [ - "dbaeumer.vscode-eslint" - ] + "recommendations": ["dbaeumer.vscode-eslint"] } diff --git a/extension/bwcontest/.vscode/launch.json b/extension/bwcontest/.vscode/launch.json index 9f7d2aa..6f400d7 100644 --- a/extension/bwcontest/.vscode/launch.json +++ b/extension/bwcontest/.vscode/launch.json @@ -5,12 +5,8 @@ "name": "Run Extension", "type": "extensionHost", "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ], - "outFiles": [ - "${workspaceFolder}/out/**/*.js" - ], - }, + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"] + } ] } diff --git a/extension/bwcontest/.vscode/settings.json b/extension/bwcontest/.vscode/settings.json index 4a965dc..19e321a 100644 --- a/extension/bwcontest/.vscode/settings.json +++ b/extension/bwcontest/.vscode/settings.json @@ -1,9 +1,9 @@ { - "files.exclude": { - "out": false - }, - "search.exclude": { - "out": true - }, - "typescript.tsc.autoDetect": "off" -} \ No newline at end of file + "files.exclude": { + "out": false + }, + "search.exclude": { + "out": true + }, + "typescript.tsc.autoDetect": "off" +} diff --git a/extension/bwcontest/package-lock.json b/extension/bwcontest/package-lock.json index 13f1fc5..b4b7c36 100644 --- a/extension/bwcontest/package-lock.json +++ b/extension/bwcontest/package-lock.json @@ -11,28 +11,31 @@ "@vscode/vsce": "^2.21.1", "axios": "^1.5.1", "fs-extra": "^11.1.1", - "tree-kill": "^1.2.2" + "tree-kill": "^1.2.2", + "url-join": "^5.0.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-node-resolve": "^15.2.1", - "@rollup/plugin-terser": "^0.4.3", - "@rollup/plugin-typescript": "^11.1.4", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^11.1.5", "@tsconfig/svelte": "^5.0.2", "@types/fs-extra": "^11.0.2", "@types/glob": "^8.1.0", "@types/mocha": "^10.0.2", "@types/node": "20.x", - "@types/vscode": "^1.82.0", - "@typescript-eslint/eslint-plugin": "^6.7.4", - "@typescript-eslint/parser": "^6.7.4", - "@vscode/test-electron": "^2.3.4", + "@types/vscode": "^1.83.0", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", + "@vscode/test-electron": "^2.3.5", "concurrently": "^8.2.1", "esbuild": "^0.19.4", - "eslint": "^8.50.0", + "eslint": "^8.51.0", "glob": "^10.3.10", "mocha": "^10.2.0", "postcss": "^8.4.31", + "prettier": "^3.0.3", + "prettier-plugin-svelte": "^3.0.3", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-svelte": "^7.1.6", @@ -42,7 +45,7 @@ "typescript": "^5.2.2" }, "engines": { - "vscode": "^1.81.0" + "vscode": "^1.83.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -479,9 +482,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.50.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", - "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", + "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -726,9 +729,9 @@ } }, "node_modules/@rollup/plugin-commonjs": { - "version": "25.0.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.4.tgz", - "integrity": "sha512-L92Vz9WUZXDnlQQl3EwbypJR4+DM2EbsO+/KOcEkP4Mc6Ct453EeDB2uH9lgRwj4w5yflgNpq9pHOiY8aoUXBQ==", + "version": "25.0.7", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", + "integrity": "sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", @@ -736,13 +739,13 @@ "estree-walker": "^2.0.2", "glob": "^8.0.3", "is-reference": "1.2.1", - "magic-string": "^0.27.0" + "magic-string": "^0.30.3" }, "engines": { "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^2.68.0||^3.0.0" + "rollup": "^2.68.0||^3.0.0||^4.0.0" }, "peerDependenciesMeta": { "rollup": { @@ -778,6 +781,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/@rollup/plugin-commonjs/node_modules/magic-string": { + "version": "0.30.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz", + "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@rollup/plugin-commonjs/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -791,9 +806,9 @@ } }, "node_modules/@rollup/plugin-node-resolve": { - "version": "15.2.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.1.tgz", - "integrity": "sha512-nsbUg588+GDSu8/NS8T4UAshO6xeaOfINNuXeVHcKV02LJtoRaM1SiOacClw4kws1SFiNhdLGxlbMY9ga/zs/w==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz", + "integrity": "sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", @@ -807,7 +822,7 @@ "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^2.78.0||^3.0.0" + "rollup": "^2.78.0||^3.0.0||^4.0.0" }, "peerDependenciesMeta": { "rollup": { @@ -816,9 +831,9 @@ } }, "node_modules/@rollup/plugin-terser": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.3.tgz", - "integrity": "sha512-EF0oejTMtkyhrkwCdg0HJ0IpkcaVg1MMSf2olHb2Jp+1mnLM04OhjpJWGma4HobiDTF0WCyViWuvadyE9ch2XA==", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", "dev": true, "dependencies": { "serialize-javascript": "^6.0.1", @@ -829,7 +844,7 @@ "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^2.x || ^3.x" + "rollup": "^2.0.0||^3.0.0||^4.0.0" }, "peerDependenciesMeta": { "rollup": { @@ -847,9 +862,9 @@ } }, "node_modules/@rollup/plugin-typescript": { - "version": "11.1.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.4.tgz", - "integrity": "sha512-WZRh5LBVLQXdKFICUId5J3eIpmjGURaBqntfg3GSZACgeOAFS+lOSMGTwfzDkELTaZVp/lWdMVNU3UkwCUBg/Q==", + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz", + "integrity": "sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", @@ -859,7 +874,7 @@ "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^2.14.0||^3.0.0", + "rollup": "^2.14.0||^3.0.0||^4.0.0", "tslib": "*", "typescript": ">=3.7.0" }, @@ -996,22 +1011,22 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.82.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.82.0.tgz", - "integrity": "sha512-VSHV+VnpF8DEm8LNrn8OJ8VuUNcBzN3tMvKrNpbhhfuVjFm82+6v44AbDhLvVFgCzn6vs94EJNTp7w8S6+Q1Rw==", + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.83.0.tgz", + "integrity": "sha512-3mUtHqLAVz9hegut9au4xehuBrzRE3UJiQMpoEHkNl6XHliihO7eATx2BMHs0odsmmrwjJrlixx/Pte6M3ygDQ==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.4.tgz", - "integrity": "sha512-DAbgDXwtX+pDkAHwiGhqP3zWUGpW49B7eqmgpPtg+BKJXwdct79ut9+ifqOFPJGClGKSHXn2PTBatCnldJRUoA==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz", + "integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.7.4", - "@typescript-eslint/type-utils": "6.7.4", - "@typescript-eslint/utils": "6.7.4", - "@typescript-eslint/visitor-keys": "6.7.4", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/type-utils": "6.7.5", + "@typescript-eslint/utils": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1037,15 +1052,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.4.tgz", - "integrity": "sha512-I5zVZFY+cw4IMZUeNCU7Sh2PO5O57F7Lr0uyhgCJmhN/BuTlnc55KxPonR4+EM3GBdfiCyGZye6DgMjtubQkmA==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz", + "integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.7.4", - "@typescript-eslint/types": "6.7.4", - "@typescript-eslint/typescript-estree": "6.7.4", - "@typescript-eslint/visitor-keys": "6.7.4", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4" }, "engines": { @@ -1065,13 +1080,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.4.tgz", - "integrity": "sha512-SdGqSLUPTXAXi7c3Ob7peAGVnmMoGzZ361VswK2Mqf8UOYcODiYvs8rs5ILqEdfvX1lE7wEZbLyELCW+Yrql1A==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz", + "integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.4", - "@typescript-eslint/visitor-keys": "6.7.4" + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1082,13 +1097,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.4.tgz", - "integrity": "sha512-n+g3zi1QzpcAdHFP9KQF+rEFxMb2KxtnJGID3teA/nxKHOVi3ylKovaqEzGBbVY2pBttU6z85gp0D00ufLzViQ==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz", + "integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.7.4", - "@typescript-eslint/utils": "6.7.4", + "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/utils": "6.7.5", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1109,9 +1124,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.4.tgz", - "integrity": "sha512-o9XWK2FLW6eSS/0r/tgjAGsYasLAnOWg7hvZ/dGYSSNjCh+49k5ocPN8OmG5aZcSJ8pclSOyVKP2x03Sj+RrCA==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz", + "integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1122,13 +1137,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.4.tgz", - "integrity": "sha512-ty8b5qHKatlNYd9vmpHooQz3Vki3gG+3PchmtsA4TgrZBKWHNjWfkQid7K7xQogBqqc7/BhGazxMD5vr6Ha+iQ==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz", + "integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.4", - "@typescript-eslint/visitor-keys": "6.7.4", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1149,17 +1164,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.4.tgz", - "integrity": "sha512-PRQAs+HUn85Qdk+khAxsVV+oULy3VkbH3hQ8hxLRJXWBEd7iI+GbQxH5SEUSH7kbEoTp6oT1bOwyga24ELALTA==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz", + "integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.7.4", - "@typescript-eslint/types": "6.7.4", - "@typescript-eslint/typescript-estree": "6.7.4", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/typescript-estree": "6.7.5", "semver": "^7.5.4" }, "engines": { @@ -1174,12 +1189,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.7.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.4.tgz", - "integrity": "sha512-pOW37DUhlTZbvph50x5zZCkFn3xzwkGtNoJHzIM3svpiSkJzwOYr/kVBaXmf+RAQiUDs1AHEZVNPg6UJCJpwRA==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz", + "integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.4", + "@typescript-eslint/types": "6.7.5", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1191,9 +1206,9 @@ } }, "node_modules/@vscode/test-electron": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.4.tgz", - "integrity": "sha512-eWzIqXMhvlcoXfEFNWrVu/yYT5w6De+WZXR/bafUQhAp8+8GkQo95Oe14phwiRUPv8L+geAKl/QM2+PoT3YW3g==", + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.5.tgz", + "integrity": "sha512-lAW7nQ0HuPqJnGJrtCzEKZCICtRizeP6qNanyCrjmdCOAAWjX3ixiG8RVPwqsYPQBWLPgYuE12qQlwXsOR/2fQ==", "dev": true, "dependencies": { "http-proxy-agent": "^4.0.1", @@ -1332,6 +1347,11 @@ "node": ">=4" } }, + "node_modules/@vscode/vsce/node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -2587,15 +2607,15 @@ } }, "node_modules/eslint": { - "version": "8.50.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", - "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", + "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.50.0", + "@eslint/js": "8.51.0", "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -5073,6 +5093,31 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-svelte": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.3.tgz", + "integrity": "sha512-dLhieh4obJEK1hnZ6koxF+tMUrZbV5YGvRpf2+OADyanjya5j0z1Llo8iGwiHmFWZVG/hLEw/AJD5chXd9r3XA==", + "dev": true, + "peerDependencies": { + "prettier": "^3.0.0", + "svelte": "^3.2.0 || ^4.0.0-next.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -6292,9 +6337,12 @@ } }, "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz", + "integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } }, "node_modules/util-deprecate": { "version": "1.0.2", diff --git a/extension/bwcontest/package.json b/extension/bwcontest/package.json index 8524439..2eab73e 100644 --- a/extension/bwcontest/package.json +++ b/extension/bwcontest/package.json @@ -4,7 +4,7 @@ "description": "The student extension for BW's HSPC", "version": "0.0.1", "engines": { - "vscode": "^1.81.0" + "vscode": "^1.83.0" }, "categories": [ "Other" @@ -57,46 +57,38 @@ } ] }, - "commands": [ - { - "command": "bwcontest.helloWorld", - "category": "BWContest", - "title": "Hello World" - }, - { - "command": "bwcontest.askQuestion", - "category": "BWContest", - "title": "Ask Question" - } - ] + "commands": [] }, "scripts": { "vscode:prepublish": "npm run compile", "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node", "esbuild": "npm run esbuild-base -- --sourcemap", "compile": "rollup -c && npm run esbuild-base -- --minify", + "format": "prettier --plugin prettier-plugin-svelte --write .", "watch": "concurrently \"rollup -c -w\" \"npm run esbuild-base -- --sourcemap --watch\"" }, "devDependencies": { - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-node-resolve": "^15.2.1", - "@rollup/plugin-terser": "^0.4.3", - "@rollup/plugin-typescript": "^11.1.4", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^11.1.5", "@tsconfig/svelte": "^5.0.2", "@types/fs-extra": "^11.0.2", "@types/glob": "^8.1.0", "@types/mocha": "^10.0.2", "@types/node": "20.x", - "@types/vscode": "^1.82.0", - "@typescript-eslint/eslint-plugin": "^6.7.4", - "@typescript-eslint/parser": "^6.7.4", - "@vscode/test-electron": "^2.3.4", + "@types/vscode": "^1.83.0", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", + "@vscode/test-electron": "^2.3.5", "concurrently": "^8.2.1", "esbuild": "^0.19.4", - "eslint": "^8.50.0", + "eslint": "^8.51.0", "glob": "^10.3.10", "mocha": "^10.2.0", "postcss": "^8.4.31", + "prettier": "^3.0.3", + "prettier-plugin-svelte": "^3.0.3", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-svelte": "^7.1.6", @@ -109,6 +101,7 @@ "@vscode/vsce": "^2.21.1", "axios": "^1.5.1", "fs-extra": "^11.1.1", - "tree-kill": "^1.2.2" + "tree-kill": "^1.2.2", + "url-join": "^5.0.0" } } diff --git a/extension/bwcontest/rollup.config.js b/extension/bwcontest/rollup.config.js index 9a6b643..24180a5 100644 --- a/extension/bwcontest/rollup.config.js +++ b/extension/bwcontest/rollup.config.js @@ -1,49 +1,47 @@ -import svelte from "rollup-plugin-svelte"; -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; -import terser from "@rollup/plugin-terser"; -import sveltePreprocess from "svelte-preprocess"; -import typescript from "@rollup/plugin-typescript"; -import path from "path"; -import fs from "fs"; -import css from "rollup-plugin-css-only"; +import svelte from 'rollup-plugin-svelte'; +import resolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import terser from '@rollup/plugin-terser'; +import sveltePreprocess from 'svelte-preprocess'; +import typescript from '@rollup/plugin-typescript'; +import path from 'path'; +import fs from 'fs'; +import css from 'rollup-plugin-css-only'; const production = !process.env.ROLLUP_WATCH; -export default fs - .readdirSync(path.join(__dirname, "webviews", "pages")) - .map((input) => { - const name = input.split(".")[0]; - return { - input: "webviews/pages/" + input, - output: { - format: "iife", - name: "app", - file: "out/compiled/" + name + ".js", - }, - plugins: [ - svelte({ - // enable run-time checks when not in production - compilerOptions: { - dev: !production - }, - preprocess: sveltePreprocess(), - emitCss: true - }), - css({ output: name + ".css" }), - resolve({ - browser: true, - dedupe: ["svelte"], - }), - commonjs(), - typescript({ - tsconfig: "webviews/tsconfig.json", - inlineSources: !production, - }), - production && terser(), - ], - watch: { - clearScreen: false, - }, - }; - }); +export default fs.readdirSync(path.join(__dirname, 'webviews', 'pages')).map((input) => { + const name = input.split('.')[0]; + return { + input: 'webviews/pages/' + input, + output: { + format: 'iife', + name: 'app', + file: 'out/compiled/' + name + '.js' + }, + plugins: [ + svelte({ + // enable run-time checks when not in production + compilerOptions: { + dev: !production + }, + preprocess: sveltePreprocess(), + emitCss: true + }), + css({ output: name + '.css' }), + resolve({ + browser: true, + dedupe: ['svelte'] + }), + commonjs(), + typescript({ + tsconfig: 'webviews/tsconfig.json', + inlineSources: !production + }), + production && terser() + ], + watch: { + clearScreen: false + } + }; +}); diff --git a/extension/bwcontest/src/SidebarProvider.ts b/extension/bwcontest/src/SidebarProvider.ts index a6a4dbe..883fa7a 100644 --- a/extension/bwcontest/src/SidebarProvider.ts +++ b/extension/bwcontest/src/SidebarProvider.ts @@ -2,43 +2,44 @@ import * as vscode from 'vscode'; import { getNonce } from './getNonce'; import { cloneAndOpenRepo } from './extension'; import { BWPanel } from './problemPanel'; +import urlJoin from 'url-join'; export class SidebarProvider implements vscode.WebviewViewProvider { - _view?: vscode.WebviewView; - _context?: vscode.ExtensionContext; - - constructor(private readonly _extensionUri: vscode.Uri, context: vscode.ExtensionContext) { - this._context = context; - } + constructor( + private readonly extensionUri: vscode.Uri, + private readonly context: vscode.ExtensionContext, + private readonly webUrl: string + ) {} public resolveWebviewView(webviewView: vscode.WebviewView) { - this._view = webviewView; - - webviewView.webview.options = { - // Allow scripts in the webview + const webview = webviewView.webview; + webview.options = { enableScripts: true, - - localResourceRoots: [this._extensionUri] + localResourceRoots: [this.extensionUri] }; + webview.html = this.getHtmlForWebview(webview); - webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); - - webviewView.webview.onDidReceiveMessage(async (data) => { + webview.onDidReceiveMessage(async (data: { type: string; value: any }) => { switch (data.type) { case 'onTestAndSubmit': { - if (this._context) { - BWPanel.createOrShow(this._context); + if (this.context) { + BWPanel.createOrShow(this.context, this.webUrl); } break; } case 'onStartup': { - const token: string | undefined = this._context?.globalState.get('token'); - if (token) { - this._view?.webview.postMessage({ - type: 'onSession', - value: token + const token: string | undefined = this.context.globalState.get('token'); + const teamData = this.context.globalState.get('teamData'); + if (token && teamData !== undefined) { + webview.postMessage({ + type: 'onLogin', + value: teamData }); } + webview.postMessage({ + type: 'onWebUrl', + value: this.webUrl + }); break; } case 'onClone': { @@ -48,15 +49,56 @@ export class SidebarProvider implements vscode.WebviewViewProvider { await cloneAndOpenRepo(parseInt(data.value.contestId), parseInt(data.value.teamId)); break; } - case 'onLogin': { - if (!data.value) { + case 'requestLogin': { + const res = await fetch(urlJoin(this.webUrl, '/api/team/login'), { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + teamname: data.value.teamname, + password: data.value.password + }) + }); + const thing = await res.json(); + if (thing.success !== true) { return; } - this._context?.globalState.update('token', data.value); + const sessionToken = thing.token; + this.context.globalState.update('token', sessionToken); + const res1 = await fetch(urlJoin(this.webUrl, `api/team/${sessionToken}`), { + method: 'GET' + }); + const data2 = await res1.json(); + if (!data2.success) { + return; + } + this.context.globalState.update('teamData', data2.data); + webview.postMessage({ type: 'onLogin', value: data2.data }); + break; + } + case 'requestLogout': { + const sessionToken = this.context.globalState.get('token'); + if (sessionToken === undefined) { + webview.postMessage({ type: 'onLogout' }); + } + const res = await fetch(urlJoin(this.webUrl, '/api/team/logout'), { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + token: sessionToken + }) + }); + if (res.status !== 200) { + return; + } + const data2 = await res.json(); + if (data2.success === true) { + webview.postMessage({ type: 'onLogout' }); + this.context.globalState.update('token', undefined); + } break; } case 'onLogout': { - this._context?.globalState.update('token', null); + this.context.globalState.update('token', null); break; } case 'onInfo': { @@ -77,19 +119,19 @@ export class SidebarProvider implements vscode.WebviewViewProvider { }); } - private _getHtmlForWebview(webview: vscode.Webview) { + private getHtmlForWebview(webview: vscode.Webview) { const styleResetUri = webview.asWebviewUri( - vscode.Uri.joinPath(this._extensionUri, 'media', 'reset.css') + vscode.Uri.joinPath(this.extensionUri, 'media', 'reset.css') ); const styleVSCodeUri = webview.asWebviewUri( - vscode.Uri.joinPath(this._extensionUri, 'media', 'vscode.css') + vscode.Uri.joinPath(this.extensionUri, 'media', 'vscode.css') ); const scriptUri = webview.asWebviewUri( - vscode.Uri.joinPath(this._extensionUri, 'out', 'compiled/sidebar.js') + vscode.Uri.joinPath(this.extensionUri, 'out', 'compiled/sidebar.js') ); const styleMainUri = webview.asWebviewUri( - vscode.Uri.joinPath(this._extensionUri, 'out', 'compiled/sidebar.css') + vscode.Uri.joinPath(this.extensionUri, 'out', 'compiled/sidebar.css') ); // Use a nonce to only allow a specific script to be run. diff --git a/extension/bwcontest/src/extension.ts b/extension/bwcontest/src/extension.ts index 1392e77..25c9d72 100644 --- a/extension/bwcontest/src/extension.ts +++ b/extension/bwcontest/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import { SidebarProvider } from './SidebarProvider'; import * as child_process from 'child_process'; import * as fs from 'fs-extra'; -import { BWPanel } from './problemPanel'; +import urlJoin from 'url-join'; export interface BWContestSettings { repoBaseUrl: string; @@ -41,8 +41,12 @@ export async function cloneAndOpenRepo(contestId: number, teamId: number) { vscode.window.showErrorMessage('BWContest: BWContest.webUrl not set'); return; } - - const repoUrl = `${currentSettings.repoBaseUrl}/${contestId.toString()}/${teamId.toString()}.git`; + + const repoUrl = urlJoin( + currentSettings.repoBaseUrl, + contestId.toString(), + `${teamId.toString()}.git` + ); const repoName = repoUrl.split('/').pop()?.replace('.git', '')!; @@ -96,27 +100,14 @@ export async function cloneAndOpenRepo(contestId: number, teamId: number) { } export function activate(context: vscode.ExtensionContext) { - const sidebarProvider = new SidebarProvider(context.extensionUri, context); + const sidebarProvider = new SidebarProvider( + context.extensionUri, + context, + extensionSettings().webUrl + ); context.subscriptions.push( vscode.window.registerWebviewViewProvider('bwcontest-sidebar', sidebarProvider) ); - - context.subscriptions.push( - vscode.commands.registerCommand('bwcontest.helloWorld', () => { - BWPanel.createOrShow(context); - }) - ); - - context.subscriptions.push( - vscode.commands.registerCommand('bwcontest.askQuestion', async () => { - const answer = await vscode.window.showInformationMessage('How was your day?', 'good', 'bad'); - if (answer === 'bad') { - vscode.window.showInformationMessage('Sorry to hear that'); - } else { - console.log(answer); - } - }) - ); } export function deactivate() {} diff --git a/extension/bwcontest/src/problemPanel.ts b/extension/bwcontest/src/problemPanel.ts index abac8ea..924d9ce 100644 --- a/extension/bwcontest/src/problemPanel.ts +++ b/extension/bwcontest/src/problemPanel.ts @@ -20,7 +20,7 @@ export class BWPanel { private static _running: boolean; private static _kill: Function | null; - public static createOrShow(context: vscode.ExtensionContext) { + public static createOrShow(context: vscode.ExtensionContext, webUrl: string) { this._context = context; const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn @@ -51,7 +51,7 @@ export class BWPanel { } ); - BWPanel.currentPanel = new BWPanel(panel, context.extensionUri); + BWPanel.currentPanel = new BWPanel(panel, context.extensionUri, webUrl); } public static kill() { @@ -59,11 +59,11 @@ export class BWPanel { BWPanel.currentPanel = undefined; } - public static revive(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) { - BWPanel.currentPanel = new BWPanel(panel, extensionUri); + public static revive(panel: vscode.WebviewPanel, extensionUri: vscode.Uri, webUrl: string) { + BWPanel.currentPanel = new BWPanel(panel, extensionUri, webUrl); } - private constructor(panel: vscode.WebviewPanel, extensionUri: vscode.Uri) { + private constructor(panel: vscode.WebviewPanel, extensionUri: vscode.Uri, webUrl: string) { this._panel = panel; this._extensionUri = extensionUri; this._update(); diff --git a/extension/bwcontest/webviews/components/ProblemPanel.svelte b/extension/bwcontest/webviews/components/ProblemPanel.svelte index 5cdb901..703aec4 100644 --- a/extension/bwcontest/webviews/components/ProblemPanel.svelte +++ b/extension/bwcontest/webviews/components/ProblemPanel.svelte @@ -1,187 +1,216 @@

Test & Submit Problems

{#if problemData} -
- {#each problemData as problem} - - {/each} -
+
+ {#each problemData as problem} + + {/each} +
{/if} {#if activeProblem} -

{activeProblem.name}

-
-
-

Sample Input (You can edit this!)

-