Migrate tsconfig to Node16 module/moduleResolution
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
This commit is contained in:
@@ -16,9 +16,9 @@ import type {
|
|||||||
PortForwardResult,
|
PortForwardResult,
|
||||||
RamCheckResult,
|
RamCheckResult,
|
||||||
ServerInstallPayload
|
ServerInstallPayload
|
||||||
} from './types'
|
} from './types.js'
|
||||||
import type { Manifest, PackDefinition } from '../shared/types'
|
import type { Manifest, PackDefinition } from '../shared/types.js'
|
||||||
import { normalizePackDefinition } from '../shared/store'
|
import { normalizePackDefinition } from '../shared/store.js'
|
||||||
|
|
||||||
interface InstallerState {
|
interface InstallerState {
|
||||||
manifestUrl: string
|
manifestUrl: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { contextBridge, ipcRenderer } from 'electron'
|
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 = {
|
const api = {
|
||||||
// 1단계
|
// 1단계
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Manifest, PackDefinition } from '../shared/types'
|
import type { Manifest, PackDefinition } from '../shared/types.js'
|
||||||
|
|
||||||
export interface InstallerConfig {
|
export interface InstallerConfig {
|
||||||
manifestUrl: string
|
manifestUrl: string
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import express from 'express'
|
|||||||
import session from 'express-session'
|
import session from 'express-session'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import fsp from 'node:fs/promises'
|
import fsp from 'node:fs/promises'
|
||||||
import { manifestRootPath, manifestDirPath, fileDirPath, viewsDirPath, publicDirPath } from '../shared/paths'
|
import { manifestRootPath, manifestDirPath, fileDirPath, viewsDirPath, publicDirPath } from '../shared/paths.js'
|
||||||
import { indexRouter } from './routes/index'
|
import { indexRouter } from './routes/index.js'
|
||||||
import { opRouter } from './routes/op'
|
import { opRouter } from './routes/op.js'
|
||||||
|
|
||||||
const PORT = Number(process.env.PORT ?? 3000)
|
const PORT = Number(process.env.PORT ?? 3000)
|
||||||
// 터미널에서 Ctrl+클릭으로 바로 열 수 있도록 기본값은 127.0.0.1.
|
// 터미널에서 Ctrl+클릭으로 바로 열 수 있도록 기본값은 127.0.0.1.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Router } from 'express'
|
import { Router } from 'express'
|
||||||
import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store'
|
import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store.js'
|
||||||
|
|
||||||
export const indexRouter = Router()
|
export const indexRouter = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import {
|
|||||||
renamePack,
|
renamePack,
|
||||||
sanitizePackKey,
|
sanitizePackKey,
|
||||||
savePackList
|
savePackList
|
||||||
} from '../../shared/store'
|
} from '../../shared/store.js'
|
||||||
import { fetchReleaseVersions } from '../../shared/mojang'
|
import { fetchReleaseVersions } from '../../shared/mojang.js'
|
||||||
import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube'
|
import { fetchPlaylistEntries, fetchVideoMeta, YtDlpUnavailableError } from '../youtube.js'
|
||||||
import { requireAuth } from '../middleware/auth'
|
import { requireAuth } from '../middleware/auth.js'
|
||||||
import type { PackDefinition, PackList } from '../../shared/types'
|
import type { PackDefinition, PackList } from '../../shared/types.js'
|
||||||
|
|
||||||
export const opRouter = Router()
|
export const opRouter = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { promises as fs, createWriteStream, constants as fsConst } from 'node:fs
|
|||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import https from 'node:https'
|
import https from 'node:https'
|
||||||
import http from 'node:http'
|
import http from 'node:http'
|
||||||
import { getMcCustomDir } from '../shared/paths'
|
import { getMcCustomDir } from '../shared/paths.js'
|
||||||
|
|
||||||
export interface YtPlaylistEntry {
|
export interface YtPlaylistEntry {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import fs from 'node:fs'
|
import fs from 'node:fs'
|
||||||
import fsp from 'node:fs/promises'
|
import fsp from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import { manifestRootPath, manifestDirPath, accountFilePath, fileListDirPath } from './paths'
|
import { manifestRootPath, manifestDirPath, accountFilePath, fileListDirPath } from './paths.js'
|
||||||
import type {
|
import type {
|
||||||
Manifest, ManifestEntry, PackDefinition, AccountEntry, LoaderType,
|
Manifest, ManifestEntry, PackDefinition, AccountEntry, LoaderType,
|
||||||
PackList, MusicListEntry, ImageListEntry
|
PackList, MusicListEntry, ImageListEntry
|
||||||
} from './types'
|
} from './types.js'
|
||||||
|
|
||||||
export async function readManifest(): Promise<Manifest> {
|
export async function readManifest(): Promise<Manifest> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "CommonJS",
|
"module": "Node16",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "Node16",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user