[Shared][Extension] Update shared

This commit is contained in:
orosmatthew 2024-03-12 12:11:59 -04:00
parent 247bd010b8
commit 8f56a6aa4c
35 changed files with 7181 additions and 657 deletions

View File

@ -10,10 +10,9 @@
"dependencies": {
"@vscode/vsce": "^2.22.0",
"axios": "^1.6.5",
"contest-monitor-types": "file:../../shared/contest-monitor-types",
"bwcontest-shared": "file:../../shared",
"fs-extra": "^11.2.0",
"isomorphic-git": "^1.25.3",
"submission-runner": "file:../../shared/submission-runner",
"tree-kill": "^1.2.2",
"url-join": "^5.0.0",
"zod": "^3.22.4"
@ -54,8 +53,27 @@
"vscode": "^1.85.0"
}
},
"../../shared/contest-monitor-types": {},
"../../shared": {
"name": "bwcontest-shared",
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/node": "20.x",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"fs-extra": "^11.2.0",
"prettier": "^3.2.5",
"tree-kill": "^1.2.2",
"typescript": "^5.4.2",
"zod": "^3.22.4"
}
},
"../../shared/contest-monitor-types": {
"extraneous": true
},
"../../shared/submission-runner": {
"extraneous": true,
"dependencies": {
"fs-extra": "^11.2.0",
"tree-kill": "^1.2.2",
@ -1744,6 +1762,10 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/bwcontest-shared": {
"resolved": "../../shared",
"link": true
},
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
@ -2205,10 +2227,6 @@
"node": ">=12"
}
},
"node_modules/contest-monitor-types": {
"resolved": "../../shared/contest-monitor-types",
"link": true
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
@ -6128,10 +6146,6 @@
"postcss": "^8.2.15"
}
},
"node_modules/submission-runner": {
"resolved": "../../shared/submission-runner",
"link": true
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",

View File

@ -116,10 +116,9 @@
"dependencies": {
"@vscode/vsce": "^2.22.0",
"axios": "^1.6.5",
"contest-monitor-types": "file:../../shared/contest-monitor-types",
"bwcontest-shared": "file:../../shared",
"fs-extra": "^11.2.0",
"isomorphic-git": "^1.25.3",
"submission-runner": "file:../../shared/submission-runner",
"tree-kill": "^1.2.2",
"url-join": "^5.0.0",
"zod": "^3.22.4"

View File

@ -9,7 +9,7 @@ import type {
ProblemNameForExtension,
SubmissionForExtension,
SubmissionStateForExtension
} from 'contest-monitor-types/contestMonitorTypes';
} from 'bwcontest-shared/types/contestMonitorTypes';
import { TeamData } from './sharedTypes';
import {
ContestTeamState,

View File

@ -7,7 +7,7 @@ import type {
ProblemNameForExtension,
FullStateForExtension,
SubmissionForExtension
} from 'contest-monitor-types/contestMonitorTypes';
} from 'bwcontest-shared/types/contestMonitorTypes';
import { LiteEvent } from '../utilities/LiteEvent';
export type ContestTeamState = {

View File

@ -2,11 +2,11 @@ import * as vscode from 'vscode';
import { getNonce } from './getNonce';
import urlJoin from 'url-join';
import { extensionSettings } from './extension';
import { runJava } from 'submission-runner/java.cjs';
import { runJava } from 'bwcontest-shared/submission-runner/java.cjs';
import { join } from 'path';
import { submitProblem } from './submit';
import { runCSharp } from 'submission-runner/csharp.cjs';
import { runCpp } from 'submission-runner/cpp.cjs';
import { runCSharp } from 'bwcontest-shared/submission-runner/csharp.cjs';
import { runCpp } from 'bwcontest-shared/submission-runner/cpp.cjs';
import { TeamData } from './sharedTypes';
import outputPanelLog from './outputPanelLog';
import { recordInitialSubmission } from './contestMonitor/contestStateSyncManager';

View File

@ -5,7 +5,7 @@ import path = require('path');
import http from 'isomorphic-git/http/node';
import urlJoin from 'url-join';
import outputPanelLog from './outputPanelLog';
import type { SubmissionForExtension } from 'contest-monitor-types/contestMonitorTypes';
import type { SubmissionForExtension } from 'bwcontest-shared/types/contestMonitorTypes';
export async function submitProblem(
sessionToken: string,

1
shared/.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
dist/tsconfig/tsbuildinfo

2462
shared/dist/cpp.js vendored Normal file

File diff suppressed because it is too large Load Diff

227
shared/dist/csharp.js vendored Normal file
View File

@ -0,0 +1,227 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/tree-kill/index.js
var require_tree_kill = __commonJS({
"node_modules/tree-kill/index.js"(exports2, module2) {
"use strict";
var childProcess = require("child_process");
var spawn2 = childProcess.spawn;
var exec = childProcess.exec;
module2.exports = function(pid, signal, callback) {
if (typeof signal === "function" && callback === void 0) {
callback = signal;
signal = void 0;
}
pid = parseInt(pid);
if (Number.isNaN(pid)) {
if (callback) {
return callback(new Error("pid must be a number"));
} else {
throw new Error("pid must be a number");
}
}
var tree = {};
var pidsToProcess = {};
tree[pid] = [];
pidsToProcess[pid] = 1;
switch (process.platform) {
case "win32":
exec("taskkill /pid " + pid + " /T /F", callback);
break;
case "darwin":
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
return spawn2("pgrep", ["-P", parentPid]);
}, function() {
killAll(tree, signal, callback);
});
break;
default:
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
}, function() {
killAll(tree, signal, callback);
});
break;
}
};
function killAll(tree, signal, callback) {
var killed = {};
try {
Object.keys(tree).forEach(function(pid) {
tree[pid].forEach(function(pidpid) {
if (!killed[pidpid]) {
killPid(pidpid, signal);
killed[pidpid] = 1;
}
});
if (!killed[pid]) {
killPid(pid, signal);
killed[pid] = 1;
}
});
} catch (err) {
if (callback) {
return callback(err);
} else {
throw err;
}
}
if (callback) {
return callback();
}
}
function killPid(pid, signal) {
try {
process.kill(parseInt(pid, 10), signal);
} catch (err) {
if (err.code !== "ESRCH")
throw err;
}
}
function buildProcessTree(parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
var ps = spawnChildProcessesList(parentPid);
var allData = "";
ps.stdout.on("data", function(data) {
var data = data.toString("ascii");
allData += data;
});
var onClose = function(code) {
delete pidsToProcess[parentPid];
if (code != 0) {
if (Object.keys(pidsToProcess).length == 0) {
cb();
}
return;
}
allData.match(/\d+/g).forEach(function(pid) {
pid = parseInt(pid, 10);
tree[parentPid].push(pid);
tree[pid] = [];
pidsToProcess[pid] = 1;
buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
});
};
ps.on("close", onClose);
}
}
});
// submission-runner/csharp.cts
var csharp_exports = {};
__export(csharp_exports, {
runCSharp: () => runCSharp
});
module.exports = __toCommonJS(csharp_exports);
var import_child_process = require("child_process");
var import_tree_kill = __toESM(require_tree_kill());
// submission-runner/settings.cts
var timeoutSeconds = 30;
// submission-runner/csharp.cts
var runCSharp = async function(params) {
console.log(`- RUN: ${params.srcDir}`);
const child = (0, import_child_process.spawn)("dotnet run", { shell: true, cwd: params.srcDir });
try {
let outputBuffer = "";
child.stdout.setEncoding("utf8");
child.stdout.on("data", (data) => {
outputBuffer += data.toString();
params.outputCallback?.(data.toString());
});
child.stderr.setEncoding("utf8");
child.stderr.on("data", (data) => {
outputBuffer += data.toString();
params.outputCallback?.(data.toString());
});
const runStartTime = performance.now();
child.stdin.write(params.input);
child.stdin.end();
let timeLimitExceeded = false;
let completedNormally = false;
return {
success: true,
runResult: new Promise((resolve) => {
child.on("close", () => {
completedNormally = !timeLimitExceeded;
const runEndTime = performance.now();
const runtimeMilliseconds = Math.floor(runEndTime - runStartTime);
if (completedNormally) {
clearTimeout(timeoutHandle);
resolve({
kind: "Completed",
output: outputBuffer,
exitCode: child.exitCode,
runtimeMilliseconds
});
} else {
console.log(`Process terminated, total sandbox time: ${runtimeMilliseconds}ms`);
resolve({
kind: "TimeLimitExceeded",
output: outputBuffer,
resultKindReason: `Timeout after ${timeoutSeconds} seconds`
});
}
});
const timeoutHandle = setTimeout(() => {
if (completedNormally) {
return;
}
console.log(`Run timed out after ${timeoutSeconds} seconds, killing process...`);
timeLimitExceeded = true;
child.stdin.end();
child.stdin.destroy();
child.stdout.destroy();
child.stderr.destroy();
if (child.pid !== void 0) {
(0, import_tree_kill.default)(child.pid);
}
}, timeoutSeconds * 1e3);
}),
killFunc() {
if (child.pid !== void 0) {
if (!completedNormally && !timeLimitExceeded) {
(0, import_tree_kill.default)(child.pid);
params.outputCallback?.("\n[Manually stopped]");
}
}
}
};
} catch (error) {
return { success: false, runResult: { kind: "RunError" } };
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
runCSharp
});

