This commit is contained in:
orosmatthew 2023-10-15 21:02:48 -04:00
commit 0019d37c38
13 changed files with 651 additions and 511 deletions

View File

@ -0,0 +1,2 @@
node_modules
compiled

View File

@ -1,8 +1,8 @@
{
"tabWidth": 2,
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"pluginSearchDirs": ["."]
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View File

@ -1,5 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
"recommendations": ["dbaeumer.vscode-eslint"]
}

View File

@ -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"]
}
]
}

View File

@ -11,28 +11,32 @@
"@vscode/vsce": "^2.21.1",
"axios": "^1.5.1",
"fs-extra": "^11.1.1",
"tree-kill": "^1.2.2"
"isomorphic-git": "^1.24.5",
"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 +46,7 @@
"typescript": "^5.2.2"
},
"engines": {
"vscode": "^1.81.0"
"vscode": "^1.83.0"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@ -479,9 +483,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 +730,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 +740,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 +782,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 +807,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 +823,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 +832,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 +845,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 +863,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 +875,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 +1012,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 +1053,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 +1081,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 +1098,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 +1125,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 +1138,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 +1165,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 +1190,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 +1207,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 +1348,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",
@ -1450,6 +1471,11 @@
"node": ">=8"
}
},
"node_modules/async-lock": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/async-lock/-/async-lock-1.4.0.tgz",
"integrity": "sha512-coglx5yIWuetakm3/1dsX9hxCNox22h7+V80RQOu2XUUMidtArxKoZoOtHUPuR84SycKTXzgGzAUR5hJxujyJQ=="
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -1931,6 +1957,11 @@
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
"optional": true
},
"node_modules/clean-git-ref": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/clean-git-ref/-/clean-git-ref-2.0.1.tgz",
"integrity": "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw=="
},
"node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -2114,6 +2145,17 @@
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"dev": true
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@ -2329,7 +2371,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
"optional": true,
"dependencies": {
"mimic-response": "^3.1.0"
},
@ -2408,6 +2449,11 @@
"node": ">=0.3.1"
}
},
"node_modules/diff3": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/diff3/-/diff3-0.0.3.tgz",
"integrity": "sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g=="
},
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@ -2587,15 +2633,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",
@ -3330,7 +3376,6 @@
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz",
"integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==",
"dev": true,
"engines": {
"node": ">= 4"
}
@ -3554,6 +3599,51 @@
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true
},
"node_modules/isomorphic-git": {
"version": "1.24.5",
"resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.24.5.tgz",
"integrity": "sha512-07M4YscftHZJIuw7xZhgWkdFvVjHSBJBsIwWXkxgFCivhb0l8mGNchM7nO2hU27EKSIf0sT4gJivEgLGohWbzA==",
"dependencies": {
"async-lock": "^1.1.0",
"clean-git-ref": "^2.0.1",
"crc-32": "^1.2.0",
"diff3": "0.0.3",
"ignore": "^5.1.4",
"minimisted": "^2.0.0",
"pako": "^1.0.10",
"pify": "^4.0.1",
"readable-stream": "^3.4.0",
"sha.js": "^2.4.9",
"simple-get": "^4.0.1"
},
"bin": {
"isogit": "cli.cjs"
},
"engines": {
"node": ">=12"
}
},
"node_modules/isomorphic-git/node_modules/pify": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
"engines": {
"node": ">=6"
}
},
"node_modules/isomorphic-git/node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/jackspeak": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
@ -3871,7 +3961,6 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
"optional": true,
"engines": {
"node": ">=10"
},
@ -3903,11 +3992,18 @@
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"devOptional": true,
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/minimisted": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/minimisted/-/minimisted-2.0.1.tgz",
"integrity": "sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA==",
"dependencies": {
"minimist": "^1.2.5"
}
},
"node_modules/minipass": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz",
@ -4252,8 +4348,7 @@
"node_modules/pako": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
"dev": true
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
},
"node_modules/parent-module": {
"version": "1.0.1",
@ -5073,6 +5168,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",
@ -5466,8 +5586,7 @@
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"devOptional": true
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/safe-identifier": {
"version": "0.4.2",
@ -5553,6 +5672,18 @@
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"dev": true
},
"node_modules/sha.js": {
"version": "2.4.11",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"dependencies": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
},
"bin": {
"sha.js": "bin.js"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -5625,8 +5756,7 @@
"type": "consulting",
"url": "https://feross.org/support"
}
],
"optional": true
]
},
"node_modules/simple-get": {
"version": "4.0.1",
@ -5646,7 +5776,6 @@
"url": "https://feross.org/support"
}
],
"optional": true,
"dependencies": {
"decompress-response": "^6.0.0",
"once": "^1.3.1",
@ -5728,7 +5857,6 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"devOptional": true,
"dependencies": {
"safe-buffer": "~5.1.0"
}
@ -6292,15 +6420,17 @@
}
},
"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",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"devOptional": true
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/which": {
"version": "2.0.2",

