diff --git a/api/package.json b/api/package.json index c693e94..cda3309 100644 --- a/api/package.json +++ b/api/package.json @@ -2,7 +2,8 @@ "name": "piston-api", "version": "3.2.0", "description": "API for piston - a high performance code execution engine", - "main": "src/index.js", + "module": "src/index.js", + "type": "module", "scripts": { "run": "node src/index.js" }, diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 8555175..2fa475f 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -3,8 +3,8 @@ import { Router } from 'express'; import { EventEmitter } from 'events'; import { get_latest_runtime_matching_language_version, runtimes as _runtimes } from '../runtime'; -import Job from '../job'; -import package_ from '../package'; +import Job from '../job.js'; +import package_ from '../package.js'; import { create } from 'logplease' const logger = create('api/v2', {}); diff --git a/api/src/index.js b/api/src/index.js index cb0dca5..62b07fd 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -2,13 +2,13 @@ import { create, setLogLevel } from 'logplease'; import express from 'express'; import expressWs from 'express-ws'; -import * as globals from './globals'; -import config from './config'; +import * as globals from './globals.js'; +import config from './config.js'; import { join } from 'path'; import { readdir } from 'fs/promises'; import { existsSync, mkdirSync, chmodSync } from 'fs'; import { urlencoded, json } from 'body-parser'; -import { load_package } from './runtime'; +import { load_package } from './runtime.js'; const logger = create('index', {}); const app = express(); diff --git a/api/src/job.js b/api/src/job.js index d015316..7ef5be1 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -4,8 +4,8 @@ const logger = create('job'); import { v4 as uuidv4 } from 'uuid'; import { spawn } from 'child_process'; import { join, relative, dirname } from 'path'; -import config from './config'; -import * as globals from './globals'; +import config from './config.js'; +import * as globals from './globals.js'; import { mkdir, chown, writeFile, readdir, stat as _stat, rm } from 'fs/promises'; import { readdirSync, readFileSync } from 'fs'; import wait_pid from 'waitpid'; diff --git a/api/src/runtime.js b/api/src/runtime.js index 4461bc1..45e8938 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -1,7 +1,7 @@ import { create } from 'logplease'; import { parse, satisfies, rcompare } from 'semver'; -import config from './config'; -import { platform } from './globals'; +import config from './config.js'; +import { platform } from './globals.js'; import { readFileSync, existsSync } from 'fs'; import { join } from 'path'; diff --git a/api/tsconfig.json b/api/tsconfig.json index 883fae0..681bc70 100644 --- a/api/tsconfig.json +++ b/api/tsconfig.json @@ -4,7 +4,7 @@ "checkJs": true, "resolveJsonModule": true, "target": "ES2022", - "moduleResolution": "node", + "moduleResolution": "nodenext", "allowSyntheticDefaultImports": true, // we dont have any thing to compile just yet "noEmit": true