241
shared/dist/java.js vendored Normal file
View File

@ -0,0 +1,241 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/tree-kill/index.js
var require_tree_kill = __commonJS({
"node_modules/tree-kill/index.js"(exports2, module2) {
"use strict";
var childProcess = require("child_process");
var spawn2 = childProcess.spawn;
var exec2 = childProcess.exec;
module2.exports = function(pid, signal, callback) {
if (typeof signal === "function" && callback === void 0) {
callback = signal;
signal = void 0;
}
pid = parseInt(pid);
if (Number.isNaN(pid)) {
if (callback) {
return callback(new Error("pid must be a number"));
} else {
throw new Error("pid must be a number");
}
}
var tree = {};
var pidsToProcess = {};
tree[pid] = [];
pidsToProcess[pid] = 1;
switch (process.platform) {
case "win32":
exec2("taskkill /pid " + pid + " /T /F", callback);
break;
case "darwin":
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
return spawn2("pgrep", ["-P", parentPid]);
}, function() {
killAll(tree, signal, callback);
});
break;
default:
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
return spawn2("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
}, function() {
killAll(tree, signal, callback);
});
break;
}
};
function killAll(tree, signal, callback) {
var killed = {};
try {
Object.keys(tree).forEach(function(pid) {
tree[pid].forEach(function(pidpid) {
if (!killed[pidpid]) {
killPid(pidpid, signal);
killed[pidpid] = 1;
}
});
if (!killed[pid]) {
killPid(pid, signal);
killed[pid] = 1;
}
});
} catch (err) {
if (callback) {
return callback(err);
} else {
throw err;
}
}
if (callback) {
return callback();
}
}
function killPid(pid, signal) {
try {
process.kill(parseInt(pid, 10), signal);
} catch (err) {
if (err.code !== "ESRCH")
throw err;
}
}
function buildProcessTree(parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
var ps = spawnChildProcessesList(parentPid);
var allData = "";
ps.stdout.on("data", function(data) {
var data = data.toString("ascii");
allData += data;
});
var onClose = function(code) {
delete pidsToProcess[parentPid];
if (code != 0) {
if (Object.keys(pidsToProcess).length == 0) {
cb();
}
return;
}
allData.match(/\d+/g).forEach(function(pid) {
pid = parseInt(pid, 10);
tree[parentPid].push(pid);
tree[pid] = [];
pidsToProcess[pid] = 1;
buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
});
};
ps.on("close", onClose);
}
}
});
// submission-runner/java.cts
var java_exports = {};
__export(java_exports, {
runJava: () => runJava
});
module.exports = __toCommonJS(java_exports);
var import_path = require("path");
var import_child_process = require("child_process");
var util = __toESM(require("util"));
// submission-runner/settings.cts
var timeoutSeconds = 30;
// submission-runner/java.cts
var kill = require_tree_kill();
var execPromise = util.promisify(import_child_process.exec);
var runJava = async function(params) {
console.log(`- BUILD: ${params.mainFile}`);
const compileCommand = `javac -cp ${(0, import_path.join)(params.srcDir, "src")} ${params.mainFile} -d ${(0, import_path.join)(params.srcDir, "build")}`;
try {
await execPromise(compileCommand);
} catch (e) {
const buildErrorText = e?.toString() ?? "Unknown build errors.";
console.log("Build errors: " + buildErrorText);
return {
success: false,
runResult: { kind: "CompileFailed", resultKindReason: buildErrorText }
};
}
console.log(`- RUN: ${params.mainClass}`);
const runCommand = `java -cp "${(0, import_path.join)(params.srcDir, "build")}" ${params.mainClass}`;
try {
let outputBuffer = "";
const child = (0, import_child_process.spawn)(runCommand, { shell: true });
child.stdout.setEncoding("utf8");
child.stdout.on("data", (data) => {
outputBuffer += data.toString();
params.outputCallback?.(data.toString());
});
child.stderr.setEncoding("utf8");
child.stderr.on("data", (data) => {
outputBuffer += data.toString();
params.outputCallback?.(data.toString());
});
const runStartTime = performance.now();
child.stdin.write(params.input);
child.stdin.end();
let timeLimitExceeded = false;
let completedNormally = false;
return {
success: true,
runResult: new Promise((resolve) => {
child.on("close", () => {
completedNormally = !timeLimitExceeded;
const runEndTime = performance.now();
const runtimeMilliseconds = Math.floor(runEndTime - runStartTime);
if (completedNormally) {
clearTimeout(timeoutHandle);
resolve({
kind: "Completed",
output: outputBuffer,
exitCode: child.exitCode,
runtimeMilliseconds
});
} else {
console.log(`Process terminated, total sandbox time: ${runtimeMilliseconds}ms`);
resolve({
kind: "TimeLimitExceeded",
output: outputBuffer,
resultKindReason: `Timeout after ${timeoutSeconds} seconds`
});
}
});
const timeoutHandle = setTimeout(() => {
if (completedNormally) {
return;
}
console.log(`Run timed out after ${timeoutSeconds} seconds, killing process...`);
timeLimitExceeded = true;
child.stdin.end();
child.stdin.destroy();
child.stdout.destroy();
child.stderr.destroy();
child.kill("SIGKILL");
}, timeoutSeconds * 1e3);
}),
killFunc() {
if (child.pid !== void 0) {
if (!completedNormally && !timeLimitExceeded) {
kill(child.pid);
params.outputCallback?.("\n[Manually stopped]");
}
}
}
};
} catch (error) {
return { success: false, runResult: { kind: "RunError" } };
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
runJava
});