View File

@ -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,8 @@
"@vscode/vsce": "^2.21.1",
"axios": "^1.5.1",
"fs-extra": "^11.1.1",
"tree-kill": "^1.2.2"
"isomorphic-git": "^1.24.5",
"tree-kill": "^1.2.2",
"url-join": "^5.0.0"
}
}

View File

@ -1,25 +1,23 @@
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];
export default fs.readdirSync(path.join(__dirname, 'webviews', 'pages')).map((input) => {
const name = input.split('.')[0];
return {
input: "webviews/pages/" + input,
input: 'webviews/pages/' + input,
output: {
format: "iife",
name: "app",
file: "out/compiled/" + name + ".js",
format: 'iife',
name: 'app',
file: 'out/compiled/' + name + '.js'
},
plugins: [
svelte({
@ -30,20 +28,20 @@ export default fs
preprocess: sveltePreprocess(),
emitCss: true
}),
css({ output: name + ".css" }),
css({ output: name + '.css' }),
resolve({
browser: true,
dedupe: ["svelte"],
dedupe: ['svelte']
}),
commonjs(),
typescript({
tsconfig: "webviews/tsconfig.json",
inlineSources: !production,
tsconfig: 'webviews/tsconfig.json',
inlineSources: !production
}),
production && terser(),
production && terser()
],
watch: {
clearScreen: false,
},
clearScreen: false
}
};
});
});

View File

