From 635c22c7ad438b187d606fbe0dec4dd0626c3d36 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Tue, 12 May 2026 13:41:58 +0900 Subject: [PATCH] Migrate tsconfig to Node16 module/moduleResolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VS Code surfaced the TS deprecation: 'moduleResolution=node10' is deprecated and won't work in TS 7.0. Fix: switch the root tsconfig.json from module: CommonJS, moduleResolution: node to module: Node16, moduleResolution: Node16 TypeScript 7 only supports node16/nodenext/bundler. node16 matches the runtime semantics we already use (Node ≥ 16, CommonJS output via the absence of "type": "module" in package.json), so the emit is unchanged. Side effect of Node16 resolution: relative imports must carry the .js extension. Added .js to every relative import across src/* (17 sites, 8 files). Bare module specifiers (express, electron, node:fs, ...) are unaffected. Verified: - tsc -p tsconfig.server.json — 0 errors - tsc -p tsconfig.installer.json — 0 errors - node dist/server/app.js boots; /op login → 302, /op/list → 200 --- src/installer/main.ts | 6 +++--- src/installer/preload.ts | 2 +- src/installer/types.ts | 2 +- src/server/app.ts | 6 +++--- src/server/routes/index.ts | 2 +- src/server/routes/op.ts | 10 +++++----- src/server/youtube.ts | 2 +- src/shared/store.ts | 4 ++-- tsconfig.json | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/installer/main.ts b/src/installer/main.ts index 9845ed9..025d755 100644 --- a/src/installer/main.ts +++ b/src/installer/main.ts @@ -16,9 +16,9 @@ import type { PortForwardResult, RamCheckResult, ServerInstallPayload -} from './types' -import type { Manifest, PackDefinition } from '../shared/types' -import { normalizePackDefinition } from '../shared/store' +} from './types.js' +import type { Manifest, PackDefinition } from '../shared/types.js' +import { normalizePackDefinition } from '../shared/store.js' interface InstallerState { manifestUrl: string diff --git a/src/installer/preload.ts b/src/installer/preload.ts index 58112a2..465405e 100644 --- a/src/installer/preload.ts +++ b/src/installer/preload.ts @@ -1,5 +1,5 @@ import { contextBridge, ipcRenderer } from 'electron' -import type { ClientInstallPayload, FetchedPack, RamCheckResult, ServerInstallPayload, PortForwardResult } from './types' +import type { ClientInstallPayload, FetchedPack, RamCheckResult, ServerInstallPayload, PortForwardResult } from './types.js' const api = { // 1단계 diff --git a/src/installer/types.ts b/src/installer/types.ts index 0a4a044..9cb3e67 100644 --- a/src/installer/types.ts +++ b/src/installer/types.ts @@ -1,4 +1,4 @@ -import type { Manifest, PackDefinition } from '../shared/types' +import type { Manifest, PackDefinition } from '../shared/types.js' export interface InstallerConfig { manifestUrl: string diff --git a/src/server/app.ts b/src/server/app.ts index 343c95d..032a188 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -2,9 +2,9 @@ import express from 'express' import session from 'express-session' import path from 'node:path' import fsp from 'node:fs/promises' -import { manifestRootPath, manifestDirPath, fileDirPath, viewsDirPath, publicDirPath } from '../shared/paths' -import { indexRouter } from './routes/index' -import { opRouter } from './routes/op' +import { manifestRootPath, manifestDirPath, fileDirPath, viewsDirPath, publicDirPath } from '../shared/paths.js' +import { indexRouter } from './routes/index.js' +import { opRouter } from './routes/op.js' const PORT = Number(process.env.PORT ?? 3000) // 터미널에서 Ctrl+클릭으로 바로 열 수 있도록 기본값은 127.0.0.1. diff --git a/src/server/routes/index.ts b/src/server/routes/index.ts index 28d31e9..8aa508d 100644 --- a/src/server/routes/index.ts +++ b/src/server/routes/index.ts @@ -1,5 +1,5 @@ import { Router } from 'express' -import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store' +import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store.js' export const indexRouter = Router() diff --git a/src/server/routes/op.ts b/src/server/routes/op.ts index 0ae76a4..7c02312 100644 --- a/src/server/routes/op.ts +++ b/src/server/routes/op.ts @@ -11,11 +11,11 @@ import { renamePack, sanitizePackKey, savePackList -} from '../../shared/store' -import { fetchReleaseVersions } from '../../shared/mojang' -import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube' -import { requireAuth } from '../middleware/auth' -import type { PackDefinition, PackList } from '../../shared/types' +} from '../../shared/store.js' +import { fetchReleaseVersions } from '../../shared/mojang.js' +import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube.js' +import { requireAuth } from '../middleware/auth.js' +import type { PackDefinition, PackList } from '../../shared/types.js' export const opRouter = Router() diff --git a/src/server/youtube.ts b/src/server/youtube.ts index 5fb70cc..2a253b2 100644 --- a/src/server/youtube.ts +++ b/src/server/youtube.ts @@ -3,7 +3,7 @@ import { promises as fs, createWriteStream, constants as fsConst } from 'node:fs import path from 'node:path' import https from 'node:https' import http from 'node:http' -import { getMcCustomDir } from '../shared/paths' +import { getMcCustomDir } from '../shared/paths.js' export interface YtPlaylistEntry { id: string diff --git a/src/shared/store.ts b/src/shared/store.ts index 58c3ade..3304002 100644 --- a/src/shared/store.ts +++ b/src/shared/store.ts @@ -1,11 +1,11 @@ import fs from 'node:fs' import fsp from 'node:fs/promises' import path from 'node:path' -import { manifestRootPath, manifestDirPath, accountFilePath, fileListDirPath } from './paths' +import { manifestRootPath, manifestDirPath, accountFilePath, fileListDirPath } from './paths.js' import type { Manifest, ManifestEntry, PackDefinition, AccountEntry, LoaderType, PackList, MusicListEntry, ImageListEntry -} from './types' +} from './types.js' export async function readManifest(): Promise { try { diff --git a/tsconfig.json b/tsconfig.json index 1ad2d3a..96e3e09 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "ES2022", - "module": "CommonJS", - "moduleResolution": "node", + "module": "Node16", + "moduleResolution": "Node16", "outDir": "dist", "rootDir": "src", "esModuleInterop": true,