mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-28 12:01:22 +08:00
* fix: get_group_info ownerUin is "0" * Add native module loading and improve logging Loaded a native module in NTQQGroupApi and added test calls to sendSsoCmdReqByContend with different parameter types. Changed fileLog default to true in config. Enhanced NativePacketClient with detailed send/receive logging. Updated NodeIKernelMsgService to accept unknown type for sendSsoCmdReqByContend param. Added process PID logging in napcat shell. * feat: new napcat-4.9.0-beta * feat: Add FFmpeg native addon and TypeScript definitions Introduced FFmpeg Node.js native addon binaries for multiple platforms (darwin-arm64, linux-arm64, linux-x64, win-x64) and added TypeScript type definitions for the addon interface, including video info extraction, duration detection, audio conversion, and PCM decoding. * Remove baseClient and simplify packet client selection Deleted baseClient.ts and moved its logic into nativeClient.ts, making NativePacketClient a standalone class. Refactored PacketClientContext to always use NativePacketClient, removing support for multiple packet backends and related selection logic. Updated binary for napi2native.win32.x64.node. * Remove debug log for process PID in napcat.ts Eliminated an unnecessary console.log statement that printed the process PID. This cleans up the output and removes leftover debugging code. * fix: getQQBuildStr * fix: 简化代码 * refactor: 大幅度调整send * feat: ffmpeg enhance for native node addon * Remove baseClient.ts from packet client module Deleted the src/core/packet/client/baseClient.ts file, which contained the PacketClient class and related interfaces. This may be part of a refactor or cleanup to remove unused or redundant code. * Remove 'bmp24' argument from getVideoInfo call Updated the extractThumbnail method to call addon.getVideoInfo without the 'bmp24' argument, aligning with the updated addon API. * refactor: 重构目录删除旧支持 * feat: raw包能力增强完成 * refactor: 规范化 * feat: packet能力增强 * feat: 9.9.22-40824 & 9.9.22-40768 * Refactor addon path resolution and rename Windows addon Simplifies the logic for resolving the ffmpeg addon path by dynamically constructing the filename from process.platform and process.arch. Also renames the Windows x64 addon file to ffmpegAddon.win32.x64.node for consistency. * Add mappings for 3.2.20 versions in napi2native.json Added send and recv address mappings for 3.2.20-x64 and 3.2.20-arm64 builds to support additional versions in napi2native.json. --------- Co-authored-by: Clansty <i@gao4.pw>
210 lines
7.3 KiB
TypeScript
210 lines
7.3 KiB
TypeScript
import cp from 'vite-plugin-cp';
|
|
import { defineConfig, PluginOption, UserConfig } from 'vite';
|
|
import { resolve } from 'path';
|
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
import { builtinModules } from 'module';
|
|
import { performanceMonitorPlugin } from './vite-plugin-performance-monitor';
|
|
//依赖排除
|
|
const external = [
|
|
'silk-wasm',
|
|
'ws',
|
|
'express'
|
|
];
|
|
const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat();
|
|
|
|
let startScripts: string[] | undefined = undefined;
|
|
if (process.env.NAPCAT_BUILDSYS == 'linux') {
|
|
startScripts = [];
|
|
} else if (process.env.NAPCAT_BUILDSYS == 'win32') {
|
|
startScripts = ['./script/KillQQ.bat'];
|
|
} else {
|
|
startScripts = ['./script/KillQQ.bat'];
|
|
}
|
|
|
|
const UniversalBaseConfigPlugin: PluginOption[] = [
|
|
// performanceMonitorPlugin({
|
|
// enabled: process.env.NODE_ENV !== 'production',
|
|
// exclude: [/node_modules/, /\.min\./, /performance-monitor/],
|
|
// include: [/\.ts$/, /\.js$/]
|
|
// }),
|
|
cp({
|
|
targets: [
|
|
{ src: './manifest.json', dest: 'dist' },
|
|
{ src: './src/core/external/napcat.json', dest: 'dist/config/' },
|
|
{ src: './src/native/', dest: 'dist/native', flatten: false },
|
|
{ src: './napcat.webui/dist/', dest: 'dist/static/', flatten: false },
|
|
{ src: './src/framework/liteloader.cjs', dest: 'dist' },
|
|
{ src: './src/framework/napcat.cjs', dest: 'dist' },
|
|
{ src: './src/framework/preload.cjs', dest: 'dist' },
|
|
{ src: './src/framework/renderer.js', dest: 'dist' },
|
|
{ src: './package.json', dest: 'dist' },
|
|
{ src: './logo.png', dest: 'dist' },
|
|
{ src: './launcher/', dest: 'dist', flatten: true },
|
|
...startScripts.map((startScript) => {
|
|
return { src: startScript, dest: 'dist' };
|
|
}),
|
|
],
|
|
}),
|
|
nodeResolve(),
|
|
];
|
|
|
|
const FrameworkBaseConfigPlugin: PluginOption[] = [
|
|
// performanceMonitorPlugin({
|
|
// enabled: process.env.NODE_ENV !== 'production',
|
|
// exclude: [/node_modules/, /\.min\./, /performance-monitor/],
|
|
// include: [/\.ts$/, /\.js$/]
|
|
// }),
|
|
cp({
|
|
targets: [
|
|
{ src: './src/native/', dest: 'dist/native', flatten: false },
|
|
{ src: './manifest.json', dest: 'dist' },
|
|
{ src: './src/core/external/napcat.json', dest: 'dist/config/' },
|
|
{ src: './napcat.webui/dist/', dest: 'dist/static/', flatten: false },
|
|
{ src: './src/framework/liteloader.cjs', dest: 'dist' },
|
|
{ src: './src/framework/napcat.cjs', dest: 'dist' },
|
|
{ src: './src/framework/nativeLoader.cjs', dest: 'dist' },
|
|
{ src: './src/framework/preload.cjs', dest: 'dist' },
|
|
{ src: './src/framework/renderer.js', dest: 'dist' },
|
|
{ src: './package.json', dest: 'dist' },
|
|
{ src: './logo.png', dest: 'dist' },
|
|
],
|
|
}),
|
|
nodeResolve(),
|
|
];
|
|
|
|
const ShellBaseConfigPlugin: PluginOption[] = [
|
|
// performanceMonitorPlugin({
|
|
// enabled: process.env.NODE_ENV !== 'production',
|
|
// exclude: [/node_modules/, /\.min\./, /performance-monitor/],
|
|
// include: [/\.ts$/, /\.js$/]
|
|
// }),
|
|
cp({
|
|
targets: [
|
|
{ src: './src/native/', dest: 'dist/native', flatten: false },
|
|
{ src: './napcat.webui/dist/', dest: 'dist/static/', flatten: false },
|
|
{ src: './src/core/external/napcat.json', dest: 'dist/config/' },
|
|
{ src: './package.json', dest: 'dist' },
|
|
{ src: './launcher/', dest: 'dist', flatten: true },
|
|
...startScripts.map((startScript) => {
|
|
return { src: startScript, dest: 'dist' };
|
|
}),
|
|
],
|
|
}),
|
|
nodeResolve(),
|
|
];
|
|
const UniversalBaseConfig = () =>
|
|
defineConfig({
|
|
resolve: {
|
|
conditions: ['node', 'default'],
|
|
alias: {
|
|
'@/core': resolve(__dirname, './src/core'),
|
|
'@': resolve(__dirname, './src'),
|
|
'@webapi': resolve(__dirname, './src/webui/src'),
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: false,
|
|
target: 'esnext',
|
|
minify: false,
|
|
lib: {
|
|
entry: {
|
|
napcat: 'src/universal/napcat.ts',
|
|
'audio-worker': 'src/common/audio-worker.ts',
|
|
'worker/conoutSocketWorker': 'src/pty/worker/conoutSocketWorker.ts',
|
|
},
|
|
formats: ['es'],
|
|
fileName: (_, entryName) => `${entryName}.mjs`,
|
|
},
|
|
rollupOptions: {
|
|
external: [...nodeModules, ...external],
|
|
},
|
|
},
|
|
});
|
|
|
|
const ShellBaseConfig = () =>
|
|
defineConfig({
|
|
resolve: {
|
|
conditions: ['node', 'default'],
|
|
alias: {
|
|
'@/core': resolve(__dirname, './src/core'),
|
|
'@': resolve(__dirname, './src'),
|
|
'@webapi': resolve(__dirname, './src/webui/src'),
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: false,
|
|
target: 'esnext',
|
|
minify: false,
|
|
lib: {
|
|
entry: {
|
|
napcat: 'src/shell/napcat.ts',
|
|
'audio-worker': 'src/common/audio-worker.ts',
|
|
'worker/conoutSocketWorker': 'src/pty/worker/conoutSocketWorker.ts',
|
|
},
|
|
formats: ['es'],
|
|
fileName: (_, entryName) => `${entryName}.mjs`,
|
|
},
|
|
rollupOptions: {
|
|
external: [...nodeModules, ...external],
|
|
},
|
|
},
|
|
});
|
|
|
|
const FrameworkBaseConfig = () =>
|
|
defineConfig({
|
|
resolve: {
|
|
conditions: ['node', 'default'],
|
|
alias: {
|
|
'@/core': resolve(__dirname, './src/core'),
|
|
'@': resolve(__dirname, './src'),
|
|
'@webapi': resolve(__dirname, './src/webui/src'),
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: false,
|
|
target: 'esnext',
|
|
minify: false,
|
|
lib: {
|
|
entry: {
|
|
napcat: 'src/framework/napcat.ts',
|
|
'audio-worker': 'src/common/audio-worker.ts',
|
|
'worker/conoutSocketWorker': 'src/pty/worker/conoutSocketWorker.ts',
|
|
},
|
|
formats: ['es'],
|
|
fileName: (_, entryName) => `${entryName}.mjs`,
|
|
},
|
|
rollupOptions: {
|
|
external: [...nodeModules, ...external],
|
|
},
|
|
},
|
|
});
|
|
|
|
export default defineConfig(({ mode }): UserConfig => {
|
|
if (mode === 'shell') {
|
|
return {
|
|
...ShellBaseConfig(),
|
|
plugins: [...ShellBaseConfigPlugin],
|
|
};
|
|
} else if (mode == 'universal') {
|
|
return {
|
|
...UniversalBaseConfig(),
|
|
plugins: [...UniversalBaseConfigPlugin],
|
|
};
|
|
} else if (mode == 'shell-analysis') {
|
|
return {
|
|
...ShellBaseConfig(),
|
|
plugins: [
|
|
performanceMonitorPlugin({
|
|
exclude: [/node_modules/, /\.min\./, /performance-monitor\.ts$/, /packet/],
|
|
include: [/\.ts$/, /\.js$/]
|
|
}),
|
|
...ShellBaseConfigPlugin
|
|
],
|
|
};
|
|
} else
|
|
return {
|
|
...FrameworkBaseConfig(),
|
|
plugins: [...FrameworkBaseConfigPlugin],
|
|
};
|
|
});
|