Skip to content

Commit

Permalink
Update rollup to v4
Browse files Browse the repository at this point in the history
and the plugins
  • Loading branch information
tjenkinson committed Oct 8, 2023
1 parent 9fd2ec3 commit c0811ec
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 101 deletions.
30 changes: 16 additions & 14 deletions build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ const buildConstants = (type, additional = {}) => ({
},
});

const buildOnLog = ({ allowCircularDeps } = {}) => {
return (level, log, handler) => {
if (allowCircularDeps && log.code === 'CIRCULAR_DEPENDENCY') return;

if (level === 'warn') {
// treat warnings as errors
handler('error', log);
} else {
handler(level, log);
}
};
};

const workerFnBanner = '(function __HLS_WORKER_BUNDLE__(__IN_WORKER__){';
const workerFnFooter = '})(false);';

Expand Down Expand Up @@ -254,12 +267,7 @@ const buildRollupConfig = ({

return {
input: './src/hls.ts',
onwarn: (e) => {
if (allowCircularDeps && e.code === 'CIRCULAR_DEPENDENCY') return;

// treat warnings as errors
throw new Error(e);
},
onLog: buildOnLog({ allowCircularDeps }),
output: {
name: 'Hls',
file: outputFile
Expand Down Expand Up @@ -328,10 +336,7 @@ const configs = Object.entries({
}),
worker: {
input: './src/demux/transmuxer-worker.ts',
onwarn: (e) => {
// treat warnings as errors
throw new Error(e);
},
onLog: buildOnLog(),
output: {
name: 'HlsWorker',
file: './dist/hls.worker.js',
Expand All @@ -352,10 +357,7 @@ const configs = Object.entries({
},
demo: {
input: './demo/main.js',
onwarn: (e) => {
// treat warnings as errors
throw new Error(e);
},
onLog: buildOnLog(),
output: {
name: 'HlsDemo',
file: './dist/hls-demo.js',
Expand Down
Loading

0 comments on commit c0811ec

Please sign in to comment.