@ -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<string>('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.

View File

@ -1,8 +1,10 @@
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';
import git from 'isomorphic-git';
import path = require('path');
import http from 'isomorphic-git/http/node';
export interface BWContestSettings {
repoBaseUrl: string;
@ -42,7 +44,11 @@ export async function cloneAndOpenRepo(contestId: number, teamId: number) {
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', '')!;
@ -70,16 +76,10 @@ export async function cloneAndOpenRepo(contestId: number, teamId: number) {
fs.removeSync(clonedRepoPath);
}
child_process.exec(
`git clone ${repoUrl}`,
{ cwd: `${currentSettings.repoClonePath}/BWContest/${contestId.toString()}` },
(error, stdout, stderr) => {
if (error) {
vscode.window.showErrorMessage(`BWContest: Failed to clone repo: ${error.message}`);
return;
}
}
);
const dir = path.join(currentSettings.repoClonePath, 'BWContest', contestId.toString(), repoName);
await git.clone({ fs, http, dir, url: repoUrl });
closeAllWorkspaces();
const addedFolder = vscode.workspace.updateWorkspaceFolders(
vscode.workspace.workspaceFolders?.length ?? 0,
@ -96,27 +96,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() {}

View File

@ -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();

View File

@ -1,19 +1,20 @@
<script lang="ts">
import { onMount } from "svelte";
import { onMount } from 'svelte';
import urlJoin from 'url-join';
function postMessage(message: any) {
vscode.postMessage(message);
}
type ProblemData = {
id: number,
name: string,
pascalName: string,
sampleInput: string,
sampleOutput: string
id: number;
name: string;
pascalName: string;
sampleInput: string;
sampleOutput: string;
}[];
let savedInputs: Map<number, {input: string, output: string}> = new Map();
let savedInputs: Map<number, { input: string; output: string }> = new Map();
let activeProblem: ProblemData[0];
let sessionToken: string | undefined;
@ -24,12 +25,14 @@
let running = false;
let webUrl: string | undefined;
$: if (problemData && problemData.length !== 0) {
let first = problemData.at(0);
if (first) {
activeProblem = first;
}
};
}
function resetInput() {
sampleInputText.value = activeProblem.sampleInput;
@ -40,7 +43,15 @@
function onRun() {
if (!running && contestId && teamId) {
postMessage({type: 'onRun', value: {problemPascalName: activeProblem.pascalName, contestId: contestId, teamId: teamId, input: sampleInputText.value}});
postMessage({
type: 'onRun',
value: {
problemPascalName: activeProblem.pascalName,
contestId: contestId,
teamId: teamId,
input: sampleInputText.value
}
});
running = true;
}
}
@ -51,23 +62,32 @@
outputText.value = savedInputs.get(activeProblem.id)!.output;
} else {
sampleInputText.value = activeProblem.sampleInput;
outputText.value = "[Run to get output]";
outputText.value = '[Run to get output]';
}
}
function onSubmit() {
if (teamId && contestId && sessionToken) {
postMessage({type: 'onSubmit', value: {sessionToken: sessionToken, contestId: contestId, teamId: teamId, problemId: activeProblem.id, problemName: activeProblem.pascalName}})
postMessage({
type: 'onSubmit',
value: {
sessionToken: sessionToken,
contestId: contestId,
teamId: teamId,
problemId: activeProblem.id,
problemName: activeProblem.pascalName
}
});
}
}
function onKill() {
postMessage({type: 'onKill'});
postMessage({ type: 'onKill' });
}
async function fetchProblemData() {
if (sessionToken) {
const res = await fetch(`http://localhost:5173/api/contest/${sessionToken}`);
if (sessionToken && webUrl) {
const res = await fetch(urlJoin(webUrl, `/api/contest/${sessionToken}`));
const data = await res.json();
if (data.success === true) {
problemData = data.problems as ProblemData;
@ -77,10 +97,10 @@
}
}
window.addEventListener("message", async (event) => {
window.addEventListener('message', async (event) => {
const message = (event as MessageEvent).data;
if (message.type === "onSession") {
if (message.value !== "") {
if (message.type === 'onSession') {
if (message.value !== '') {
sessionToken = message.value;
await fetchProblemData();
updateTextBoxes();
@ -88,13 +108,14 @@
} else if (message.type === 'onOutput') {
outputText.value = message.value;
running = false;
} else if (message.type === 'onWebUrl') {
webUrl = message.value;
}
})
});
onMount(() => {
postMessage({type: "onStartup"});
})
postMessage({ type: 'onStartup' });
});
</script>
<h1>Test & Submit Problems</h1>
@ -102,13 +123,21 @@
{#if problemData}
<div class="tab-container">
{#each problemData as problem}
<button on:click={() => {
<button
on:click={() => {
if (!running) {
savedInputs.set(activeProblem.id, {input: sampleInputText.value, output: outputText.value});
savedInputs.set(activeProblem.id, {
input: sampleInputText.value,
output: outputText.value
});
activeProblem = problem;
updateTextBoxes();
}
}} id={`problem_${problem.id}`} type="button" class={"tab " + (activeProblem.id == problem.id ? "active" : "")}>{problem.name}</button>
}}
id={`problem_${problem.id}`}
type="button"
class={'tab ' + (activeProblem.id == problem.id ? 'active' : '')}>{problem.name}</button
>
{/each}
</div>
{/if}
@ -168,7 +197,7 @@
.loader {
width: 16px;
height: 16px;
border: 3px solid #FFF;
border: 3px solid #fff;
border-bottom-color: transparent;
border-radius: 50%;
display: inline-block;

View File

@ -1,108 +1,72 @@
<script lang="ts">
import { onMount } from "svelte";
import { onMount } from 'svelte';
function postMessage(message: any) {
vscode.postMessage(message);
}
let teamname: HTMLInputElement;
let password: HTMLInputElement;
let teamname: string;
let password: string;
let sessionToken: string | undefined;
let loggedIn = false;
interface TeamData {
teamId: number,
contestId: number
teamId: number;
contestId: number;
}
let teamData: TeamData | undefined;
async function fetchTeamData() {
if (sessionToken) {
const res = await fetch(`http://localhost:5173/api/team/${sessionToken}`, {method: "GET"});
const data = await res.json();
if (!data.success) {
postMessage({type: 'onError', value: "BWContest: Failed to fetch team data"});
return;
}
teamData = data.data as TeamData;
}
}
async function onClone() {
function onClone() {
if (teamData) {
postMessage({type: 'onClone', value: {contestId: teamData.contestId, teamId: teamData.teamId}});
postMessage({
type: 'onClone',
value: { contestId: teamData.contestId, teamId: teamData.teamId }
});
}
}
async function onLogin() {
try {
const res = await fetch("http://localhost:5173/api/team/login", {method: "POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({
teamname: teamname.value, password: password.value
})});
if (res.status !== 200) {
postMessage({type: 'onError', value: 'Error logging in'});
return;
}
const data = await res.json();
if (data.success === false) {
postMessage({type: 'onError', value: data.message ?? "Unknown error logging in"});
return;
}
sessionToken = data.token;
postMessage({type: 'onLogin', value: sessionToken});
} catch (err) {
console.error('Failed to fetch:', err);
}
fetchTeamData();
function onLogin() {
postMessage({
type: 'requestLogin',
value: { teamname: teamname, password: password }
});
}
async function onLogout() {
const res = await fetch("http://localhost:5173/api/team/logout", {method: "POST", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({
token: sessionToken,
})})
if (res.status !== 200) {
postMessage({type: 'onError', value: 'Error logging out'});
sessionToken = undefined;
return;
function onLogout() {
postMessage({
type: 'requestLogout'
});
}
const data = await res.json();
if (data.success === true) {
postMessage({type: 'onInfo', value: 'BWContest: Logged out'});
sessionToken = undefined;
postMessage({type: 'onLogout'});
} else {
postMessage({type: 'onError', value: 'Log out unsuccessful'});
}
}
window.addEventListener("message", event => {
const message = (event as MessageEvent).data;
if (message.type === "onSession") {
if (message.value !== "") {
sessionToken = message.value;
fetchTeamData();
}
}
})
function onTestAndSubmit() {
postMessage({type: 'onTestAndSubmit'});
postMessage({ type: 'onTestAndSubmit' });
}
onMount(() => {
postMessage({type: "onStartup"});
})
postMessage({ type: 'onStartup' });
});
window.addEventListener('message', (event) => {
const message = (event as MessageEvent).data;
if (message.type === 'onLogin') {
loggedIn = true;
teamData = message.value;
} else if (message.type === 'onLogout') {
loggedIn = false;
teamData = undefined;
}
});
</script>
<h1>Contest</h1>
{#if sessionToken === undefined}
{#if !loggedIn}
<label for="teamname">Team Name</label>
<input bind:this={teamname} id="teamname" type="text"/>
<input bind:value={teamname} id="teamname" type="text" />
<label for="password">Password</label>
<input bind:this={password} id="password" type="password"/>
<input bind:value={password} id="password" type="password" />
<button on:click={onLogin}>Login</button>
{:else}