Refactor type build: inline external types, simplify scripts

Removed custom build scripts for copying and inlining types, consolidating all post-build logic into a single enhanced post-build.mjs script. The new script processes .d.ts files, inlines external module types, updates imports, and copies necessary files to dist, eliminating the need for external-shims and simplifying the build process. Updated package.json scripts accordingly.

Refactor type inlining: remove shims, auto-extract types

Removed external-shims.d.ts and its references, replacing manual shims with an automated script that extracts type definitions from node_modules. Updated build scripts, dependencies, and test files to support the new inlining process. The inline-types.mjs script now scans for external imports, generates inline type files, and rewrites imports as import type, eliminating the need for hand-written shims.

Add type inlining script and update build process

Introduced a new script (inline-types.mjs) to inline external type dependencies into the dist directory, updated the build process to use this script, and removed the now-unnecessary external-shims.d.ts from the copy-dist script. Added a test file to verify inlined types, updated dependencies to include ts-morph, and adjusted package.json and pnpm-lock.yaml accordingly.
This commit is contained in:
手瓜一十雪 committed 2026-01-29 15:27:46 +08:00
1 parent b958e9e803
commit 542036f46e
7 files changed
+115 -47

No files matched your search

-21
View File
@@ -308,30 +308,9 @@ importers:
'@sinclair/typebox':
specifier: ^0.34.38
version: 0.34.41
'@types/cors':
specifier: ^2.8.17
version: 2.8.19
'@types/express':
specifier: ^4.17.21
version: 4.17.25
'@types/ip':
specifier: ^1.1.3
version: 1.1.3
'@types/multer':
specifier: ^1.4.12
version: 1.4.13
'@types/node':
specifier: ^22.10.7
version: 22.19.1
'@types/winston':
specifier: ^2.4.4
version: 2.4.4
'@types/ws':
specifier: ^8.5.12
version: 8.18.1
'@types/yaml':
specifier: ^1.9.7
version: 1.9.7
devDependencies:
napcat-core:
specifier: workspace:*