30
shared/dist/settings.js vendored Normal file
View File

@ -0,0 +1,30 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// submission-runner/settings.cts
var settings_exports = {};
__export(settings_exports, {
timeoutSeconds: () => timeoutSeconds
});
module.exports = __toCommonJS(settings_exports);
var timeoutSeconds = 30;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
timeoutSeconds
});

View File

@ -1,207 +0,0 @@
'use strict';
var __createBinding =
(this && this.__createBinding) ||
(Object.create
? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
Object.defineProperty(o, k2, desc);
}
: function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault =
(this && this.__setModuleDefault) ||
(Object.create
? function (o, v) {
Object.defineProperty(o, 'default', { enumerable: true, value: v });
}
: function (o, v) {
o['default'] = v;
});
var __importStar =
(this && this.__importStar) ||
function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null)
for (var k in mod)
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator['throw'](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, '__esModule', { value: true });
exports.runCpp = void 0;
const path_1 = require('path');
const child_process_1 = require('child_process');
const util = __importStar(require('util'));
const settings_cjs_1 = require('./settings.cjs');
const tree_kill_1 = __importDefault(require('tree-kill'));
const os = __importStar(require('os'));
const fs = __importStar(require('fs-extra'));
const execPromise = util.promisify(child_process_1.exec);
const runCpp = function (params) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b;
const tmpDir = os.tmpdir();
const buildDir = (0, path_1.join)(tmpDir, 'bwcontest-cpp');
if (fs.existsSync(buildDir)) {
fs.removeSync(buildDir);
}
fs.mkdirSync(buildDir);
console.log(`- BUILD: ${params.problemName}`);
const configureCommand = `cmake -S ${params.srcDir} -B ${buildDir}`;
try {
yield execPromise(configureCommand);
} catch (e) {
const buildErrorText =
(_a = e === null || e === void 0 ? void 0 : e.toString()) !== null && _a !== void 0
? _a
: 'Unknown build errors.';
console.log('Build errors: ' + buildErrorText);
return {
success: false,
runResult: { kind: 'CompileFailed', resultKindReason: buildErrorText }
};
}
const compileCommand = `cmake --build ${buildDir} --target ${params.problemName}`;
try {
yield execPromise(compileCommand);
} catch (e) {
const buildErrorText =
(_b = e === null || e === void 0 ? void 0 : e.toString()) !== null && _b !== void 0
? _b
: 'Unknown build errors.';
console.log('Build errors: ' + buildErrorText);
return {
success: false,
runResult: { kind: 'CompileFailed', resultKindReason: buildErrorText }
};
}
console.log(`- RUN: ${params.problemName}`);
let runCommand = '';
if (params.cppPlatform === 'VisualStudio') {
runCommand = `${(0, path_1.join)(buildDir, 'Debug', `${params.problemName}.exe`)}`;
} else {
runCommand = `${(0, path_1.join)(buildDir, params.problemName)}`;
}
try {
let outputBuffer = '';
const child = (0, child_process_1.spawn)(runCommand, { shell: true });
child.stdout.setEncoding('utf8');
child.stdout.on('data', (data) => {
outputBuffer += data.toString();
});
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
outputBuffer += data.toString();
});
const runStartTime = performance.now();
child.stdin.write(params.input);
child.stdin.end();
let timeLimitExceeded = false;
let completedNormally = false;
return {
success: true,
runResult: new Promise((resolve) => {
child.on('close', () => {
completedNormally = !timeLimitExceeded;
const runEndTime = performance.now();
const runtimeMilliseconds = Math.floor(runEndTime - runStartTime);
if (completedNormally) {
clearTimeout(timeoutHandle);
resolve({
kind: 'Completed',
output: outputBuffer,
exitCode: child.exitCode,
runtimeMilliseconds
});
} else {
console.log(`Process terminated, total sandbox time: ${runtimeMilliseconds}ms`);
resolve({
kind: 'TimeLimitExceeded',
output: outputBuffer,
resultKindReason: `Timeout after ${settings_cjs_1.timeoutSeconds} seconds`
});
}
});
const timeoutHandle = setTimeout(() => {
if (completedNormally) {
return;
}
console.log(
`Run timed out after ${settings_cjs_1.timeoutSeconds} seconds, killing process...`
);
timeLimitExceeded = true;
child.stdin.end();
child.stdin.destroy();
child.stdout.destroy();
child.stderr.destroy();
child.kill('SIGKILL');
}, settings_cjs_1.timeoutSeconds * 1000);
}),
killFunc() {
var _a;
if (child.pid !== undefined) {
if (!completedNormally && !timeLimitExceeded) {
(0, tree_kill_1.default)(child.pid);
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, '\n[Manually stopped]');
}
}
}
};
} catch (error) {
return { success: false, runResult: { kind: 'RunError' } };
}
});
};
exports.runCpp = runCpp;
//# sourceMappingURL=cpp.cjs.map

