Merge main into release for tag v1.15.1

This commit is contained in:
github-actions[bot]
2025-09-12 15:16:52 +00:00
6 changed files with 47 additions and 24 deletions
+3
View File
@@ -29,6 +29,9 @@ api-extractor run -c packages/mp3-encoder/api-extractor.json
tsx scripts/check-docblocks.ts dist/mediabunny.d.ts
tsx scripts/check-docblocks.ts packages/mp3-encoder/dist/mediabunny-mp3-encoder.d.ts
# Checks that API docs are generatable
npm run docs:generate -- --dry
# Appends stuff to the declaration files to register the global variables these libraries expose
echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts
echo 'export as namespace MediabunnyMp3Encoder;' >> packages/mp3-encoder/dist/mediabunny-mp3-encoder.d.ts
+6 -6
View File
@@ -1,12 +1,12 @@
{
"name": "mediabunny",
"version": "1.15.0",
"version": "1.15.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mediabunny",
"version": "1.15.0",
"version": "1.15.1",
"license": "MPL-2.0",
"workspaces": [
"packages/*"
@@ -7749,9 +7749,9 @@
}
},
"node_modules/mediabunny": {
"version": "1.14.4",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.14.4.tgz",
"integrity": "sha512-WXY384sVkUOGKF2OuQgLqo8+dwX1MLYnpkSDoaPa+oNed4tP4L5u0/Vq0yZQEmcaBO7rRFusMDSBcbrp66R++A==",
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/mediabunny/-/mediabunny-1.15.0.tgz",
"integrity": "sha512-yeqr+4sRNzl7QqeHckr+SgPKfaQwSSmhTdVSgKgbenneC+TFlBrk+zCRhF9b7kwLtrm6qziJc/flqYQccX6W/Q==",
"license": "MPL-2.0",
"peer": true,
"workspaces": [
@@ -12242,7 +12242,7 @@
},
"packages/mp3-encoder": {
"name": "@mediabunny/mp3-encoder",
"version": "1.15.0",
"version": "1.15.1",
"license": "MPL-2.0",
"devDependencies": {
"@types/emscripten": "^1.40.1"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "mediabunny",
"author": "Vanilagy",
"version": "1.15.0",
"version": "1.15.1",
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
"type": "module",
"workspaces": [
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@mediabunny/mp3-encoder",
"author": "Vanilagy",
"version": "1.15.0",
"version": "1.15.1",
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
+35 -16
View File
@@ -16,7 +16,7 @@ import * as ts from 'typescript';
import * as fs from 'fs';
import * as path from 'path';
const generateDocs = (entryFiles: string[], apiConfigFile: string) => {
const generateDocs = (entryFiles: string[], apiConfigFile: string, dry = false) => {
const program = ts.createProgram(entryFiles, {
target: ts.ScriptTarget.ES2020,
module: ts.ModuleKind.ESNext,
@@ -55,11 +55,13 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string) => {
delete groupConfig['heading'];
delete groupConfig['intro'];
// Clear and recreate output directory
if (fs.existsSync(outputDir)) {
fs.rmSync(outputDir, { recursive: true });
// Clear and recreate output directory (skip if dry run)
if (!dry) {
if (fs.existsSync(outputDir)) {
fs.rmSync(outputDir, { recursive: true });
}
fs.mkdirSync(outputDir, { recursive: true });
}
fs.mkdirSync(outputDir, { recursive: true });
// Collect all exported types for cross-referencing
const exportedTypes = new Set<string>();
@@ -1539,9 +1541,11 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string) => {
}
const finalMarkdown = markdown.replace('<!-- USED_BY_SECTION -->', usedByMarkdown);
const outputPath = path.join(outputDir, `${symbolName}.md`);
fs.writeFileSync(outputPath, finalMarkdown);
console.log(`Generated: ${outputPath}`);
if (!dry) {
const outputPath = path.join(outputDir, `${symbolName}.md`);
fs.writeFileSync(outputPath, finalMarkdown);
console.log(`Generated: ${outputPath}`);
}
});
// Generate index.md with all exported symbols grouped by group
@@ -1587,9 +1591,11 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string) => {
indexMarkdown += '\n';
});
const indexPath = path.join(outputDir, 'index.md');
fs.writeFileSync(indexPath, indexMarkdown);
console.log(`Generated: ${indexPath}`);
if (!dry) {
const indexPath = path.join(outputDir, 'index.md');
fs.writeFileSync(indexPath, indexMarkdown);
console.log(`Generated: ${indexPath}`);
}
// Generate index.json with sidebar config structure
const sidebarConfig = sortedGroups.map((group) => {
@@ -1607,15 +1613,28 @@ const generateDocs = (entryFiles: string[], apiConfigFile: string) => {
};
});
const jsonPath = path.join(outputDir, 'index.json');
fs.writeFileSync(jsonPath, JSON.stringify(sidebarConfig, null, 2));
console.log(`Generated: ${jsonPath}`);
if (!dry) {
const jsonPath = path.join(outputDir, 'index.json');
fs.writeFileSync(jsonPath, JSON.stringify(sidebarConfig, null, 2));
console.log(`Generated: ${jsonPath}`);
}
};
const main = () => {
const args = process.argv.slice(2);
// Check for --dry flag
const dryIndex = args.indexOf('--dry');
const dry = dryIndex !== -1;
// Remove --dry flag from args
if (dry) {
args.splice(dryIndex, 1);
}
if (args.length < 2) {
console.error('Usage: npm run generate-docs <entry-file1> [entry-file2 ...] <api-config-file>');
console.error('Usage: npm run generate-docs [--dry] <entry-file1> [entry-file2 ...] <api-config-file>');
console.error(' --dry: Check if docs are generatable without writing files');
console.error(' entry-files: One or more TypeScript entry files');
console.error(' api-config-file: JSON config file defining groups');
process.exit(1);
@@ -1625,7 +1644,7 @@ const main = () => {
const apiConfigFile = args[args.length - 1]!;
const entryFiles = args.slice(0, -1);
generateDocs(entryFiles, apiConfigFile);
generateDocs(entryFiles, apiConfigFile, dry);
};
main();
+1
View File
@@ -731,6 +731,7 @@ const isVideoFrame = (x: unknown): x is VideoFrame => {
/**
* Specifies the rectangular cropping region.
* @group Miscellaneous
* @public
*/
export type CropRectangle = {