diff --git a/packages/rspeedy/core/package.json b/packages/rspeedy/core/package.json index a64c8f9595..82d6f17d92 100644 --- a/packages/rspeedy/core/package.json +++ b/packages/rspeedy/core/package.json @@ -41,7 +41,6 @@ "bin/rspeedy.js", "client", "dist", - "register", "client.d.ts", "CHANGELOG.md", "README.md" @@ -49,6 +48,7 @@ "scripts": { "api-extractor": "api-extractor run --verbose", "build": "rslib build", + "prepublishOnly": "rslib build", "test": "pnpm -w run test --project rspeedy", "test:type": "vitest --typecheck.only" }, diff --git a/packages/rspeedy/core/rslib.config.ts b/packages/rspeedy/core/rslib.config.ts index 425967b231..ebee51cca0 100644 --- a/packages/rspeedy/core/rslib.config.ts +++ b/packages/rspeedy/core/rslib.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from '@rslib/core' +import { defineConfig, type rsbuild } from '@rslib/core' import { pluginPublint } from 'rsbuild-plugin-publint' import { TypiaRspackPlugin } from 'typia-rspack-plugin' @@ -8,17 +8,7 @@ export default defineConfig({ format: 'esm', syntax: 'es2022', dts: { bundle: true }, - tools: { - rspack: { - plugins: [ - new TypiaRspackPlugin({ - cache: false, - include: './src/config/validate.ts', - tsconfig: './tsconfig.build.json', - }), - ], - }, - }, + plugins: [pluginTypia()], }, { format: 'esm', @@ -30,6 +20,7 @@ export default defineConfig({ }, }, dts: false, + plugins: [pluginTypia()], }, { format: 'esm', @@ -73,3 +64,25 @@ export default defineConfig({ }, }, }) + +function pluginTypia(): rsbuild.RsbuildPlugin { + return { + name: 'rspeedy-plugin-typia', + setup(api) { + api.modifyBundlerChain(chain => { + const { source } = api.getRsbuildConfig() + + chain + .plugin('typia') + .use(TypiaRspackPlugin, [ + { + cache: false, + include: './src/config/validate.ts', + tsconfig: source?.tsconfigPath, + log: false, + }, + ]) + }) + }, + } +}