taglib-wasm 0.3.3 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +293 -0
- package/NOTICE +34 -0
- package/README.md +122 -511
- package/dist/index.d.ts +132 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +137 -0
- package/dist/index.ts +220 -0
- package/dist/src/constants.d.ts +201 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.ts +227 -0
- package/dist/src/errors.d.ts +89 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.ts +237 -0
- package/dist/src/file-utils.d.ts +205 -0
- package/dist/src/file-utils.d.ts.map +1 -0
- package/dist/src/file-utils.ts +467 -0
- package/dist/src/file.js +47 -0
- package/dist/src/global.d.ts +10 -0
- package/dist/src/mod.d.ts +9 -0
- package/dist/src/mod.d.ts.map +1 -0
- package/dist/src/mod.ts +19 -0
- package/dist/src/simple.d.ts +347 -0
- package/dist/src/simple.d.ts.map +1 -0
- package/dist/src/simple.ts +659 -0
- package/dist/src/taglib.d.ts +502 -0
- package/dist/src/taglib.d.ts.map +1 -0
- package/dist/src/taglib.ts +959 -0
- package/dist/src/types.d.ts +323 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.ts +538 -0
- package/dist/src/utils/file.d.ts +15 -0
- package/dist/src/utils/file.d.ts.map +1 -0
- package/dist/src/utils/file.ts +82 -0
- package/dist/src/utils/write.d.ts +15 -0
- package/dist/src/utils/write.d.ts.map +1 -0
- package/dist/src/utils/write.ts +61 -0
- package/dist/src/wasm-workers.d.ts +33 -0
- package/dist/src/wasm-workers.d.ts.map +1 -0
- package/dist/src/wasm-workers.ts +176 -0
- package/dist/src/wasm.d.ts +97 -0
- package/dist/src/wasm.d.ts.map +1 -0
- package/dist/src/wasm.ts +133 -0
- package/dist/src/web-utils.d.ts +180 -0
- package/dist/src/web-utils.d.ts.map +1 -0
- package/dist/src/web-utils.ts +347 -0
- package/dist/src/workers.d.ts +219 -0
- package/dist/src/workers.d.ts.map +1 -0
- package/dist/src/workers.ts +465 -0
- package/dist/src/write.js +33 -0
- package/dist/taglib-wrapper.d.ts +5 -0
- package/dist/taglib-wrapper.js +14 -0
- package/dist/taglib.wasm +0 -0
- package/index.ts +100 -7
- package/package.json +40 -16
- package/src/errors.ts +237 -0
- package/src/file-utils.ts +467 -0
- package/src/global.d.ts +10 -0
- package/src/simple.ts +399 -84
- package/src/taglib.ts +522 -28
- package/src/types.ts +1 -1
- package/src/utils/file.ts +82 -0
- package/src/utils/write.ts +61 -0
- package/src/wasm-workers.ts +13 -4
- package/src/wasm.ts +1 -1
- package/src/web-utils.ts +347 -0
- package/src/workers.ts +32 -13
- package/build/taglib.js +0 -2407
- package/build/taglib.wasm +0 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Contributing to taglib-wasm
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to taglib-wasm! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## 🤝 Code of Conduct
|
|
6
|
+
|
|
7
|
+
Be respectful and constructive in all interactions. We're here to build great software together.
|
|
8
|
+
|
|
9
|
+
## 🚀 Getting Started
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- **Deno 2.x** - Primary development runtime
|
|
14
|
+
- **Node.js 22.6+** - For npm compatibility testing
|
|
15
|
+
- **Emscripten SDK** - For building WebAssembly
|
|
16
|
+
- **Git** - With git subtree support for TagLib updates
|
|
17
|
+
|
|
18
|
+
### Development Setup
|
|
19
|
+
|
|
20
|
+
1. **Clone the repository**
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/CharlesWiltgen/taglib-wasm.git
|
|
23
|
+
cd taglib-wasm
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Install Emscripten**
|
|
27
|
+
```bash
|
|
28
|
+
# Follow instructions at https://emscripten.org/docs/getting_started/downloads.html
|
|
29
|
+
# Or use brew on macOS:
|
|
30
|
+
brew install emscripten
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. **Build the project**
|
|
34
|
+
```bash
|
|
35
|
+
npm run build
|
|
36
|
+
# or
|
|
37
|
+
deno task build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
4. **Run tests**
|
|
41
|
+
```bash
|
|
42
|
+
npm test
|
|
43
|
+
# or
|
|
44
|
+
deno task test
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 📝 Development Guidelines
|
|
48
|
+
|
|
49
|
+
### Code Style
|
|
50
|
+
|
|
51
|
+
- **TypeScript**: Strict mode enabled, no `any` types without justification
|
|
52
|
+
- **Formatting**: Use Deno formatter (`deno fmt`)
|
|
53
|
+
- **Linting**: Pass Deno linter (`deno lint`)
|
|
54
|
+
- **Comments**: JSDoc for all public APIs
|
|
55
|
+
|
|
56
|
+
### Project Structure
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
taglib-wasm/
|
|
60
|
+
├── src/ # TypeScript source code
|
|
61
|
+
├── build/ # Build scripts and C++ wrapper
|
|
62
|
+
├── tests/ # Test files
|
|
63
|
+
├── docs/ # Documentation
|
|
64
|
+
├── examples/ # Usage examples
|
|
65
|
+
└── lib/taglib/ # TagLib C++ library (git subtree)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Key Files
|
|
69
|
+
|
|
70
|
+
- `build/taglib_embind.cpp` - C++ wrapper using Embind
|
|
71
|
+
- `src/taglib.ts` - Core TypeScript API
|
|
72
|
+
- `src/simple.ts` - Simplified API
|
|
73
|
+
- `tests/index.test.ts` - Main test suite
|
|
74
|
+
|
|
75
|
+
## 🧪 Testing
|
|
76
|
+
|
|
77
|
+
### Running Tests
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Run all tests
|
|
81
|
+
npm test
|
|
82
|
+
|
|
83
|
+
# Run specific test category
|
|
84
|
+
npm run test:core # Core functionality
|
|
85
|
+
npm run test:edge # Edge cases
|
|
86
|
+
npm run test:errors # Error handling
|
|
87
|
+
npm run test:memory # Memory management
|
|
88
|
+
|
|
89
|
+
# Watch mode
|
|
90
|
+
npm run test:watch
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Writing Tests
|
|
94
|
+
|
|
95
|
+
- Use Deno's built-in test framework
|
|
96
|
+
- Place tests in `tests/` directory
|
|
97
|
+
- Follow existing test patterns
|
|
98
|
+
- Test both success and error cases
|
|
99
|
+
- Include edge cases for new features
|
|
100
|
+
|
|
101
|
+
Example test:
|
|
102
|
+
```typescript
|
|
103
|
+
Deno.test("feature description", async () => {
|
|
104
|
+
const taglib = await TagLib.initialize();
|
|
105
|
+
const audioFile = await taglib.open(testFile);
|
|
106
|
+
try {
|
|
107
|
+
// Test your feature
|
|
108
|
+
assertEquals(result, expected);
|
|
109
|
+
} finally {
|
|
110
|
+
audioFile.dispose();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 💻 Making Changes
|
|
116
|
+
|
|
117
|
+
### Workflow
|
|
118
|
+
|
|
119
|
+
1. **Fork the repository**
|
|
120
|
+
2. **Create a feature branch**
|
|
121
|
+
```bash
|
|
122
|
+
git checkout -b feat/your-feature-name
|
|
123
|
+
# or
|
|
124
|
+
git checkout -b fix/issue-description
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
3. **Make your changes**
|
|
128
|
+
- Write code following the style guide
|
|
129
|
+
- Add tests for new functionality
|
|
130
|
+
- Update documentation as needed
|
|
131
|
+
|
|
132
|
+
4. **Test your changes**
|
|
133
|
+
```bash
|
|
134
|
+
npm test
|
|
135
|
+
deno task fmt # Format code
|
|
136
|
+
deno task lint # Check for issues
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
5. **Commit your changes**
|
|
140
|
+
- Follow [Conventional Commits](https://www.conventionalcommits.org/)
|
|
141
|
+
- See commit examples below
|
|
142
|
+
|
|
143
|
+
6. **Push and create PR**
|
|
144
|
+
```bash
|
|
145
|
+
git push origin feat/your-feature-name
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Commit Message Format
|
|
149
|
+
|
|
150
|
+
Use the Conventional Commits specification:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
<type>[optional scope]: <description>
|
|
154
|
+
|
|
155
|
+
[optional body]
|
|
156
|
+
|
|
157
|
+
[optional footer(s)]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Types
|
|
161
|
+
- `feat`: New feature
|
|
162
|
+
- `fix`: Bug fix
|
|
163
|
+
- `docs`: Documentation changes
|
|
164
|
+
- `style`: Code style changes (formatting, etc.)
|
|
165
|
+
- `refactor`: Code refactoring
|
|
166
|
+
- `test`: Test additions or modifications
|
|
167
|
+
- `chore`: Maintenance tasks
|
|
168
|
+
- `perf`: Performance improvements
|
|
169
|
+
|
|
170
|
+
#### Examples
|
|
171
|
+
```
|
|
172
|
+
feat: add FLAC metadata support
|
|
173
|
+
fix: resolve memory leak in dispose method
|
|
174
|
+
docs: update API reference for SimpleAPI
|
|
175
|
+
test: add edge cases for Unicode handling
|
|
176
|
+
chore: update TagLib to v2.1.1
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 🔧 Building WebAssembly
|
|
180
|
+
|
|
181
|
+
If you modify the C++ wrapper (`build/taglib_embind.cpp`):
|
|
182
|
+
|
|
183
|
+
1. **Edit the C++ code**
|
|
184
|
+
2. **Rebuild Wasm**
|
|
185
|
+
```bash
|
|
186
|
+
npm run build:wasm
|
|
187
|
+
```
|
|
188
|
+
3. **Test thoroughly** - C++ changes can break everything
|
|
189
|
+
|
|
190
|
+
### C++ Guidelines
|
|
191
|
+
|
|
192
|
+
- Use `std::unique_ptr` for memory management
|
|
193
|
+
- Validate all inputs from JavaScript
|
|
194
|
+
- Handle exceptions gracefully
|
|
195
|
+
- Use Embind's `val` type for JavaScript objects
|
|
196
|
+
- Document any new exported functions
|
|
197
|
+
|
|
198
|
+
## 📚 Documentation
|
|
199
|
+
|
|
200
|
+
### When to Update Docs
|
|
201
|
+
|
|
202
|
+
Update documentation when you:
|
|
203
|
+
- Add new features
|
|
204
|
+
- Change API behavior
|
|
205
|
+
- Fix confusing aspects
|
|
206
|
+
- Add examples
|
|
207
|
+
|
|
208
|
+
### Documentation Structure
|
|
209
|
+
|
|
210
|
+
- `README.md` - Main project documentation
|
|
211
|
+
- `docs/API-Reference.md` - Complete API documentation
|
|
212
|
+
- `docs/guide/` - User guides and tutorials
|
|
213
|
+
- `examples/` - Working code examples
|
|
214
|
+
|
|
215
|
+
## 🐛 Reporting Issues
|
|
216
|
+
|
|
217
|
+
### Before Creating an Issue
|
|
218
|
+
|
|
219
|
+
1. Check existing issues
|
|
220
|
+
2. Try with the latest version
|
|
221
|
+
3. Verify it's not a TagLib limitation
|
|
222
|
+
|
|
223
|
+
### Issue Template
|
|
224
|
+
|
|
225
|
+
```markdown
|
|
226
|
+
**Description**
|
|
227
|
+
Clear description of the issue
|
|
228
|
+
|
|
229
|
+
**Steps to Reproduce**
|
|
230
|
+
1. Code example
|
|
231
|
+
2. Expected behavior
|
|
232
|
+
3. Actual behavior
|
|
233
|
+
|
|
234
|
+
**Environment**
|
|
235
|
+
- taglib-wasm version:
|
|
236
|
+
- Runtime: [Deno/Node.js/Browser]
|
|
237
|
+
- OS:
|
|
238
|
+
|
|
239
|
+
**Additional Context**
|
|
240
|
+
Error messages, logs, etc.
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## 🚀 Pull Request Process
|
|
244
|
+
|
|
245
|
+
1. **Ensure all tests pass**
|
|
246
|
+
2. **Update documentation** if needed
|
|
247
|
+
3. **Add tests** for new features
|
|
248
|
+
4. **Keep PRs focused** - one feature/fix per PR
|
|
249
|
+
5. **Fill out PR template** completely
|
|
250
|
+
|
|
251
|
+
### PR Template
|
|
252
|
+
|
|
253
|
+
```markdown
|
|
254
|
+
## Description
|
|
255
|
+
Brief description of changes
|
|
256
|
+
|
|
257
|
+
## Type of Change
|
|
258
|
+
- [ ] Bug fix
|
|
259
|
+
- [ ] New feature
|
|
260
|
+
- [ ] Breaking change
|
|
261
|
+
- [ ] Documentation update
|
|
262
|
+
|
|
263
|
+
## Testing
|
|
264
|
+
- [ ] All tests pass
|
|
265
|
+
- [ ] Added new tests
|
|
266
|
+
- [ ] Tested on [Deno/Node.js/Bun/Browser]
|
|
267
|
+
|
|
268
|
+
## Checklist
|
|
269
|
+
- [ ] Follows code style
|
|
270
|
+
- [ ] Updated documentation
|
|
271
|
+
- [ ] Added to CHANGELOG (if applicable)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## 🔄 Updating TagLib
|
|
275
|
+
|
|
276
|
+
To update the TagLib C++ library:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
./scripts/update-taglib.sh [version]
|
|
280
|
+
# Default: v2.1
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
This uses git subtree to update `lib/taglib/`.
|
|
284
|
+
|
|
285
|
+
## ❓ Questions?
|
|
286
|
+
|
|
287
|
+
- Open a discussion on GitHub
|
|
288
|
+
- Check existing issues
|
|
289
|
+
- Review the documentation
|
|
290
|
+
|
|
291
|
+
## 🙏 Thank You!
|
|
292
|
+
|
|
293
|
+
Your contributions make taglib-wasm better for everyone. We appreciate your time and effort!
|
package/NOTICE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
taglib-wasm
|
|
2
|
+
Copyright (c) 2024 Charles Wiltgen
|
|
3
|
+
|
|
4
|
+
This product includes software developed by:
|
|
5
|
+
- Scott Wheeler and the TagLib contributors (https://taglib.org/)
|
|
6
|
+
|
|
7
|
+
DUAL LICENSING NOTICE:
|
|
8
|
+
=====================
|
|
9
|
+
|
|
10
|
+
1. TypeScript/JavaScript Code (src/, index.ts, examples/):
|
|
11
|
+
- Licensed under the MIT License
|
|
12
|
+
- See LICENSE file for details
|
|
13
|
+
|
|
14
|
+
2. WebAssembly Binary (build/taglib.wasm):
|
|
15
|
+
- Contains compiled TagLib library code
|
|
16
|
+
- Licensed under LGPL-2.1-or-later
|
|
17
|
+
- Original TagLib source: lib/taglib/
|
|
18
|
+
- See lib/taglib/COPYING.LGPL for license terms
|
|
19
|
+
|
|
20
|
+
LGPL COMPLIANCE:
|
|
21
|
+
===============
|
|
22
|
+
The WebAssembly binary is subject to LGPL requirements. This means:
|
|
23
|
+
- You may use it in commercial applications
|
|
24
|
+
- Modifications to TagLib must be shared under LGPL
|
|
25
|
+
- You must enable users to relink with modified TagLib versions
|
|
26
|
+
|
|
27
|
+
To rebuild the WebAssembly binary with a modified TagLib:
|
|
28
|
+
1. Modify the TagLib source in lib/taglib/
|
|
29
|
+
2. Run: npm run build:wasm
|
|
30
|
+
3. The new binary will be in build/taglib.wasm
|
|
31
|
+
|
|
32
|
+
For questions about licensing, please see:
|
|
33
|
+
- https://www.gnu.org/licenses/lgpl-2.1.html
|
|
34
|
+
- https://github.com/CharlesWiltgen/taglib-wasm/issues
|