Skip to content

Commit

Permalink
Update to correct rollup terser version
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrasser committed Nov 9, 2023
1 parent 07fbde0 commit babce6c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 100 deletions.
123 changes: 42 additions & 81 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.4",
"chai": "^4.3.4",
"copyfiles": "^2.4.1",
"coveralls": "^3.1.0",
Expand All @@ -61,7 +62,6 @@
"react-dom": "^18.0.0",
"request": "^2.88.2",
"rollup": "^2.42.1",
"rollup-plugin-terser": "^7.0.2",
"sinon": "^17.0.0",
"typescript": "^5.0.2"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/linkifyjs/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import { plugins } from '../../rollup.config';

export default [
Expand All @@ -8,8 +8,8 @@ export default [
{ file: 'dist/linkify.js', name: 'linkify', format: 'iife' },
{ file: 'dist/linkify.min.js', name: 'linkify', format: 'iife', plugins: [terser()] },
{ file: 'dist/linkify.cjs.js', format: 'cjs', exports: 'auto' },
{ file: 'dist/linkify.es.js', format: 'es' }
{ file: 'dist/linkify.es.js', format: 'es' },
],
plugins
}
plugins,
},
];
30 changes: 16 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';

export const plugins = [
resolve(),
commonjs(),
babel({ babelHelpers: 'bundled' })
];
export const plugins = [resolve(), commonjs(), babel({ babelHelpers: 'bundled' })];

// For interfaces in their dedicated packages
export function linkifyInterface(name, opts = {}) {
const iifeOpts = { name };
const globals = { linkifyjs: 'linkify' };
const external = ['linkifyjs'];
if ('globalName' in opts) { iifeOpts.name = opts.globalName; }
if ('globals' in opts) { Object.assign(globals, opts.globals); }
if ('external' in opts) { external.push(...opts.external); }
if ('globalName' in opts) {
iifeOpts.name = opts.globalName;
}
if ('globals' in opts) {
Object.assign(globals, opts.globals);
}
if ('external' in opts) {
external.push(...opts.external);
}

return {
input: `src/linkify-${name}.js`,
Expand All @@ -27,7 +29,7 @@ export function linkifyInterface(name, opts = {}) {
{ file: `dist/linkify-${name}.cjs.js`, format: 'cjs', exports: 'auto' },
{ file: `dist/linkify-${name}.es.js`, format: 'es' },
],
plugins
plugins,
};
}

Expand All @@ -36,16 +38,16 @@ export function linkifyInterface(name, opts = {}) {
// v2. Will change in v4
export function linkifyPlugin(plugin, opts = {}) {
const name = opts.globalName || false; // Most plugins don't export anything
const globals = { linkifyjs: 'linkify' };
const globals = { linkifyjs: 'linkify' };
return {
input: 'src/index.js',
external: ['linkifyjs'],
output: [
{ file: `dist/linkify-plugin-${plugin}.js`, format: 'iife', globals, name },
{ file: `dist/linkify-plugin-${plugin}.min.js`, format: 'iife', globals, name, plugins: [terser()] },
{ file: `dist/linkify-plugin-${plugin}.cjs.js`, format: 'cjs', exports: 'auto'},
{ file: `dist/linkify-plugin-${plugin}.es.js`, format: 'es' }
{ file: `dist/linkify-plugin-${plugin}.cjs.js`, format: 'cjs', exports: 'auto' },
{ file: `dist/linkify-plugin-${plugin}.es.js`, format: 'es' },
],
plugins
plugins,
};
}

0 comments on commit babce6c

Please sign in to comment.