mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 21:33:52 +02:00
Revise build step and dist structure for better Webpack, CJS and pnpm support
This commit is contained in:
@@ -2,6 +2,7 @@ name: Lint
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/build
|
|
||||||
/dist
|
/dist
|
||||||
/dist-docs
|
/dist-docs
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ For development, clone this repository and install it using a modern version of
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install # Install dependencies
|
npm install # Install dependencies
|
||||||
npm run watch # Development build with watch mode
|
npm run watch # Build bundles on watch mode
|
||||||
|
|
||||||
npm run build # Production build with type definitions
|
npm run build # Production build with type definitions
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "build/index.d.ts",
|
"mainEntryPointFilePath": "dist/modules/index.d.ts",
|
||||||
"bundledPackages": [],
|
"bundledPackages": [],
|
||||||
"compiler": {},
|
"compiler": {},
|
||||||
"apiReport": {
|
"apiReport": {
|
||||||
|
|||||||
@@ -37,20 +37,20 @@ const esmConfig = {
|
|||||||
|
|
||||||
const ctxUmd = await esbuild.context({
|
const ctxUmd = await esbuild.context({
|
||||||
...umdConfig,
|
...umdConfig,
|
||||||
outfile: 'dist/mediabunny.js',
|
outfile: 'dist/bundles/mediabunny.cjs',
|
||||||
});
|
});
|
||||||
const ctxEsm = await esbuild.context({
|
const ctxEsm = await esbuild.context({
|
||||||
...esmConfig,
|
...esmConfig,
|
||||||
outfile: 'dist/mediabunny.mjs',
|
outfile: 'dist/bundles/mediabunny.mjs',
|
||||||
});
|
});
|
||||||
const ctxUmdMinified = await esbuild.context({
|
const ctxUmdMinified = await esbuild.context({
|
||||||
...umdConfig,
|
...umdConfig,
|
||||||
outfile: 'dist/mediabunny.min.js',
|
outfile: 'dist/bundles/mediabunny.min.cjs',
|
||||||
minify: true,
|
minify: true,
|
||||||
});
|
});
|
||||||
const ctxEsmMinified = await esbuild.context({
|
const ctxEsmMinified = await esbuild.context({
|
||||||
...esmConfig,
|
...esmConfig,
|
||||||
outfile: 'dist/mediabunny.min.mjs',
|
outfile: 'dist/bundles/mediabunny.min.mjs',
|
||||||
minify: true,
|
minify: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<script src="../dist/mediabunny.js"></script>
|
<script src="../dist/bundles/mediabunny.cjs"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const fileInput = document.createElement('input');
|
const fileInput = document.createElement('input');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<script src="../dist/mediabunny.js"></script>
|
<script src="../dist/bundles/mediabunny.cjs"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const fileInput = document.createElement('input');
|
const fileInput = document.createElement('input');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<button>Go</button>
|
<button>Go</button>
|
||||||
|
|
||||||
<script src="../dist/mediabunny.js"></script>
|
<script src="../dist/bundles/mediabunny.cjs"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
function download(blob, filename) {
|
function download(blob, filename) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<script src="../dist/mediabunny.js"></script>
|
<script src="../dist/bundles/mediabunny.cjs"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
function download(blob, filename) {
|
function download(blob, filename) {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../dist/mediabunny.js"></script>
|
<script src="../dist/bundles/mediabunny.cjs"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const fileInput = document.querySelector('input[type="file"]');
|
const fileInput = document.querySelector('input[type="file"]');
|
||||||
|
|||||||
Generated
+22
-36
@@ -319,9 +319,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-string-parser": {
|
"node_modules/@babel/helper-string-parser": {
|
||||||
"version": "7.25.9",
|
"version": "7.27.1",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
|
||||||
"integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
|
"integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -329,9 +329,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-validator-identifier": {
|
"node_modules/@babel/helper-validator-identifier": {
|
||||||
"version": "7.25.9",
|
"version": "7.27.1",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
|
||||||
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
|
"integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -339,13 +339,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/parser": {
|
"node_modules/@babel/parser": {
|
||||||
"version": "7.27.0",
|
"version": "7.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz",
|
||||||
"integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==",
|
"integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/types": "^7.27.0"
|
"@babel/types": "^7.28.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"parser": "bin/babel-parser.js"
|
"parser": "bin/babel-parser.js"
|
||||||
@@ -355,14 +355,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/types": {
|
"node_modules/@babel/types": {
|
||||||
"version": "7.27.0",
|
"version": "7.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.0.tgz",
|
||||||
"integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==",
|
"integrity": "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-string-parser": "^7.25.9",
|
"@babel/helper-string-parser": "^7.27.1",
|
||||||
"@babel/helper-validator-identifier": "^7.25.9"
|
"@babel/helper-validator-identifier": "^7.27.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
@@ -1238,18 +1238,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.8",
|
"version": "0.3.12",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
|
||||||
"integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
|
"integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/set-array": "^1.2.1",
|
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
|
||||||
"@jridgewell/trace-mapping": "^0.3.24"
|
"@jridgewell/trace-mapping": "^0.3.24"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/resolve-uri": {
|
"node_modules/@jridgewell/resolve-uri": {
|
||||||
@@ -1262,16 +1258,6 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/set-array": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@jridgewell/sourcemap-codec": {
|
"node_modules/@jridgewell/sourcemap-codec": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
||||||
@@ -1280,9 +1266,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/trace-mapping": {
|
"node_modules/@jridgewell/trace-mapping": {
|
||||||
"version": "0.3.25",
|
"version": "0.3.29",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz",
|
||||||
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
|
"integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+13
-9
@@ -4,22 +4,24 @@
|
|||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
"description": "Pure TypeScript media toolkit for reading, writing, and converting media files, directly in the browser.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/mediabunny.js",
|
"main": "./dist/bundles/mediabunny.cjs",
|
||||||
"module": "./dist/mediabunny.mjs",
|
"module": "./dist/modules/index.js",
|
||||||
"types": "./dist/mediabunny.d.ts",
|
"types": "./dist/modules/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
"types": "./dist/mediabunny.d.ts",
|
"types": "./dist/modules/index.d.ts",
|
||||||
"import": "./dist/mediabunny.mjs",
|
"import": "./dist/modules/index.js",
|
||||||
"require": "./dist/mediabunny.js"
|
"require": "./dist/bundles/mediabunny.cjs"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"package.json",
|
"package.json",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"dist"
|
"dist",
|
||||||
|
"src"
|
||||||
],
|
],
|
||||||
|
"sideEffects": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsx scripts/ensure-license-headers.ts && node build.mjs && tsc -p src && api-extractor run && npm run check-docblocks && tsx scripts/append-namespace.ts",
|
"build": "rm -rf dist && tsx scripts/ensure-license-headers.ts && tsc -p src && npm run fix-build-import-paths && node build.mjs && api-extractor run && npm run check-docblocks && npm run append-namespace",
|
||||||
"watch": "node build.mjs --watch",
|
"watch": "node build.mjs --watch",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"check": "tsc -p src --noEmit && tsc -p scripts --noEmit && tsc -p tsconfig.vite.json --noEmit && rm tsconfig.vite.tsbuildinfo",
|
"check": "tsc -p src --noEmit && tsc -p scripts --noEmit && tsc -p tsconfig.vite.json --noEmit && rm tsconfig.vite.tsbuildinfo",
|
||||||
@@ -28,7 +30,9 @@
|
|||||||
"docs:build": "vitepress build docs && npm run examples:build",
|
"docs:build": "vitepress build docs && npm run examples:build",
|
||||||
"docs:preview": "vitepress preview docs",
|
"docs:preview": "vitepress preview docs",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"examples:build": "vite build"
|
"examples:build": "vite build",
|
||||||
|
"fix-build-import-paths": "find dist -name \"*.js\" -type f -exec sed -i -r \"s/ from '([^']+)';/ from '\\1.js';/g\" {} \\;",
|
||||||
|
"append-namespace": "echo 'export as namespace Mediabunny;' >> dist/mediabunny.d.ts"
|
||||||
},
|
},
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import { appendFileSync } from 'fs';
|
|
||||||
|
|
||||||
appendFileSync('dist/mediabunny.d.ts', '\nexport as namespace Mediabunny;');
|
|
||||||
@@ -6,6 +6,9 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// <reference types="dom-mediacapture-transform" preserve="true" />
|
||||||
|
/// <reference types="dom-webcodecs" preserve="true" />
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Output,
|
Output,
|
||||||
OutputOptions,
|
OutputOptions,
|
||||||
|
|||||||
+1
-2
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../build",
|
"outDir": "../dist/modules",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"sourceMap": true,
|
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"noEmit": false
|
"noEmit": false
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ const rollupInput = Object.fromEntries(
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
mediabunny: path.resolve(__dirname, './dist/mediabunny.mjs'),
|
mediabunny: path.resolve(__dirname, './dist/bundles/mediabunny.mjs'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
Reference in New Issue
Block a user