From 8bc53613b09d8d80d741a02eeb2db33b0524f40f Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 28 Jul 2023 04:49:34 -0400 Subject: [PATCH] refactor to use single options object --- index.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.mjs b/index.mjs index 28eea7f..caac7a1 100644 --- a/index.mjs +++ b/index.mjs @@ -3,7 +3,11 @@ import {readFileSync} from 'node:fs'; import {resolve, basename, extname, dirname, relative, join} from 'node:path'; -export function createConfig (manifestPathRelative, options, createConfig) { +export function createConfig ({ + manifest: manifestPathRelative, + scriptPlugins = [], + sourcemap, +}) { const manifestPath = resolve(process.cwd(), manifestPathRelative); const manifestDirname = dirname(manifestPath); @@ -109,15 +113,13 @@ export function createConfig (manifestPathRelative, options, createConfig) { const platform = 'firefox'; return [ ...scripts.map(entrypointPath => ({ - // Get configuration options for this entrypoint from the caller - ...createConfig(), - // Overwrite input and output options input: relative(process.cwd(), entrypointPath), output: { file: getOutputPathRelative('build', platform, entrypointPath, 'js'), format: 'iife', - sourcemap: options.sourcemap, + sourcemap, }, + plugins: scriptPlugins, })), // A special step that processes the manifest and copies over non-JS