From 12ace068f21017bf787709861d5a985ff9ec98b5 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 28 Jul 2023 04:55:46 -0400 Subject: [PATCH] add platforms option platform stuff is still mostly special cased but --- index.mjs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.mjs b/index.mjs index 3475f63..e85a324 100644 --- a/index.mjs +++ b/index.mjs @@ -5,12 +5,17 @@ import {resolve, basename, extname, dirname, relative, join} from 'node:path'; export function buildConfig ({ manifest: manifestPathRelative, + platforms = [], scriptPlugins = [], sourcemap, }) { const manifestPath = resolve(process.cwd(), manifestPathRelative); const manifestDirname = dirname(manifestPath); + if (!platforms.length) { + throw new Error('No platforms specified'); + } + // Load the manifest let manifestContent; try { @@ -110,8 +115,7 @@ export function buildConfig ({ const {scripts, styles, assets} = getEntryPointsFromManifest(manifestContent); - const platform = 'firefox'; - return [ + return platforms.flatMap(platform => [ ...scripts.map(entrypointPath => ({ input: relative(process.cwd(), entrypointPath), output: { @@ -165,5 +169,5 @@ export function buildConfig ({ }, ], }, - ]; + ]); }