From 1c7e77b8546ac32b8176ab54dd06ede6ba7deb55 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Wed, 2 Oct 2024 10:12:46 +0800 Subject: style: switch to standardjs --- rollup.config.js | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'rollup.config.js') diff --git a/rollup.config.js b/rollup.config.js index 75db905..cc42bf0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,70 +1,70 @@ -import node from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; -import { existsSync } from 'fs'; -import { join } from 'path'; -import { bundleStats } from 'rollup-plugin-bundle-stats'; +import node from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' +import terser from '@rollup/plugin-terser' +import { existsSync } from 'fs' +import { join } from 'path' +import { bundleStats } from 'rollup-plugin-bundle-stats' -const production = !process.env.ROLLUP_WATCH; +const production = !process.env.ROLLUP_WATCH const general = { output: [ { dir: './dist', format: 'esm', - entryFileNames: '[name].mjs', + entryFileNames: '[name].mjs' } ], watch: { clearScreen: false, - include: ["src/**", "mapclay/dist/mapclay.mjs"] + include: ['src/**', 'mapclay/dist/mapclay.mjs'] }, - context: "window", + context: 'window', plugins: [ { name: 'watch-mapclay', - buildStart() { - const mapclayPath = join(process.cwd(), 'mapclay', 'dist', 'mapclay.mjs'); - console.log('Watching:', mapclayPath); + buildStart () { + const mapclayPath = join(process.cwd(), 'mapclay', 'dist', 'mapclay.mjs') + console.log('Watching:', mapclayPath) if (existsSync(mapclayPath)) { - this.addWatchFile(mapclayPath); + this.addWatchFile(mapclayPath) } else { - console.log('mapclay.mjs not found at:', mapclayPath); + console.log('mapclay.mjs not found at:', mapclayPath) } } }, { name: 'leader-line', - transform(code, id) { + transform (code, id) { if (id.includes('node_modules/leader-line/')) { - return `${code}\nexport default LeaderLine;`; + return `${code}\nexport default LeaderLine;` } - return null; - }, + return null + } }, { name: 'mapclay', - resolveId(source) { + resolveId (source) { if (source === 'mapclay' && existsSync(join('.', 'mapclay'))) { - return './mapclay/dist/mapclay.mjs'; + return './mapclay/dist/mapclay.mjs' } - return null; + return null } }, node(), commonjs(), production && terser(), - // bundleStats(), - ], + production && bundleStats() + ] } export default [ { - input: "src/editor.mjs", + input: 'src/editor.mjs' }, { - input: "src/dumbymap.mjs", - }, + input: 'src/dumbymap.mjs' + } ] .map(config => ({ ...general, ...config })) .filter((config) => production || config.input.match(/editor/)) -- cgit v1.2.3-70-g09d2