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
24 lines
725 B
TypeScript
24 lines
725 B
TypeScript
import { Router } from 'express'
|
|
import { listPackKeys, loadPackDefinition, readManifest } from '../../shared/store.js'
|
|
|
|
export const indexRouter = Router()
|
|
|
|
indexRouter.get('/', async (_req, res, next) => {
|
|
try {
|
|
const manifest = await readManifest()
|
|
const definitionMap = new Map<string, Awaited<ReturnType<typeof loadPackDefinition>>>()
|
|
const keys = await listPackKeys()
|
|
for (const key of keys) {
|
|
definitionMap.set(key, await loadPackDefinition(key))
|
|
}
|
|
const packs = manifest.packs.map((entry) => ({
|
|
name: entry.name,
|
|
file: entry.file,
|
|
definition: definitionMap.get(entry.file) ?? null
|
|
}))
|
|
res.render('index', { packs })
|
|
} catch (error) {
|
|
next(error)
|
|
}
|
|
})
|