View File

@ -1 +0,0 @@
{"version":3,"file":"cpp.cjs","sourceRoot":"","sources":["../../submission-runner/cpp.cts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,iDAA4C;AAC5C,2CAA6B;AAE7B,iDAAgD;AAChD,0DA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C;wBACjF,iBAAiB,GAAG,IAAI,CAAC;wBAEzB,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;wBAClB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;wBACtB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;wBACvB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;wBACvB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACvB,CAAC,EAAE,6BAAc,GAAG,IAAI,CAAC,CAAC;gBAC3B,CAAC,CAAC;gBACF,QAAQ;;oBACP,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;wBAC7B,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,EAAE,CAAC;4BAC9C,IAAA,mBAAI,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC;4BAChB,MAAA,MAAM,CAAC,cAAc,uDAAG,sBAAsB,CAAC,CAAC;wBACjD,CAAC;oBACF,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC;QAC5D,CAAC;IACF,CAAC;CAAA,CAAC;AArHW,QAAA,MAAM,UAqHjB"}

View File

@ -1,12 +0,0 @@
import type { IRunner, IRunnerParams } from './types.cjs';
export type CppPlatform = 'VisualStudio' | 'GCC';
interface IRunnerParamsCpp extends IRunnerParams {
srcDir: string;
problemName: string;
input: string;
cppPlatform: CppPlatform;
outputCallback?: (data: string) => void;
}
export declare const runCpp: IRunner<IRunnerParamsCpp>;
export {};
//# sourceMappingURL=cpp.d.cts.map

View File

@ -1 +0,0 @@
{"version":3,"file":"cpp.d.cts","sourceRoot":"","sources":["../../submission-runner/cpp.cts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAA4B,MAAM,aAAa,CAAC;AAQpF,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,KAAK,CAAC;AAEjD,UAAU,gBAAiB,SAAQ,aAAa;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAqH5C,CAAC"}

View File

@ -1,129 +0,0 @@
'use strict';
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator['throw'](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, '__esModule', { value: true });
exports.runCSharp = void 0;
const child_process_1 = require('child_process');
const tree_kill_1 = __importDefault(require('tree-kill'));
const settings_cjs_1 = require('./settings.cjs');
const runCSharp = function (params) {
return __awaiter(this, void 0, void 0, function* () {
console.log(`- RUN: ${params.srcDir}`);
const child = (0, child_process_1.spawn)('dotnet run', { shell: true, cwd: params.srcDir });
try {
let outputBuffer = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', (data) => {
var _a;
outputBuffer += data.toString();
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, data.toString());
});
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
var _a;
outputBuffer += data.toString();
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, data.toString());
});
const runStartTime = performance.now();
child.stdin.write(params.input);
child.stdin.end();
let timeLimitExceeded = false;
let completedNormally = false;
return {
success: true,
runResult: new Promise((resolve) => {
child.on('close', () => {
completedNormally = !timeLimitExceeded;
const runEndTime = performance.now();
const runtimeMilliseconds = Math.floor(runEndTime - runStartTime);
if (completedNormally) {
clearTimeout(timeoutHandle);
resolve({
kind: 'Completed',
output: outputBuffer,
exitCode: child.exitCode,
runtimeMilliseconds
});
} else {
console.log(`Process terminated, total sandbox time: ${runtimeMilliseconds}ms`);
resolve({
kind: 'TimeLimitExceeded',
output: outputBuffer,
resultKindReason: `Timeout after ${settings_cjs_1.timeoutSeconds} seconds`
});
}
});
const timeoutHandle = setTimeout(() => {
if (completedNormally) {
return;
}
console.log(
`Run timed out after ${settings_cjs_1.timeoutSeconds} seconds, killing process...`
);
timeLimitExceeded = true;
child.stdin.end();
child.stdin.destroy();
child.stdout.destroy();
child.stderr.destroy();
if (child.pid !== undefined) {
(0, tree_kill_1.default)(child.pid);
}
}, settings_cjs_1.timeoutSeconds * 1000);
}),
killFunc() {
var _a;
if (child.pid !== undefined) {
if (!completedNormally && !timeLimitExceeded) {
(0, tree_kill_1.default)(child.pid);
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, '\n[Manually stopped]');
}
}
}
};
} catch (error) {
return { success: false, runResult: { kind: 'RunError' } };
}
});
};
exports.runCSharp = runCSharp;
//# sourceMappingURL=csharp.cjs.map

