Switched from CommonJS exports to ESM exports
This commit is contained in:
parent
052337aeaa
commit
09871cc01a
BIN
ffmpeg-ffmpeg-0.10.2.tgz
Normal file
BIN
ffmpeg-ffmpeg-0.10.2.tgz
Normal file
Binary file not shown.
@ -8,7 +8,15 @@ const webpackConfig = require('./webpack.config.dev');
|
||||
const compiler = webpack(webpackConfig);
|
||||
const app = express();
|
||||
|
||||
function coi(req, res, next) {
|
||||
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
||||
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
||||
next();
|
||||
}
|
||||
|
||||
app.use(cors());
|
||||
app.use(coi);
|
||||
|
||||
app.use('/', express.static(path.resolve(__dirname, '..')));
|
||||
app.use(middleware(compiler, { publicPath: '/dist', writeToDisk: true }));
|
||||
|
||||
|
@ -3,8 +3,8 @@ const { devDependencies } = require('../../package.json');
|
||||
/*
|
||||
* Default options for browser environment
|
||||
*/
|
||||
module.exports = {
|
||||
corePath: typeof process !== 'undefined' && process.env.NODE_ENV === 'development'
|
||||
const corePath = typeof process !== 'undefined' && process.env.NODE_ENV === 'development'
|
||||
? new URL('/node_modules/@ffmpeg/core/dist/ffmpeg-core.js', import.meta.url).href
|
||||
: `https://unpkg.com/@ffmpeg/core@${devDependencies['@ffmpeg/core'].substring(1)}/dist/ffmpeg-core.js`,
|
||||
};
|
||||
: `https://unpkg.com/@ffmpeg/core@${devDependencies['@ffmpeg/core'].substring(1)}/dist/ffmpeg-core.js`
|
||||
|
||||
export {corePath};
|
||||
|
@ -11,7 +11,7 @@ const readFromBlobOrFile = (blob) => (
|
||||
})
|
||||
);
|
||||
|
||||
module.exports = async (_data) => {
|
||||
export const fetchFile = async (_data) => {
|
||||
let data = _data;
|
||||
if (typeof _data === 'undefined') {
|
||||
return new Uint8Array();
|
||||
|
@ -18,9 +18,9 @@ const toBlobURL = async (url, mimeType) => {
|
||||
return blobURL;
|
||||
};
|
||||
|
||||
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
|
||||
export const getCreateFFmpegCore = async ({ corePath: _corePath }) => {
|
||||
// in Web Worker context
|
||||
module.exports = async ({ corePath: _corePath }) => {
|
||||
if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
|
||||
if (typeof _corePath !== 'string') {
|
||||
throw Error('corePath should be a string!');
|
||||
}
|
||||
@ -59,9 +59,7 @@ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScop
|
||||
wasmPath,
|
||||
workerPath,
|
||||
});
|
||||
};
|
||||
} else {
|
||||
module.exports = async ({ corePath: _corePath }) => {
|
||||
if (typeof _corePath !== 'string') {
|
||||
throw Error('corePath should be a string!');
|
||||
}
|
||||
@ -107,6 +105,8 @@ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScop
|
||||
wasmPath,
|
||||
workerPath,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
const defaultOptions = require('./defaultOptions');
|
||||
const getCreateFFmpegCore = require('./getCreateFFmpegCore');
|
||||
const fetchFile = require('./fetchFile');
|
||||
const {getCreateFFmpegCore} = require('./getCreateFFmpegCore');
|
||||
const {fetchFile} = require('./fetchFile');
|
||||
|
||||
module.exports = {
|
||||
defaultOptions,
|
||||
getCreateFFmpegCore,
|
||||
fetchFile,
|
||||
};
|
||||
export {defaultOptions, getCreateFFmpegCore, fetchFile};
|
@ -2,7 +2,7 @@ require('regenerator-runtime/runtime');
|
||||
const createFFmpeg = require('./createFFmpeg');
|
||||
const { fetchFile } = require('./node');
|
||||
|
||||
module.exports = {
|
||||
export {
|
||||
/*
|
||||
* Create ffmpeg instance.
|
||||
* Each ffmpeg instance owns an isolated MEMFS and works
|
||||
|
Loading…
Reference in New Issue
Block a user