Files
Meting/rollup.config.js
METO 041d6b56df refactor: 重构为 nodejs 语言 (#118)
* feat: migrate from PHP to Node.js implementation

- Replace PHP implementation with Node.js version
- Add Node.js package configuration (package.json, package-lock.json)
- Add Rollup build configuration for browser compatibility
- Update README with Node.js usage examples and API documentation
- Add comprehensive test suite for all supported platforms
- Add Claude Code development instructions (CLAUDE.md)
- Remove PHP-specific files (composer.json, src/Meting.php)
- Update GitHub workflows for Node.js environment

This migration maintains API compatibility while providing:
- Promise-based async/await support
- ES6 class design with method chaining
- Zero external dependencies (Node.js built-in modules only)
- Support for all existing music platforms (netease, tencent, xiami, kugou, baidu, kuwo)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* refactor: 重构为 Provider 模式架构

- 引入统一的 Provider 接口,实现平台解耦
- 将原有单体文件拆分为模块化 Provider 系统
- 实现真正的内部闭环设计,每个 Provider 独立处理编码/解码
- 优化构建系统,支持版本号注入和 TypeScript 定义生成
- 完善测试覆盖,支持独立平台测试
- 新增架构文档,详细说明设计模式和开发流程

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* fix: 修复 ES Module 导入问题,添加 package.json exports 配置

- 添加 module 字段指向 ESM 版本构建文件
- 添加 exports 字段支持双包发布模式
- 修正 main 字段路径格式
- 解决 import Meting from '@meting/core'; 导入失败问题

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>

* refactor: 简化网易云音乐架构并恢复 search option 参数支持

- 移除 WebAPI 支持,统一使用 EAPI 架构,简化代码结构
- 删除复杂的选项管理系统和全局配置
- 恢复 search 接口的 option 参数支持(type, page, limit)
- 优化构建配置和代码压缩设置
- 更新文档和测试以反映新的 API 结构

Breaking Changes:
- 移除 setOption() 方法
- 删除 WebAPI (weapi) 相关代码
- 简化 netease provider 为纯 EAPI 实现

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Happy <[email protected]>
2025-10-10 13:00:21 +08:00

47 lines
1.0 KiB
JavaScript

import { nodeResolve } from '@rollup/plugin-node-resolve';
import { babel } from '@rollup/plugin-babel';
import { readFileSync } from 'fs';
import terser from '@rollup/plugin-terser'
// 读取 package.json 中的版本号
const packageInfo = JSON.parse(readFileSync('./package.json', 'utf8'));
export default {
input: 'src/meting.js',
output: [
{
file: 'lib/meting.esm.js',
format: 'es'
},
{
file: 'lib/meting.js',
format: 'cjs',
exports: 'auto'
}
],
plugins: [
nodeResolve({
preferBuiltins: true
}),
babel({ babelHelpers: 'bundled' }),
// 版本号注入插件
{
name: 'inject-version',
transform(code, id) {
if (id.endsWith('src/meting.js')) {
return code.replace('__VERSION__', packageInfo.version);
}
return null;
}
},
terser({
format: {
comments: false
},
compress: {
drop_console: false
}
})
],
external: ['crypto', 'url', 'fs', 'path']
};