View File

@ -1 +0,0 @@
{"version":3,"file":"csharp.cjs","sourceRoot":"","sources":["../../submission-runner/csharp.cts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAsC;AACtC,0DAA6B;AAE7B,iDAAgD;AAEzC,MAAM,SAAS,GAAY,UAAgB,MAIjD;;QACA,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,Y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AC7B,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,EAAE,CAAC;4BAC9C,IAAA,mBAAI,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC;4BAChB,MAAA,MAAM,CAAC,cAAc,uDAAG,sBAAsB,CAAC,CAAC;wBACjD,CAAC;oBACF,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC;QAC5D,CAAC;IACF,CAAC;CAAA,CAAC;AApFW,QAAA,SAAS,aAoFpB"}

View File

@ -1,3 +0,0 @@
import type { IRunner } from './types.cjs';
export declare const runCSharp: IRunner;
//# sourceMappingURL=csharp.d.cts.map

View File

@ -1 +0,0 @@
{"version":3,"file":"csharp.d.cts","sourceRoot":"","sources":["../../submission-runner/csharp.cts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAA4B,MAAM,aAAa,CAAC;AAGrE,eAAO,MAAM,SAAS,EAAE,OAoFvB,CAAC"}

View File

@ -1,183 +0,0 @@
'use strict';
var __createBinding =
(this && this.__createBinding) ||
(Object.create
? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
Object.defineProperty(o, k2, desc);
}
: function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault =
(this && this.__setModuleDefault) ||
(Object.create
? function (o, v) {
Object.defineProperty(o, 'default', { enumerable: true, value: v });
}
: function (o, v) {
o['default'] = v;
});
var __importStar =
(this && this.__importStar) ||
function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null)
for (var k in mod)
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P
? value
: new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator['throw'](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, '__esModule', { value: true });
exports.runJava = void 0;
const path_1 = require('path');
const child_process_1 = require('child_process');
const util = __importStar(require('util'));
const settings_cjs_1 = require('./settings.cjs');
const kill = require('tree-kill');
const execPromise = util.promisify(child_process_1.exec);
const runJava = function (params) {
return __awaiter(this, void 0, void 0, function* () {
var _a;
console.log(`- BUILD: ${params.mainFile}`);
const compileCommand = `javac -cp ${(0, path_1.join)(params.srcDir, 'src')} ${params.mainFile} -d ${(0, path_1.join)(params.srcDir, 'build')}`;
try {
yield execPromise(compileCommand);
} catch (e) {
const buildErrorText =
(_a = e === null || e === void 0 ? void 0 : e.toString()) !== null && _a !== void 0
? _a
: 'Unknown build errors.';
console.log('Build errors: ' + buildErrorText);
return {
success: false,
runResult: { kind: 'CompileFailed', resultKindReason: buildErrorText }
};
}
console.log(`- RUN: ${params.mainClass}`);
const runCommand = `java -cp "${(0, path_1.join)(params.srcDir, 'build')}" ${params.mainClass}`;
try {
let outputBuffer = '';
const child = (0, child_process_1.spawn)(runCommand, { shell: true });
child.stdout.setEncoding('utf8');
child.stdout.on('data', (data) => {
var _a;
outputBuffer += data.toString();
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, data.toString());
});
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
var _a;
outputBuffer += data.toString();
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, data.toString());
});
const runStartTime = performance.now();
child.stdin.write(params.input);
child.stdin.end();
let timeLimitExceeded = false;
let completedNormally = false;
return {
success: true,
runResult: new Promise((resolve) => {
child.on('close', () => {
completedNormally = !timeLimitExceeded;
const runEndTime = performance.now();
const runtimeMilliseconds = Math.floor(runEndTime - runStartTime);
if (completedNormally) {
clearTimeout(timeoutHandle);
resolve({
kind: 'Completed',
output: outputBuffer,
exitCode: child.exitCode,
runtimeMilliseconds
});
} else {
console.log(`Process terminated, total sandbox time: ${runtimeMilliseconds}ms`);
resolve({
kind: 'TimeLimitExceeded',
output: outputBuffer,
resultKindReason: `Timeout after ${settings_cjs_1.timeoutSeconds} seconds`
});
}
});
const timeoutHandle = setTimeout(() => {
if (completedNormally) {
return;
}
console.log(
`Run timed out after ${settings_cjs_1.timeoutSeconds} seconds, killing process...`
);
timeLimitExceeded = true;
child.stdin.end();
child.stdin.destroy();
child.stdout.destroy();
child.stderr.destroy();
child.kill('SIGKILL');
}, settings_cjs_1.timeoutSeconds * 1000);
}),
killFunc() {
var _a;
if (child.pid !== undefined) {
if (!completedNormally && !timeLimitExceeded) {
kill(child.pid);
(_a = params.outputCallback) === null || _a === void 0
? void 0
: _a.call(params, '\n[Manually stopped]');
}
}
}
};
} catch (error) {
return { success: false, runResult: { kind: 'RunError' } };
}
});
};
exports.runJava = runJava;
//# sourceMappingURL=java.cjs.map

View File

@ -1 +0,0 @@
{"version":3,"file":"java.cjs","sourceRoot":"","sources":["../../submission-runner/java.cts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,iDAA4C;AAC5C,2CAA6B;AAE7B,iDAAgD;AAEhD,kCAAmC;AAEnC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAI,CAAC,CAAC;AAUlC,MAAM,OAAO,GAA+B,UAClD,MAAyB;;;QAEzB,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,QAAQ,EAAE,CAAC,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MAAM,EAAE,YAAY;gCACpB,gBAAgB,EAAE,iBAAiB,6BAAc,UAAU;6BAC3D,CAAC,CAAC;wBACJ,CAAC;oBACF,CAAC,CAAC,CAAC;oBAEH,MAAM,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;wBACrC,IAAI,iBAAiB,EAAE,CAAC;4BACvB,OAAO;wBACR,CAAC;wBAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,6BAAc,8BAA8B,CAAC,CAAC;wBACjF,iBAAiB,GAAG,IAAI,CAAC;wBAEzB,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;wBAClB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;wBACtB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;wBACvB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;wBACvB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACvB,CAAC,EAAE,6BAAc,GAAG,IAAI,CAAC,CAAC;gBAC3B,CAAC,CAAC;gBACF,QAAQ;;oBACP,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;wBAC7B,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,EAAE,CAAC;4BAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;4BAChB,MAAA,MAAM,CAAC,cAAc,uDAAG,sBAAsB,CAAC,CAAC;wBACjD,CAAC;oBACF,CAAC;gBACF,CAAC;aACD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC;QAC5D,CAAC;IACF,CAAC;CAAA,CAAC;AA/FW,QAAA,OAAO,WA+FlB"}

View File

@ -1,11 +0,0 @@
import type { IRunner, IRunnerParams } from './types.cjs';
interface IRunnerParamsJava extends IRunnerParams {
srcDir: string;
mainFile: string;
mainClass: string;
input: string;
outputCallback?: (data: string) => void;
}
export declare const runJava: IRunner<IRunnerParamsJava>;
export {};
//# sourceMappingURL=java.d.cts.map

View File

@ -1 +0,0 @@
{"version":3,"file":"java.d.cts","sourceRoot":"","sources":["../../submission-runner/java.cts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAA4B,MAAM,aAAa,CAAC;AAOpF,UAAU,iBAAkB,SAAQ,aAAa;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,iBAAiB,CA+F9C,CAAC"}

View File

@ -1,5 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.timeoutSeconds = void 0;
exports.timeoutSeconds = 30;
//# sourceMappingURL=settings.cjs.map

View File

@ -1 +0,0 @@
{"version":3,"file":"settings.cjs","sourceRoot":"","sources":["../../submission-runner/settings.cts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,EAAE,CAAC"}

View File

@ -1,2 +0,0 @@
export declare const timeoutSeconds = 30;
//# sourceMappingURL=settings.d.cts.map

View File

@ -1 +0,0 @@
{"version":3,"file":"settings.d.cts","sourceRoot":"","sources":["../../submission-runner/settings.cts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,KAAK,CAAC"}

View File

@ -1,21 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.RunResultZod = void 0;
const zod_1 = require('zod');
const RunResultKind = zod_1.z.enum([
'CompileFailed',
'TimeLimitExceeded',
'Completed',
'SandboxError',
'RunError'
]);
exports.RunResultZod = zod_1.z
.object({
kind: RunResultKind,
output: zod_1.z.string().optional(),
exitCode: zod_1.z.number().optional(),
runtimeMilliseconds: zod_1.z.number().optional(),
resultKindReason: zod_1.z.string().optional()
})
.strict();
//# sourceMappingURL=types.cjs.map

View File

@ -1 +0,0 @@
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../submission-runner/types.cts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,MAAM,aAAa,GAAG,OAAC,CAAC,IAAI,CAAC;IAC5B,eAAe;IACf,mBAAmB;IACnB,WAAW;IACX,cAAc;IACd,UAAU;CACV,CAAC,CAAC;AAIU,QAAA,YAAY,GAAG,OAAC;KAC3B,MAAM,CAAC;IACP,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,MAAM,EAAE,CAAC"}

View File

@ -1,53 +0,0 @@
import { z } from 'zod';
declare const RunResultKind: z.ZodEnum<
['CompileFailed', 'TimeLimitExceeded', 'Completed', 'SandboxError', 'RunError']
>;
export type RunResultKind = z.infer<typeof RunResultKind>;
export declare const RunResultZod: z.ZodObject<
{
kind: z.ZodEnum<
['CompileFailed', 'TimeLimitExceeded', 'Completed', 'SandboxError', 'RunError']
>;
output: z.ZodOptional<z.ZodString>;
exitCode: z.ZodOptional<z.ZodNumber>;
runtimeMilliseconds: z.ZodOptional<z.ZodNumber>;
resultKindReason: z.ZodOptional<z.ZodString>;
},
'strict',
z.ZodTypeAny,
{
kind: 'CompileFailed' | 'TimeLimitExceeded' | 'Completed' | 'SandboxError' | 'RunError';
output?: string | undefined;
exitCode?: number | undefined;
runtimeMilliseconds?: number | undefined;
resultKindReason?: string | undefined;
},
{
kind: 'CompileFailed' | 'TimeLimitExceeded' | 'Completed' | 'SandboxError' | 'RunError';
output?: string | undefined;
exitCode?: number | undefined;
runtimeMilliseconds?: number | undefined;
resultKindReason?: string | undefined;
}
>;
export type RunResult = z.infer<typeof RunResultZod>;
export interface IRunnerParams {
srcDir: string;
input: string;
outputCallback?: (data: string) => void;
}
export type IRunnerReturn =
| {
success: true;
killFunc: () => void;
runResult: Promise<RunResult>;
}
| {
success: false;
runResult: RunResult;
};
export type IRunner<T extends IRunnerParams = IRunnerParams> = (
params: T
) => Promise<IRunnerReturn>;
export {};
//# sourceMappingURL=types.d.cts.map

View File

@ -1 +0,0 @@
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../submission-runner/types.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,aAAa,4FAMjB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;EAQf,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAErD,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,aAAa,GACtB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;CAAE,GACtE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5C,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,CAC9D,MAAM,EAAE,CAAC,KACL,OAAO,CAAC,aAAa,CAAC,CAAC"}

File diff suppressed because one or more lines are too long

3778
shared/dist/types.js vendored Normal file

File diff suppressed because it is too large Load Diff

407
shared/package-lock.json generated
View File

@ -10,6 +10,7 @@
"@types/node": "20.x",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"fs-extra": "^11.2.0",
"prettier": "^3.2.5",
@ -27,6 +28,374 @@
"node": ">=0.10.0"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.1.tgz",
"integrity": "sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.1.tgz",
"integrity": "sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz",
"integrity": "sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.1.tgz",
"integrity": "sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz",
"integrity": "sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz",
"integrity": "sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz",
"integrity": "sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz",
"integrity": "sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz",
"integrity": "sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz",
"integrity": "sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz",
"integrity": "sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz",
"integrity": "sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==",
"cpu": [
"loong64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz",
"integrity": "sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==",
"cpu": [
"mips64el"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz",
"integrity": "sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz",
"integrity": "sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==",
"cpu": [
"riscv64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz",
"integrity": "sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==",
"cpu": [
"s390x"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz",
"integrity": "sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz",
"integrity": "sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz",
"integrity": "sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz",
"integrity": "sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz",
"integrity": "sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz",
"integrity": "sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz",
"integrity": "sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@ -644,6 +1013,44 @@
"node": ">=6.0.0"
}
},
"node_modules/esbuild": {
"version": "0.20.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.1.tgz",
"integrity": "sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.20.1",
"@esbuild/android-arm": "0.20.1",
"@esbuild/android-arm64": "0.20.1",
"@esbuild/android-x64": "0.20.1",
"@esbuild/darwin-arm64": "0.20.1",
"@esbuild/darwin-x64": "0.20.1",
"@esbuild/freebsd-arm64": "0.20.1",
"@esbuild/freebsd-x64": "0.20.1",
"@esbuild/linux-arm": "0.20.1",
"@esbuild/linux-arm64": "0.20.1",
"@esbuild/linux-ia32": "0.20.1",
"@esbuild/linux-loong64": "0.20.1",
"@esbuild/linux-mips64el": "0.20.1",
"@esbuild/linux-ppc64": "0.20.1",
"@esbuild/linux-riscv64": "0.20.1",
"@esbuild/linux-s390x": "0.20.1",
"@esbuild/linux-x64": "0.20.1",
"@esbuild/netbsd-x64": "0.20.1",
"@esbuild/openbsd-x64": "0.20.1",
"@esbuild/sunos-x64": "0.20.1",
"@esbuild/win32-arm64": "0.20.1",
"@esbuild/win32-ia32": "0.20.1",
"@esbuild/win32-x64": "0.20.1"
}
},
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",

View File

@ -1,7 +1,7 @@
{
"name": "bwcontest-shared",
"scripts": {
"build": "tsc",
"build": "esbuild submission-runner/*.cts --bundle --outdir=dist --format=cjs --platform=node",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"check": "tsc -noEmit"
@ -11,6 +11,7 @@
"@types/node": "20.x",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"esbuild": "^0.20.1",
"eslint": "^8.57.0",
"fs-extra": "^11.2.0",
"prettier": "^3.2.5",